KickJava   Java API By Example, From Geeks To Geeks.

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


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.JavaPluginImages;
21 import org.eclipse.jdt.internal.ui.search.SearchMessages;
22 import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
23 import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor;
24
25 /**
26  * Finds field write accesses of the selected element in its hierarchy.
27  * The action is applicable to selections representing a Java field.
28  *
29  * <p>
30  * This class may be instantiated; it is not intended to be subclassed.
31  * </p>
32  *
33  * @since 2.0
34  */

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

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

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