本文整理了Java中org.eclipse.jface.action.Action
类的一些代码示例,展示了Action
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Action
类的具体详情如下:
包路径:org.eclipse.jface.action.Action
类名称:Action
[英]The standard abstract implementation of an action.
Subclasses must implement the IAction.run
method to carry out the action's semantics.
[中]动作的标准抽象实现。
子类必须实现IAction.run
方法来执行操作的语义。
代码示例来源:origin: org.eclipse/org.eclipse.pde.runtime
private Action createClearAction() {
Action action = new Action(PDERuntimeMessages.LogView_clear) {
public void run() {
handleClear();
}
};
action.setImageDescriptor(PDERuntimePluginImages.DESC_CLEAR);
action.setDisabledImageDescriptor(PDERuntimePluginImages.DESC_CLEAR_DISABLED);
action.setToolTipText(PDERuntimeMessages.LogView_clear_tooltip);
action.setText(PDERuntimeMessages.LogView_clear);
return action;
}
代码示例来源:origin: pentaho/pentaho-kettle
action.setChecked( selected );
JfaceMenuitem child =
new JfaceMenuitem( null, customRowDistMenu, xulDomContainer, "Round Robin row distribution", 0, action );
action.setChecked( selected );
child =
new JfaceMenuitem( null, customRowDistMenu, xulDomContainer, rowDistributionPlugin.getName(), p + 1,
action.setChecked( selected );
child = new JfaceMenuitem( null, customRowDistMenu, xulDomContainer, "Copy rows distribution", 0, action );
child.setLabel( BaseMessages.getString( PKG, "TransGraph.PopupMenu.CopyData" ) );
代码示例来源:origin: org.eclipse/org.eclipse.pde.runtime
private Action createExportAction() {
Action action = new Action(PDERuntimeMessages.LogView_export) {
public void run() {
handleExport();
}
};
action.setToolTipText(PDERuntimeMessages.LogView_export_tooltip);
action.setImageDescriptor(PDERuntimePluginImages.DESC_EXPORT);
action.setDisabledImageDescriptor(PDERuntimePluginImages.DESC_EXPORT_DISABLED);
action.setEnabled(fInputFile.exists());
return action;
}
代码示例来源:origin: org.eclipse/org.eclipse.pde.runtime
private Action createImportLogAction() {
Action action = new Action(PDERuntimeMessages.LogView_import) {
public void run() {
handleImport();
}
};
action.setToolTipText(PDERuntimeMessages.LogView_import_tooltip);
action.setImageDescriptor(PDERuntimePluginImages.DESC_IMPORT);
action.setDisabledImageDescriptor(PDERuntimePluginImages.DESC_IMPORT_DISABLED);
return action;
}
代码示例来源:origin: biz.aQute/aQute.bnd
private void createActions() {
sampleAction = new Action() {
public void run() {
MessageDialog.openInformation(null, "aQute Bnd PRO", "Sample Action Executed");
}
};
sampleAction.setText("Sample Action");
sampleAction.setToolTipText("Sample Action tool tip");
sampleAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().
getImageDescriptor(IDE.SharedImages.IMG_OBJS_TASK_TSK));
}
public void contributeToMenu(IMenuManager manager) {
代码示例来源:origin: org.apache.directory.studio/ldapbrowser.common
public OpenSortDialogAction( EntryEditorWidgetPreferences preferences )
{
super.setText( Messages.getString( "OpenSortDialogAction.Sorting" ) ); //$NON-NLS-1$
super.setToolTipText( Messages.getString( "OpenSortDialogAction.Sorting" ) ); //$NON-NLS-1$
super.setImageDescriptor( BrowserCommonActivator.getDefault().getImageDescriptor(
BrowserCommonConstants.IMG_SORT ) );
super.setEnabled( true );
this.preferences = preferences;
}
代码示例来源:origin: org.apache.directory.studio/ldapbrowser.common
/**
* Creates a new instance of ValueEditorPreferencesAction.
*/
public ValueEditorPreferencesAction()
{
super.setText( Messages.getString( "ValueEditorPreferencesAction.Preferences" ) ); //$NON-NLS-1$
super.setToolTipText( Messages.getString( "ValueEditorPreferencesAction.Preferences" ) ); //$NON-NLS-1$
super.setEnabled( true );
}
代码示例来源:origin: org.apache.directory.studio/ldapbrowser.common
/**
* Creates a new instance of ShowRawValuesAction.
*/
public ShowDecoratedValuesAction()
{
super( Messages.getString( "ShowDecoratedValuesAction.ShowDecoratedValues" ), AS_CHECK_BOX ); //$NON-NLS-1$
super.setToolTipText( getText() );
super.setEnabled( true );
super.setChecked( !BrowserCommonActivator.getDefault().getPreferenceStore().getBoolean(
BrowserCommonConstants.PREFERENCE_SHOW_RAW_VALUES ) );
}
代码示例来源:origin: org.eclipse.mylyn.commons/screenshots
private void updateAction(Action action, int id) {
action.setChecked(id == selectedItemID);
if (getId().equals(CAPTURE_DROP_DOWN_MENU + "")) { //$NON-NLS-1$
if (id == CAPTURE_CLIPBOARD) {
action.setEnabled(existImageOnClipboard());
} else if (id == CAPTURE_RECTANGLE) {
action.setEnabled(isEnableRectangle());
}
}
}
代码示例来源:origin: org.eclipse/org.eclipse.team.ui
public Object execute(ExecutionEvent event)
throws ExecutionException {
synchronizeAction.run();
return null;
}
};
代码示例来源:origin: org.eclipse/org.eclipse.team.ui
public SynchronizePageDropDownAction(ISynchronizeView view) {
fView= view;
Utils.initAction(this, "action.refreshSubscriber."); //$NON-NLS-1$
synchronizeAction = new Action(TeamUIMessages.GlobalRefreshAction_4) {
public void run() {
IWizard wizard = new GlobalSynchronizeWizard();
WizardDialog dialog = new WizardDialog(fView.getViewSite().getShell(), wizard);
dialog.open();
}
};
synchronizeAction.setImageDescriptor(TeamImages.getImageDescriptor(ITeamUIImages.IMG_SYNC_VIEW));
synchronizeAction.setActionDefinitionId("org.eclipse.team.ui.synchronizeAll"); //$NON-NLS-1$
setMenuCreator(this);
TeamUI.getSynchronizeManager().addSynchronizeParticipantListener(this);
update();
fView.getSite().getKeyBindingService().registerAction(synchronizeAction);
setActionDefinitionId("org.eclipse.team.ui.synchronizeLast"); //$NON-NLS-1$
fView.getSite().getKeyBindingService().registerAction(this);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.intro
private void addShortcut(final IntroLaunchBarShortcut shortcut, IToolBarManager toolBarManager) {
Action action = new Action(shortcut.getToolTip()) {
@Override
public void run() {
executeShortcut(shortcut.getURL());
}
};
action.setImageDescriptor(shortcut.getImageDescriptor());
action.setToolTipText(shortcut.getToolTip());
toolBarManager.add(action);
}
代码示例来源:origin: org.eclipse/org.eclipse.ui.console
private void addActionToMenu(Menu parent, Action action, int accelerator) {
if (accelerator < 10) {
StringBuffer label= new StringBuffer();
//add the numerical accelerator
label.append('&');
label.append(accelerator);
label.append(' ');
label.append(action.getText());
action.setText(label.toString());
}
ActionContributionItem item= new ActionContributionItem(action);
item.fill(parent, -1);
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.m2e.core.ui
@Override
public void widgetSelected(SelectionEvent e) {
showPhases = btnShowPhases.getSelection();
actExpandAll.setEnabled(showPhases);
actCollapseAll.setEnabled(showPhases);
updateMappingsTreeViewer();
}
});
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.workbench.texteditor
/**
* Setup the menu, context menu and toolbar actions.
*/
private void setupActions() {
createActions();
IActionBars actionBars= getSite().getActionBars();
actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), fPasteAction);
fPasteAction.setActionDefinitionId(ActionFactory.PASTE.getCommandId());
fPasteAction.setText(TemplatesMessages.TemplatesPage_paste);
actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), fCopyAction);
fCopyAction.setActionDefinitionId(ActionFactory.COPY.getCommandId());
fCopyAction.setText(TemplatesMessages.TemplatesPage_copy);
fillToolbar(actionBars);
fillMenu(actionBars);
}
代码示例来源:origin: inspectIT/inspectIT
/**
* {@inheritDoc}
*/
@Override
public void disableLiveMode() {
if (switchLiveMode.isChecked()) {
switchLiveMode.setChecked(false);
// switchPreferences.setEnabled(!switchPreferences.isEnabled());
createLiveModeEvent();
}
}
代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui
private boolean isTreeViewerSorted() {
if (fSortAction == null) {
return false;
}
return fSortAction.isChecked();
}
}
代码示例来源:origin: org.apache.directory.studio/ldapbrowser.common
protected BrowserActionProxy( ISelectionProvider selectionProvider, BrowserAction action, int style )
{
super( action.getText(), style );
this.selectionProvider = selectionProvider;
this.action = action;
super.setImageDescriptor( action.getImageDescriptor() );
super.setActionDefinitionId( action.getCommandId() );
selectionProvider.addSelectionChangedListener( this );
// PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().addSelectionListener(this);
ConnectionEventRegistry.addConnectionUpdateListener( this, ConnectionUIPlugin.getDefault().getEventRunner() );
EventRegistry.addEntryUpdateListener( this, BrowserCommonActivator.getDefault().getEventRunner() );
EventRegistry.addSearchUpdateListener( this, BrowserCommonActivator.getDefault().getEventRunner() );
EventRegistry.addBookmarkUpdateListener( this, BrowserCommonActivator.getDefault().getEventRunner() );
updateAction();
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.search
private void initActionDefinitionIDs() {
fCopyToClipboardAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_COPY);
fRemoveSelectedMatches.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_DELETE);
fShowNextAction.setActionDefinitionId(IWorkbenchCommandConstants.NAVIGATE_NEXT);
fShowPreviousAction.setActionDefinitionId(IWorkbenchCommandConstants.NAVIGATE_PREVIOUS);
fSelectAllAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_SELECT_ALL);
}
代码示例来源:origin: org.eclipse/org.eclipse.ajdt.ui
protected void addActionToMenu(Menu parent, Action action, IProject project) {
String txt = action.getText();
if (txt.equals(UIMessages.changesView_ComparisonReference_last_full)) {
txt = ChangesView.REF_LAST_FULL;
} else if (txt.equals(UIMessages.changesView_ComparisonReference_last_inc)) {
txt = ChangesView.REF_LAST_INC;
}
action.setChecked(txt.equals(ChangesView.getReferencePoint(project)));
ActionContributionItem item= new ActionContributionItem(action);
item.fill(parent, -1);
}
内容来源于网络,如有侵权,请联系作者删除!