?? activehelpaction.java
字號:
/*******************************************************************************
* Copyright (c) 2003 Berthold Daum.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* Berthold Daum
*******************************************************************************/
package com.bdaum.SpellChecker.actions;
import org.eclipse.help.ILiveHelpAction;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.WorkbenchPage;
import com.bdaum.SpellChecker.SpellCheckerPlugin;
/**
* Invoking spell checking via active help
*/
public class ActiveHelpAction implements ILiveHelpAction {
// JavaScript invocation parameter
String data;
/**
* Accepts the third parameter of the script invocation
*/
public void setInitializationString(
String data) {
// Remember the parameter
this.data = data;
}
/**
* Runs help action
*/
public void run() {
IWorkbench wb = PlatformUI.getWorkbench();
final IWorkbenchWindow window =
(wb.getActiveWorkbenchWindow() == null) ?
wb.getWorkbenchWindows()[0] :
wb.getActiveWorkbenchWindow();
if (window == null) return;
Display display = window.getShell().getDisplay();
if (display == null) return;
// Active help does not run in the SWT thread.
// Therefore we must encapsulate all GUI accesses into
// a syncExec() method.
display.syncExec(new Runnable() {
public void run() {
// Bring the workbench window into the foreground
Shell shell = window.getShell();
shell.setMinimized(false);
shell.forceActive();
if (data.equals("install")) {
// Fetch workbench page
WorkbenchPage page = (WorkbenchPage) window.getActivePage();
if (page == null) return;
// Call Perspective Configuration function
page.editActionSets();
} else if (data.equals("start")) {
// Get the SpellCheckingActionDelegate
IWorkbenchWindowActionDelegate delegate =
SpellCheckerPlugin.getSpellCheckingActionDelegate();
if (delegate == null) return;
// Execute the spell checking action
delegate.run(null);
}
}
});
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -