private String getSchemaURI(XMLNode node) { for (DocumentStructureDeclaration declaration : this.otherSchemas) { if (declaration.getNamespace().equals(node.getNamespace())) { return declaration.getPublicId(); } } return ""; }
public void run(IAction action) { int offset = ((TextSelection) this.editor.getSelectionProvider().getSelection()).getOffset(); XMLNode node = XMLTreeModelUtilities.getActiveNode( this.editor.getDocumentProvider().getDocument(this.editor.getEditorInput()), offset); String selection = node.getXPath(); IWorkbench workbench = XMLEditorPlugin.getDefault().getWorkbench(); Shell shell = workbench.getActiveWorkbenchWindow().getShell(); Clipboard clipboard = new Clipboard(shell.getDisplay()); try { clipboard.setContents(new String[] {selection}, new Transfer[] {TextTransfer.getInstance()}); } catch (SWTError e) { if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD) { throw new RuntimeException(e); } } finally { clipboard.dispose(); } }
public TagTypeDefinition getTagDefinition(XMLNode node) { String tagName = node.getFullTagName(); TagTypeDefinition tagTypeDefinition = this.tags.get(tagName); if (node == null || tagTypeDefinition == null) { String nodeSchemaId = this.getSchemaURI(node); if (this.namespaceContainers.contains(nodeSchemaId)) { return new XSDPossibleRootsTagTypeDefinition(this.possibleRoots); } else { return EMPTY_POSSIBLE_ROOTS; } } return tagTypeDefinition != null ? tagTypeDefinition : new OnlyNameTypeTagDefinition(tagName); }