use of org.eclipse.jface.dialogs.MessageDialog in project soot by Sable.
the class SootFileLauncher method handleClassFile.
private void handleClassFile(IFile file) {
ClassFile cf = new ClassFile(file.getLocation().toOSString());
FileInputStream fis = null;
try {
fis = new FileInputStream(file.getLocation().toOSString());
} catch (FileNotFoundException e) {
}
if (!cf.loadClassFile(fis)) {
MessageDialog noClassFound = new MessageDialog(window.getShell(), "Soot Information", null, "Could not determine package for class file will not continue.", 0, new String[] { "OK" }, 0);
noClassFound.open();
setDoNotContinue(true);
}
getToProcessList().add(replaceWithDot(cf.toString()));
setClasspathAppend(file.getLocation().toOSString().substring(0, file.getLocation().toOSString().indexOf(cf.toString())));
addJars();
}
use of org.eclipse.jface.dialogs.MessageDialog in project soot by Sable.
the class SootFileLauncher method handleSourceFile.
private void handleSourceFile(ICompilationUnit cu) {
IPackageFragmentRoot pfr = (IPackageFragmentRoot) cu.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);
IPackageFragment pf = (IPackageFragment) cu.getAncestor(IJavaElement.PACKAGE_FRAGMENT);
if (isSrcPrec() && getSrcPrec().equals("java")) {
setClasspathAppend(platform_location + pfr.getPath().toOSString());
} else {
try {
IProject proj = cu.getJavaProject().getProject();
IFolder output = proj.getFolder(cu.getJavaProject().getOutputLocation().lastSegment());
IPackageFragment pkf = (IPackageFragment) cu.getAncestor(IJavaElement.PACKAGE_FRAGMENT);
IFile exists = null;
if (pkf.isDefaultPackage()) {
exists = output.getFile(removeFileExt(cu.getElementName()) + ".class");
} else {
IFolder pkg = output.getFolder(dotsToSlashes(pf.getElementName()));
exists = pkg.getFile(removeFileExt(cu.getElementName()) + ".class");
}
if (!exists.exists()) {
window = SootPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow();
MessageDialog noClassFound = new MessageDialog(window.getShell(), "Soot Information", null, "No underlying class file was found, maybe build project.", 0, new String[] { "OK" }, 0);
noClassFound.open();
setDoNotContinue(true);
}
setClasspathAppend(platform_location + cu.getJavaProject().getOutputLocation().toOSString());
} catch (CoreException e) {
}
}
addJars();
if (pf.isDefaultPackage()) {
getToProcessList().add(removeFileExt(cu.getElementName()));
} else {
getToProcessList().add(pf.getElementName() + "." + removeFileExt(cu.getElementName()));
}
}
use of org.eclipse.jface.dialogs.MessageDialog in project nebula.widgets.nattable by eclipse.
the class CrossValidationDialogErrorHandling method showWarningDialog.
@Override
protected void showWarningDialog(String dialogMessage, String dialogTitle) {
if (!isWarningDialogActive()) {
if (dialogMessage != null) {
MessageDialog warningDialog = new MessageDialog(Display.getCurrent().getActiveShell(), dialogTitle, null, dialogMessage, MessageDialog.WARNING, new String[] { getChangeButtonLabel(), getDiscardButtonLabel(), "Commit" }, 0);
// if discard was selected close the editor
int returnCode = warningDialog.open();
if (returnCode == 1) {
this.editor.close();
} else if (returnCode == 2) {
this.editor.commit(MoveDirectionEnum.NONE, true, true);
}
}
}
}
use of org.eclipse.jface.dialogs.MessageDialog in project rap by entirej.
the class EJRWTMessenger method askQuestion.
/**
* Asks the given question and after the user has made an answer, the answer
* will be sent to the corresponding <code>IActionProcessor</code>
*
* @param question
* The question to be asked
*/
@Override
public void askQuestion(final EJQuestion question) {
final EJQuestionButton[] optionsButtons = getOptions(question);
String[] options = new String[optionsButtons.length];
for (int i = 0; i < optionsButtons.length; i++) {
options[i] = question.getButtonText(optionsButtons[i]);
}
MessageDialog dialog = new MessageDialog(manager.getShell(), question.getTitle(), null, question.getMessageText(), MessageDialog.QUESTION, options, 2) {
@Override
public boolean close() {
boolean close = super.close();
int answer = getReturnCode();
try {
if (answer > -1) {
question.setAnswer(optionsButtons[answer]);
question.getActionProcessor().questionAnswered(question);
}
} catch (EJApplicationException e) {
handleException(e);
}
return close;
}
};
dialog.setBlockOnOpen(false);
dialog.open();
}
use of org.eclipse.jface.dialogs.MessageDialog in project rap by entirej.
the class EJRWTMessenger method askInternalQuestion.
/**
* Asks the given question and after the user has made an answer, the answer
* will be sent to the corresponding <code>IActionProcessor</code>
*
* @param question
* The question to be asked
*/
@Override
public void askInternalQuestion(final EJInternalQuestion question) {
final EJQuestionButton[] optionsButtons = getOptions(question);
String[] options = new String[optionsButtons.length];
for (int i = 0; i < optionsButtons.length; i++) {
options[i] = question.getButtonText(optionsButtons[i]);
}
MessageDialog dialog = new MessageDialog(manager.getShell(), question.getTitle(), null, question.getMessageText(), MessageDialog.QUESTION, options, 2) {
@Override
public boolean close() {
boolean close = super.close();
int answer = getReturnCode();
try {
if (answer > -1) {
question.setAnswer(optionsButtons[answer]);
question.getActionProcessor().questionAnswered(question);
}
question.getForm().internalQuestionAnswered(question);
} catch (EJApplicationException e) {
handleException(e);
}
return close;
}
};
dialog.setBlockOnOpen(false);
dialog.open();
}
Aggregations