@Override public boolean performOk() { try { if (preferences.hasChanged()) { preferences.save(); triggerRebuild(); } } catch (CoreException exception) { Activator.logError("Failed to save preferences", exception); return false; } return true; }
@Override protected void performDefaults() { preferences.resetToDefaults(); updateControlsFromPrefs(); updateControlsEnabled(); super.performDefaults(); }
private void selectFile() { FileDialog fileDialog = new FileDialog(getShell(), SWT.OPEN); fileDialog.setText("Select JSHint library file"); File file = new File(preferences.getCustomLibPath()); fileDialog.setFileName(file.getName()); fileDialog.setFilterPath(file.getParent()); fileDialog.setFilterNames(new String[] {"JavaScript files"}); fileDialog.setFilterExtensions(new String[] {"*.js", ""}); String selectedPath = fileDialog.open(); if (selectedPath != null) { customLibPathText.setText(selectedPath); } }
private void updateControlsFromPrefs() { customLibRadio.setSelection(preferences.getUseCustomLib()); defaultLibRadio.setSelection(!customLibRadio.getSelection()); customLibPathText.setText(preferences.getCustomLibPath()); enableErrorsCheckbox.setSelection(preferences.getEnableErrorMarkers()); }
private void validatePrefs() { if (preferences.getUseCustomLib()) { String path = preferences.getCustomLibPath(); validateFile(new File(path)); } }