protected Control createDialogArea(Composite parent) { // we create a working copy of the 'User Settings' for the Catalog // that we can modify CatalogSet tempCatalogSet = new CatalogSet(); workingUserCatalog = tempCatalogSet.lookupOrCreateCatalog("working", ""); //$NON-NLS-1$ //$NON-NLS-2$ // TODO: add entries from the nested catalogs as well workingUserCatalog.addEntriesFromCatalog(userCatalog); Composite composite = new Composite(parent, SWT.NULL); composite.setLayout(new GridLayout()); GridData gridData = new GridData(GridData.FILL_BOTH); gridData.heightHint = 500; composite.setLayoutData(gridData); createCatalogEntriesView(composite); createCatalogDetailsView(composite); return composite; }
/** * 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; }
/** * Creates preference page controls on demand. * * @param parent * the parent for the preference page */ protected Control createContents(Composite parent) { // we create a working copy of the 'User Settings' for the Catalog // that we can modify CatalogSet tempCatalogSet = new CatalogSet(); workingUserCatalog = tempCatalogSet.lookupOrCreateCatalog("working", ""); //$NON-NLS-1$ //$NON-NLS-2$ // TODO: add entries from the nested catalogs as well workingUserCatalog.addEntriesFromCatalog(userCatalog); workingUserCatalog.addListener(this); noDefaultAndApplyButton(); Composite composite = new Composite(parent, SWT.NULL); // WorkbenchHelp.setHelp(composite, new // ControlContextComputer(composite, // XMLBuilderContextIds.XMLP_CATALOG_PAGE)); composite.setLayout(new GridLayout()); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); createCatalogEntriesView(composite); createCatalogDetailsView(composite); createAdvancedButton(composite); // catalogEntriesView.updatePage(); applyDialogFont(composite); return composite; }
protected void invokeImportDialog() { SelectSingleFileDialog dialog = new SelectSingleFileDialog(getShell(), null, true); String[] extensions = {".xmlcatalog", ".xml"}; //$NON-NLS-1$ //$NON-NLS-2$ dialog.addFilterExtensions(extensions); dialog.create(); dialog.getShell().setText(XMLCatalogMessages.UI_LABEL_IMPORT_DIALOG_TITLE); dialog.setTitle(XMLCatalogMessages.UI_LABEL_IMPORT_DIALOG_HEADING); dialog.setMessage(XMLCatalogMessages.UI_LABEL_IMPORT_DIALOG_MESSAGE); dialog.setBlockOnOpen(true); int rc = dialog.open(); if (rc == Window.OK) { IFile file = dialog.getFile(); if (file != null) { String fileName = file.getLocation().toFile().toURI().toString(); try { CatalogSet tempResourceSet = new CatalogSet(); ICatalog newCatalog = tempResourceSet.lookupOrCreateCatalog("temp", fileName); //$NON-NLS-1$ workingUserCatalog.addEntriesFromCatalog(newCatalog); } catch (Exception e) { // TODO... give error message } } close(); } }