Search in sources :

Example 21 with WorkbenchException

use of org.eclipse.ui.WorkbenchException in project linuxtools by eclipse.

the class RunScriptChartHandler method scriptConsoleInitialized.

@Override
protected void scriptConsoleInitialized(ScriptConsole console) {
    int n = parsers.size();
    for (int i = 0; i < n; i++) {
        console.getCommand().addInputStreamListener(new ChartStreamDaemon(dataSets.get(i), parsers.get(i)));
    }
    try {
        String name = console.getName();
        String title = name.substring(name.lastIndexOf('/') + 1);
        IWorkbenchPage p = PlatformUI.getWorkbench().showPerspective(IDEPerspective.ID, PlatformUI.getWorkbench().getActiveWorkbenchWindow());
        GraphSelectorEditor ivp = (GraphSelectorEditor) p.openEditor(new GraphSelectorEditorInput(title), GraphSelectorEditor.ID);
        String scriptName = console.getName();
        ivp.createScriptSets(scriptName, names, dataSets);
        for (int i = 0; i < n; i++) {
            for (GraphData graph : graphs.get(i)) {
                ivp.getDisplaySet(i).addGraph(graph);
            }
        }
    } catch (WorkbenchException we) {
        ExceptionErrorDialog.openError(Messages.RunScriptChartHandler_couldNotSwitchToGraphicPerspective, we);
    }
    super.scriptConsoleInitialized(console);
}
Also used : GraphSelectorEditorInput(org.eclipse.linuxtools.systemtap.graphing.ui.views.GraphSelectorEditorInput) ChartStreamDaemon(org.eclipse.linuxtools.systemtap.graphing.core.structures.ChartStreamDaemon) GraphSelectorEditor(org.eclipse.linuxtools.systemtap.graphing.ui.views.GraphSelectorEditor) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) WorkbenchException(org.eclipse.ui.WorkbenchException) GraphData(org.eclipse.linuxtools.systemtap.graphing.core.structures.GraphData)

Example 22 with WorkbenchException

use of org.eclipse.ui.WorkbenchException in project linuxtools by eclipse.

the class TreeSettings method getTreeFileMemento.

private static IMemento getTreeFileMemento() {
    if (!isTreeFileAvailable()) {
        return null;
    }
    try (FileReader reader = new FileReader(settingsFile)) {
        IMemento data = XMLMemento.createReadRoot(reader, FILE_NAME);
        IMemento versionChild = data.getChild(T_VERSION);
        if (versionChild != null && versionChild.getTextData().equals(VERSION_NUMBER)) {
            return data;
        }
        return null;
    } catch (IOException | WorkbenchException fnfe) {
        return null;
    }
}
Also used : FileReader(java.io.FileReader) IOException(java.io.IOException) WorkbenchException(org.eclipse.ui.WorkbenchException) IMemento(org.eclipse.ui.IMemento)

Example 23 with WorkbenchException

use of org.eclipse.ui.WorkbenchException in project linuxtools by eclipse.

the class GcovTest method init.

@BeforeClass
public static void init() {
    display = Display.getDefault();
    display.syncExec(() -> {
        try {
            window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
            IWorkbenchPart part = window.getActivePage().getActivePart();
            if (part.getTitle().equals("Welcome")) {
                part.dispose();
            }
            PlatformUI.getWorkbench().showPerspective(CUIPlugin.ID_CPERSPECTIVE, window);
        } catch (WorkbenchException e) {
            Assert.fail("Couldn't open C/C++ perspective.");
        }
    });
}
Also used : IWorkbenchPart(org.eclipse.ui.IWorkbenchPart) WorkbenchException(org.eclipse.ui.WorkbenchException) BeforeClass(org.junit.BeforeClass)

Example 24 with WorkbenchException

use of org.eclipse.ui.WorkbenchException in project core by jcryptool.

the class ImportSampleHandler method openActionView.

private void openActionView() {
    IWorkbench workbench = PlatformUI.getWorkbench();
    IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
    try {
        // open the action view
        window.getActivePage().showView(ActionView.ID);
    } catch (WorkbenchException e) {
        LogUtil.logError(e);
    }
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) WorkbenchException(org.eclipse.ui.WorkbenchException)

Example 25 with WorkbenchException

use of org.eclipse.ui.WorkbenchException in project mdw-designer by CenturyLinkCloud.

the class DesignerPerspective method showPerspectiveAndSelectProjectPreferences.

public static void showPerspectiveAndSelectProjectPreferences(IWorkbenchWindow activeWindow, WorkflowProject project) {
    try {
        IWorkbenchPage page = showPerspective(activeWindow);
        ProcessExplorerView processExplorer = (ProcessExplorerView) page.findView(ProcessExplorerView.VIEW_ID);
        if (processExplorer != null) {
            processExplorer.setFocus();
            processExplorer.select(project);
            PropertySheet propSheet = (PropertySheet) page.showView(PROPERTY_SHEET);
            if (propSheet != null) {
                TabbedPropertySheetPage tabbedPage = (TabbedPropertySheetPage) propSheet.getCurrentPage();
                if (tabbedPage != null)
                    tabbedPage.setSelectedTab("mdw.properties.tabs.preferences");
            }
        }
    } catch (WorkbenchException ex) {
        PluginMessages.uiError(activeWindow.getShell(), ex, "Project Preferences", project);
    }
}
Also used : PropertySheet(org.eclipse.ui.views.properties.PropertySheet) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) ProcessExplorerView(com.centurylink.mdw.plugin.designer.views.ProcessExplorerView) TabbedPropertySheetPage(com.centurylink.mdw.plugin.designer.properties.TabbedPropertySheetPage) WorkbenchException(org.eclipse.ui.WorkbenchException)

Aggregations

WorkbenchException (org.eclipse.ui.WorkbenchException)37 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)16 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)15 IPerspectiveDescriptor (org.eclipse.ui.IPerspectiveDescriptor)11 IMemento (org.eclipse.ui.IMemento)7 IOException (java.io.IOException)6 IWorkbench (org.eclipse.ui.IWorkbench)5 IRepositoryView (org.talend.repository.ui.views.IRepositoryView)5 StringReader (java.io.StringReader)4 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)4 CoreException (org.eclipse.core.runtime.CoreException)3 IStatus (org.eclipse.core.runtime.IStatus)3 Status (org.eclipse.core.runtime.Status)3 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)3 StructuredViewer (org.eclipse.jface.viewers.StructuredViewer)3 TreeViewer (org.eclipse.jface.viewers.TreeViewer)3 ProjectRepositoryNode (org.talend.core.repository.model.ProjectRepositoryNode)3 RepositoryNode (org.talend.repository.model.RepositoryNode)3 ProcessExplorerView (com.centurylink.mdw.plugin.designer.views.ProcessExplorerView)2 BufferedReader (java.io.BufferedReader)2