protected ICatalogEntry getEntry() { if (catalogEntry == null) { if ((fCatalogElement != null) && (fCatalogElement.getType() == ICatalogElement.TYPE_ENTRY)) { catalogEntry = (ICatalogEntry) fCatalogElement; } else { if (catalog != null) { catalogEntry = (ICatalogEntry) catalog.createCatalogElement(ICatalogElement.TYPE_ENTRY); } } } return catalogEntry; }
/** * Stores the values of the controls back to the preference store. */ private boolean storeValues() { // dw Object fileObject = null; try { // update the userCatalog so that its the same as the working // catalog userCatalog.clear(); // TODO add entries from the nested catalogs? userCatalog.addEntriesFromCatalog(workingUserCatalog); // now save the userCatalog userCatalog.save(); } catch (Exception e) { } return true; }
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); } } } }
/** * 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; }
public XMLCatalogPreferencePage() { defaultCatalog = XMLCorePlugin.getDefault().getDefaultXMLCatalog(); INextCatalog[] nextCatalogs = defaultCatalog.getNextCatalogs(); for (int i = 0; i < nextCatalogs.length; i++) { INextCatalog catalog = nextCatalogs[i]; ICatalog referencedCatalog = catalog.getReferencedCatalog(); if (referencedCatalog != null) { if (XMLCorePlugin.SYSTEM_CATALOG_ID.equals(referencedCatalog.getId())) { systemCatalog = referencedCatalog; } else if (XMLCorePlugin.USER_CATALOG_ID.equals(referencedCatalog.getId())) { userCatalog = referencedCatalog; } } } }
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$ } }
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 Object clone() { ICatalogElement element = ownerCatalog.createCatalogElement(type); String[] attributes = getAttributes(); for (int i = 0; i < attributes.length; i++) { String attrName = attributes[i]; String attrValue = getAttributeValue(attrName); element.setAttributeValue(attrName, attrValue); } element.setOwnerCatalog(ownerCatalog); element.setId(id); return element; }
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 String getId() { ICatalogEntry entry = getXMLCatalogEntry(); return entry != null ? entry.getKey() : null; }
public Object[] getChildren(Object parentElement) { Object[] result = new Object[0]; if (parentElement == roots[0]) { result = getChildrenHelper(fWorkingUserCatalog); } else if (parentElement == roots[1]) { result = getChildrenHelper(fSystemCatalog); } else if (parentElement instanceof INextCatalog) { ICatalog nextCatalog = ((INextCatalog) parentElement).getReferencedCatalog(); result = getChildrenHelper(nextCatalog); } return result; }
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); } } }
public void dispose() { super.dispose(); workingUserCatalog.removeListener(this); }
public void addCatalogElement(ICatalogElement element) { catalogElements.add(element); element.setOwnerCatalog(this); internalResolver = null; notifyAddElement(element); }
protected void performDelete() { ISelection selection = tableViewer.getSelection(); Object selectedObject = (selection instanceof IStructuredSelection) ? ((IStructuredSelection) selection).getFirstElement() : null; if (selectedObject instanceof ICatalogElement) { ICatalogElement catalogElement = (ICatalogElement) selectedObject; workingUserCatalog.removeCatalogElement(catalogElement); } }
private void retrieveCatalog() { if (systemCatalog != null) return; ICatalog defaultCatalog = XMLCorePlugin.getDefault().getDefaultXMLCatalog(); INextCatalog[] nextCatalogs = defaultCatalog.getNextCatalogs(); for (int i = 0; i < nextCatalogs.length; i++) { INextCatalog catalog = nextCatalogs[i]; ICatalog referencedCatalog = catalog.getReferencedCatalog(); if (referencedCatalog != null) { if (XMLCorePlugin.SYSTEM_CATALOG_ID.equals(referencedCatalog.getId())) { systemCatalog = referencedCatalog; } } } }
/** * @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 INextCatalog getNextCatalog() { if (nextCatalog == null) { if ((fCatalogElement != null) && (fCatalogElement.getType() == ICatalogElement.TYPE_NEXT_CATALOG)) { nextCatalog = (INextCatalog) fCatalogElement; } else { if (catalog != null) { nextCatalog = (INextCatalog) catalog.createCatalogElement(ICatalogElement.TYPE_NEXT_CATALOG); } } } return nextCatalog; }
public String getURI() { ICatalogEntry entry = getXMLCatalogEntry(); return entry != null ? entry.getURI() : null; }