Search in sources :

Example 1 with ListEditor

use of org.eclipse.jface.preference.ListEditor in project sling by apache.

the class SlingIdePreferencePage method createFieldEditors.

@Override
protected void createFieldEditors() {
    ignoredFileNamesForSyncEditor = new ListEditor(Preferences.IGNORED_FILE_NAMES_FOR_SYNC, "Ignored file names for the server sync", getFieldEditorParent()) {

        @Override
        protected String createList(String[] items) {
            //$NON-NLS-1$
            StringBuffer path = new StringBuffer("");
            for (int i = 0; i < items.length; i++) {
                path.append(items[i]);
                path.append(Preferences.LIST_SEPARATOR);
            }
            return path.toString();
        }

        @Override
        protected String getNewInputObject() {
            InputDialog dialog = new InputDialog(getShell(), "Add file name", "Enter a file name to ignore during the server sync ...", "", new PatternValidator());
            if (dialog.open() == Window.OK) {
                return dialog.getValue();
            } else {
                return null;
            }
        }

        @Override
        protected String[] parseString(String stringList) {
            return stringList.split(Preferences.LIST_SEPARATOR);
        }
    };
    addField(ignoredFileNamesForSyncEditor);
}
Also used : ListEditor(org.eclipse.jface.preference.ListEditor) InputDialog(org.eclipse.jface.dialogs.InputDialog)

Aggregations

InputDialog (org.eclipse.jface.dialogs.InputDialog)1 ListEditor (org.eclipse.jface.preference.ListEditor)1