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.aptana.ide.editors.views.profiles.ProfilesView.java

License:Open Source License

private void showMessage(String message) {
    MessageDialog.openInformation(viewer.getControl().getShell(), Messages.ProfilesView_FileExplorer, message);
}

From source file:com.aptana.ide.js.docgen.actions.GenerateHTMLDocsAction.java

License:Open Source License

/**
 * The action has been activated. The argument of the method represents the 'real' action
 * sitting in the workbench UI./*from   w  w  w  .jav a 2  s . c  o m*/
 * 
 * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
 */
public void run(IAction action) {
    final JSEditor editor = (JSEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
            .getActiveEditor();

    Job job = new Job(Messages.GenerateHTMLDocsAction_Job_GenerateDoc) {

        protected IStatus run(IProgressMonitor monitor) {

            IParseState pstate = editor.getFileContext().getParseState();
            IEditorInput input = editor.getEditorInput();

            final IFile file = (input instanceof IFileEditorInput) ? ((IFileEditorInput) input).getFile()
                    : null;

            if (file == null) {
                UIJob job = new UIJob(Messages.GenerateHTMLDocsAction_Job_DisplayError) {
                    /**
                     * 
                     */
                    public IStatus runInUIThread(IProgressMonitor monitor) {
                        MessageDialog.openInformation(Display.getDefault().getActiveShell(),
                                Messages.GenerateHTMLDocsAction_ErrorTitle,
                                Messages.GenerateHTMLDocsAction_ErrorMessage);
                        return Status.OK_STATUS;
                    }
                };
                job.setSystem(true);
                job.schedule();

                return Status.CANCEL_STATUS;
            }

            if (pstate instanceof JSParseState) {
                String xml = GenerateDocs.generateXML((JSParseState) pstate, file.getName());
                InputStream schemaStream = DocgenPlugin.class
                        .getResourceAsStream("/com/aptana/ide/js/docgen/resources/docs.xsl"); //$NON-NLS-1$
                IPath location = file.getParent().getLocation();
                location = location.append(FileUtils.stripExtension(file.getName()) + "_docs"); //$NON-NLS-1$
                File f = new File(location.toOSString());
                f.mkdirs();

                String folderPath = location.append("/images/").toOSString(); //$NON-NLS-1$ //$NON-NLS-2$
                GenerateDocs.exportImage(folderPath, "shared.css"); //$NON-NLS-1$
                GenerateDocs.exportImage(folderPath, "doc_background.gif"); //$NON-NLS-1$

                GenerateDocs.generateHTMLFromXML(xml, f.getAbsolutePath() + "/", file.getName(), schemaStream); //$NON-NLS-1$
                //  Does not appear to work in Vista
                //   if(url != null)
                //   {
                //      WorkbenchHelper.launchBrowser(url.toExternalForm());
                //   }

                IContainer project = file.getParent();
                try {
                    project.refreshLocal(1, null);
                } catch (CoreException e) {
                }

                UIJob job = new UIJob(Messages.GenerateHTMLDocsAction_Job_DocCompleted) {
                    /**
                     * 
                     */
                    public IStatus runInUIThread(IProgressMonitor monitor) {
                        MessageDialog.openInformation(Display.getDefault().getActiveShell(),
                                Messages.GenerateHTMLDocsAction_DocCompletedTitle,
                                MessageFormat.format(Messages.GenerateHTMLDocsAction_DocCompletedMessage,
                                        file.getFullPath().toString()));
                        return Status.OK_STATUS;
                    }
                };
                job.setSystem(true);
                job.schedule();

            }

            return Status.OK_STATUS;
        }

    };
    job.setSystem(false);
    job.schedule();
}

From source file:com.aptana.ide.server.ui.views.GenericServersView.java

License:Open Source License

private void doEdit(final IServer server) {
    // if (server.getServerState() != IServer.STATE_STOPPED && server.getServerState() != IServer.STATE_UNKNOWN)
    // {/*ww w  .java2  s  .c  o  m*/
    // MessageDialog.openInformation(serverViewer.getControl().getShell(),
    // Messages.GenericServersView_ServerReadOnly_TITLE,
    // Messages.GenericServersView_ServerReadOnlyDescription);
    // return;
    // }

    IStatus canModify = server.canModify();
    if (canModify != null && canModify.getCode() != IStatus.OK) {
        MessageDialog.openInformation(serverViewer.getControl().getShell(),
                Messages.GenericServersView_READONLY_TITLE, Messages.GenericServersView_READONLY_DESCRIPTION);
        return;
    }

    ICanEdit adapter = (ICanEdit) server.getAdapter(ICanEdit.class);
    if (adapter != null) {
        adapter.doEdit();
        return;
    }
    IConfigurationDialog dialog = ServerDialogPageRegistry.getInstance()
            .getDialog(server.getServerType().getId());
    Configuration cf = new Configuration();
    server.storeConfiguration(cf);
    dialog.setConfiguration(cf);
    dialog.setServer(server);
    dialog.setEdit(true);

    int open = dialog.getDialog().open();
    if (open == Dialog.OK) {
        IAbstractConfiguration configuration = dialog.getConfiguration();
        // configuration.setStringAttribute(IServer.KEY_ID,ServerManager.getFreeId());
        configuration.setStringAttribute(IServer.KEY_TYPE, server.getServerType().getId());
        try {
            server.reconfigure(configuration);
        } catch (CoreException e) {
            MessageDialog.openError(Display.getCurrent().getActiveShell(),
                    Messages.GenericServersView_ERROR_WHILE_EDITING_DESCRIPTION, e.getMessage());
            IdeLog.log(ServerUIPlugin.getDefault(), IStatus.ERROR,
                    Messages.GenericServersView_ERROR_WHILE_EDITING_TITLE, e);
        }
    }
    IStructuredSelection selection = (IStructuredSelection) serverViewer.getSelection();
    this.pauseAction.selectionChanged(new SelectionChangedEvent(this.serverViewer, selection));
}

From source file:com.aptana.ide.ui.ftp.dialogs.FTPConnectionPointPropertyDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite dialogArea = (Composite) super.createDialogArea(parent);

    titleImage = Activator.getImageDescriptor("/icons/full/wizban/ftp.png").createImage(); //$NON-NLS-1$
    smallFont = JFaceResources.getTextFontDescriptor().increaseHeight(-2).createFont(dialogArea.getDisplay());
    dialogArea.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
            dispose();/*  w  w w . j a  v  a  2 s  .c o  m*/
        }
    });

    setTitleImage(titleImage);
    if (ftpConnectionPoint != null) {
        setTitle(StringUtils.format(Messages.FTPConnectionPointPropertyDialog_MessageTitle_Edit,
                getConnectionPointType().getName()));
        getShell().setText(Messages.FTPConnectionPointPropertyDialog_Title_Edit);
    } else {
        setTitle(StringUtils.format(Messages.FTPConnectionPointPropertyDialog_MessageTitle_New,
                getConnectionPointType().getName()));
        getShell().setText(Messages.FTPConnectionPointPropertyDialog_Title_New);
    }

    Composite container = new Composite(dialogArea, SWT.NONE);
    container.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    container.setLayout(GridLayoutFactory.swtDefaults()
            .margins(convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN),
                    convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN))
            .spacing(convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING),
                    convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING))
            .numColumns(2).create());

    /* row 1 */
    createSiteSection(container);

    Group group = new Group(container, SWT.NONE);
    group.setLayoutData(GridDataFactory.fillDefaults().span(2, 1).grab(true, false).create());
    group.setLayout(GridLayoutFactory.swtDefaults().numColumns(3).create());
    group.setText(Messages.FTPConnectionPointPropertyDialog_LBL_GroupInfo);

    /* row 2 */
    Label label = new Label(group, SWT.NONE);
    label.setLayoutData(GridDataFactory.swtDefaults()
            .hint(new PixelConverter(label).convertHorizontalDLUsToPixels(IDialogConstants.LABEL_WIDTH),
                    SWT.DEFAULT)
            .create());
    label.setText(StringUtils.makeFormLabel(Messages.FTPConnectionPointPropertyDialog_LBL_Server));

    hostText = new Text(group, SWT.SINGLE | SWT.BORDER);
    hostText.setLayoutData(GridDataFactory.swtDefaults()
            .hint(convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH), SWT.DEFAULT).span(2, 1)
            .create());

    /* row 3 */
    new Label(group, SWT.NONE).setLayoutData(GridDataFactory.swtDefaults().create());

    label = new Label(group, SWT.NONE);
    label.setLayoutData(GridDataFactory.swtDefaults().span(2, 1).create());
    label.setFont(smallFont);
    label.setText(Messages.FTPConnectionPointPropertyDialog_LBL_Example);

    /* row 4 */
    label = new Label(group, SWT.NONE);
    label.setLayoutData(GridDataFactory.swtDefaults()
            .hint(new PixelConverter(label).convertHorizontalDLUsToPixels(IDialogConstants.LABEL_WIDTH),
                    SWT.DEFAULT)
            .create());
    label.setText(StringUtils.makeFormLabel(Messages.FTPConnectionPointPropertyDialog_LBL_Username));

    loginCombo = new Combo(group, SWT.DROP_DOWN | SWT.BORDER);
    loginCombo.setLayoutData(GridDataFactory.swtDefaults()
            .hint(convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH), SWT.DEFAULT)
            .grab(true, false).create());
    loginCombo.add(IFTPConstants.LOGIN_ANONYMOUS);

    testButton = new Button(group, SWT.PUSH);
    testButton.setText(Messages.FTPConnectionPointPropertyDialog_LBL_Test);
    testButton.setLayoutData(GridDataFactory.fillDefaults()
            .hint(Math.max(
                    new PixelConverter(testButton).convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH),
                    testButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x), SWT.DEFAULT)
            .create());

    /* row 5 */
    createPasswordSection(group);

    /* row 6 */
    label = new Label(group, SWT.NONE);
    label.setLayoutData(GridDataFactory.swtDefaults()
            .hint(new PixelConverter(label).convertHorizontalDLUsToPixels(IDialogConstants.LABEL_WIDTH),
                    SWT.DEFAULT)
            .create());
    label.setText(StringUtils.makeFormLabel(Messages.FTPConnectionPointPropertyDialog_LBL_RemotePath));

    remotePathText = new Text(group, SWT.SINGLE | SWT.BORDER);
    remotePathText.setLayoutData(GridDataFactory.swtDefaults()
            .hint(convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH), SWT.DEFAULT)
            .grab(true, false).create());

    browseButton = new Button(group, SWT.PUSH);
    browseButton.setText('&' + StringUtils.ellipsify(CoreStrings.BROWSE));
    browseButton.setLayoutData(GridDataFactory.fillDefaults()
            .hint(Math.max(
                    new PixelConverter(browseButton)
                            .convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH),
                    browseButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x), SWT.DEFAULT)
            .create());

    /* row 7 */
    optionsExpandable = new ExpandableComposite(container, SWT.NONE,
            ExpandableComposite.TWISTIE | ExpandableComposite.FOCUS_TITLE);
    optionsExpandable.setText(Messages.FTPConnectionPointPropertyDialog_LBL_Options);
    optionsExpandable.setLayoutData(GridDataFactory.fillDefaults().span(2, 1).grab(true, true).create());
    Group optionsGroup = new Group(optionsExpandable, SWT.NONE);
    optionsGroup.setLayout(GridLayoutFactory.fillDefaults().create());

    createAdvancedOptions(optionsGroup);

    optionsExpandable.setClient(optionsGroup);
    optionsExpandable.addExpansionListener(new ExpansionAdapter() {
        public void expansionStateChanged(ExpansionEvent e) {
            layoutShell();
        }
    });

    /* row 8 */
    progressMonitorPart = new ProgressMonitorPart(container, GridLayoutFactory.fillDefaults().create());
    progressMonitorPart
            .setLayoutData(GridDataFactory.fillDefaults().grab(true, false).exclude(true).span(2, 1).create());

    /* -- */
    addListeners();

    passwordText.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            e.doit = false;
            testConnection();
        }
    });

    testButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            if (testConnection()) {
                MessageDialog.openInformation(getShell(),
                        Messages.FTPConnectionPointPropertyDialog_Succeed_Title, StringUtils.format(
                                Messages.FTPConnectionPointPropertyDialog_Succeed_Message, hostText.getText()));
            }
        }
    });

    browseButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            browseConnection();
        }
    });

    if (ftpConnectionPoint == null) {
        isNew = true;
        ftpConnectionPoint = getOrCreateConnectionPoint(getConnectionPointType());
        ftpConnectionPoint.setName(DEFAULT_NAME);
    } else {
        originalFtpConnectionPoint = ftpConnectionPoint;
    }
    loadPropertiesFrom(ftpConnectionPoint);
    connectionTested = !isNew;

    return dialogArea;
}

From source file:com.aptana.ide.update.portal.clients.PluginsManager.java

License:Open Source License

public static void install(String pluginId) {
    Plugin plugin = FeatureUtil.findRemotePlugin(pluginId);
    if (plugin == null) {
        MessageDialog.openError(Display.getDefault().getActiveShell(),
                Messages.PluginsManager_ERR_TTL_Unable_find_plugin,
                Messages.PluginsManager_ERR_MSG_Unable_find_plugin + pluginId);
        return;//from   w  w  w .ja v a 2s . com
    }
    if (FeatureUtil.isInstalled(pluginId)) {
        MessageDialog.openInformation(Display.getDefault().getActiveShell(),
                Messages.PluginsManager_TTL_Plugin_already_installed,
                Messages.PluginsManager_INF_MSG_Feature_selected_already_installed);
        return;
    }
    try {
        getPluginManager().install(new Plugin[] { plugin }, new NullProgressMonitor());
    } catch (PluginManagerException e) {
        IdeLog.logError(Activator.getDefault(), e.getMessage(), e);
        MessageDialog.openError(Display.getDefault().getActiveShell(),
                Messages.PluginsManager_ERR_TTL_Unable_install_plugin,
                Messages.PluginsManager_ERR_MSG_Unable_install_plugin + pluginId);
    }
}

From source file:com.aptana.ide.wizards.LibraryImportWizard.java

License:Open Source License

/**
 * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench,
 *      org.eclipse.jface.viewers.IStructuredSelection)
 *//*from  w  ww .jav a 2  s .c o  m*/
public void init(IWorkbench workbench, IStructuredSelection s) {
    Object firstItem = s.getFirstElement();

    if (firstItem instanceof IProject) {
        this._project = (IProject) firstItem;
    } else {
        _project = null;
        MessageDialog.openInformation(workbench.getActiveWorkbenchWindow().getShell(),
                Messages.LibraryImportWizard_ImportJavaScriptLibrary,
                Messages.LibraryImportWizard_CanOnlyImportIntoTopLevel);
    }
}

From source file:com.aptana.jira.ui.preferences.JiraPreferencePageProvider.java

License:Open Source License

private Composite createLoginComponents(Composite parent) {
    Composite loginComp = new Composite(parent, SWT.NONE);
    loginComp.setLayout(GridLayoutFactory.swtDefaults().numColumns(3).create());

    Label label = new Label(loginComp, SWT.NONE);
    label.setText(StringUtil.makeFormLabel(Messages.JiraPreferencePageProvider_LBL_Username));
    label.setLayoutData(GridDataFactory.swtDefaults().create());

    ModifyListener modifyListener = new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            updateButtonStates();/*from   w  ww.j  a  va 2 s .co  m*/
        }
    };
    usernameText = new Text(loginComp, SWT.BORDER);
    usernameText.setLayoutData(
            GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).create());
    usernameText.addModifyListener(modifyListener);

    testButton = new Button(loginComp, SWT.NONE);
    testButton.setText(Messages.JiraPreferencePageProvider_LBL_Validate);
    testButton.setLayoutData(
            GridDataFactory.swtDefaults().hint(getButtonWidthHint(testButton), SWT.DEFAULT).create());
    testButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (login(true)) {
                // shows a success message
                MessageDialog.openInformation(UIUtils.getActiveShell(),
                        Messages.JiraPreferencePageProvider_Success_Title,
                        Messages.JiraPreferencePageProvider_Success_Message);
            }
        }
    });

    label = new Label(loginComp, SWT.NONE);
    label.setText(StringUtil.makeFormLabel(Messages.JiraPreferencePageProvider_LBL_Password));
    label.setLayoutData(GridDataFactory.swtDefaults().create());

    passwordText = new Text(loginComp, SWT.BORDER | SWT.PASSWORD);
    passwordText.setLayoutData(
            GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).create());
    passwordText.addModifyListener(modifyListener);

    createAccountButton = new Button(loginComp, SWT.NONE);
    createAccountButton.setText(StringUtil.ellipsify(Messages.JiraPreferencePageProvider_LBL_Signup));
    createAccountButton.setLayoutData(
            GridDataFactory.swtDefaults().hint(getButtonWidthHint(createAccountButton), SWT.DEFAULT).create());
    createAccountButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            WorkbenchBrowserUtil.launchExternalBrowser(SIGNUP_URL);
        }
    });

    KeyListener keyListener = new KeyListener() {

        public void keyPressed(KeyEvent e) {
            if (e.character == SWT.CR || e.character == SWT.KEYPAD_CR) {
                if (testButton.isEnabled()) {
                    login(true);
                }
            }
        }

        public void keyReleased(KeyEvent e) {
        }
    };
    usernameText.addKeyListener(keyListener);
    passwordText.addKeyListener(keyListener);

    updateButtonStates();
    adjustWidth();

    return loginComp;
}

From source file:com.aptana.js.debug.ui.internal.actions.OpenScriptSourceAction.java

License:Open Source License

/**
 * @see org.eclipse.jface.action.IAction#run()
 *//*from  w  w w.j  a  va  2s.co m*/
public void run() {
    if (scriptElement == null) {
        selectionChanged(getStructuredSelection());
        if (scriptElement == null) {
            return;
        }
    }
    URI location = scriptElement.getLocation();
    if (location == null) {
        return;
    }
    int lineNumber = scriptElement.getBaseLine();

    try {
        Object sourceElement = DebugUITools.lookupSource(scriptElement, getSourceLocator(scriptElement))
                .getSourceElement();
        IEditorInput editorInput = SourceDisplayUtil.getEditorInput(sourceElement);
        if (editorInput != null) {
            SourceDisplayUtil.openInEditor(editorInput, lineNumber);
            return;
        }
        MessageDialog.openInformation(UIUtils.getActiveShell(), Messages.OpenScriptSourceAction_Information,
                MessageFormat.format(Messages.OpenScriptSourceAction_SourceNotFoundFor_0, location.getPath()));
    } catch (CoreException e) {
        DebugUiPlugin.errorDialog(Messages.OpenScriptSourceAction_ExceptionWhileOpeningScriptSource, e);
    }
}

From source file:com.aptana.js.debug.ui.internal.InstallDebuggerPromptStatusHandler.java

License:Open Source License

/**
 * @see org.eclipse.debug.core.IStatusHandler#handleStatus(org.eclipse.core.runtime.IStatus, java.lang.Object)
 *///from   w  w w.  j  a  v  a2 s .  co m
public Object handleStatus(IStatus status, Object source) throws CoreException {
    Shell shell = UIUtils.getActiveShell();
    String title = Messages.InstallDebuggerPromptStatusHandler_InstallDebuggerExtension;

    if ("install".equals(source)) { //$NON-NLS-1$
        MessageDialog.openInformation(shell, title,
                Messages.InstallDebuggerPromptStatusHandler_WaitbrowserLaunches_AcceptExtensionInstallation_Quit);
        return null;
    } else if ("postinstall".equals(source)) { //$NON-NLS-1$
        MessageDialog.openInformation(shell, title,
                Messages.InstallDebuggerPromptStatusHandler_WaitbrowserLaunches_Quit);
        return null;
    } else if ("nopdm".equals(source)) { //$NON-NLS-1$
        MessageDialog md = new MessageDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                title, null, Messages.InstallDebuggerPromptStatusHandler_PDMNotInstalled, MessageDialog.WARNING,
                new String[] { StringUtil.ellipsify(Messages.InstallDebuggerPromptStatusHandler_Download),
                        CoreStrings.CONTINUE, CoreStrings.CANCEL, CoreStrings.HELP },
                0);
        switch (md.open()) {
        case 0:
            WorkbenchBrowserUtil.launchExternalBrowser(URL_INSTALL_PDM, "org.eclipse.ui.browser.ie"); //$NON-NLS-1$
            return Boolean.TRUE;
        case 1:
            return Boolean.TRUE;
        case 3:
            WorkbenchBrowserUtil.launchExternalBrowser(URL_DOCS_INSTALL_IE_DEBUGGER);
            return Boolean.TRUE;
        default:
            break;
        }
        return null;
    } else if (source instanceof String && ((String) source).startsWith("quit_")) { //$NON-NLS-1$
        MessageDialog.openInformation(shell, title, MessageFormat.format(
                Messages.InstallDebuggerPromptStatusHandler_BrowserIsRunning, ((String) source).substring(5)));
        return null;
    } else if (source instanceof String && ((String) source).startsWith("installed_")) { //$NON-NLS-1$
        MessageDialog.openInformation(shell, title,
                MessageFormat.format(Messages.InstallDebuggerPromptStatusHandler_ExtensionInstalled,
                        ((String) source).substring(10)));
        return null;
    } else if (source instanceof String && ((String) source).startsWith("warning_")) { //$NON-NLS-1$
        MessageDialog.openWarning(shell, title, ((String) source).substring(8));
        return null;
    } else if (source instanceof String && ((String) source).startsWith("failed_")) { //$NON-NLS-1$
        MessageDialog md = new MessageDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                title, null,
                MessageFormat.format(Messages.InstallDebuggerPromptStatusHandler_ExtensionInstallFailed,
                        new Object[] { ((String) source).substring(7) }),
                MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL, CoreStrings.HELP }, 0);
        while (true) {
            switch (md.open()) {
            case IDialogConstants.OK_ID:
                return null;
            default:
                break;
            }
            String urlString = (((String) source).indexOf("Internet Explorer") != -1) //$NON-NLS-1$
                    ? URL_DOCS_INSTALL_IE_DEBUGGER
                    : URL_DOCS_INSTALL_DEBUGGER;
            WorkbenchBrowserUtil.launchExternalBrowser(urlString);
        }
    }
    IPreferenceStore store = JSDebugUIPlugin.getDefault().getPreferenceStore();

    String pref = store.getString(IJSDebugUIConstants.PREF_INSTALL_DEBUGGER);
    if (pref != null) {
        if (pref.equals(MessageDialogWithToggle.ALWAYS)) {
            return Boolean.TRUE;
        }
    }
    String message = MessageFormat.format(Messages.InstallDebuggerPromptStatusHandler_ExtensionNotInstalled,
            (String) source);

    MessageDialogWithToggle dialog = new MessageDialogWithToggle(shell, title, null, message,
            MessageDialog.INFORMATION,
            new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, CoreStrings.HELP }, 2, null,
            false);
    dialog.setPrefKey(IJSDebugUIConstants.PREF_INSTALL_DEBUGGER);
    dialog.setPrefStore(store);

    while (true) {
        switch (dialog.open()) {
        case IDialogConstants.YES_ID:
            return Boolean.TRUE;
        case IDialogConstants.NO_ID:
            return Boolean.FALSE;
        default:
            break;
        }
        String urlString = (((String) source).indexOf("Internet Explorer") != -1) //$NON-NLS-1$
                ? URL_DOCS_INSTALL_IE_DEBUGGER
                : URL_DOCS_INSTALL_DEBUGGER;
        WorkbenchBrowserUtil.launchExternalBrowser(urlString);
    }
}

From source file:com.aptana.php.debug.ui.launching.PathMappingConfigurationTab.java

License:Open Source License

public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout(1, false));
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));

    Label msg1 = new Label(composite, SWT.WRAP);
    msg1.setText(PathMappingMessages.PathMappingConfigurationTab_mappingTableDescription);
    msg1.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Link link = new Link(composite, SWT.NONE);
    link.setText(PathMappingMessages.PathMappingConfigurationTab_changeMappingLink);
    link.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    link.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            IServer server = getServer();
            if (server != null) {
                PathMapperDialog dialog = new PathMapperDialog(getShell(), server);
                if (dialog.open() == Window.OK) {
                    // Notify the change to all other launch configurations that use this server.
                    PathMappingUpdater pathMappingUpdater = new PathMappingUpdater();
                    pathMappingUpdater.updatePaths(server, new String[] { workingCopy.getName() });
                    // We must set the working copy with the new values before we call for an update on the rest of
                    // the tabs
                    // The same rules also apply here. We should not modify the working copy if it does not use a
                    // specific file
                    // or does not auto-generate the script when using a specific file.
                    try {
                        if (workingCopy.getAttribute(IPHPDebugCorePreferenceKeys.ATTR_USE_SPECIFIC_FILE, false)
                                && workingCopy.getAttribute(IPHPDebugCorePreferenceKeys.ATTR_AUTO_GENERATED_URL,
                                        false)) {
                            // Update the current launch config
                            PathMappingUpdater.updateConfigurations(Arrays.asList(workingCopy), server);
                            // Update the preview table and the other tabs
                            ILaunchConfigurationTab[] tabs = getLaunchConfigurationDialog().getTabs();
                            for (ILaunchConfigurationTab tab : tabs) {
                                tab.initializeFrom(workingCopy);
                            }//from  w w w. j a  v a 2s.  c  o m
                        } else {
                            // just update this tab (this will update the preview table)
                            initializeFrom(workingCopy);
                        }
                    } catch (CoreException ce) {
                        PHPDebugEPLPlugin.logError("Error updating the configurations", ce); //$NON-NLS-1$
                    }
                }
            } else {
                MessageDialog.openInformation(getShell(),
                        PathMappingMessages.PathMappingConfigurationTab_noServersDialogTitle,
                        PathMappingMessages.PathMappingConfigurationTab_noServersDialogMessage);
            }
        }
    });
    // Add the path mapper table preview
    pathMappingPreview = new PathMappingComposite(composite, SWT.NO_FOCUS, false);
    pathMappingPreview.setLayoutData(new GridData(GridData.FILL_BOTH));

    // // Add the debug link preview at the bottom
    // Label l = new Label(composite, SWT.WRAP);
    // link.setText("test test test test test test test test test vtest ");
    // link.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    setControl(composite);
}