1 /*******************************************************************************
2 * Copyright (c) 2000, 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 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package org.eclipse.jdt.ui.actions;
13 import org.eclipse.ui.IWorkbenchSite;
14 import org.eclipse.ui.IWorkingSet;
15 import org.eclipse.ui.PlatformUI;
17 import org.eclipse.jdt.core.IField;
18 import org.eclipse.jdt.core.ILocalVariable;
19 import org.eclipse.jdt.core.search.IJavaSearchConstants;
21 import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
22 import org.eclipse.jdt.internal.ui.JavaPluginImages;
23 import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor;
24 import org.eclipse.jdt.internal.ui.search.SearchMessages;
27 * Finds field read accesses of the selected element in working sets.
28 * The action is applicable to selections representing a Java field.
31 * This class may be instantiated; it is not intended to be subclassed.
36 * @noextend This class is not intended to be subclassed by clients.
38 public class FindReadReferencesInWorkingSetAction extends FindReferencesInWorkingSetAction {
41 * Creates a new <code>FindReadReferencesInWorkingSetAction</code>. The action
42 * requires that the selection provided by the site's selection provider is of type
43 * <code>org.eclipse.jface.viewers.IStructuredSelection</code>. The user will be
44 * prompted to select the working sets.
46 * @param site the site providing context information for this action
48 public FindReadReferencesInWorkingSetAction(IWorkbenchSite site) {
53 * Creates a new <code>FindReadReferencesInWorkingSetAction</code>. The action
54 * requires that the selection provided by the site's selection provider is of type
55 * <code>org.eclipse.jface.viewers.IStructuredSelection</code>.
57 * @param site the site providing context information for this action
58 * @param workingSets the working sets to be used in the search
60 public FindReadReferencesInWorkingSetAction(IWorkbenchSite site, IWorkingSet[] workingSets) {
61 super(site, workingSets);
65 * Note: This constructor is for internal use only. Clients should not call this constructor.
66 * @param editor the Java editor
68 * @noreference This constructor is not intended to be referenced by clients.
70 public FindReadReferencesInWorkingSetAction(JavaEditor editor) {
75 * Note: This constructor is for internal use only. Clients should not call this constructor.
76 * @param editor the Java editor
77 * @param workingSets the working sets to be used in the search
79 * @noreference This constructor is not intended to be referenced by clients.
81 public FindReadReferencesInWorkingSetAction(JavaEditor editor, IWorkingSet[] workingSets) {
82 super(editor, workingSets);
86 Class<?>[] getValidTypes() {
87 return new Class[] { IField.class, ILocalVariable.class };
92 setText(SearchMessages.Search_FindReadReferencesInWorkingSetAction_label);
93 setToolTipText(SearchMessages.Search_FindReadReferencesInWorkingSetAction_tooltip);
94 setImageDescriptor(JavaPluginImages.DESC_OBJS_SEARCH_REF);
95 PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.FIND_READ_REFERENCES_IN_WORKING_SET_ACTION);
100 return IJavaSearchConstants.READ_ACCESSES;
104 String getOperationUnavailableMessage() {
105 return SearchMessages.JavaElementAction_operationUnavailable_field;