Search in sources :

Example 51 with IWorkbenchWindow

use of org.eclipse.ui.IWorkbenchWindow in project tdi-studio-se by Talend.

the class DesignerCoreService method refreshComponentView.

@Override
public void refreshComponentView(Item item) {
    try {
        IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
        IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
        IEditorReference[] editors = activePage.getEditorReferences();
        for (IEditorReference er : editors) {
            IEditorPart part = er.getEditor(false);
            if (part instanceof AbstractMultiPageTalendEditor) {
                AbstractMultiPageTalendEditor editor = (AbstractMultiPageTalendEditor) part;
                CommandStack stack = (CommandStack) editor.getTalendEditor().getAdapter(CommandStack.class);
                if (stack != null) {
                    IProcess process = editor.getProcess();
                    for (final INode processNode : process.getGraphicalNodes()) {
                        if (processNode instanceof Node) {
                            checkRepository((Node) processNode, item, stack);
                        }
                    }
                }
            }
        }
    } catch (Exception e) {
        ExceptionHandler.process(e);
    }
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) CommandStack(org.eclipse.gef.commands.CommandStack) INode(org.talend.core.model.process.INode) IEditorReference(org.eclipse.ui.IEditorReference) AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor) Node(org.talend.designer.core.ui.editor.nodes.Node) INode(org.talend.core.model.process.INode) DataNode(org.talend.designer.core.model.process.DataNode) ConvertRepositoryNodeToProcessNode(org.talend.designer.core.ui.editor.process.ConvertRepositoryNodeToProcessNode) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IEditorPart(org.eclipse.ui.IEditorPart) IProcess(org.talend.core.model.process.IProcess) JavaModelException(org.eclipse.jdt.core.JavaModelException) ProcessorException(org.talend.designer.runprocess.ProcessorException)

Example 52 with IWorkbenchWindow

use of org.eclipse.ui.IWorkbenchWindow in project tdi-studio-se by Talend.

the class TalendPaletteHelper method checkAndInitToolBar.

public static void checkAndInitToolBar() {
    if (talendPartListener == null) {
        talendPartListener = new TalendPartAdapter2() {

            @Override
            public void partActivated(IWorkbenchPartReference partRef) {
                checkAndInitToolBar();
            }

            @Override
            public void partOpened(IWorkbenchPartReference partRef) {
                checkAndInitToolBar();
            }
        };
        IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
        if (activeWorkbenchWindow != null) {
            IPartService partService = activeWorkbenchWindow.getPartService();
            partService.addPartListener(talendPartListener);
        }
    }
    // check every time
    checkAndInitToolBar2();
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) TalendPartAdapter2(org.talend.designer.core.TalendPartAdapter2) IPartService(org.eclipse.ui.IPartService) IWorkbenchPartReference(org.eclipse.ui.IWorkbenchPartReference)

Example 53 with IWorkbenchWindow

use of org.eclipse.ui.IWorkbenchWindow in project tdi-studio-se by Talend.

the class DesignerColorsPreferencePage method switchToCurrentColor.

/**
     * zli Comment method "switchToCurrentColor".
     */
private void switchToCurrentColor() {
    IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (activeWorkbenchWindow != null) {
        IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
        if (activePage != null) {
            for (IEditorReference ref : activePage.getEditorReferences()) {
                IEditorPart editor = ref.getEditor(true);
                if (editor instanceof AbstractMultiPageTalendEditor) {
                    AbstractMultiPageTalendEditor pageEditor = (AbstractMultiPageTalendEditor) editor;
                    AbstractTalendEditor talendEditor = pageEditor.getTalendEditor();
                    ProcessPart processPart = talendEditor.getProcessPart();
                    processPart.ajustReadOnly();
                    changeMRGroupColor(processPart);
                }
            }
        }
    }
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) IEditorReference(org.eclipse.ui.IEditorReference) AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor) AbstractTalendEditor(org.talend.designer.core.ui.editor.AbstractTalendEditor) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IEditorPart(org.eclipse.ui.IEditorPart) ProcessPart(org.talend.designer.core.ui.editor.process.ProcessPart)

Example 54 with IWorkbenchWindow

use of org.eclipse.ui.IWorkbenchWindow in project tdi-studio-se by Talend.

the class CreateDiagramAction method setRepositoryNode.

private void setRepositoryNode(Properties params) {
    IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (null == workbenchWindow) {
        return;
    }
    IWorkbenchPage workbenchPage = workbenchWindow.getActivePage();
    if (null == workbenchPage) {
        return;
    }
    IPerspectiveDescriptor currentPerspective = workbenchPage.getPerspective();
    if (!IBrandingConfiguration.PERSPECTIVE_DI_ID.equals(currentPerspective.getId())) {
        // show di perspective
        try {
            workbenchWindow.getWorkbench().showPerspective(IBrandingConfiguration.PERSPECTIVE_DI_ID, workbenchWindow);
            workbenchPage = workbenchWindow.getActivePage();
        } catch (WorkbenchException e) {
            ExceptionHandler.process(e);
            return;
        }
    }
    // bug 16594
    IRepositoryView view = RepositoryManagerHelper.getRepositoryView();
    if (view != null) {
        Object type = params.get("type");
        if (ERepositoryObjectType.BUSINESS_PROCESS != null && ERepositoryObjectType.BUSINESS_PROCESS.name().equals(type)) {
            RepositoryNode processNode = ((ProjectRepositoryNode) view.getRoot()).getRootRepositoryNode(ERepositoryObjectType.BUSINESS_PROCESS);
            final StructuredViewer viewer = view.getViewer();
            if (viewer instanceof TreeViewer) {
                ((TreeViewer) viewer).expandToLevel(processNode, 1);
            }
            this.repositoryNode = processNode;
        }
    }
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) TreeViewer(org.eclipse.jface.viewers.TreeViewer) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IPerspectiveDescriptor(org.eclipse.ui.IPerspectiveDescriptor) ProjectRepositoryNode(org.talend.core.repository.model.ProjectRepositoryNode) StructuredViewer(org.eclipse.jface.viewers.StructuredViewer) WorkbenchException(org.eclipse.ui.WorkbenchException) IRepositoryView(org.talend.repository.ui.views.IRepositoryView) ProjectRepositoryNode(org.talend.core.repository.model.ProjectRepositoryNode) RepositoryNode(org.talend.repository.model.RepositoryNode)

Example 55 with IWorkbenchWindow

use of org.eclipse.ui.IWorkbenchWindow in project tdi-studio-se by Talend.

the class DownloadComponenentsAction method selectPaletteEntry.

private void selectPaletteEntry(String componentName) {
    IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (activeWorkbenchWindow != null) {
        IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
        if (activePage != null) {
            IEditorReference[] editorReferences = activePage.getEditorReferences();
            if (editorReferences != null) {
                for (IEditorReference er : editorReferences) {
                    IEditorPart part = er.getEditor(false);
                    if (part instanceof AbstractMultiPageTalendEditor) {
                        AbstractMultiPageTalendEditor editor = (AbstractMultiPageTalendEditor) part;
                        AbstractTalendEditor talendEditor = editor.getTalendEditor();
                        try {
                            ComponentPaletteUtilities.setSkipUpdatePalette(true);
                            talendEditor.selectPaletteEntry(componentName);
                        } catch (Exception e) {
                            ExceptionHandler.process(e);
                        }
                        return;
                    }
                }
            }
        }
    }
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) IEditorReference(org.eclipse.ui.IEditorReference) AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor) AbstractTalendEditor(org.talend.designer.core.ui.editor.AbstractTalendEditor) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IEditorPart(org.eclipse.ui.IEditorPart)

Aggregations

IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)363 IEditorPart (org.eclipse.ui.IEditorPart)136 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)102 PartInitException (org.eclipse.ui.PartInitException)81 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)41 QueryEditorPart (com.cubrid.common.ui.query.editor.QueryEditorPart)39 IViewPart (org.eclipse.ui.IViewPart)39 ArrayList (java.util.ArrayList)37 IEditorReference (org.eclipse.ui.IEditorReference)35 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)32 IWorkbench (org.eclipse.ui.IWorkbench)32 IFile (org.eclipse.core.resources.IFile)30 ISelection (org.eclipse.jface.viewers.ISelection)29 XLIFFEditorImplWithNatTable (net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable)27 Shell (org.eclipse.swt.widgets.Shell)26 XLFHandler (net.heartsome.cat.ts.core.file.XLFHandler)24 CoreException (org.eclipse.core.runtime.CoreException)23 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)21 IProject (org.eclipse.core.resources.IProject)20 QueryUnit (com.cubrid.common.ui.query.editor.QueryUnit)19