Search in sources :

Example 1 with MarkupTagInfoProvider

use of org.eclipse.wst.xml.ui.internal.taginfo.MarkupTagInfoProvider in project webtools.sourceediting by eclipse.

the class XMLAnnotationsView method selectionChanged.

public void selectionChanged(IWorkbenchPart part, ISelection selection) {
    IEditorPart edPart = getSite().getPage().getActiveEditor();
    if (part.equals(edPart)) {
        if (selection instanceof IStructuredSelection) {
            currentSelection = (IStructuredSelection) selection;
            if (!selection.isEmpty() && (currentSelection.getFirstElement() instanceof Node)) {
                Node node = (Node) currentSelection.getFirstElement();
                ModelQuery mq = ModelQueryUtil.getModelQuery(node.getOwnerDocument());
                if (mq != null) {
                    cmNode = mq.getCMNode(node);
                    MarkupTagInfoProvider tagInfo = new MarkupTagInfoProvider();
                    xmlDoc = tagInfo.getInfo(cmNode);
                } else {
                    xmlDoc = XMLUIMessages.Documentation_view_default_msg;
                }
                doStyledTextInput();
            }
        }
    }
}
Also used : Node(org.w3c.dom.Node) CMNode(org.eclipse.wst.xml.core.internal.contentmodel.CMNode) ModelQuery(org.eclipse.wst.xml.core.internal.contentmodel.modelquery.ModelQuery) MarkupTagInfoProvider(org.eclipse.wst.xml.ui.internal.taginfo.MarkupTagInfoProvider) IEditorPart(org.eclipse.ui.IEditorPart) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Aggregations

IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 IEditorPart (org.eclipse.ui.IEditorPart)1 CMNode (org.eclipse.wst.xml.core.internal.contentmodel.CMNode)1 ModelQuery (org.eclipse.wst.xml.core.internal.contentmodel.modelquery.ModelQuery)1 MarkupTagInfoProvider (org.eclipse.wst.xml.ui.internal.taginfo.MarkupTagInfoProvider)1 Node (org.w3c.dom.Node)1