Search in sources :

Example 11 with IEditorReference

use of org.eclipse.ui.IEditorReference in project tdi-studio-se by Talend.

the class TalendEditorComponentCreationUtil method removeAssistListenerOnOpenedEditors.

public static void removeAssistListenerOnOpenedEditors() {
    IEditorReference[] editorReferences = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences();
    for (IEditorReference er : editorReferences) {
        if (er == null) {
            continue;
        }
        IEditorPart editor = er.getEditor(true);
        if (editor == null || !(editor instanceof AbstractMultiPageTalendEditor)) {
            continue;
        }
        AbstractTalendEditor talendEditor = ((AbstractMultiPageTalendEditor) editor).getTalendEditor();
        removeComponentCreationAssist(talendEditor);
    }
}
Also used : IEditorReference(org.eclipse.ui.IEditorReference) AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor) AbstractTalendEditor(org.talend.designer.core.ui.editor.AbstractTalendEditor) IEditorPart(org.eclipse.ui.IEditorPart)

Example 12 with IEditorReference

use of org.eclipse.ui.IEditorReference in project tdi-studio-se by Talend.

the class TalendEditorComponentCreationUtil method registerAssistListenerFromOpenedEditors.

public static void registerAssistListenerFromOpenedEditors() {
    IEditorReference[] editorReferences = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences();
    for (IEditorReference er : editorReferences) {
        if (er == null) {
            continue;
        }
        IEditorPart editor = er.getEditor(true);
        if (editor == null || !(editor instanceof AbstractMultiPageTalendEditor)) {
            continue;
        }
        AbstractTalendEditor talendEditor = ((AbstractMultiPageTalendEditor) editor).getTalendEditor();
        addComponentCreationAssist(talendEditor);
    }
}
Also used : IEditorReference(org.eclipse.ui.IEditorReference) AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor) AbstractTalendEditor(org.talend.designer.core.ui.editor.AbstractTalendEditor) IEditorPart(org.eclipse.ui.IEditorPart)

Example 13 with IEditorReference

use of org.eclipse.ui.IEditorReference in project tdi-studio-se by Talend.

the class AbstractJobSettingsPage method getEditors.

protected IEditorReference[] getEditors() {
    final List<IEditorReference> list = new ArrayList<IEditorReference>();
    Display.getDefault().syncExec(new Runnable() {

        @Override
        public void run() {
            IEditorReference[] reference = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences();
            list.addAll(Arrays.asList(reference));
        }
    });
    return list.toArray(new IEditorReference[0]);
}
Also used : IEditorReference(org.eclipse.ui.IEditorReference) IWorkspaceRunnable(org.eclipse.core.resources.IWorkspaceRunnable) ArrayList(java.util.ArrayList)

Example 14 with IEditorReference

use of org.eclipse.ui.IEditorReference 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 15 with IEditorReference

use of org.eclipse.ui.IEditorReference in project tdi-studio-se by Talend.

the class DeleteAssignmentAction method doRun.

@Override
protected void doRun() {
    IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
    if (activeEditor instanceof BusinessDiagramEditor) {
        BusinessDiagramEditor editor = (BusinessDiagramEditor) activeEditor;
        ISelection selection2 = editor.getSelection();
        EObject element = null;
        Object firstElement = ((IStructuredSelection) selection2).getFirstElement();
        if (firstElement instanceof BusinessItemShapeEditPart) {
            BusinessItemShapeEditPart editpart = (BusinessItemShapeEditPart) firstElement;
            element = ((Node) editpart.getModel()).getElement();
        } else if (firstElement instanceof BaseBusinessItemRelationShipEditPart) {
            BaseBusinessItemRelationShipEditPart editpart = (BaseBusinessItemRelationShipEditPart) firstElement;
            element = ((EdgeImpl) editpart.getModel()).getElement();
        }
        if (element instanceof BusinessItem) {
            BusinessItem businessItem = (BusinessItem) element;
            DeleteAssignmentCommand command = new DeleteAssignmentCommand(businessItem, selection);
            try {
                command.execute(null, null);
            } catch (ExecutionException e) {
                ExceptionHandler.process(e);
            }
            IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
            for (IEditorReference editors : page.getEditorReferences()) {
                CorePlugin.getDefault().getDiagramModelService().refreshBusinessModel(editors);
            }
        }
    }
}
Also used : BusinessDiagramEditor(org.talend.designer.business.model.business.diagram.part.BusinessDiagramEditor) EdgeImpl(org.eclipse.gmf.runtime.notation.impl.EdgeImpl) IEditorPart(org.eclipse.ui.IEditorPart) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) DeleteAssignmentCommand(org.talend.designer.business.diagram.custom.commands.DeleteAssignmentCommand) BaseBusinessItemRelationShipEditPart(org.talend.designer.business.diagram.custom.edit.parts.BaseBusinessItemRelationShipEditPart) IEditorReference(org.eclipse.ui.IEditorReference) BusinessItemShapeEditPart(org.talend.designer.business.diagram.custom.edit.parts.BusinessItemShapeEditPart) EObject(org.eclipse.emf.ecore.EObject) ISelection(org.eclipse.jface.viewers.ISelection) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) EObject(org.eclipse.emf.ecore.EObject) ExecutionException(org.eclipse.core.commands.ExecutionException) BusinessItem(org.talend.designer.business.model.business.BusinessItem)

Aggregations

IEditorReference (org.eclipse.ui.IEditorReference)174 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)83 IEditorPart (org.eclipse.ui.IEditorPart)78 PartInitException (org.eclipse.ui.PartInitException)59 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)55 IFile (org.eclipse.core.resources.IFile)50 IEditorInput (org.eclipse.ui.IEditorInput)49 ArrayList (java.util.ArrayList)34 FileEditorInput (org.eclipse.ui.part.FileEditorInput)28 Item (org.talend.core.model.properties.Item)17 IWorkbench (org.eclipse.ui.IWorkbench)14 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)14 PersistenceException (org.talend.commons.exception.PersistenceException)13 IOException (java.io.IOException)12 CoreException (org.eclipse.core.runtime.CoreException)12 ProcessItem (org.talend.core.model.properties.ProcessItem)11 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)10 IXliffEditor (net.heartsome.cat.ts.ui.editors.IXliffEditor)10 Path (org.eclipse.core.runtime.Path)10 IProcess2 (org.talend.core.model.process.IProcess2)10