mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
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>
This commit is contained in:
parent
1ef180e2ab
commit
5a964614c4
1 changed files with 7 additions and 20 deletions
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue