Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/WorkingSetDescriptor.java')
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/WorkingSetDescriptor.java328
1 files changed, 158 insertions, 170 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/WorkingSetDescriptor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/WorkingSetDescriptor.java
index 10e298aaf80..c9083be7664 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/WorkingSetDescriptor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/WorkingSetDescriptor.java
@@ -30,114 +30,107 @@ import org.eclipse.ui.internal.WorkbenchPlugin;
import org.eclipse.ui.plugin.AbstractUIPlugin;
/**
- * A working set descriptor stores the plugin registry data for
- * a working set page extension.
+ * A working set descriptor stores the plugin registry data for a working set
+ * page extension.
*
* @since 2.0
*/
public class WorkingSetDescriptor implements IPluginContribution {
- private String id;
+ private String id;
- private String name;
+ private String name;
- private String icon;
+ private String icon;
- private String pageClassName;
+ private String pageClassName;
- private String updaterClassName;
+ private String updaterClassName;
- private IConfigurationElement configElement;
+ private IConfigurationElement configElement;
- private String[] classTypes;
+ private String[] classTypes;
private String[] adapterTypes;
- private static final String ATT_ID = "id"; //$NON-NLS-1$
+ private static final String ATT_ID = "id"; //$NON-NLS-1$
- private static final String ATT_NAME = "name"; //$NON-NLS-1$
+ private static final String ATT_NAME = "name"; //$NON-NLS-1$
- private static final String ATT_ICON = "icon"; //$NON-NLS-1$
+ private static final String ATT_ICON = "icon"; //$NON-NLS-1$
- private static final String ATT_PAGE_CLASS = "pageClass"; //$NON-NLS-1$
+ private static final String ATT_PAGE_CLASS = "pageClass"; //$NON-NLS-1$
- private static final String ATT_UPDATER_CLASS = "updaterClass"; //$NON-NLS-1$
+ private static final String ATT_UPDATER_CLASS = "updaterClass"; //$NON-NLS-1$
- private static final String ATT_ELEMENT_ADAPTER_CLASS = "elementAdapterClass"; //$NON-NLS-1$
+ private static final String ATT_ELEMENT_ADAPTER_CLASS = "elementAdapterClass"; //$NON-NLS-1$
- private static final String TAG_APPLICABLE_TYPE = "applicableType"; //$NON-NLS-1$
+ private static final String TAG_APPLICABLE_TYPE = "applicableType"; //$NON-NLS-1$
- /**
- * Creates a descriptor from a configuration element.
- *
- * @param configElement configuration element to create a descriptor from
- */
- public WorkingSetDescriptor(IConfigurationElement configElement)
- throws CoreException {
- super();
- this.configElement = configElement;
- id = configElement.getAttribute(ATT_ID);
- name = configElement.getAttribute(ATT_NAME);
- icon = configElement.getAttribute(ATT_ICON);
- pageClassName = configElement.getAttribute(ATT_PAGE_CLASS);
- updaterClassName = configElement.getAttribute(ATT_UPDATER_CLASS);
-
- if (name == null) {
- throw new CoreException(new Status(IStatus.ERROR,
- WorkbenchPlugin.PI_WORKBENCH, 0,
- "Invalid extension (missing class name): " + id, //$NON-NLS-1$
- null));
- }
+ /**
+ * Creates a descriptor from a configuration element.
+ *
+ * @param configElement configuration element to create a descriptor from
+ */
+ public WorkingSetDescriptor(IConfigurationElement configElement) throws CoreException {
+ super();
+ this.configElement = configElement;
+ id = configElement.getAttribute(ATT_ID);
+ name = configElement.getAttribute(ATT_NAME);
+ icon = configElement.getAttribute(ATT_ICON);
+ pageClassName = configElement.getAttribute(ATT_PAGE_CLASS);
+ updaterClassName = configElement.getAttribute(ATT_UPDATER_CLASS);
+
+ if (name == null) {
+ throw new CoreException(new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, 0,
+ "Invalid extension (missing class name): " + id, //$NON-NLS-1$
+ null));
+ }
- IConfigurationElement[] containsChildren = configElement
- .getChildren(TAG_APPLICABLE_TYPE);
+ IConfigurationElement[] containsChildren = configElement.getChildren(TAG_APPLICABLE_TYPE);
if (containsChildren.length > 0) {
List byClassList = new ArrayList(containsChildren.length);
List byAdapterList = new ArrayList(containsChildren.length);
for (IConfigurationElement child : containsChildren) {
- String className = child
- .getAttribute(IWorkbenchRegistryConstants.ATT_CLASS);
+ String className = child.getAttribute(IWorkbenchRegistryConstants.ATT_CLASS);
if (className != null)
byClassList.add(className);
- if ("true".equals(child.getAttribute(IWorkbenchRegistryConstants.ATT_ADAPTABLE))) //$NON-NLS-1$
+ if ("true".equals(child.getAttribute(IWorkbenchRegistryConstants.ATT_ADAPTABLE))) //$NON-NLS-1$
byAdapterList.add(className);
}
if (!byClassList.isEmpty()) {
- classTypes = (String[]) byClassList.toArray(new String[byClassList
- .size()]);
+ classTypes = (String[]) byClassList.toArray(new String[byClassList.size()]);
Arrays.sort(classTypes);
}
if (!byAdapterList.isEmpty()) {
- adapterTypes = (String[]) byAdapterList.toArray(new String[byAdapterList
- .size()]);
+ adapterTypes = (String[]) byAdapterList.toArray(new String[byAdapterList.size()]);
Arrays.sort(adapterTypes);
}
}
- }
-
- /**
- * Returns the name space that declares this working set.
- *
- * @return the name space declaring this working set
- */
- public String getDeclaringNamespace() {
+ }
+
+ /**
+ * Returns the name space that declares this working set.
+ *
+ * @return the name space declaring this working set
+ */
+ public String getDeclaringNamespace() {
return configElement.getContributor().getName();
- }
+ }
- /**
- * Return the namespace that contains the class referenced by the
- * updaterClass. May be the bundle that declared this extension or another
- * bundle that contains the referenced class.
+ /**
+ * Return the namespace that contains the class referenced by the updaterClass.
+ * May be the bundle that declared this extension or another bundle that
+ * contains the referenced class.
*
* @return the namespace
* @since 3.3
*/
public String getUpdaterNamespace() {
- return WorkbenchPlugin.getBundleForExecutableExtension(configElement,
- ATT_UPDATER_CLASS).getSymbolicName();
+ return WorkbenchPlugin.getBundleForExecutableExtension(configElement, ATT_UPDATER_CLASS).getSymbolicName();
}
- /**
+ /**
* Return the namespace that contains the class referenced by the
* elementAdapterClass. May be the bundle that declared this extension or
* another bundle that contains the referenced class.
@@ -146,86 +139,82 @@ public class WorkingSetDescriptor implements IPluginContribution {
* @since 3.3
*/
public String getElementAdapterNamespace() {
- return WorkbenchPlugin.getBundleForExecutableExtension(configElement,
- ATT_UPDATER_CLASS).getSymbolicName();
+ return WorkbenchPlugin.getBundleForExecutableExtension(configElement, ATT_UPDATER_CLASS).getSymbolicName();
}
- /**
+ /**
* Creates a working set page from this extension descriptor.
*
* @return a working set page created from this extension descriptor.
*/
- public IWorkingSetPage createWorkingSetPage() {
- Object page = null;
-
- if (pageClassName != null) {
- try {
- page = WorkbenchPlugin.createExtension(configElement,
- ATT_PAGE_CLASS);
- } catch (CoreException exception) {
- WorkbenchPlugin.log("Unable to create working set page: " + //$NON-NLS-1$
- pageClassName, exception.getStatus());
- }
- }
- return (IWorkingSetPage) page;
- }
-
- /**
- * Returns the page's icon
- *
- * @return the page's icon
- */
- public ImageDescriptor getIcon() {
- if (icon == null) {
+ public IWorkingSetPage createWorkingSetPage() {
+ Object page = null;
+
+ if (pageClassName != null) {
+ try {
+ page = WorkbenchPlugin.createExtension(configElement, ATT_PAGE_CLASS);
+ } catch (CoreException exception) {
+ WorkbenchPlugin.log("Unable to create working set page: " + //$NON-NLS-1$
+ pageClassName, exception.getStatus());
+ }
+ }
+ return (IWorkingSetPage) page;
+ }
+
+ /**
+ * Returns the page's icon
+ *
+ * @return the page's icon
+ */
+ public ImageDescriptor getIcon() {
+ if (icon == null) {
return null;
}
- IExtension extension = configElement.getDeclaringExtension();
+ IExtension extension = configElement.getDeclaringExtension();
String extendingPluginId = extension.getContributor().getName();
- return AbstractUIPlugin.imageDescriptorFromPlugin(extendingPluginId,
- icon);
- }
-
- /**
- * Returns the working set page id.
- *
- * @return the working set page id.
- */
- public String getId() {
- return id;
- }
-
- /**
- * Returns the working set page class name
- *
- * @return the working set page class name or <code>null</code> if
- * no page class name has been provided by the extension
- */
- public String getPageClassName() {
- return pageClassName;
- }
-
- /**
- * Returns the name of the working set element type the
- * page works with.
- *
- * @return the working set element type name
- */
- public String getName() {
- return name;
- }
-
- /**
- * Returns the working set updater class name
- *
- * @return the working set updater class name or <code>null</code> if
- * no updater class name has been provided by the extension
- */
- public String getUpdaterClassName() {
- return updaterClassName;
- }
-
- /**
+ return AbstractUIPlugin.imageDescriptorFromPlugin(extendingPluginId, icon);
+ }
+
+ /**
+ * Returns the working set page id.
+ *
+ * @return the working set page id.
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * Returns the working set page class name
+ *
+ * @return the working set page class name or <code>null</code> if no page class
+ * name has been provided by the extension
+ */
+ public String getPageClassName() {
+ return pageClassName;
+ }
+
+ /**
+ * Returns the name of the working set element type the page works with.
+ *
+ * @return the working set element type name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Returns the working set updater class name
+ *
+ * @return the working set updater class name or <code>null</code> if no updater
+ * class name has been provided by the extension
+ */
+ public String getUpdaterClassName() {
+ return updaterClassName;
+ }
+
+ /**
* Creates a working set element adapter.
*
* @return the element adapter or <code>null</code> if no adapter has been
@@ -236,8 +225,8 @@ public class WorkingSetDescriptor implements IPluginContribution {
return null;
IWorkingSetElementAdapter result = null;
try {
- result = (IWorkingSetElementAdapter) WorkbenchPlugin
- .createExtension(configElement, ATT_ELEMENT_ADAPTER_CLASS);
+ result = (IWorkingSetElementAdapter) WorkbenchPlugin.createExtension(configElement,
+ ATT_ELEMENT_ADAPTER_CLASS);
} catch (CoreException exception) {
WorkbenchPlugin.log("Unable to create working set element adapter: " + //$NON-NLS-1$
result, exception.getStatus());
@@ -245,45 +234,45 @@ public class WorkingSetDescriptor implements IPluginContribution {
return result;
}
- /**
+ /**
* Creates a working set updater.
*
- * @return the working set updater or <code>null</code> if no updater has
- * been declared
+ * @return the working set updater or <code>null</code> if no updater has been
+ * declared
*/
- public IWorkingSetUpdater createWorkingSetUpdater() {
- if (updaterClassName == null) {
+ public IWorkingSetUpdater createWorkingSetUpdater() {
+ if (updaterClassName == null) {
return null;
}
- IWorkingSetUpdater result = null;
- try {
- result = (IWorkingSetUpdater)WorkbenchPlugin.createExtension(configElement, ATT_UPDATER_CLASS);
- } catch (CoreException exception) {
- WorkbenchPlugin.log("Unable to create working set updater: " + //$NON-NLS-1$
- updaterClassName, exception.getStatus());
- }
- return result;
- }
-
- public boolean isUpdaterClassLoaded() {
- return WorkbenchPlugin.isBundleLoadedForExecutableExtension(configElement, ATT_UPDATER_CLASS);
- }
-
- public boolean isElementAdapterClassLoaded() {
- return WorkbenchPlugin.isBundleLoadedForExecutableExtension(configElement, ATT_ELEMENT_ADAPTER_CLASS);
- }
-
- /**
- * Returns whether working sets based on this descriptor are editable.
- *
- * @return <code>true</code> if working sets based on this descriptor are editable; otherwise
- * <code>false</code>
- *
- * @since 3.1
- */
- public boolean isEditable() {
- return getPageClassName() != null;
- }
+ IWorkingSetUpdater result = null;
+ try {
+ result = (IWorkingSetUpdater) WorkbenchPlugin.createExtension(configElement, ATT_UPDATER_CLASS);
+ } catch (CoreException exception) {
+ WorkbenchPlugin.log("Unable to create working set updater: " + //$NON-NLS-1$
+ updaterClassName, exception.getStatus());
+ }
+ return result;
+ }
+
+ public boolean isUpdaterClassLoaded() {
+ return WorkbenchPlugin.isBundleLoadedForExecutableExtension(configElement, ATT_UPDATER_CLASS);
+ }
+
+ public boolean isElementAdapterClassLoaded() {
+ return WorkbenchPlugin.isBundleLoadedForExecutableExtension(configElement, ATT_ELEMENT_ADAPTER_CLASS);
+ }
+
+ /**
+ * Returns whether working sets based on this descriptor are editable.
+ *
+ * @return <code>true</code> if working sets based on this descriptor are
+ * editable; otherwise <code>false</code>
+ *
+ * @since 3.1
+ */
+ public boolean isEditable() {
+ return getPageClassName() != null;
+ }
@Override
public String getLocalId() {
@@ -312,8 +301,7 @@ public class WorkingSetDescriptor implements IPluginContribution {
* @since 3.4
*/
public String getDescription() {
- String description = configElement
- .getAttribute(IWorkbenchRegistryConstants.ATT_DESCRIPTION);
+ String description = configElement.getAttribute(IWorkbenchRegistryConstants.ATT_DESCRIPTION);
if (description == null)
description = ""; //$NON-NLS-1$
return description;

Back to the top