本文整理汇总了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);
}
示例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');
}
}