Lines 48-56
Link Here
|
48 |
|
48 |
|
49 |
static final String ATT_PATTERN = "pattern"; //$NON-NLS-1$ |
49 |
static final String ATT_PATTERN = "pattern"; //$NON-NLS-1$ |
50 |
|
50 |
|
51 |
private static final String TAG_CONTENT_EXTENSION = "contentExtension"; //$NON-NLS-1$ |
51 |
static final String TAG_CONTENT_EXTENSION = "contentExtension"; //$NON-NLS-1$ |
52 |
|
52 |
|
53 |
private static final String TAG_ACTION_EXTENSION = "actionExtension"; //$NON-NLS-1$ |
53 |
static final String TAG_ACTION_EXTENSION = "actionExtension"; //$NON-NLS-1$ |
|
|
54 |
|
55 |
static final String TAG_COMMAND_MENU_EXTENSION = "commandMenuExtension"; //$NON-NLS-1$ |
54 |
|
56 |
|
55 |
private final String viewerId; |
57 |
private final String viewerId; |
56 |
|
58 |
|
Lines 60-65
Link Here
|
60 |
|
62 |
|
61 |
private Binding contentBinding = new Binding(TAG_CONTENT_EXTENSION); |
63 |
private Binding contentBinding = new Binding(TAG_CONTENT_EXTENSION); |
62 |
|
64 |
|
|
|
65 |
private Binding commandBinding = new Binding(TAG_COMMAND_MENU_EXTENSION); |
66 |
|
63 |
private MenuInsertionPoint[] customInsertionPoints = null; |
67 |
private MenuInsertionPoint[] customInsertionPoints = null; |
64 |
|
68 |
|
65 |
private boolean allowsPlatformContributions = true; |
69 |
private boolean allowsPlatformContributions = true; |
Lines 101-128
Link Here
|
101 |
return popupMenuId != null ? popupMenuId : viewerId; |
105 |
return popupMenuId != null ? popupMenuId : viewerId; |
102 |
} |
106 |
} |
103 |
|
107 |
|
104 |
/** |
|
|
105 |
* Consume an action binding for this viewer. |
106 |
* |
107 |
* @param element |
108 |
* The IConfigurationElement containing a viewerActionBinding |
109 |
* element. |
110 |
*/ |
111 |
public void consumeActionBinding(IConfigurationElement element) { |
112 |
consumeBinding(element, false); |
113 |
} |
114 |
|
115 |
/** |
116 |
* Consume a content binding for this viewer. |
117 |
* |
118 |
* @param element |
119 |
* The IConfigurationElement containing a viewerContentBinding |
120 |
* element. |
121 |
*/ |
122 |
public void consumeContentBinding(IConfigurationElement element) { |
123 |
consumeBinding(element, true); |
124 |
} |
125 |
|
126 |
public boolean isRootExtension(String aContentExtensionId) { |
108 |
public boolean isRootExtension(String aContentExtensionId) { |
127 |
return contentBinding.isRootExtension(aContentExtensionId); |
109 |
return contentBinding.isRootExtension(aContentExtensionId); |
128 |
} |
110 |
} |
Lines 139-144
Link Here
|
139 |
return actionBinding.isVisibleExtension(anActionExtensionId); |
121 |
return actionBinding.isVisibleExtension(anActionExtensionId); |
140 |
} |
122 |
} |
141 |
|
123 |
|
|
|
124 |
public boolean isVisibleCommand(String aCommandId) { |
125 |
return commandBinding.isVisibleExtension(aCommandId); |
126 |
} |
127 |
|
142 |
public boolean hasOverriddenRootExtensions() { |
128 |
public boolean hasOverriddenRootExtensions() { |
143 |
return contentBinding.hasOverriddenRootExtensions(); |
129 |
return contentBinding.hasOverriddenRootExtensions(); |
144 |
} |
130 |
} |
Lines 237-242
Link Here
|
237 |
} |
223 |
} |
238 |
|
224 |
|
239 |
/** |
225 |
/** |
|
|
226 |
* @param binding |
227 |
*/ |
228 |
public void setCommandBinding(Binding binding) { |
229 |
commandBinding = binding; |
230 |
} |
231 |
|
232 |
/** |
233 |
* @return the content Binding |
234 |
*/ |
235 |
public Binding getCommandBinding() { |
236 |
return commandBinding; |
237 |
} |
238 |
|
239 |
/** |
240 |
* @param assistants |
240 |
* @param assistants |
241 |
*/ |
241 |
*/ |
242 |
public void setDragAssistants(Set assistants) { |
242 |
public void setDragAssistants(Set assistants) { |
Lines 328-343
Link Here
|
328 |
return dragAssistants; |
328 |
return dragAssistants; |
329 |
} |
329 |
} |
330 |
|
330 |
|
331 |
private void consumeBinding(IConfigurationElement element, boolean isContent) { |
331 |
/** |
|
|
332 |
* @param element |
333 |
* @param bindingTag |
334 |
*/ |
335 |
public void consumeBinding(IConfigurationElement element, String bindingTag) { |
332 |
IConfigurationElement[] includesElement = element |
336 |
IConfigurationElement[] includesElement = element |
333 |
.getChildren(TAG_INCLUDES); |
337 |
.getChildren(TAG_INCLUDES); |
334 |
|
338 |
|
|
|
339 |
boolean respectRoots = false; |
340 |
Binding binding = null; |
341 |
if (bindingTag.equals(TAG_CONTENT_EXTENSION)) { |
342 |
binding = contentBinding; |
343 |
respectRoots = true; |
344 |
} else if (bindingTag.equals(TAG_ACTION_EXTENSION)) |
345 |
binding = actionBinding; |
346 |
else if (bindingTag.equals(TAG_COMMAND_MENU_EXTENSION)) |
347 |
binding = commandBinding; |
348 |
|
335 |
if (includesElement.length == 1) { |
349 |
if (includesElement.length == 1) { |
336 |
if (isContent) { |
350 |
binding.consumeIncludes(includesElement[0], respectRoots); |
337 |
contentBinding.consumeIncludes(includesElement[0], true); |
|
|
338 |
} else { |
339 |
actionBinding.consumeIncludes(includesElement[0], false); |
340 |
} |
341 |
} else if (includesElement.length >= 1) { |
351 |
} else if (includesElement.length >= 1) { |
342 |
NavigatorPlugin.logError(0, NLS.bind( |
352 |
NavigatorPlugin.logError(0, NLS.bind( |
343 |
CommonNavigatorMessages.Too_many_elements_Warning, |
353 |
CommonNavigatorMessages.Too_many_elements_Warning, |
Lines 353-364
Link Here
|
353 |
.getChildren(TAG_EXCLUDES); |
363 |
.getChildren(TAG_EXCLUDES); |
354 |
|
364 |
|
355 |
if (excludesElement.length == 1) { |
365 |
if (excludesElement.length == 1) { |
356 |
|
366 |
binding.consumeExcludes(excludesElement[0]); |
357 |
if (isContent) { |
|
|
358 |
contentBinding.consumeExcludes(excludesElement[0]); |
359 |
} else { |
360 |
actionBinding.consumeExcludes(excludesElement[0]); |
361 |
} |
362 |
} else if (excludesElement.length >= 1) { |
367 |
} else if (excludesElement.length >= 1) { |
363 |
NavigatorPlugin.logError(0, NLS.bind( |
368 |
NavigatorPlugin.logError(0, NLS.bind( |
364 |
CommonNavigatorMessages.Too_many_elements_Warning, |
369 |
CommonNavigatorMessages.Too_many_elements_Warning, |
Lines 371-374
Link Here
|
371 |
} |
376 |
} |
372 |
} |
377 |
} |
373 |
|
378 |
|
|
|
379 |
void setupFromParent(NavigatorViewerDescriptor parentDesc) { |
380 |
setActionBinding(parentDesc.getActionBinding()); |
381 |
setContentBinding(parentDesc.getContentBinding()); |
382 |
setCommandBinding(parentDesc.getCommandBinding()); |
383 |
setDragAssistants(parentDesc.getDragAssistants()); |
384 |
} |
385 |
|
374 |
} |
386 |
} |