Example usage for org.eclipse.jface.dialogs MessageDialog openInformation

List of usage examples for org.eclipse.jface.dialogs MessageDialog openInformation

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs MessageDialog openInformation.

Prototype

public static void openInformation(Shell parent, String title, String message) 

Source Link

Document

Convenience method to open a standard information dialog.

Usage

From source file:com.android.sdkuilib.internal.repository.UpdaterData.java

License:Apache License

private void notifyToolsNeedsToBeRestarted(int flags) {

    String msg = null;/*from   w  w  w .j a  v  a2 s.co  m*/
    if ((flags & TOOLS_MSG_UPDATED_FROM_ADT) != 0) {
        msg = "The Android SDK and AVD Manager that you are currently using has been updated. "
                + "Please also run Eclipse > Help > Check for Updates to see if the Android "
                + "plug-in needs to be updated.";

    } else if ((flags & TOOLS_MSG_UPDATED_FROM_SDKMAN) != 0) {
        msg = "The Android SDK and AVD Manager that you are currently using has been updated. "
                + "It is recommended that you now close the manager window and re-open it. "
                + "If you use Eclipse, please run Help > Check for Updates to see if the Android "
                + "plug-in needs to be updated.";
    }

    final String msg2 = msg;

    final Shell shell = getWindowShell();
    if (msg2 != null && shell != null && !shell.isDisposed()) {
        shell.getDisplay().syncExec(new Runnable() {
            public void run() {
                if (!shell.isDisposed()) {
                    MessageDialog.openInformation(shell, "Android Tools Updated", msg2);
                }
            }
        });
    }
}

From source file:com.android.sdkuilib.internal.widgets.MessageBoxLog.java

License:Apache License

/**
 * Displays the log if anything was captured.
 * <p/>//ww w  . ja v a  2 s .co m
 * @param success Used only when the logger was constructed with <var>logErrorsOnly</var>==true.
 * In this case the dialog will only be shown either if success if false or some errors
 * where captured.
 */
@Override
public void displayResult(final boolean success) {
    if (logMessages.size() > 0) {
        final StringBuilder sb = new StringBuilder(mMessage + "\n\n");
        for (String msg : logMessages) {
            if (msg.length() > 0) {
                if (msg.charAt(0) != '\n') {
                    int n = sb.length();
                    if (n > 0 && sb.charAt(n - 1) != '\n') {
                        sb.append('\n');
                    }
                }
                sb.append(msg);
            }
        }

        // display the message
        // dialog box only run in ui thread..
        if (mDisplay != null && !mDisplay.isDisposed()) {
            mDisplay.asyncExec(new Runnable() {
                @Override
                public void run() {
                    // This is typically displayed at the end, so make sure the UI
                    // instances are not disposed.
                    Shell shell = null;
                    if (mDisplay != null && !mDisplay.isDisposed()) {
                        shell = mDisplay.getActiveShell();
                    }
                    if (shell == null || shell.isDisposed()) {
                        return;
                    }
                    // Use the success icon if the call indicates success.
                    // However just use the error icon if the logger was only recording errors.
                    if (success && !mLogErrorsOnly) {
                        MessageDialog.openInformation(shell, "Android Virtual Devices Manager", sb.toString());
                    } else {
                        MessageDialog.openError(shell, "Android Virtual Devices Manager", sb.toString());

                    }
                }
            });
        }
    }
}

From source file:com.anirudh.emacseclipse.handlers.BaseHandler.java

License:Open Source License

public static Boolean resolveDocument() {
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    IPartService partService = window.getPartService();
    IWorkbenchPart part = partService.getActivePart();

    if (!(part instanceof IEditorPart)) {
        MessageDialog.openInformation(window.getShell(), "Emacs Eclipse Plug-in", "Unexpected part: " + part);
        return false;
    }/*  w ww .j a  va2  s.  c om*/

    BaseHandler.editor = (IEditorPart) part;
    BaseHandler.sourceViewer = (ISourceViewer) editor.getAdapter(ITextOperationTarget.class);
    BaseHandler.document = BaseHandler.sourceViewer.getDocument();

    return true;
}

From source file:com.anirudh.emacseclipse.handlers.OpenEmacsHandler.java

License:Open Source License

/**
 * the command has been executed, so extract extract the needed information
 * from the application context.//  w w  w  .j  a  v  a2  s. c  om
 */
public Object execute(ExecutionEvent event) throws ExecutionException {
    IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);

    if (BaseHandler.resolveDocument() == false) {
        return null;
    }

    ISourceViewer editor = BaseHandler.sourceViewer;

    try {
        ISelection cursorpos = editor.getSelectionProvider().getSelection();
        if (cursorpos instanceof ITextSelection) {
            ITextSelection currSelection = (ITextSelection) cursorpos;
            int currOffset;
            EmacsHandler emacs = new EmacsHandler();

            if (BaseHandler.editor.getEditorInput() instanceof IPathEditorInput) {
                String path = ((IPathEditorInput) BaseHandler.editor.getEditorInput()).getPath().toOSString();
                emacs.emacsFindFile(path);
                if (path.toLowerCase().endsWith(".mxml") || path.toLowerCase().endsWith(".as")) {
                    currOffset = currSelection.getStartLine();
                    emacs.emacsGotoLine(currOffset);
                } else {
                    currOffset = currSelection.getOffset();
                    emacs.emacsGotoChar(currOffset);
                }

            } else {
                emacs.emacsShowMessage("Error: Not an IPathEditorInput");
            }
            emacs.emacsFlush();
        }
    } catch (Exception e) {
        MessageDialog.openInformation(window.getShell(), "Emacs Eclipse Plug-in", "Exception: " + e);
    }

    return null;
}

From source file:com.apicloud.makepackage.ui.PackageAppItemDialog.java

License:Open Source License

protected void buttonPressed(int buttonId) {
    if (buttonId == 0) {
        if (!new File(path + File.separator + "icon" + File.separator + "icon150x150.png").exists()) {
            MessageDialog.openInformation(null, Messages.PackageAppItemDialog_INFO,
                    Messages.PackageAppItemDialog_MUST_BE_A_ICON);
            return;
        }//from   www. ja  v  a 2s .  com
        if (!new File(path + File.separator + "launch" + File.separator + "launch1080x1920.png").exists()) {
            MessageDialog.openInformation(null, Messages.PackageAppItemDialog_INFO,
                    Messages.PackageAppItemDialog_MUST_BE_A_ICON);
            return;
        }
        if (!button_iphone.getSelection() && !button_android.getSelection()) {
            return;
        }
        test = IDEUtil.getInstallPath();
        java.io.File file = new java.io.File(test);
        ide_home = test;
        test = file.getParent() + File.separator;
        int i = 0;
        if (button_android.getSelection()) {
            i = i + 1;
        }
        if (button_iphone.getSelection()) {
            i = i + 2;
        }
        PackageJob job = new PackageJob(i, test, ide_home, path, id, appName, fullScreen);
        job.setUser(true);
        job.schedule();
        job.addJobChangeListener(new JobChangeAdapter() {
            public void done(IJobChangeEvent event) {
                if (event.getResult().isOK())
                    Display.getDefault().syncExec(new Runnable() {
                        public void run() {
                            MessageDialog.openInformation(null, Messages.PackageAppItemDialog_SUCESS,
                                    Messages.PackageAppItemDialog_PACKAGE_SUCESS);
                            openPackageFolder(test + File.separator + "package");
                        }
                    });
                else
                    Display.getDefault().syncExec(new Runnable() {
                        public void run() {
                            MessageDialog.openError(null, Messages.PackageAppItemDialog_EXCEPTION,
                                    Messages.PackageAppItemDialog_PACKAGE_FAIL);
                        }
                    });
            }
        });

        close();
        close();
    } else if (buttonId == 1) {
        close();
    }
}

From source file:com.apicloud.navigator.dialogs.AddFeatureDialog.java

License:Open Source License

@Override
protected void buttonPressed(int buttonId) {
    if (buttonId == IDialogConstants.OK_ID) {
        if (selectFeature == null) {
            MessageDialog.openInformation(getShell(), Messages.AddFeatureDialog_INFORMATION,
                    Messages.AddFeatureDialog_MESSAGE);
            return;
        }//from w  w  w. j a  v  a  2  s .c om
        for (Feature feature : config.getFeatures()) {
            if (feature.getName().equals(selectFeature.getName())) {
                MessageDialog.openInformation(getShell(), Messages.AddFeatureDialog_INFORMATION,
                        Messages.CreateFeatureDialog_FEATURE_NAME_DUP);
                return;
            }
        }
        if (text_urlScheme.isVisible() && text_urlScheme.getText().isEmpty()) {
            MessageDialog.openInformation(getShell(), Messages.AddFeatureDialog_INFORMATION,
                    lblParamkey.getText().trim() + Messages.AddFeatureDialog_MESSAGE_NULL);
            return;
        }
        if (text_apiKey.isVisible() && text_apiKey.getText().isEmpty()) {
            MessageDialog.openInformation(getShell(), Messages.AddFeatureDialog_INFORMATION,
                    lblParamvalue.getText().trim() + Messages.AddFeatureDialog_MESSAGE_NULL);
            return;
        }
        feature = new Feature();
        feature.setName(selectFeature.getName());
        if (text_urlScheme.isVisible()) {
            Param p = new Param();
            p.setName("urlScheme");
            if (feature.getName().equals("baiduMap")) {
                p.setName("android_api_key");
            }

            p.setValue(text_urlScheme.getText());
            feature.getParams().add(p);
        }
        if (text_apiKey.isVisible()) {
            Param p = new Param();
            p.setName("apiKey");
            if (feature.getName().equals("baiduMap")) {
                p.setName("ios_api_key");
            }
            p.setValue(text_apiKey.getText());
            feature.getParams().add(p);
        }

        config.addFeature(feature);
        TreeNode node = new TreeNode(feature);
        treeViewer.setInput(config.createTreeNode());
        treeViewer.collapseAll();
        StructuredSelection selection = new StructuredSelection(node);
        treeViewer.setSelection(selection, true);
        treeViewer.refresh();
        editor.setDirty(true);
        editor.change();
    }
    super.buttonPressed(buttonId);
}

From source file:com.apicloud.navigator.dialogs.CustomerLoaderDialog.java

License:Open Source License

private void compileAndDownloadAppLoader(final String id) {

    job = new WorkspaceJob(Messages.CUSTOMERLOADER) {
        private String androidST;
        private String iosST;

        @Override// ww w .j  a  v a  2s .c o  m
        public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
            monitor.beginTask("package Resource:", 101);
            monitor.setTaskName(Messages.LOADERPATH);
            int i = 0;
            try {
                while (true) {
                    if (monitor.isCanceled()) {
                        return close();
                    }
                    String message = network_instance.getLoaderState(pkgId, cookie, ip);
                    JSONObject json;
                    json = new JSONObject(message);
                    String status = json.getString("status");
                    if (status.equals("0")) {
                        final String errorStr = json.getString("msg");
                        Display.getDefault().asyncExec(new Runnable() {

                            @Override
                            public void run() {
                                MessageDialog.openError(Display.getCurrent().getActiveShell(), "\u5931\u8D25",
                                        errorStr);
                            }
                        });
                        return Status.CANCEL_STATUS;
                    } else {
                        String body = json.getString("body");
                        JSONObject result = new JSONObject(body);
                        androidST = result.getString("androidST");
                        iosST = result.getString("iosST");

                        if (androidST.equals("0") || iosST.equals("0")) {
                            monitor.subTask(Messages.UNPACKINFO);
                            if (i == 50) {
                                continue;
                            } else {
                                i++;
                                Thread.sleep(10000);
                                monitor.worked(1);
                            }
                        } else if (androidST.equals("7") || iosST.equals("7")) {

                            Display.getDefault().syncExec(new Runnable() {

                                @Override
                                public void run() {
                                    MessageDialog.openError(Display.getCurrent().getActiveShell(), "Error",
                                            Messages.COMMITTOCLOUD);

                                }
                            });
                            isTrue = false;
                            break;
                        } else if (androidST.equals("1") && iosST.equals("1")) {
                            android_log = result.getString("android_log");
                            ios_log = result.getString("ios_log");
                            String apkPath = result.getString("apkPath");
                            String ipaPath = result.getString("ipaPath");
                            apackageName = result.getString("packageName");
                            ipackageName = result.getString("iosAppIds");
                            version = result.getString("version");
                            if (i != 50) {
                                i++;
                                monitor.worked(1);
                                continue;
                            }
                            File file = new File(IDEUtil.getInstallPath() + "/apploader");
                            if (!file.exists()) {
                                file.mkdirs();
                            }
                            DownLoadUtil.downZip1(apkPath,
                                    IDEUtil.getInstallPath() + "/apploader/" + id + "/load.apk", // ?/apploder/appid/load.apk
                                    new SubProgressMonitor(monitor, 25));
                            DownLoadUtil.downZip1(ipaPath,
                                    IDEUtil.getInstallPath() + "/apploader/" + id + "/load.ipa",
                                    new SubProgressMonitor(monitor, 25));
                            saveApploaderInfo();
                            isTrue = true;
                            break;
                        } else {
                            Display.getDefault().asyncExec(new Runnable() {
                                @Override
                                public void run() {
                                    String androidMessage = compileInfo.get(androidST) == null ? ""
                                            : compileInfo.get(androidST);
                                    String iosMessage = compileInfo.get(iosST) == null ? ""
                                            : compileInfo.get(iosST);
                                    String message = androidMessage + iosMessage;
                                    if (message.equals("")) {
                                        message = Messages.UNKNOWERROR;
                                    }
                                    MessageDialog.openError(Display.getCurrent().getActiveShell(),
                                            Messages.ERROR, message + Messages.BROWSERERROR);
                                    if (!androidMessage.equals("")) {
                                        openErrorMessage(android_log);
                                    }
                                    if (!iosMessage.equals("")) {
                                        openErrorMessage(ios_log);
                                    }
                                }
                            });

                            return Status.CANCEL_STATUS;
                        }
                    }
                }
                monitor.worked(1);
                monitor.done();
            } catch (UnsupportedEncodingException e) {
                return closeAndShowMessage(Messages.SERVICEBUSY);
            } catch (JSONException e1) {
                return closeAndShowMessage(Messages.DATAANALYSISERROR);
            } catch (IOException e) {
                return closeAndShowMessage(Messages.SERVICEDATAERROR);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

            return Status.OK_STATUS;
        }

        private IStatus close() {
            return Status.CANCEL_STATUS;
        }

        private IStatus closeAndShowMessage(final String errorMessage) {
            return Status.CANCEL_STATUS;
        }
    };
    job.setUser(true);
    job.schedule();
    job.getState();

    job.addJobChangeListener(new JobChangeAdapter() {
        public void done(IJobChangeEvent event) {
            if (event.getResult().isOK() && isTrue)
                Display.getDefault().syncExec(new Runnable() {
                    public void run() {
                        MessageDialog.openInformation(null, Messages.PackageAppItemDialog_SUCESS,
                                Messages.COMPILESUCCESS);
                    }
                });
            else
                Display.getDefault().syncExec(new Runnable() {
                    public void run() {
                        MessageDialog.openError(null, Messages.PackageAppItemDialog_EXCEPTION,
                                Messages.COMPILERROR);
                    }
                });
        }
    });

}

From source file:com.apicloud.navigator.dialogs.PackageDialog.java

License:Open Source License

protected void buttonPressed(int buttonId) {
    if (buttonId == 0) {
        if (!new File(path + File.separator + "icon" + File.separator + "icon150x150.png").exists()) {
            MessageDialog.openInformation(null, Messages.AddFeatureDialog_INFORMATION,
                    Messages.PackageAppItemDialog_MUST_BE_A_ICON);
            return;
        }//ww w .ja v  a2s  .  c  o m
        if (!new File(path + File.separator + "launch" + File.separator + "launch1080x1920.png").exists()) {
            MessageDialog.openInformation(null, Messages.AddFeatureDialog_INFORMATION,
                    Messages.PackageAppItemDialog_MUST_BE_B_ICON);
            return;
        }
        if (!button_iphone.getSelection() && !button_android.getSelection()) {
            return;
        }
        test = IDEUtil.getInstallPath();
        java.io.File file = new java.io.File(test);
        ide_home = test;
        test = file.getParent() + File.separator;
        int i = 0;
        if (button_android.getSelection()) {
            i = i + 1;
        }
        if (button_iphone.getSelection()) {
            i = i + 2;
        }
        PackageJob job = new PackageJob(i, test, ide_home, path, id, appName, fullScreen);
        job.setUser(true);
        job.schedule();
        job.addJobChangeListener(new JobChangeAdapter() {
            public void done(IJobChangeEvent event) {
                if (event.getResult().isOK())
                    Display.getDefault().syncExec(new Runnable() {
                        public void run() {
                            MessageDialog.openInformation(null, Messages.PackageAppItemDialog_SUCESS,
                                    Messages.PackageAppItemDialog_PACKAGE_SUCESS);
                            openPackageFolder(test + File.separator + "package");
                        }
                    });
                else
                    Display.getDefault().syncExec(new Runnable() {
                        public void run() {
                            MessageDialog.openError(null, Messages.PackageAppItemDialog_EXCEPTION,
                                    Messages.PackageAppItemDialog_PACKAGE_FAIL);
                        }
                    });
            }
        });

        close();
        close();
    } else if (buttonId == 1) {
        close();
    }
}

From source file:com.apicloud.navigator.ui.actions.CustomLoader.java

License:Open Source License

private void compileAndDownloadAppLoader(final String id) {
    job = new WorkspaceJob(Messages.CUSTOMERLOADER) {
        private String androidST;
        private String iosST;

        @Override/* w  w w .  j  ava 2 s  . co m*/
        public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
            monitor.beginTask("package Resource:", 101);
            monitor.setTaskName(Messages.LOADERPATH);
            int i = 0;
            try {
                while (true) {
                    if (monitor.isCanceled()) {
                        return close();
                    }
                    String message = ConnectionUtil.sendPostRequest("http://" + ip + "/getLoaderState",
                            "pkgId=" + URLEncoder.encode(pkgId, "UTF-8"), cookie);
                    JSONObject json;
                    json = new JSONObject(message);
                    String status = json.getString("status");
                    if (status.equals("0")) {
                        final String errorStr = json.getString("msg");
                        Display.getDefault().asyncExec(new Runnable() {

                            @Override
                            public void run() {
                                MessageDialog.openError(Display.getCurrent().getActiveShell(), Messages.ERROR,
                                        errorStr);
                            }
                        });
                        return Status.CANCEL_STATUS;
                    } else {
                        String body = json.getString("body");
                        JSONObject result = new JSONObject(body);
                        androidST = result.getString("androidST");
                        iosST = result.getString("iosST");

                        if (androidST.equals("0") || iosST.equals("0")) {
                            monitor.subTask(Messages.COMPILEREADY);
                            if (i == 50) {
                                continue;
                            } else {
                                i++;
                                Thread.sleep(1000);
                                monitor.worked(1);
                            }
                        } else if (androidST.equals("7") || iosST.equals("7")) {

                            Display.getDefault().syncExec(new Runnable() {

                                @Override
                                public void run() {
                                    MessageDialog.openError(Display.getCurrent().getActiveShell(), "Error",
                                            Messages.COMMITTOCLOUD);

                                }
                            });
                            isTrue = false;
                            break;
                        } else if (androidST.equals("1") && iosST.equals("1")) {
                            monitor.subTask(Messages.STARTTOCOMPILE);
                            android_log = result.getString("android_log");
                            ios_log = result.getString("ios_log");
                            String apkPath = result.getString("apkPath");
                            String ipaPath = result.getString("ipaPath");
                            apackageName = result.getString("packageName");
                            ipackageName = result.getString("iosAppIds");
                            version = result.getString("version");
                            if (i != 50) {
                                i++;
                                monitor.worked(1);
                                continue;
                            }
                            File file = new File(IDEUtil.getInstallPath() + "/apploader");
                            if (!file.exists()) {
                                file.mkdirs();
                            }
                            String apkpath = IDEUtil.getInstallPath() + "/apploader/" + id + "/load.apk";
                            File loaderFile = new File(apkpath);
                            if (loaderFile.exists()) {
                                //                        FileUtil.deleteFile(path);
                                apkpath = IDEUtil.getInstallPath() + "/apploadertemp/" + id + "/load.apk";
                            }
                            monitor.subTask(Messages.ANDROIDDOWNLOAD);
                            DownLoadUtil.downZip1(apkPath, apkpath, // ?/apploder/appid/load.apk
                                    new SubProgressMonitor(monitor, 25));
                            monitor.subTask("\u4E0B\u8F7DIOS Loader\u4E2D...");
                            String ipapath = IDEUtil.getInstallPath() + "/apploader/" + id + "/load.ipa";
                            File ipafile = new File(
                                    IDEUtil.getInstallPath() + "/apploader/" + id + "/load.ipa");
                            if (ipafile.exists()) {
                                //                           FileUtil.deleteFile(path);
                                ipapath = IDEUtil.getInstallPath() + "/apploadertemp/" + id + "/load.ipa";
                            }

                            DownLoadUtil.downZip1(ipaPath, ipapath, new SubProgressMonitor(monitor, 25));
                            String tempapkfilePath = IDEUtil.getInstallPath() + "/apploadertemp/" + id
                                    + "/load.apk";
                            String sourceapkPath = IDEUtil.getInstallPath() + "/apploader/" + id + "/load.apk";
                            String tempipafilePath = IDEUtil.getInstallPath() + "/apploadertemp/" + id
                                    + "/load.apk";
                            String sourceipaPath = IDEUtil.getInstallPath() + "/apploader/" + id + "/load.apk";
                            String tempfolder = IDEUtil.getInstallPath() + "/apploadertemp";
                            File tempapkFile = new File(tempapkfilePath);
                            File tempipaFile = new File(tempipafilePath);
                            if (tempapkFile.exists() || tempipaFile.exists()) {
                                FileUtil.deleteFile(sourceapkPath);
                                FileUtil.copyFile(tempapkfilePath, sourceapkPath);
                                FileUtil.deleteFile(sourceipaPath);
                                FileUtil.copyFile(tempipafilePath, sourceipaPath);

                                FileUtil.deleteDirectory(tempfolder);
                            }
                            saveApploaderInfo(id);
                            isTrue = true;
                            break;
                        } else {
                            Display.getDefault().asyncExec(new Runnable() {
                                @Override
                                public void run() {
                                    String androidMessage = compileInfo.get(androidST) == null ? ""
                                            : compileInfo.get(androidST);
                                    String iosMessage = compileInfo.get(iosST) == null ? ""
                                            : compileInfo.get(iosST);
                                    String message = androidMessage + iosMessage;
                                    if (message.equals("")) {
                                        message = Messages.UNKNOWERROR;
                                    }
                                    if (!androidMessage.equals("")) {
                                        openErrorMessage(android_log);
                                    }
                                    if (!iosMessage.equals("")) {
                                        openErrorMessage(ios_log);
                                    }
                                }
                            });

                            return Status.CANCEL_STATUS;
                        }
                    }
                }
                monitor.worked(1);
                monitor.done();
            } catch (UnsupportedEncodingException e) {
                return closeAndShowMessage(Messages.SERVICEBUSY);
            } catch (JSONException e1) {
                return closeAndShowMessage(Messages.DATAANALYSISERROR);
            } catch (IOException e) {
                return closeAndShowMessage(Messages.SERVICEDATAERROR);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

            return Status.OK_STATUS;
        }

        private IStatus close() {

            return Status.CANCEL_STATUS;
        }

        private IStatus closeAndShowMessage(final String errorMessage) {
            return Status.CANCEL_STATUS;
        }
    };
    job.setUser(true);
    job.schedule();
    job.getState();

    job.addJobChangeListener(new JobChangeAdapter() {
        public void done(IJobChangeEvent event) {
            if (event.getResult().isOK() && isTrue)
                Display.getDefault().syncExec(new Runnable() {
                    public void run() {
                        MessageDialog.openInformation(null, Messages.PackageAppItemDialog_SUCESS,
                                Messages.CUSTOMERSUCCESS);
                    }
                });
            else
                Display.getDefault().syncExec(new Runnable() {
                    public void run() {
                        MessageDialog.openError(null, Messages.PackageAppItemDialog_EXCEPTION,
                                Messages.COMPILEFAILURE);
                    }
                });
        }
    });

}

From source file:com.apicloud.navigator.ui.actions.RemoveAppLoaderAction.java

License:Open Source License

@Override
public void run(IAction action) {
    if (file != null) {
        FileUtil.deleteDirectory((file.getAbsolutePath()));
        Properties p = com.apicloud.commons.model.Activator.getAppLoaderProperties();
        p.remove(id);/*  w  w  w.j av  a2  s . c  o m*/
        com.apicloud.commons.model.Activator.getLoaderMap().remove(id);
        writeFile(p, com.apicloud.commons.model.Activator.getLoaderFile());
        try {
            ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_INFINITE, null);
            Display.getDefault().syncExec(new Runnable() {

                @Override
                public void run() {
                    MessageDialog.openInformation(Display.getCurrent().getActiveShell(), Messages.REMOVESUCCESS,
                            Messages.LOADERREMOVED);
                }
            });

        } catch (CoreException e) {
            e.printStackTrace();
        }
    }

}