Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » zoom in , zoom out , zoom fit on the palette
zoom in , zoom out , zoom fit on the palette [message #94847] Sun, 21 January 2007 18:59 Go to next message
Eclipse UserFriend
how to add zoom in , zoom out , zoom fit, etc. to the palette.

I added them as a standard tool in my xxx.gmftool file, but generated
map and gmfgen do not use them. moreover, I need to add some empty entry
to Palette.Tool group in xxx.gmfgen, in order not to remove the whole
palette.


ciao
Wiktor
Re: zoom in , zoom out , zoom fit on the palette [message #95115 is a reply to message #94847] Mon, 22 January 2007 08:55 Go to previous messageGo to next message
Eclipse UserFriend
Hello Wiktor,

> map and gmfgen do not use them. moreover, I need to add some empty
> entry to Palette.Tool group in xxx.gmfgen, in order not to remove the
> whole palette.
Zooming tools are not supported by code generator now.

Concerning an empty palette entry, you can try using GenericTool and specify
F.Q.Class name of the tool implementation class as a parameter for this tool.

-----------------
Alex Shatalin
Re: zoom in , zoom out , zoom fit on the palette [message #95336 is a reply to message #95115] Mon, 22 January 2007 18:46 Go to previous messageGo to next message
Eclipse UserFriend
But how this class specified in GenericTool should look like?
i do not know what should I override?

Summing up my needs:
I want to have on my palett two tools which are available from my
default context menu:
- zoom to fit
- arrange all


If you could write me some steps for doing this I would be very thankful.

Wiktor

Alex Shatalin napisał(a):
> Hello Wiktor,
>
>> map and gmfgen do not use them. moreover, I need to add some empty
>> entry to Palette.Tool group in xxx.gmfgen, in order not to remove the
>> whole palette.
> Zooming tools are not supported by code generator now.
> Concerning an empty palette entry, you can try using GenericTool and
> specify F.Q.Class name of the tool implementation class as a parameter
> for this tool.
>
> -----------------
> Alex Shatalin
>
>
Re: zoom in , zoom out , zoom fit on the palette [message #95555 is a reply to message #95336] Tue, 23 January 2007 06:50 Go to previous messageGo to next message
Eclipse UserFriend
Hello Wiktor,

> But how this class specified in GenericTool should look like? i do not
> know what should I override?
You have to implement org.eclipse.gef.Tool and call zoom/arrange all actions
from there. Probably you can subclass some existing implementation.

-----------------
Alex Shatalin
Re: zoom in , zoom out , zoom fit on the palette [message #99912 is a reply to message #95555] Wed, 31 January 2007 19:54 Go to previous message
Eclipse UserFriend
I have no idea how Tools work.
I tried something like this, but with no result. It's mean, now my
command is created but I cannot any see visual effect.

The best would be if this command (and also arrange all) is executed
only on this tool selection on palet (for zoomFit and arrange there is
no sense to select anything on diagram).


Thanks for any suggestions, and ask for more, because I've spent many
hours on that and still fell as a blindman.



public class ZoomFitTool extends AbstractTool {


private Command zoomFitCommand;

protected Command getCommand() {
if (zoomFitCommand == null ||
zoomFitCommand.equals(org.eclipse.gef.commands.UnexecutableC ommand.INSTANCE))
{
ArrangeRequest arrangeRequest =
new ArrangeRequest(RequestConstants.REQ_ARRANGE_RADIAL);
List list = new ArrayList();
DiagramEditDomain domain = (DiagramEditDomain) getDomain();
EditPartViewer editPartViewer =
domain.getDiagramEditorPart().getDiagramGraphicalViewer();
list.add(editPartViewer.getEditPartRegistry().keySet());
arrangeRequest.setViewAdaptersToArrange(list);
zoomFitCommand =
editPartViewer.getRootEditPart().getCommand(arrangeRequest);
}
return zoomFitCommand;
}

protected Command getCurrentCommand() {
return getCommand();
}

protected String getCommandName() {
return "Zoom Fit";
}


protected boolean handleButtonDown(int button) {
executeCurrentCommand();
return true;
}

public void activate() {
super.activate();
executeCurrentCommand();
}
}


Alex Shatalin napisał(a):
> Hello Wiktor,
>
>> But how this class specified in GenericTool should look like? i do not
>> know what should I override?
> You have to implement org.eclipse.gef.Tool and call zoom/arrange all
> actions from there. Probably you can subclass some existing implementation.
>
> -----------------
> Alex Shatalin
>
>
Previous Topic:Xpand plugins
Next Topic:Refresh editor when root model element change
Goto Forum:
  


Current Time: Wed Jul 16 08:55:49 EDT 2025

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

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

Back to the top