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);
}
}
}
use of org.talend.designer.core.ui.editor.ProcessEditorInput in project tdi-studio-se by Talend.
the class DesignerCoreService method getProcessItem.
@Override
public Item getProcessItem(MultiPageEditorPart talendEditor) {
ProcessEditorInput processEditorInput = (ProcessEditorInput) talendEditor.getEditorInput();
Item item = processEditorInput.getItem();
return item;
}
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 tmdm-studio-se by Talend.
the class NewProcessAction method closeEditor.
private void closeEditor(String processName) {
IWorkbenchPage activePage = getActivePage();
IEditorReference[] editorRef = activePage.getEditorReferences();
for (IEditorReference ref : editorRef) {
IEditorInput editorInput = ref.getEditor(false).getEditorInput();
if (editorInput instanceof ProcessEditorInput) {
ProcessEditorInput processInput = (ProcessEditorInput) editorInput;
ProcessItem jobItem = (ProcessItem) processInput.getItem();
if (jobItem.getProperty().getLabel().equals(processName)) {
activePage.closeEditors(new IEditorReference[] { ref }, false);
IRepositoryViewObject jobViewObject = RepositoryResourceUtil.findViewObjectByName(ERepositoryObjectType.PROCESS, processName);
if (jobViewObject != null) {
IProxyRepositoryFactory factory = CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
try {
factory.deleteObjectPhysical(jobViewObject);
} catch (PersistenceException e) {
log.error(e.getMessage(), e);
}
}
break;
}
}
}
}
use of org.talend.designer.core.ui.editor.ProcessEditorInput in project tmdm-studio-se by Talend.
the class LockedDirtyObjectDialog method isDirtyMdmViewObj.
private boolean isDirtyMdmViewObj(List<IRepositoryViewObject> inputObjs, IRepositoryViewObject viewObj) {
if (editorRefMap == null) {
editorRefMap = new HashMap<String, IEditorPart>();
// collect all ids
Set<String> ids = new HashSet<String>();
for (IRepositoryViewObject viewObject : inputObjs) {
String id = viewObject.getId();
if (id != null) {
ids.add(id);
}
}
//
if (PlatformUI.getWorkbench().getActiveWorkbenchWindow() != null) {
IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
for (IEditorReference ref : activePage.getEditorReferences()) {
try {
String id = null;
IEditorInput editorInput = ref.getEditorInput();
if (editorInput instanceof IRepositoryViewEditorInput) {
IRepositoryViewObject viewObject = ((IRepositoryViewEditorInput) editorInput).getViewObject();
if (viewObject != null) {
id = viewObject.getId();
}
} else if (editorInput instanceof ProcessEditorInput) {
id = ((ProcessEditorInput) editorInput).getId();
}
if (id != null && ids.contains(id)) {
IEditorPart editor = ref.getEditor(false);
if (editor != null && editor.isDirty()) {
editorRefMap.put(id, editor);
}
}
} catch (PartInitException e) {
log.error(e.getMessage(), e);
}
}
}
}
return editorRefMap.containsKey(viewObj.getId());
}
Aggregations