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$ } }
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; }
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); } } } }
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; } }
String key = entry.getKey(); String uri = entry.getURI(); String id = entry.getId(); Element childElement = null; switch (entry.getEntryType()) String[] attributes = entry.getAttributes(); for (int j = 0; j < attributes.length; j++) if (attrName != null && !attrName.equals("")) //$NON-NLS-1$ String attrValue = entry.getAttributeValue(attrName); if (childElement != null && attrValue != null)
resourceLocationField.setLayoutData(gd); resourceLocationField.setText(getDisplayValue(URIUtils.convertURIToLocation(getEntry().getURI()))); gd.grabExcessHorizontalSpace = true; keyTypeCombo.setLayoutData(gd); updateKeyTypeCombo(getEntry().getEntryType()); keyTypeCombo.addModifyListener(modifyListener); keyField.setText(getDisplayValue(getEntry().getKey())); keyField.addModifyListener(modifyListener); checkboxButton.setSelection(getEntry().getAttributeValue(ICatalogEntry.ATTR_WEB_URL) != null); SelectionListener buttonListener = new SelectionListener() { public void widgetDefaultSelected(SelectionEvent event) { webAddressField.setText(getDisplayValue(getEntry().getAttributeValue(ICatalogEntry.ATTR_WEB_URL))); webAddressField.setEnabled(false); webAddressField.addModifyListener(webAddressFieldListener);
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 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; } }
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 void saveData() { getEntry().setURI(URIUtils.convertLocationToURI(resourceLocationField.getText())); getEntry().setKey(keyField.getText()); getEntry().setEntryType(getKeyType()); getEntry().setAttributeValue(ICatalogEntry.ATTR_WEB_URL, checkboxButton.getSelection() ? webAddressField.getText() : null); }
public String getId() { ICatalogEntry entry = getXMLCatalogEntry(); return entry != null ? entry.getKey() : null; }
protected void addXMLCatalogEntries(List list, ICatalogEntry[] entries) { for (int i = 0; i < entries.length; i++) { ICatalogEntry entry = entries[i]; if (catalogEntryType == 0) { list.add(entry); } else if (catalogEntryType == entry.getEntryType()) { list.add(entry); } } }
String locationInfo = null; if (xmlCatalogEntry != null) { if (xmlCatalogEntry.getEntryType() == ICatalogEntry.ENTRY_TYPE_PUBLIC) { locationInfo = xmlCatalogEntry.getAttributeValue(ICatalogEntry.ATTR_WEB_URL); locationInfo = xmlCatalogEntry.getKey();
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 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(); }
/** * @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()); }
public String getURI() { ICatalogEntry entry = getXMLCatalogEntry(); return entry != null ? entry.getURI() : null; }
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); }
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; } }