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.Shell;
|
||||||
import org.eclipse.swt.widgets.Text;
|
import org.eclipse.swt.widgets.Text;
|
||||||
import org.eclipse.ui.PlatformUI;
|
import org.eclipse.ui.PlatformUI;
|
||||||
import org.osgi.framework.Bundle;
|
|
||||||
|
|
||||||
import org.eclipse.ui.dialogs.FilteredTree;
|
import org.eclipse.ui.dialogs.FilteredTree;
|
||||||
import org.eclipse.ui.dialogs.PatternFilter;
|
import org.eclipse.ui.dialogs.PatternFilter;
|
||||||
|
|
||||||
|
@ -522,25 +520,17 @@ public class BuildOptionSettingsUI extends AbstractToolSettingUI {
|
||||||
*/
|
*/
|
||||||
private class CustomFieldEditorDescriptor
|
private class CustomFieldEditorDescriptor
|
||||||
{
|
{
|
||||||
private final String editorClassName;
|
private final IConfigurationElement element;
|
||||||
private final String bundleName;
|
|
||||||
|
|
||||||
CustomFieldEditorDescriptor(String editorClassName, String bundleName) {
|
public CustomFieldEditorDescriptor(IConfigurationElement providerElement) {
|
||||||
this.editorClassName = editorClassName;
|
this.element = providerElement;
|
||||||
this.bundleName = bundleName;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FieldEditor createEditor() {
|
FieldEditor createEditor() {
|
||||||
try {
|
try {
|
||||||
Bundle bundle = Platform.getBundle(this.bundleName);
|
Object editor = element.createExecutableExtension("class"); //$NON-NLS-1$
|
||||||
if(bundle != null) {
|
if(editor instanceof FieldEditor && editor instanceof ICustomBuildOptionEditor) {
|
||||||
Class<?> editorClass = bundle.loadClass(this.editorClassName);
|
return (FieldEditor)editor;
|
||||||
if(editorClass != null) {
|
|
||||||
Object editor = editorClass.newInstance();
|
|
||||||
if(editor instanceof FieldEditor && editor instanceof ICustomBuildOptionEditor) {
|
|
||||||
return (FieldEditor)editor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(Exception x) {
|
catch(Exception x) {
|
||||||
|
@ -567,11 +557,8 @@ public class BuildOptionSettingsUI extends AbstractToolSettingUI {
|
||||||
for(IExtension e : ep.getExtensions()) {
|
for(IExtension e : ep.getExtensions()) {
|
||||||
for(IConfigurationElement providerElement : e.getConfigurationElements()) {
|
for(IConfigurationElement providerElement : e.getConfigurationElements()) {
|
||||||
String editorId = providerElement.getAttribute("id"); //$NON-NLS-1$
|
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(providerElement));
|
||||||
|
|
||||||
this.customFieldEditorDescriptorIndex.put(editorId, new CustomFieldEditorDescriptor(editorClassName, bundleName));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue