use of org.talend.designer.core.ui.editor.ProcessEditorInput in project tdi-studio-se by Talend.
the class JobLaunchConfigurationDelegate method findProcessFromRepository.
/**
* DOC bqian Comment method "findProcessFromRepository".
*
* @param jobName
* @return
*/
private IProcess2 findProcessFromRepository(String jobId, String version) {
try {
ItemCacheManager.clearCache();
ProcessItem processItem = ItemCacheManager.getProcessItem(jobId, version);
if (processItem != null) {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IDesignerCoreService.class)) {
IDesignerCoreService service = (IDesignerCoreService) GlobalServiceRegister.getDefault().getService(IDesignerCoreService.class);
IProcess process = service.getProcessFromItem(processItem);
if (process instanceof IProcess2) {
return (IProcess2) process;
}
}
// keep old code for now, but it should never be called.
ProcessEditorInput fileEditorInput = new ProcessEditorInput(processItem, true, true, true);
IProcess2 process = fileEditorInput.getLoadedProcess();
return process;
}
} catch (Exception e) {
ExceptionHandler.process(e);
}
return null;
}
use of org.talend.designer.core.ui.editor.ProcessEditorInput in project tdi-studio-se by Talend.
the class CreateProcess method doRun.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.Action#run()
*/
@Override
protected void doRun() {
final NewProcessWizard processWizard;
if (isToolbar()) {
processWizard = new NewProcessWizard(null);
} else {
ISelection selection = getSelection();
if (selection == null) {
return;
}
Object obj = ((IStructuredSelection) selection).getFirstElement();
IRepositoryService service = DesignerPlugin.getDefault().getRepositoryService();
IPath path = service.getRepositoryPath((IRepositoryNode) obj);
if (RepositoryConstants.isSystemFolder(path.toString())) {
// Not allowed to create in system folder.
return;
}
processWizard = new NewProcessWizard(path);
}
WizardDialog dlg = new WizardDialog(Display.getCurrent().getActiveShell(), processWizard);
if (dlg.open() == Window.OK) {
if (processWizard.getProcess() == null) {
return;
}
ProcessEditorInput fileEditorInput;
try {
// Set readonly to false since created job will always be editable.
fileEditorInput = new ProcessEditorInput(processWizard.getProcess(), false, true, false);
IRepositoryNode repositoryNode = RepositorySeekerManager.getInstance().searchRepoViewNode(fileEditorInput.getItem().getProperty().getId(), false);
fileEditorInput.setRepositoryNode(repositoryNode);
IWorkbenchPage page = getActivePage();
page.openEditor(fileEditorInput, MultiPageTalendEditor.ID, true);
// // use project setting true
// ProjectSettingManager.defaultUseProjectSetting(fileEditorInput.getLoadedProcess());
} catch (PartInitException e) {
// TODO Auto-generated catch block
ExceptionHandler.process(e);
} catch (PersistenceException e) {
MessageBoxExceptionHandler.process(e);
}
}
}
use of org.talend.designer.core.ui.editor.ProcessEditorInput in project tdi-studio-se by Talend.
the class ReadProcess method doRun.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.Action#run()
*/
@Override
protected void doRun() {
ISelection selection = getSelection();
Object obj = ((IStructuredSelection) selection).getFirstElement();
RepositoryNode node = (RepositoryNode) obj;
ProcessItem processItem = (ProcessItem) node.getObject().getProperty().getItem();
IWorkbenchPage page = getActivePage();
try {
ProcessEditorInput fileEditorInput = new ProcessEditorInput(processItem, true, null, true);
checkUnLoadedNodeForProcess(fileEditorInput);
IEditorPart editorPart = page.findEditor(fileEditorInput);
if (editorPart == null) {
fileEditorInput.setRepositoryNode(node);
page.openEditor(fileEditorInput, MultiPageTalendEditor.ID, true);
} else {
page.activate(editorPart);
}
} catch (PartInitException e) {
MessageBoxExceptionHandler.process(e);
} catch (PersistenceException e) {
MessageBoxExceptionHandler.process(e);
}
}
use of org.talend.designer.core.ui.editor.ProcessEditorInput in project tdi-studio-se by Talend.
the class SaveAsProcessAction method run.
@Override
public void run() {
SaveAsProcessWizard processWizard = new SaveAsProcessWizard(editorPart);
WizardDialog dlg = new WizardDialog(Display.getCurrent().getActiveShell(), processWizard);
if (dlg.open() == Window.OK) {
try {
// Set readonly to false since created job will always be editable.
JobEditorInput newJobEditorInput = new ProcessEditorInput(processWizard.getProcess(), true, true, false);
IWorkbenchPage page = getActivePage();
IRepositoryNode repositoryNode = RepositoryNodeUtilities.getRepositoryNode(newJobEditorInput.getItem().getProperty().getId(), false);
newJobEditorInput.setRepositoryNode(repositoryNode);
// close the old editor
page.closeEditor(((AbstractTalendEditor) this.editorPart).getParent(), false);
// open the new editor, because at the same time, there will update the jobSetting/componentSetting view
page.openEditor(newJobEditorInput, MultiPageTalendEditor.ID, true);
} catch (Exception e) {
MessageDialog.openError(Display.getCurrent().getActiveShell(), "Error", "Job could not be saved" + " : " + e.getMessage());
ExceptionHandler.process(e);
}
}
}
Aggregations