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
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package org.eclipse.jdt.ui.actions;
13 import org.eclipse.ui.IWorkbenchSite;
14 import org.eclipse.ui.PlatformUI;
16 import org.eclipse.jdt.core.IField;
17 import org.eclipse.jdt.core.ILocalVariable;
18 import org.eclipse.jdt.core.search.IJavaSearchConstants;
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;
26 * Finds field write accesses of the selected element in the workspace.
27 * The action is applicable to selections representing a Java element.
30 * This class may be instantiated; it is not intended to be subclassed.
35 * @noextend This class is not intended to be subclassed by clients.
37 public class FindWriteReferencesAction extends FindReferencesAction {
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>.
44 * @param site the site providing context information for this action
46 public FindWriteReferencesAction(IWorkbenchSite site) {
51 * Note: This constructor is for internal use only. Clients should not call this constructor.
52 * @param editor the Java editor
54 * @noreference This constructor is not intended to be referenced by clients.
56 public FindWriteReferencesAction(JavaEditor editor) {
61 Class<?>[] getValidTypes() {
62 return new Class[] { IField.class, ILocalVariable.class };
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);
75 return IJavaSearchConstants.WRITE_ACCESSES;
79 String getOperationUnavailableMessage() {
80 return SearchMessages.JavaElementAction_operationUnavailable_field;