Search in sources :

Example 26 with AbstractMultiPageTalendEditor

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

the class TalendEditorComponentCreationUtil method removeAssistListenerOnOpenedEditors.

public static void removeAssistListenerOnOpenedEditors() {
    IEditorReference[] editorReferences = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences();
    for (IEditorReference er : editorReferences) {
        if (er == null) {
            continue;
        }
        IEditorPart editor = er.getEditor(true);
        if (editor == null || !(editor instanceof AbstractMultiPageTalendEditor)) {
            continue;
        }
        AbstractTalendEditor talendEditor = ((AbstractMultiPageTalendEditor) editor).getTalendEditor();
        removeComponentCreationAssist(talendEditor);
    }
}
Also used : IEditorReference(org.eclipse.ui.IEditorReference) AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor) AbstractTalendEditor(org.talend.designer.core.ui.editor.AbstractTalendEditor) IEditorPart(org.eclipse.ui.IEditorPart)

Example 27 with AbstractMultiPageTalendEditor

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

the class TalendEditorComponentCreationUtil method registerAssistListenerFromOpenedEditors.

public static void registerAssistListenerFromOpenedEditors() {
    IEditorReference[] editorReferences = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences();
    for (IEditorReference er : editorReferences) {
        if (er == null) {
            continue;
        }
        IEditorPart editor = er.getEditor(true);
        if (editor == null || !(editor instanceof AbstractMultiPageTalendEditor)) {
            continue;
        }
        AbstractTalendEditor talendEditor = ((AbstractMultiPageTalendEditor) editor).getTalendEditor();
        addComponentCreationAssist(talendEditor);
    }
}
Also used : IEditorReference(org.eclipse.ui.IEditorReference) AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor) AbstractTalendEditor(org.talend.designer.core.ui.editor.AbstractTalendEditor) IEditorPart(org.eclipse.ui.IEditorPart)

Example 28 with AbstractMultiPageTalendEditor

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

the class JobletUtil method needReadOnlyJoblet.

public boolean needReadOnlyJoblet(JobletProcessItem jobletItem) {
    IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    IEditorPart[] editors = page.getEditors();
    for (IEditorPart editor : editors) {
        if (editor instanceof AbstractMultiPageTalendEditor) {
            List<? extends INode> nodeList = ((AbstractMultiPageTalendEditor) editor).getProcess().getGraphicalNodes();
            for (INode node : nodeList) {
                if (((Node) node).isJoblet() && jobletItem.getProperty() != null) {
                    if (jobletItem.getProperty().getId().equals(node.getComponent().getProcess().getId())) {
                        boolean haveLock = jobletItem.getState().isLocked();
                        boolean isSvn = false;
                        ISVNProviderService service = null;
                        if (PluginChecker.isSVNProviderPluginLoaded()) {
                            service = (ISVNProviderService) GlobalServiceRegister.getDefault().getService(ISVNProviderService.class);
                        }
                        if (service != null && service.isProjectInSvnMode()) {
                            isSvn = service.isProjectInSvnMode();
                        }
                        if (isSvn) {
                            IProxyRepositoryService proxyService = (IProxyRepositoryService) GlobalServiceRegister.getDefault().getService(IProxyRepositoryService.class);
                            IProxyRepositoryFactory factory = proxyService.getProxyRepositoryFactory();
                            ERepositoryStatus repositoryStatus = factory.getStatus(jobletItem);
                            if (repositoryStatus == ERepositoryStatus.LOCK_BY_USER) {
                                haveLock = true;
                            }
                        }
                        if (haveLock) {
                            return true;
                        }
                    }
                }
            }
        }
    }
    return false;
}
Also used : INode(org.talend.core.model.process.INode) ERepositoryStatus(org.talend.commons.runtime.model.repository.ERepositoryStatus) AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor) IProxyRepositoryService(org.talend.repository.model.IProxyRepositoryService) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) ISVNProviderService(org.talend.core.services.ISVNProviderService) IEditorPart(org.eclipse.ui.IEditorPart) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory)

Example 29 with AbstractMultiPageTalendEditor

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

the class JobletUtil method openedInJob.

public boolean openedInJob(JobletProcessItem jobletItem, Node currNode) {
    IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    IEditorPart[] editors = page.getEditors();
    for (IEditorPart editor : editors) {
        if (editor instanceof AbstractMultiPageTalendEditor) {
            IProcess2 pro = ((AbstractMultiPageTalendEditor) editor).getProcess();
            if (currNode != null) {
                IProcess2 currPro = (IProcess2) currNode.getProcess();
                if (currPro.getId().equals(pro.getId())) {
                    List<? extends INode> currNodeList = currPro.getGraphicalNodes();
                    for (INode node : currNodeList) {
                        if (node == currNode) {
                            continue;
                        } else {
                            if (((Node) node).isJoblet() && jobletItem.getProperty() != null) {
                                if (jobletItem.getProperty().getId().equals(node.getComponent().getProcess().getId()) && jobletItem.getProperty().getVersion().equals(node.getComponent().getVersion())) {
                                    boolean haveOpened = !((Node) node).getNodeContainer().isCollapsed();
                                    if (haveOpened) {
                                        return true;
                                    }
                                }
                            }
                        }
                    }
                    continue;
                }
            }
            List<? extends INode> nodeList = pro.getGraphicalNodes();
            for (INode node : nodeList) {
                if (((Node) node).isJoblet() && jobletItem.getProperty() != null) {
                    if (jobletItem.getProperty().getId().equals(node.getComponent().getProcess().getId()) && jobletItem.getProperty().getVersion().equals(node.getComponent().getVersion())) {
                        boolean haveOpened = !((Node) node).getNodeContainer().isCollapsed();
                        if (haveOpened) {
                            return true;
                        }
                    }
                }
            }
        }
    }
    return false;
}
Also used : INode(org.talend.core.model.process.INode) AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor) Node(org.talend.designer.core.ui.editor.nodes.Node) IExternalNode(org.talend.core.model.process.IExternalNode) INode(org.talend.core.model.process.INode) JobletNode(org.talend.designer.joblet.model.JobletNode) IProcess2(org.talend.core.model.process.IProcess2) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IEditorPart(org.eclipse.ui.IEditorPart)

Example 30 with AbstractMultiPageTalendEditor

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

the class TalendTabbedPropertySheetPage method selectionChanged.

@Override
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
    ISelection newSelection;
    if (part instanceof AbstractMultiPageTalendEditor) {
        AbstractMultiPageTalendEditor mpte = (AbstractMultiPageTalendEditor) part;
        newSelection = mpte.getTalendEditor().getViewer().getSelection();
        if (selection instanceof StructuredSelection) {
            StructuredSelection structSel = (StructuredSelection) newSelection;
            if (structSel.size() != 1) {
                return;
            }
            if (structSel.getFirstElement() instanceof EditPart) {
                if (structSel.equals(oldSelection)) {
                // if (getCurrentTab() != null) {
                // getCurrentTab().setInput(part, selection);
                // }
                } else {
                    super.selectionChanged(part, selection);
                }
                oldSelection = structSel;
            }
        }
    } else if (part instanceof ContentOutline) {
        ContentOutline outline = (ContentOutline) part;
        newSelection = outline.getSelection();
        if (selection instanceof StructuredSelection) {
            StructuredSelection structSel = (StructuredSelection) newSelection;
            if (structSel.size() != 1) {
                return;
            }
            if (structSel.getFirstElement() instanceof NodeTreeEditPart) {
                if (structSel.equals(oldSelection)) {
                // this.getCurrentTab().setInput(part, selection);
                } else {
                    super.selectionChanged(part, selection);
                }
                oldSelection = structSel;
            }
        }
    }
}
Also used : NodeTreeEditPart(org.talend.designer.core.ui.editor.outline.NodeTreeEditPart) AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor) ISelection(org.eclipse.jface.viewers.ISelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) NodeTreeEditPart(org.talend.designer.core.ui.editor.outline.NodeTreeEditPart) EditPart(org.eclipse.gef.EditPart) ContentOutline(org.eclipse.ui.views.contentoutline.ContentOutline)

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