/** Call this to browse for a custom gradle executor. */ private void browseForCustomGradleExecutor() { File startingDirectory = new File(SystemProperties.getInstance().getUserHome()); File currentFile = gradlePluginLord.getCustomGradleExecutor(); if (currentFile != null) { startingDirectory = currentFile.getAbsoluteFile(); } else { if (gradlePluginLord.getCurrentDirectory() != null) { startingDirectory = gradlePluginLord.getCurrentDirectory(); } } JFileChooser chooser = new JFileChooser(startingDirectory); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); chooser.setMultiSelectionEnabled(false); File file = null; if (chooser.showOpenDialog(mainPanel) == JFileChooser.APPROVE_OPTION) { file = chooser.getSelectedFile(); } if (file != null) { setCustomGradleExecutor(file); } else { // if they canceled, and they have no custom gradle executor specified, then we must // clear things // This will reset the UI back to 'not using a custom executor'. We can't have them check the // field and not have a value here. if (gradlePluginLord.getCustomGradleExecutor() == null) { setCustomGradleExecutor(null); } } }
/** * Called upon start up and whenever GradlePluginLord settings are changed. We'll update our * values. Note: this actually gets called several times in a row for each settings during * initialization. Its not optimal, but functional and I didn't want to deal with numerous, * specific-field notifications. */ private void updatePluginLordSettings() { setCustomGradleExecutor(gradlePluginLord.getCustomGradleExecutor()); setCurrentDirectory(gradlePluginLord.getCurrentDirectory()); setSelectedStackTraceLevel(gradlePluginLord.getStackTraceLevel()); setLogLevelComboBoxSetting(gradlePluginLord.getLogLevel()); }