Show CheckAsFitProjectAction.java syntax highlighted
package ca.ucalgary.cpsc.ebe.fitClipse.actions;
import org.eclipse.core.internal.resources.Project;
import org.eclipse.core.resources.IProject;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IActionDelegate;
import org.eclipse.ui.PlatformUI;
import ca.ucalgary.cpsc.ebe.fitClipse.ui.wizards.CheckAsFitProjectWizard;
public class CheckAsFitProjectAction implements IActionDelegate{
ISelection selection = null;
IStructuredSelection ss = null;
Shell shell=null;
public void run(IAction action) {
if(selection instanceof IStructuredSelection){
ss = (IStructuredSelection)selection;
if(ss.getFirstElement().getClass() == Project.class){
IProject project = (IProject)(ss.getFirstElement());
System.out.println("project is: "+project.toString());
checkAsFitProject(project);
}
}
}
private void checkAsFitProject(IProject project) {
System.out.println("this is check project");
CheckAsFitProjectWizard fitProjectWizard = new CheckAsFitProjectWizard();
fitProjectWizard.init(PlatformUI.getWorkbench(), ss);
shell= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
try{
WizardDialog dialog= new WizardDialog(shell, fitProjectWizard);
dialog.create();
dialog.open();
}catch (Exception e){
e.printStackTrace();
}
}
public void selectionChanged(IAction action, ISelection selection) {
this.selection = selection;
}
}
See more files for this project here