Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Goldthorpe2007-01-24 18:37:30 +0000
committerChris Goldthorpe2007-01-24 18:37:30 +0000
commitddfe7cea9e1a98302de446610a6a42e474b1a844 (patch)
tree47ed26171680fe8dfca5108907dbb390449aa99e /org.eclipse.ui.cheatsheets/src/org/eclipse/ui/cheatsheets
parent1f0ba98c8421130ed8c2e1e6c320c9058216e095 (diff)
downloadeclipse.platform.ua-ddfe7cea9e1a98302de446610a6a42e474b1a844.tar.gz
eclipse.platform.ua-ddfe7cea9e1a98302de446610a6a42e474b1a844.tar.xz
eclipse.platform.ua-ddfe7cea9e1a98302de446610a6a42e474b1a844.zip
Open cheat sheet from URL, initial implementation.
Diffstat (limited to 'org.eclipse.ui.cheatsheets/src/org/eclipse/ui/cheatsheets')
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/cheatsheets/OpenCheatSheetAction.java29
1 files changed, 9 insertions, 20 deletions
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/cheatsheets/OpenCheatSheetAction.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/cheatsheets/OpenCheatSheetAction.java
index 553f91823..afd9f04a7 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/cheatsheets/OpenCheatSheetAction.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/cheatsheets/OpenCheatSheetAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
+ * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -12,17 +12,13 @@ package org.eclipse.ui.cheatsheets;
import java.net.URL;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
import org.eclipse.jface.action.Action;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
import org.eclipse.ui.internal.cheatsheets.CheatSheetPlugin;
-import org.eclipse.ui.internal.cheatsheets.ICheatSheetResource;
-import org.eclipse.ui.internal.cheatsheets.Messages;
import org.eclipse.ui.internal.cheatsheets.views.CheatSheetView;
+import org.eclipse.ui.internal.cheatsheets.views.ViewUtilities;
/**
* Action for opening a cheat sheet. The cheat sheet can be specified
@@ -112,22 +108,10 @@ public final class OpenCheatSheetAction extends Action {
* @see IAction#run()
*/
public void run() {
- IWorkbench workbench = CheatSheetPlugin.getPlugin().getWorkbench();
- IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
- IWorkbenchPage page = window.getActivePage();
+ CheatSheetView view = ViewUtilities.showCheatSheetView();
- CheatSheetView view = (CheatSheetView) page.findView(ICheatSheetResource.CHEAT_SHEET_VIEW_ID);
if (view == null) {
- try {
- view = (CheatSheetView)page.showView(ICheatSheetResource.CHEAT_SHEET_VIEW_ID);
- page.activate(view);
- } catch (PartInitException pie) {
- String message = Messages.LAUNCH_SHEET_ERROR;
- IStatus status = new Status(IStatus.ERROR, ICheatSheetResource.CHEAT_SHEET_PLUGIN_ID, IStatus.OK, message, pie);
- CheatSheetPlugin.getPlugin().getLog().log(status);
- org.eclipse.jface.dialogs.ErrorDialog.openError(window.getShell(), Messages.CHEAT_SHEET_ERROR_OPENING, null, pie.getStatus());
- return;
- }
+ return;
}
// Depending on which constructor was used open the cheat sheet view from a
// URL, an XML string or based on the id
@@ -138,6 +122,11 @@ public final class OpenCheatSheetAction extends Action {
} else {
view.setInput(id);
}
+ IWorkbench workbench = CheatSheetPlugin.getPlugin().getWorkbench();
+ IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
+ IWorkbenchPage page = window.getActivePage();
page.bringToTop(view);
}
+
+
}

Back to the top