Palette items as part of a toolbar [message #228762] |
Tue, 09 January 2007 12:14  |
Eclipse User |
|
|
|
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 15:17  |
Eclipse User |
|
|
|
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)));
}
}
|
|
|
Powered by
FUDForum. Page generated in 0.03260 seconds