Example usage for org.eclipse.jface.resource JFaceResources DIALOG_FONT

List of usage examples for org.eclipse.jface.resource JFaceResources DIALOG_FONT

Introduction

In this page you can find the example usage for org.eclipse.jface.resource JFaceResources DIALOG_FONT.

Prototype

String DIALOG_FONT

To view the source code for org.eclipse.jface.resource JFaceResources DIALOG_FONT.

Click Source Link

Document

The symbolic font name for the dialog font (value "org.eclipse.jface.dialogfont").

Usage

From source file:org.org.eclipse.core.utils.platform.dialogs.Dialog.java

License:Open Source License

/**
 * Return whether or not the dialog font is currently the same as the default font.
 * //from   w w w.  j  av  a  2 s .c o m
 * @return boolean if the two are the same
 */
protected static boolean dialogFontIsDefault() {
    FontData[] dialogFontData = JFaceResources.getFontRegistry().getFontData(JFaceResources.DIALOG_FONT);
    FontData[] defaultFontData = JFaceResources.getFontRegistry().getFontData(JFaceResources.DEFAULT_FONT);
    return Arrays.equals(dialogFontData, defaultFontData);
}

From source file:org.pdtextensions.semanticanalysis.ui.preferences.validation.SemanticAnalysisConfigurationBlock.java

License:Open Source License

protected ExpandableComposite createGroup(int numColumns, Composite parent, String label) {
    ExpandableComposite excomposite = new ExpandableComposite(parent, SWT.NONE,
            ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT);
    excomposite.setText(label);//from  w w  w.j ava  2s .c o  m
    excomposite.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
    excomposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 3, 1));
    excomposite.setExpanded(true);
    excomposite.addExpansionListener(new ExpansionAdapter() {
        public void expansionStateChanged(ExpansionEvent e) {
            expandedStateChanged((ExpandableComposite) e.getSource());
        }
    });

    return excomposite;
}

From source file:org.robotframework.ide.eclipse.main.plugin.preferences.ValidationPreferencePage.java

License:Apache License

private ExpandableComposite createExpandableSection(final Composite parent, final ProblemCategoryType type) {
    final ExpandableComposite section = new ExpandableComposite(parent,
            ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
    section.setText(type.getName());//ww w. ja  v a  2  s .  c o m
    section.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
    GridDataFactory.fillDefaults().grab(true, false).span(3, SWT.DEFAULT).hint(900, SWT.DEFAULT)
            .applyTo(section);
    section.addExpansionListener(new ExpansionAdapter() {

        @Override
        public void expansionStateChanged(final ExpansionEvent e) {
            preferencesSettings.put(type.name(), (boolean) e.data);
            final ScrolledContent scrolled = getParentScrolledComposite((ExpandableComposite) e.getSource());
            if (scrolled != null) {
                scrolled.reflow(true);
            }
        }
    });
    section.setExpanded(preferencesSettings.getBoolean(type.name()));
    return section;
}

From source file:org.rssowl.ui.internal.dialogs.fatal.CleanProfilePage.java

License:Open Source License

public void createControl(Composite parent) {

    /* Title Image and Message */
    setImageDescriptor(OwlUI.getImageDescriptor("icons/wizban/welcome_wiz.gif")); //$NON-NLS-1$
    if (!fErrorStatus.isOK())
        setMessage(Messages.CleanProfilePage_RSSOWL_CRASH, IMessageProvider.WARNING);
    else/*from ww w .  j  a  v a 2 s.c o  m*/
        setMessage(fHasOPMLBackup ? Messages.CleanProfilePage_CLEAN_TEXT_OPML_OK
                : Messages.CleanProfilePage_CLEAN_TEXT_OK, IMessageProvider.INFORMATION);

    /* Container */
    Composite container = new Composite(parent, SWT.NONE);
    container.setLayout(LayoutUtils.createGridLayout(1, 5, 5));
    ((GridLayout) container.getLayout()).marginBottom = 10;

    /* Recover Information */
    {
        Label recoverInfoLabel = new Label(container, SWT.NONE);
        recoverInfoLabel.setText(fHasOPMLBackup ? Messages.CleanProfilePage_RESTORING_SUBSCRIPTIONS_SETTINGS
                : Messages.CleanProfilePage_STARTING_OVER);
        recoverInfoLabel.setFont(OwlUI.getBold(JFaceResources.DIALOG_FONT));
        recoverInfoLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));

        Label recoverInfoTextLabel = new Label(container, SWT.WRAP);
        if (fHasOPMLBackup)
            recoverInfoTextLabel.setText(Messages.CleanProfilePage_OPML_BACKUP_INFO);
        else
            recoverInfoTextLabel.setText(Messages.CleanProfilePage_NO_BACKUPS);
        recoverInfoTextLabel.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
        ((GridData) recoverInfoTextLabel.getLayoutData()).widthHint = 200;

        fDoRecoverCheck = new Button(container, SWT.CHECK);
        fDoRecoverCheck.setText(fHasOPMLBackup ? Messages.CleanProfilePage_RESTORE_SUBSCRIPTIONS_SETTINGS
                : Messages.CleanProfilePage_START_OVER);
        fDoRecoverCheck.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
        ((GridData) fDoRecoverCheck.getLayoutData()).verticalIndent = 5;
        ((GridData) fDoRecoverCheck.getLayoutData()).horizontalIndent = 5;
        fDoRecoverCheck.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                getContainer().updateButtons();
                fConfirmWarningCheck.setEnabled(fDoRecoverCheck.getSelection());
            }
        });
    }

    /* Recover Advise */
    {
        Label adviseLabel = new Label(container, SWT.NONE);
        adviseLabel.setText(Messages.CleanProfilePage_CAUTION);
        adviseLabel.setFont(OwlUI.getBold(JFaceResources.DIALOG_FONT));
        adviseLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));
        ((GridData) adviseLabel.getLayoutData()).verticalIndent = 10;

        Label adviseTextLabel = new Label(container, SWT.WRAP);
        if (fHasOPMLBackup)
            adviseTextLabel.setText(Messages.CleanProfilePage_CAUTION_TEXT_RESTORE);
        else
            adviseTextLabel.setText(Messages.CleanProfilePage_CAUTION_TEXT_START_OVER);
        adviseTextLabel.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
        ((GridData) adviseTextLabel.getLayoutData()).widthHint = 200;

        fConfirmWarningCheck = new Button(container, SWT.CHECK);
        fConfirmWarningCheck.setText(Messages.CleanProfilePage_CONFIRM_TEXT);
        fConfirmWarningCheck.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
        ((GridData) fConfirmWarningCheck.getLayoutData()).verticalIndent = 5;
        ((GridData) fConfirmWarningCheck.getLayoutData()).horizontalIndent = 5;
        fConfirmWarningCheck.setEnabled(false);
        fConfirmWarningCheck.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                getContainer().updateButtons();
            }
        });
    }

    Dialog.applyDialogFont(container);

    setControl(container);
}

From source file:org.rssowl.ui.internal.dialogs.fatal.ErrorInfoPage.java

License:Open Source License

public void createControl(Composite parent) {

    /* Title Image and Message */
    setImageDescriptor(OwlUI.getImageDescriptor("icons/wizban/welcome_wiz.gif")); //$NON-NLS-1$
    setMessage(Messages.ErrorInfoPage_RSSOWL_CRASH, IMessageProvider.WARNING);

    /* Container */
    Composite container = new Composite(parent, SWT.NONE);
    container.setLayout(LayoutUtils.createGridLayout(1, 5, 5));
    if (!fHasNextPage)
        ((GridLayout) container.getLayout()).marginBottom = 5;

    /* Error Details */
    Label errorDetailsLabel = new Label(container, SWT.NONE);
    errorDetailsLabel.setText(Messages.ErrorInfoPage_ERROR_DETAILS);
    errorDetailsLabel.setFont(OwlUI.getBold(JFaceResources.DIALOG_FONT));
    errorDetailsLabel.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));

    String msg = null;//from   ww w. j a v a 2s .  c om

    /* Out of memory error */
    if (fErrorStatus.getException() instanceof OutOfMemoryError) {
        if (StringUtils.isSet(fErrorStatus.getMessage()))
            msg = NLS.bind(Messages.ErrorInfoPage_OOM_ERROR_N, fErrorStatus.getMessage());
        else
            msg = Messages.ErrorInfoPage_OOM_ERROR;
    }

    /* Profile Locked by another Instance */
    else if (fErrorStatus.getException() instanceof ProfileLockedException) {
        if (StringUtils.isSet(fErrorStatus.getMessage()))
            msg = NLS.bind(Messages.ErrorInfoPage_LOCKED_ERROR_N, fErrorStatus.getMessage());
        else
            msg = Messages.ErrorInfoPage_LOCKED_ERROR;
    }

    /* Any other error */
    else {
        if (StringUtils.isSet(fErrorStatus.getMessage()))
            msg = NLS.bind(Messages.ErrorInfoPage_STARTUP_ERROR_N, fErrorStatus.getMessage());
        else
            msg = Messages.ErrorInfoPage_STARTUP_ERROR;
    }

    final Label errorDetailsTextLabel = new Label(container, SWT.WRAP);
    errorDetailsTextLabel.setText(msg);
    errorDetailsTextLabel.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    ((GridData) errorDetailsTextLabel.getLayoutData()).widthHint = 200;

    /* Context Menu to copy the error message */
    fCopyMenu = new Menu(errorDetailsTextLabel.getShell(), SWT.POP_UP);
    MenuItem copyItem = new MenuItem(fCopyMenu, SWT.PUSH);
    copyItem.setText(Messages.ErrorInfoPage_COPY);
    copyItem.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            OwlUI.getClipboard(fCopyMenu.getDisplay()).setContents(
                    new Object[] { errorDetailsTextLabel.getText() },
                    new Transfer[] { TextTransfer.getInstance() });
        }
    });
    errorDetailsTextLabel.setMenu(fCopyMenu);

    /* Report Crash (not for OutOfMemory and ProfileLockedException  */
    if (!(fErrorStatus.getException() instanceof ProfileLockedException)
            && !(fErrorStatus.getException() instanceof OutOfMemoryError)) {
        Label crashReportLabel = new Label(container, SWT.NONE);
        crashReportLabel.setText(Messages.ErrorInfoPage_LET_US_KNOW);
        crashReportLabel.setFont(OwlUI.getBold(JFaceResources.DIALOG_FONT));
        crashReportLabel.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
        ((GridData) crashReportLabel.getLayoutData()).verticalIndent = 10;

        Link crashReportTextLabel = new Link(container, SWT.WRAP);
        crashReportTextLabel.setText(Messages.ErrorInfoPage_SEND_LOGS_ADVISE);
        crashReportTextLabel.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
        crashReportTextLabel.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                try {
                    if ("save".equals(e.text)) //$NON-NLS-1$
                        OwlUI.saveCrashReport(getShell());
                    else
                        BrowserUtils.sendErrorLog();
                } catch (Throwable t) {
                    setMessage(t.getMessage(), IMessageProvider.ERROR);
                }
            }
        });
    }

    /* Further Steps */
    {
        Label furtherStepsLabel = new Label(container, SWT.NONE);
        furtherStepsLabel.setText(Messages.ErrorInfoPage_FURTHER_STEPS);
        furtherStepsLabel.setFont(OwlUI.getBold(JFaceResources.DIALOG_FONT));
        furtherStepsLabel.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
        ((GridData) furtherStepsLabel.getLayoutData()).verticalIndent = 10;

        Link moreInfoLabel = new Link(container, SWT.WRAP);
        if (fErrorStatus.getException() instanceof ProfileLockedException)
            moreInfoLabel.setText(Messages.ErrorInfoPage_LOCKED_PROFILE_ADVISE);
        else
            moreInfoLabel.setText(fHasNextPage ? Messages.ErrorInfoPage_NEXT_PAGE_ADVISE
                    : Messages.ErrorInfoPage_GENERAL_ERROR_ADVISE);
        moreInfoLabel.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
        ((GridData) moreInfoLabel.getLayoutData()).widthHint = 200;

        moreInfoLabel.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                try {
                    if ("faq".equals(e.text)) //$NON-NLS-1$
                        BrowserUtils.openFAQ(fErrorStatus);
                    else if ("forum".equals(e.text)) //$NON-NLS-1$
                        BrowserUtils.openHelpForum(fErrorStatus);
                } catch (Throwable t) {
                    setMessage(t.getMessage(), IMessageProvider.ERROR);
                }
            }
        });
    }

    Dialog.applyDialogFont(container);

    setControl(container);
}

From source file:org.rssowl.ui.internal.dialogs.fatal.RecreateSearchIndexPage.java

License:Open Source License

public void createControl(Composite parent) {

    /* Title Image and Message */
    setImageDescriptor(OwlUI.getImageDescriptor("icons/wizban/welcome_wiz.gif")); //$NON-NLS-1$
    setMessage(Messages.RecreateSearchIndexPage_RSSOWL_CRASH, IMessageProvider.WARNING);

    /* Container */
    Composite container = new Composite(parent, SWT.NONE);
    container.setLayout(LayoutUtils.createGridLayout(1, 5, 5));
    ((GridLayout) container.getLayout()).marginBottom = 10;

    /* Recreate Information */
    {/*from w w w  . j a v a 2  s .c  om*/
        Label recoverInfoLabel = new Label(container, SWT.NONE);
        recoverInfoLabel.setText(Messages.RecreateSearchPage_RECREATING_SEARCH_INDEX);
        recoverInfoLabel.setFont(OwlUI.getBold(JFaceResources.DIALOG_FONT));
        recoverInfoLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));

        Label recoverInfoTextLabel = new Label(container, SWT.WRAP);
        if (Application.IS_WINDOWS)
            recoverInfoTextLabel.setText(Messages.RecreateSearchPage_RECREATING_DETAILS_RESTART);
        else
            recoverInfoTextLabel.setText(Messages.RecreateSearchPage_RECREATING_DETAILS_QUIT);
        recoverInfoTextLabel.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
        ((GridData) recoverInfoTextLabel.getLayoutData()).widthHint = 200;
    }

    /* Recreate Advise */
    {
        Label adviseLabel = new Label(container, SWT.NONE);
        adviseLabel.setText(Messages.RecreateSearchPage_INFORMATION);
        adviseLabel.setFont(OwlUI.getBold(JFaceResources.DIALOG_FONT));
        adviseLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));
        ((GridData) adviseLabel.getLayoutData()).verticalIndent = 10;

        Label adviseTextLabel = new Label(container, SWT.WRAP);
        adviseTextLabel.setText(Messages.RecreateSearchPage_RECREATING_INFORMATION);
        adviseTextLabel.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
        ((GridData) adviseTextLabel.getLayoutData()).widthHint = 200;
    }

    Dialog.applyDialogFont(container);

    setControl(container);
}

From source file:org.rssowl.ui.internal.dialogs.fatal.RestoreBackupPage.java

License:Open Source License

public void createControl(Composite parent) {

    /* Title Image and Message */
    setImageDescriptor(OwlUI.getImageDescriptor("icons/wizban/welcome_wiz.gif")); //$NON-NLS-1$
    if (!fErrorStatus.isOK())
        setMessage(Messages.RestoreBackupPage_RSSOWL_CRASH, IMessageProvider.WARNING);
    else//from   w  ww  .j  a v  a 2  s.com
        setMessage(Messages.RestoreBackupPage_RESTORE_TEXT_OK, IMessageProvider.INFORMATION);

    /* Container */
    Composite container = new Composite(parent, SWT.NONE);
    container.setLayout(LayoutUtils.createGridLayout(2, 5, 5));
    ((GridLayout) container.getLayout()).marginBottom = 10;

    /* Restore Information */
    {
        Label backupInfoLabel = new Label(container, SWT.NONE);
        backupInfoLabel.setText(Messages.RestoreBackupPage_RESTORING_A_BACKUP);
        backupInfoLabel.setFont(OwlUI.getBold(JFaceResources.DIALOG_FONT));
        backupInfoLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false, 2, 1));

        Label backupTextLabel = new Label(container, SWT.WRAP);
        backupTextLabel.setText(
                Application.IS_WINDOWS && !fErrorStatus.isOK() ? Messages.RestoreBackupPage_BACKUP_INFO_RESTART
                        : Messages.RestoreBackupPage_BACKUP_INFO_QUIT);
        backupTextLabel.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false, 2, 1));
        ((GridData) backupTextLabel.getLayoutData()).widthHint = 200;
    }

    /* Current Profile Info */
    Pair<File, Long> pair = InternalOwl.getDefault().getProfile();
    File profile = pair.getFirst();
    if (profile != null && profile.exists()) {
        Label currentProfileLabel = new Label(container, SWT.NONE);
        currentProfileLabel.setText(Messages.RestoreBackupPage_CURRENT_PROFILE);
        currentProfileLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));
        ((GridData) currentProfileLabel.getLayoutData()).verticalIndent = 5;

        Long timestamp = (pair.getSecond() != null) ? pair.getSecond() : profile.lastModified();

        Label currentProfileTextLabel = new Label(container, SWT.NONE);
        currentProfileTextLabel.setText(NLS.bind(Messages.RestoreBackupPage_LAST_MODIFIED,
                fDateFormat.format(timestamp), OwlUI.getSize((int) profile.length())));
        currentProfileTextLabel.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
        ((GridData) currentProfileTextLabel.getLayoutData()).verticalIndent = 5;
    }

    /* Restore Controls */
    {
        Label chooseBackupLabel = new Label(container, SWT.NONE);
        chooseBackupLabel.setText(Messages.RestoreBackupPage_CHOOSE_BACKUP);
        chooseBackupLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));

        fBackupsViewer = new ComboViewer(container, SWT.BORDER | SWT.READ_ONLY);
        fBackupsViewer.getControl().setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));
        fBackupsViewer.getCombo().setVisibleItemCount(fBackups.size());
        fBackupsViewer.setContentProvider(new ArrayContentProvider());
        fBackupsViewer.setLabelProvider(new LabelProvider() {
            @Override
            public String getText(Object element) {
                File file = (File) element;
                return NLS.bind(Messages.RestoreBackupPage_BACKUP_LABEL,
                        fDateFormat.format(file.lastModified()), OwlUI.getSize((int) file.length()));
            }
        });

        fBackupsViewer.addSelectionChangedListener(new ISelectionChangedListener() {
            public void selectionChanged(SelectionChangedEvent event) {
                getContainer().updateButtons();
                fConfirmRestoreCheck.setEnabled(!event.getSelection().isEmpty());
            }
        });

        fBackupsViewer.setInput(fBackups);
    }

    /* Restore Advise */
    {
        Composite adviseContainer = new Composite(container, SWT.None);
        adviseContainer.setLayout(LayoutUtils.createGridLayout(1, 0, 0));
        adviseContainer.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false, 2, 1));
        ((GridData) adviseContainer.getLayoutData()).verticalIndent = 5;

        Label adviseLabel = new Label(adviseContainer, SWT.NONE);
        adviseLabel.setText(Messages.RestoreBackupPage_CAUTION);
        adviseLabel.setFont(OwlUI.getBold(JFaceResources.DIALOG_FONT));
        adviseLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));

        Label adviseTextLabel = new Label(adviseContainer, SWT.WRAP);
        adviseTextLabel.setText(Messages.RestoreBackupPage_RESTORE_WARNING);
        adviseTextLabel.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
        ((GridData) adviseTextLabel.getLayoutData()).widthHint = 200;

        fConfirmRestoreCheck = new Button(adviseContainer, SWT.CHECK);
        fConfirmRestoreCheck.setText(Messages.RestoreBackupPage_CONFIRM_RESTORE);
        fConfirmRestoreCheck.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
        ((GridData) fConfirmRestoreCheck.getLayoutData()).verticalIndent = 5;
        ((GridData) fConfirmRestoreCheck.getLayoutData()).horizontalIndent = 5;
        fConfirmRestoreCheck.setEnabled(false);
        fConfirmRestoreCheck.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                getContainer().updateButtons();
            }
        });
    }

    Dialog.applyDialogFont(container);

    setControl(container);
}

From source file:org.rssowl.ui.internal.dialogs.FatalOutOfMemoryErrorDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {

    /* Composite to hold all components */
    Composite composite = new Composite((Composite) super.createDialogArea(parent), SWT.NONE);
    composite.setLayout(LayoutUtils.createGridLayout(2, 5, 10, 15, 5, false));
    composite.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));

    /* Title *//*  w  w  w. j  a v a  2 s.c o  m*/
    setTitle(Messages.StartupErrorDialog_WE_SORRY);

    /* Title Image */
    setTitleImage(OwlUI.getImage(fResources, "icons/wizban/welcome_wiz.gif")); //$NON-NLS-1$

    /* Title Message */
    setMessage(Messages.FatalOutOfMemoryErrorDialog_RSSOWL_CRASHED_OOM, IMessageProvider.WARNING);

    /* Recovery Label */
    Link recoveryMessageLabel = new Link(composite, SWT.WRAP);
    recoveryMessageLabel.setText(Messages.FatalOutOfMemoryErrorDialog_CRASH_ADVISE_OOM);
    recoveryMessageLabel.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false, 2, 1));
    recoveryMessageLabel.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            try {
                if ("faq".equals(e.text)) //$NON-NLS-1$
                    BrowserUtils.openFAQ(fErrorStatus);
                else if ("forum".equals(e.text)) //$NON-NLS-1$
                    BrowserUtils.openHelpForum(fErrorStatus);
            } catch (Throwable t) {
                setMessage(t.getMessage(), IMessageProvider.ERROR);
            }
        }
    });

    /* Crash Report Label */
    Link dialogMessageLabel = new Link(composite, SWT.WRAP);
    dialogMessageLabel.setText(Messages.FatalOutOfMemoryErrorDialog_CRASH_DIAGNOSE_OOM);
    dialogMessageLabel.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false, 2, 1));
    dialogMessageLabel.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            try {
                if ("save".equals(e.text)) //$NON-NLS-1$
                    OwlUI.saveCrashReport(getShell());
                else
                    BrowserUtils.sendErrorLog();
            } catch (Throwable t) {
                setMessage(t.getMessage(), IMessageProvider.ERROR);
            }
        }
    });

    /* Error Details Label */
    Label reasonLabel = new Label(composite, SWT.NONE);
    reasonLabel.setText(Messages.StartupErrorDialog_ERROR_DETAILS);
    reasonLabel.setFont(OwlUI.getBold(JFaceResources.DIALOG_FONT));
    reasonLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));

    Label errorDetailsLabel = new Label(composite, SWT.WRAP);
    if (StringUtils.isSet(fErrorStatus.getMessage()))
        errorDetailsLabel
                .setText(NLS.bind(Messages.FatalOutOfMemoryErrorDialog_OOM_ERROR_N, fErrorStatus.getMessage()));
    else
        errorDetailsLabel.setText(Messages.FatalOutOfMemoryErrorDialog_OOM_ERROR);
    errorDetailsLabel.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));

    /* Holder for the separator to the OK and Cancel buttons */
    Composite sepHolder = new Composite(parent, SWT.NONE);
    sepHolder.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    sepHolder.setLayout(LayoutUtils.createGridLayout(1, 0, 0));

    /* Separator */
    Label separator = new Label(sepHolder, SWT.SEPARATOR | SWT.HORIZONTAL);
    separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    applyDialogFont(composite);

    return composite;
}

From source file:org.rssowl.ui.internal.dialogs.preferences.BrowserPreferencePage.java

License:Open Source License

private void createBrowserOptions(Composite container) {
    Composite browserGroup = new Composite(container, SWT.None);
    browserGroup.setLayout(LayoutUtils.createGridLayout(1, 0, 0));
    browserGroup.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));

    /* Tabbed Browsing */
    {//from w  ww.  j  a  v  a 2  s . c  o  m
        Label label = new Label(browserGroup, SWT.NONE);
        label.setText(Messages.BrowserPreferencePage_BROWSER_SELECTION);
        label.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));

        /* Group */
        Composite group = new Composite(browserGroup, SWT.None);
        group.setLayout(LayoutUtils.createGridLayout(2, 7, 3));
        ((GridLayout) group.getLayout()).marginBottom = 5;
        group.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));

        /* Use internal Browser */
        fUseInternalBrowser = new Button(group, SWT.RADIO);
        fUseInternalBrowser.setText(Messages.BrowserPreferencePage_USE_EMBEDDED_BROWSER);
        fUseInternalBrowser.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, false, false, 2, 1));
        fUseInternalBrowser.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                updateEnablement();
            }
        });

        /* Use default external Browser */
        fUseDefaultExternalBrowser = new Button(group, SWT.RADIO);
        String name = getDefaultBrowserName();
        if (StringUtils.isSet(name))
            fUseDefaultExternalBrowser
                    .setText(NLS.bind(Messages.BrowserPreferencePage_USE_STANDARD_BROWSER_N, name));
        else
            fUseDefaultExternalBrowser.setText(Messages.BrowserPreferencePage_USE_STANDARD_BROWSER);

        fUseDefaultExternalBrowser.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, false, false, 2, 1));
        fUseDefaultExternalBrowser
                .setSelection(fGlobalScope.getBoolean(DefaultPreferences.USE_DEFAULT_EXTERNAL_BROWSER));

        /* Use custom external Browser */
        fUseCustomExternalBrowser = new Button(group, SWT.RADIO);
        fUseCustomExternalBrowser.setText(Messages.BrowserPreferencePage_USE_EXTERNAL_BROWSER);
        fUseCustomExternalBrowser.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, false, false, 2, 1));
        fUseCustomExternalBrowser
                .setSelection(fGlobalScope.getBoolean(DefaultPreferences.USE_CUSTOM_EXTERNAL_BROWSER));
        fUseCustomExternalBrowser.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                fCustomBrowserInput.setEnabled(fUseCustomExternalBrowser.getSelection());
                fCustomBrowserSearchButton.setEnabled(fUseCustomExternalBrowser.getSelection());
            }
        });

        fUseInternalBrowser.setSelection(
                !fUseDefaultExternalBrowser.getSelection() && !fUseCustomExternalBrowser.getSelection());

        fCustomBrowserInput = new Text(group, SWT.BORDER);
        OwlUI.makeAccessible(fCustomBrowserInput, fUseCustomExternalBrowser);
        fCustomBrowserInput.setEnabled(fUseCustomExternalBrowser.getSelection());
        fCustomBrowserInput.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));

        ControlDecoration controlDeco = new ControlDecoration(fCustomBrowserInput, SWT.LEFT | SWT.TOP);
        controlDeco.setImage(FieldDecorationRegistry.getDefault()
                .getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage());
        controlDeco.setDescriptionText(Messages.BrowserPreferencePage_BROWSER_PARAMETER_SUPPORT);
        controlDeco.setShowOnlyOnFocus(true);

        String customBrowserValue = fGlobalScope.getString(DefaultPreferences.CUSTOM_BROWSER_PATH);
        if (customBrowserValue != null)
            fCustomBrowserInput.setText(customBrowserValue);

        fCustomBrowserSearchButton = new Button(group, SWT.PUSH);
        fCustomBrowserSearchButton.setText(Messages.BrowserPreferencePage_BROWSE);
        Dialog.applyDialogFont(fCustomBrowserSearchButton);
        setButtonLayoutData(fCustomBrowserSearchButton);
        fCustomBrowserSearchButton.setEnabled(fUseCustomExternalBrowser.getSelection());
        fCustomBrowserSearchButton.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                FileDialog dialog = new FileDialog(getShell(), SWT.OPEN);
                dialog.setFileName(fCustomBrowserInput.getText());
                String path = dialog.open();
                if (path != null)
                    fCustomBrowserInput.setText(path);
            }
        });
    }

    /* Tabbed Browsing */
    {
        Label label = new Label(browserGroup, SWT.NONE);
        label.setText(Messages.BrowserPreferencePage_TABBED_BROWSING);
        label.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));

        /* Group */
        Composite group = new Composite(browserGroup, SWT.None);
        group.setLayout(LayoutUtils.createGridLayout(1, 7, 3));
        ((GridLayout) group.getLayout()).marginBottom = 5;
        group.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));

        fOpenLinksInNewTab = new Button(group, SWT.CHECK);
        fOpenLinksInNewTab.setText(Messages.BrowserPreferencePage_OPEN_LINKS_IN_TABS);
        fOpenLinksInNewTab.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, false, false));
        fOpenLinksInNewTab.setSelection(fGlobalScope.getBoolean(DefaultPreferences.OPEN_LINKS_IN_NEW_TAB));

        fReOpenBrowserTabs = new Button(group, SWT.CHECK);
        fReOpenBrowserTabs.setText(Messages.BrowserPreferencePage_REOPEN_WEBSITE);
        fReOpenBrowserTabs.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, false, false));
        fReOpenBrowserTabs.setSelection(fGlobalScope.getBoolean(DefaultPreferences.REOPEN_BROWSER_TABS));

        fLoadBrowserTabInBackground = new Button(group, SWT.CHECK);
        fLoadBrowserTabInBackground.setText(Messages.BrowserPreferencePage_OPEN_IN_BACKGROUND);
        fLoadBrowserTabInBackground.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, false, false));
        fLoadBrowserTabInBackground
                .setSelection(fGlobalScope.getBoolean(DefaultPreferences.OPEN_BROWSER_IN_BACKGROUND));

        fAlwaysReuseBrowser = new Button(group, SWT.CHECK);
        fAlwaysReuseBrowser.setText(Messages.BrowserPreferencePage_OPEN_IN_SAME_TAB);
        fAlwaysReuseBrowser.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, false, false, 2, 1));
        fAlwaysReuseBrowser.setSelection(fGlobalScope.getBoolean(DefaultPreferences.ALWAYS_REUSE_BROWSER));
    }

    /* Disable JavaScript in Browser / Popup Blocker */
    if (!Application.IS_WINDOWS || !CBrowser.isMozillaRunningOnWindows()) {
        Label label = new Label(browserGroup, SWT.NONE);
        label.setText(Messages.BrowserPreferencePage_CONTENT);
        label.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));

        /* Group */
        Composite group = new Composite(browserGroup, SWT.None);
        group.setLayout(LayoutUtils.createGridLayout(2, 7, 3));
        group.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));

        if (Application.IS_WINDOWS) {
            fEnablePopupBlockerCheck = new Button(group, SWT.CHECK);
            fEnablePopupBlockerCheck.setText(Messages.BrowserPreferencePage_BLOCK_POPUPS);
            fEnablePopupBlockerCheck.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, false, false, 2, 1));
            fEnablePopupBlockerCheck
                    .setSelection(fGlobalScope.getBoolean(DefaultPreferences.ENABLE_IE_POPUP_BLOCKER));
        }

        Composite jsContainer = new Composite(group, SWT.NONE);
        jsContainer.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, false, false, 2, 1));
        jsContainer.setLayout(LayoutUtils.createGridLayout(2, 0, 0));

        fDisableJavaScriptCheck = new Button(jsContainer, SWT.CHECK);
        fDisableJavaScriptCheck.setText(Messages.BrowserPreferencePage_DISABLE_JS);
        fDisableJavaScriptCheck.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, true));
        fDisableJavaScriptCheck.setSelection(fGlobalScope.getBoolean(DefaultPreferences.DISABLE_JAVASCRIPT));
        fDisableJavaScriptCheck.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                fDisableJavaScriptExceptionsButton.setEnabled(fDisableJavaScriptCheck.getSelection());
            }
        });

        fDisableJavaScriptExceptionsButton = new Button(jsContainer, SWT.PUSH);
        fDisableJavaScriptExceptionsButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, true));
        fDisableJavaScriptExceptionsButton.setText(Messages.BrowserPreferencePage_EXCEPTIONS);
        Dialog.applyDialogFont(fDisableJavaScriptExceptionsButton);
        setButtonLayoutData(fDisableJavaScriptExceptionsButton);
        fDisableJavaScriptExceptionsButton.setEnabled(fDisableJavaScriptCheck.getSelection());
        fDisableJavaScriptExceptionsButton.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                new WebsiteListDialog(getShell()).open();
            }
        });

        /* Info Container to Link to Internet Options */
        if (Application.IS_WINDOWS) {
            Composite infoContainer = new Composite(group, SWT.None);
            infoContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
            infoContainer.setLayout(LayoutUtils.createGridLayout(2, 0, 0));
            ((GridLayout) infoContainer.getLayout()).marginTop = 5;

            Label infoImg = new Label(infoContainer, SWT.NONE);
            infoImg.setImage(OwlUI.getImage(fResources, "icons/obj16/info.gif")); //$NON-NLS-1$
            infoImg.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));

            Link infoText = new Link(infoContainer, SWT.WRAP);
            infoText.setText(Messages.BrowserPreferencePage_INTERNET_OPTIONS);
            infoText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
            infoText.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(SelectionEvent e) {
                    Program.launch("inetcpl.cpl"); //$NON-NLS-1$
                }
            });
        }
    }

    updateEnablement();

    /* Enable Apply Button on Selection Changes */
    OwlUI.runOnSelection(new Runnable() {
        public void run() {
            updateApplyEnablement(true);
        }
    }, browserGroup);
}

From source file:org.rssowl.ui.internal.dialogs.preferences.FeedsPreferencePage.java

License:Open Source License

private void createReadingGroup(TabFolder parent) {
    Composite group = new Composite(parent, SWT.NONE);
    group.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    group.setLayout(LayoutUtils.createGridLayout(1, 10, 10));

    TabItem item = new TabItem(parent, SWT.None);
    item.setText(Messages.FeedsPreferencePage_READING);
    item.setControl(group);//w  w  w  .  j a va 2s.c om

    /* Mark read after millis */
    Composite markReadAfterContainer = new Composite(group, SWT.None);
    markReadAfterContainer.setLayout(LayoutUtils.createGridLayout(3, 0, 0));

    /* Mark Read after Millis */
    fMarkReadStateCheck = new Button(markReadAfterContainer, SWT.CHECK);
    fMarkReadStateCheck.setText(Messages.FeedsPreferencePage_MARK_READ_AFTER);
    fMarkReadStateCheck.setSelection(fGlobalScope.getBoolean(DefaultPreferences.MARK_READ_STATE));
    fMarkReadStateCheck.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            fMarkReadAfterSpinner.setEnabled(fMarkReadStateCheck.getSelection());
        }
    });

    fMarkReadAfterSpinner = new Spinner(markReadAfterContainer, SWT.BORDER);
    fMarkReadAfterSpinner.setMinimum(0);
    fMarkReadAfterSpinner.setMaximum(100);
    fMarkReadAfterSpinner.setSelection(fGlobalScope.getInteger(DefaultPreferences.MARK_READ_IN_MILLIS) / 1000);
    fMarkReadAfterSpinner.setEnabled(fMarkReadStateCheck.getSelection());

    Label label = new Label(markReadAfterContainer, SWT.None);
    label.setText(Messages.FeedsPreferencePage_SECONDS);

    /* Mark Read on Scrolling */
    fMarkReadOnScrolling = new Button(group, SWT.CHECK);
    fMarkReadOnScrolling.setText(Messages.FeedsPreferencePage_MARK_READ_ON_SCROLLING);
    fMarkReadOnScrolling.setSelection(fGlobalScope.getBoolean(DefaultPreferences.MARK_READ_ON_SCROLLING));

    /* Mark Read on changing displayed Feed */
    fMarkReadOnChange = new Button(group, SWT.CHECK);
    fMarkReadOnChange.setText(Messages.FeedsPreferencePage_MARK_READ_ON_SWITCH);
    fMarkReadOnChange.setSelection(fGlobalScope.getBoolean(DefaultPreferences.MARK_READ_ON_CHANGE));

    /* Mark Read on closing the Feed Tab */
    fMarkReadOnTabClose = new Button(group, SWT.CHECK);
    fMarkReadOnTabClose.setText(Messages.FeedsPreferencePage_MARK_READ_ON_CLOSE);
    fMarkReadOnTabClose.setSelection(fGlobalScope.getBoolean(DefaultPreferences.MARK_READ_ON_TAB_CLOSE));

    /* Mark Read on Minimize */
    fMarkReadOnMinimize = new Button(group, SWT.CHECK);
    fMarkReadOnMinimize.setText(Messages.FeedsPreferencePage_MARK_READ_ON_MINIMIZE);
    fMarkReadOnMinimize.setSelection(fGlobalScope.getBoolean(DefaultPreferences.MARK_READ_ON_MINIMIZE));

    /* Mark Read Duplicates (including description) */
    Composite markReadDuplicatesContainer = new Composite(group, SWT.NONE);
    markReadDuplicatesContainer.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    markReadDuplicatesContainer.setLayout(LayoutUtils.createGridLayout(1, 0, 0));
    ((GridLayout) markReadDuplicatesContainer.getLayout()).marginTop = 10;

    label = new Label(markReadDuplicatesContainer, SWT.NONE);
    label.setText(Messages.FeedsPreferencePage_UPDATE_DUPLICATE_LABEL);
    label.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));

    Label infoText = new Label(markReadDuplicatesContainer, SWT.WRAP);
    infoText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    ((GridData) infoText.getLayoutData()).widthHint = 200;
    infoText.setText(Messages.FeedsPreferencePage_UPDATE_DUPLICATES_DESCRIPTION);

    fMarkReadDuplicateNews = new Button(markReadDuplicatesContainer, SWT.CHECK);
    fMarkReadDuplicateNews.setText(Messages.FeedsPreferencePage_UPDATE_DUPLICATES);
    fMarkReadDuplicateNews.setSelection(fGlobalScope.getBoolean(DefaultPreferences.MARK_READ_DUPLICATES));
    fMarkReadDuplicateNews.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, true, false));
}