]> git.uio.no Git - ifi-stolz-refaktor.git/blob - case-study/jdt-after/ui/org/eclipse/jdt/ui/actions/OpenImplementationAction.java
Case Study: adding data and statistics
[ifi-stolz-refaktor.git] / case-study / jdt-after / ui / org / eclipse / jdt / ui / actions / OpenImplementationAction.java
1 /*******************************************************************************
2  * Copyright (c) 2009, 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.jface.viewers.IStructuredSelection;
14
15 import org.eclipse.jface.text.ITextSelection;
16
17 import org.eclipse.ui.IWorkbenchSite;
18 import org.eclipse.ui.PlatformUI;
19
20 import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
21 import org.eclipse.jdt.internal.ui.actions.ActionMessages;
22 import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor;
23
24
25 /**
26  * The action allows to open the implementation for a method in its hierarchy.
27  * <p>
28  * The action is applicable to selections containing elements of type <code>
29  * IMethod</code>.
30  * </p>
31  * 
32  * @since 3.6
33  * @noextend This class is not intended to be subclassed by clients.
34  */
35 public class OpenImplementationAction extends SelectionDispatchAction {
36
37         /**
38          * The Java editor.
39          */
40         public JavaEditor fEditor;
41
42
43         /**
44          * Creates an <code>OpenImplementationAction</code>.
45          * 
46          * @param site the workbench site
47          */
48         protected OpenImplementationAction(IWorkbenchSite site) {
49                 super(site);
50                 setText(ActionMessages.OpenImplementationAction_label);
51                 setDescription(ActionMessages.OpenImplementationAction_description);
52                 setToolTipText(ActionMessages.OpenImplementationAction_tooltip);
53                 PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.OPEN_IMPLEMENTATION_ACTION);
54         }
55
56         /**
57          * Creates an <code>OpenImplementationAction</code>. Note: This constructor is for internal use
58          * only. Clients should not call this constructor.
59          * 
60          * @param editor the editor
61          * @noreference This constructor is not intended to be referenced by clients.
62          */
63         public OpenImplementationAction(JavaEditor editor) {
64                 this(editor.getEditorSite());
65                 fEditor= editor;
66                 fEditor.generated_2044915647447833346(this);
67         }
68
69         /*
70          * @see org.eclipse.jdt.ui.actions.SelectionDispatchAction#selectionChanged(org.eclipse.jface.text.ITextSelection)
71          */
72         @Override
73         public void selectionChanged(ITextSelection selection) {
74         }
75
76         /*
77          * @see org.eclipse.jdt.ui.actions.SelectionDispatchAction#selectionChanged(org.eclipse.jface.viewers.IStructuredSelection)
78          */
79         @Override
80         public void selectionChanged(IStructuredSelection selection) {
81                 setEnabled(false);
82         }
83
84         /*
85          * @see org.eclipse.jdt.ui.actions.SelectionDispatchAction#run(org.eclipse.jface.text.ITextSelection)
86          */
87         @Override
88         public void run(ITextSelection selection) {
89                 fEditor.generated_4148697551160775241(this, selection);
90
91         }
92
93         /**
94          * Returns the dialog title.
95          * 
96          * @return the dialog title
97          */
98         public String getDialogTitle() {
99                 return ActionMessages.OpenImplementationAction_error_title;
100         }
101 }