use of org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalog in project webtools.sourceediting by eclipse.
the class XMLHyperlinkDetector method getCatalogEntry.
/**
* @param uriString
* @return
*/
private ICatalogEntry getCatalogEntry(String uriString) {
ICatalog defaultCatalog = XMLCorePlugin.getDefault().getDefaultXMLCatalog();
if (defaultCatalog != null) {
// Process default catalog
ICatalogEntry[] entries = defaultCatalog.getCatalogEntries();
for (int entry = 0; entry < entries.length; entry++) {
if (uriString.equals(entries[entry].getKey()) || uriString.equals(entries[entry].getURI())) {
return entries[entry];
}
}
// Process declared OASIS nextCatalogs catalog
INextCatalog[] nextCatalogs = defaultCatalog.getNextCatalogs();
for (int nextCatalog = 0; nextCatalog < nextCatalogs.length; nextCatalog++) {
ICatalog catalog = nextCatalogs[nextCatalog].getReferencedCatalog();
ICatalogEntry[] entries2 = catalog.getCatalogEntries();
for (int entry = 0; entry < entries2.length; entry++) {
if (uriString.equals(entries2[entry].getKey()) || uriString.equals(entries2[entry].getURI()))
return entries2[entry];
}
}
}
return null;
}
use of org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalog in project webtools.sourceediting by eclipse.
the class CommonAddNamespacesDialog method createDialogArea.
protected Control createDialogArea(Composite parent) {
Composite dialogArea = (Composite) super.createDialogArea(parent);
addNamespacesControl = new CommonAddNamespacesControl(dialogArea, SWT.NONE, resourceLocation);
List list = new ArrayList();
addBuiltInNamespaces(list);
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.USER_CATALOG_ID.equals(referencedCatalog.getId())) {
ICatalog userCatalog = referencedCatalog;
addCatalogMapToList(userCatalog, list);
} else if (XMLCorePlugin.SYSTEM_CATALOG_ID.equals(referencedCatalog.getId())) {
ICatalog systemCatalog = referencedCatalog;
addCatalogMapToList(systemCatalog, list);
}
}
}
computeAddablePrefixes(list, existingNamespaces);
addNamespacesControl.setNamespaceInfoList(list);
return dialogArea;
}
use of org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalog in project webtools.sourceediting by eclipse.
the class BugFixesTest method testInvalidSchemaWithNamespaceInCatalog.
/**
* Test /BugFixes/XSDRegisteredWithCatalog/InvalidSchemaWithNamespaceInCatalog.xsd
*/
public void testInvalidSchemaWithNamespaceInCatalog() {
String testname = "InvalidSchemaWithNamespaceInCatalog";
String testfile = PLUGIN_ABSOLUTE_PATH + SAMPLES_DIR + BUGFIXES_DIR + "XSDRegisteredWithCatalog/" + testname + ".xsd";
String loglocation = PLUGIN_ABSOLUTE_PATH + GENERATED_RESULTS_DIR + BUGFIXES_DIR + "XSDRegisteredWithCatalog/" + testname + ".xsd-log";
String idealloglocation = PLUGIN_ABSOLUTE_PATH + IDEAL_RESULTS_DIR + BUGFIXES_DIR + "XSDRegisteredWithCatalog/" + testname + ".xsd-log";
createSimpleProject("Project", new String[] { testfile });
ICatalog catalog = XMLCorePlugin.getDefault().getDefaultXMLCatalog();
INextCatalog[] nextCatalogs = catalog.getNextCatalogs();
for (int i = 0; i < nextCatalogs.length; i++) {
INextCatalog nextCatalog = nextCatalogs[i];
if (XMLCorePlugin.USER_CATALOG_ID.equals(nextCatalog.getId())) {
ICatalog userCatalog = nextCatalog.getReferencedCatalog();
if (userCatalog != null) {
ICatalogEntry catalogEntry = (ICatalogEntry) userCatalog.createCatalogElement(ICatalogEntry.ENTRY_TYPE_PUBLIC);
catalogEntry.setKey("http://www.eclipse.org/webtools/Catalogue");
catalogEntry.setURI("platform:/resource/Project/InvalidSchemaInXMLCatalog.xsd");
userCatalog.addCatalogElement(catalogEntry);
runTest("platform:/resource/Project/InvalidSchemaWithNamespaceInCatalog.xsd", loglocation, idealloglocation);
catalog.removeCatalogElement(catalogEntry);
}
}
}
}
use of org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalog in project webtools.sourceediting by eclipse.
the class BugFixesTest method testInvalidSchemaInXMLCatalog.
/**
* Test /BugFixes/InvalidSchemaInXMLCatalog/InvalidSchemaInXMLCatalog.xsd
*/
public void testInvalidSchemaInXMLCatalog() {
String testname = "InvalidSchemaInXMLCatalog";
String testfile = PLUGIN_ABSOLUTE_PATH + SAMPLES_DIR + BUGFIXES_DIR + "InvalidSchemaInXMLCatalog/" + testname + ".xsd";
String loglocation = PLUGIN_ABSOLUTE_PATH + GENERATED_RESULTS_DIR + BUGFIXES_DIR + "InvalidSchemaInXMLCatalog/" + testname + ".xsd-log";
String idealloglocation = PLUGIN_ABSOLUTE_PATH + IDEAL_RESULTS_DIR + BUGFIXES_DIR + "InvalidSchemaInXMLCatalog/" + testname + ".xsd-log";
createSimpleProject("Project", new String[] { testfile });
ICatalog catalog = XMLCorePlugin.getDefault().getDefaultXMLCatalog();
INextCatalog[] nextCatalogs = catalog.getNextCatalogs();
for (int i = 0; i < nextCatalogs.length; i++) {
INextCatalog nextCatalog = nextCatalogs[i];
if (XMLCorePlugin.USER_CATALOG_ID.equals(nextCatalog.getId())) {
ICatalog userCatalog = nextCatalog.getReferencedCatalog();
if (userCatalog != null) {
ICatalogEntry catalogEntry = (ICatalogEntry) userCatalog.createCatalogElement(ICatalogEntry.ENTRY_TYPE_PUBLIC);
catalogEntry.setKey("testKey");
catalogEntry.setURI("http://testuri");
userCatalog.addCatalogElement(catalogEntry);
runTest("platform:/resource/Project/InvalidSchemaInXMLCatalog.xsd", /*FILE_PROTOCOL + file.getLocation().toString()*/
loglocation, idealloglocation);
catalog.removeCatalogElement(catalogEntry);
}
}
}
}
use of org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalog in project webtools.sourceediting by eclipse.
the class ProjectDescription method getCatalogRecords.
private Collection getCatalogRecords() {
if (fCatalogRecords == null) {
List records = new ArrayList();
ICatalog defaultCatalog = XMLCorePlugin.getDefault().getDefaultXMLCatalog();
if (defaultCatalog != null) {
// Process default catalog
ICatalogEntry[] entries = defaultCatalog.getCatalogEntries();
for (int entry = 0; entry < entries.length; entry++) {
ITaglibRecord record = createCatalogRecord(entries[entry]);
records.add(record);
}
// Process declared OASIS nextCatalogs catalog
INextCatalog[] nextCatalogs = defaultCatalog.getNextCatalogs();
for (int nextCatalog = 0; nextCatalog < nextCatalogs.length; nextCatalog++) {
ICatalog catalog = nextCatalogs[nextCatalog].getReferencedCatalog();
ICatalogEntry[] entries2 = catalog.getCatalogEntries();
for (int entry = 0; entry < entries2.length; entry++) {
String uri = entries2[entry].getURI();
if (uri != null) {
uri = uri.toLowerCase(Locale.US);
if (uri.endsWith((".jar")) || uri.endsWith((".tld"))) {
ITaglibRecord record = createCatalogRecord(entries2[entry]);
if (record != null) {
records.add(record);
}
}
}
}
}
}
fCatalogRecords = records;
}
return fCatalogRecords;
}
Aggregations