Search in sources :

Example 86 with IEditorPart

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;
}
Also used : INode(org.talend.core.model.process.INode) AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor) Node(org.talend.designer.core.ui.editor.nodes.Node) IExternalNode(org.talend.core.model.process.IExternalNode) INode(org.talend.core.model.process.INode) JobletNode(org.talend.designer.joblet.model.JobletNode) IProcess2(org.talend.core.model.process.IProcess2) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IEditorPart(org.eclipse.ui.IEditorPart)

Example 87 with IEditorPart

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);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) IEditorPart(org.eclipse.ui.IEditorPart) IProcess(org.talend.core.model.process.IProcess)

Example 88 with IEditorPart

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());
}
Also used : EditDomain(org.eclipse.gef.EditDomain) DefaultEditDomain(org.eclipse.gef.DefaultEditDomain) AbstractTalendEditor(org.talend.designer.core.ui.editor.AbstractTalendEditor) IProcess2(org.talend.core.model.process.IProcess2) IEditorPart(org.eclipse.ui.IEditorPart) DefaultEditDomain(org.eclipse.gef.DefaultEditDomain)

Example 89 with IEditorPart

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);
                }
            }
        }
    }
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) IEditorReference(org.eclipse.ui.IEditorReference) AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor) AbstractTalendEditor(org.talend.designer.core.ui.editor.AbstractTalendEditor) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IEditorPart(org.eclipse.ui.IEditorPart) ProcessPart(org.talend.designer.core.ui.editor.process.ProcessPart)

Example 90 with IEditorPart

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);
        // }
        }
    }
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IFile(org.eclipse.core.resources.IFile) RepositoryObject(org.talend.core.model.repository.RepositoryObject) BusinessDiagramEditor(org.talend.designer.business.model.business.diagram.part.BusinessDiagramEditor) BusinessProcessItem(org.talend.core.model.properties.BusinessProcessItem) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) IEditorPart(org.eclipse.ui.IEditorPart) RepositoryNode(org.talend.repository.model.RepositoryNode) ISelection(org.eclipse.jface.viewers.ISelection) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) RepositoryObject(org.talend.core.model.repository.RepositoryObject) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) RepositoryViewObject(org.talend.core.model.repository.RepositoryViewObject) Property(org.talend.core.model.properties.Property) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) RepositoryViewObject(org.talend.core.model.repository.RepositoryViewObject)

Aggregations

IEditorPart (org.eclipse.ui.IEditorPart)401 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)137 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)127 PartInitException (org.eclipse.ui.PartInitException)73 IFile (org.eclipse.core.resources.IFile)58 XLIFFEditorImplWithNatTable (net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable)53 IEditorReference (org.eclipse.ui.IEditorReference)52 XLFHandler (net.heartsome.cat.ts.core.file.XLFHandler)45 ArrayList (java.util.ArrayList)43 QueryEditorPart (com.cubrid.common.ui.query.editor.QueryEditorPart)41 IEditorInput (org.eclipse.ui.IEditorInput)37 IViewPart (org.eclipse.ui.IViewPart)34 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)33 Test (org.junit.Test)31 ISelection (org.eclipse.jface.viewers.ISelection)30 FileEditorInput (org.eclipse.ui.part.FileEditorInput)29 ITextEditor (org.eclipse.ui.texteditor.ITextEditor)27 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)26 AbstractMultiPageTalendEditor (org.talend.designer.core.ui.AbstractMultiPageTalendEditor)26 IXliffEditor (net.heartsome.cat.ts.ui.editors.IXliffEditor)24