How to hide help content in an eclipse RCP? - eclipse

In my eclipse based RCP Application, I want to hide unwanted help contents.
The help content is added via the org.eclipse.help.toc extension point from other plug-ins.
<extension point="org.eclipse.help.toc">
<toc file="help/toc.xml" primary="true">
</toc>
</extension>
I tried to disable it by activities:
<extension point="org.eclipse.ui.activities">
<activity id="disable" name="Disable">
</activity>
<activityPatternBinding activityId="disable"
pattern=".*/org.eclipse.help.toc">
</activityPatternBinding>
</extension>
But no success.

Help content contributions cannot be controlled by activities.
You simply need to exclude the help plug-ins (e.g. org.eclipse.jdt.doc.* for JDT documentation) from the runtime and the corresponding TOC entries will vanish.

I had the same issue and found the solution. You have to set the content to be hidden with HELP_DATA (link).
Here's my helpData.xml content:
<extensions>
<hidden>
<toc id="/org.eclipse.platform.doc.user/toc.xml"/>
</hidden>
</extensions>
and then refer to it in plugin_customization.ini:
org.eclipse.help/HELP_DATA = helpData.xml
and reference your plugin_customization.ini in your eclipse.ini or in the vm arguments of your launch config as
-Declipse.pluginCustomization=${workspace_loc}/com.castortech.iris.vision/plugin_customization.ini

Related

Optional extension points in plugin.xml

I want to define an extension point in my plugin.xml which is not available in my target platform. This is fine for me, because I want to take advantage of it only if it's available .
However ,when I add it Eclipse flags it with an error
Unknown extension point: 'org.eclipse.ui.trace.traceComponents'
Can I somehow mark this extension point as optional? I know that I can reduce the Unresolved extension points severity per-workspace or per-project, but I'd rather not do that for just one error.
The complete plugin.xml is
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
id="org.apache.sling.slingclipse.preferences"
name="Slingclipse Preferences"
point="org.eclipse.ui.preferencePages">
<page
name="Slingclipse"
class="org.apache.sling.slingclipse.preferences.SlingclipsePreferencePage"
id="org.apache.sling.slingclipse.preferences.defaultPreferences">
</page>
</extension>
<extension
point="org.eclipse.core.runtime.preferences">
<initializer
class="org.apache.sling.slingclipse.preferences.PreferenceInitializer">
</initializer>
</extension>
<extension
point="org.eclipse.ui.startup">
<startup
class="org.apache.sling.slingclipse.SlingclipseStrartup">
</startup>
</extension>
<extension
point="org.eclipse.ui.importWizards">
<category
id="org.apache.sling.slingclipse.ui.wizards.sampleCategory"
name="Sling">
</category>
<wizard
category="org.apache.sling.slingclipse.ui.wizards.sampleCategory"
class="org.apache.sling.slingclipse.ui.wizards.ImportWizard"
icon="icons/sample.gif"
id="org.apache.sling.slingclipse.ui.wizards.ImportWizard"
name="Import from Repository">
<description>
Import a file from the local file system into the workspace.
</description>
</wizard>
</extension>
<extension
point="org.eclipse.ui.trace.traceComponents">
<component
id="org.eclipse.ui.trace.tracingPrefPage"
label="Slingclipse">
<bundle
name="org.apache.sling.slingclipse"></bundle>
</component>
</extension>
</plugin>
You are mixing two concepts here: Development time versus runtime.
Extension points are dependencies declared at development time. Therefore you should have the plugin defining that extension point in your target platform at development time. But you are right, you can generally write the manifest XML for extending that extension point without it being available. In practice this does not work well because many extension points require to implement an interface which itself is also defined in the (non existing) plugin.
To make the functionality be optional for a user (and to not force him to have the defining plugin), you need to make the installation of your plugin optional. But that is not related to the manifest and the use of extension points at all. E.g. you have to declare a feature containing your plugin and make that feature depend on the feature containing the plugin defining the extension point.

Removing context menu entry in Eclipse PDE using Activities

I am using org.eclipse.ui.activities to remove certain context menu entries.
I was successful in removing
Team, Show in Remote Systems View, Restore From Local History
by using the below in my plugin.xml
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension point="org.eclipse.ui.activities">
<activity description="Disable Menu/Context Menu Contributions"
id="com.myapp.myactivity" name="MyViewActivity">
</activity>
<activityPatternBinding activityId="com.myapp.myactivity"
pattern="org.eclipse.team.*"/>
<activityPatternBinding activityId="com.myapp.myactivity"
pattern="org.eclipse.rse.*"/>
<activityPatternBinding activityId="com.myapp.myactivity"
pattern="org.eclipse.compare.*"/>
</extension>
</plugin>
I need to remove the "Profile As" , "Source" , "Configure" entries. I've used plugin spy of eclipse and was able to get the associated class and it's plugin jar like for e.x
<activityPatternBinding activityId="com.myapp.myactivity"
pattern="org\.eclipse\.ui\.workbench/org\.eclipse\.jst\.servlet\.ui\.internal\.actions\.ConvertToWebModuleTypeAction"/>
for Removing Configure->Convert To Dynamic Web Project Entry in the context menu but this doesn't work. Am I missing something here?
From Plugin Spy
The active contribution item identifier:
convertToWebModuleTypeAction
The active contribution location URI:
menu:org.eclipse.ui.projectConfigure?after=convertToWebModuleTypeAction
The active contribution item class:
ConvertToWebModuleTypeAction
The contributing plug-in:
org.eclipse.ui.workbench (3.7.1.v20120104-1859)
Any Help to remove the entries above (i.e Profile As, Source, Configure) will be really appreciated.

Provide library from Eclipse plugin to workspace

JUnit does the same, and I just can't figure out how...
I guess thats because of this entry in the Properties > Java Build Path > Libraries > Add Library wizard:
How can I do the same and include my library in this wizard from my plugin, i.e. make it available to a user in workspace?
OK, there are three different extension points you need to look at. The easiest way is to look at the JUnit plugin itself (there are four)
org.eclipse.jdt.junit: git://dev.eclipse.org/org.eclipse.jdt/org.eclipse.jdt.junit.git
org.eclipse.jdt.junit.core: git://dev.eclipse.org/org.eclipse.jdt/org.eclipse.jdt.junit.core.git
org.eclipse.jdt.junit.runtime: git://dev.eclipse.org/org.eclipse.jdt/org.eclipse.jdt.junit.runtime.git
org.eclipse.jdt.junit4.runtime: git://dev.eclipse.org/org.eclipse.jdt/org.eclipse.jdt.junit4.runtime.git
So, you can investigate the JUnit plugins, but these are the extension points you'll need:
For the Add Library, look at the extension point org.eclipse.jdt.ui.classpathContainerPage. From the JUnit plugin.xml:
<extension point="org.eclipse.jdt.ui.classpathContainerPage">
<classpathContainerPage
name="%JUnitContainerName"
class="org.eclipse.jdt.internal.junit.buildpath.JUnitContainerWizardPage"
id="org.eclipse.jdt.junit.JUNIT_CONTAINER">
</classpathContainerPage>
</extension>
So this is implemented as JUnitContainerWizardPage. This extends IClasspathContainerPage and IClasspathContainerPageExtension.
For the quickfix and classpathfix see the extension points org.eclipse.jdt.ui.quickFixProcessors and org.eclipse.jdt.ui.classpathFixProcessors. From the JUnit plugin.xml again:
<extension point="org.eclipse.jdt.ui.quickFixProcessors">
<quickFixProcessor
name="%junitQuickFixProcessor"
class="org.eclipse.jdt.internal.junit.ui.JUnitQuickFixProcessor"
id="org.eclipse.jdt.junit.JUnitQuickFixProcessor">
</quickFixProcessor>
</extension>
<extension point="org.eclipse.jdt.ui.classpathFixProcessors">
<classpathFixProcessor
name="%junitClasspathFixProcessor"
class="org.eclipse.jdt.internal.junit.ui.JUnitClasspathFixProcessor"
id="org.eclipse.jdt.junit.JUnitClasspathFixProcessor">
<overrides id="org.eclipse.jdt.ui.text.correction.DefaultClasspathFixProcessor">
</overrides>
</classpathFixProcessor>
</extension>
In addition to the extension points that are already mentioned in the thread:
The logic that initializes the container is in org.eclipse.jdt.junit.core plugin.
<extension
point="org.eclipse.jdt.core.classpathContainerInitializer">
<classpathContainerInitializer
class="org.eclipse.jdt.internal.junit.buildpath.JUnitContainerInitializer"
id="org.eclipse.jdt.junit.JUNIT_CONTAINER">
</classpathContainerInitializer>
</extension>

Hiding context menu

One of my plugins depends on WST which has 'Validate' menu item. I tried hiding this menu item using activities, but so far was no successful. Any ideas what am I doing wrong?
Using plug-in spy, I am pretty sure menu is contributed by org.eclipse.wst.validation.internal.ui.ValidationMenuAction
Here is what I did:
<extension
point="org.eclipse.ui.activities">
<activity
id="com.iwaysoftware.integration.tools.validationActivity"
name="validation activity">
</activity>
<activityPatternBinding
activityId="com.iwaysoftware.integration.tools.validationActivity"
pattern="org.eclipse.wst.validation.ui/org.eclipse.wst.validation.internal.ui.ValidationMenuAction">
</activityPatternBinding>
<category
id="com.iwaysoftware.integration.tools.validationCategory"
name="validation category">
</category>
<categoryActivityBinding
activityId="com.iwaysoftware.integration.tools.validationActivity"
categoryId="com.iwaysoftware.integration.tools.validationCategory">
</categoryActivityBinding>
easiest way to remove the validate option is to remove following 3 jars from your plugins folder:
org.eclipse.wst.validation.infopop_1.0.300.v201309101952.jar
org.eclipse.wst.validation.ui_1.2.500.v201310231452.jar
org.eclipse.wst.validation_1.2.600.v201501211647.jar

How to extend the source menu in Eclipse? (or: What is its locationURI?)

I am developing an eclipse plugin and trying to extend the source menu (mainMenubar/Source - visible when editing in the java-editor) in Eclipse 3.7.
The documentation says to rely on the org.eclipse.ui.menus-extension point since the older extension points are deprecated. It is a complete secret to me where to obtain reliable locationURIs, but I finally managed to find some plausible URI with the Plugin Spy (following an advice here).
So the following should be the extension snippet for the plugin.xml:
<extension
point="org.eclipse.ui.menus">
<menuContribution
locationURI="menu:org.eclipse.jdt.ui.source.menu">
<command
commandId="some.command.id"
label="Some label"
style="push">
</command>
</menuContribution>
</extension>
Unfortunately, when running the plugin for my development IDE no command appears, and also no error message. Just nothing happens. When I set the locationURI to "menu:help", the new command appears in the help menu, so the problem seems to be really the locationURI.
This thread reports having added an entry in the main Source menu:
<!-- main menu -->
<extension point="org.eclipse.ui.actionSets">
<actionSet label="Java Coding"
description="Action set containing coding related Java actions"
visible="true"
id="org.eclipse.jdt.ui.CodingActionSet2">
<menu label="&Source"
path="edit"
id="org.eclipse.jdt.ui.source.menu">
</menu>
<action class="org.gsoc.eclipse.tostringgenerator.actions.GenerateToStringActionDelegate "
id="org.gsoc.eclipse.tostringgenerator.action"
label="Generate to&String()..."
menubarPath="org.eclipse.jdt.ui.source.menu/generateGroup">
</action>
</actionSet>
</extension>
I ran into the same problem. I finally figured out that extending the Source menu using the (recommended) extension point org.eclipse.ui.menus is not possible.
The reason is that a menu defined in an old style actionSet (like the Source menu) is created after the processing of org.eclipse.ui.menus-extensions. The way it is, these extensions can only contribute to already existing menus.
So sticking to the old API (as suggested by VonC) is probably the best option until the jdt plugin is migrated to the new approach...
You can use the popup: space instead of the menu: space. Here is a working example:
<extension point="org.eclipse.ui.commands">
<command defaultHandler="com.igenox.plugin.dpbuilder.rcp.handler.CreateBuilderHandler"
id="com.igenox.plugin.DPBuilder.CreateBuilderPattern" name="CreateBuilderPattern">
</command>
</extension>
<extension point="org.eclipse.ui.menus">
<menuContribution
locationURI="popup:org.eclipse.jdt.ui.source.menu?after=DPSeparator">
<command commandId="com.igenox.plugin.DPBuilder.CreateBuilderPattern"
id="createBuilder" label="Create Builder Pattern">
</command>
</menuContribution>
<menuContribution
locationURI="popup:org.eclipse.jdt.ui.source.menu?after=additions">
<separator name="DPSeparator" visible="true">
</separator>
</menuContribution>
</extension>