本文整理汇总了Java中org.eclipse.ui.WorkbenchException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java WorkbenchException.printStackTrace方法的具体用法?Java WorkbenchException.printStackTrace怎么用?Java WorkbenchException.printStackTrace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.ui.WorkbenchException
的用法示例。
在下文中一共展示了WorkbenchException.printStackTrace方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: openPerspectiveInNewWindow
import org.eclipse.ui.WorkbenchException; //导入方法依赖的package包/类
/**
* Opens the new window containing the new perspective
*
* @param perspectiveId
* new perspective
* @param input
* IAdaptable, or null if no input
* @return IWorkbenchWindow instance
*
*/
public static IWorkbenchWindow openPerspectiveInNewWindow(String perspectiveId, IAdaptable input) {
IWorkbench workbench = Activator.getDefault().getWorkbench();
IWorkbenchWindow window = null;
try {
// avoids flicking, from implementation above
window = workbench.openWorkbenchWindow(perspectiveId, input);
// show intro
if (InitialPerspective.ID.equals(perspectiveId) && workbench.getIntroManager().hasIntro()) {
// IIntroPart intro =
workbench.getIntroManager().showIntro(window, true);
}
} catch (WorkbenchException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return window;
}
示例2: openPerspective
import org.eclipse.ui.WorkbenchException; //导入方法依赖的package包/类
public static void openPerspective(String perspectiveID) {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
try {
PlatformUI.getWorkbench().showPerspective(perspectiveID, window, null);
} catch (WorkbenchException e) {
e.printStackTrace();
}
}
示例3: getPage
import org.eclipse.ui.WorkbenchException; //导入方法依赖的package包/类
public static IWorkbenchPage getPage(final String perspectiveId) {
IWorkbenchPage p = getPage();
if (p == null && perspectiveId != null) {
try {
p = getWindow().openPage(perspectiveId, null);
} catch (final WorkbenchException e) {
e.printStackTrace();
}
}
return p;
}
示例4: execute
import org.eclipse.ui.WorkbenchException; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
ISelection selection = HandlerUtil.getCurrentSelection(event);
if (selection != null && selection instanceof IStructuredSelection) {
for (Iterator<?> it = ((IStructuredSelection) selection).iterator(); it.hasNext();) {
Object element = it.next();
IProject project = null;
if (element instanceof IProject) {
project = (IProject) element;
} else if (element instanceof IAdaptable) {
project = (IProject) ((IAdaptable) element).getAdapter(IProject.class);
}
if (project != null) {
addSPLevoNature(project);
}
}
}
IWorkbench workbench = PlatformUI.getWorkbench();
IWorkbenchWindow activeWindow = workbench.getActiveWorkbenchWindow();
Shell shell = activeWindow.getShell();
boolean switchPerspective = MessageDialog.openConfirm(shell, "Open SPLevo Perspective",
"SPLevo projects are associated with a specialized perspective.\n"
+ "Do you want to switch to the SPLevo perspective?");
if (switchPerspective) {
try {
workbench.showPerspective(SPLevoPerspectiveFactory.SPLEVO_PERSPECTIVE_ID, activeWindow);
} catch (WorkbenchException e) {
e.printStackTrace();
}
}
return null;
}
示例5: execute
import org.eclipse.ui.WorkbenchException; //导入方法依赖的package包/类
@Execute
public void execute(IWorkbenchWindow window, MApplication application, EModelService service, EPartService partService) {
//using old e3 show perspective call
try {
window.getWorkbench().showPerspective("org.palladiosimulator.pcmbench.perspectives.palladio", window);
CloudScaleBranding.initProjectExplorer();
} catch (WorkbenchException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
示例6: execute
import org.eclipse.ui.WorkbenchException; //导入方法依赖的package包/类
@Execute
public void execute() {
//using old e3 show perspective call
try {
PlatformUI.getWorkbench().showPerspective("org.palladiosimulator.edp2.ui.perspective",
PlatformUI.getWorkbench().getActiveWorkbenchWindow());
CloudScaleBranding.initProjectExplorer();
} catch (WorkbenchException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
示例7: execute
import org.eclipse.ui.WorkbenchException; //导入方法依赖的package包/类
@Execute
public void execute(IWorkbench workbench, IWorkbenchWindow window, MApplication application, EModelService service, EPartService partService) {
//using old e3 show perspective call
try {
window.getWorkbench().showPerspective("org.palladiosimulator.pcmbench.perspectives.palladio", window);
CloudScaleBranding.initProjectExplorer();
} catch (WorkbenchException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
示例8: execute
import org.eclipse.ui.WorkbenchException; //导入方法依赖的package包/类
@Execute
public void execute(IWorkbenchWindow window, MApplication application, EModelService service, EPartService partService) {
//using old e3 show perspective call
try {
window.getWorkbench().showPerspective("org.spotter.eclipse.ui.Perspective", window);
} catch (WorkbenchException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
示例9: openPerspective
import org.eclipse.ui.WorkbenchException; //导入方法依赖的package包/类
public static boolean openPerspective(final String perspectiveId, final boolean immediately,
final boolean withAutoSave) {
if ( perspectiveId == null )
return false;
if ( perspectiveId.equals(currentPerspectiveId) )
return true;
IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
if ( activePage == null )
try {
activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().openPage(perspectiveId, null);
} catch (final WorkbenchException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
if ( activePage == null )
return false;
final IPerspectiveDescriptor oldDescriptor = activePage.getPerspective();
final IPerspectiveDescriptor descriptor = findOrBuildPerspectiveWithId(perspectiveId);
final IWorkbenchPage page = activePage;
final Runnable r = () -> {
try {
page.setPerspective(descriptor);
} catch (final NullPointerException e) {
// System.err.println(
// "NPE in WorkbenchPage.setPerspective(). See Issue #1602.
// Working around the bug in e4...");
page.setPerspective(descriptor);
}
activateAutoSave(withAutoSave);
if ( isSimulationPerspective(currentPerspectiveId) && isSimulationPerspective(perspectiveId) ) {
page.closePerspective(oldDescriptor, false, false);
}
currentPerspectiveId = perspectiveId;
// System.out.println("Perspective " + perspectiveId + " opened ");
};
if ( immediately ) {
Display.getDefault().syncExec(r);
} else {
Display.getDefault().asyncExec(r);
}
return true;
}
示例10: run
import org.eclipse.ui.WorkbenchException; //导入方法依赖的package包/类
@Override
public void run() {
//diable switch perspective suggestion dialog. just for defense.
String notAskAutoSwitchToDIKey="notAskAutoSwitchToDI";
boolean oldValueNotSwitchToDiKey=PlatformUI.getPreferenceStore().getBoolean(notAskAutoSwitchToDIKey);
PlatformUI.getPreferenceStore().setValue(notAskAutoSwitchToDIKey, true);
//need to be restore at the end .
// open in editor, type and count already checked in calculateEnabled()
List<?> selectedObjects = getSelectedObjects();
Object select = selectedObjects.get(0);
NodePart nodePart = (NodePart) select;
nodePart.performRequest(new org.eclipse.gef.Request(REQUEST_TYPE_OPEN_NODE_PART));
IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
if(activePage==null) {
return;
}
IEditorPart activeEditor = activePage.getActiveEditor();
if(activeEditor==null||activeEditor.getEditorSite()==null) {
return;
}
Node node = (Node) nodePart.getModel();
String selectedJobName=(String)node.getElementParameter(NODE_PARAM_SELECTED_JOB_NAME).getValue();
String openJobName=activeEditor.getEditorInput().getName();
if(!selectedJobName.equals(openJobName)) {
return;
}
// open/switch editor success and then try to switch perspective.
try {
//if current perspective is ORG_TALEND_RCP_INTEGRATION_PERSPECTIVE, will do nothing in under layer.
PlatformUI.getWorkbench().showPerspective(ORG_TALEND_RCP_INTEGRATION_PERSPECTIVE, PlatformUI.getWorkbench().getActiveWorkbenchWindow());
} catch (WorkbenchException e) {
e.printStackTrace();
}finally {
//Restore config of switch perspective suggestion dialog. just for defense.
PlatformUI.getPreferenceStore().setValue(notAskAutoSwitchToDIKey, oldValueNotSwitchToDiKey);
}
}
示例11: execute
import org.eclipse.ui.WorkbenchException; //导入方法依赖的package包/类
/**
* {@inheritDoc} The first thing that is done in this method is that a new editor page is opened
* when this command is called/requested by {@link StepInNewPageAction} or that the method gets
* the active editor page in any other case. After that a new {@link ORMMultiPageEditor} instance
* is created, the initial viewer content of the new {@link ORMMultiPageEditor} instance is
* replaced with the newContent, a custom title based on the newContent which is shown in the tab
* is created for the new editor instance and the editortype of the childeditors is updated to
* adjust what is accessible in the editor pallet. All this is done in the case that this command
* was called/requested by the {@link StepInNewPageAction} or the {@link StepInNewTabAction} the
* initial viewer content. In any other case all thing which where listed for a new
* {@link ORMMultiPageEditor} instance are done for the active {@link ORMMultiPageEditor}
* instance.
*
*/
@Override
public void execute() {
// the page, which in the user wants to open a new tab or step into as a complete new page
IWorkbenchPage page = null;
if (isNewWindowCommand) {
// try to open a new editor page
try {
page = editorPart.getSite().getWorkbenchWindow().openPage(editorPart.getSite());
} catch (WorkbenchException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} else {
// get the active editor page
page = editorPart.getSite().getWorkbenchWindow().getActivePage();
}
if (isNewWindowCommand || isNewTabCommand) {
try {
// try to open a new ORMMultiPageEditor instance
ORMMultiPageEditor newPart =
(ORMMultiPageEditor) page.openEditor(editorPart.getEditorInput(), "ORMEditor.editorID",
false, IWorkbenchPage.MATCH_NONE);
// try to change the viewer content of the new instance
newPart.setContents(newContent);
// try to create a new title for the new instance based on the newContent
newPart.createCustomTitleForEditor(newContent);
// try to update the editor type of the childeditors of the new instance
newPart.getBehaviorEditor().updateEditorType();
} catch (PartInitException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
} else {
// change the content of the viewer of the active ORMMultiPageEditor instance
editorPart.setContents(newContent);
// create a new title for the active instance based on the newContent
editorPart.createCustomTitleForEditor(newContent);
// update the editor type of the childeditors of the active instance
editorPart.getBehaviorEditor().updateEditorType();
}
}