New GhidraDev.

This commit is contained in:
Ryan Kurtz 2019-06-17 14:23:36 -04:00
parent a004012c9a
commit dcad9f3272
8 changed files with 97 additions and 49 deletions

View file

@ -76,9 +76,9 @@ implements IWorkbenchPreferencePage {
// Description label
Label descriptionLabel = new Label(container, SWT.NULL);
descriptionLabel.setText("Add or remove Ghidra installations.\n" +
descriptionLabel.setText("Add or remove Ghidra installation directories.\n" +
"The checked Ghidra installation is the default used when creating new projects.\n" +
"Red entries correspond to invalid Ghidra installations.");
"Red entries correspond to invalid Ghidra installation directories.");
new Label(container, SWT.NONE).setText(""); // filler
// Ghidra installations table

View file

@ -77,6 +77,10 @@ public class CreateGhidraModuleProjectWizard extends Wizard implements INewWizar
@Override
public boolean performFinish() {
if (!validate()) {
return false;
}
File ghidraInstallDir = ghidraInstallationPage.getGhidraInstallDir();
String projectName = projectPage.getProjectName();
boolean createRunConfig = projectPage.shouldCreateRunConfig();
@ -148,4 +152,20 @@ public class CreateGhidraModuleProjectWizard extends Wizard implements INewWizar
monitor.done();
}
}
/**
* Validates the wizard pages. If they are invalid, an error popup will be displayed which
* will indicate the problem.
*
* @return True if the data returned from the wizard pages are valid; otherwise, false
*/
private boolean validate() {
if (projectPage.getProjectDir().getAbsolutePath().startsWith(
ghidraInstallationPage.getGhidraInstallDir().getAbsolutePath())) {
EclipseMessageUtils.showErrorDialog("Invalid Project Root Directory",
"Project root directory cannot reside inside of the selected Ghidra installation directory.");
return false;
}
return true;
}
}

View file

@ -30,6 +30,7 @@ import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
import ghidra.GhidraApplicationLayout;
import ghidradev.EclipseMessageUtils;
import ghidradev.ghidraprojectcreator.utils.GhidraScriptUtils;
import ghidradev.ghidraprojectcreator.wizards.pages.*;
@ -68,6 +69,10 @@ public class CreateGhidraScriptProjectWizard extends Wizard implements INewWizar
@Override
public boolean performFinish() {
if (!validate()) {
return false;
}
File ghidraInstallDir = ghidraInstallationPage.getGhidraInstallDir();
String projectName = projectPage.getProjectName();
File projectDir = projectPage.getProjectDir();
@ -134,4 +139,20 @@ public class CreateGhidraScriptProjectWizard extends Wizard implements INewWizar
monitor.done();
}
}
/**
* Validates the wizard pages. If they are invalid, an error popup will be displayed which
* will indicate the problem.
*
* @return True if the data returned from the wizard pages are valid; otherwise, false
*/
private boolean validate() {
if (projectPage.getProjectDir().getAbsolutePath().startsWith(
ghidraInstallationPage.getGhidraInstallDir().getAbsolutePath())) {
EclipseMessageUtils.showErrorDialog("Invalid Project Root Directory",
"Project root directory cannot reside inside of the selected Ghidra installation directory.");
return false;
}
return true;
}
}