Three requests [message #224592] |
Tue, 17 October 2006 09:47 |
Eclipse User |
|
|
|
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?
|
|
|
Powered by
FUDForum. Page generated in 0.03207 seconds