KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > ui > actions > FindReadReferencesAction


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 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
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.ui.actions;
12
13 import org.eclipse.ui.IWorkbenchSite;
14 import org.eclipse.ui.PlatformUI;
15
16 import org.eclipse.jdt.core.IField;
17 import org.eclipse.jdt.core.ILocalVariable;
18 import org.eclipse.jdt.core.search.IJavaSearchConstants;
19
20 import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
21 import org.eclipse.jdt.internal.ui.JavaPluginImages;
22 import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor;
23 import org.eclipse.jdt.internal.ui.search.SearchMessages;
24
25 /**
26  * Finds field read accesses of the selected element in the workspace.
27  * The action is applicable to selections representing a Java interface field.
28  * <p>
29  * This class may be instantiated; it is not intended to be subclassed.
30  * </p>
31  *
32  * @since 2.0
33  */

34 public class FindReadReferencesAction extends FindReferencesAction {
35
36     /**
37      * Creates a new <code>FindReadReferencesAction</code>. The action
38      * requires that the selection provided by the site's selection provider is of type
39      * <code>org.eclipse.jface.viewers.IStructuredSelection</code>.
40      *
41      * @param site the site providing context information for this action
42      */

43     public FindReadReferencesAction(IWorkbenchSite site) {
44         super(site);
45     }
46
47     /**
48      * Note: This constructor is for internal use only. Clients should not call this constructor.
49      * @param editor the Java editor
50      */

51     public FindReadReferencesAction(JavaEditor editor) {
52         super(editor);
53     }
54     
55     Class JavaDoc[] getValidTypes() {
56         return new Class JavaDoc[] { IField.class, ILocalVariable.class };
57     }
58
59     void init() {
60         setText(SearchMessages.Search_FindReadReferencesAction_label);
61         setToolTipText(SearchMessages.Search_FindReadReferencesAction_tooltip);
62         setImageDescriptor(JavaPluginImages.DESC_OBJS_SEARCH_REF);
63         PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.FIND_READ_REFERENCES_IN_WORKSPACE_ACTION);
64     }
65     
66     int getLimitTo() {
67         return IJavaSearchConstants.READ_ACCESSES;
68     }
69
70     String JavaDoc getOperationUnavailableMessage() {
71         return SearchMessages.JavaElementAction_operationUnavailable_field;
72     }
73 }
74
Popular Tags