public String getId() { ICatalogEntry entry = getXMLCatalogEntry(); return entry != null ? entry.getKey() : null; }
InternalResolver() { for (Iterator i = catalogElements.iterator(); i.hasNext();) { ICatalogElement catalogElement = (ICatalogElement) i.next(); if (catalogElement.getType() == ICatalogElement.TYPE_ENTRY) { ICatalogEntry entry = (ICatalogEntry) catalogElement; Map map = getEntryMap(entry.getEntryType()); map.put(entry.getKey(), entry); } } }
public boolean select(Viewer viewer, Object parent, Object element) { boolean result = false; if (element instanceof ICatalogEntry) { ICatalogEntry catalogEntry = (ICatalogEntry) element; for (int i = 0; i < extensions.length; i++) { // if the extension is correct and the namespace indicates // that this entry is not the W3 XML Schema if (catalogEntry.getURI().endsWith(extensions[i]) && !catalogEntry.getKey().startsWith(W3_XMLSCHEMA_NAMESPACE)) { result = true; break; } } } else if (element.equals(XMLCatalogTreeViewer.PLUGIN_SPECIFIED_ENTRIES_OBJECT) || element.equals(XMLCatalogTreeViewer.USER_SPECIFIED_ENTRIES_OBJECT)) { return true; } return result; } }
public String getColumnText(Object object, int columnIndex) { String result = null; if (object instanceof ICatalogEntry) { ICatalogEntry catalogEntry = (ICatalogEntry) object; result = columnIndex == 0 ? catalogEntry.getKey() : catalogEntry.getURI(); result = URIHelper.removePlatformResourceProtocol(result); } return result != null ? result : ""; //$NON-NLS-1$ } }
/** * @param catalogEntry * a XML catalog entry pointing to a .jar or .tld file * @return a ITaglibRecord describing a TLD contributed to the XMLCatalog * if one was found at the given location, null otherwise */ private ITaglibRecord createCatalogRecord(ICatalogEntry catalogEntry) { return createCatalogRecord(catalogEntry.getKey(), catalogEntry.getURI()); }
protected void addCatalogMapToList(ICatalog catalog, List list) { ICatalogEntry[] entries = catalog.getCatalogEntries(); for (int i = 0; i < entries.length; i++) { ICatalogEntry entry = entries[i]; if ((entry.getEntryType() == ICatalogEntry.ENTRY_TYPE_PUBLIC) && entry.getURI().endsWith(".xsd")) { //$NON-NLS-1$ if (!isAlreadyDeclared(entry.getKey())) { NamespaceInfo namespaceInfo = new NamespaceInfo(entry.getKey(), "xx", null); //$NON-NLS-1$ list.add(namespaceInfo); } } } }
public String getText(Object object) { String result = null; if (object instanceof ICatalogEntry) { ICatalogEntry catalogEntry = (ICatalogEntry) object; result = catalogEntry.getKey(); // result = URIHelper.removePlatformResourceProtocol(result); } else if (object instanceof INextCatalog) { INextCatalog nextCatalog = (INextCatalog) object; // result = nextCatalog.getCatalogLocation(); result = URIUtils.convertURIToLocation(nextCatalog.getCatalogLocation()); if (nextCatalog.getCatalogLocation().startsWith("file:")) { result += " (" + XMLCatalogMessages.UI_LABEL_FILE_SYSTEM_RESOURCE + ")"; } else if (nextCatalog.getCatalogLocation().startsWith("platform:")) { result += " (" + XMLCatalogMessages.UI_LABEL_PLATFORM_RESOURCE + ")"; } } return result != null ? result : object.toString(); }
/** * Returns the String location for the schema with the given namespaceURI by * looking at the XML catalog. We look only in the plugin specified entries of * the catalog. * * @param namespaceURI * @return String representing the location of the schema. */ private String locateFileUsingCatalog(String namespaceURI) { retrieveCatalog(); ICatalogEntry[] entries = systemCatalog.getCatalogEntries(); for (int i = 0; i < entries.length; i++) { if (entries[i].getKey().equals(namespaceURI)) return entries[i].getURI(); } return null; }
/** * Helper method to find the physical location of the schema * in the XML Catalog * @param namespaceURI * @return physical location of the schema */ public String locateFileUsingCatalog(String namespaceURI) { retrieveCatalog(); ICatalogEntry[] entries = systemCatalog.getCatalogEntries(); for (int i = 0; i < entries.length; i++) { if (entries[i].getKey().equals(namespaceURI)) return entries[i].getURI(); } return null; }
String key = entry.getKey(); String uri = entry.getURI(); String id = entry.getId();
public void update() { String thePublicId = null; String theSystemId = null; ICatalogEntry xmlCatalogEntry = generator.getXMLCatalogEntry(); if (xmlCatalogEntry != null) { if (xmlCatalogEntry.getEntryType() == ICatalogEntry.ENTRY_TYPE_PUBLIC) { thePublicId = xmlCatalogEntry.getKey(); theSystemId = xmlCatalogEntry.getAttributeValue(ICatalogEntry.ATTR_WEB_URL); if (theSystemId == null) { theSystemId = generator.getGrammarURI().startsWith("http:") ? generator.getGrammarURI() : URIHelper.getLastSegment(generator.getGrammarURI()); //$NON-NLS-1$ } } else { theSystemId = xmlCatalogEntry.getKey(); } } else { theSystemId = getDefaultSystemId(); } publicIdField.setText(thePublicId != null ? thePublicId : ""); //$NON-NLS-1$ systemIdField.setText(theSystemId != null ? theSystemId : ""); //$NON-NLS-1$ }
public void setCatalogElement(ICatalogEntry entry) { String value = getDisplayValue(entry != null ? entry.getURI() : ""); //$NON-NLS-1$ String line1 = XMLCatalogMessages.UI_LABEL_DETAILS_URI_COLON + "\t\t" + value; //$NON-NLS-1$ String line0; if (value.startsWith("jar:file:")) { String jarFile = URIUtils.convertURIToLocation(URIHelper.ensureURIProtocolFormat(value.substring("jar:".length(), value.indexOf('!')))); String internalFile = URIUtils.convertURIToLocation(URIHelper.ensureURIProtocolFormat("file://" + value.substring(value.indexOf('!') + 1))); line0 = XMLCatalogMessages.UI_LABEL_DETAILS_URI_LOCATION + "\t" + internalFile + " " + XMLCatalogMessages.UI_LABEL_DETAILS_IN_JAR_FILE + " " + jarFile; } else { value = URIUtils.convertURIToLocation(value); line0 = XMLCatalogMessages.UI_LABEL_DETAILS_URI_LOCATION + "\t" + value; //$NON-NLS-1$ } value = entry != null ? getKeyTypeValue(entry) : ""; //$NON-NLS-1$ String line2 = XMLCatalogMessages.UI_KEY_TYPE_DETAILS_COLON + "\t" + value; //$NON-NLS-1$ value = getDisplayValue(entry != null ? entry.getKey() : ""); //$NON-NLS-1$ String line3 = XMLCatalogMessages.UI_LABEL_DETAILS_KEY_COLON + "\t\t" + value; //$NON-NLS-1$ String entireString = "\n" + line0 + "\n" + line1 + "\n" + line2 + "\n" + line3; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ detailsText.setText(entireString); }
keyField.setText(getDisplayValue(getEntry().getKey())); keyField.addModifyListener(modifyListener);
protected void buttonPressed(int buttonId) { if (buttonId == IDialogConstants.OK_ID) { ISelection selection = panel.getTableViewer().getSelection(); Object selectedObject = (selection instanceof IStructuredSelection) ? ((IStructuredSelection) selection).getFirstElement() : null; if (selectedObject instanceof ICatalogEntry) { ICatalogEntry mappingInfo = (ICatalogEntry) selectedObject; publicId = mappingInfo.getKey(); systemId = computeDefaultSystemId(mappingInfo); } } super.buttonPressed(buttonId); }
locationInfo = xmlCatalogEntry.getKey();
public void selectionChanged(SelectionChangedEvent event) { ISelection selection = event.getSelection(); Object selectedObject = (selection instanceof IStructuredSelection) ? ((IStructuredSelection) selection).getFirstElement() : null; if (selectedObject instanceof ICatalogEntry) { ICatalogEntry entry = (ICatalogEntry) selectedObject; detailsView.setCatalogElement(entry); currentSelectionLocation = entry.getURI(); currentSelectionNamespace = entry.getKey(); } else { detailsView.setCatalogElement((ICatalogEntry) null); currentSelectionLocation = ""; currentSelectionNamespace = ""; } } };