Hi Bernd,

That was not too hard. There are at least two ways to find the information you 
seek and accomplish your goal:

(1)    Create the extension through the GUI that the Plugin Development 
Environment (PDE) provides. First, you add an "org.eclipse.ui.viewActions" 
extension. Second, you add an "action" to this extension. Third, you hover the 
label of the field "class" that tells you "must implement IViewDelegate".

(2)    [In case you don't like GUIs.] You search for the specification of the 
extension point you want to use: Google Search for 
"org.eclipse.ui.viewActions", and click on the first result: 
http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Fguide%2Fworkbench_basicext_viewActions.htm.
 Then you read "To provide the action behavior, the implementation class 
specified in the plugin.xml must implement the 
IViewActionDelegate<http://help.eclipse.org/indigo/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/ui/IViewActionDelegate.html>
 interface."

So instead of subclassing Action, you just need to implement 
IViewActionDelegate.

Franz

From: Bernd Bieber [mailto:brot...@zedat.fu-berlin.de]
Sent: Tuesday, March 18, 2014 6:00 PM
To: dpp-devel@lists.sourceforge.net
Subject: [DPP-Devel] Problem with actions

Hello fellow developers

I have a problem adding and executing an action in the console-view of eclipse.

I put the following code at the end of the plugin.xml :

<extension point="org.eclipse.ui.viewActions">
       <viewContribution
            id="de.fu_berlin.inf.dpp.ui.ConsoleContribution"
            targetID="org.eclipse.ui.console.ConsoleView">
            <action
                  id="de.fu_berlin.inf.dpp.ui.ShareConsoleAction"
                  label="SarosConsoleSharing"
                  toolbarPath="Saros"
                  icon="icons/obj16/group.png"
                  tooltip="Share the Console"
                  class="de.fu_berlin.inf.dpp.ui.actions.TestAction">
            </action>
      </viewContribution>
</extension>

I created the class TestAction in the package: de.fu_berlin.inf.dpp.ui.actions
and filled it with the following content:

package de.fu_berlin.inf.dpp.ui.actions;
import org.eclipse.jface.action.Action;
public class TestAction extends Action {
    @Override
    public void run() {
        System.out.println("Action tested");
    }
}

In my understanding this should suffice. But when I'm pressing the button an 
information window opens containing: "The chosen operation is not currently 
available".

Can anybody please help me? Thanks in advance!

Sincerely
Bernd Bieber
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
DPP-Devel mailing list
DPP-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dpp-devel

Reply via email to