bindeditorcontributor.java
来自「一个eclipse插件源代码。用于web开发」· Java 代码 · 共 110 行
JAVA
110 行
/*
* $Header: /home/cvs/WEBPUMP2.0/WebPumpIDE_Src/WebPumpIDE/src/com/webpump/ui/bind/editors/BindEditorContributor.java,v 1.1.1.1 2004/07/01 09:07:41 wang_j Exp $
* $Revision: 1.1.1.1 $
* $Date: 2004/07/01 09:07:41 $
*
* ====================================================================
*
* The NanJing HopeRun(IT-FOREST) Software License, Version 2.0.0
*
* Copyright 2003-2004 by NanJing HopeRun(IT-FOREST) Information System Co., Ltd, CHINA and
* IT Forest Corporation
* All rights reserved.
*
* This software is the confidential and proprietary information of
* HopeRun(IT-FOREST) Information System Co., Ltd, CHINA and IT Forest Corporation.
* You shall not disclose such Confidential Information and shall use it only in
* accordance with the terms of the license agreement you entered into with
* HopeRun(IT-FOREST) Information System Co., Ltd, CHINA and IT Forest Corporation.
*/
package com.webpump.ui.bind.editors;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.texteditor.BasicTextEditorActionContributor;
import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.jface.action.*;
/**
* Class for manages the installation/deinstallation of global actions for multi-page editors.
* Responsible for the redirection of global actions to the active editor.
* Multi-page contributor replaces the contributors for the individual editors in the multi-page editor.
*
* @author zhang_tx
* @version 2.0.0 2004-2-13
*/
public class BindEditorContributor extends BasicTextEditorActionContributor {
private IEditorPart activeEditorPart;
private IAction u;
/**
* Creates a multi-page contributor.
*/
public BindEditorContributor() {
super();
createActions();
}
/* (non-JavaDoc)
* Method declared in AbstractMultiPageEditorActionBarContributor.
*/
public void setActivePage(IEditorPart part) {
if (activeEditorPart == part)
return;
activeEditorPart = part;
IActionBars actionBars = getActionBars();
if (actionBars != null) {
ITextEditor editor = (part instanceof ITextEditor) ? (ITextEditor) part : null;
actionBars.setGlobalActionHandler(
IWorkbenchActionConstants.DELETE,
getAction(editor, ITextEditorActionConstants.DELETE));
u = getAction(editor, ITextEditorActionConstants.DELETE);
int t = 0;
actionBars.setGlobalActionHandler(
IWorkbenchActionConstants.UNDO,
getAction(editor, ITextEditorActionConstants.UNDO));
actionBars.setGlobalActionHandler(
IWorkbenchActionConstants.REDO,
getAction(editor, ITextEditorActionConstants.REDO));
actionBars.setGlobalActionHandler(
IWorkbenchActionConstants.CUT,
getAction(editor, ITextEditorActionConstants.CUT));
actionBars.setGlobalActionHandler(
IWorkbenchActionConstants.COPY,
getAction(editor, ITextEditorActionConstants.COPY));
actionBars.setGlobalActionHandler(
IWorkbenchActionConstants.PASTE,
getAction(editor, ITextEditorActionConstants.PASTE));
actionBars.setGlobalActionHandler(
IWorkbenchActionConstants.SELECT_ALL,
getAction(editor, ITextEditorActionConstants.SELECT_ALL));
actionBars.setGlobalActionHandler(
IWorkbenchActionConstants.FIND,
getAction(editor, ITextEditorActionConstants.FIND));
actionBars.setGlobalActionHandler(
IWorkbenchActionConstants.BOOKMARK,
getAction(editor, ITextEditorActionConstants.BOOKMARK));
actionBars.updateActionBars();
}
}
private void createActions(){
}
public void contributeToMenu(IMenuManager manager) {
IMenuManager menu = new MenuManager("Editor &Menu");
manager.prependToGroup(IWorkbenchActionConstants.MB_ADDITIONS, menu);
}
public void contributeToToolBar(IToolBarManager manager) {
manager.add(new Separator());
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?