/** * Returns the expression {@link Expression} declared in the * <code>enabledWhen</code> element. * * @param configElement * the configuration element * @param id * the id of the codemining provider. * @return the expression {@link Expression} declared in the enabledWhen * element. * @throws CoreException * when enabledWhen expression is not valid. */ private static Expression createEnabledWhen(IConfigurationElement configElement, String id) throws CoreException { final IConfigurationElement[] children = configElement.getChildren(ENABLED_WHEN_ATTR); if (children.length > 0) { IConfigurationElement[] subChildren = children[0].getChildren(); if (subChildren.length != 1) { throw new CoreException(new Status(IStatus.ERROR, TextEditorPlugin.PLUGIN_ID, "One <enabledWhen> element is accepted. Disabling " + id)); //$NON-NLS-1$ } final ElementHandler elementHandler = ElementHandler.getDefault(); final ExpressionConverter converter = ExpressionConverter.getDefault(); return elementHandler.create(converter, subChildren[0]); } throw new CoreException(new Status(IStatus.ERROR, TextEditorPlugin.PLUGIN_ID, "<enabledWhen> element is required. Disabling " + id)); //$NON-NLS-1$ }
/** * Each instance of this class will have it's own internal registry, that will load (maximum) once each extension class, * depending on whether the extension has been active for one case handled by this Manager. */ public ProjectConfiguratorExtensionManager() { this.extensions = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_POINT_ID); // Force Eclipse configurator to be 1st int eclipseConfiguratorIndex = 0; while (eclipseConfiguratorIndex < this.extensions.length && !this.extensions[eclipseConfiguratorIndex] .getAttribute("class").equals(EclipseProjectConfigurator.class.getName())) { //$NON-NLS-1$ eclipseConfiguratorIndex++; } if (eclipseConfiguratorIndex != 0 && eclipseConfiguratorIndex < this.extensions.length) { // swap IConfigurationElement tmp = this.extensions[eclipseConfiguratorIndex]; this.extensions[eclipseConfiguratorIndex] = this.extensions[0]; this.extensions[0] = tmp; } this.expressionConverter = new ExpressionConverter(new ElementHandler[] { ElementHandler.getDefault(), new FileExpressionHandler() }); }
/** * Create an AND-type core expression from an IConfigurationElement of * arbitrary name. The children elements are combined using boolean AND * semantics to evaluate the expression. * * @param element * An IConfigurationElement of arbitrary name. */ public CustomAndExpression(IConfigurationElement element) { Assert.isNotNull(element); IConfigurationElement[] children = element.getChildren(); if (children.length > 0) { fExpressions = new ArrayList(); } for (int i = 0; i < children.length; i++) { try { fExpressions.add(ElementHandler.getDefault().create( ExpressionConverter.getDefault(), children[i])); } catch (CoreException ce) { NavigatorPlugin.log(IStatus.ERROR, 0, ce.getMessage(), ce); } } }
enablement = ElementHandler.getDefault().create( ExpressionConverter.getDefault(), children[0]);
if (children.length == 1) { try { enablement = ElementHandler.getDefault().create( ExpressionConverter.getDefault(), children[0]); } catch (CoreException e) {
enablement = ElementHandler.getDefault().create( ExpressionConverter.getDefault(), children[0]); } catch (CoreException e) {
final ElementHandler elementHandler = ElementHandler.getDefault(); final ExpressionConverter converter = ExpressionConverter.getDefault(); try { final ElementHandler elementHandler = ElementHandler.getDefault(); final ExpressionConverter converter = ExpressionConverter.getDefault(); try {
.getDefault(); final ExpressionConverter converter = ExpressionConverter .getDefault();