From c7803d38e9dfeae5e842eaca263450268f12a3dc Mon Sep 17 00:00:00 2001
From: Anton Leherbauer
Date: Wed, 21 Sep 2011 13:51:29 +0200
Subject: Bug 366942 - [disassembly] Extension point for contributing ruler
columns
---
.../org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF | 1 +
debug/org.eclipse.cdt.debug.ui/plugin.properties | 3 +
debug/org.eclipse.cdt.debug.ui/plugin.xml | 1 +
.../schema/disassemblyRulerColumns.exsd | 269 ++++++++++++++++++
.../ui/preferences/StringSetSerializer.java | 56 ++++
.../rulers/AbstractContributedRulerColumn.java | 66 +++++
.../ui/disassembly/rulers/IColumnSupport.java | 62 +++++
.../rulers/IContributedRulerColumn.java | 99 +++++++
.../disassembly/rulers/RulerColumnDescriptor.java | 309 +++++++++++++++++++++
.../rulers/RulerColumnPreferenceAdapter.java | 89 ++++++
.../ui/disassembly/rulers/RulerColumnRegistry.java | 294 ++++++++++++++++++++
11 files changed, 1249 insertions(+)
create mode 100644 debug/org.eclipse.cdt.debug.ui/schema/disassemblyRulerColumns.exsd
create mode 100644 debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/StringSetSerializer.java
create mode 100644 debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/disassembly/rulers/AbstractContributedRulerColumn.java
create mode 100644 debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/disassembly/rulers/IColumnSupport.java
create mode 100644 debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/disassembly/rulers/IContributedRulerColumn.java
create mode 100644 debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/disassembly/rulers/RulerColumnDescriptor.java
create mode 100644 debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/disassembly/rulers/RulerColumnPreferenceAdapter.java
create mode 100644 debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/disassembly/rulers/RulerColumnRegistry.java
(limited to 'debug/org.eclipse.cdt.debug.ui')
diff --git a/debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF b/debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF
index e353bd2dc76..934302b9c8d 100644
--- a/debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF
+++ b/debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF
@@ -33,6 +33,7 @@ Export-Package:
org.eclipse.cdt.debug.ui.breakpointactions,
org.eclipse.cdt.debug.ui.breakpoints,
org.eclipse.cdt.debug.ui.disassembly,
+ org.eclipse.cdt.debug.ui.disassembly.rulers,
org.eclipse.cdt.debug.ui.editors,
org.eclipse.cdt.debug.ui.importexecutable,
org.eclipse.cdt.debug.ui.preferences,
diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.properties b/debug/org.eclipse.cdt.debug.ui/plugin.properties
index 719707c823f..c60a7ff9ee3 100644
--- a/debug/org.eclipse.cdt.debug.ui/plugin.properties
+++ b/debug/org.eclipse.cdt.debug.ui/plugin.properties
@@ -226,3 +226,6 @@ CastingCategory.name = Cast to Type or Array
# Pin & Clone
PinView.name = Pin to Debug Context
OpenNewView.name = Open New View
+
+# Disassembly Ruler Column extension point
+extPoint.disassemblyRulerColumn=Disassembly Ruler Column
diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.xml b/debug/org.eclipse.cdt.debug.ui/plugin.xml
index 7bb1df689ba..bcff9995a95 100644
--- a/debug/org.eclipse.cdt.debug.ui/plugin.xml
+++ b/debug/org.eclipse.cdt.debug.ui/plugin.xml
@@ -5,6 +5,7 @@
+ * Subclasses must have a zero-argument constructor so that they can be created by
+ * {@link IConfigurationElement#createExecutableExtension(String)}.
+ * This interface must not be implemented by clients.
+ *
+ * Implementors must have a zero-argument constructor so that they can be created
+ * by {@link IConfigurationElement#createExecutableExtension(String)}.
+ * This method will be called by the framework and must not
+ * be called by clients.
+ * This method will be called by the framework and must not
+ * be called by clients.
+ * This happens when
+ * org.eclipse.cdt.debug.ui.disassemblyRulerColumns
extension point.
+ * true
if the column described by descriptor
is
+ * currently showing, false
if not.
+ *
+ * @param descriptor the column descriptor
+ * @return true
if the specified column is currently visible
+ */
+ boolean isColumnVisible(RulerColumnDescriptor descriptor);
+
+ /**
+ * Attempts to set the visibility of the column described by descriptor
. Nothing
+ * happens if the visibility is already as requested, or if the column is not supported by the
+ * editor.
+ *
+ * @param descriptor the column descriptor
+ * @param visible true
to show the column, false
to hide it
+ */
+ void setColumnVisible(RulerColumnDescriptor descriptor, boolean visible);
+
+ /**
+ * Returns true
if the column described by descriptor
is
+ * supported by the receiver's editor, false
if id
is not the
+ * identifier of a known column contribution, if the column does not target the editor, or if
+ * the editor does not support contributed columns.
+ *
+ * @param descriptor the column descriptor
+ * @return true
if the specified column is supported
+ */
+ boolean isColumnSupported(RulerColumnDescriptor descriptor);
+
+ /**
+ * Removes and disposes all currently visible ruler columns.
+ */
+ void dispose();
+}
\ No newline at end of file
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/disassembly/rulers/IContributedRulerColumn.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/disassembly/rulers/IContributedRulerColumn.java
new file mode 100644
index 00000000000..4c2e7c616ba
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/disassembly/rulers/IContributedRulerColumn.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2011 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Wind River Systems, Inc. - adapted for for disassembly parts
+ *******************************************************************************/
+package org.eclipse.cdt.debug.ui.disassembly.rulers;
+
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.jface.text.source.IVerticalRulerColumn;
+import org.eclipse.ui.IWorkbenchPart;
+
+
+/**
+ * Interface that has to be implemented by contributions to the
+ * org.eclipse.cdt.debug.ui.disassembly.rulerColumns
extension point.
+ * null
if called before {@link #columnCreated()}
+ */
+ RulerColumnDescriptor getDescriptor();
+
+ /**
+ * Sets the extension point descriptor of this ruler.
+ * null
if called before {@link #columnCreated()}
+ */
+ IWorkbenchPart getDisassemblyPart();
+
+ /**
+ * Hook method called after a column has been instantiated, but before it is
+ * added to a {@link org.eclipse.jface.text.source.CompositeRuler} and before
+ * {@linkplain org.eclipse.jface.text.source.IVerticalRulerColumn#createControl(org.eclipse.jface.text.source.CompositeRuler, org.eclipse.swt.widgets.Composite) createControl}
+ * is called.
+ *
+ *
+ * This happens when + *
+ * The column will not be used after this method has been called. A new + * column will be instantiated if the same column type should be shown for + * the same disassembly part. + *
+ */ + void columnRemoved(); + +} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/disassembly/rulers/RulerColumnDescriptor.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/disassembly/rulers/RulerColumnDescriptor.java new file mode 100644 index 00000000000..48dfaef455f --- /dev/null +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/disassembly/rulers/RulerColumnDescriptor.java @@ -0,0 +1,309 @@ +/******************************************************************************* + * Copyright (c) 2005, 2011 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * Wind River Systems, Inc. - adapted for for disassembly parts + *******************************************************************************/ +package org.eclipse.cdt.debug.ui.disassembly.rulers; + +import java.net.URL; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.InvalidRegistryObjectException; +import org.eclipse.core.runtime.content.IContentType; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.IWorkbenchPartSite; +import org.eclipse.ui.internal.texteditor.rulers.ExtensionPointHelper; +import org.eclipse.ui.internal.texteditor.rulers.RulerColumnMessages; +import org.eclipse.ui.internal.texteditor.rulers.RulerColumnPlacement; +import org.eclipse.ui.internal.texteditor.rulers.RulerColumnTarget; + + +/** + * The description of an extension to the + *org.eclipse.ui.workbench.texteditor.rulerColumns
extension point. Instances are
+ * immutable. Instances can be obtained from a {@link RulerColumnRegistry}.
+ *
+ * @since 7.2
+ * @noinstantiate This class is not intended to be instantiated by clients.
+ */
+public final class RulerColumnDescriptor {
+ /** The extension schema name of the class attribute. */
+ private static final String CLASS= "class"; //$NON-NLS-1$
+ /** The extension schema name of the id attribute. */
+ private static final String ID= "id"; //$NON-NLS-1$
+ /** The extension schema name of the optional name attribute. */
+ private static final String NAME= "name"; //$NON-NLS-1$
+ /** The extension schema name of the optional enabled attribute. */
+ private static final String ENABLED= "enabled"; //$NON-NLS-1$
+ /** The extension schema name of the optional icon attribute. */
+ private static final String ICON= "icon"; //$NON-NLS-1$
+ /** The extension schema name of the optional global attribute. */
+ private static final String GLOBAL= "global"; //$NON-NLS-1$
+ /** The extension schema name of the optional menu inclusion attribute. */
+ private static final String INCLUDE_IN_MENU= "includeInMenu"; //$NON-NLS-1$
+ /** The extension schema name of the targetEditor element. */
+ private static final String TARGET_ID= "targetId"; //$NON-NLS-1$
+ /** The extension schema name of the targetClass element. */
+ private static final String TARGET_CLASS= "targetClass"; //$NON-NLS-1$
+ /** The extension schema name of the placement element. */
+ private static final String PLACEMENT= "placement"; //$NON-NLS-1$
+
+ /** The identifier of the extension. */
+ private final String fId;
+ /** The name of the extension, equal to the id if no name is given. */
+ private final String fName;
+ /** The icon descriptor. */
+ private final ImageDescriptor fIcon;
+ /** The configuration element of this extension. */
+ private final IConfigurationElement fElement;
+ /** The target specification of the ruler column contribution. */
+ private final RulerColumnTarget fTarget;
+ /** The placement specification of the ruler column contribution. */
+ private final RulerColumnPlacement fRulerColumnPlacement;
+ /** The default enablement setting of the ruler column contribution. */
+ private final boolean fDefaultEnablement;
+ /** The global setting of the ruler column contribution. */
+ private final boolean fIsGlobal;
+ /** The menu inclusion setting of the ruler column contribution. */
+ private final boolean fIncludeInMenu;
+
+ /**
+ * Creates a new descriptor.
+ *
+ * @param element the configuration element to read
+ * @param registry the computer registry creating this descriptor
+ * @throws InvalidRegistryObjectException if the configuration element is no longer valid
+ * @throws CoreException if the configuration element does not conform to the extension point spec
+ */
+ RulerColumnDescriptor(IConfigurationElement element, RulerColumnRegistry registry) throws InvalidRegistryObjectException, CoreException {
+ Assert.isLegal(registry != null);
+ Assert.isLegal(element != null);
+ fElement= element;
+
+ ExtensionPointHelper helper= new ExtensionPointHelper(element);
+
+ fId= helper.getNonNullAttribute(ID);
+ fName= helper.getDefaultAttribute(NAME, fId);
+ helper.getNonNullAttribute(CLASS); // just check validity
+ URL iconURL= helper.getDefaultResourceURL(ICON, null);
+ fIcon= iconURL == null ? null : ImageDescriptor.createFromURL(iconURL);
+ fDefaultEnablement= helper.getDefaultAttribute(ENABLED, true);
+ fIsGlobal= helper.getDefaultAttribute(GLOBAL, true);
+ fIncludeInMenu= helper.getDefaultAttribute(INCLUDE_IN_MENU, true);
+
+ @SuppressWarnings("null")
+ IConfigurationElement[] targetEditors= element.getChildren(TARGET_ID);
+ IConfigurationElement[] targetClasses= element.getChildren(TARGET_CLASS);
+
+ RulerColumnTarget combined= null;
+ for (int i= 0; i < targetEditors.length; i++) {
+ IConfigurationElement targetEditor= targetEditors[i];
+ RulerColumnTarget target= RulerColumnTarget.createEditorIdTarget(new ExtensionPointHelper(targetEditor).getNonNullAttribute(ID));
+ combined= RulerColumnTarget.createOrTarget(combined, target);
+ }
+ for (int i= 0; i < targetClasses.length; i++) {
+ IConfigurationElement targetClass= targetClasses[i];
+ RulerColumnTarget target= RulerColumnTarget.createClassTarget(new ExtensionPointHelper(targetClass).getNonNullAttribute(CLASS));
+ combined= RulerColumnTarget.createOrTarget(combined, target);
+ }
+ fTarget= combined;
+
+ IConfigurationElement[] placements= element.getChildren(PLACEMENT);
+ switch (placements.length) {
+ case 0:
+ fRulerColumnPlacement= new RulerColumnPlacement();
+ break;
+ case 1:
+ fRulerColumnPlacement= new RulerColumnPlacement(placements[0]);
+ break;
+ default:
+ helper.fail(RulerColumnMessages.RulerColumnDescriptor_invalid_placement_msg);
+ fRulerColumnPlacement= null; // dummy
+ break;
+ }
+
+ Assert.isTrue(fTarget != null);
+ Assert.isTrue(fRulerColumnPlacement != null);
+ }
+
+ /**
+ * Returns the identifier of the described extension.
+ *
+ * @return the identifier of the described extension
+ */
+ public String getId() {
+ return fId;
+ }
+
+ /**
+ * Returns the name of the described extension.
+ *
+ * @return the name of the described extension
+ */
+ public String getName() {
+ return fName;
+ }
+
+ /**
+ * Returns the image descriptor of the described extension, null
if it does not
+ * have an image.
+ *
+ * @return the image descriptor of the described extension or null
for no image
+ */
+ public ImageDescriptor getIcon() {
+ return fIcon;
+ }
+
+ RulerColumnTarget getTarget() {
+ return fTarget;
+ }
+
+ RulerColumnPlacement getPlacement() {
+ return fRulerColumnPlacement;
+ }
+
+ /**
+ * Returns the default enablement of the described extension. Editors that support this
+ * contribution should typically enable the column by default.
+ *
+ * @return the default enablement of the described extension
+ */
+ public boolean getDefaultEnablement() {
+ return fDefaultEnablement;
+ }
+
+ /**
+ * Returns the global property of the described extension. Changing the visibility of a column
+ * with the global property set to true
should typically affect all matching
+ * editors. Changing the visibility of a column with the global property set to
+ * false
should only affect the current disassembly part.
+ *
+ * @return the global property of the described extension
+ */
+ public boolean isGlobal() {
+ return fIsGlobal;
+ }
+
+ /**
+ * Returns the menu inclusion property of the described extension. A toggle menu entry should be
+ * inluded in the ruler context menu for columns with this property set to true
.
+ *
+ * @return the menu inclusion property of the described extension
+ */
+ public boolean isIncludedInMenu() {
+ return fIncludeInMenu;
+ }
+
+ /**
+ * Returns true
if this contribution matches the passed disassembly part , false
if not.
+ *
+ * @param disassembly the disassembly part to check
+ * @return true
if this contribution targets the passed disassembly part
+ */
+ public boolean matchesPart(IWorkbenchPart disassembly) {
+ Assert.isLegal(disassembly != null);
+ RulerColumnTarget target= getTarget();
+
+ @SuppressWarnings("null")
+ IWorkbenchPartSite site= disassembly.getSite();
+ if (site != null && target.matchesEditorId(site.getId()))
+ return true;
+
+ if (target.matchesClass(disassembly.getClass()))
+ return true;
+
+ IContentType contentType= getContentType(disassembly);
+ return contentType != null && target.matchesContentType(contentType);
+
+ }
+
+ /**
+ * Creates a {@link IContributedRulerColumn} instance as described by the receiver. This may load the contributing plug-in.
+ *
+ * @param disassembly the disassembly part that loads the contributed column
+ * @return the instantiated column
+ * @throws CoreException as thrown by {@link IConfigurationElement#createExecutableExtension(String)}
+ * @throws InvalidRegistryObjectException as thrown by {@link IConfigurationElement#createExecutableExtension(String)}
+ */
+ public IContributedRulerColumn createColumn(IWorkbenchPart disassembly) throws CoreException, InvalidRegistryObjectException {
+ Assert.isLegal(disassembly != null);
+ IContributedRulerColumn column= (IContributedRulerColumn)fElement.createExecutableExtension(CLASS);
+ column.setDescriptor(this);
+ column.setDisassemblyPart(disassembly);
+ column.columnCreated();
+ return column;
+ }
+
+ /*
+ * @see java.lang.Object#toString()
+ * @since 3.3
+ */
+ @Override
+ public String toString() {
+ return "RulerColumnDescriptor[name=" + getName() + "]"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ IConfigurationElement getConfigurationElement() {
+ return fElement;
+ }
+
+ /*
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime= 31;
+ int result= 1;
+ result= prime * result + ((fId == null) ? 0 : fId.hashCode());
+ return result;
+ }
+
+ /*
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ final RulerColumnDescriptor other= (RulerColumnDescriptor) obj;
+ if (fId == null) {
+ if (other.fId != null)
+ return false;
+ } else if (!fId.equals(other.fId))
+ return false;
+ return true;
+ }
+
+ /**
+ * Returns the content type of the disassembly part's input, null
if the disassembly part input or
+ * the document provider is null
or the content type cannot be determined.
+ *
+ * @param disassembly part the disassembly part to get the content type from
+ * @return the content type of the disassembly part's input, null
if it cannot be
+ * determined
+ */
+ private IContentType getContentType(IWorkbenchPart disassembly) {
+ return null;
+ }
+
+ String getContributor() {
+ try {
+ return fElement.getContributor().getName();
+ } catch (InvalidRegistryObjectException e) {
+ return "unknown"; //$NON-NLS-1$
+ }
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/disassembly/rulers/RulerColumnPreferenceAdapter.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/disassembly/rulers/RulerColumnPreferenceAdapter.java
new file mode 100644
index 00000000000..b924ec41782
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/disassembly/rulers/RulerColumnPreferenceAdapter.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 201 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Wind River Systems, Inc. - adapted for for disassembly parts
+ *******************************************************************************/
+package org.eclipse.cdt.debug.ui.disassembly.rulers;
+
+import java.util.Set;
+
+import org.eclipse.cdt.debug.internal.ui.preferences.StringSetSerializer;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.preference.IPreferenceStore;
+
+/**
+ * Manages the preferences for ruler contributions stored in a preference store.
+ *
+ * @since 7.2
+ */
+public final class RulerColumnPreferenceAdapter {
+ private final IPreferenceStore fStore;
+ private final String fKey;
+
+ /**
+ * Creates a new preference adapter that will read and write under the specified key in the
+ * given preference store.
+ *
+ * @param store the preference store
+ * @param key the key
+ */
+ public RulerColumnPreferenceAdapter(IPreferenceStore store, String key) {
+ Assert.isLegal(store != null);
+ Assert.isLegal(key != null);
+ fStore= store;
+ fKey= key;
+ }
+
+ /**
+ * Returns the enablement state of the given ruler contribution.
+ *
+ * @param descriptor a ruler contribution descriptor
+ * @return true
if the ruler is enabled, false
otherwise
+ */
+ @SuppressWarnings("null")
+ public boolean isEnabled(RulerColumnDescriptor descriptor) {
+ Assert.isLegal(descriptor != null);
+ String preference= fStore.getString(fKey);
+ return StringSetSerializer.deserialize(preference).contains(descriptor.getId()) ^ descriptor.getDefaultEnablement();
+ }
+
+ /**
+ * Sets the enablement state of the given ruler contribution.
+ *
+ * @param descriptor a ruler contribution descriptor
+ * @param enabled true
to enable the contribution, false
to
+ * disable it
+ */
+ public void setEnabled(RulerColumnDescriptor descriptor, boolean enabled) {
+ Assert.isLegal(descriptor != null);
+ @SuppressWarnings("null")
+ String id= descriptor.getId();
+ String preference= fStore.getString(fKey);
+ SetrulerColumns
extension point.
+ *
+ * @since 7.2
+ * @noinstantiate This class is not intended to be instantiated by clients.
+ */
+public final class RulerColumnRegistry {
+
+ private static final String EXTENSION_POINT= "disassemblyRulerColumns"; //$NON-NLS-1$
+ private static final String QUALIFIED_EXTENSION_POINT= CDebugUIPlugin.PLUGIN_ID + '.' + EXTENSION_POINT;
+
+ /** The singleton instance. */
+ private static RulerColumnRegistry fgSingleton= null;
+
+ /**
+ * Returns the default computer registry.
+ *
+ * @return the singleton instance
+ */
+ public static synchronized RulerColumnRegistry getDefault() {
+ if (fgSingleton == null) {
+ fgSingleton= new RulerColumnRegistry();
+ }
+
+ return fgSingleton;
+ }
+
+ /**
+ * All descriptors (element type:
+ * {@link RulerColumnDescriptor}).
+ */
+ private Listtrue
if this registry has been loaded.
+ */
+ private boolean fLoaded= false;
+
+ /**
+ * Creates a new instance.
+ */
+ RulerColumnRegistry() {
+ }
+
+ /**
+ * Returns the list of {@link RulerColumnDescriptor}s describing all extensions to the
+ * rulerColumns
extension point. The list's iterator traverses the descriptors in
+ * the ordering implied by the placement specifications of the contributions.
+ * + * The returned list is unmodifiable and guaranteed to never change. Note that the set of + * descriptors may change over time due to dynamic plug-in removal or addition. + *
+ * + * @return the sorted list of extensions to therulerColumns
extension point
+ * (element type: {@link RulerColumnDescriptor})
+ */
+ public Listnull
if no
+ * such descriptor exists.
+ *
+ * @param id the identity of the ruler contribution as given in the extension point xml.
+ * @return the {@link RulerColumnDescriptor} with the given identity, null
if no
+ * such descriptor exists
+ */
+ public RulerColumnDescriptor getColumnDescriptor(String id) {
+ Assert.isLegal(id != null);
+ ensureExtensionPointRead();
+ return fDescriptorMap.get(id);
+ }
+
+ /**
+ * Ensures that the extensions are read and stored in
+ * fDescriptorsByPartition
.
+ */
+ private void ensureExtensionPointRead() {
+ boolean reload;
+ synchronized (this) {
+ reload= !fLoaded;
+ fLoaded= true;
+ }
+ if (reload)
+ reload();
+ }
+
+ /**
+ * Reloads the extensions to the extension point.
+ * + * This method can be called more than once in order to reload from + * a changed extension registry. + *
+ */ + public void reload() { + IExtensionRegistry registry= Platform.getExtensionRegistry(); + List