/** * Converts the tree of configuration elements represented by the given * root element and returns a corresponding expression tree. * * @param root the configuration element to be converted * * @return the corresponding expression tree or <code>null</code> * if the configuration element cannot be converted * * @throws CoreException if the configuration element can't be * converted. Reasons include: (a) no handler is available to * cope with a certain configuration element or (b) the XML * expression tree is malformed. */ public Expression perform(IConfigurationElement root) throws CoreException { for (ElementHandler handler : fHandlers) { Expression result= handler.create(this, root); if (result != null) return result; } return null; }
/** * Converts the tree of configuration elements represented by the given * root element and returns a corresponding expression tree. * * @param root the configuration element to be converted * * @return the corresponding expression tree or <code>null</code> * if the configuration element cannot be converted * * @throws CoreException if the configuration element can't be * converted. Reasons include: (a) no handler is available to * cope with a certain configuration element or (b) the XML * expression tree is malformed. */ public Expression perform(IConfigurationElement root) throws CoreException { for (int i= 0; i < fHandlers.length; i++) { ElementHandler handler= fHandlers[i]; Expression result= handler.create(this, root); if (result != null) return result; } return null; }
/** * Converts the tree of DOM elements represented by the given * root element and returns a corresponding expression tree. * * @param root the element to be converted * * @return the corresponding expression tree or <code>null</code> * if the element cannot be converted * * @throws CoreException if the element can't be converted. * Reasons include: (a) no handler is available to cope with * a certain element or (b) the XML expression tree is malformed. * * @since 3.3 */ public Expression perform(Element root) throws CoreException { for (ElementHandler handler : fHandlers) { Expression result= handler.create(this, root); if (result != null) return result; } return null; }
/** * Converts the tree of DOM elements represented by the given * root element and returns a corresponding expression tree. * * @param root the element to be converted * * @return the corresponding expression tree or <code>null</code> * if the element cannot be converted * * @throws CoreException if the element can't be converted. * Reasons include: (a) no handler is available to cope with * a certain element or (b) the XML expression tree is malformed. * * @since 3.3 */ public Expression perform(Element root) throws CoreException { for (int i= 0; i < fHandlers.length; i++) { ElementHandler handler= fHandlers[i]; Expression result= handler.create(this, root); if (result != null) return result; } return null; }
/** * Converts the tree of configuration elements represented by the given * root element and returns a corresponding expression tree. * * @param root the configuration element to be converted * * @return the corresponding expression tree or <code>null</code> * if the configuration element cannot be converted * * @throws CoreException if the configuration element can't be * converted. Reasons include: (a) no handler is available to * cope with a certain configuration element or (b) the XML * expression tree is malformed. */ public Expression perform(IConfigurationElement root) throws CoreException { for (int i= 0; i < fHandlers.length; i++) { ElementHandler handler= fHandlers[i]; Expression result= handler.create(this, root); if (result != null) return result; } return null; }
/** * Converts the tree of configuration elements represented by the given * root element and returns a corresponding expression tree. * * @param root the configuration element to be converted * * @return the corresponding expression tree or <code>null</code> * if the configuration element cannot be converted * * @throws CoreException if the configuration element can't be * converted. Reasons include: (a) no handler is available to * cope with a certain configuration element or (b) the XML * expression tree is malformed. */ public Expression perform(IConfigurationElement root) throws CoreException { for (int i= 0; i < fHandlers.length; i++) { ElementHandler handler= fHandlers[i]; Expression result= handler.create(this, root); if (result != null) return result; } return null; }
/** * Converts the tree of DOM elements represented by the given * root element and returns a corresponding expression tree. * * @param root the element to be converted * * @return the corresponding expression tree or <code>null</code> * if the element cannot be converted * * @throws CoreException if the element can't be converted. * Reasons include: (a) no handler is available to cope with * a certain element or (b) the XML expression tree is malformed. * * @since 3.3 */ public Expression perform(Element root) throws CoreException { for (int i= 0; i < fHandlers.length; i++) { ElementHandler handler= fHandlers[i]; Expression result= handler.create(this, root); if (result != null) return result; } return null; }
/** * Converts the tree of DOM elements represented by the given * root element and returns a corresponding expression tree. * * @param root the element to be converted * * @return the corresponding expression tree or <code>null</code> * if the element cannot be converted * * @throws CoreException if the element can't be converted. * Reasons include: (a) no handler is available to cope with * a certain element or (b) the XML expression tree is malformed. * * @since 3.3 */ public Expression perform(Element root) throws CoreException { for (int i= 0; i < fHandlers.length; i++) { ElementHandler handler= fHandlers[i]; Expression result= handler.create(this, root); if (result != null) return result; } return null; }
/** * 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$ }
/** * 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 ExpressionConverter converter = ExpressionConverter.getDefault(); try { activeWhen = elementHandler.create(converter, subChildren[0]); } catch (CoreException e) { if (Policy.DEBUG_CMDS) { final ExpressionConverter converter = ExpressionConverter.getDefault(); try { enabledWhen = elementHandler.create(converter, subChildren[0]); } catch (CoreException e) { if (Policy.DEBUG_CMDS) {
final IConfigurationElement expressionElement = expressionElements[0]; try { whenExpression = elementHandler.create(converter, expressionElement); } catch (final CoreException e) {