I'm trying to develop an eclipse plugin, but, seeing the steps, or using the template Eclipse gives, I can't see the menu item.
Mi Eclipse version is 3.6.2 and mi plugin.xml file has this content:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.ui.popupMenus">
<objectContribution
objectClass="org.eclipse.core.resources.IFile"
id="Test.contribution1">
<menu
label="Test Submenu"
path="additions"
id="Test.menu1">
<separator
name="group1">
</separator>
</menu>
<action
label="Test Action"
class="test.popup.actions.TestNewAction"
menubarPath="Test.menu1/group1"
enablesFor="1"
id="Test.newAction">
</action>
</objectContribution>
</extension>
</plugin>
This is the sample template Eclipse gives, but it doesn't work.
It's supposed that this kind of menu shows the option when you right click on a Java element (like a constant or something like that). Am I wrong?
Indeed, the code you posted should show a menu and a submenu when you make a right click on a file in the Project Explorer/Package Explorer view.
If you don't see any menu or submenu, try to add adaptable="true" and nameFilter="*", like this :
<objectContribution
adaptable="true"
nameFilter="*"
objectClass="org.eclipse.core.resources.IFile"
id="Test.contribution1">
It should work now and you should have this output.
Related
I'm creating a plugin for Intellij IDEA. Following found tutorial now I have pretty simple working plugin. But my problem is the fact I don't know how to maintain localization for my actions.
Now I've got plugin.xml file with following actions tag:
<actions>
<group id="MyPlugin.TopMenu"
text="_MyPlugin"
description="My plugin toolbar menu">
<add-to-group group-id="MainMenu" anchor="last"/>
<action id="MyAction"
class="actions.MyAction"
text="_MyAction"
description="MyAction"/>
</group>
</actions>
This code means that my group and action will be shown as "_MyPlugin" and "_MyAction" regardless localization.
I found how to create resouces bundle and did it. Now I have strings.xml (as I used to for Android) with following content:
<properties>
<entry key="ActionName">_MyAction</entry>
</properties>
Another resource file called strings_ru.xml is combined with it into Resource Bundle, so I don't think I did something wrong with it.
I want to use resource reference to set text tag for my group and its actions. Is it even possible? If not should I create and register actions in runtime?
I am experimenting with the way an Eclipse RCP application is dealing with its plugins. In Eclipse IDE I created an Eclipse RCP 3.x project with a view that generated all the necessary files and worked just fine.
Assuming that I can transform this application into one that only holds an empty perspective just by removing the respective parts of the plugin.xml file, I commented out all the lines that deal with the view like so:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
id="application"
point="org.eclipse.core.runtime.applications">
<application>
<run
class="pluginwithview.Application">
</run>
</application>
</extension>
<extension
point="org.eclipse.ui.perspectives">
<perspective
name="Perspective"
class="pluginwithview.Perspective"
id="PluginWithView.perspective">
</perspective>
</extension>
<!--
even without these lines
there's an Exception thrown saying:
"Could not create the view: PluginWithView.view
-->
<!-- <extension
point="org.eclipse.ui.views">
<view
name="View"
inject="true"
class="pluginwithview.View"
id="PluginWithView.view">
</view>
</extension>
<extension
point="org.eclipse.ui.perspectiveExtensions">
<perspectiveExtension
targetID="*">
<view
standalone="true"
minimized="false"
relative="org.eclipse.ui.editorss"
relationship="left"
id="PluginWithView.view">
</view>
</perspectiveExtension>
</extension> -->
<extension
point="org.eclipse.ui.menus">
<menuContribution
locationURI="menu:org.eclipse.ui.main.menu">
<menu
label="File">
<command
commandId="org.eclipse.ui.file.exit"
label="Exit">
</command>
</menu>
</menuContribution>
</extension>
</plugin>
But instead of displaying an empty perspective, the app now looks like so:
What must I do to not have the application search for the view ? Is there a config file that I am missing ? (I know there a few reasons to not have a view , but right now I am mainly interested in the inner workings of an Eclipse RCP application)
Perspectives remember the views they contained. If you change the perspective definition you will have to do a perspective reset ('Window > Perspective > Reset Perspective') to get it to read the updated definition.
For testing you can also specify the -clean and -clearPersistedState options in the 'Program Arguments' section of the RCP Run Configuration to discard all saved information.
I've found this post about BPMN files designer, I tried to open designer window in every way, but i can only open diagram preview. Did anyone use jBPM plugin and can tell me how can I open designer window?
Edit
For simplicity, i'm using this bpmn file:
<?xml version="1.0" encoding="UTF-8"?>
<definitions id="definitions"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
targetNamespace="http://www.activiti.org/bpmn2.0">
<process id="helloWorld">
<startEvent id="start" />
<sequenceFlow id="flow1" sourceRef="start" targetRef="script" />
<scriptTask id="script" name="HelloWorld" scriptFormat="groovy">
<script>
System.out.println("Hello world")
</script>
</scriptTask>
<sequenceFlow id="flow2" sourceRef="script" targetRef="theEnd" />
<endEvent id="theEnd" />
</process>
</definitions>
It's from tutorial
You don't need any third-party plug-ins, the bundled plug-in works just fine. We've recorded a screencast which shows how to use it:
jBPM plugin: how to
Make sure you have at least 2016.3.x IntelliJ IDEA Ultimate version.
I am trying to hide 'delete' popup-menu for some files. I used following plugin.xml entry.
<extension point="org.eclipse.ui.activities">
<activity id="hidedeletepopupmenuID" name="hidedeletepopupmenu">
<enabledWhen>
<with variable="selection">
<iterate operator="and">
<adapt type="org.eclipse.core.resources.IResource" >
<or>
<test property="org.eclipse.core.resources.name" value="*.java"/>
</or>
</adapt>
</iterate>
</with>
</enabledWhen>
</activity>
<activityPatternBinding activityId="hidedeletepopupmenuID"
isEqualityPattern="false" pattern="org.eclipse.ui.edit.delete">
</activityPatternBinding>
</extension>
This seems to be working fine over project explorer view, but navigator view its not wokring. Can anyone help on this?
Thanks,
darshan
Actions in Navigator view context menu are hard-coded, see ResourceNavigator.fillContextMenu(IMenuManager menu).
Note that the action in popup menu is not the only way to delete a resource (there's also a menu item in Edit menu and key-binding).
I have created an eclipse plugin. I am able to add a menu and submenu.
However, I am not able to add an option in the Right Click menu. Does anyone have any idea how to do that?
Here's an example (this code has filled with your preferences and classes and to be added to the plugin.xml):
<extension point="org.eclipse.ui.popupMenus">
<objectContribution
adaptable="true"
id=""
nameFilter=""
objectClass="org.eclipse.core.resources.IFile">
<action
id="org.eclipse.ui.articles.action.contribution.object.action1"
label=""
icon=""
menubarPath="additions"
class="">
</action>
</objectContribution>
</extension>
The provided solution using org.eclipse.ui.popupMenus is deprecated.
One should use the org.eclipse.ui.menus extension point.
In general you can configure a menuContribution using the plugin GUI, which will generate the plugin.xml for you. As you requested the menu to be available in the "Right Click menu" you can use popup:org.eclipse.ui.popup.any as locationURI. With additional configuration you can control under which circumstances the menu should be visible.
You can also edit the plugin.xml directly in the plugin.xml tab.
The generated plugin.xml will look similar to this:
<extension
id="menuid"
point="org.eclipse.ui.menus">
<menuContribution
allPopups="false"
locationURI="popup:org.eclipse.ui.popup.any">
.
.
.
</menuContribution>
</extension>
See Custom Popup menu in eclipse plugin for a similar problem.