Search in sources :

Example 1 with FigureCanvas

use of org.eclipse.draw2d.FigureCanvas in project tdi-studio-se by Talend.

the class AbstractTalendEditor method configurationSubJob.

protected void configurationSubJob(GraphicalViewer viewer) {
    if (getProcess() != null) {
        if (getProcess().isSubjobEnabled()) {
            // toggle subjobs action
            IAction toggleSubjobsAction = ToggleSubjobsAction.getDefault();
            getActionRegistry().registerAction(toggleSubjobsAction);
            for (Iterator iterator = getSelectionActions().iterator(); iterator.hasNext(); ) {
                String actionID = (String) iterator.next();
                IAction action = getActionRegistry().getAction(actionID);
                setAction(actionID, action);
            }
        }
        int minx = getMinX();
        int miny = getMinY();
        if (viewer != null && viewer.getControl() instanceof FigureCanvas) {
            if (minx < 0) {
                ((FigureCanvas) viewer.getControl()).getViewport().getHorizontalRangeModel().setMinimum(minx);
                ((FigureCanvas) viewer.getControl()).scrollToX(minx);
            }
            if (miny < 0) {
                ((FigureCanvas) viewer.getControl()).getViewport().getVerticalRangeModel().setMinimum(miny);
                ((FigureCanvas) viewer.getControl()).scrollToY(miny);
            }
        }
    }
}
Also used : FigureCanvas(org.eclipse.draw2d.FigureCanvas) IAction(org.eclipse.jface.action.IAction) Iterator(java.util.Iterator) Point(org.eclipse.draw2d.geometry.Point)

Example 2 with FigureCanvas

use of org.eclipse.draw2d.FigureCanvas in project tdi-studio-se by Talend.

the class TalendPaletteViewerProvider method createPaletteViewer.

@Override
public PaletteViewer createPaletteViewer(Composite parent) {
    // removed by 10304
    // if (SystemUtils.IS_OS_MAC_OSX || SystemUtils.IS_OS_MAC) {
    // // PTDO need check it later and fix the bug on MacOS.
    // return super.createPaletteViewer(parent);
    // }
    talendPaletteViewer = new TalendPaletteViewer(this.getEditDomain(), cssStyleSetting);
    FigureCanvas canvas = new TalendFigureCanvas(parent, talendPaletteViewer.getLightweightSys(), talendPaletteViewer);
    talendPaletteViewer.setFigureCanvas(canvas);
    configurePaletteViewer(talendPaletteViewer);
    hookPaletteViewer(talendPaletteViewer);
    return talendPaletteViewer;
}
Also used : FigureCanvas(org.eclipse.draw2d.FigureCanvas)

Aggregations

FigureCanvas (org.eclipse.draw2d.FigureCanvas)2 Iterator (java.util.Iterator)1 Point (org.eclipse.draw2d.geometry.Point)1 IAction (org.eclipse.jface.action.IAction)1