private void processNextCatalogElements(IConfigurationElement[] childElementList) { if (catalog == null) return; for (int i = 0; i < childElementList.length; i++) { IConfigurationElement childElement = childElementList[i]; String location = childElement.getAttribute(OASISCatalogConstants.ATTR_CATALOG); // mandatory if (location == null || location.equals("")) //$NON-NLS-1$ { Logger.log(Logger.ERROR, XMLCoreMessages.Catalog_next_catalog_location_uri_not_set); continue; } INextCatalog nextCatalog = new NextCatalog(); String resolvedPath = resolvePath(location); nextCatalog.setCatalogLocation(resolvedPath); String id = childElement.getAttribute(OASISCatalogConstants.ATTR_ID); if (id != null && !id.equals("")) //$NON-NLS-1$ { nextCatalog.setId(id); } catalog.addCatalogElement(nextCatalog); } }
catalog.addCatalogElement(catalogElement);
protected void performNew() { // ICatalogEntry newEntry = // (ICatalogEntry)workingUserCatalog.createCatalogElement(ICatalogElement.TYPE_ENTRY); EditCatalogEntryDialog dialog = invokeDialog(XMLCatalogMessages.UI_LABEL_NEW_DIALOG_TITLE, workingUserCatalog); ICatalogElement element = dialog.getCatalogElement(); if (dialog.getReturnCode() == Window.OK) { workingUserCatalog.addCatalogElement(element); tableViewer.setSelection(new StructuredSelection(element), true); tableViewer.refresh(); } }
protected void performEdit() { ISelection selection = tableViewer.getSelection(); Object selectedObject = (selection instanceof IStructuredSelection) ? ((IStructuredSelection) selection).getFirstElement() : null; if (selectedObject instanceof ICatalogElement) { ICatalogElement oldEntry = (ICatalogElement) selectedObject; ICatalogElement newEntry = (ICatalogElement) ((CatalogElement) oldEntry).clone(); EditCatalogEntryDialog dialog = invokeDialog(XMLCatalogMessages.UI_LABEL_EDIT_DIALOG_TITLE, newEntry); if (dialog.getReturnCode() == Window.OK) { // delete the old value if the 'mapFrom' has changed // workingUserCatalog.removeCatalogElement(oldEntry); // update the new mapping // workingUserCatalog.addCatalogElement(newEntry); tableViewer.setSelection(new StructuredSelection(newEntry)); } } }