1 21 22 package org.apache.derby.ui.actions; 23 24 25 import org.apache.derby.ui.DerbyPlugin; 26 import org.apache.derby.ui.common.CommonNames; 27 import org.apache.derby.ui.common.Messages; 28 import org.apache.derby.ui.util.DerbyUtils; 29 import org.eclipse.core.resources.IProject; 30 import org.eclipse.core.runtime.CoreException; 31 import org.eclipse.jdt.core.IJavaProject; 32 import org.eclipse.jface.action.IAction; 33 import org.eclipse.jface.dialogs.MessageDialog; 34 import org.eclipse.jface.viewers.ISelection; 35 import org.eclipse.swt.widgets.Shell; 36 import org.eclipse.ui.IActionDelegate; 37 import org.eclipse.ui.IObjectActionDelegate; 38 import org.eclipse.ui.IWorkbenchPart; 39 40 41 public class SysInfoAction implements IObjectActionDelegate { 42 43 private IJavaProject currentJavaProject; 44 private IProject currentProject; 45 48 public SysInfoAction() { 49 super(); 50 } 51 52 55 public void setActivePart(IAction action, IWorkbenchPart targetPart) { 56 } 57 58 61 public void run(IAction action) { 62 Shell shell = new Shell(); 63 DerbyPlugin plugin = DerbyPlugin.getDefault(); 64 if (plugin== null) { 65 MessageDialog.openInformation(shell, 66 CommonNames.PLUGIN_NAME, 67 Messages.NO_ACTION); 68 } 69 else { 70 try { 71 if(currentJavaProject!=null){ 72 DerbyUtils.runSysInfo(currentJavaProject.getProject()); 73 }else{ 74 DerbyUtils.runSysInfo(currentProject); 75 } 76 77 } 78 catch (CoreException ce) { 79 ce.printStackTrace(System.err); 80 }catch(Exception e){ 81 e.printStackTrace(); 82 } 83 } 84 } 85 86 89 public void selectionChanged(IAction action, ISelection selection) { 90 currentJavaProject = org.apache.derby.ui.util.SelectionUtil.findSelectedJavaProject(selection); 91 if(currentJavaProject==null){ 92 currentProject=org.apache.derby.ui.util.SelectionUtil.findSelectedProject(selection); 93 } 94 } 95 96 } 97 | Popular Tags |