Example usage for org.eclipse.jface.preference ListEditor loadDefault

List of usage examples for org.eclipse.jface.preference ListEditor loadDefault

Introduction

In this page you can find the example usage for org.eclipse.jface.preference ListEditor loadDefault.

Prototype

public void loadDefault() 

Source Link

Document

Initializes this field editor with the default preference value from the preference store.

Usage

From source file:com.codenvy.eclipse.ui.preferences.CodenvyPreferencesPage.java

License:Open Source License

@Override
protected void createFieldEditors() {
    final Composite parent = getFieldEditorParent();
    final ListEditor locations = new ListEditor(REMOTE_REPOSITORIES_LOCATION_KEY_NAME,
            "Remote repositories locations:", parent) {
        @Override//from  w  w  w .  j a v a 2 s  .  c  o m
        protected String getNewInputObject() {
            // Give the user an input dialog to enter its new location
            final InputDialog dialog = new InputDialog(getShell(), "Add a remote Codenvy repository location",
                    "Enter the URL of the repository", null, new CodenvyRepositoryValidator());
            if (dialog.open() != Window.OK) {
                return null;
            }

            final String newRepositoryLocation = dialog.getValue();
            if (StringHelper.isNullOrEmpty(newRepositoryLocation)) {
                return null;
            }

            return newRepositoryLocation;
        }

        @Override
        protected String[] parseString(String stringList) {
            return CodenvyPreferencesInitializer.parseString(stringList);
        }

        @Override
        protected String createList(String[] items) {
            return CodenvyPreferencesInitializer.createList(items);
        }
    };

    locations.loadDefault();
    addField(locations);
}