KickJava   Java API By Example, From Geeks To Geeks.

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


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

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

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

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

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

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