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();
}
}
}
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);
}
}
}
}
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();
}
}
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);
}
}
}
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());
}
Aggregations