Search in sources :

Example 41 with AbstractMultiPageTalendEditor

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

the class DesignerCoreService method getCurrentProcess.

// ends.
/*
     * (non-Javadoc)
     * 
     * @see org.talend.designer.core.IDesignerCoreService#getCurrentProcess()
     */
@Override
public IProcess getCurrentProcess() {
    IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
    if (!(editor instanceof AbstractMultiPageTalendEditor)) {
        return null;
    }
    IProcess process = ((AbstractMultiPageTalendEditor) editor).getProcess();
    return process;
}
Also used : AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor) IEditorPart(org.eclipse.ui.IEditorPart) IProcess(org.talend.core.model.process.IProcess)

Example 42 with AbstractMultiPageTalendEditor

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

the class StatsAndLogsComposite method useProjectSettingButtonClick.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.designer.core.ui.views.jobsettings.AbstractPreferenceComposite#useProjectSettingButtonClick()
     */
@Override
protected void useProjectSettingButtonClick() {
    boolean flag = useProjectSetting.getSelection();
    setMainCompositeEnable(!flag);
    topComposite.setEnabled(true);
    ElementParameter2ParameterType.setParameterValue(pType, EParameterName.STATANDLOG_USE_PROJECT_SETTINGS.getName(), Boolean.valueOf(flag));
    PropertyChangeCommand cmd = new PropertyChangeCommand(elem, EParameterName.STATANDLOG_USE_PROJECT_SETTINGS.getName(), Boolean.valueOf(flag));
    getCommandStack().execute(cmd);
    updateContextValue(flag);
    // hywang add for bug 7587
    IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
    if (activeEditor != null && activeEditor instanceof AbstractMultiPageTalendEditor) {
        AbstractTalendEditor workbenchPart = ((AbstractMultiPageTalendEditor) activeEditor).getTalendEditor();
        Boolean currentEditorDirty = workbenchPart.isDirty();
        if (!currentEditorDirty) {
            workbenchPart.setDirty(true);
        }
    }
    if (flag) {
        useProjectSetting();
    }
}
Also used : PropertyChangeCommand(org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand) AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor) AbstractTalendEditor(org.talend.designer.core.ui.editor.AbstractTalendEditor) IEditorPart(org.eclipse.ui.IEditorPart)

Example 43 with AbstractMultiPageTalendEditor

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

the class SQLPatternComposite method executeCommand.

/**
     * yzhang Comment method "executeCommand".
     * 
     * @param cmd
     */
private void executeCommand(Command cmd) {
    if (commandStack == null) {
        IEditorPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
        if (part instanceof AbstractMultiPageTalendEditor) {
            AbstractTalendEditor editor = ((AbstractMultiPageTalendEditor) part).getTalendEditor();
            commandStack = (CommandStack) editor.getAdapter(CommandStack.class);
        }
    }
    if (commandStack == null) {
        return;
    }
    commandStack.execute(cmd);
}
Also used : AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor) AbstractTalendEditor(org.talend.designer.core.ui.editor.AbstractTalendEditor) IEditorPart(org.eclipse.ui.IEditorPart)

Example 44 with AbstractMultiPageTalendEditor

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

the class TalendPaletteHelper method checkAndInitToolBar2.

private static void checkAndInitToolBar2() {
    //
    IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (activeWorkbenchWindow == null || activeWorkbenchWindow.getActivePage() == null) {
        return;
    }
    boolean isTalendEditor = false;
    IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
    IEditorPart activePart = activePage.getActiveEditor();
    if (activePart != null && activePart instanceof AbstractMultiPageTalendEditor) {
        isTalendEditor = true;
    }
    IViewPart paletteViewPart = activePage.findView(PaletteView.ID);
    if (paletteViewPart != null) {
        // find existing or not, and add it.
        IActionBars actionBars = paletteViewPart.getViewSite().getActionBars();
        // ShowStandardAction showStandardAction = ShowStandardAction.getInstance();
        // updatePaletteActions(actionBars, showStandardAction, isTalendEditor);
        //
        // ShowFavoriteAction showFavoriteAction = ShowFavoriteAction.getInstance();
        // updatePaletteActions(actionBars, showFavoriteAction, isTalendEditor);
        //
        // if (ShowFavoriteAction.state) {
        // showStandardAction.doSetEnable();
        // }
        OpenPaletteFilterAction openPaletteFilterAction = OpenPaletteFilterAction.getInstance();
        updatePaletteActions(actionBars, openPaletteFilterAction, isTalendEditor);
        actionBars.updateActionBars();
    }
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) IViewPart(org.eclipse.ui.IViewPart) OpenPaletteFilterAction(org.talend.repository.ui.actions.OpenPaletteFilterAction) AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IEditorPart(org.eclipse.ui.IEditorPart) IActionBars(org.eclipse.ui.IActionBars)

Example 45 with AbstractMultiPageTalendEditor

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

the class NodePart method setSelected.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.gef.editparts.AbstractEditPart#setSelected(int)
     */
@Override
@SuppressWarnings("unchecked")
public void setSelected(final int value) {
    if (value == SELECTED) {
        super.setSelected(SELECTED_PRIMARY);
    } else {
        super.setSelected(value);
    }
    IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    if (value == SELECTED_NONE) {
        ComponentSettingsView viewer = (ComponentSettingsView) page.findView(ComponentSettingsView.ID);
        if (viewer == null) {
            return;
        }
        ComponentSettingsView compSettings = viewer;
        compSettings.cleanDisplay();
        return;
    }
    IEditorPart activeEditor = page.getActiveEditor();
    if (activeEditor instanceof AbstractMultiPageTalendEditor) {
        GraphicalViewer designerViewer = ((AbstractMultiPageTalendEditor) activeEditor).getTalendEditor().getViewer();
        Control ctrl = designerViewer.getControl();
        String helpLink = (String) ((Node) getModel()).getPropertyValue(EParameterName.HELP.getName());
        String requiredHelpLink = ((Process) ((Node) getModel()).getProcess()).getBaseHelpLink() + ((Node) getModel()).getComponent().getName();
        if (helpLink == null || "".equals(helpLink) || !requiredHelpLink.equals(helpLink)) {
            //$NON-NLS-1$
            helpLink = ((Process) ((Node) getModel()).getProcess()).getBaseHelpLink() + ((Node) getModel()).getComponent().getName();
        }
        if (ctrl != null) {
            PlatformUI.getWorkbench().getHelpSystem().setHelp(ctrl, helpLink);
        }
        // This code was to update automatically the help view, to set the documentation of the selected component
        // remove for TDI-24396
        //            IViewPart view = page.findView("org.eclipse.help.ui.HelpView"); //$NON-NLS-1$
        // if (view != null) {
        // PlatformUI.getWorkbench().getHelpSystem().displayHelp(helpLink);
        // }
        TalendSelectionManager selectionManager = (TalendSelectionManager) designerViewer.getSelectionManager();
        if (value == SELECTED || value == SELECTED_PRIMARY) {
            ComponentSettingsView viewer = (ComponentSettingsView) page.findView(ComponentSettingsView.ID);
            if (viewer == null) {
                return;
            }
            if (selectionManager.getSelectionType() == ETalendSelectionType.SINGLE) {
                ComponentSettingsView compSettings = viewer;
                compSettings.setElement((Node) getModel());
                if (((Node) getModel()).getComponent() instanceof DummyComponent) {
                    MessageDialog.openWarning(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), //$NON-NLS-1$
                    Messages.getString("NodePart_warning"), //$NON-NLS-1$
                    Messages.getString("NodePart_componentNotLoaded"));
                    return;
                }
                CodeView.refreshCodeView((Node) getModel());
            } else if (!viewer.isCleaned() && selectionManager.getSelectionType() == ETalendSelectionType.MULTIPLE) {
                ComponentSettingsView compSettings = viewer;
                compSettings.cleanDisplay();
            } else if (isDrop()) {
                if (value == SELECTED || value == SELECTED_PRIMARY) {
                    ComponentSettingsView compSettings = viewer;
                    compSettings.setElement((Node) getModel());
                    if (((Node) getModel()).getComponent() instanceof DummyComponent) {
                        MessageDialog.openWarning(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), //$NON-NLS-1$
                        Messages.getString("NodePart_warning"), //$NON-NLS-1$
                        Messages.getString("NodePart_componentNotLoaded"));
                        return;
                    }
                    CodeView.refreshCodeView((Node) getModel());
                }
            }
        }
    }
}
Also used : Control(org.eclipse.swt.widgets.Control) GraphicalViewer(org.eclipse.gef.GraphicalViewer) DummyComponent(org.talend.designer.core.model.components.DummyComponent) AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor) IExternalNode(org.talend.core.model.process.IExternalNode) INode(org.talend.core.model.process.INode) IGraphicalNode(org.talend.core.ui.process.IGraphicalNode) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) Process(org.talend.designer.core.ui.editor.process.Process) IEditorPart(org.eclipse.ui.IEditorPart) ComponentSettingsView(org.talend.designer.core.ui.views.properties.ComponentSettingsView) TalendSelectionManager(org.talend.designer.core.ui.editor.TalendSelectionManager)

Aggregations

AbstractMultiPageTalendEditor (org.talend.designer.core.ui.AbstractMultiPageTalendEditor)53 IEditorPart (org.eclipse.ui.IEditorPart)26 INode (org.talend.core.model.process.INode)16 Node (org.talend.designer.core.ui.editor.nodes.Node)15 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)14 CommandStack (org.eclipse.gef.commands.CommandStack)13 AbstractTalendEditor (org.talend.designer.core.ui.editor.AbstractTalendEditor)12 GraphicalViewer (org.eclipse.gef.GraphicalViewer)10 IExternalNode (org.talend.core.model.process.IExternalNode)10 IProcess (org.talend.core.model.process.IProcess)10 ArrayList (java.util.ArrayList)9 List (java.util.List)8 EditPart (org.eclipse.gef.EditPart)8 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)8 IEditorReference (org.eclipse.ui.IEditorReference)7 PersistenceException (org.talend.commons.exception.PersistenceException)7 IProcess2 (org.talend.core.model.process.IProcess2)7 Property (org.talend.core.model.properties.Property)7 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)7 Process (org.talend.designer.core.ui.editor.process.Process)7