@Override protected void createFieldEditors() { addField(new ListEditor(TermSuiteUIPreferences.TAGGERS, "Installed POS taggers/lemmatizers: ", getFieldEditorParent()) { @Override protected String createList(String[] items) { return Joiner.on(TermSuiteUIPreferences.LIST_SEPARATOR_CHAR).join(items); } @Override protected String getNewInputObject() { ConfigureTaggerDialog dialog = new ConfigureTaggerDialog(getShell()); if(dialog.open() == Dialog.OK) { ETaggerConfig config = dialog.getTaggerConfig(); return TaggerUtil.toPreferenceString(config); } else return null; } @Override protected String[] parseString(String stringList) { List<String> list = Splitter.on(TermSuiteUIPreferences.LIST_SEPARATOR_CHAR).splitToList(stringList); return list.toArray(new String[list.size()]); } }); }
@Override protected void createFieldEditors() { final Composite parent = getFieldEditorParent(); final ListEditor locations = new ListEditor(REMOTE_REPOSITORIES_LOCATION_KEY_NAME, "Remote repositories locations:", parent) { @Override 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); }
@Override protected void createFieldEditors() { List<String> cmakeGenerators = launcher.retrieveCMakeGenerators(); String[][] generators = new String[cmakeGenerators.size()][]; int i = 0; for( String generator : cmakeGenerators ) { String name = generator.replaceAll("[^-]+-(.*)", "$1").trim(); generators[i++] = new String[]{name,generator}; } buildEnvironmentEditor = new ComboFieldEditor("BUILD_SYS", "Build System", generators, getFieldEditorParent()); buildEnvironmentEditor.setPreferenceName(Activator.PREF_STORE_BUILD_SYS); buildEnvironmentEditor.load(); makeArgsEditor = new StringFieldEditor("MAKE_ARGS", "Make/Ninja Args", getFieldEditorParent()); makeArgsEditor.setPreferenceName(Activator.PREF_STORE_MAKE_ARGS); makeArgsEditor.load(); cmakeArgsEditor = new StringFieldEditor("CMAKE_ARGS", "CMake Args", getFieldEditorParent()); cmakeArgsEditor.setPreferenceName(Activator.PREF_STORE_CMAKE_ARGS); cmakeArgsEditor.load(); String[][] entryNamesAndValues = { { "Toolchain path invalid or not set.", Platform.getOSArch() } }; List<String> toolchains = PluginDataIO.getToolchainArchitectures(); if (!toolchains.isEmpty()) { int index = 0; entryNamesAndValues = new String[toolchains.size()][2]; for (String toolchain : toolchains) { entryNamesAndValues[index++] = new String[]{toolchain, toolchain}; } } defaultToolchain = new ComboFieldEditor("DEF_TOOLCHAIN", "Default-Toolchain", entryNamesAndValues, getFieldEditorParent()); defaultToolchain.setPreferenceName(Activator.PREF_STORE_DEFAULT_TOOLCHAIN); defaultToolchain.load(); defaultBuildtypes = new ListEditor("DEF_BUILDTYPES", "Available Buildtypes", getFieldEditorParent()) { @Override protected String[] parseString(String stringList) { return stringList.split(File.pathSeparator); } @Override protected String getNewInputObject() { InputDialog dialog = new InputDialog(getShell(), "New Buildconfiguration", "Enter the name of the Buildconfiguration to add", "", null); if (dialog.open() == InputDialog.OK) { return dialog.getValue(); } return null; } @Override protected String createList(String[] items) { StringBuilder sb = new StringBuilder(); for (String string : items) { sb.append(string).append(File.pathSeparator); } return sb.toString(); } }; defaultBuildtypes.setPreferenceName(Activator.PREF_STORE_BUILD_CONF); defaultBuildtypes.load(); addField(buildEnvironmentEditor); addField(makeArgsEditor); addField(cmakeArgsEditor); addField(defaultToolchain); addField(defaultBuildtypes); buildEnvironmentEditor.setPropertyChangeListener(this); makeArgsEditor.setPropertyChangeListener(this); cmakeArgsEditor.setPropertyChangeListener(this); defaultToolchain.setPropertyChangeListener(this); defaultBuildtypes.setPropertyChangeListener(this); }
@Override protected void createFieldEditors() { Composite p = getFieldEditorParent(); addField(new IntegerFieldEditor( CodeCompletionPreferencesInitializer.CHARS_FOR_CTX_INSENSITIVE_MODULES_COMPLETION, "Number of chars for showing modules in context-insensitive completions?", p)); addField(new IntegerFieldEditor( CodeCompletionPreferencesInitializer.CHARS_FOR_CTX_INSENSITIVE_TOKENS_COMPLETION, "Number of chars for showing global tokens in context-insensitive completions?", p)); addField(new BooleanFieldEditor(CodeCompletionPreferencesInitializer.USE_KEYWORDS_CODE_COMPLETION, "Use common tokens auto code completion?", p)); addField(new LabelFieldEditor("LabelFieldEditor", "", p)); addField(new BooleanFieldEditor(CodeCompletionPreferencesInitializer.ADD_SPACE_WHEN_NEEDED, "Add <SPACE> for common cases (e.g.: \"and \", \"assert \", etc.)?", p)); addField(new LabelFieldEditor("LabelFieldEditor", "", p)); addField(new BooleanFieldEditor(CodeCompletionPreferencesInitializer.ADD_SPACE_AND_COLON_WHEN_NEEDED, "Add <SPACE><COLON> for common cases (e.g.: \"class :\", \"if :\", etc.)?", p)); addField(new LabelFieldEditor("LabelFieldEditor", "", p)); addField(new BooleanFieldEditor(CodeCompletionPreferencesInitializer.FORCE_PY3K_PRINT_ON_PY2, "Force print() function on Python 2.x projects?", p)); addField(new LabelFieldEditor("LabelFieldEditor", "", p)); addField(new ListEditor(CodeCompletionPreferencesInitializer.KEYWORDS_CODE_COMPLETION, "Tokens to use:", p) { @Override protected String createList(String[] items) { return KeywordsSimpleAssist.wordsAsString(items); } @Override protected String getNewInputObject() { InputDialog d = new InputDialog(getShell(), "New word", "Add the word you wish.", "", new IInputValidator() { @Override public String isValid(String newText) { if (newText.indexOf(' ') != -1) { return "The input cannot have spaces"; } return null; } }); int retCode = d.open(); if (retCode == InputDialog.OK) { return d.getValue(); } return null; } @Override protected String[] parseString(String stringList) { return KeywordsSimpleAssist.stringAsWords(stringList); } @Override protected void doFillIntoGrid(Composite parent, int numColumns) { super.doFillIntoGrid(parent, numColumns); List listControl = getListControl(parent); GridData layoutData = (GridData) listControl.getLayoutData(); layoutData.heightHint = 300; } }); }
@Override protected void createFieldEditors() { Composite p = getFieldEditorParent(); addField(new BooleanFieldEditor(PydevConsoleConstants.INTERACTIVE_CONSOLE_UMD_ENABLED, "Enable UMD", p)); addField(new LabelFieldEditor("LabelFieldEditor", "", p)); addField(new BooleanFieldEditor(PydevConsoleConstants.INTERACTIVE_CONSOLE_UMD_VERBOSE, "Show reloaded modules list", p)); addField(new LabelFieldEditor("LabelFieldEditor", "", p)); addField(new ListEditor(PydevConsoleConstants.INTERACTIVE_CONSOLE_UMD_EXCLUDE_MODULE_LIST, "UMD Excluded Modules:", p) { @Override protected String createList(String[] items) { return StringUtils.join(",", items); } @Override protected String[] parseString(String stringList) { return stringList.split(","); } @Override protected String getNewInputObject() { InputDialog d = new InputDialog(getShell(), "New Excluded Module", "Add the module you want to exclude.", "", new IInputValidator() { @Override public String isValid(String newText) { if (newText.indexOf(',') != -1) { return "The input cannot have a comma"; } return null; } }); if (d.open() == InputDialog.OK) { return d.getValue(); } return null; } @Override protected void doFillIntoGrid(Composite parent, int numColumns) { super.doFillIntoGrid(parent, numColumns); List listControl = getListControl(parent); GridData layoutData = (GridData) listControl.getLayoutData(); layoutData.heightHint = 300; } }); }