Example usage for org.eclipse.jface.dialogs DialogPage DialogPage

List of usage examples for org.eclipse.jface.dialogs DialogPage DialogPage

Introduction

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

Prototype

protected DialogPage() 

Source Link

Document

Creates a new empty dialog page.

Usage

From source file:com.aptana.internal.ui.text.spelling.SpellingConfigurationBlock.java

License:Open Source License

/**
 * Creates the encoding field editor./*w  ww  . j  av a 2  s .co  m*/
 * 
 * @param composite
 *            the parent composite
 * @param allControls
 *            list with all controls
 * @since 3.3
 */
private void createEncodingFieldEditor(Composite composite, List allControls) {
    final Label filler = new Label(composite, SWT.NONE);
    final GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    gd.horizontalSpan = 4;
    filler.setLayoutData(gd);

    // Label label = new Label(composite, SWT.NONE);
    // label
    // .setText(PreferencesMessages.SpellingPreferencePage_encoding_label);
    // label.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
    // allControls.add(label);

    // fEncodingEditorParent = new Composite(composite, SWT.NONE);
    // GridLayout layout = new GridLayout(2, false);
    // layout.marginWidth = 0;
    // layout.marginHeight = 0;
    // fEncodingEditorParent.setLayout(layout);
    // gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    // gd.horizontalSpan = 3;
    // fEncodingEditorParent.setLayoutData(gd);

    //fEncodingEditor= new EncodingFieldEditor(PREF_SPELLING_USER_DICTIONARY_ENCODING.getName(), "", null, fEncodingEditorParent); //$NON-NLS-1$

    final PreferenceStore store = new PreferenceStore();
    // String defaultEncoding= ResourcesPlugin.getEncoding();
    store.setDefault(PREF_SPELLING_USER_DICTIONARY_ENCODING.getName(), Charset.defaultCharset().name());
    final String encoding = this.getValue(PREF_SPELLING_USER_DICTIONARY_ENCODING);
    if ((encoding != null) && (encoding.length() > 0)) {
        store.setValue(PREF_SPELLING_USER_DICTIONARY_ENCODING.getName(), encoding);
    }

    // fEncodingEditor.setPreferenceStore(store);

    // Redirect status messages from the field editor to the status change
    // listener
    final DialogPage fakePage = new DialogPage() {
        public void createControl(Composite c) {
        }

        public void setErrorMessage(String newMessage) {
            final StatusInfo status = new StatusInfo();
            if (newMessage != null) {
                status.setError(newMessage);
            }
            SpellingConfigurationBlock.this.fEncodingFieldEditorStatus = status;
            SpellingConfigurationBlock.this.fContext.statusChanged(
                    StatusUtil.getMostSevere(new IStatus[] { SpellingConfigurationBlock.this.fThresholdStatus,
                            SpellingConfigurationBlock.this.fFileStatus,
                            SpellingConfigurationBlock.this.fEncodingFieldEditorStatus }));
        }
    };
    // fEncodingEditor.setPage(fakePage);
    //      
    // fEncodingEditor.load();
    //      
    // if (encoding == null || encoding.equals(defaultEncoding) ||
    // encoding.length() == 0)
    // fEncodingEditor.loadDefault();

}

From source file:eclipse.spellchecker.preferences.SpellingConfigurationBlock.java

License:Open Source License

/**
 * Creates the encoding field editor.//from   w  ww.  j  a v a  2 s.  c  o m
 *
 * @param composite the parent composite
 * @param allControls list with all controls
 * @since 3.3
 */
private void createEncodingFieldEditor(Composite composite, List<Control> allControls) {
    Label filler = new Label(composite, SWT.NONE);
    GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    gd.horizontalSpan = 4;
    filler.setLayoutData(gd);

    Label label = new Label(composite, SWT.NONE);
    label.setText(PreferencesMessages.SpellingPreferencePage_encoding_label);
    label.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
    allControls.add(label);

    fEncodingEditorParent = new Composite(composite, SWT.NONE);
    GridLayout layout = new GridLayout(2, false);
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    fEncodingEditorParent.setLayout(layout);
    gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    gd.horizontalSpan = 3;
    fEncodingEditorParent.setLayoutData(gd);

    fEncodingEditor = new EncodingFieldEditor(PREF_SPELLING_USER_DICTIONARY_ENCODING.getName(), "", null, //$NON-NLS-1$
            fEncodingEditorParent);

    PreferenceStore store = new PreferenceStore();
    String defaultEncoding = ResourcesPlugin.getEncoding();
    store.setDefault(PREF_SPELLING_USER_DICTIONARY_ENCODING.getName(), defaultEncoding);
    String encoding = getValue(PREF_SPELLING_USER_DICTIONARY_ENCODING);
    if (encoding != null && encoding.length() > 0)
        store.setValue(PREF_SPELLING_USER_DICTIONARY_ENCODING.getName(), encoding);

    fEncodingEditor.setPreferenceStore(store);

    // Redirect status messages from the field editor to the status change listener
    DialogPage fakePage = new DialogPage() {
        public void createControl(Composite c) {
        }

        @Override
        public void setErrorMessage(String newMessage) {
            StatusInfo status = new StatusInfo();
            if (newMessage != null)
                status.setError(newMessage);
            fEncodingFieldEditorStatus = status;
            fContext.statusChanged(StatusUtil.getMostSevere(
                    new IStatus[] { fThresholdStatus, fFileStatus, fEncodingFieldEditorStatus }));
        }
    };
    fEncodingEditor.setPage(fakePage);

    fEncodingEditor.load();

    if (encoding == null || encoding.equals(defaultEncoding) || encoding.length() == 0)
        fEncodingEditor.loadDefault();

}

From source file:net.certiv.fluentmark.spell.SpellingConfigurationBlock.java

License:Open Source License

/**
 * Creates the encoding field editor.// w w w.  j a va 2 s . c  o m
 *
 * @param composite the parent composite
 * @param string list with all controls
 */
private void encodingControl(Composite composite, String text) {

    Label label = new Label(composite, SWT.NONE);
    label.setText(text);
    label.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));

    fEncodingEditorParent = new Composite(composite, SWT.NONE);
    GridLayout layout = new GridLayout(2, false);
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    fEncodingEditorParent.setLayout(layout);
    GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    gd.horizontalSpan = 3;
    gd.horizontalIndent += SwtUtil.getIndent();
    fEncodingEditorParent.setLayoutData(gd);

    encEditor = new EncodingFieldEditor(SPELLING_USER_DICTIONARY_ENCODING, "", null, fEncodingEditorParent); //$NON-NLS-1$

    PreferenceStore store = new PreferenceStore();
    String defaultEncoding = ResourcesPlugin.getEncoding();
    store.setDefault(SPELLING_USER_DICTIONARY_ENCODING, defaultEncoding);
    String encoding = store.getString(SPELLING_USER_DICTIONARY_ENCODING);
    if (encoding != null && encoding.length() > 0)
        store.setValue(SPELLING_USER_DICTIONARY_ENCODING, encoding);

    encEditor.setPreferenceStore(store);

    // Redirect status messages from the field editor to the status change listener
    DialogPage fakePage = new DialogPage() {

        @Override
        public void createControl(Composite c) {
        }

        @Override
        public void setErrorMessage(String newMessage) {
            StatusInfo status = new StatusInfo();
            if (newMessage != null)
                status.setError(newMessage);
            fEncodingFieldEditorStatus = status;
            fContext.statusChanged(StatusUtil.getMostSevere(
                    new IStatus[] { fThresholdStatus, fFileStatus, fEncodingFieldEditorStatus }));
        }
    };
    encEditor.setPage(fakePage);
    encEditor.load();
    if (encoding == null || encoding.equals(defaultEncoding) || encoding.length() == 0) {
        encEditor.loadDefault();
    }
}

From source file:org.eclipse.cdt.internal.ui.preferences.SpellingConfigurationBlock.java

License:Open Source License

/**
 * Creates the encoding field editor.//  w w  w.  j a  va 2  s .  c  o m
 * 
 * @param composite the parent composite
 * @param allControls list with all controls
 */
private void createEncodingFieldEditor(Composite composite, List<Control> allControls) {
    Label filler = new Label(composite, SWT.NONE);
    GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    gd.horizontalSpan = 4;
    filler.setLayoutData(gd);

    Label label = new Label(composite, SWT.NONE);
    label.setText(PreferencesMessages.SpellingPreferencePage_encoding_label);
    label.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
    allControls.add(label);

    fEncodingEditorParent = new Composite(composite, SWT.NONE);
    GridLayout layout = new GridLayout(2, false);
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    fEncodingEditorParent.setLayout(layout);
    gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    gd.horizontalSpan = 3;
    fEncodingEditorParent.setLayoutData(gd);

    fEncodingEditor = new EncodingFieldEditor(PREF_SPELLING_USER_DICTIONARY_ENCODING.getName(), "", null, //$NON-NLS-1$
            fEncodingEditorParent);

    PreferenceStore store = new PreferenceStore();
    String defaultEncoding = ResourcesPlugin.getEncoding();
    store.setDefault(PREF_SPELLING_USER_DICTIONARY_ENCODING.getName(), defaultEncoding);
    String encoding = getValue(PREF_SPELLING_USER_DICTIONARY_ENCODING);
    if (encoding != null && encoding.length() > 0)
        store.setValue(PREF_SPELLING_USER_DICTIONARY_ENCODING.getName(), encoding);

    fEncodingEditor.setPreferenceStore(store);

    // Redirect status messages from the field editor to the status change listener  
    DialogPage fakePage = new DialogPage() {
        @Override
        public void createControl(Composite c) {
        }

        @Override
        public void setErrorMessage(String newMessage) {
            StatusInfo status = new StatusInfo();
            if (newMessage != null)
                status.setError(newMessage);
            fEncodingFieldEditorStatus = status;
            fContext.statusChanged(StatusUtil.getMostSevere(
                    new IStatus[] { fThresholdStatus, fFileStatus, fEncodingFieldEditorStatus }));
        }
    };
    fEncodingEditor.setPage(fakePage);

    fEncodingEditor.load();

    if (encoding == null || encoding.equals(defaultEncoding) || encoding.length() == 0)
        fEncodingEditor.loadDefault();
}