1 /*******************************************************************************
2 * Copyright (c) 2008, 2011 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
9 * Stephan Herrmann (stephan@cs.tu-berlin.de):
10 * - bug 206949: [call hierarchy] filter field accesses (only write or only read)
11 *******************************************************************************/
12 package org.eclipse.jdt.internal.ui.callhierarchy;
14 import org.eclipse.core.runtime.Assert;
16 import org.eclipse.jface.action.Action;
18 import org.eclipse.jdt.core.search.IJavaSearchConstants;
21 * Toggles how fields should be expanded: all references, read accesses, write accesses.
23 public class SelectFieldModeAction extends Action {
25 private CallHierarchyViewPart fView;
28 public SelectFieldModeAction(CallHierarchyViewPart v, int mode) {
29 super(null, AS_RADIO_BUTTON);
30 if (mode == IJavaSearchConstants.REFERENCES) {
31 setText(CallHierarchyMessages.SelectFieldModeAction_all_references_label);
32 setDescription(CallHierarchyMessages.SelectFieldModeAction_all_references_description);
33 } else if (mode == IJavaSearchConstants.READ_ACCESSES) {
34 setText(CallHierarchyMessages.SelectFieldModeAction_read_accesses_label);
35 setDescription(CallHierarchyMessages.SelectFieldModeAction_read_accesses_description);
36 } else if (mode == IJavaSearchConstants.WRITE_ACCESSES) {
37 setText(CallHierarchyMessages.SelectFieldModeAction_write_accesses_label);
38 setDescription(CallHierarchyMessages.SelectFieldModeAction_write_accesses_description);
44 // FIXME(stephan) adjust/create new help context
45 // PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.CALL_HIERARCHY_TOGGLE_CALL_MODE_ACTION);
48 public int getMode() {
53 * @see Action#actionPerformed
57 fView.setFieldMode(fMode); // will toggle the checked state