Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Three requests
Three requests [message #224592] Tue, 17 October 2006 09:47
Eclipse UserFriend
Originally posted by: kanthi.swaroop.gmail.com

Three Requests (normal english, not GEF Vocab)

First Request,

A code snippet, which makes developers life easier.This is about a simple
tool which points out the underlying information.Can we have something
like this as part of GEF API?

About: A tool which highlights the details of figure and simplifies
debugging.


Usage:

copy these classes and import refered entities,

public class InspectionTool extends SelectionTool {


public void mouseDown(MouseEvent e, EditPartViewer viewer) {
super.mouseDown(e, viewer);
showInfoLog();
}


public void mouseHover(MouseEvent me, EditPartViewer viewer) {
super.mouseHover(me, viewer);
showInfoLog();
}

protected void updateHoverRequest() {
super.updateHoverRequest();
showInfoLog();
}


private void showInfoLog() {
EditPart epart = getTargetEditPart();
if (epart instanceof AbstractGraphicalEditPart) {
AbstractGraphicalEditPart gpart = (AbstractGraphicalEditPart) epart;
Object model = gpart.getModel();
IFigure figure = gpart.getFigure();
Rectangle rect = figure.getBounds();
String str =
model.toString()+"\n"+gpart.toString()+"\n"+figure.toString()+ "\n"+rect.toString();
gpart.getFigure().setToolTip(new Label(str));
}
}

}


public class InspectionToolEntry extends ToolEntry {

public InspectionToolEntry(String label, String shortDesc, ImageDescriptor
iconSmall, ImageDescriptor iconLarge) {
super(label, shortDesc, iconSmall, iconLarge,InspectionTool.class);
}

private InspectionToolEntry(String label, String description,
ImageDescriptor iconSmall, ImageDescriptor iconLarge, Class tool) {
super(label, description, iconSmall, iconLarge, tool);
}

}


While configuring palette of editor, add an entry in tool group

toolGroup.add(new CustomToolEntry( "Inspect Tool",
"Inspect Tool",
null,
null));

return toolGroup;

Second Request

GEF.debugXXX()is one of the more obscure entries in the whole of GEF API.
It is deprecated for unknown reasons. But as a developer it simplifies my
life than clutter my ErrorLog or Console with a whole lot of debug
statements. So if possible please retain that API.

Third Request

Is it possible to have a GEF best practices group?
Previous Topic:Change the look of the Cursor
Next Topic:thumbnail view not as Content outline view
Goto Forum:
  


Current Time: Sun Oct 17 09:25:40 GMT 2021

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

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

Back to the top