Search in sources :

Example 1 with XSLNode

use of org.eclipse.wst.xsl.core.model.XSLNode in project webtools.sourceediting by eclipse.

the class Validator method addInfoToMessage.

@Override
protected void addInfoToMessage(ValidationMessage validationMessage, IMessage message) {
    XSLValidationMessage msg = (XSLValidationMessage) validationMessage;
    XSLNode node = msg.getNode();
    // set this here as it gets set to the wrong value by the superclass
    message.setSeverity(msg.getRealSeverity());
    // constants are defined in org.eclipse.wst.xml.ui.internal.validation.DelegatingSourceValidator
    if (node.getNodeType() == XSLNode.ATTRIBUTE_NODE) {
        // $NON-NLS-1$//$NON-NLS-2$
        message.setAttribute("ERROR_SIDE", "ERROR_SIDE_RIGHT");
        message.setAttribute(COLUMN_NUMBER_ATTRIBUTE, Integer.valueOf(validationMessage.getColumnNumber()));
        // whether to squiggle the element, attribute or text //$NON-NLS-1$
        message.setAttribute(SQUIGGLE_SELECTION_STRATEGY_ATTRIBUTE, "ATTRIBUTE_VALUE");
        message.setAttribute(SQUIGGLE_NAME_OR_VALUE_ATTRIBUTE, ((XSLAttribute) node).getName());
    } else if (node.getNodeType() == XSLNode.ELEMENT_NODE) {
        // $NON-NLS-1$//$NON-NLS-2$
        message.setAttribute("ERROR_SIDE", "ERROR_SIDE_RIGHT");
        message.setAttribute(COLUMN_NUMBER_ATTRIBUTE, Integer.valueOf(validationMessage.getColumnNumber()));
        // whether to squiggle the element, attribute or text //$NON-NLS-1$
        message.setAttribute(SQUIGGLE_SELECTION_STRATEGY_ATTRIBUTE, "START_TAG");
    }
}
Also used : XSLValidationMessage(org.eclipse.wst.xsl.core.internal.validation.XSLValidationMessage) XSLNode(org.eclipse.wst.xsl.core.model.XSLNode)

Example 2 with XSLNode

use of org.eclipse.wst.xsl.core.model.XSLNode in project webtools.sourceediting by eclipse.

the class StylesheetModelView method handleTreeSelection.

private void handleTreeSelection(IStructuredSelection selection, boolean reveal) {
    if (activeEditor != null) {
        // isFiringSelection = true;
        if (selection.getFirstElement() instanceof XSLNode) {
            XSLNode node = (XSLNode) selection.getFirstElement();
            ITextEditor textEditor = (ITextEditor) activeEditor.getAdapter(ITextEditor.class);
            if (textEditor != null) {
                // if (reveal)
                textEditor.selectAndReveal(node.getOffset(), 0);
            // else
            // textEditor.setHighlightRange(node.getOffset(), 0, true);
            }
        }
    // isFiringSelection = false;
    }
}
Also used : ITextEditor(org.eclipse.ui.texteditor.ITextEditor) XSLNode(org.eclipse.wst.xsl.core.model.XSLNode)

Aggregations

XSLNode (org.eclipse.wst.xsl.core.model.XSLNode)2 ITextEditor (org.eclipse.ui.texteditor.ITextEditor)1 XSLValidationMessage (org.eclipse.wst.xsl.core.internal.validation.XSLValidationMessage)1