use of org.eclipse.ui.IEditorPart in project tdi-studio-se by Talend.
the class JobletUtil method openedInJob.
public boolean openedInJob(JobletProcessItem jobletItem, Node currNode) {
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IEditorPart[] editors = page.getEditors();
for (IEditorPart editor : editors) {
if (editor instanceof AbstractMultiPageTalendEditor) {
IProcess2 pro = ((AbstractMultiPageTalendEditor) editor).getProcess();
if (currNode != null) {
IProcess2 currPro = (IProcess2) currNode.getProcess();
if (currPro.getId().equals(pro.getId())) {
List<? extends INode> currNodeList = currPro.getGraphicalNodes();
for (INode node : currNodeList) {
if (node == currNode) {
continue;
} else {
if (((Node) node).isJoblet() && jobletItem.getProperty() != null) {
if (jobletItem.getProperty().getId().equals(node.getComponent().getProcess().getId()) && jobletItem.getProperty().getVersion().equals(node.getComponent().getVersion())) {
boolean haveOpened = !((Node) node).getNodeContainer().isCollapsed();
if (haveOpened) {
return true;
}
}
}
}
}
continue;
}
}
List<? extends INode> nodeList = pro.getGraphicalNodes();
for (INode node : nodeList) {
if (((Node) node).isJoblet() && jobletItem.getProperty() != null) {
if (jobletItem.getProperty().getId().equals(node.getComponent().getProcess().getId()) && jobletItem.getProperty().getVersion().equals(node.getComponent().getVersion())) {
boolean haveOpened = !((Node) node).getNodeContainer().isCollapsed();
if (haveOpened) {
return true;
}
}
}
}
}
}
return false;
}
use of org.eclipse.ui.IEditorPart in project tdi-studio-se by Talend.
the class MetadataToolbarEditorViewExt method createNumberRows.
private void createNumberRows() {
numRowComposite = new Composite(toolbar, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
layout.horizontalSpacing = 4;
layout.marginBottom = 0;
layout.marginHeight = 0;
layout.marginLeft = 0;
layout.marginRight = 0;
layout.marginTop = 0;
layout.marginWidth = 0;
GridData gridData = new GridData();
gridData.verticalAlignment = GridData.CENTER;
numRowComposite.setLayout(layout);
final Label numRowLabel = new Label(numRowComposite, SWT.NONE);
//$NON-NLS-1$
numRowLabel.setText(Messages.getString("MetadataToolbarEditorViewExt.RowNum.LabelText"));
numRowText = new Text(numRowComposite, SWT.BORDER);
GridDataFactory.swtDefaults().hint(rowNumberWidth(), SWT.DEFAULT).applyTo(numRowText);
numRowText.setBackground(ColorConstants.white);
IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
IProcess process = ((AbstractMultiPageTalendEditor) editor).getTalendEditor().getProcess();
TalendProposalUtils.installOn(numRowText, process);
}
use of org.eclipse.ui.IEditorPart in project tdi-studio-se by Talend.
the class TalendPaletteContextMenuProvider method isComponentsTypePalette.
// public TalendPaletteContextMenuProvider() {
//
// }
protected boolean isComponentsTypePalette(ComponentCategory componentCategory) {
if (componentCategory == null) {
return false;
}
EditDomain editDomain = getPaletteViewer().getEditDomain();
if (editDomain == null || !(editDomain instanceof DefaultEditDomain)) {
return false;
}
IEditorPart editorPart = ((DefaultEditDomain) editDomain).getEditorPart();
if (editorPart == null || !(editorPart instanceof AbstractTalendEditor)) {
return false;
}
IProcess2 process = ((AbstractTalendEditor) editorPart).getProcess();
if (process == null) {
return false;
}
return componentCategory.getName().equals(process.getComponentsType());
}
use of org.eclipse.ui.IEditorPart in project tdi-studio-se by Talend.
the class DesignerColorsPreferencePage method switchToCurrentColor.
/**
* zli Comment method "switchToCurrentColor".
*/
private void switchToCurrentColor() {
IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (activeWorkbenchWindow != null) {
IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
if (activePage != null) {
for (IEditorReference ref : activePage.getEditorReferences()) {
IEditorPart editor = ref.getEditor(true);
if (editor instanceof AbstractMultiPageTalendEditor) {
AbstractMultiPageTalendEditor pageEditor = (AbstractMultiPageTalendEditor) editor;
AbstractTalendEditor talendEditor = pageEditor.getTalendEditor();
ProcessPart processPart = talendEditor.getProcessPart();
processPart.ajustReadOnly();
changeMRGroupColor(processPart);
}
}
}
}
}
use of org.eclipse.ui.IEditorPart in project tdi-studio-se by Talend.
the class OpenDiagramAction method doRun.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.Action#run()
*/
@Override
protected void doRun() {
ISelection selection = getSelectedObject();
if (selection == null) {
return;
}
Object obj = ((IStructuredSelection) selection).getFirstElement();
if (obj instanceof RepositoryNode) {
RepositoryNode repositoryNode = (RepositoryNode) obj;
IRepositoryViewObject repositoryObject = repositoryNode.getObject();
Property updatedProperty = null;
if (repositoryObject instanceof RepositoryObject) {
RepositoryViewObject abstractRepositoryObject = new RepositoryViewObject(repositoryObject.getProperty());
updatedProperty = abstractRepositoryObject.getProperty();
} else if (repositoryObject instanceof RepositoryViewObject) {
updatedProperty = repositoryObject.getProperty();
}
if (updatedProperty != null) {
BusinessProcessItem businessProcessItem = (BusinessProcessItem) updatedProperty.getItem();
DiagramResourceManager diagramResourceManager = new DiagramResourceManager(getActivePage(), new NullProgressMonitor());
IFile file = diagramResourceManager.createDiagramFile();
diagramResourceManager.updateResource(businessProcessItem, file);
IEditorPart part = diagramResourceManager.openEditor(businessProcessItem, file, false);
if (part instanceof BusinessDiagramEditor) {
((BusinessDiagramEditor) part).setLastVersion(true);
}
// TDI-21143 : Studio repository view : remove all refresh call to repo view
// IRepositoryView view = getViewPart();
// if (view != null) {
// view.refresh(repositoryNode);
// }
}
}
}
Aggregations