Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » Usage of XMLCorePlugin to programatically register XML Catalog in eclipse...
Usage of XMLCorePlugin to programatically register XML Catalog in eclipse... [message #224607] Mon, 01 December 2008 21:02 Go to next message
Priyajeet is currently offline PriyajeetFriend
Messages: 4
Registered: July 2009
Junior Member
I have an xml catalog that is code generated and I want to programatically
register this catalog within eclipse. I looked at the usage of the XML
core plugin as follows -

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)
{
INextCatalog catalogEntry = new NextCatalog();
catalogEntry.setCatalogLocation(catalogPath);
userCatalog.addCatalogElement(catalogEntry);
}
}
}

however it fails at line 1 with a null pointer exception on
XMLCorePlugin.getdefault(). This is probably because the plugin doesnt get
loaded in eclipse and I am not sure how to do that since there already is
a plugin dependency. I even tried

BundleContext context
= Platform.getBundle("org.eclipse.wst.xml.core").getBundleContext();
Bundle bundle = context.installBundle("org.eclipse.wst.xml.core");
bundle.start();

But that seems not to work either.
Can someone help me with how to register an XML catalog with eclipse
programatically?

Thanks.
Re: Usage of XMLCorePlugin to programatically register XML Catalog in eclipse... [message #224615 is a reply to message #224607] Tue, 02 December 2008 00:16 Go to previous messageGo to next message
Priyajeet is currently offline PriyajeetFriend
Messages: 4
Registered: July 2009
Junior Member
Well I notice that the plugin in its manifest doesn't export packages
exclept to friends...

Manifest-Version: 1.0
Bundle-RequiredExecutionEnvironment: J2SE-1.4
Bundle-SymbolicName: org.eclipse.wst.xml.core; singleton:=true
Bundle-ManifestVersion: 2
Bundle-Activator: org.eclipse.wst.xml.core.internal.XMLCorePlugin
Bundle-Localization: plugin
Bundle-Name: %pluginName
Bundle-Version: 1.1.306.v200810210016
Bundle-ActivationPolicy: lazy; exclude:="org.eclipse.wst.xml.core.inte
rnal.contenttype"
Bundle-Vendor: %providerName
Export-Package: org.eclipse.wst.xml.core.internal;x-friends:="org.ecli
pse.wst.dtd.core,org.eclipse.wst.dtd.ui,org.eclipse.wst.xml. ui,org.ec
lipse.wst.xsd.core,org.eclipse.wst.xsd.ui",org.eclipse.wst.xml.core.i
nternal.catalog;x-friends:="org.eclipse.wst.dtd.core,org.eclipse.wst.
dtd.ui,org.eclipse.wst.xml.ui.....



Now how would one go about using the plugin with this restriction?
Is there something at a higher level that might expose packages for this
plugin?
Re: Usage of XMLCorePlugin to programatically register XML Catalog in eclipse... [message #224737 is a reply to message #224615] Fri, 05 December 2008 16:28 Go to previous message
Gabriel Indik is currently offline Gabriel IndikFriend
Messages: 16
Registered: July 2009
Junior Member
Priyajeet wrote:

> Well I notice that the plugin in its manifest doesn't export packages
> exclept to friends...

> Manifest-Version: 1.0
> Bundle-RequiredExecutionEnvironment: J2SE-1.4
> Bundle-SymbolicName: org.eclipse.wst.xml.core; singleton:=true
> Bundle-ManifestVersion: 2
> Bundle-Activator: org.eclipse.wst.xml.core.internal.XMLCorePlugin
> Bundle-Localization: plugin
> Bundle-Name: %pluginName
> Bundle-Version: 1.1.306.v200810210016
> Bundle-ActivationPolicy: lazy; exclude:="org.eclipse.wst.xml.core.inte
> rnal.contenttype"
> Bundle-Vendor: %providerName
> Export-Package: org.eclipse.wst.xml.core.internal;x-friends:="org.ecli
> pse.wst.dtd.core,org.eclipse.wst.dtd.ui,org.eclipse.wst.xml. ui,org.ec
> lipse.wst.xsd.core,org.eclipse.wst.xsd.ui",org.eclipse.wst.xml.core.i
> nternal.catalog;x-friends:="org.eclipse.wst.dtd.core,org.eclipse.wst.
> dtd.ui,org.eclipse.wst.xml.ui.....



> Now how would one go about using the plugin with this restriction?
> Is there something at a higher level that might expose packages for this
> plugin?



I created a small plug-in and used your code fragment to test this
scenario. Just as you mentioned, some of these classes are not accessible
due to restrictions, in fact bugzilla entries have been created to address
this:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=88015
https://bugs.eclipse.org/bugs/show_bug.cgi?id=129454

Even when these restrictions will create a number of warnings (i.e.
discouraged access) it is still possible to execute the code. I was able
to run it in my environment. So there could probably be something in your
environment that is causing this problem, like a missing dependency. What
version of the platform are you using?
Previous Topic:Newbie: Server publish not including extra RMIC stubs
Next Topic:Javascript editor pls do it something somebody :$
Goto Forum:
  


Current Time: Fri Apr 19 16:37:34 GMT 2024

Powered by FUDForum. Page generated in 0.02593 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top