Search in sources :

Example 16 with IWorkbenchPage

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

the class TutorialsService method openTutorialsDialog.

@Override
public void openTutorialsDialog() {
    IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    if (activePage != null) {
        TutorialsDialog dialog = new TutorialsDialog();
        dialog.open();
    }
}
Also used : IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) TutorialsDialog(org.talend.designer.tutorials.dialog.TutorialsDialog)

Example 17 with IWorkbenchPage

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

the class ExportJobScriptAction method checkDirtyPart.

/**
     * DOC Administrator Comment method "checkDirtyPart".
     * 
     * @param workbench
     */
@SuppressWarnings("restriction")
private boolean checkDirtyPart(IWorkbench workbench) {
    ISaveablePart[] parts = null;
    IWorkbenchWindow[] windows = workbench.getWorkbenchWindows();
    for (IWorkbenchWindow window : windows) {
        IWorkbenchPage[] pages = window.getPages();
        for (IWorkbenchPage page : pages) {
            parts = page.getDirtyEditors();
        }
    }
    if (parts != null && parts.length > 0) {
        return true;
    }
    return false;
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) ISaveablePart(org.eclipse.ui.ISaveablePart)

Example 18 with IWorkbenchPage

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

the class ContextRepositoryCommand method refreshContextView.

/**
     * qzhang Comment method "refreshContextView".
     */
private void refreshContextView() {
    IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    IViewPart view2 = page.findView(ContextsView.CTX_ID_DESIGNER);
    if (view2 instanceof ContextsView) {
        ((ContextsView) view2).updateContextView(contextItem == null);
    }
}
Also used : IViewPart(org.eclipse.ui.IViewPart) ContextsView(org.talend.designer.core.ui.views.contexts.ContextsView) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage)

Example 19 with IWorkbenchPage

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

the class TalendLaunchToolbarAction method run.

/**
     * Launch the last launch, or open the launch config dialog if none.
     * 
     * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
     */
@Override
public void run(IAction action) {
    // launch the job that is selected in the repository.
    if (selection instanceof IStructuredSelection) {
        IStructuredSelection sel = (IStructuredSelection) selection;
        Object o = sel.getFirstElement();
        if ((o instanceof RepositoryNode)) {
            RepositoryNode node = (RepositoryNode) o;
            if (node.getObject() != null && node.getObject().getRepositoryObjectType().equals(ERepositoryObjectType.PROCESS)) {
                JobLaunchShortcutManager.run(selection);
                return;
            }
        }
    }
    // launch the job that is open in editor
    if (window != null) {
        IWorkbenchPage page = window.getActivePage();
        if (page != null) {
            if (page.getActivePart() == page.getActiveEditor()) {
                IEditorPart editor = page.getActiveEditor();
                IEditorInput input = editor.getEditorInput();
                if (input instanceof RepositoryEditorInput) {
                    JobLaunchShortcutManager.run(editor);
                    return;
                }
            }
        }
    }
    ILaunchConfiguration configuration = getLastLaunch();
    if (configuration == null) {
        // MessageDialog
        // .openInformation(
        // DebugUIPlugin.getShell(),
        //                            Messages.getString("TalendLaunchToolbarAction.information"), Messages.getString("TalendLaunchToolbarAction.noAvailableItem")); //$NON-NLS-1$ //$NON-NLS-2$
        MessageDialog.openInformation(getShell(), Messages.getString("TalendLaunchToolbarAction.information"), //$NON-NLS-1$ //$NON-NLS-2$
        Messages.getString("TalendLaunchToolbarAction.noAvailableItem"));
    // DebugUITools.openLaunchConfigurationDialogOnGroup(DebugUIPlugin.getShell(), new StructuredSelection(),
    // getLaunchGroupIdentifier());
    } else {
        DebugUITools.launch(configuration, getMode());
    }
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) RepositoryEditorInput(org.talend.core.repository.ui.editor.RepositoryEditorInput) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IRepositoryObject(org.talend.core.model.repository.IRepositoryObject) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) IEditorPart(org.eclipse.ui.IEditorPart) RepositoryNode(org.talend.repository.model.RepositoryNode) IEditorInput(org.eclipse.ui.IEditorInput)

Example 20 with IWorkbenchPage

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

the class DesignerCoreService method refreshComponentView.

@Override
public void refreshComponentView(Item item) {
    try {
        IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
        IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
        IEditorReference[] editors = activePage.getEditorReferences();
        for (IEditorReference er : editors) {
            IEditorPart part = er.getEditor(false);
            if (part instanceof AbstractMultiPageTalendEditor) {
                AbstractMultiPageTalendEditor editor = (AbstractMultiPageTalendEditor) part;
                CommandStack stack = (CommandStack) editor.getTalendEditor().getAdapter(CommandStack.class);
                if (stack != null) {
                    IProcess process = editor.getProcess();
                    for (final INode processNode : process.getGraphicalNodes()) {
                        if (processNode instanceof Node) {
                            checkRepository((Node) processNode, item, stack);
                        }
                    }
                }
            }
        }
    } catch (Exception e) {
        ExceptionHandler.process(e);
    }
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) CommandStack(org.eclipse.gef.commands.CommandStack) INode(org.talend.core.model.process.INode) IEditorReference(org.eclipse.ui.IEditorReference) AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor) Node(org.talend.designer.core.ui.editor.nodes.Node) INode(org.talend.core.model.process.INode) DataNode(org.talend.designer.core.model.process.DataNode) ConvertRepositoryNodeToProcessNode(org.talend.designer.core.ui.editor.process.ConvertRepositoryNodeToProcessNode) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IEditorPart(org.eclipse.ui.IEditorPart) IProcess(org.talend.core.model.process.IProcess) JavaModelException(org.eclipse.jdt.core.JavaModelException) ProcessorException(org.talend.designer.runprocess.ProcessorException)

Aggregations

IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)827 PartInitException (org.eclipse.ui.PartInitException)309 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)296 IEditorPart (org.eclipse.ui.IEditorPart)268 IFile (org.eclipse.core.resources.IFile)221 FileEditorInput (org.eclipse.ui.part.FileEditorInput)99 IViewPart (org.eclipse.ui.IViewPart)98 IWorkbench (org.eclipse.ui.IWorkbench)89 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)88 IEditorInput (org.eclipse.ui.IEditorInput)84 IEditorReference (org.eclipse.ui.IEditorReference)83 IResource (org.eclipse.core.resources.IResource)76 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)69 CoreException (org.eclipse.core.runtime.CoreException)66 ISelection (org.eclipse.jface.viewers.ISelection)64 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)60 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)59 IOException (java.io.IOException)57 ArrayList (java.util.ArrayList)56 IProject (org.eclipse.core.resources.IProject)51