| author | mhussein | 2012-06-19 12:51:05 (EDT) |
|---|---|---|
| committer | Andrew Gvozdev | 2012-06-19 13:01:44 (EDT) |
| commit | 5a964614c4493757f0952d32afc13ae0d79a309e (patch) (side-by-side diff) | |
| tree | 64df7e64c83fdbe2e47358715ab59265fffc0bb9 | |
| parent | 1ef180e2ab6da0687e7e02aa6d3269a5e1a4d85e (diff) | |
| download | org.eclipse.cdt-5a964614c4493757f0952d32afc13ae0d79a309e.zip org.eclipse.cdt-5a964614c4493757f0952d32afc13ae0d79a309e.tar.gz org.eclipse.cdt-5a964614c4493757f0952d32afc13ae0d79a309e.tar.bz2 | |
Bug 380132: BuildOptionSettingsUI need to correctly load custom field
editors
Update: removed unused import.
Change-Id: I4e665eda7921f573f340a57807d7a23c110daf88
Reviewed-on: https://git.eclipse.org/r/6047
Reviewed-by: Andrew Gvozdev <angvoz.dev@gmail.com>
IP-Clean: Andrew Gvozdev <angvoz.dev@gmail.com>
Tested-by: Andrew Gvozdev <angvoz.dev@gmail.com>
| -rw-r--r-- | build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildOptionSettingsUI.java | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildOptionSettingsUI.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildOptionSettingsUI.java index d082e0c..42e1a7d 100644 --- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildOptionSettingsUI.java +++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildOptionSettingsUI.java @@ -89,8 +89,6 @@ import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; import org.eclipse.ui.PlatformUI; -import org.osgi.framework.Bundle; - import org.eclipse.ui.dialogs.FilteredTree; import org.eclipse.ui.dialogs.PatternFilter; @@ -522,25 +520,17 @@ public class BuildOptionSettingsUI extends AbstractToolSettingUI { */ private class CustomFieldEditorDescriptor { - private final String editorClassName; - private final String bundleName; + private final IConfigurationElement element; - CustomFieldEditorDescriptor(String editorClassName, String bundleName) { - this.editorClassName = editorClassName; - this.bundleName = bundleName; + public CustomFieldEditorDescriptor(IConfigurationElement providerElement) { + this.element = providerElement; } FieldEditor createEditor() { try { - Bundle bundle = Platform.getBundle(this.bundleName); - if(bundle != null) { - Class<?> editorClass = bundle.loadClass(this.editorClassName); - if(editorClass != null) { - Object editor = editorClass.newInstance(); - if(editor instanceof FieldEditor && editor instanceof ICustomBuildOptionEditor) { - return (FieldEditor)editor; - } - } + Object editor = element.createExecutableExtension("class"); //$NON-NLS-1$ + if(editor instanceof FieldEditor && editor instanceof ICustomBuildOptionEditor) { + return (FieldEditor)editor; } } catch(Exception x) { @@ -567,11 +557,8 @@ public class BuildOptionSettingsUI extends AbstractToolSettingUI { for(IExtension e : ep.getExtensions()) { for(IConfigurationElement providerElement : e.getConfigurationElements()) { String editorId = providerElement.getAttribute("id"); //$NON-NLS-1$ - String editorClassName = providerElement.getAttribute("class"); //$NON-NLS-1$ - - String bundleName = providerElement.getContributor().getName(); - this.customFieldEditorDescriptorIndex.put(editorId, new CustomFieldEditorDescriptor(editorClassName, bundleName)); + this.customFieldEditorDescriptorIndex.put(editorId, new CustomFieldEditorDescriptor(providerElement)); } } } |

