本文整理汇总了Java中org.eclipse.jface.action.Action类的典型用法代码示例。如果您正苦于以下问题:Java Action类的具体用法?Java Action怎么用?Java Action使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Action类属于org.eclipse.jface.action包,在下文中一共展示了Action类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initCopyPaste
import org.eclipse.jface.action.Action; //导入依赖的package包/类
/**
* Initialize copy paste by getting the clipboard and hooking
* the actions to global edit menu.
*
* @param viewer
*/
private void initCopyPaste(TreeViewer viewer) {
this.clipboard = new Clipboard(getSite().getShell().getDisplay());
IActionBars bars = getSite().getActionBars();
bars.setGlobalActionHandler(
ActionFactory.CUT.getId(),
(Action)outlineActions.get(ACTION_CUT));
bars.setGlobalActionHandler(
ActionFactory.COPY.getId(),
(Action)outlineActions.get(ACTION_COPY));
bars.setGlobalActionHandler(
ActionFactory.PASTE.getId(),
(Action)outlineActions.get(ACTION_PASTE));
bars.setGlobalActionHandler(
ActionFactory.DELETE.getId(),
(Action)outlineActions.get(ACTION_DELETE));
}
示例2: makeActions
import org.eclipse.jface.action.Action; //导入依赖的package包/类
private void makeActions() {
actionUpdate = new Action() {
@Override
public void run() {
updateComparison();
}
};
actionUpdate.setText("Update");
actionUpdate.setToolTipText(
"Recompute comparison for all API project and their implementation projects in the workspace.");
// action2.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().
// getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK));
actionOpenInEditor = new Action() {
@Override
public void run() {
ISelection selection = viewer.getSelection();
Object obj = ((IStructuredSelection) selection).getFirstElement();
if (obj instanceof ProjectComparisonEntry)
showInEditor((ProjectComparisonEntry) obj, true, true);
}
};
actionOpenInEditor.setText("Open in Editor");
actionOpenInEditor.setToolTipText(
"Open the currently selected API element and its implementations in N4JS editors.");
}
示例3: init
import org.eclipse.jface.action.Action; //导入依赖的package包/类
@Override
public void init ( final ICommonActionExtensionSite aSite )
{
super.init ( aSite );
final ICommonViewerSite viewSite = aSite.getViewSite ();
if ( viewSite instanceof ICommonViewerWorkbenchSite )
{
final ICommonViewerWorkbenchSite workbenchSite = (ICommonViewerWorkbenchSite)viewSite;
this.openAction = new Action ( "Open", IAction.AS_PUSH_BUTTON ) {
@Override
public void run ()
{
EditorHelper.handleOpen ( workbenchSite.getPage (), workbenchSite.getSelectionProvider () );
}
};
}
}
示例4: init
import org.eclipse.jface.action.Action; //导入依赖的package包/类
@Override
public void init ( final ICommonActionExtensionSite aSite )
{
super.init ( aSite );
final ICommonViewerSite viewSite = aSite.getViewSite ();
if ( viewSite instanceof ICommonViewerWorkbenchSite )
{
final ICommonViewerWorkbenchSite workbenchSite = (ICommonViewerWorkbenchSite)viewSite;
this.openAction = new Action ( "Open", IAction.AS_PUSH_BUTTON ) {
@Override
public void run ()
{
handleOpen ( workbenchSite );
}
};
}
}
示例5: BaseFolderImplementation
import org.eclipse.jface.action.Action; //导入依赖的package包/类
public BaseFolderImplementation ( final int index, final String label, final MenuManager mgr )
{
this.summaryInformation = new SummaryInformation ( Collections.<String, DataValue> emptyMap () );
this.index = index;
this.label = label;
this.mgr = mgr;
this.dumpAction = new Action ( "Dump summaries for: " + this.label ) {
@Override
public void run ()
{
BaseFolderImplementation.this.summaryInformation.dump ( System.out );
};
};
this.contribution = new ActionContributionItem ( this.dumpAction );
}
示例6: createPreferenceAction
import org.eclipse.jface.action.Action; //导入依赖的package包/类
private IAction createPreferenceAction(String label, String preference, String icon) {
IAction ret = new Action(label, IAction.AS_CHECK_BOX) {
@Override
public void run() {
Activator.getDefault().getPreferenceStore().setValue(preference, isChecked());
try {
viewer.reset();
} catch (Exception e) {
logger.error("Cannot refresh scannable viewer!", e);
}
}
};
ret.setImageDescriptor(Activator.getImageDescriptor(icon));
ret.setChecked(Activator.getDefault().getPreferenceStore().getBoolean(preference));
return ret;
}
示例7: createActions
import org.eclipse.jface.action.Action; //导入依赖的package包/类
/**
* Create the actions
*/
private void createActions() {
final IContributionManager man = getViewSite().getActionBars().getToolBarManager();
final Action restart = new Action("Clear", Activator.getImageDescriptor("icons/layers-stack.png")) {
@Override
public void run() {
clear();
}
};
man.add(restart);
final MenuManager menuMan = new MenuManager();
menuMan.add(restart);
text.setMenu(menuMan.createContextMenu(text));
}
示例8: addMenuBarItems
import org.eclipse.jface.action.Action; //导入依赖的package包/类
private void addMenuBarItems() {
IMenuManager menuManager = getViewSite().getActionBars().getMenuManager();
menuManager.add(new Action("highlight color") {
});
menuManager.add(new Action("Copy canvas to clipboard") {
@Override
public void run() {
// stackView.copyToClipBoard();
}
@Override
public boolean isEnabled() {
// return !stackView.isEmpty();
return false;
}
});
}
示例9: createActions
import org.eclipse.jface.action.Action; //导入依赖的package包/类
private void createActions(IToolBarManager manager) {
Action publishAction = new Action("Publish to DAWN marketplace", Action.AS_PUSH_BUTTON) {
@Override
public ImageDescriptor getImageDescriptor() {
return Activator.getImageDescriptor("icons/publish.png");
}
@Override
public void run() {
OverviewPage.this.getManagedForm().getMessageManager().removeAllMessages();
try {
scheduleExportJob();
} catch (IOException e) {
OverviewPage.this.getManagedForm().getMessageManager().addMessage(MPC, e.getMessage(), null,
IMessage.ERROR);
}
}
};
manager.add(publishAction);
manager.update(true);
}
示例10: createActions
import org.eclipse.jface.action.Action; //导入依赖的package包/类
private void createActions() {
newNodeAction = new NewNodeAction(this);
renameNodeAction = new RenameNodeAction(this);
deleteNodeAction = new DeleteNodeAction(this);
moveUpNodeAction = new MoveUpNodeAction(this);
moveDownNodeAction = new MoveDownNodeAction(this);
promoteNodeAction = new PromoteNodeAction(this);
demoteNodeAction = new DemoteNodeAction(this);
refreshAction = new Action() {
@Override
public void run() {
refresh();
}
};
refreshAction.setText(Messages.getString("CommonStructureControl.RefreshActionText")); //$NON-NLS-1$
refreshAction.setImageDescriptor(
AbstractUIPlugin.imageDescriptorFromPlugin(TFSCommonUIClientPlugin.PLUGIN_ID, "icons/Refresh.gif")); //$NON-NLS-1$
}
示例11: createAction
import org.eclipse.jface.action.Action; //导入依赖的package包/类
/**
* Creates a menu action for a team project when TFS 2012 teams are not
* available.
*/
private Action createAction(final ProjectInfo project) {
Check.notNull(project, "project"); //$NON-NLS-1$
final String projectGUID = project.getGUID();
final Action action = new Action(project.getName()) {
@Override
public void run() {
if (!context.getCurrentProjectInfo().getGUID().equals(projectGUID)) {
context.setCurrentProject(projectGUID);
context.setCurrentTeam(null);
final boolean tfvc = context.getCurrentProjectInfo().getSourceControlCapabilityFlags().contains(
SourceControlCapabilityFlags.TFS);
TFSCommonUIClientPlugin.getDefault().projectOrTeamChanged();
TFSCommonUIClientPlugin.getDefault().sourceControlChanged(tfvc);
}
}
};
if (context.getCurrentProjectInfo().getGUID().equals(projectGUID)) {
action.setChecked(true);
}
return action;
}
示例12: createActions
import org.eclipse.jface.action.Action; //导入依赖的package包/类
private void createActions() {
evaluateAction = new Action() {
@Override
public void run() {
evaluate();
}
};
evaluateAction.setText(Messages.getString("PolicyWarningsCheckinControl.EvaluateActionText")); //$NON-NLS-1$
helpAction = new Action() {
@Override
public void run() {
final PolicyFailureData policyFailure = policyFailureTable.getSelectedPolicyFailure();
if (policyFailure != null) {
policyFailure.displayHelp();
}
}
};
helpAction.setText(Messages.getString("PolicyWarningsCheckinControl.HelpActionText")); //$NON-NLS-1$
}
示例13: fillTableMenu
import org.eclipse.jface.action.Action; //导入依赖的package包/类
/**
* fill the popup menu for the table
*/
private void fillTableMenu(IMenuManager manager) {
manager.add(getRefreshAction());
Action action = getAddPropertyAction();
try {
if (resource != null)
action.setEnabled(resource.isManaged());
else
action.setEnabled(false);
} catch (SVNException e) {
action.setEnabled(false);
}
manager.add(action);
manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}
示例14: createTerminateAction
import org.eclipse.jface.action.Action; //导入依赖的package包/类
private Action createTerminateAction() {
Action terminate = new Action(Messages.getString("action.stop")) {
@Override
public void run() {
DeployJob job = console.getJob();
if (job != null) {
job.cancel();
update();
}
}
};
terminate.setToolTipText(Messages.getString("action.stop"));
terminate.setImageDescriptor(getSharedImage(ISharedImages.IMG_ELCL_STOP));
terminate.setHoverImageDescriptor(getSharedImage(ISharedImages.IMG_ELCL_STOP));
terminate.setDisabledImageDescriptor(getSharedImage(ISharedImages.IMG_ELCL_STOP_DISABLED));
return terminate;
}
示例15: configureToolBar
import org.eclipse.jface.action.Action; //导入依赖的package包/类
private void configureToolBar(IToolBarManager toolbarManager) {
terminateAction = new Action(Messages.actionStop) {
@Override
public void run() {
//code to execute when button is pressed
LocalAppEngineServerBehaviour serverBehaviour = console.getServerBehaviourDelegate();
if (serverBehaviour != null) {
// try to initiate a nice shutdown
boolean force = serverBehaviour.getServer().getServerState() == IServer.STATE_STOPPING;
serverBehaviour.stop(force);
}
update();
}
};
terminateAction.setToolTipText(Messages.actionStopToolTip);
terminateAction.setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_ELCL_STOP));
terminateAction.setHoverImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_CLCL_STOP));
terminateAction.setDisabledImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_DLCL_STOP));
toolbarManager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, terminateAction);
}
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:22,代码来源:LocalAppEngineConsolePageParticipant.java