use of org.eclipse.wst.xsd.ui.internal.design.figures.CenteredIconFigure in project webtools.sourceediting by eclipse.
the class BackToSchemaEditPart method createFigure.
protected IFigure createFigure() {
backToSchema = new CenteredIconFigure();
backToSchema.setBackgroundColor(ColorConstants.white);
backToSchema.image = XSDEditorPlugin.getPlugin().getIcon("elcl16/schemaview_co.gif");
// TODO, look at why the editpolicy doesn't work
mouseListener = new MouseListener() {
public void mouseDoubleClicked(org.eclipse.draw2d.MouseEvent me) {
}
public void mousePressed(org.eclipse.draw2d.MouseEvent me) {
if (isEnabled) {
addFeedback();
}
}
public void mouseReleased(org.eclipse.draw2d.MouseEvent me) {
if (isEnabled) {
removeFeedback();
SetInputToGraphView action = new SetInputToGraphView(multipageEditor, getModel());
action.run();
}
}
};
backToSchema.addMouseListener(mouseListener);
return backToSchema;
}
use of org.eclipse.wst.xsd.ui.internal.design.figures.CenteredIconFigure in project webtools.sourceediting by eclipse.
the class BackToSchemaEditPart method removeFeedback.
public void removeFeedback() {
CenteredIconFigure figure = (CenteredIconFigure) getFigure();
figure.setMode(CenteredIconFigure.NORMAL);
figure.refresh();
}
use of org.eclipse.wst.xsd.ui.internal.design.figures.CenteredIconFigure in project webtools.sourceediting by eclipse.
the class BackToSchemaEditPart method refreshVisuals.
protected void refreshVisuals() {
super.refreshVisuals();
CenteredIconFigure figure = (CenteredIconFigure) getFigure();
if (isEnabled) {
backToSchema.image = XSDEditorPlugin.getPlugin().getIcon("elcl16/schemaview_co.gif");
} else {
backToSchema.image = XSDEditorPlugin.getPlugin().getIcon("dlcl16/schemaview_co.gif");
}
figure.refresh();
}
use of org.eclipse.wst.xsd.ui.internal.design.figures.CenteredIconFigure in project webtools.sourceediting by eclipse.
the class CenteredConnectionAnchor method getLocation.
public Point getLocation(Point reference) {
Rectangle r = getOwner().getBounds();
int x, y;
switch(location) {
case TOP:
x = r.right() - r.width / 2 + offset;
y = r.y + inset;
break;
case BOTTOM:
x = r.right() - r.width / 2 + offset;
y = r.bottom() - inset;
break;
case LEFT:
x = r.x + inset;
y = r.bottom() - r.height / 2 + offset;
break;
case RIGHT:
x = r.right() - inset;
y = r.bottom() - r.height / 2 + offset;
break;
case HEADER_LEFT:
x = r.x + inset;
y = r.y + offset;
break;
case HEADER_RIGHT:
x = r.right() - inset;
y = r.y + offset;
break;
default:
x = r.right() - r.width / 2;
y = r.bottom() - r.height / 2;
}
Point p = new Point(x, y);
if (!(getOwner() instanceof CenteredIconFigure)) {
getOwner().translateToAbsolute(p);
} else {
getOwner().translateToAbsolute(p);
}
if (other != null) {
// if within only one pixel of being vertical, we straighten up the line
Point p2 = other.getLocation(null);
if (Math.abs(p2.x - p.x) <= 1) {
p.x = p2.x;
}
}
return p;
}
use of org.eclipse.wst.xsd.ui.internal.design.figures.CenteredIconFigure in project webtools.sourceediting by eclipse.
the class BackToSchemaEditPart method addFeedback.
public void addFeedback() {
CenteredIconFigure figure = (CenteredIconFigure) getFigure();
figure.setMode(CenteredIconFigure.SELECTED);
figure.refresh();
}
Aggregations