001: /*******************************************************************************
002: * Copyright (c) 2007 IBM Corporation and others.
003: * All rights reserved. This program and the accompanying materials
004: * are made available under the terms of the Eclipse Public License v1.0
005: * which accompanies this distribution, and is available at
006: * http://www.eclipse.org/legal/epl-v10.html
007: *
008: * Contributors:
009: * IBM Corporation - initial API and implementation
010: ******************************************************************************/package org.eclipse.ui.internal.tweaklets;
011:
012: import org.eclipse.jface.preference.IPreferenceStore;
013: import org.eclipse.swt.widgets.Button;
014: import org.eclipse.swt.widgets.Composite;
015: import org.eclipse.ui.IEditorInput;
016: import org.eclipse.ui.IEditorReference;
017: import org.eclipse.ui.internal.EditorAreaHelper;
018: import org.eclipse.ui.internal.EditorManager;
019: import org.eclipse.ui.internal.IPreferenceConstants;
020: import org.eclipse.ui.internal.WorkbenchPage;
021: import org.eclipse.ui.internal.WorkbenchPlugin;
022: import org.eclipse.ui.internal.registry.EditorDescriptor;
023: import org.eclipse.ui.internal.tweaklets.Tweaklets.TweakKey;
024:
025: /**
026: * @since 3.3
027: *
028: */
029: public abstract class TabBehaviour {
030:
031: public static TweakKey KEY = new Tweaklets.TweakKey(
032: TabBehaviour.class);
033:
034: static {
035: Tweaklets.setDefault(TabBehaviour.KEY, new TabBehaviourMRU());
036: }
037:
038: /**
039: *
040: * @return
041: */
042: public abstract boolean alwaysShowPinAction();
043:
044: /**
045: *
046: * @param page
047: * @return
048: */
049: public abstract IEditorReference findReusableEditor(
050: WorkbenchPage page);
051:
052: public abstract IEditorReference reuseInternalEditor(
053: WorkbenchPage page, EditorManager manager,
054: EditorAreaHelper editorPresentation, EditorDescriptor desc,
055: IEditorInput input, IEditorReference reusableEditorRef);
056:
057: /**
058: * Does nothing by default. Can be overridden by subclasses.
059: *
060: * @param editorReuseGroup
061: * @param showMultipleEditorTabs
062: */
063: public void setPreferenceVisibility(Composite editorReuseGroup,
064: Button showMultipleEditorTabs) {
065: }
066:
067: /**
068: * @return
069: */
070: public boolean autoPinOnDirty() {
071: return false;
072: }
073:
074: /**
075: * @return
076: */
077: public boolean isPerTabHistoryEnabled() {
078: return false;
079: }
080:
081: /**
082: * @param originalMatchFlags
083: * @return
084: */
085: public int getReuseEditorMatchFlags(int originalMatchFlags) {
086: return originalMatchFlags;
087: }
088:
089: /**
090: * @return
091: */
092: public int getEditorReuseThreshold() {
093: IPreferenceStore store = WorkbenchPlugin.getDefault()
094: .getPreferenceStore();
095: return store.getInt(IPreferenceConstants.REUSE_EDITORS);
096: }
097:
098: /**
099: * @return
100: */
101: public boolean enableMRUTabVisibility() {
102: return true;
103: }
104:
105: }
|