Hi,

although activities extension point can be useful to hide some basic
eclipse ui elements,
you cannot control every other extension point with it.
In your case, I believe that the tools extension loader does not take into
account the activities while loading the available extensions. So your code
will have no effect.
Also note that a user can turn an activity on, so the hidden elements can
be visible at the end.

I've been willing long time now to write a tutorial about Equinox
transforms.
That is the only way to turn off completely any eclipse extension point
from any plugin.
It's a very neat and powerful system, but not that straight-forward.
I promise that I'll write a full tutorial soon.

Meanwhile, you can follow the docs here:
http://wiki.eclipse.org/Equinox_Transforms

Make sure to run the examples there.
Here are some quick guidelines:

This filtering system works inside the equinox loader, which loads the
eclipse platform/application.
The org.eclipse.equinox.transforms.hook plugin puts a hook on the loader
and gets called whenever any plugin resource needs to be loaded.
Then it calls any existing transform hook client to actually load the
resource and transform it if needed.
There are a few clients available, but for our
case org.eclipse.equinox.transforms.xslt is the simplest; it works with
xslt as the name suggests.
So for example, when plugin.xml will be loaded for some plugin, the hook
asks if there are any transform hooks for it.
The hooks can transform the plugin.xml on the fly, filtering out completely
stuff that you don't want, as they will never reach the Eclipse loader.

1) You will need these two plugins:
org.eclipse.equinox.transforms.hook
org.eclipse.equinox.transforms.xslt

They can be found in equinox sdk (the ones in the doc are from the cvs;
they are older versions).
You can either download the sdk and put the individual plugins in your
target environment,
or add to your target environment the update site:
http://download.eclipse.org/releases/indigo
And from that select the org.eclipse.equinox.sdk feature group

2) Take a look at the org.eclipse.equinox.transforms.xslt.plugin example.
You will need to put similar code to a plugin (either existing or a new
one).
The catch is that the plugin which loads the transforms will have to be
loaded first (among your app's plugins)
and should have no dependencies to any other plugin of your app or any udig
plugin.
I put mine in my app's product branding plugin.

Add as only required plugin the transform hook
client: org.eclipse.equinox.transforms.xslt
And as imported package the osgi base:  org.osgi.framework

3) Then override the start & stop in plugin's Activator, according to the
example and create the csv and xslt files.
For your case, I think you would need to filter
the net.refractions.udig.tool.select plugin.xml
and take out the "modalTool" nodes
with categoryId="net.refractions.udig.tool.category.selection"

For this the transform csv, should contain the line:
net\.refractions\.udig\.tool\.select,plugin\.xml,/udig.xslt

And the udig.xslt should contain:
<xsl:template 
match="modalTool[@categoryId='net.refractions.udig.tool.category.selection']"
/>

4) Don't know if you're using a custom config.ini in your rcp-app, but now
you will need to.
You will need to specify the start levels for some plugins.
Here's a template that works:

osgi.bundles=org.eclipse.equinox.common@2
\:start,org.eclipse.update.configurator@3
\:start,org.eclipse.core.runtime@start,org.eclipse.equinox.transforms.xslt@1
:\start,YOUR_PLUGIN_ID@1:\start
osgi.bundles.defaultStartLevel=4
osgi.configuration.cascaded=false
osgi.framework.extensions=org.eclipse.equinox.transforms.hook
eclipse.application=YOUR_APP_ID
eclipse.product=YOUR_PRODUCT_ID

5) That's it. Hope you got it working.
You should include the two plugins (from step 1) in one of your rcp's
features.
When you debug your app, make sure that the two plugins are selected in the
debug configuration,
use your custom config.ini as template and "clear configuration area before
launching".

-Panagiotis
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel

Reply via email to