当前位置: 首页>>代码示例>>Java>>正文


Java WorkbenchException.printStackTrace方法代码示例

本文整理汇总了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;
}
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:30,代码来源:UIHelper.java

示例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();
	}
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:9,代码来源:RCPUtil.java

示例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;
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:13,代码来源:WorkbenchHelper.java

示例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;
}
 
开发者ID:kopl,项目名称:SPLevo,代码行数:35,代码来源:AddSPLevoNatureHandler.java

示例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();
	}
	
}
 
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:14,代码来源:OpenMainPerspectiveHandler.java

示例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();
	}
	
}
 
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:16,代码来源:OpenResultsPerspective.java

示例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();
	}
}
 
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:12,代码来源:OpenExtractorHandler.java

示例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();
			}
}
 
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:11,代码来源:DynamicSpotterPerspectiveHandler.java

示例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;
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:44,代码来源:PerspectiveHelper.java

示例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);
    }
    
}
 
开发者ID:Talend,项目名称:tesb-studio-se,代码行数:43,代码来源:OpenTalendJobRefAction.java

示例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();
  }
}
 
开发者ID:leondart,项目名称:FRaMED,代码行数:63,代码来源:StepCommand.java


注:本文中的org.eclipse.ui.WorkbenchException.printStackTrace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。