]> git.uio.no Git - ifi-stolz-refaktor.git/blobdiff - case-study/jdt-before/ui/org/eclipse/jdt/internal/ui/packageview/GotoRequiredProjectAction.java
Case Study: adding data and statistics
[ifi-stolz-refaktor.git] / case-study / jdt-before / ui / org / eclipse / jdt / internal / ui / packageview / GotoRequiredProjectAction.java
diff --git a/case-study/jdt-before/ui/org/eclipse/jdt/internal/ui/packageview/GotoRequiredProjectAction.java b/case-study/jdt-before/ui/org/eclipse/jdt/internal/ui/packageview/GotoRequiredProjectAction.java
new file mode 100644 (file)
index 0000000..55a15a9
--- /dev/null
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.internal.ui.packageview;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.viewers.IStructuredSelection;
+
+/**
+ * Goto to the referenced required project
+ */
+class GotoRequiredProjectAction extends Action {
+
+       private PackageExplorerPart fPackageExplorer;
+
+       GotoRequiredProjectAction(PackageExplorerPart part) {
+               super(PackagesMessages.GotoRequiredProjectAction_label);
+               setDescription(PackagesMessages.GotoRequiredProjectAction_description);
+               setToolTipText(PackagesMessages.GotoRequiredProjectAction_tooltip);
+               fPackageExplorer= part;
+       }
+
+       @Override
+       public void run() {
+               IStructuredSelection selection= (IStructuredSelection)fPackageExplorer.getSite().getSelectionProvider().getSelection();
+               Object element= selection.getFirstElement();
+               if (element instanceof ClassPathContainer.RequiredProjectWrapper) {
+                       ClassPathContainer.RequiredProjectWrapper wrapper= (ClassPathContainer.RequiredProjectWrapper) element;
+                       fPackageExplorer.tryToReveal(wrapper.getProject());
+               }
+       }
+}