if (project != null) {
if (MessageDialog.openConfirm(shell, "Confirm action", "Processing project: " + project.getName() + "\n\n" + "Please save changes before and check that no compiler errors exist.")) {
try {
IJavaProject javaProject = JavaCore.create(project);
MethodSearch methodSearcher = new MethodSearch(javaProject);
IRunnableWithProgress op = methodSearcher;
ProgressMonitorDialog progressDialog = new ProgressMonitorDialog(shell);
progressDialog.run(true, true, op);
// output format?
MessageDialog formatDialog = new MessageDialog(shell, "Output Format", null, "What kind of output do you want?", 0, new String[] { "cancel", "Comments", "Text File", }, 1);
formatDialog.open();
if (formatDialog.getReturnCode() == 2) {
// text file
InputDialog inputDialog = new InputDialog(shell, "Output text file", "Where do you want to save the file?", "file path including name", null);
inputDialog.open();
if (inputDialog.getReturnCode() == Window.OK) {
String path = inputDialog.getValue();
while (path == null || path.length() == 0) {
inputDialog.open();
inputDialog.setErrorMessage("Wrong Input");
path = inputDialog.getValue();
}
methodSearcher.writePossiblyUnusedMethodsToFile(new File(path));
}
} else if (formatDialog.getReturnCode() == 1) {
// comments
if (!methodSearcher.setComments()) {
throw new InterruptedException();
}
}
} catch (InvocationTargetException e) {
StackTraceElement[] stackTraces = e.getStackTrace();