use of org.eclipse.wst.xml.core.internal.catalog.CatalogSet in project webtools.sourceediting by eclipse.
the class AdvancedOptionsDialog method invokeImportDialog.
protected void invokeImportDialog() {
SelectSingleFileDialog dialog = new SelectSingleFileDialog(getShell(), null, true);
// $NON-NLS-1$ //$NON-NLS-2$
String[] extensions = { ".xmlcatalog", ".xml" };
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();
// $NON-NLS-1$
ICatalog newCatalog = tempResourceSet.lookupOrCreateCatalog("temp", fileName);
workingUserCatalog.addEntriesFromCatalog(newCatalog);
} catch (Exception e) {
// TODO... give error message
}
}
close();
}
}
use of org.eclipse.wst.xml.core.internal.catalog.CatalogSet in project webtools.sourceediting by eclipse.
the class XMLCatalogPreferencePage method createContents.
/**
* 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();
// $NON-NLS-1$ //$NON-NLS-2$
workingUserCatalog = tempCatalogSet.lookupOrCreateCatalog("working", "");
// 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;
}
use of org.eclipse.wst.xml.core.internal.catalog.CatalogSet in project webtools.sourceediting by eclipse.
the class ImportXMLCatalogWizard method performFinish.
public boolean performFinish() {
IFile file = importPage.getFile();
if (file != null) {
String fileName = file.getLocation().toFile().toURI().toString();
try {
CatalogSet tempResourceSet = new CatalogSet();
// $NON-NLS-1$
ICatalog newCatalog = tempResourceSet.lookupOrCreateCatalog("temp", fileName);
workingUserCatalog.addEntriesFromCatalog(newCatalog);
userCatalog.clear();
userCatalog.addEntriesFromCatalog(workingUserCatalog);
userCatalog.save();
} catch (Exception e) {
return false;
}
}
return true;
}
use of org.eclipse.wst.xml.core.internal.catalog.CatalogSet in project webtools.sourceediting by eclipse.
the class XMLCorePlugin method getDefaultXMLCatalog.
public ICatalog getDefaultXMLCatalog() {
if (catalogSet == null) {
catalogSet = new CatalogSet();
defaultCatalogFileStateLocation = getPluginStateLocation(Catalog.DEFAULT_CATALOG_FILE);
catalogSet.putCatalogPersistenceLocation(DEFAULT_CATALOG_ID, defaultCatalogFileStateLocation);
catalogSet.putCatalogPersistenceLocation(SYSTEM_CATALOG_ID, getPluginStateLocation(Catalog.SYSTEM_CATALOG_FILE));
catalogSet.putCatalogPersistenceLocation(USER_CATALOG_ID, getPluginStateLocation(Catalog.USER_CATALOG_FILE));
}
return catalogSet.lookupOrCreateCatalog(DEFAULT_CATALOG_ID, defaultCatalogFileStateLocation);
}
use of org.eclipse.wst.xml.core.internal.catalog.CatalogSet in project webtools.sourceediting by eclipse.
the class SelectFromCatalogDialog method createDialogArea.
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();
// $NON-NLS-1$ //$NON-NLS-2$
workingUserCatalog = tempCatalogSet.lookupOrCreateCatalog("working", "");
// 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;
}
Aggregations