Search in sources :

Example 1 with WorkbenchException

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

the class LoadChartAction method loadChartSet.

/**
     * Loads the given chart set.
     * 
     * @param chartSet The chart set
     * @throws JvmCoreException
     */
private void loadChartSet(String chartSet) throws JvmCoreException {
    loadPredefinedChartSet(chartSet);
    IMemento chartSetsMemento;
    try {
        chartSetsMemento = getChartSetsMemento();
    } catch (WorkbenchException e) {
        throw new JvmCoreException(IStatus.ERROR, Messages.loadChartSetFailedMsg, e);
    } catch (IOException e) {
        throw new JvmCoreException(IStatus.ERROR, Messages.loadChartSetFailedMsg, e);
    }
    if (chartSetsMemento == null) {
        return;
    }
    IMemento[] mementos = chartSetsMemento.getChildren(CHART_SET);
    for (IMemento memento : mementos) {
        if (chartSet.equals(memento.getID())) {
            loadChartSet(memento);
            return;
        }
    }
}
Also used : IOException(java.io.IOException) WorkbenchException(org.eclipse.ui.WorkbenchException) IMemento(org.eclipse.ui.IMemento) JvmCoreException(org.talend.designer.runtime.visualization.JvmCoreException)

Example 2 with WorkbenchException

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

the class LoadChartSetAction method loadChartSet.

/**
     * Loads the given chart set.
     * 
     * @param chartSet The chart set
     * @throws JvmCoreException
     */
private void loadChartSet(String chartSet) throws JvmCoreException {
    loadPredefinedChartSet(chartSet);
    IMemento chartSetsMemento;
    try {
        chartSetsMemento = getChartSetsMemento();
    } catch (WorkbenchException e) {
        throw new JvmCoreException(IStatus.ERROR, Messages.loadChartSetFailedMsg, e);
    } catch (IOException e) {
        throw new JvmCoreException(IStatus.ERROR, Messages.loadChartSetFailedMsg, e);
    }
    if (chartSetsMemento == null) {
        return;
    }
    IMemento[] mementos = chartSetsMemento.getChildren(CHART_SET);
    for (IMemento memento : mementos) {
        if (chartSet.equals(memento.getID())) {
            loadChartSet(memento);
            return;
        }
    }
}
Also used : IOException(java.io.IOException) WorkbenchException(org.eclipse.ui.WorkbenchException) IMemento(org.eclipse.ui.IMemento) JvmCoreException(org.talend.designer.runtime.visualization.JvmCoreException)

Example 3 with WorkbenchException

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

the class CreateDiagramAction method setRepositoryNode.

private void setRepositoryNode(Properties params) {
    IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (null == workbenchWindow) {
        return;
    }
    IWorkbenchPage workbenchPage = workbenchWindow.getActivePage();
    if (null == workbenchPage) {
        return;
    }
    IPerspectiveDescriptor currentPerspective = workbenchPage.getPerspective();
    if (!IBrandingConfiguration.PERSPECTIVE_DI_ID.equals(currentPerspective.getId())) {
        // show di perspective
        try {
            workbenchWindow.getWorkbench().showPerspective(IBrandingConfiguration.PERSPECTIVE_DI_ID, workbenchWindow);
            workbenchPage = workbenchWindow.getActivePage();
        } catch (WorkbenchException e) {
            ExceptionHandler.process(e);
            return;
        }
    }
    // bug 16594
    IRepositoryView view = RepositoryManagerHelper.getRepositoryView();
    if (view != null) {
        Object type = params.get("type");
        if (ERepositoryObjectType.BUSINESS_PROCESS != null && ERepositoryObjectType.BUSINESS_PROCESS.name().equals(type)) {
            RepositoryNode processNode = ((ProjectRepositoryNode) view.getRoot()).getRootRepositoryNode(ERepositoryObjectType.BUSINESS_PROCESS);
            final StructuredViewer viewer = view.getViewer();
            if (viewer instanceof TreeViewer) {
                ((TreeViewer) viewer).expandToLevel(processNode, 1);
            }
            this.repositoryNode = processNode;
        }
    }
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) TreeViewer(org.eclipse.jface.viewers.TreeViewer) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IPerspectiveDescriptor(org.eclipse.ui.IPerspectiveDescriptor) ProjectRepositoryNode(org.talend.core.repository.model.ProjectRepositoryNode) StructuredViewer(org.eclipse.jface.viewers.StructuredViewer) WorkbenchException(org.eclipse.ui.WorkbenchException) IRepositoryView(org.talend.repository.ui.views.IRepositoryView) ProjectRepositoryNode(org.talend.core.repository.model.ProjectRepositoryNode) RepositoryNode(org.talend.repository.model.RepositoryNode)

Example 4 with WorkbenchException

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

the class StapNewWizard method doFinish.

/**
 * The worker method. It will find the container, create the
 * file if missing or just replace its contents, and open
 * the editor on the newly created file.
 */
private void doFinish(String containerName, String fileName, IProgressMonitor monitor) throws CoreException {
    // create a .stp file
    // $NON-NLS-1$
    monitor.beginTask(resourceBundle.getString("StapNewWizard.BeginTask") + fileName, 2);
    final IContainer newResource = (IContainer) ResourcesPlugin.getWorkspace().getRoot().findMember(containerName);
    final IFile newFile = newResource.getFile(new Path(fileName));
    // $NON-NLS-1$
    String envString = "#!/usr/bin/env stap";
    newFile.create(new ByteArrayInputStream(envString.getBytes()), true, monitor);
    monitor.worked(1);
    // $NON-NLS-1$
    monitor.setTaskName(resourceBundle.getString("StapNewWizard.SetTask"));
    getShell().getDisplay().asyncExec(() -> {
        try {
            IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getWorkbench().showPerspective(IDEPerspective.ID, PlatformUI.getWorkbench().getActiveWorkbenchWindow());
            IDE.openEditor(page, newFile);
        } catch (WorkbenchException e1) {
        // ignore, the file is created but opening the editor failed
        }
    });
    monitor.worked(1);
}
Also used : Path(org.eclipse.core.runtime.Path) IFile(org.eclipse.core.resources.IFile) ByteArrayInputStream(java.io.ByteArrayInputStream) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IContainer(org.eclipse.core.resources.IContainer) WorkbenchException(org.eclipse.ui.WorkbenchException)

Example 5 with WorkbenchException

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

the class ImportSampleHandler method openDefaultPerspective.

private void openDefaultPerspective() {
    IWorkbench workbench = PlatformUI.getWorkbench();
    IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
    try {
        // open the default perspective
        workbench.showPerspective(org.jcryptool.core.Perspective.PERSPECTIVE_ID, window);
    } catch (WorkbenchException e) {
        LogUtil.logError(e);
    }
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) 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