use of org.eclipse.ui.IEditorPart in project tdi-studio-se by Talend.
the class SaveJobBeforeRunAction method run.
public void run() {
boolean saveMyself = false;
List<? extends INode> nodes = filterTRunJobNode();
if (nodes.isEmpty()) {
return;
}
IEditorReference[] references = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences();
for (int i = 0; i < references.length; i++) {
IEditorPart part = references[i].getEditor(false);
if (!(part instanceof MultiPageTalendEditor)) {
continue;
}
MultiPageTalendEditor editor = (MultiPageTalendEditor) part;
saveJob(nodes, editor);
}
}
use of org.eclipse.ui.IEditorPart in project tdi-studio-se by Talend.
the class OpentRunJobComponentAction method run.
@Override
public void run() {
List selection = getSelectedObjects();
Object input = selection.get(0);
if (input instanceof NodePart) {
NodePart part = (NodePart) input;
Node node = (Node) part.getModel();
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
String processName = (String) node.getPropertyValue(EParameterName.PROCESS_TYPE_PROCESS.getName());
String version = (String) node.getPropertyValue(EParameterName.PROCESS_TYPE_VERSION.getName());
if (processName != null && !"".equals(processName)) {
//$NON-NLS-1$
try {
ItemCacheManager.clearCache();
ProcessItem processItem = ItemCacheManager.getProcessItem(processName, version);
if (processItem != null) {
ProcessEditorInput fileEditorInput = new ProcessEditorInput(processItem, true);
IEditorPart editorPart = page.findEditor(fileEditorInput);
if (editorPart == null) {
ERepositoryObjectType repObjType = ERepositoryObjectType.getItemType(processItem);
IJobEditorHandler editorInputFactory = JobEditorHandlerManager.getInstance().extractEditorInputFactory(repObjType.getType());
editorInputFactory.openJobEditor(editorInputFactory.createJobEditorInput(processItem, true));
} else {
page.activate(editorPart);
}
}
} catch (PartInitException e) {
MessageBoxExceptionHandler.process(e);
} catch (PersistenceException e) {
MessageBoxExceptionHandler.process(e);
}
} else {
try {
// modified for feature 2454.
page.showView(ComponentSettingsView.ID);
} catch (PartInitException e) {
ExceptionHandler.process(e);
}
}
}
}
use of org.eclipse.ui.IEditorPart in project tdi-studio-se by Talend.
the class JobSettingsView method getProcess.
private IProcess getProcess(IRepositoryViewObject viewObject) {
boolean isOpen = RepositoryManager.isOpenedItemInEditor(viewObject);
if (isOpen) {
final IEditorPart activeEditor = getSite().getPage().getActiveEditor();
if (activeEditor != null && activeEditor instanceof AbstractMultiPageTalendEditor) {
AbstractTalendEditor talendEditor = ((AbstractMultiPageTalendEditor) activeEditor).getTalendEditor();
IProcess process = talendEditor.getProcess();
return process;
}
}
return null;
}
use of org.eclipse.ui.IEditorPart in project tdi-studio-se by Talend.
the class JobSettingsView method getCategories.
/**
* set the category.
*/
private EComponentCategory[] getCategories(Object obj) {
List<EComponentCategory> category = new ArrayList<EComponentCategory>();
boolean isOfflineMode = CorePlugin.getDefault().getProxyRepositoryFactory().getRepositoryContext().isOffline();
if (obj instanceof Process) {
Process process = (Process) obj;
category.add(EComponentCategory.MAIN);
boolean isJoblet = AbstractProcessProvider.isExtensionProcessForJoblet(process);
if (process.getComponentsType().equals(ComponentCategory.CATEGORY_4_DI.getName())) {
category.add(EComponentCategory.EXTRA);
}
if (!isJoblet && process.getComponentsType().equals(ComponentCategory.CATEGORY_4_DI.getName())) {
category.add(EComponentCategory.STATSANDLOGS);
}
if (allowVerchange) {
category.add(EComponentCategory.VERSIONS);
}
if (!isJoblet && !ProcessUtils.isTestContainer(process) && ERepositoryObjectType.getItemType(process.getProperty().getItem()) != ERepositoryObjectType.PROCESS_ROUTELET) {
category.add(EComponentCategory.DEPLOYMENT);
}
if (GlobalServiceRegister.getDefault().isServiceRegistered(IHeaderFooterProviderService.class)) {
IHeaderFooterProviderService headerFooterService = (IHeaderFooterProviderService) GlobalServiceRegister.getDefault().getService(IHeaderFooterProviderService.class);
if (headerFooterService.isVisible()) {
category.add(EComponentCategory.HEADERFOOTER);
}
}
// if svn remote connection, added by nma
if (svnService != null && svnService.isProjectInSvnMode() && !isOfflineMode) {
category.add(EComponentCategory.SVNHISTORY);
}
if (gitService != null && gitService.isProjectInGitMode() && !isOfflineMode) {
category.add(EComponentCategory.GITHISTORY);
}
} else if (obj instanceof IRepositoryViewObject) {
category.add(EComponentCategory.MAIN);
if (allowVerchange) {
category.add(EComponentCategory.VERSIONS);
}
if (svnService != null && svnService.isProjectInSvnMode() && !isOfflineMode && (((IRepositoryViewObject) obj).getRepositoryObjectType() == ERepositoryObjectType.JOBLET || ERepositoryObjectType.getAllTypesOfProcess().contains(((IRepositoryViewObject) obj).getRepositoryObjectType()))) {
category.add(EComponentCategory.SVNHISTORY);
} else if (gitService != null && gitService.isProjectInGitMode() && !isOfflineMode && (((IRepositoryViewObject) obj).getRepositoryObjectType() == ERepositoryObjectType.JOBLET || ERepositoryObjectType.getAllTypesOfProcess().contains(((IRepositoryViewObject) obj).getRepositoryObjectType()))) {
category.add(EComponentCategory.GITHISTORY);
}
} else if (obj instanceof IEditorPart) {
if (CorePlugin.getDefault().getDiagramModelService().isBusinessDiagramEditor((IEditorPart) obj)) {
category.add(EComponentCategory.MAIN);
category.add(EComponentCategory.APPEARANCE);
category.add(EComponentCategory.RULERS_AND_GRID);
if (allowVerchange) {
category.add(EComponentCategory.VERSIONS);
}
}
} else {
BusinessType type = CorePlugin.getDefault().getDiagramModelService().getBusinessModelType(obj);
if (BusinessType.SHAP.equals(type) || BusinessType.CONNECTION.equals(type)) {
category.add(EComponentCategory.APPEARANCE);
category.add(EComponentCategory.ASSIGNMENT);
} else if (BusinessType.NOTE.equals(type)) {
category.add(EComponentCategory.APPEARANCE);
}
}
return category.toArray(new EComponentCategory[0]);
}
use of org.eclipse.ui.IEditorPart in project tdi-studio-se by Talend.
the class JobSettingsView method createPartControl.
@Override
public void createPartControl(Composite parent) {
// tabFactory = new HorizontalTabFactory();
this.parent = parent;
tabFactory.initComposite(parent, false);
tabFactory.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
TalendPropertyTabDescriptor descriptor = (TalendPropertyTabDescriptor) selection.getFirstElement();
if (descriptor == null) {
return;
}
if (currentSelectedTab != null) {
if ((!currentSelectedTab.getData().equals(descriptor.getData()) || currentSelectedTab.getData() != descriptor.getData() || currentSelectedTab.getCategory() != descriptor.getCategory())) {
for (Control curControl : tabFactory.getTabComposite().getChildren()) {
curControl.dispose();
}
}
}
if (element == null || !element.equals(descriptor.getData()) || currentSelectedTab == null || currentSelectedTab.getCategory() != descriptor.getCategory() || selectedPrimary) {
Object data = descriptor.getData();
if (data instanceof Element) {
element = (Element) data;
currentSelectedTab = descriptor;
IDynamicProperty propertyComposite = createTabComposite(tabFactory.getTabComposite(), element, descriptor.getCategory());
} else if (data instanceof IRepositoryViewObject) {
IRepositoryViewObject viewObject = (IRepositoryViewObject) data;
IProcess process = getProcess(viewObject);
if (process != null && process instanceof Element && process.getId().equals(viewObject.getId()) && process.getVersion().equals(viewObject.getVersion())) {
data = process;
}
currentSelectedTab = descriptor;
IDynamicProperty propertyComposite = createTabComposite(tabFactory.getTabComposite(), data, descriptor.getCategory());
} else if (data instanceof IEditorPart) {
currentSelectedTab = descriptor;
IRepositoryViewObject repObj = retrieveBusiness((IEditorPart) data);
if (repObj != null) {
IDynamicProperty propertyComposite = createTabComposite(tabFactory.getTabComposite(), repObj, descriptor.getCategory());
}
} else {
currentSelectedTab = descriptor;
IDynamicProperty propertyComposite = createTabComposite(tabFactory.getTabComposite(), null, descriptor.getCategory());
}
selectedPrimary = false;
}
}
});
}
Aggregations