Example usage for org.eclipse.jface.dialogs IMessageProvider INFORMATION

List of usage examples for org.eclipse.jface.dialogs IMessageProvider INFORMATION

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs IMessageProvider INFORMATION.

Prototype

int INFORMATION

To view the source code for org.eclipse.jface.dialogs IMessageProvider INFORMATION.

Click Source Link

Document

Constant for an info message (value 1).

Usage

From source file:org.robotframework.ide.eclipse.main.plugin.tableeditor.HeaderFilterSupport.java

License:Apache License

void addFormMessageIfNeeded() {
    if (filter != null && !filter.getText().isEmpty() && form.getMessage() == null) {
        form.setMessage("Filtering is enabled", IMessageProvider.INFORMATION);
    }/*from   w  ww  .j a  v  a2 s  .  co  m*/
}

From source file:org.rssowl.ui.internal.dialogs.exporter.ExportOptionsPage.java

License:Open Source License

public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NONE);
    container.setLayout(new GridLayout(1, false));

    StyledText infoText = new StyledText(container, SWT.WRAP | SWT.READ_ONLY);
    infoText.setEnabled(false);//  w ww.  j a  va 2  s  .  c o  m
    infoText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    ((GridData) infoText.getLayoutData()).widthHint = 200;
    infoText.setBackground(container.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
    infoText.setText(Messages.ExportOptionsPage_OPTIONS_INFO);

    /* Labels */
    Collection<ILabel> labels = DynamicDAO.loadAll(ILabel.class);
    fExportLabelsCheck = new Button(container, SWT.CHECK);
    fExportLabelsCheck.setImage(OwlUI.getImage(fExportLabelsCheck, "icons/elcl16/labels.gif")); //$NON-NLS-1$
    if (!labels.isEmpty())
        fExportLabelsCheck.setText(NLS.bind(Messages.ExportOptionsPage_EXPORT_N_LABELS, labels.size()));
    else
        fExportLabelsCheck.setText(Messages.ExportOptionsPage_EXPORT_LABELS);
    fExportLabelsCheck.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    ((GridData) fExportLabelsCheck.getLayoutData()).verticalIndent = 10;
    fExportLabelsCheck.setEnabled(!labels.isEmpty());

    /* Filters */
    Collection<ISearchFilter> filters = DynamicDAO.loadAll(ISearchFilter.class);
    final boolean filtersUseLabels = filtersUseLabels(filters);
    fExportFiltersCheck = new Button(container, SWT.CHECK);
    fExportFiltersCheck.setImage(OwlUI.getImage(fExportFiltersCheck, OwlUI.FILTER));
    if (!filters.isEmpty())
        fExportFiltersCheck.setText(NLS.bind(Messages.ExportOptionsPage_EXPORT_N_FILTERS, filters.size()));
    else
        fExportFiltersCheck.setText(Messages.ExportOptionsPage_EXPORT_FILTERS);
    fExportFiltersCheck.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    fExportFiltersCheck.setEnabled(!filters.isEmpty());
    fExportFiltersCheck.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            if (fExportFiltersCheck.getSelection() && !fExportLabelsCheck.getSelection() && filtersUseLabels) {
                fExportLabelsCheck.setSelection(true);
                setMessage(Messages.ExportOptionsPage_EXPORT_LABEL_FILTER_INFO, IMessageProvider.INFORMATION);
            } else if (!fExportFiltersCheck.getSelection()) {
                setMessage(Messages.ExportOptionsPage_EXPORT_OPTIONS);
            }
        }
    });

    /* Properties */
    fExportSettingsCheck = new Button(container, SWT.CHECK);
    fExportSettingsCheck.setImage(OwlUI.getImage(fExportSettingsCheck, "icons/elcl16/preferences.gif")); //$NON-NLS-1$
    fExportSettingsCheck.setText(Messages.ExportOptionsPage_EXPORT_PREFERENCES);
    fExportSettingsCheck.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));

    Dialog.applyDialogFont(container);

    setControl(container);
}

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 w  w  w . j  av a2  s .  co  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.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   ww  w .j a v a2s .c  o  m
        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.importer.ImportElementsPage.java

License:Open Source License

private void updateMessage(boolean clearErrors) {
    List<?> input = (List<?>) fViewer.getInput();
    if (!input.isEmpty() && fViewer.getTree().getItemCount() == 0 && fViewer.getFilters().length > 0)
        setMessage(Messages.ImportElementsPage_HIDDEN_ELEMENTS_INFO, IMessageProvider.INFORMATION);
    else/*from w ww  .  j  ava 2s . co  m*/
        setMessage(Messages.ImportElementsPage_CHOOSE_ELEMENTS_MESSAGE);

    if (clearErrors)
        setErrorMessage(null);

    updatePageComplete();
}

From source file:org.rssowl.ui.internal.dialogs.importer.ImportElementsPage.java

License:Open Source License

@SuppressWarnings("null")
private void importFromLinksBruteforce(List<String> links, IProgressMonitor monitor) {

    /* Return on Cancellation */
    if (monitor.isCanceled() || Controller.getDefault().isShuttingDown())
        return;/*from  w ww  .j a va 2 s . c  o  m*/

    /* Update Task Information */
    monitor.beginTask(Messages.ImportElementsPage_SEARCHING_FOR_FEEDS, links.size());
    monitor.subTask(Messages.ImportElementsPage_FETCHING_RESULTS);

    /* A Root to add Found Bookmarks into */
    final IFolder defaultRootFolder = Owl.getModelFactory().createFolder(null, null,
            Messages.ImportElementsPage_BOOKMARKS);
    defaultRootFolder.setProperty(ITypeImporter.TEMPORARY_FOLDER, true);

    /* For Each Link of the Queue - try to interpret as Feed */
    int counter = 0;
    final List<String> foundBookMarkNames = new ArrayList<String>();
    IBookMarkDAO dao = DynamicDAO.getDAO(IBookMarkDAO.class);
    for (String feedLinkVal : links) {
        monitor.worked(1);

        InputStream in = null;
        boolean canceled = false;
        Exception error = null;
        try {
            URI feedLink = new URI(feedLinkVal);

            /* Report Progress Back To User */
            if (counter == 1)
                monitor.subTask(Messages.ImportElementsPage_SINGLE_RESULT);
            else if (counter > 1)
                monitor.subTask(NLS.bind(Messages.ImportElementsPage_N_RESULTS, counter));

            /* Ignore if already present in Subscriptions List (ignoring trailing slashes) */
            if (dao.exists(new FeedLinkReference(feedLink)))
                continue;
            else if (feedLinkVal.endsWith("/") && dao //$NON-NLS-1$
                    .exists(new FeedLinkReference(new URI(feedLinkVal.substring(0, feedLinkVal.length() - 1)))))
                continue;
            else if (!feedLinkVal.endsWith("/") //$NON-NLS-1$
                    && dao.exists(new FeedLinkReference(new URI(feedLinkVal + "/")))) //$NON-NLS-1$
                continue;

            /* Return on Cancellation */
            if (monitor.isCanceled() || Controller.getDefault().isShuttingDown())
                break;

            /* Open Stream to potential Feed */
            in = openStream(feedLink, monitor, FEED_CON_TIMEOUT, false, false, null);

            /* Return on Cancellation */
            if (monitor.isCanceled() || Controller.getDefault().isShuttingDown()) {
                canceled = true;
                break;
            }

            /* Try to interpret as Feed */
            IFeed feed = Owl.getModelFactory().createFeed(null, feedLink);
            Owl.getInterpreter().interpret(in, feed, null);
            fLoadedFeedCache.put(feedLink, feed);

            /* Return on Cancellation */
            if (monitor.isCanceled() || Controller.getDefault().isShuttingDown()) {
                canceled = true;
                break;
            }

            /* Add as Result if Feed contains News */
            if (!feed.getNews().isEmpty() && StringUtils.isSet(feed.getTitle())) {
                String title = feed.getTitle();
                boolean sameTitleExists = foundBookMarkNames.contains(title);
                if (sameTitleExists && StringUtils.isSet(feed.getFormat()))
                    title = NLS.bind(Messages.ImportElementsPage_FEED_TITLE, title, feed.getFormat());

                final IBookMark bookmark = Owl.getModelFactory().createBookMark(null, defaultRootFolder,
                        new FeedLinkReference(feedLink), title);
                foundBookMarkNames.add(bookmark.getName());
                counter++;

                if (StringUtils.isSet(feed.getDescription()))
                    bookmark.setProperty(ITypeImporter.DESCRIPTION_KEY, feed.getDescription());

                if (feed.getHomepage() != null)
                    bookmark.setProperty(ITypeImporter.HOMEPAGE_KEY, feed.getHomepage());

                /* Directly show in Viewer */
                JobRunner.runInUIThread(getShell(), new Runnable() {
                    public void run() {
                        addImportedElement(bookmark);
                    }
                });
            }
        }

        /* Ignore Errors (likely not a Feed then) */
        catch (Exception e) {
            error = e;
        }

        /* Close Stream */
        finally {

            /* Close Input Stream */
            if (in != null) {
                try {
                    if ((canceled || error != null) && in instanceof IAbortable)
                        ((IAbortable) in).abort();
                    else
                        in.close();
                } catch (IOException e) {
                    /* Ignore Silently */
                }
            }
        }
    }

    /* Inform if no feeds have been found */
    if (counter == 0) {
        JobRunner.runInUIThread(getShell(), new Runnable() {
            public void run() {
                setMessage(Messages.ImportElementsPage_NO_FEEDS_FOUND, IMessageProvider.INFORMATION);
            }
        });
    }
}

From source file:org.rssowl.ui.internal.dialogs.importer.ImportOptionsPage.java

License:Open Source License

public void createControl(Composite parent) {

    /* Title Image */
    setImageDescriptor(/*w  ww  .j a  v a 2  s  .c o  m*/
            OwlUI.getImageDescriptor(getWizard() instanceof WelcomeWizard ? "icons/wizban/welcome_wiz.gif" //$NON-NLS-1$
                    : "icons/wizban/import_wiz.png")); //$NON-NLS-1$

    /* Container */
    Composite container = new Composite(parent, SWT.NONE);
    container.setLayout(new GridLayout(1, false));

    /* Info Text */
    StyledText infoText = new StyledText(container, SWT.WRAP | SWT.READ_ONLY);
    infoText.setEnabled(false);
    infoText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    ((GridData) infoText.getLayoutData()).widthHint = 300;
    infoText.setBackground(container.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
    infoText.setText(Messages.ImportOptionsPage_OPTIONS_INFO);

    /* Labels */
    fImportLabelsCheck = new Button(container, SWT.CHECK);
    fImportLabelsCheck.setImage(OwlUI.getImage(fImportLabelsCheck, "icons/elcl16/labels.gif")); //$NON-NLS-1$
    fImportLabelsCheck.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    ((GridData) fImportLabelsCheck.getLayoutData()).verticalIndent = 10;

    /* Filters */
    fImportFiltersCheck = new Button(container, SWT.CHECK);
    fImportFiltersCheck.setImage(OwlUI.getImage(fImportFiltersCheck, OwlUI.FILTER));
    fImportFiltersCheck.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    fImportFiltersCheck.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (fImportFiltersCheck.getSelection() && !fImportLabelsCheck.getSelection() && fFiltersUseLabels) {
                fImportLabelsCheck.setSelection(true);
                setMessage(Messages.ImportOptionsPage_LABELS_INFO, IMessageProvider.INFORMATION);
            } else if (!fImportFiltersCheck.getSelection()) {
                setMessage(Messages.ImportOptionsPage_SELECT_OPTIONS);
            }
        }
    });

    /* Preferences */
    fImportPreferencesCheck = new Button(container, SWT.CHECK);
    fImportPreferencesCheck.setImage(OwlUI.getImage(fImportPreferencesCheck, "icons/elcl16/preferences.gif")); //$NON-NLS-1$
    fImportPreferencesCheck.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));

    Dialog.applyDialogFont(container);

    setControl(container);
}

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

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {

    /* Separator */
    new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL)
            .setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));

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

    /* Title *//*from   w  ww . j  a  v a 2  s  .  com*/
    setTitle(Messages.MasterPasswordDialog_MASTER_PASSWORD);

    /* Title Image */
    if ((fStyle & PasswordProvider.CREATE_NEW_PASSWORD) != 0) {
        setTitleImage(OwlUI.getImage(fResources, "icons/wizban/new_value_wiz.png")); //$NON-NLS-1$
        setMessage(Messages.MasterPasswordDialog_REMEMBER_PASSWORD, IMessageProvider.WARNING);
    } else {
        setTitleImage(OwlUI.getImage(fResources, "icons/wizban/login_wiz.png")); //$NON-NLS-1$
        setMessage(Messages.MasterPasswordDialog_MASTER_PASSWORD_INFO, IMessageProvider.INFORMATION);
    }

    /* Username Label */
    Label passwordLabel = new Label(composite, SWT.NONE);
    passwordLabel.setText(Messages.MasterPasswordDialog_PASSWORD);
    passwordLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, true));

    /* Password input field */
    fPassword = new Text(composite, SWT.SINGLE | SWT.BORDER | SWT.PASSWORD);
    fPassword.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
    fPassword.setFocus();

    if ((fStyle & PasswordProvider.CREATE_NEW_PASSWORD) != 0) {
        fPassword.addModifyListener(new ModifyListener() {
            public void modifyText(ModifyEvent e) {
                boolean enabled = fPassword.getText().equals(fPasswordConfirmed.getText())
                        && fPassword.getText().length() > 0;
                getButton(IDialogConstants.OK_ID).setEnabled(enabled);
                updateQualityBar();
            }
        });
    }

    /* Confirm Password Label */
    if ((fStyle & PasswordProvider.CREATE_NEW_PASSWORD) != 0) {
        Label confirmPasswordLabel = new Label(composite, SWT.NONE);
        confirmPasswordLabel.setText(Messages.MasterPasswordDialog_CONFIRM_PASSWORD);
        confirmPasswordLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, true));

        /* Confirm Password input field */
        fPasswordConfirmed = new Text(composite, SWT.SINGLE | SWT.BORDER | SWT.PASSWORD);
        fPasswordConfirmed.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
        fPasswordConfirmed.addModifyListener(new ModifyListener() {
            public void modifyText(ModifyEvent e) {
                boolean enabled = fPassword.getText().equals(fPasswordConfirmed.getText())
                        && fPassword.getText().length() > 0;
                getButton(IDialogConstants.OK_ID).setEnabled(enabled);
            }
        });

        /* Spacer */
        new Label(composite, SWT.NONE);
        new Label(composite, SWT.NONE);

        /* Password Quality Meter */
        Label passwordQuality = new Label(composite, SWT.NONE);
        passwordQuality.setText(Messages.MasterPasswordDialog_PASSWORD_QUALITY);
        passwordQuality.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, true));

        fQualityBar = new ProgressBar(composite, SWT.HORIZONTAL);
        fQualityBar.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
        fQualityBar.setMinimum(0);
        fQualityBar.setMaximum(100);
    }

    /* Separator */
    Label separator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
    separator.setLayoutData(new GridData(SWT.FILL, SWT.END, true, true));

    applyDialogFont(composite);

    return composite;
}

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

License:Open Source License

private void updateTitle() {
    ISearchFilter problematicFilter = null;

    Table table = fViewer.getTable();/*from w w w  .  j av  a2s  .c  o  m*/
    TableItem[] items = table.getItems();
    for (TableItem item : items) {
        ISearchFilter filter = (ISearchFilter) item.getData();
        if (filter.getSearch() == null && filter.isEnabled()) {
            int index = table.indexOf(item);
            if (index < table.getItemCount() - 1) {
                problematicFilter = filter;
                break;
            }
        }
    }

    if (problematicFilter != null)
        setMessage(
                NLS.bind(Messages.NewsFiltersListDialog_FILTER_MATCHES_ALL_NEWS, problematicFilter.getName()),
                IMessageProvider.WARNING);
    else
        setMessage(Messages.NewsFiltersListDialog_ENABLED_FILTERS, IMessageProvider.INFORMATION);
}

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

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {

    /* Separator */
    new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL)
            .setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));

    /* Title *//*from   ww  w  . j a  va  2  s .  c  om*/
    setTitle(Messages.SearchMarkDialog_SAVED_SEARCH);

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

    /* Title Message */
    setMessage(Messages.SearchMarkDialog_SEARCH_HELP, IMessageProvider.INFORMATION);

    Composite container = new Composite(parent, SWT.NONE);
    container.setLayout(LayoutUtils.createGridLayout(2, 5, 5, 5, 5, false));
    container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    Label nameLabel = new Label(container, SWT.NONE);
    nameLabel.setText(Messages.SearchMarkDialog_NAME);

    Composite nameContainer = new Composite(container, SWT.BORDER);
    nameContainer.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    nameContainer.setLayout(LayoutUtils.createGridLayout(2, 0, 0));
    nameContainer.setBackground(container.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));

    fNameInput = new Text(nameContainer, SWT.SINGLE);
    OwlUI.makeAccessible(fNameInput, nameLabel);
    fNameInput.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
    fNameInput.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            setErrorMessage(null);
        }
    });

    ToolBar generateTitleBar = new ToolBar(nameContainer, SWT.FLAT);
    OwlUI.makeAccessible(generateTitleBar, Messages.SearchMarkDialog_CREATE_NAME_FROM_CONDITIONS);
    generateTitleBar.setBackground(container.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));

    ToolItem generateTitleItem = new ToolItem(generateTitleBar, SWT.PUSH);
    generateTitleItem.setImage(OwlUI.getImage(fResources, "icons/etool16/info.gif")); //$NON-NLS-1$
    generateTitleItem.setToolTipText(Messages.SearchMarkDialog_CREATE_NAME_FROM_CONDITIONS);
    generateTitleItem.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            onGenerateName();
        }
    });

    Label folderLabel = new Label(container, SWT.NONE);
    folderLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
    folderLabel.setText(Messages.SearchMarkDialog_LOCATION);

    /* Folder Chooser */
    fFolderChooser = new FolderChooser(container, fParent, SWT.BORDER, true);
    fFolderChooser.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    fFolderChooser.setLayout(LayoutUtils.createGridLayout(1, 0, 0, 2, 5, false));
    fFolderChooser.setBackground(container.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));

    Composite topControlsContainer = new Composite(container, SWT.None);
    topControlsContainer.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false, 2, 1));
    topControlsContainer.setLayout(LayoutUtils.createGridLayout(4, 5, 0));
    ((GridLayout) topControlsContainer.getLayout()).marginTop = 10;

    fMatchAllRadio = new Button(topControlsContainer, SWT.RADIO);
    fMatchAllRadio.setText(Messages.SearchMarkDialog_MATCH_ALL_CONDITIONS);
    fMatchAllRadio.setSelection(fInitialMatchAllConditions);

    fMatchAnyRadio = new Button(topControlsContainer, SWT.RADIO);
    fMatchAnyRadio.setText(Messages.SearchMarkDialog_MATCH_ANY_CONDITION);
    fMatchAnyRadio.setSelection(!fInitialMatchAllConditions);

    /* Separator */
    Label sep = new Label(topControlsContainer, SWT.SEPARATOR | SWT.VERTICAL);
    sep.setLayoutData(new GridData(SWT.DEFAULT, 16));

    /* Scope */
    Composite scopeContainer = new Composite(topControlsContainer, SWT.None);
    scopeContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
    scopeContainer.setLayout(LayoutUtils.createGridLayout(2, 0, 0, 0, 5, false));
    ((GridLayout) scopeContainer.getLayout()).marginLeft = 2;

    Label locationLabel = new Label(scopeContainer, SWT.NONE);
    locationLabel.setText(Messages.SearchMarkDialog_SEARCH_IN);

    fLocationControl = new LocationControl(scopeContainer, SWT.WRAP) {
        @Override
        protected String getDefaultLabel() {
            return Messages.SearchMarkDialog_ALL_NEWS;
        }
    };
    fLocationControl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
    ((GridData) fLocationControl.getLayoutData()).widthHint = 100;
    fLocationControl.setLayout(LayoutUtils.createGridLayout(1, 0, 0, 0, 0, false));

    if (fInitialLocation != null && fInitialLocation.getValue() instanceof Long[][])
        fLocationControl.select((Long[][]) fInitialLocation.getValue());

    Composite conditionsContainer = new Composite(container, SWT.BORDER);
    conditionsContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
    conditionsContainer.setLayout(LayoutUtils.createGridLayout(2));
    conditionsContainer.setBackground(container.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    conditionsContainer.setBackgroundMode(SWT.INHERIT_FORCE);

    /* Search Conditions List */
    if (fInitialSearchConditions == null)
        fInitialSearchConditions = getDefaultConditions();
    fSearchConditionList = new SearchConditionList(conditionsContainer, SWT.None, fInitialSearchConditions);
    fSearchConditionList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
    fSearchConditionList.setVisibleItemCount(3);

    /* Prefill Name out of Conditions if provided */
    if (fInitialSearchConditions != null && !fInitialSearchConditions.isEmpty())
        onGenerateName();

    /* Show Warning in case of location conflict */
    if (fShowLocationConflict)
        setMessage(Messages.SearchMarkDialog_LOCATION_WARNING, IMessageProvider.WARNING);

    applyDialogFont(container);

    return container;
}