Search in sources :

Example 1 with TalendEditor

use of org.talend.designer.core.ui.editor.TalendEditor in project tdi-studio-se by Talend.

the class MultiPageEditorContributor method setActivePage.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.ui.part.MultiPageEditorActionBarContributor#setActivePage(org.eclipse.ui.IEditorPart)
     */
@Override
public void setActivePage(final IEditorPart activeEditor) {
    if ((activeEditorPart == activeEditor) || (activeEditor == null)) {
        return;
    }
    activeEditorPart = activeEditor;
    if (activeEditor instanceof TalendEditor) {
        RootEditPart editPart = ((TalendEditor) activeEditor).getViewer().getRootEditPart();
        if (editPart != null && editPart instanceof TalendScalableFreeformRootEditPart) {
            ZoomManager manager = ((TalendScalableFreeformRootEditPart) ((TalendEditor) activeEditor).getViewer().getRootEditPart()).getZoomManager();
            item.setZoomManager(manager);
        }
    } else {
        item.setZoomManager(null);
    }
    IActionBars actionBars = getActionBars();
    if (actionBars != null) {
        actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), getAction(activeEditor, ActionFactory.DELETE.getId()));
        actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), getAction(activeEditor, ActionFactory.UNDO.getId()));
        actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), getAction(activeEditor, ActionFactory.REDO.getId()));
        actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(), getAction(activeEditor, ActionFactory.CUT.getId()));
        actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), getAction(activeEditor, ActionFactory.COPY.getId()));
        actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), getAction(activeEditor, ActionFactory.PASTE.getId()));
        actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), getAction(activeEditor, ActionFactory.SELECT_ALL.getId()));
        actionBars.setGlobalActionHandler(ToggleSubjobsAction.ID, getAction(activeEditor, ToggleSubjobsAction.ID));
        // see bug 0003656: Actions in the main menu "View" are always disabled.
        activateActionsInViewMenu(activeEditor, actionBars, VIEW_MENU_ACTIONS_ID);
        // MOD mzhao bug 8710
        if (showAndRunProcessAction != null) {
            actionBars.setGlobalActionHandler(showAndRunProcessAction.getActionDefinitionId(), showAndRunProcessAction);
        }
        actionBars.updateActionBars();
    }
}
Also used : TalendScalableFreeformRootEditPart(org.talend.designer.core.ui.editor.TalendScalableFreeformRootEditPart) ZoomManager(org.eclipse.gef.editparts.ZoomManager) TalendEditor(org.talend.designer.core.ui.editor.TalendEditor) AbstractTalendEditor(org.talend.designer.core.ui.editor.AbstractTalendEditor) IActionBars(org.eclipse.ui.IActionBars) TalendScalableFreeformRootEditPart(org.talend.designer.core.ui.editor.TalendScalableFreeformRootEditPart) RootEditPart(org.eclipse.gef.RootEditPart)

Aggregations

RootEditPart (org.eclipse.gef.RootEditPart)1 ZoomManager (org.eclipse.gef.editparts.ZoomManager)1 IActionBars (org.eclipse.ui.IActionBars)1 AbstractTalendEditor (org.talend.designer.core.ui.editor.AbstractTalendEditor)1 TalendEditor (org.talend.designer.core.ui.editor.TalendEditor)1 TalendScalableFreeformRootEditPart (org.talend.designer.core.ui.editor.TalendScalableFreeformRootEditPart)1