类org.eclipse.ui.WorkbenchException源码实例Demo

下面列出了怎么用org.eclipse.ui.WorkbenchException的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: xds-ide   文件: XdsResourcesUpdater.java
private void applyInstanceResourceUpdates(UpdateDirDescriptor desc) throws URISyntaxException, WorkbenchException, IOException {
	InstalledUpdatesRegistry installedUpdatesRegistry = InstalledUpdatesManager.getInstance().loadInstalledUpdatesRegistry();
	boolean isNewUpdatesInstalled = false;
	
	String eclipseInstallDir = System.getProperty(ECLIPSE_HOME_LOCATION_PROPERTY);
	for (InstanceDirectoryUpdate instanceDirectoryUpdate : desc.instanceDirectoryUpdates) {
		File targetDirectory = new File(new URL(FilenameUtils.concat(eclipseInstallDir, instanceDirectoryUpdate.name)).toURI());
		if (!targetDirectory.exists()) {
			LogHelper.logError(String.format("Resource update : incorrect instance directory specified : '%s'", targetDirectory)); //$NON-NLS-1$
			continue;
		}
		List<FileUpdate> fileUpdates = instanceDirectoryUpdate.fileUpdates;
		for (FileUpdate fileUpdate : fileUpdates) {
			if (updateResource(installedUpdatesRegistry, desc.updateDirPath, fileUpdate.source, targetDirectory, 
					 fileUpdate.name, null, fileUpdate.version, false)) {
				isNewUpdatesInstalled = true;
			}
		}
	}
	if (isNewUpdatesInstalled) {
		InstalledUpdatesManager.getInstance().saveInstalledUpdatesRegistry(installedUpdatesRegistry);
	}
}
 
源代码2 项目: xds-ide   文件: NewProjectFromSourcesWizard.java
@Override
public boolean performFinish() {
	IProject newProject = NewProjectCreator.createFromSources(firstPage.getSettings());
	if (newProject == null) {
		return false;
	}
	selectAndReveal(newProject);
	
	try {
           PerspectiveUtils.promptAndOpenPerspective(getWorkbench(), XdsPerspectiveFactory.DEVELOPMENT_PERSPECTIVE_ID, Messages.NewProjectWizard_PerspectiveSwitch, Messages.NewProjectWizard_DoYouWantToSwitsh);
       } catch (WorkbenchException e) {
           LogHelper.logError(e);
       }
	
	return true;
}
 
源代码3 项目: spotbugs   文件: BugExplorerView.java
@Override
public void init(IViewSite site, IMemento memento) throws PartInitException {
    viewMemento = memento;
    if (memento == null) {
        IDialogSettings dialogSettings = FindbugsPlugin.getDefault().getDialogSettings();
        String persistedMemento = dialogSettings.get(TAG_MEMENTO);
        if (persistedMemento == null) {
            // See bug 2504068. First time user opens a view, no settings
            // are defined
            // but we still need to enforce initialisation of content
            // provider
            // which can only happen if memento is not null
            memento = XMLMemento.createWriteRoot("bugExplorer");
        } else {
            try {
                memento = XMLMemento.createReadRoot(new StringReader(persistedMemento));
            } catch (WorkbenchException e) {
                // don't do anything. Simply don't restore the settings
            }
        }
    }
    super.init(site, memento);
}
 
源代码4 项目: spotbugs   文件: AbstractFindbugsView.java
/**
 *
 */
final void showPerspective() {
    IWorkbenchPage page = getSite().getPage();
    IWorkbenchWindow window = getSite().getWorkbenchWindow();
    IAdaptable input;
    if (page != null) {
        input = page.getInput();
    } else {
        input = ResourcesPlugin.getWorkspace().getRoot();
    }
    try {
        PlatformUI.getWorkbench().showPerspective(FindBugsPerspectiveFactory.ID, window, input);
    } catch (WorkbenchException e) {
        FindbugsPlugin.getDefault().logException(e, "Failed to open SpotBugs Perspective");
    }
}
 
源代码5 项目: dsl-devkit   文件: CoreSwtbotTools.java
/**
 * Switching to the default Avaloq perspective and resets it.
 */
public static void switchAndResetPerspective() {
  PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {

    @Override
    public void run() {
      final IWorkbench workbench = PlatformUI.getWorkbench();
      final IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
      IWorkbenchPage page = null;
      try {
        page = workbench.showPerspective("com.avaloq.ice.perspectives.Development", window);
      } catch (final WorkbenchException exception) {
        // Try customer perspective
        try {
          page = workbench.showPerspective("com.avaloq.ice.perspectives.Development", window);
        } catch (final WorkbenchException second) {
          // Both perspectives are missing
          throw new AssertionFailedException("Could not switch to Avaloq Perspective: " + exception.getLocalizedMessage());
        }
      }
      if (page != null) {
        page.resetPerspective();
      }
    }
  });
}
 
源代码6 项目: tlaplus   文件: UIHelper.java
/**
 * 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;
}
 
源代码7 项目: tlaplus   文件: RCPTestSetupHelper.java
/**
 * Close all open windows, editors, perspectives. Open and reset default perspective.
 */
private static void resetWorkbench() {
    try {
        IWorkbench workbench = PlatformUI.getWorkbench();
        IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
        IWorkbenchPage page = workbenchWindow.getActivePage();
        
        Shell activeShell = Display.getCurrent().getActiveShell();
        if (activeShell != null && activeShell != workbenchWindow.getShell()) {
            activeShell.close();
        }
        
        page.closeAllEditors(false);
        page.resetPerspective();
        
        String defaultPerspectiveId = workbench.getPerspectiveRegistry().getDefaultPerspective();
        workbench.showPerspective(defaultPerspectiveId, workbenchWindow);
        page.resetPerspective();
        
        page.showView("org.eclipse.ui.internal.introview");
    } catch (WorkbenchException e) {
        throw new RuntimeException(e);
    }
}
 
public void testLoad() throws WorkbenchException {
  // Test loading from a well-formed XML fragment
  IndexedJsniJavaRef ref = loadRef("<JavaRef class=\"com.google.gwt.eclipse.plugin.search.IndexedJsniJavaRef\" offset=\"25\" source=\"/MyProject/src/com/hello/Hello.java\">@com.hello.Hello::sayHi(Ljava/lang/String;)</JavaRef>");
  assertNotNull(ref);
  assertEquals(25, ref.getOffset());
  assertEquals("/MyProject/src/com/hello/Hello.java",
      ref.getSource().toString());
  assertEquals("com.hello.Hello", ref.className());
  assertEquals("sayHi", ref.memberName());
  assertEquals("Ljava/lang/String;", ref.paramTypesString());

  // Test fragment missing the Java ref string
  assertNull(loadRef("<JavaRef class=\"com.google.gwt.eclipse.plugin.search.IndexedJsniJavaRef\" offset=\"25\" source=\"/MyProject/src/com/hello/Hello.java\"></JavaRef>"));

  // Test fragment with malformed Java ref string
  assertNull(loadRef("<JavaRef class=\"com.google.gwt.eclipse.plugin.search.IndexedJsniJavaRef\" offset=\"25\" source=\"/MyProject/src/com/hello/Hello.java\">[email protected]#</JavaRef>"));

  // Test fragment missing the source attribute
  assertNull(loadRef("<JavaRef class=\"com.google.gwt.eclipse.plugin.search.IndexedJsniJavaRef\" offset=\"25\">@com.hello.Hello::sayHi(Ljava/lang/String;)</JavaRef>"));

  // Test fragment missing the offset attribute
  assertNull(loadRef("<JavaRef class=\"com.google.gwt.eclipse.plugin.search.IndexedJsniJavaRef\" source=\"/MyProject/src/com/hello/Hello.java\">@com.hello.Hello::sayHi(Ljava/lang/String;)</JavaRef>"));
}
 
public void testLoad() throws WorkbenchException {
  // Test loading from a well-formed XML fragment
  JsniJavaRefParamType ref = loadRef("<JavaRef class=\"com.google.gwt.eclipse.plugin.search.JsniJavaRefParamType\" offset=\"25\" source=\"/MyProject/src/com/hello/Hello.java\">Ljava/lang/String;</JavaRef>");
  assertNotNull(ref);

  // Test fragment missing the Java ref string
  assertNull(loadRef("<JavaRef class=\"com.google.gwt.eclipse.plugin.search.JsniJavaRefParamType\" offset=\"25\" source=\"/MyProject/src/com/hello/Hello.java\"></JavaRef>"));

  // Test fragment with malformed Java ref string
  assertNull(loadRef("<JavaRef class=\"com.google.gwt.eclipse.plugin.search.JsniJavaRefParamType\" offset=\"25\" source=\"/MyProject/src/com/hello/Hello.java\">[email protected]#</JavaRef>"));

  // Test fragment missing the source attribute
  assertNull(loadRef("<JavaRef class=\"com.google.gwt.eclipse.plugin.search.JsniJavaRefParamType\" offset=\"25\">Ljava/lang/String;</JavaRef>"));

  // Test fragment missing the offset attribute
  assertNull(loadRef("<JavaRef class=\"com.google.gwt.eclipse.plugin.search.JsniJavaRefParamType\" source=\"/MyProject/src/com/hello/Hello.java\">Ljava/lang/String;</JavaRef>"));
}
 
@Override
public void run() {
	IWorkbench workbench= JavaPlugin.getDefault().getWorkbench();
	IWorkbenchWindow window= workbench.getActiveWorkbenchWindow();
	IWorkbenchPage page= window.getActivePage();
	IAdaptable input;
	if (page != null)
		input= page.getInput();
	else
		input= ResourcesPlugin.getWorkspace().getRoot();
	try {
		workbench.showPerspective(JavaUI.ID_BROWSING_PERSPECTIVE, window, input);
	} catch (WorkbenchException e) {
		ExceptionHandler.handle(e, window.getShell(),
			ActionMessages.OpenJavaBrowsingPerspectiveAction_dialog_title,
			ActionMessages.OpenJavaBrowsingPerspectiveAction_error_open_failed);
	}
}
 
@Override
public void run() {
	IWorkbench workbench= JavaPlugin.getDefault().getWorkbench();
	IWorkbenchWindow window= workbench.getActiveWorkbenchWindow();
	IWorkbenchPage page= window.getActivePage();
	IAdaptable input;
	if (page != null)
		input= page.getInput();
	else
		input= ResourcesPlugin.getWorkspace().getRoot();
	try {
		workbench.showPerspective(JavaUI.ID_PERSPECTIVE, window, input);
	} catch (WorkbenchException e) {
		ExceptionHandler.handle(e, window.getShell(),
			ActionMessages.OpenJavaPerspectiveAction_dialog_title,
			ActionMessages.OpenJavaPerspectiveAction_error_open_failed);
	}
}
 
@Override
public void init(IViewSite site, IMemento memento) throws PartInitException {
	super.init(site, memento);
	if (memento == null) {
		String persistedMemento= fDialogSettings.get(TAG_MEMENTO);
		if (persistedMemento != null) {
			try {
				memento= XMLMemento.createReadRoot(new StringReader(persistedMemento));
			} catch (WorkbenchException e) {
				// don't do anything. Simply don't restore the settings
			}
		}
	}
	fMemento= memento;
	if (memento != null) {
		restoreLayoutState(memento);
		restoreLinkingEnabled(memento);
		restoreRootMode(memento);
	}
	if (getRootMode() == WORKING_SETS_AS_ROOTS) {
		createWorkingSetModel();
	}
}
 
private static TypeHierarchyViewPart openInPerspective(IWorkbenchWindow window, IJavaElement[] input) throws WorkbenchException, JavaModelException {
	IWorkbench workbench= JavaPlugin.getDefault().getWorkbench();
	IJavaElement perspectiveInput= input.length == 1 ? input[0] : null;

	if (perspectiveInput != null && input[0] instanceof IMember) {
		if (input[0].getElementType() != IJavaElement.TYPE) {
			perspectiveInput= ((IMember)input[0]).getDeclaringType();
		} else {
			perspectiveInput= input[0];
		}
	}
	IWorkbenchPage page= workbench.showPerspective(JavaUI.ID_HIERARCHYPERSPECTIVE, window, perspectiveInput);

	TypeHierarchyViewPart part= (TypeHierarchyViewPart) page.findView(JavaUI.ID_TYPE_HIERARCHY);
	if (part != null) {
		part.clearNeededRefresh(); // avoid refresh of old hierarchy on 'becomes visible'
	}
	part= (TypeHierarchyViewPart) page.showView(JavaUI.ID_TYPE_HIERARCHY);
	part.setInputElements(input);
	if (perspectiveInput != null) {
		if (page.getEditorReferences().length == 0) {
			JavaUI.openInEditor(input[0], false, false); // only open when the perspective has been created
		}
	}
	return part;
}
 
源代码14 项目: tesb-studio-se   文件: OpenWSDLEditorAction.java
public void run(IIntroSite site, Properties params) {
    PlatformUI.getWorkbench().getIntroManager().closeIntro(PlatformUI.getWorkbench().getIntroManager().getIntro());

    IPerspectiveDescriptor currentPerspective = site.getPage().getPerspective();
    if (!PERSPECTIVE_ID.equals(currentPerspective.getId())) {
        // show required perspective
        IWorkbenchWindow workbenchWindow = site.getWorkbenchWindow();
        try {
            workbenchWindow.getWorkbench().showPerspective(PERSPECTIVE_ID, workbenchWindow);
        } catch (WorkbenchException e) {
            ExceptionHandler.process(e);
            return;
        }
    }

    // find repository node
    repositoryNode = (RepositoryNode) RepositorySeekerManager.getInstance().searchRepoViewNode(params.getProperty("nodeId"),
            false);
    if (null != repositoryNode) {
        // expand/select node item
        RepositoryManagerHelper.getRepositoryView().getViewer().setSelection(new StructuredSelection(repositoryNode));
        init(repositoryNode);
        doRun();
    }
}
 
源代码15 项目: Pydev   文件: GlobalsTwoPanelElementSelector2.java
@Override
protected void restoreDialog(IDialogSettings settings) {
    super.restoreDialog(settings);

    String setting = settings.get(WORKINGS_SET_SETTINGS);
    if (setting != null) {
        try {
            IMemento memento = XMLMemento.createReadRoot(new StringReader(setting));
            workingSetFilterActionGroup.restoreState(memento);
        } catch (WorkbenchException e) {
            StatusManager.getManager().handle(
                    new Status(IStatus.ERROR, AnalysisPlugin.getPluginID(), IStatus.ERROR, "", e)); //$NON-NLS-1$
            // don't do anything. Simply don't restore the settings
        }
    }

    addListFilter(workingSetFilter);

    applyFilter();
}
 
源代码16 项目: Pydev   文件: DebuggerTestUtils.java
/**
 * This method can be used to switch to a given perspective
 * @param perspectiveId the id of the perspective that should be activated.
 * @return the exception raised or null.
 */
public void switchToPerspective(final String perspectiveId) {
    final IWorkbench workBench = PydevPlugin.getDefault().getWorkbench();
    Display display = workBench.getDisplay();

    // Make sure to run the UI thread.
    display.syncExec(new Runnable() {

        @Override
        public void run() {
            IWorkbenchWindow window = workBench.getActiveWorkbenchWindow();
            try {
                workBench.showPerspective(perspectiveId, window);
            } catch (WorkbenchException e) {
                failException = e;
            }
        }
    });
}
 
源代码17 项目: bonita-studio   文件: SwitchPaletteMode.java
/**
 * Retrieves the root memento from the workspace preferences if there were
 * existing palette customizations.
 * 
 * @return the root memento if there were existing customizations; null
 *         otherwise
 */
private XMLMemento getExistingCustomizations() {
	if (preferences != null) {
		String sValue = preferences.getString(PALETTE_CUSTOMIZATIONS_ID);
		if (sValue != null && sValue.length() != 0) { //$NON-NLS-1$
			try {
				XMLMemento rootMemento = XMLMemento.createReadRoot(new StringReader(sValue));
				return rootMemento;
			} catch (WorkbenchException e) {
				Trace.catching(GefPlugin.getInstance(), GefDebugOptions.EXCEPTIONS_CATCHING, getClass(),
						"Problem creating the XML memento when saving the palette customizations.", //$NON-NLS-1$
						e);
				Log.warning(GefPlugin.getInstance(), GefStatusCodes.IGNORED_EXCEPTION_WARNING,
						"Problem creating the XML memento when saving the palette customizations.", //$NON-NLS-1$
						e);
			}
		}
	}
	return null;
}
 
源代码18 项目: xds-ide   文件: PerspectiveUtils.java
public static void promptAndOpenPerspective(IWorkbench workbench, String perspectiveId, String title, String message) throws WorkbenchException {
    IWorkbenchWindow activeWindow = workbench.getActiveWorkbenchWindow();

    if (!perspectiveId.equals(activeWindow.getActivePage().getPerspective().getId())) {
        if (MessageDialog.openConfirm(activeWindow.getShell(), title, message)) {
            workbench.showPerspective(perspectiveId, activeWindow);
        }
    }
}
 
源代码19 项目: xds-ide   文件: PerspectiveUtils.java
public static void showPerspective(String perspectiveId, IWorkbenchWindow window) {
 	Display.getDefault().asyncExec(() -> {
 		IWorkbench workbench = PlatformUI.getWorkbench();
try {
	workbench.showPerspective(perspectiveId, window);
} catch (WorkbenchException e) {
	LogHelper.logError(e);
}
 	});
 }
 
源代码20 项目: xds-ide   文件: XdsResourcesUpdater.java
private void applyPluginResourceUpdates(UpdateDirDescriptor desc) throws WorkbenchException, IOException {
	InstalledUpdatesRegistry installedUpdatesRegistry = InstalledUpdatesManager.getInstance().loadInstalledUpdatesRegistry();
	
	boolean isNewUpdatesInstalled = false;
	
	String updateDirPath = desc.updateDirPath;
	List<Update> updates = desc.updates;
	Map<String, Bundle> pluginName2Bundle = new HashMap<String, Bundle>();
	Set<String> unresolvedBundleNames = new HashSet<String>();
	for (Update update : updates) {
		Bundle bundle = pluginName2Bundle.get(update.targetPluginName);
		if (bundle == null) {
			bundle = Platform.getBundle(update.targetPluginName);
			if (bundle == null) {
				unresolvedBundleNames.add(update.targetPluginName);
				continue;
			}
			pluginName2Bundle.put(update.targetPluginName, bundle);
		}
		if (updateResource(installedUpdatesRegistry, bundle, updateDirPath, update)) {
			isNewUpdatesInstalled = true;
		}
	}
	if (isNewUpdatesInstalled) {
		InstalledUpdatesManager.getInstance().saveInstalledUpdatesRegistry(installedUpdatesRegistry);
	}
	
	for (String unresolvedBundleName : unresolvedBundleNames) {
		LogHelper.logError(String.format("Bundle '%s' was not found during update", unresolvedBundleName)); //$NON-NLS-1$
	}
}
 
源代码21 项目: xds-ide   文件: InstalledUpdatesManager.java
public InstalledUpdatesRegistry loadInstalledUpdatesRegistry() throws IOException, WorkbenchException {
	if (installedUpdatesRegistry == null) {
		File installedUpdatesRegistryFile = getInstalledUpdatesRegistryFile();
		if (installedUpdatesRegistryFile.exists()) {
			Reader reader = new FileReader(installedUpdatesRegistryFile);
			XMLMemento memento = XMLMemento.createReadRoot(reader);
			installedUpdatesRegistry = loadInstalledUpdatesRegistry(memento);
		}
		else {
			installedUpdatesRegistry = new InstalledUpdatesRegistry(new HashMap<String, InstalledUpdate>());
		}
	}
	return installedUpdatesRegistry;
}
 
源代码22 项目: spotbugs   文件: FindBugsAction.java
protected static void switchPerspective(IWorkbenchPart part) {
    IWorkbenchWindow window = getWindow(part);
    IWorkbenchPage page = window.getActivePage();
    IAdaptable input;
    if (page != null) {
        input = page.getInput();
    } else {
        input = ResourcesPlugin.getWorkspace().getRoot();
    }
    try {
        PlatformUI.getWorkbench().showPerspective(FindBugsPerspectiveFactory.ID, window, input);
    } catch (WorkbenchException e) {
        FindbugsPlugin.getDefault().logException(e, "Failed to open SpotBugs Perspective");
    }
}
 
源代码23 项目: spotbugs   文件: FindBugsPerspectiveTest.java
@Test
public void testShowPerspective() throws WorkbenchException {
    // Show the perspective
    IWorkbenchPage page = showFindBugsPerspective();

    // Reset the perspective to its default state
    page.resetPerspective();

    // Assert the FindBugs explorer view is visible
    IViewPart bugExplorerView = page.findView(AbstractPluginTest.BUG_EXPLORER_VIEW_ID);
    assertNotNull(bugExplorerView);
    assertTrue(page.isPartVisible(bugExplorerView));
}
 
源代码24 项目: tlaplus   文件: UIHelper.java
/**
 * Switch current perspective
 * 
 * @param perspectiveId
 * @return
 */
public static IWorkbenchPage switchPerspective(String perspectiveId) {
	Assert.isNotNull(perspectiveId, "PerspectiveId is null");
	IWorkbench workbench = PlatformUI.getWorkbench();
	IWorkbenchWindow window = getActiveWindow();
	Assert.isNotNull(workbench, "Workbench is null");
	Assert.isNotNull(window, "Window is null");
	try {
		IWorkbenchPage page = workbench.showPerspective(perspectiveId, window);

		// show intro
		if (InitialPerspective.ID.equals(perspectiveId) && workbench.getIntroManager().hasIntro()) {
			page.resetPerspective();
			// We are no longer showing the Intro view. The following will
			// probably
			// be replaced by something that shows the view we want. 09 Oct
			// 2009
			// workbench.getIntroManager().showIntro(window, false);
			openView(ToolboxWelcomeView.ID);

		}

		return page;
	} catch (WorkbenchException e) {
		Activator.getDefault().logError("Error switching a perspective to " + perspectiveId, e);
	}

	return null;
}
 
源代码25 项目: tlaplus   文件: FilteredItemsSelectionDialog.java
/**
 * Restores dialog using persisted settings. The default implementation
 * restores the status of the details line and the selection history.
 *
 * @param settings
 *            settings used to restore dialog
 */
protected void restoreDialog(IDialogSettings settings) {
	boolean toggleStatusLine = true;

	if (settings.get(SHOW_STATUS_LINE) != null) {
		toggleStatusLine = settings.getBoolean(SHOW_STATUS_LINE);
	}

	toggleStatusLineAction.setChecked(toggleStatusLine);

	details.setVisible(toggleStatusLine);

	String setting = settings.get(HISTORY_SETTINGS);
	if (setting != null) {
		try {
			IMemento memento = XMLMemento.createReadRoot(new StringReader(
					setting));
			this.contentProvider.loadHistory(memento);
		} catch (WorkbenchException e) {
			// Simply don't restore the settings
			StatusManager
					.getManager()
					.handle(
							new Status(
									IStatus.ERROR,
									PlatformUI.PLUGIN_ID,
									IStatus.ERROR,
									WorkbenchMessages.FilteredItemsSelectionDialog_restoreError,
									e));
		}
	}
}
 
源代码26 项目: typescript.java   文件: AbstractNewProjectWizard.java
private static void openInNewWindow(IPerspectiveDescriptor desc) {

		// Open the page.
		try {
			PlatformUI.getWorkbench().openWorkbenchWindow(desc.getId(), ResourcesPlugin.getWorkspace().getRoot());
		} catch (WorkbenchException e) {
			IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
			if (window != null) {
				ErrorDialog.openError(window.getShell(), WINDOW_PROBLEMS_TITLE, e.getMessage(), e.getStatus());
			}
		}
	}
 
源代码27 项目: tracecompass   文件: SWTBotUtils.java
/**
 * Switch to a given perspective
 *
 * @param id
 *            the perspective id (like
 *            "org.eclipse.linuxtools.tmf.ui.perspective"
 */
public static void switchToPerspective(final String id) {
    UIThreadRunnable.syncExec(new VoidResult() {
        @Override
        public void run() {
            try {
                PlatformUI.getWorkbench().showPerspective(id, PlatformUI.getWorkbench().getActiveWorkbenchWindow());
                PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().resetPerspective();
            } catch (WorkbenchException e) {
                fail(e.getMessage());
            }
        }
    });
}
 
源代码28 项目: tracecompass   文件: TmfPerspectiveManager.java
/**
 * Switches to the specified perspective.
 *
 * @param window
 *            the workbench window
 * @param id
 *            perspective identifier
 */
protected void switchToPerspective(IWorkbenchWindow window, String id) {
    try {
        window.getWorkbench().showPerspective(id, window);
    } catch (WorkbenchException e) {
        TraceUtils.displayErrorMsg(
                Messages.TmfPerspectiveManager_SwitchPerspectiveErrorTitle,
                Messages.TmfPerspectiveManager_SwitchPerspectiveErrorMessage,
                e);
    }
}
 
public void testMemberSignature() throws WorkbenchException {
  // Test regular method
  IndexedJsniJavaRef ref = loadRef("<JavaRef class=\"com.google.gwt.eclipse.plugin.search.IndexedJsniJavaRef\" offset=\"25\" source=\"/MyProject/src/com/hello/Hello.java\">@com.hello.Hello::sayHi()</JavaRef>");
  assertEquals("sayHi()", ref.memberSignature());

  // Test constructor
  ref = loadRef("<JavaRef class=\"com.google.gwt.eclipse.plugin.search.IndexedJsniJavaRef\" offset=\"25\" source=\"/MyProject/src/com/hello/Hello.java\">@com.hello.Hello::new()</JavaRef>");
  assertEquals("Hello()", ref.memberSignature());
}
 
@Override
protected void restoreDialog(IDialogSettings settings) {
	super.restoreDialog(settings);

	if (! BUG_184693) {
		boolean showContainer= settings.getBoolean(SHOW_CONTAINER_FOR_DUPLICATES);
		fShowContainerForDuplicatesAction.setChecked(showContainer);
		fTypeInfoLabelProvider.setContainerInfo(showContainer);
	} else {
		fTypeInfoLabelProvider.setContainerInfo(true);
	}

	if (fAllowScopeSwitching) {
		String setting= settings.get(WORKINGS_SET_SETTINGS);
		if (setting != null) {
			try {
				IMemento memento= XMLMemento.createReadRoot(new StringReader(setting));
				fFilterActionGroup.restoreState(memento);
			} catch (WorkbenchException e) {
				// don't do anything. Simply don't restore the settings
				JavaPlugin.log(e);
			}
		}
		IWorkingSet ws= fFilterActionGroup.getWorkingSet();
		if (ws == null || (ws.isAggregateWorkingSet() && ws.isEmpty())) {
			setSearchScope(SearchEngine.createWorkspaceScope());
			setSubtitle(null);
		} else {
			setSearchScope(JavaSearchScopeFactory.getInstance().createJavaSearchScope(ws, true));
			setSubtitle(ws.getLabel());
		}
	}

	// TypeNameMatch[] types = OpenTypeHistory.getInstance().getTypeInfos();
	//
	// for (int i = 0; i < types.length; i++) {
	// TypeNameMatch type = types[i];
	// accessedHistoryItem(type);
	// }
}
 
 类所在包
 类方法
 同包方法