Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Palette items as part of a toolbar
Palette items as part of a toolbar [message #228762] Tue, 09 January 2007 17:14 Go to next message
Eclipse UserFriend
Originally posted by: ben.vitale.precipia.com

I have a very simple palette with three items: select, create link,
create node. I'm using PaletteView to display them. Unfortunately,
this takes up a lot of real estate (yes, I have played with the
right-click palette settings).

I'd prefer to have these three tool items integrated into a larger
perspective or application-level SWT/RCP toolbar. Is this possible?
Re: Palette items as part of a toolbar [message #229021 is a reply to message #228762] Sat, 13 January 2007 20:17 Go to previous message
Jeff Higgins is currently offline Jeff HigginsFriend
Messages: 51
Registered: July 2009
Member
Ben Vitale wrote:
>I have a very simple palette with three items: select, create link, create
>node. I'm using PaletteView to display them. Unfortunately, this takes up
>a lot of real estate (yes, I have played with the right-click palette
>settings).
>
> I'd prefer to have these three tool items integrated into a larger
> perspective or application-level SWT/RCP toolbar. Is this possible?

Ben,
I have just found a way to create
editparts from an action. It was exhausting
trying to find the way, but it turns out
to be only one line of code.

I created action like following:
and called action from context menu.

Hope this might help.
Jeff Higgins

package project.actions;
import project.model.Node;
import org.eclipse.gef.EditPartViewer;
import org.eclipse.gef.requests.SimpleFactory;
import org.eclipse.gef.tools.CreationTool;
import org.eclipse.jface.action.Action;

public class InsertNodeAction extends Action{

public static final String ID =
"project.actions.insertnodeaction";

private EditPartViewer viewer;

public InsertNodeAction(EditPartViewer viewer){
this.viewer = viewer;
this.setId(ID);
this.setText("Insert Node");
this.setEnabled(true);
}

public void run() {
viewer.getEditDomain().setActiveTool(
new CreationTool(new SimpleFactory(Node.class)));
}
}
Previous Topic:How to start editing when double clicked?
Next Topic:How to start a GEF project in Eclispe
Goto Forum:
  


Current Time: Fri Apr 26 12:29:48 GMT 2024

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

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

Back to the top