zoom in , zoom out , zoom fit on the palette [message #94847] |
Sun, 21 January 2007 18:59  |
Eclipse User |
|
|
|
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 #99912 is a reply to message #95555] |
Wed, 31 January 2007 19:54  |
Eclipse User |
|
|
|
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
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.82824 seconds