KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > terracotta > dso > actions > OpenConfigurationAction


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package org.terracotta.dso.actions;
5
6 import org.eclipse.core.resources.IProject;
7 import org.eclipse.jdt.core.IJavaProject;
8 import org.eclipse.jface.action.IAction;
9 import org.eclipse.jface.viewers.ISelection;
10 import org.eclipse.ui.IObjectActionDelegate;
11 import org.eclipse.ui.IWorkbenchPart;
12 import org.eclipse.ui.PartInitException;
13
14 import org.terracotta.dso.TcPlugin;
15
16 public class OpenConfigurationAction implements IObjectActionDelegate {
17   private IJavaProject m_currentProject;
18   
19   public OpenConfigurationAction() {
20     super();
21   }
22
23   public void setActivePart(IAction action, IWorkbenchPart targetPart) {/**/}
24
25   public void run(IAction action) {
26     try {
27       IProject project = m_currentProject.getProject();
28       
29       TcPlugin.getDefault().openConfigurationEditor(project);
30     } catch(PartInitException pie) {
31       pie.printStackTrace();
32     }
33   }
34
35   public void selectionChanged(IAction action, ISelection selection) {
36     m_currentProject = ActionUtil.locateSelectedJavaProject(selection);
37   }
38 }
39
Popular Tags