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;
}
}
}
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;
}
}
}
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;
}
}
}
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);
}
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);
}
}
Aggregations