From 4d379222d044923adb2226e9c88b25325bf5c6f3 Mon Sep 17 00:00:00 2001 From: ustieber Date: Sat, 14 May 2011 10:05:30 +0000 Subject: Target Explorer: Keep a reference to the configuration element for executable extensions --- .../tm/te/core/extensions/ExecutableExtension.java | 92 ++++++++++++---------- .../internal/extensions/EditorPageBinding.java | 56 ++++++------- 2 files changed, 74 insertions(+), 74 deletions(-) diff --git a/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/extensions/ExecutableExtension.java b/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/extensions/ExecutableExtension.java index 858310598..d09bf6330 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/extensions/ExecutableExtension.java +++ b/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/extensions/ExecutableExtension.java @@ -9,6 +9,7 @@ *******************************************************************************/ package org.eclipse.tm.te.core.extensions; +import org.eclipse.core.runtime.Assert; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IStatus; @@ -18,25 +19,15 @@ import org.eclipse.osgi.util.NLS; import org.eclipse.tm.te.core.activator.CoreBundleActivator; import org.eclipse.tm.te.core.nls.Messages; - - /** * Target Explorer: Executable extension implementation. */ public class ExecutableExtension extends PlatformObject { - private String fId; - private String fLabel; - private String fDescription; + // The mandatory id of the extension + private String id = null; - /** - * Constructor. - */ - public ExecutableExtension() { - super(); - fId = null; - fLabel = ""; //$NON-NLS-1$ - fDescription = ""; //$NON-NLS-1$ - } + // The configuration element + private IConfigurationElement configElement = null; /** * Clone the initialization data to the given executable extension instance. @@ -44,36 +35,23 @@ public class ExecutableExtension extends PlatformObject { * @param other The destination executable extension instance. Must not be null. */ public void cloneInitializationData(ExecutableExtension other) { - assert other != null; - other.fId = fId; - other.fLabel = fLabel; - other.fDescription = fDescription; + Assert.isNotNull(other); + other.id = id; + other.configElement = configElement; } /* (non-Javadoc) * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object) */ public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException { - if (config != null) { - // Initialize the id field by reading the extension attribute. - // Throws an exception if the id is empty or null. - fId = config.getAttribute("id"); //$NON-NLS-1$ - if (fId == null || fId.trim().length() == 0) { - throw createMissingMandatoryAttributeException("id", config.getContributor().getName()); //$NON-NLS-1$ - } - - // Initialize the label field by reading the