KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > tweaklets > TabBehaviour


1 /*******************************************************************************
2  * Copyright (c) 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  ******************************************************************************/

11
12 package org.eclipse.ui.internal.tweaklets;
13
14 import org.eclipse.jface.preference.IPreferenceStore;
15 import org.eclipse.swt.widgets.Button;
16 import org.eclipse.swt.widgets.Composite;
17 import org.eclipse.ui.IEditorInput;
18 import org.eclipse.ui.IEditorReference;
19 import org.eclipse.ui.internal.EditorAreaHelper;
20 import org.eclipse.ui.internal.EditorManager;
21 import org.eclipse.ui.internal.IPreferenceConstants;
22 import org.eclipse.ui.internal.WorkbenchPage;
23 import org.eclipse.ui.internal.WorkbenchPlugin;
24 import org.eclipse.ui.internal.registry.EditorDescriptor;
25 import org.eclipse.ui.internal.tweaklets.Tweaklets.TweakKey;
26
27 /**
28  * @since 3.3
29  *
30  */

31 public abstract class TabBehaviour {
32
33     public static TweakKey KEY = new Tweaklets.TweakKey(TabBehaviour.class);
34
35     static {
36         Tweaklets.setDefault(TabBehaviour.KEY, new TabBehaviourMRU());
37     }
38
39     /**
40      *
41      * @return
42      */

43     public abstract boolean alwaysShowPinAction();
44
45     /**
46      *
47      * @param page
48      * @return
49      */

50     public abstract IEditorReference findReusableEditor(WorkbenchPage page);
51
52     public abstract IEditorReference reuseInternalEditor(WorkbenchPage page,
53             EditorManager manager, EditorAreaHelper editorPresentation,
54             EditorDescriptor desc, IEditorInput input,
55             IEditorReference reusableEditorRef);
56
57     /**
58      * Does nothing by default. Can be overridden by subclasses.
59      *
60      * @param editorReuseGroup
61      * @param showMultipleEditorTabs
62      */

63     public void setPreferenceVisibility(Composite editorReuseGroup,
64             Button showMultipleEditorTabs) {
65     }
66
67     /**
68      * @return
69      */

70     public boolean autoPinOnDirty() {
71         return false;
72     }
73
74     /**
75      * @return
76      */

77     public boolean isPerTabHistoryEnabled() {
78         return false;
79     }
80
81     /**
82      * @param originalMatchFlags
83      * @return
84      */

85     public int getReuseEditorMatchFlags(int originalMatchFlags) {
86         return originalMatchFlags;
87     }
88
89     /**
90      * @return
91      */

92     public int getEditorReuseThreshold() {
93         IPreferenceStore store = WorkbenchPlugin.getDefault()
94                 .getPreferenceStore();
95         return store.getInt(IPreferenceConstants.REUSE_EDITORS);
96     }
97
98     /**
99      * @return
100      */

101     public boolean enableMRUTabVisibility() {
102         return true;
103     }
104
105 }
106
Popular Tags