KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > ui > infoviews > GotoInputAction


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 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.internal.ui.infoviews;
12
13 import org.eclipse.core.runtime.Assert;
14
15 import org.eclipse.jface.action.Action;
16
17 import org.eclipse.ui.PlatformUI;
18
19 import org.eclipse.jdt.core.IJavaElement;
20
21 import org.eclipse.jdt.ui.actions.OpenAction;
22
23 import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
24 import org.eclipse.jdt.internal.ui.JavaPluginImages;
25
26 class GotoInputAction extends Action {
27
28     private AbstractInfoView fInfoView;
29
30     public GotoInputAction(AbstractInfoView infoView) {
31         Assert.isNotNull(infoView);
32         fInfoView= infoView;
33
34         JavaPluginImages.setLocalImageDescriptors(this, "goto_input.gif"); //$NON-NLS-1$
35
setText(InfoViewMessages.GotoInputAction_label);
36         setToolTipText(InfoViewMessages.GotoInputAction_tooltip);
37         setDescription(InfoViewMessages.GotoInputAction_description);
38
39         PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.OPEN_INPUT_ACTION);
40     }
41
42     public void run() {
43         IJavaElement inputElement= fInfoView.getInput();
44         new OpenAction(fInfoView.getViewSite()).run(new Object JavaDoc[] { inputElement });
45     }
46 }
47
Popular Tags