001: /*******************************************************************************
002: * Copyright (c) 2005, 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;
011:
012: import org.eclipse.core.expressions.IEvaluationContext;
013:
014: /**
015: * <p>
016: * A source is type of event change that can occur within the workbench. For
017: * example, the active workbench window can change, so it is considered a
018: * source. Workbench services can track changes to these sources, and thereby
019: * try to resolve conflicts between a variety of possible options. This is most
020: * commonly used for things like handlers and contexts.
021: * </p>
022: * <p>
023: * This interface defines the source that are known to the workbench at
024: * compile-time. These sources can be combined in a bit-wise fashion. So, for
025: * example, a <code>ACTIVE_PART | ACTIVE_CONTEXT</code> source includes change
026: * to both the active context and the active part.
027: * </p>
028: * <p>
029: * The values assigned to each source indicates its relative priority. The
030: * higher the value, the more priority the source is given in resolving
031: * conflicts. Another way to look at this is that the higher the value, the more
032: * "local" the source is to what the user is currently doing. This is similar
033: * to, but distinct from the concept of components. The nesting support provided
034: * by components represent only one source (<code>ACTIVE_SITE</code>) that
035: * the workbench understands.
036: * </p>
037: * <p>
038: * Note that for backward compatibility, we must reserve the lowest three bits
039: * for <code>Priority</code> instances using the old
040: * <code>HandlerSubmission</code> mechanism. This mechanism was used in
041: * Eclipse 3.0.
042: * </p>
043: * <p>
044: * <b>Note in 3.3:</b>
045: * </p>
046: * <p>
047: * Currently, source variables are not extensible by user plugins, and
048: * the number of bits available for resolving conflicts is limited. When
049: * the variable sources become user extensible a new conflict resolution
050: * mechanism will be implemented.
051: * </p>
052: * <p>
053: * This interface is not intended to be implemented or extended by clients.
054: * </p>
055: *
056: * @see org.eclipse.ui.ISourceProvider
057: * @since 3.1
058: */
059: public interface ISources {
060:
061: /**
062: * The priority given to default handlers and handlers that are active
063: * across the entire workbench.
064: */
065: public static final int WORKBENCH = 0;
066:
067: /**
068: * The priority given when the activation is defined by a handler submission
069: * with a legacy priority.
070: */
071: public static final int LEGACY_LEGACY = 1;
072:
073: /**
074: * The priority given when the activation is defined by a handler submission
075: * with a low priority.
076: */
077: public static final int LEGACY_LOW = 1 << 1;
078:
079: /**
080: * The priority given when the activation is defined by a handler submission
081: * with a medium priority.
082: */
083: public static final int LEGACY_MEDIUM = 1 << 2;
084:
085: /**
086: * The priority given when the source includes a particular context.
087: */
088: public static final int ACTIVE_CONTEXT = 1 << 6;
089:
090: /**
091: * The variable name for the active contexts. This is for use with the
092: * <code>ISourceProvider</code> and <code>IEvaluationContext</code>.
093: * @since 3.2
094: */
095: public static final String ACTIVE_CONTEXT_NAME = "activeContexts"; //$NON-NLS-1$
096:
097: /**
098: * The priority given when the source includes a particular action set.
099: * @since 3.2
100: */
101: public static final int ACTIVE_ACTION_SETS = 1 << 8;
102:
103: /**
104: * The variable name for the active action sets. This is for use with the
105: * {@link ISourceProvider} and {@link IEvaluationContext}.
106: * @since 3.2
107: */
108: public static final String ACTIVE_ACTION_SETS_NAME = "activeActionSets"; //$NON-NLS-1$
109:
110: /**
111: * The priority given when the source includes the currently active shell.
112: */
113: public static final int ACTIVE_SHELL = 1 << 10;
114:
115: /**
116: * The variable name for the active shell. This is for use with the
117: * <code>ISourceProvider</code> and <code>IEvaluationContext</code>.
118: */
119: public static final String ACTIVE_SHELL_NAME = "activeShell"; //$NON-NLS-1$
120:
121: /**
122: * The priority given when the source includes the currently active
123: * workbench window shell.
124: * @since 3.2
125: */
126: public static final int ACTIVE_WORKBENCH_WINDOW_SHELL = 1 << 12;
127:
128: /**
129: * The variable name for the active workbench window shell. This is for use
130: * with the <code>ISourceProvider</code> and
131: * <code>IEvaluationContext</code>.
132: * @since 3.2
133: */
134: public static final String ACTIVE_WORKBENCH_WINDOW_SHELL_NAME = "activeWorkbenchWindowShell"; //$NON-NLS-1$
135:
136: /**
137: * The priority given when the source includes the currently active
138: * workbench window.
139: */
140: public static final int ACTIVE_WORKBENCH_WINDOW = 1 << 14;
141:
142: /**
143: * The variable name for the active workbench window. This is for use with
144: * the <code>ISourceProvider</code> and <code>IEvaluationContext</code>.
145: */
146: public static final String ACTIVE_WORKBENCH_WINDOW_NAME = "activeWorkbenchWindow"; //$NON-NLS-1$
147:
148: /**
149: * The priority given when the source includes subordinate properties of the currently active
150: * workbench window.
151: *
152: * @since 3.3
153: */
154: public static final int ACTIVE_WORKBENCH_WINDOW_SUBORDINATE = 1 << 15;
155:
156: /**
157: * The variable name for the coolbar visibility state of the active
158: * workbench window. This is for use with the <code>ISourceProvider</code>
159: * and <code>IEvaluationContext</code>.
160: *
161: * @since 3.3
162: */
163: public static final String ACTIVE_WORKBENCH_WINDOW_IS_COOLBAR_VISIBLE_NAME = ACTIVE_WORKBENCH_WINDOW_NAME
164: + ".isCoolbarVisible"; //$NON-NLS-1$
165:
166: /**
167: * The variable name for the perspective bar visibility state of the active
168: * workbench window. This is for use with the <code>ISourceProvider</code>
169: * and <code>IEvaluationContext</code>.
170: *
171: * @since 3.3
172: */
173: public static final String ACTIVE_WORKBENCH_WINDOW_IS_PERSPECTIVEBAR_VISIBLE_NAME = ACTIVE_WORKBENCH_WINDOW_NAME
174: + ".isPerspectiveBarVisible"; //$NON-NLS-1$
175:
176: /**
177: * The priority given when the source includes the active editor part.
178: */
179: public static final int ACTIVE_EDITOR = 1 << 16;
180:
181: /**
182: * The variable name for the active editor part. This is for use with the
183: * <code>ISourceProvider</code> and <code>IEvaluationContext</code>.
184: * @since 3.2
185: */
186: public static final String ACTIVE_EDITOR_NAME = "activeEditor"; //$NON-NLS-1$
187:
188: /**
189: * The priority given when the source includes the active editor identifier.
190: *
191: * @since 3.2
192: */
193: public static final int ACTIVE_EDITOR_ID = 1 << 18;
194:
195: /**
196: * The variable name for the active editor identifier. This is for use with
197: * the <code>ISourceProvider</code> and <code>IEvaluationContext</code>.
198: *
199: * @since 3.2
200: */
201: public static final String ACTIVE_EDITOR_ID_NAME = "activeEditorId"; //$NON-NLS-1$
202:
203: /**
204: * The priority given when the source includes the active part.
205: */
206: public static final int ACTIVE_PART = 1 << 20;
207:
208: /**
209: * The variable name for the active part. This is for use with the
210: * <code>ISourceProvider</code> and <code>IEvaluationContext</code>.
211: */
212: public static final String ACTIVE_PART_NAME = "activePart"; //$NON-NLS-1$
213:
214: /**
215: * The priority given when the source includes the active part id.
216: *
217: * @since 3.2
218: */
219: public static final int ACTIVE_PART_ID = 1 << 22;
220:
221: /**
222: * The variable name for the active part id. This is for use with the
223: * <code>ISourceProvider</code> and <code>IEvaluationContext</code>.
224: *
225: * @since 3.2
226: */
227: public static final String ACTIVE_PART_ID_NAME = "activePartId"; //$NON-NLS-1$
228:
229: /**
230: * The priority given when the source includes the active workbench site. In
231: * the case of nesting components, one should be careful to only activate
232: * the most nested component.
233: */
234: public static final int ACTIVE_SITE = 1 << 26;
235:
236: /**
237: * The variable name for the active workbench site. This is for use with the
238: * <code>ISourceProvider</code> and <code>IEvaluationContext</code>.
239: */
240: public static final String ACTIVE_SITE_NAME = "activeSite"; //$NON-NLS-1$
241:
242: /**
243: * The priority given when the source includes the current selection.
244: */
245: public static final int ACTIVE_CURRENT_SELECTION = 1 << 30;
246:
247: /**
248: * The variable name for the active selection. This is for use with the
249: * <code>ISourceProvider</code> and <code>IEvaluationContext</code>.
250: * @since 3.2
251: */
252: public static final String ACTIVE_CURRENT_SELECTION_NAME = "selection"; //$NON-NLS-1$
253:
254: /**
255: * The priority given when the source includes the current menu.
256: * @since 3.2
257: */
258: public static final int ACTIVE_MENU = 1 << 31;
259:
260: /**
261: * The variable name for the active menu. This is for use with the
262: * {@link ISourceProvider} and {@link IEvaluationContext}.
263: * @since 3.2
264: */
265: public static final String ACTIVE_MENU_NAME = "activeMenu"; //$NON-NLS-1$
266:
267: /**
268: * The variable name for the <b>local</b> selection, available while a
269: * context menu is visible.
270: *
271: * @since 3.3
272: */
273: public static final String ACTIVE_MENU_SELECTION_NAME = "activeMenuSelection"; //$NON-NLS-1$
274:
275: /**
276: * The variable name for the <b>local</b> editor input which is sometimes
277: * available while a context menu is visible.
278: *
279: * @since 3.3
280: */
281: public static final String ACTIVE_MENU_EDITOR_INPUT_NAME = "activeMenuEditorInput"; //$NON-NLS-1$
282:
283: /**
284: * The variable name for the active focus Control, when provided by the
285: * IFocusService.
286: *
287: * @since 3.3
288: */
289: public static final String ACTIVE_FOCUS_CONTROL_NAME = "activeFocusControl"; //$NON-NLS-1$
290:
291: /**
292: * The variable name for the active focus Control id, when provided by the
293: * IFocusService.
294: *
295: * @since 3.3
296: */
297: public static final String ACTIVE_FOCUS_CONTROL_ID_NAME = "activeFocusControlId"; //$NON-NLS-1$
298: }
|