KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > ui > packageview > GotoRequiredProjectAction


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.internal.ui.packageview;
12
13 import org.eclipse.jface.action.Action;
14 import org.eclipse.jface.viewers.IStructuredSelection;
15
16 /**
17  * Goto to the referenced required project
18  */

19 class GotoRequiredProjectAction extends Action {
20     
21     private PackageExplorerPart fPackageExplorer;
22     
23     GotoRequiredProjectAction(PackageExplorerPart part) {
24         super(PackagesMessages.GotoRequiredProjectAction_label);
25         setDescription(PackagesMessages.GotoRequiredProjectAction_description);
26         setToolTipText(PackagesMessages.GotoRequiredProjectAction_tooltip);
27         fPackageExplorer= part;
28     }
29  
30     public void run() {
31         IStructuredSelection selection= (IStructuredSelection)fPackageExplorer.getSite().getSelectionProvider().getSelection();
32         Object JavaDoc element= selection.getFirstElement();
33         if (element instanceof ClassPathContainer.RequiredProjectWrapper) {
34             ClassPathContainer.RequiredProjectWrapper wrapper= (ClassPathContainer.RequiredProjectWrapper) element;
35             fPackageExplorer.tryToReveal(wrapper.getProject());
36         }
37     }
38 }
39
Popular Tags