protected String computeDefaultSystemId(ICatalogEntry mappingInfo) { String result = mappingInfo.getAttributeValue(ICatalogEntry.ATTR_WEB_URL); if ((result == null) && (mappingInfo.getURI() != null)) { int index = mappingInfo.getURI().lastIndexOf("/"); //$NON-NLS-1$ String lastSegment = index != -1 ? mappingInfo.getURI().substring(index + 1) : mappingInfo.getURI(); result = lastSegment; } return result; }
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 (catalogEntry.getURI().endsWith(extensions[i])) { result = true; break; } } } return result; } }
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 (catalogEntry.getURI().endsWith(extensions[i])) { 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 getURI() { ICatalogEntry entry = getXMLCatalogEntry(); return entry != null ? entry.getURI() : null; }
protected String getKeyTypeValue(ICatalogEntry entry) { String result = null; if ((entry.getURI() != null) && entry.getURI().endsWith("xsd")) //$NON-NLS-1$ { result = (entry.getEntryType() == ICatalogEntry.ENTRY_TYPE_URI) ? XMLCatalogMessages.UI_KEY_TYPE_DESCRIPTION_XSD_PUBLIC : XMLCatalogMessages.UI_KEY_TYPE_DESCRIPTION_XSD_SYSTEM; } else { switch (entry.getEntryType()) { case ICatalogEntry.ENTRY_TYPE_PUBLIC : result = XMLCatalogMessages.UI_KEY_TYPE_DESCRIPTION_DTD_PUBLIC; break; case ICatalogEntry.ENTRY_TYPE_SYSTEM : result = XMLCatalogMessages.UI_KEY_TYPE_DESCRIPTION_DTD_SYSTEM; break; default : result = XMLCatalogMessages.UI_KEY_TYPE_DESCRIPTION_URI; break; } } return result; } }
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; } }
if (object instanceof ICatalogEntry) { ICatalogEntry catalogEntry = (ICatalogEntry) object; String uri = catalogEntry.getURI(); if (uri.endsWith("dtd")) { //$NON-NLS-1$ base = dtdFileImage;
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()); }
/** * 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; }
/** * 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; }
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); } } } }
String uri = entry.getURI(); String id = entry.getId(); Element childElement = null;
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); }
ICatalogEntry[] entries2 = catalog.getCatalogEntries(); for (int entry = 0; entry < entries2.length; entry++) { String uri = entries2[entry].getURI(); if (uri != null) { uri = uri.toLowerCase(Locale.US);
resourceLocationField.setLayoutData(gd); resourceLocationField.setText(getDisplayValue(URIUtils.convertURIToLocation(getEntry().getURI())));
String uri = catalogEntry.getURI(); IEditorRegistry er = PlatformUI.getWorkbench().getEditorRegistry(); ImageDescriptor imageDescriptor = er.getImageDescriptor(uri);
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 = ""; } } };