this.severity = severity;
}
protected IStatus run(IProgressMonitor monitor) {
Application readApplication = null;
try {
IPackageFragmentRoot[] packageFragmentRoots = javaGProject
.getPackageFragmentRoots();
for (IPackageFragmentRoot r : packageFragmentRoots) {
int kind = r.getKind();
if (kind == IPackageFragmentRoot.K_BINARY) {
String elementName = r.getElementName();
if (elementName.startsWith("appengine-local-runtime")) {
File fl = r.getPath().toFile().getParentFile()
.getParentFile().getParentFile();
System.setProperty("appengine.sdk.root",
fl.getAbsolutePath() + File.separatorChar);
}
System.out.println(elementName);
}
}
IProject javaProj = javaGProject.getProject();
IContainer warLocation = WebRootDirProvider.calculate(javaProj);
if (!warLocation.exists()) {
throw new FileNotFoundException("War Directory not found");
}
readApplication = Application.readApplication(warLocation
.getLocation().toOSString());
} catch (IOException e) {
if (e instanceof FileNotFoundException) {
Display.getDefault().syncExec(new Runnable() {
public void run() {
MessageDialog.openError(Display.getDefault()
.getActiveShell(), "Error",
"War directory did not found.");
PreferencesUtil.createPreferenceDialogOn(Display
.getDefault().getActiveShell(),
"com.onpositive.gae.tools.core.weblocation",
new String[] {}, null);
}
});
}
return new Status(IStatus.ERROR, Activator.PLUGIN_ID,
IStatus.ERROR, e.getMessage(), e);
} catch (JavaModelException e) {
e.printStackTrace();
}
ConnectOptions connectOptions = ConnectionOptionsManager
.getOptions(readApplication.getAppId());
if (connectOptions == null) {
return Status.CANCEL_STATUS;
}
AppAdmin createAppAdmin2 = new AppAdminFactory().createAppAdmin(
connectOptions, readApplication, new PrintWriter(System.err));