private boolean shouldVerify() { if (VerifyJob.isRunning()) { new MessageDialog( getShell(), "Program being verified.", null, "Only one program can be verified at a time.", MessageDialog.ERROR, new String[] {"OK"}, 0) .open(); return false; } if (!editor.isDirty()) return true; MessageDialog dialog = new MessageDialog( getShell(), "Save Changes?", null, "Before the program can be verified changes made to the configuration must first be saved.", MessageDialog.ERROR, new String[] { "&Save New Properties and Verify", "&Revert to Old Properties and Verify", "&Cancel" }, 2); int option = dialog.open(); if (option == 0) editor.saveProperties(); else if (option == 1) editor.revertProperties(); else return false; return true; }
/** Handles the verify action. Checks whether is can be done or not. */ private void handleVerify(boolean step) { if (!shouldVerify()) return; TreeSelection s = ((TreeSelection) (fileTree.getSelection())); TreeProject p = (TreeProject) s.getPaths()[0].getFirstSegment(); Object o = s.getFirstElement(); if (!(o instanceof IFile)) return; VerifyJob.verify((IFile) o, p.java_project, step); close(); }