Search in sources :

Example 71 with IEditorPart

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

the class StatsAndLogsView method getCurrentJob.

/**
     * Gets current opened job.
     */
private void getCurrentJob() {
    final IEditorPart activeEditor = getSite().getPage().getActiveEditor();
    if (activeEditor != null && activeEditor instanceof AbstractMultiPageTalendEditor) {
        AbstractTalendEditor talendEditor = ((AbstractMultiPageTalendEditor) activeEditor).getTalendEditor();
        Process process = (Process) talendEditor.getProcess();
        if (process != null) {
            this.process = process;
            this.title = talendEditor.getTitle();
        }
    }
}
Also used : AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor) AbstractTalendEditor(org.talend.designer.core.ui.editor.AbstractTalendEditor) Process(org.talend.designer.core.ui.editor.process.Process) IEditorPart(org.eclipse.ui.IEditorPart)

Example 72 with IEditorPart

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

the class ProblemsView method selectInDesigner.

private void selectInDesigner(BasicJobInfo jobInfo, String nodeName) {
    IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    IEditorReference[] editorParts = page.getEditorReferences();
    for (IEditorReference reference : editorParts) {
        IEditorPart editor = reference.getEditor(false);
        if (editor instanceof AbstractMultiPageTalendEditor) {
            AbstractMultiPageTalendEditor mpte = (AbstractMultiPageTalendEditor) editor;
            if (mpte.getTalendEditor().getProcess().getId().equals(jobInfo.getJobId()) && mpte.getTalendEditor().getProcess().getVersion().equals(jobInfo.getJobVersion())) {
                page.bringToTop(mpte);
                mpte.selectNode(nodeName);
            }
        }
    }
}
Also used : IEditorReference(org.eclipse.ui.IEditorReference) AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IEditorPart(org.eclipse.ui.IEditorPart)

Example 73 with IEditorPart

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

the class ActiveProcessTracker method partClosed.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.ui.IPartListener#partClosed(org.eclipse.ui.IWorkbenchPart)
     */
@Override
public void partClosed(IWorkbenchPart part) {
    if (part instanceof AbstractMultiPageTalendEditor && currentProcess != null) {
        AbstractMultiPageTalendEditor mpte = (AbstractMultiPageTalendEditor) part;
        if (mpte.isKeepPropertyLocked()) {
            currentProcess = null;
            return;
        }
        IProcess process = getJobFromActivatedEditor(part);
        if (process != null) {
            Problems.removeProblemsByProcess(process);
            Problems.removeJob(process);
            IRunProcessService service = DesignerPlugin.getDefault().getRunProcessService();
            service.removeProcess(process);
            CodeView.refreshCodeView(null);
            if (currentProcess == process) {
                //$NON-NLS-1$
                Contexts.setTitle("");
                Contexts.clearAll();
                if (lastProcessOpened == currentProcess) {
                    lastProcessOpened = null;
                }
                currentProcess = null;
                for (IJobTrackerListener listener : jobTrackerListeners) {
                    listener.allJobClosed();
                }
            } else if (lastProcessOpened == process) {
                lastProcessOpened = currentProcess;
            }
            if (GlobalServiceRegister.getDefault().isServiceRegistered(ISQLBuilderService.class)) {
                ISQLBuilderService sqlBuilderService = (ISQLBuilderService) GlobalServiceRegister.getDefault().getService(ISQLBuilderService.class);
                sqlBuilderService.closeSqlBuilderDialogs(process.getName());
            }
        }
    } else if (part instanceof IEditorPart) {
        if (GlobalServiceRegister.getDefault().isServiceRegistered(IDiagramModelService.class) && CorePlugin.getDefault().getDiagramModelService().isBusinessDiagramEditor((IEditorPart) part)) {
            //$NON-NLS-1$
            Contexts.setTitle("");
            Contexts.clearAll();
        }
    }
    if (part instanceof AbstractMultiPageTalendEditor) {
        AbstractMultiPageTalendEditor mpte = (AbstractMultiPageTalendEditor) part;
        mpte.beforeDispose();
        JobSettings.switchToCurJobSettingsView();
    }
}
Also used : IRunProcessService(org.talend.designer.runprocess.IRunProcessService) IEditorPart(org.eclipse.ui.IEditorPart) IProcess(org.talend.core.model.process.IProcess) ISQLBuilderService(org.talend.core.ui.services.ISQLBuilderService)

Example 74 with IEditorPart

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

the class ActiveProcessTracker method partOpened.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.ui.IPartListener#partOpened(org.eclipse.ui.IWorkbenchPart)
     */
@Override
public void partOpened(IWorkbenchPart part) {
    boolean existedJobOpened = false;
    if (part instanceof AbstractMultiPageTalendEditor) {
        AbstractMultiPageTalendEditor mpte = (AbstractMultiPageTalendEditor) part;
        if (mpte.isJobAlreadyOpened()) {
            mpte.updateChildrens();
            // close the first editor and keep the new one. (so only one will remain)
            IEditorReference[] ref = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findEditors(mpte.getEditorInput(), mpte.getEditorId(), IWorkbenchPage.MATCH_INPUT);
            IEditorPart editorPart = ref[0].getEditor(false);
            editorPart.doSave(new NullProgressMonitor());
            ((AbstractMultiPageTalendEditor) editorPart).setKeepPropertyLocked(true);
            PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeEditor(editorPart, false);
            existedJobOpened = true;
        }
    } else {
        if (GlobalServiceRegister.getDefault().isServiceRegistered(IDiagramModelService.class)) {
            CorePlugin.getDefault().getDiagramModelService().handleNewEditorAction(part);
        }
    }
    IProcess2 process = getJobFromActivatedEditor(part);
    if (part instanceof AbstractMultiPageTalendEditor && process instanceof Process) {
        ((Process) process).setEditor((AbstractMultiPageTalendEditor) part);
    }
    if (process != null && currentProcess != process && lastProcessOpened != process) {
        lastProcessOpened = process;
        addJobInProblemView(process);
    } else if (existedJobOpened) {
        currentProcess = process;
        for (IJobTrackerListener listener : jobTrackerListeners) {
            listener.focusOnJob(process);
        }
    }
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IEditorReference(org.eclipse.ui.IEditorReference) IProcess2(org.talend.core.model.process.IProcess2) IProcess(org.talend.core.model.process.IProcess) Process(org.talend.designer.core.ui.editor.process.Process) IEditorPart(org.eclipse.ui.IEditorPart)

Example 75 with IEditorPart

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

the class AbstractMultiPageTalendEditor method doSaveAs.

/**
     * Saves the multi-page editor's document as another file. Also updates the text for page 0's tab, and updates this
     * multi-page editor's input to correspond to the nested editor's.
     */
@Override
public void doSaveAs() {
    IEditorPart editor = getEditor(0);
    editor.doSaveAs();
// setPageText(0, editor.getTitle());
// setInput(editor.getEditorInput());
}
Also used : IEditorPart(org.eclipse.ui.IEditorPart)

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