Search in sources :

Example 81 with IEditorPart

use of org.eclipse.ui.IEditorPart 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 82 with IEditorPart

use of org.eclipse.ui.IEditorPart 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 83 with IEditorPart

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

the class ShowDesignerPageAction method run.

@Override
public void run() {
    IWorkbench workbench = PlatformUI.getWorkbench();
    IWorkbenchPage page = workbench.getActiveWorkbenchWindow().getActivePage();
    IEditorPart editorPart = page.getActiveEditor();
    if (editorPart instanceof MultiPageTalendEditor) {
        ((MultiPageTalendEditor) editorPart).showDesignerPage();
    }
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) MultiPageTalendEditor(org.talend.designer.core.ui.MultiPageTalendEditor) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IEditorPart(org.eclipse.ui.IEditorPart)

Example 84 with IEditorPart

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

the class ShowEditorPageAction method run.

@Override
public void run() {
    IWorkbench workbench = PlatformUI.getWorkbench();
    IWorkbenchPage page = workbench.getActiveWorkbenchWindow().getActivePage();
    IEditorPart editorPart = page.getActiveEditor();
    if (editorPart instanceof MultiPageTalendEditor) {
        ((MultiPageTalendEditor) editorPart).showCodePage();
    }
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) MultiPageTalendEditor(org.talend.designer.core.ui.MultiPageTalendEditor) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IEditorPart(org.eclipse.ui.IEditorPart)

Example 85 with IEditorPart

use of org.eclipse.ui.IEditorPart 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)

Aggregations

IEditorPart (org.eclipse.ui.IEditorPart)401 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)137 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)127 PartInitException (org.eclipse.ui.PartInitException)73 IFile (org.eclipse.core.resources.IFile)58 XLIFFEditorImplWithNatTable (net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable)53 IEditorReference (org.eclipse.ui.IEditorReference)52 XLFHandler (net.heartsome.cat.ts.core.file.XLFHandler)45 ArrayList (java.util.ArrayList)43 QueryEditorPart (com.cubrid.common.ui.query.editor.QueryEditorPart)41 IEditorInput (org.eclipse.ui.IEditorInput)37 IViewPart (org.eclipse.ui.IViewPart)34 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)33 Test (org.junit.Test)31 ISelection (org.eclipse.jface.viewers.ISelection)30 FileEditorInput (org.eclipse.ui.part.FileEditorInput)29 ITextEditor (org.eclipse.ui.texteditor.ITextEditor)27 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)26 AbstractMultiPageTalendEditor (org.talend.designer.core.ui.AbstractMultiPageTalendEditor)26 IXliffEditor (net.heartsome.cat.ts.ui.editors.IXliffEditor)24