KickJava   Java API By Example, From Geeks To Geeks.

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


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.IWorkingSet;
15 import org.eclipse.ui.PlatformUI;
16
17 import org.eclipse.jdt.core.IField;
18 import org.eclipse.jdt.core.ILocalVariable;
19 import org.eclipse.jdt.core.search.IJavaSearchConstants;
20
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;
25
26 /**
27  * Finds field read accesses of the selected element in working sets.
28  * The action is applicable to selections representing a Java field.
29  *
30  * <p>
31  * This class may be instantiated; it is not intended to be subclassed.
32  * </p>
33  *
34  * @since 2.0
35  */

36 public class FindReadReferencesInWorkingSetAction extends FindReferencesInWorkingSetAction {
37
38     /**
39      * Creates a new <code>FindReadReferencesInWorkingSetAction</code>. The action
40      * requires that the selection provided by the site's selection provider is of type
41      * <code>org.eclipse.jface.viewers.IStructuredSelection</code>. The user will be
42      * prompted to select the working sets.
43      *
44      * @param site the site providing context information for this action
45      */

46     public FindReadReferencesInWorkingSetAction(IWorkbenchSite site) {
47         super(site);
48     }
49
50     /**
51      * Creates a new <code>FindReadReferencesInWorkingSetAction</code>. The action
52      * requires that the selection provided by the site's selection provider is of type
53      * <code>org.eclipse.jface.viewers.IStructuredSelection</code>.
54      *
55      * @param site the site providing context information for this action
56      * @param workingSets the working sets to be used in the search
57      */

58     public FindReadReferencesInWorkingSetAction(IWorkbenchSite site, IWorkingSet[] workingSets) {
59         super(site, workingSets);
60     }
61
62     /**
63      * Note: This constructor is for internal use only. Clients should not call this constructor.
64      * @param editor the Java editor
65      */

66     public FindReadReferencesInWorkingSetAction(JavaEditor editor) {
67         super(editor);
68     }
69
70     /**
71      * Note: This constructor is for internal use only. Clients should not call this constructor.
72      * @param editor the Java editor
73      * @param workingSets the working sets to be used in the search
74      */

75     public FindReadReferencesInWorkingSetAction(JavaEditor editor, IWorkingSet[] workingSets) {
76         super(editor, workingSets);
77     }
78     
79     Class JavaDoc[] getValidTypes() {
80         return new Class JavaDoc[] { IField.class, ILocalVariable.class };
81     }
82     
83     void init() {
84         setText(SearchMessages.Search_FindReadReferencesInWorkingSetAction_label);
85         setToolTipText(SearchMessages.Search_FindReadReferencesInWorkingSetAction_tooltip);
86         setImageDescriptor(JavaPluginImages.DESC_OBJS_SEARCH_REF);
87         PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.FIND_READ_REFERENCES_IN_WORKING_SET_ACTION);
88     }
89
90     int getLimitTo() {
91         return IJavaSearchConstants.READ_ACCESSES;
92     }
93
94     String JavaDoc getOperationUnavailableMessage() {
95         return SearchMessages.JavaElementAction_operationUnavailable_field;
96     }
97 }
98
Popular Tags