]>
Commit | Line | Data |
---|---|---|
1b2798f6 EK |
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 | |
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 write accesses of the selected element in the workspace. | |
27 | * The action is applicable to selections representing a Java element. | |
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 | * @noextend This class is not intended to be subclassed by clients. | |
36 | */ | |
37 | public class FindWriteReferencesAction extends FindReferencesAction { | |
38 | ||
39 | /** | |
40 | * Creates a new <code>FindWriteReferencesAction</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>. | |
43 | * | |
44 | * @param site the site providing context information for this action | |
45 | */ | |
46 | public FindWriteReferencesAction(IWorkbenchSite site) { | |
47 | super(site); | |
48 | } | |
49 | ||
50 | /** | |
51 | * Note: This constructor is for internal use only. Clients should not call this constructor. | |
52 | * @param editor the Java editor | |
53 | * | |
54 | * @noreference This constructor is not intended to be referenced by clients. | |
55 | */ | |
56 | public FindWriteReferencesAction(JavaEditor editor) { | |
57 | super(editor); | |
58 | } | |
59 | ||
60 | @Override | |
61 | Class<?>[] getValidTypes() { | |
62 | return new Class[] { IField.class, ILocalVariable.class }; | |
63 | } | |
64 | ||
65 | @Override | |
66 | void init() { | |
67 | setText(SearchMessages.Search_FindWriteReferencesAction_label); | |
68 | setToolTipText(SearchMessages.Search_FindWriteReferencesAction_tooltip); | |
69 | setImageDescriptor(JavaPluginImages.DESC_OBJS_SEARCH_REF); | |
70 | PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.FIND_WRITE_REFERENCES_IN_WORKSPACE_ACTION); | |
71 | } | |
72 | ||
73 | @Override | |
74 | int getLimitTo() { | |
75 | return IJavaSearchConstants.WRITE_ACCESSES; | |
76 | } | |
77 | ||
78 | @Override | |
79 | String getOperationUnavailableMessage() { | |
80 | return SearchMessages.JavaElementAction_operationUnavailable_field; | |
81 | } | |
82 | } |