本文整理汇总了Java中org.eclipse.jface.action.Action.setEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java Action.setEnabled方法的具体用法?Java Action.setEnabled怎么用?Java Action.setEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.action.Action
的用法示例。
在下文中一共展示了Action.setEnabled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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));
}
示例2: disconnect
import org.eclipse.jface.action.Action; //导入方法依赖的package包/类
@Override
public void disconnect() {
synchronized (this) {
if (!isDisconnecting) {
isDisconnecting = true;
try {
if (isConnected()) {
super.disconnect();
}
connectAction.setEnabled(true);
if (autoConnectAction != null) {
autoConnectAction.setEnabled(true);
}
for (Action action : onlyEnabledOnConnectActions) {
action.setEnabled(false);
}
} finally {
isDisconnecting = false;
}
}
}
}
示例3: addProblemActions
import org.eclipse.jface.action.Action; //导入方法依赖的package包/类
protected void addProblemActions(MenuManager problemMenu) {
for (int i = 0; i < PROBLEM_ACTIONS.length; i++) {
if (PROBLEM_ACTIONS[i][0].equals("separator")) {
problemMenu.add(new Separator());
} else {
final String action = PROBLEM_ACTIONS[i][1];
Action problemAction = new Action(PROBLEM_ACTIONS[i][0]) {
public void run() {
sendMessage(action);
}
};
problemAction.setEnabled(false);
onlyEnabledOnConnectActions.add(problemAction);
problemMenu.add(problemAction);
}
}
}
示例4: fillTreeViewerContextMenu
import org.eclipse.jface.action.Action; //导入方法依赖的package包/类
private void fillTreeViewerContextMenu(IMenuManager mgr){
ISelection selection = viewer.getSelection();
if (selection instanceof IStructuredSelection) {
IStructuredSelection sel = (IStructuredSelection)selection;
Object[] elements = sel.toArray();
if (elements == null || elements.length < 1) {
return;
}
Action action = new DeleteAction(elements);
for (Object obj : elements) {
try {
DirObject dirObj = (DirObject) obj;
if (dirObj.name.contains("00000000")) {
action.setEnabled(false);
break;
}
} catch (Exception e) { }
}
mgr.add(action);
}
}
示例5: createActions
import org.eclipse.jface.action.Action; //导入方法依赖的package包/类
/**
* Creates the JFace {@code Action}s used to add or remove rows to or from
* the {@link #tableComponent}.
*/
private void createActions() {
// Create the add action. It will add a new, default row.
addRowAction = new Action("+", IAction.AS_PUSH_BUTTON) {
@Override
public void run() {
tableComponent.addRow();
}
};
addRowAction.setToolTipText("Adds a new, default row.");
// Create the remove action. It will remove all rows selected in the
// TableViewer from the TableComponent.
removeRowAction = new Action("-", IAction.AS_PUSH_BUTTON) {
@Override
public void run() {
// The action should only be run once.
setEnabled(false);
// Delete all selected rows from the TableComponent.
for (int i = selectedIndices.size() - 1; i >= 0; i--) {
tableComponent.deleteRow(selectedIndices.get(i));
}
selectedIndices.clear();
// Make sure the model knows there is no selection.
tableComponent.setSelectedRows(new ArrayList<Integer>());
}
};
removeRowAction.setToolTipText("Removes all selected rows.");
removeRowAction.setEnabled(false);
return;
}
示例6: configureMenuManager
import org.eclipse.jface.action.Action; //导入方法依赖的package包/类
/**
* Create the ZAP view menu dropdown. This is only enabled when the plugin
* is properly configured, the ZAP server is running, and a scan is not
* currently processing.
*
* @param enableMenu
* A boolean determining if the menu should be enabled or not.
* The menu is enabled when set to true, disabled when set to
* false.
*/
private void configureMenuManager(boolean enableMenu) {
IMenuManager menuManager = getViewSite().getActionBars().getMenuManager();
menuManager.setVisible(true);
if (enableMenu) {
menuManager.removeAll();
MenuManager spiderMenu = new MenuManager("ZAP Spider Configuration");
spiderMenu.add(new ParseCommentsToggle());
spiderMenu.add(new ParseGitToggle());
spiderMenu.add(new ParseRobotsTxtToggle());
spiderMenu.add(new ParseSvnEntriesToggle());
spiderMenu.add(new ParseSitemapXmlToggle());
spiderMenu.add(new PostFormToggle());
spiderMenu.add(new ProcessFormToggle());
spiderMenu.add(new SendRefererHeaderToggle());
menuManager.add(spiderMenu);
menuManager.add(new Separator());
MenuManager ascanMenu = new MenuManager("ZAP Ascan Configuration");
ascanMenu.add(new AllowAttackOnStartToggle());
ascanMenu.add(new HandleAntiCSRFTokensToggle());
ascanMenu.add(new InjectPluginIdInHeaderToggle());
ascanMenu.add(new RescanInAttackModeToggle());
menuManager.add(ascanMenu);
} else {
menuManager.removeAll();
Action noConfigurationAction = new Action("Configuration Unavailabile") {
};
noConfigurationAction.setEnabled(false);
menuManager.add(noConfigurationAction);
}
}
示例7: connect
import org.eclipse.jface.action.Action; //导入方法依赖的package包/类
@Override
protected void connect(final String profileName) {
if (actions != null && actions.isEmpty()) {
// Don't do this for fics2, or if menu's been created before.
createFicsMenuActions();
}
synchronized (this) {
if (!isConnected()) {
for (Action action : onlyEnabledOnConnectActions) {
action.setEnabled(true);
}
connectAction.setEnabled(false);
if (autoConnectAction != null) {
autoConnectAction.setChecked(getPreferences().getBoolean(
context.getPreferencePrefix() + "auto-connect"));
autoConnectAction.setEnabled(true);
}
super.connect(profileName);
if (isConnecting) {
if (getPreferences().getBoolean(
context.getPreferencePrefix()
+ "show-bugbuttons-on-connect")) {
Raptor.getInstance()
.getWindow()
.addRaptorWindowItem(
new BugButtonsWindowItem(this));
}
}
}
}
}
示例8: enableGraphAction
import org.eclipse.jface.action.Action; //导入方法依赖的package包/类
public void enableGraphAction(final int graphId, final boolean isEnabled) {
if (_allTourChartActions == null) {
return;
}
final Action action = _allTourChartActions.get(getGraphActionId(graphId));
if (action != null) {
action.setEnabled(isEnabled);
}
}
示例9: enableZoomOptions
import org.eclipse.jface.action.Action; //导入方法依赖的package包/类
private void enableZoomOptions() {
if (_allTourChartActions == null) {
return;
}
final boolean canAutoZoom = getMouseMode().equals(Chart.MOUSE_MODE_ZOOM);
final Action action = _allTourChartActions.get(ACTION_ID_CAN_MOVE_SLIDERS_WHEN_ZOOMED);
if (action != null) {
action.setEnabled(canAutoZoom);
}
}
示例10: setActionEnabled
import org.eclipse.jface.action.Action; //导入方法依赖的package包/类
/**
* Set the enable state for a command and update the UI
*/
public void setActionEnabled(final String commandId, final boolean isEnabled) {
final Action action = _allTourChartActions.get(commandId);
if (action != null) {
action.setEnabled(isEnabled);
}
}
示例11: setActionState
import org.eclipse.jface.action.Action; //导入方法依赖的package包/类
/**
* Set the enable/check state for a command and update the UI
*/
public void setActionState(final String commandId, final boolean isEnabled, final boolean isChecked) {
final Action action = _allTourChartActions.get(commandId);
if (action != null) {
action.setEnabled(isEnabled);
action.setChecked(isChecked);
}
}
示例12: updateChart
import org.eclipse.jface.action.Action; //导入方法依赖的package包/类
@Override
public void updateChart(final ChartDataModel chartDataModel, final boolean isShowAllData) {
super.updateChart(chartDataModel, isShowAllData);
if (chartDataModel == null) {
_tourData = null;
_tcc = null;
_valuePointTooltip.setTourData(null);
// disable all actions
if (_allTourChartActions != null) {
for (final Action action : _allTourChartActions.values()) {
action.setEnabled(false);
}
}
if (_actionTourInfo != null) {
_actionTourInfo.setEnabled(false);
}
if (_actionTourMarker != null) {
_actionTourMarker.setEnabled(false);
}
}
}
示例13: disableAllActions
import org.eclipse.jface.action.Action; //导入方法依赖的package包/类
/**
* disable all actions
*/
private void disableAllActions() {
if (_allChartActions != null) {
for (final Action action : _allChartActions.values()) {
action.setEnabled(false);
}
}
}
示例14: VizActionTree
import org.eclipse.jface.action.Action; //导入方法依赖的package包/类
/**
* ActionTree constructor for <b>parent</b> tree nodes that will get a menu.
* These nodes should have child ActionTrees added via the function
*
* @param text
* The text displayed by the Action's IContributionItem. This
* will be seen on the MenuItem or ToolItem.
*/
public VizActionTree(String text) {
// Set the text.
this.text = text;
// Define a new JFace Action that will open a Menu for this node. The
// Menu will show items for the children of this node.
action = new Action(this.text, IAction.AS_DROP_DOWN_MENU) {
@Override
public void run() {
// This method only appears to be run when the action
// corresponds to a ToolItem.
// TODO Have the menu appear in the correct location below the
// button.
// ToolItem toolItem = null;
// Menu menu = null;
// TODO How do we get the Action's ToolItem?
// TODO How do we get the Action's Menu?
// getMenuCreator().getMenu(Control parent);
//
// Rectangle r = toolItem.getBounds();
// Point p = new Point(r.x, r.y + r.height);
// p = toolItem.getParent().toDisplay(p.x, p.y);
// menu.setLocation(p.x, p.y);
// menu.setVisible(true);
}
};
action.setEnabled(false);
// Initialize the list of children.
children = new ArrayList<VizActionTree>();
// Initialize and set the IMenuCreator that will build the menu.
menuCreator = new MenuCreator();
action.setMenuCreator(menuCreator);
// Default to being enabled as soon as possible.
enabled = true;
return;
}
示例15: createDefaultAction
import org.eclipse.jface.action.Action; //导入方法依赖的package包/类
private void createDefaultAction(final TagMenuManager tagMenuMgr) {
_tagMenuMgr = tagMenuMgr;
_actionAddTagTitle = new Action(Messages.Action_Tag_Add_AutoOpen_Title) {};
_actionAddTagTitle.setEnabled(false);
_actionRecentTagsTitle = new Action(Messages.Action_Tag_Add_RecentTags) {};
_actionRecentTagsTitle.setEnabled(false);
_actionOK = new ActionOK();
_actionOpenTagPrefs = new ActionOpenPrefDialog(Messages.action_tag_open_tagging_structure, PrefPageTags.ID);
}