Search in sources :

Example 96 with MessageDialog

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();
}
Also used : MessageDialog(org.eclipse.jface.dialogs.MessageDialog)

Example 97 with MessageDialog

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()));
    }
}
Also used : CoreException(org.eclipse.core.runtime.CoreException) MessageDialog(org.eclipse.jface.dialogs.MessageDialog)

Example 98 with MessageDialog

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);
            }
        }
    }
}
Also used : MessageDialog(org.eclipse.jface.dialogs.MessageDialog)

Example 99 with MessageDialog

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();
}
Also used : EJQuestionButton(org.entirej.framework.core.enumerations.EJQuestionButton) EJApplicationException(org.entirej.framework.core.EJApplicationException) MessageDialog(org.eclipse.jface.dialogs.MessageDialog)

Example 100 with MessageDialog

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();
}
Also used : EJQuestionButton(org.entirej.framework.core.enumerations.EJQuestionButton) EJApplicationException(org.entirej.framework.core.EJApplicationException) MessageDialog(org.eclipse.jface.dialogs.MessageDialog)

Aggregations

MessageDialog (org.eclipse.jface.dialogs.MessageDialog)129 Shell (org.eclipse.swt.widgets.Shell)27 CoreException (org.eclipse.core.runtime.CoreException)16 IPath (org.eclipse.core.runtime.IPath)14 File (java.io.File)10 ArrayList (java.util.ArrayList)10 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)10 InvocationTargetException (java.lang.reflect.InvocationTargetException)9 Composite (org.eclipse.swt.widgets.Composite)9 SelectionEvent (org.eclipse.swt.events.SelectionEvent)7 Point (org.eclipse.swt.graphics.Point)7 IOException (java.io.IOException)6 IFile (org.eclipse.core.resources.IFile)6 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)6 List (java.util.List)5 IStatus (org.eclipse.core.runtime.IStatus)5 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)5 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)5 IWorkspaceRoot (org.eclipse.core.resources.IWorkspaceRoot)4 Path (org.eclipse.core.runtime.Path)4