Search in sources :

Example 1 with CenteredIconFigure

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;
}
Also used : MouseListener(org.eclipse.draw2d.MouseListener) CenteredIconFigure(org.eclipse.wst.xsd.ui.internal.design.figures.CenteredIconFigure) SetInputToGraphView(org.eclipse.wst.xsd.ui.internal.adt.actions.SetInputToGraphView)

Example 2 with CenteredIconFigure

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();
}
Also used : CenteredIconFigure(org.eclipse.wst.xsd.ui.internal.design.figures.CenteredIconFigure)

Example 3 with CenteredIconFigure

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();
}
Also used : CenteredIconFigure(org.eclipse.wst.xsd.ui.internal.design.figures.CenteredIconFigure)

Example 4 with CenteredIconFigure

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;
}
Also used : CenteredIconFigure(org.eclipse.wst.xsd.ui.internal.design.figures.CenteredIconFigure) Rectangle(org.eclipse.draw2d.geometry.Rectangle) Point(org.eclipse.draw2d.geometry.Point) Point(org.eclipse.draw2d.geometry.Point)

Example 5 with CenteredIconFigure

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();
}
Also used : CenteredIconFigure(org.eclipse.wst.xsd.ui.internal.design.figures.CenteredIconFigure)

Aggregations

CenteredIconFigure (org.eclipse.wst.xsd.ui.internal.design.figures.CenteredIconFigure)5 MouseListener (org.eclipse.draw2d.MouseListener)1 Point (org.eclipse.draw2d.geometry.Point)1 Rectangle (org.eclipse.draw2d.geometry.Rectangle)1 SetInputToGraphView (org.eclipse.wst.xsd.ui.internal.adt.actions.SetInputToGraphView)1