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


Java Action.setAccelerator方法代码示例

本文整理汇总了Java中org.eclipse.jface.action.Action.setAccelerator方法的典型用法代码示例。如果您正苦于以下问题:Java Action.setAccelerator方法的具体用法?Java Action.setAccelerator怎么用?Java Action.setAccelerator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jface.action.Action的用法示例。


在下文中一共展示了Action.setAccelerator方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createActions

import org.eclipse.jface.action.Action; //导入方法依赖的package包/类
private void createActions() {
    cutAction = new Action() {
        @Override
        public void run() {
            WorkingFolderDataTable.this.cutSelectionToClipboard();
        }
    };
    cutAction.setText(Messages.getString("WorkingFolderDataTable.CutActionText")); //$NON-NLS-1$
    cutAction.setActionDefinitionId(CommandIDs.CUT);

    copyAction = new Action() {
        @Override
        public void run() {
            WorkingFolderDataTable.this.copySelectionToClipboard();
        }
    };
    copyAction.setText(Messages.getString("WorkingFolderDataTable.CopyActionText")); //$NON-NLS-1$
    copyAction.setActionDefinitionId("org.eclipse.ui.edit.copy"); //$NON-NLS-1$

    pasteAction = new Action() {
        @Override
        public void run() {
            WorkingFolderDataTable.this.pasteFromClipboard();
        }
    };
    pasteAction.setText(Messages.getString("WorkingFolderDataTable.PasteActionText")); //$NON-NLS-1$
    pasteAction.setActionDefinitionId(CommandIDs.PASTE);

    deleteAction = new Action() {
        @Override
        public void run() {
            WorkingFolderDataTable.this.removeSelectedWorkingFolders();
        }
    };
    deleteAction.setText(Messages.getString("WorkingFolderDataTable.DeleteActionText")); //$NON-NLS-1$
    deleteAction.setAccelerator(SWT.DEL);
    deleteAction.setActionDefinitionId(CommandIDs.DELETE);

    selectAllAction = new Action() {
        @Override
        public void run() {
            WorkingFolderDataTable.this.selectAll();
        }
    };
    selectAllAction.setText(Messages.getString("WorkingFolderDataTable.SelectAllActionText")); //$NON-NLS-1$
    selectAllAction.setActionDefinitionId(CommandIDs.SELECT_ALL);

    new ActionValidatorBinding(new IAction[] {
        cutAction,
        copyAction,
        deleteAction
    }).bind(getSelectionValidator());

    /*
     * IMPORTANT: this keybinding support is only appropriate for
     * dialogs/wizards. If this control is ever hosted in a view or editor
     * (or standalone in a SWT/JFace application outside the workbench) then
     * this support will need to be made optional instead of hardcoded.
     */
    actionCommandSupport = ActionKeyBindingSupportFactory.newInstance(getShell());
    actionCommandSupport.addAction(cutAction);
    actionCommandSupport.addAction(copyAction);
    actionCommandSupport.addAction(pasteAction);
    actionCommandSupport.addAction(selectAllAction);
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:66,代码来源:WorkingFolderDataTable.java

示例2: createActions

import org.eclipse.jface.action.Action; //导入方法依赖的package包/类
/**
	 * Create the actions.
	 */
	private void createActions() 
	{
		// Create the actions
		
		// Open the predicate xml file and show it in text area <code>styledTextPredicate</code>
		{
			actionOpen = new Action("Open")
			{
				public void run()
				{
					// choose the predicate xml file
					FileDialog openDlg = new FileDialog(MIPAAppllicationWindow.this.getShell(),SWT.SINGLE);
					openDlg.setFilterExtensions(new String[] {"*.xml"});
					MIPAAppllicationWindow.this.predicateFileName = openDlg.open();
					
					// show the predicate in text are <code>styledTextPredicate</code>
					if(MIPAAppllicationWindow.this.predicateFileName != null)
					{
						logger.info("The predicate xml file is: " + MIPAAppllicationWindow.this.predicateFileName);
//						MIPAAppllicationWindow.this.styledTextPredicate.setText(MIPAAppllicationWindow.this.retrieveContent(predicateFileName));
						PredicateTabUI.getInstance(null).setText(MIPAAppllicationWindow.this.retrieveContent(predicateFileName));
					}
				}
			};
			actionOpen.setToolTipText("Choose the predicate xml file and open it.");
			actionOpen.setAccelerator(SWT.CTRL | 'O');
		}
		// Run mipa application
		{
			actionRun = new Action("Run")
			{
				public void run()
				{
					if(MIPAAppllicationWindow.this.predicateFileName == null)
					{
						logger.info("Please choose the predicate xml file first!");
					}
					else
					{
						logger.info("Run MIPA application all in one.");
						try {
							MIPAAllInOne.getInstance(MIPAAppllicationWindow.this.predicateFileName).runMIPAAllInOne();
						} catch (FileNotFoundException e) {
							// TODO Auto-generated catch block
							e.printStackTrace();
						}
					}
				}
			};
			actionRun.setToolTipText("Run MIPA all in one.");
			actionRun.setAccelerator(SWT.CTRL | 'R');
		}
	}
 
开发者ID:alg-nju,项目名称:mipa,代码行数:57,代码来源:MIPAAppllicationWindow.java


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