diff --git a/java/maven/nbproject/project.properties b/java/maven/nbproject/project.properties index e32c9c9d58ee..db246fc845d1 100644 --- a/java/maven/nbproject/project.properties +++ b/java/maven/nbproject/project.properties @@ -34,7 +34,7 @@ test.config.stableBTD.excludes=\ jnlp.indirect.files=maven-nblib/netbeans-eventspy.jar,maven-nblib/netbeans-cos.jar -# requires nb.javac for compiling of tests +# TODO remove after JDK 17 bump (code uses CompilationUnitTree#getModule) requires.nb.javac=true test-unit-sys-prop.test.netbeans.dest.dir=${netbeans.dest.dir} diff --git a/java/maven/src/org/netbeans/modules/maven/execute/MavenCommandLineExecutor.java b/java/maven/src/org/netbeans/modules/maven/execute/MavenCommandLineExecutor.java index a3de953dfd55..2419314862b6 100644 --- a/java/maven/src/org/netbeans/modules/maven/execute/MavenCommandLineExecutor.java +++ b/java/maven/src/org/netbeans/modules/maven/execute/MavenCommandLineExecutor.java @@ -21,14 +21,10 @@ import java.awt.event.ActionEvent; import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; import java.io.IOException; -import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; import java.nio.charset.Charset; -import java.nio.file.Files; import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; @@ -44,19 +40,10 @@ import java.util.function.Consumer; import java.util.logging.Level; import java.util.logging.Logger; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; import javax.swing.AbstractAction; import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.versioning.DefaultArtifactVersion; -import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; -import org.apache.maven.artifact.versioning.VersionRange; -import org.apache.maven.model.Prerequisites; import org.apache.maven.project.MavenProject; -import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator; -import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.cli.CommandLineUtils; -import org.codehaus.plexus.util.xml.Xpp3Dom; import org.netbeans.api.annotations.common.NonNull; import org.netbeans.api.extexecution.base.ExplicitProcessParameters; import org.netbeans.api.extexecution.base.Processes; @@ -68,7 +55,6 @@ import org.netbeans.modules.maven.api.Constants; import org.netbeans.modules.maven.api.FileUtilities; import org.netbeans.modules.maven.api.NbMavenProject; -import org.netbeans.modules.maven.api.PluginPropertyUtils; import org.netbeans.modules.maven.api.execute.ActiveJ2SEPlatformProvider; import org.netbeans.modules.maven.api.execute.ExecutionContext; import org.netbeans.modules.maven.api.execute.ExecutionResultChecker; @@ -92,7 +78,6 @@ import org.openide.filesystems.FileObject; import org.openide.filesystems.FileUtil; import org.openide.modules.InstalledFileLocator; -import org.openide.modules.Places; import org.openide.modules.SpecificationVersion; import org.openide.util.Exceptions; import org.openide.util.ImageUtilities; @@ -100,7 +85,6 @@ import org.openide.util.NbBundle; import org.openide.util.RequestProcessor; import org.openide.util.Task; -import org.openide.util.TaskListener; import org.openide.util.Utilities; import org.openide.windows.IOColorLines; import org.openide.windows.IOColors; @@ -183,26 +167,20 @@ public ExecutorTask execute(RunConfig config, InputOutput io, TabContext tc) { MavenExecutor exec = createCommandLineExecutor(config, io, tc); ExecutorTask task = ExecutionEngine.getDefault().execute(config.getTaskDisplayName(), exec, new ProxyNonSelectableInputOutput(exec.getInputOutput())); exec.setTask(task); - task.addTaskListener(new TaskListener() { - @Override - public void taskFinished(Task t) { - MavenProject mp = config.getMavenProject(); - if (mp == null) { - return; - } - final List arts = new ArrayList(); - Artifact main = mp.getArtifact(); - if (main != null) { - arts.add(main); - } - arts.addAll(mp.getArtifacts()); - UPDATE_INDEX_RP.post(new Runnable() { - @Override - public void run() { - RepositoryIndexer.updateIndexWithArtifacts(RepositoryPreferences.getInstance().getLocalRepository(), arts); - } - }); + task.addTaskListener((Task t) -> { + MavenProject mp = config.getMavenProject(); + if (mp == null) { + return; } + final List arts = new ArrayList<>(); + Artifact main = mp.getArtifact(); + if (main != null) { + arts.add(main); + } + arts.addAll(mp.getArtifacts()); + UPDATE_INDEX_RP.post(() -> { + RepositoryIndexer.updateIndexWithArtifacts(RepositoryPreferences.getInstance().getLocalRepository(), arts); + }); }); return task; } @@ -271,17 +249,14 @@ public void run() { ex.getLocalizedMessage(), null, NotificationDisplayer.Priority.NORMAL, NotificationDisplayer.Category.ERROR); ioput.getErr().append(Bundle.ERR_CannotOverrideProxy(ex.getLocalizedMessage())); // FIXME: log exception - } catch (ExecutionException ex) { - // FIXME: log exception - } catch (InterruptedException ex) { - // FIXME: log exception + } catch (ExecutionException | InterruptedException ex) { + LOGGER.log(Level.WARNING, "could not determine proxy settings", ex); } finally { if (!ok) { ioput.getOut().close(); ioput.getErr().close(); actionStatesAtFinish(null, null); markFreeTab(); - return; } } } @@ -429,7 +404,7 @@ int executeProcess(CommandLineOutputHandler out, ProcessBuilder builder, Consume } private void kill(Process prcs, String uuid) { - Map env = new HashMap(); + Map env = new HashMap<>(); env.put(KEY_UUID, uuid); Processes.killTree(prcs, env); } @@ -440,22 +415,19 @@ public boolean cancel() { preProcess = null; final Process pro = process; process = null; - RP.post(new Runnable() { - @Override - public void run() { - if (pre != null) { - kill(pre, preProcessUUID); - } - if (pro != null) { - kill(pro, processUUID); - } + RP.post(() -> { + if (pre != null) { + kill(pre, preProcessUUID); + } + if (pro != null) { + kill(pro, processUUID); } }); return true; } private static List createMavenExecutionCommand(RunConfig config, Constructor base) { - List toRet = new ArrayList(base.construct()); + List toRet = new ArrayList<>(base.construct()); if (Utilities.isUnix()) { // #198997 - defend against symlinks File basedir = config.getExecutionDirectory(); @@ -501,7 +473,7 @@ private static List createMavenExecutionCommand(RunConfig config, Constr } } - if (config.isOffline() != null && config.isOffline().booleanValue()) { + if (config.isOffline() != null && config.isOffline()) { toRet.add("--offline");//NOI18N } if (!config.isInteractive()) { @@ -557,7 +529,7 @@ private static List createMavenExecutionCommand(RunConfig config, Constr if (config.isInteractive() && (one.equals("--batch-mode") || one.equals("-B"))) { continue; } - if ((config.isOffline() != null && !config.isOffline().booleanValue()) && (one.equals("--offline") || one.equals("-o"))) { + if ((config.isOffline() != null && !config.isOffline()) && (one.equals("--offline") || one.equals("-o"))) { continue; } } @@ -636,7 +608,7 @@ private static String quote2apos(String s) { // tests only ProcessBuilder constructBuilder(final RunConfig clonedConfig, InputOutput ioput) { File javaHome = null; - Map envMap = new LinkedHashMap(); + Map envMap = new LinkedHashMap<>(); for (Map.Entry entry : clonedConfig.getProperties().entrySet()) { if (entry.getKey().startsWith(ENV_PREFIX)) { String env = entry.getKey().substring(ENV_PREFIX.length()); @@ -697,12 +669,6 @@ ProcessBuilder constructBuilder(final RunConfig clonedConfig, InputOutput ioput) constructeur = new WrapperShellConstructor(wrapper); } else { mavenHome = EmbedderFactory.getEffectiveMavenHome(); - if (MavenSettings.getDefault().isUseBestMaven()) { - File n = guessBestMaven(clonedConfig, ioput); - if (n != null) { - mavenHome = n; - } - } constructeur = new ShellConstructor(mavenHome); } @@ -779,13 +745,8 @@ ProcessBuilder constructBuilder(final RunConfig clonedConfig, InputOutput ioput) } else { //very hacky here.. have a way to remove - List command = new ArrayList(builder.command()); - for (Iterator it = command.iterator(); it.hasNext();) { - String s = it.next(); - if (s.startsWith("-D" + CosChecker.MAVENEXTCLASSPATH + "=")) { - it.remove(); - } - } + List command = new ArrayList<>(builder.command()); + command.removeIf(s -> s.startsWith("-D" + CosChecker.MAVENEXTCLASSPATH + "=")); display.append(Utilities.escapeParameters(command.toArray(new String[0]))); } @@ -832,12 +793,9 @@ public void outputLineAction(OutputEvent ev) { } ioput.getErr().println(" This message will show on the next start of the IDE again, to skip it, add -J-Dmaven.run.cmd=true to your etc/netbeans.conf file in your NetBeans installation."); //NOI18N - in maven output ioput.getErr().println("The detailed exception output is printed to the IDE's log file."); //NOI18N - in maven output - RP.post(new Runnable() { - @Override - public void run() { - RunConfig newConfig = new BeanRunConfig(config); - RunUtils.executeMaven(newConfig); - } + RP.post(() -> { + RunConfig newConfig = new BeanRunConfig(config); + RunUtils.executeMaven(newConfig); }); } else { ioput.getErr().println(x.getMessage()); @@ -935,167 +893,6 @@ static boolean isMultiThreadedMaven(List params) { } return false; } - - private File guessBestMaven(RunConfig clonedConfig, InputOutput ioput) { - MavenProject mp = clonedConfig.getMavenProject(); - if (mp != null) { - if (mp.getPrerequisites() != null) { - Prerequisites pp = mp.getPrerequisites(); - String ver = pp.getMaven(); - if (ver != null) { - return checkAvailability(ver, null, ioput); - } - } - String value = PluginPropertyUtils.getPluginPropertyBuildable(clonedConfig.getMavenProject(), Constants.GROUP_APACHE_PLUGINS, "maven-enforcer-plugin", "enforce", new PluginPropertyUtils.ConfigurationBuilder() { - @Override - public String build(Xpp3Dom configRoot, ExpressionEvaluator eval) { - if(configRoot != null) { - Xpp3Dom rules = configRoot.getChild("rules"); - if (rules != null) { - Xpp3Dom rmv = rules.getChild("requireMavenVersion"); - if (rmv != null) { - Xpp3Dom v = rmv.getChild("version"); - if (v != null) { - return v.getValue(); - } - } - } - } - return null; - } - }); - if (value != null) { - if (value.contains("[") || value.contains("(")) { - try { - VersionRange vr = VersionRange.createFromVersionSpec(value); - return checkAvailability(null, vr, ioput); - } catch (InvalidVersionSpecificationException ex) { - Exceptions.printStackTrace(ex); - } - } else { - return checkAvailability(value, null, ioput); - } - } - } - return null; - } - - private File checkAvailability(String ver, VersionRange vr, InputOutput ioput) { - ArrayList all = new ArrayList<>(MavenSettings.getDefault().getUserDefinedMavenRuntimes()); - //TODO this could be slow? but is it slower than downloading stuff? - //is there a faster way? or can we somehow log the findings after first attempt? - DefaultArtifactVersion candidate = null; - File candidateFile = null; - for (String one : all) { - File f = FileUtil.normalizeFile(new File(one)); - String oneVersion = MavenSettings.getCommandLineMavenVersion(f); - if(oneVersion == null) { - continue; - } - if (ver != null && ver.equals(oneVersion)) { - return f; - } - DefaultArtifactVersion dav = new DefaultArtifactVersion(oneVersion); - if (vr != null && vr.containsVersion(dav)) { - if (candidate != null) { - if (candidate.compareTo(dav) < 0) { - candidate = dav; - candidateFile = f; - } - } else { - candidate = new DefaultArtifactVersion(oneVersion); - candidateFile = f; - } - } - } - if (candidateFile != null) { - return candidateFile; - } else if (vr != null) { - ver = vr.getRecommendedVersion() != null ? vr.getRecommendedVersion().toString() : null; - if (ver == null) { - //TODO can we figure out which version to get without hardwiring a list of known versions? - ioput.getOut().println("NetBeans: No match and no recommended version for version range " + vr.toString()); - return null; - } - } - if (ver == null) { - return null; - } - - File f = getAltMavenLocation(); - File child = FileUtil.normalizeFile(new File(f, "apache-maven-" + ver)); - if (child.exists()) { - return child; - } else { - f.mkdirs(); - ioput.getOut().println("NetBeans: Downloading and unzipping Maven version " + ver); - try { - //this url pattern works for all versions except the last one 3.2.3 - //which is only under /apache/maven/maven-3/3.2.3/binaries/ - URL[] urls = new URL[] {new URL("http://archive.apache.org/dist/maven/binaries/apache-maven-" + ver + "-bin.zip"), - new URL("http://archive.apache.org/dist/maven/maven-3/" + ver + "/binaries/apache-maven-" + ver + "-bin.zip")}; - InputStream is = null; - for (URL u : urls) { - try { - is = u.openStream(); - break; - } catch (FileNotFoundException e) { - // try next url - } - } - if(is == null) { - LOGGER.log(Level.WARNING, "wasn''t able to download maven binaries, version {0}", ver); - return null; - } - try (ZipInputStream str = new ZipInputStream(is)) { - ZipEntry entry; - while ((entry = str.getNextEntry()) != null) { - //base it of f not child as the zip contains the maven base folder - File fileOrDir = new File(f, entry.getName()); - if (entry.isDirectory()) { - fileOrDir.mkdirs(); - } else { - Files.copy(str, fileOrDir.toPath()); - // correct way to set executable flag? - if ("bin".equals(fileOrDir.getParentFile().getName()) && !fileOrDir.getName().endsWith(".conf")) { - fileOrDir.setExecutable(true); - } - } - } - } - if (!all.contains(child.getAbsolutePath())) { - all.add(child.getAbsolutePath()); - MavenSettings.getDefault().setMavenRuntimes(all); - } - return child; - } catch (MalformedURLException ex) { - Exceptions.printStackTrace(ex); - try { - FileUtils.deleteDirectory(child); - } catch (IOException ex1) { - Exceptions.printStackTrace(ex1); - } - } catch (IOException ex) { - Exceptions.printStackTrace(ex); - try { - FileUtils.deleteDirectory(child); - } catch (IOException ex1) { - Exceptions.printStackTrace(ex1); - } - } - } - return null; - } - - private File getAltMavenLocation() { - if (MavenSettings.getDefault().isUseBestMavenAltLocation()) { - String s = MavenSettings.getDefault().getBestMavenAltLocation(); - if (s != null && s.trim().length() > 0) { - return FileUtil.normalizeFile(new File(s)); - } - } - return Places.getCacheSubdirectory("downloaded-mavens"); - } private File searchMavenWrapper(RunConfig config) { String fileName = Utilities.isWindows() ? "mvnw.cmd" : "mvnw"; //NOI18N diff --git a/java/maven/src/org/netbeans/modules/maven/options/Bundle.properties b/java/maven/src/org/netbeans/modules/maven/options/Bundle.properties index 065cc4758517..7a98ffcc52c2 100644 --- a/java/maven/src/org/netbeans/modules/maven/options/Bundle.properties +++ b/java/maven/src/org/netbeans/modules/maven/options/Bundle.properties @@ -74,11 +74,6 @@ SettingsPanel.lblOutputTab.text=Output Tab identified by: SettingsPanel.rbOutputTabName.text=Project Name SettingsPanel.rbOutputTabId.text=Maven ArtifactId SettingsPanel.cbOutputTabShowConfig.text=Also show active configuration -SettingsPanel.cbUseBestMaven.text=Download and use best Maven binary for execution -SettingsPanel.cbAlternateLocation.text=Use the following location to store Maven binaries -SettingsPanel.lblDirectory.text=Directory: -SettingsPanel.btnDirectory.text=Browse... -SettingsPanel.lblHint.text=Attempts to judge which version of binaries is the best suited for the project by examining prerequisites section in pom and maven-enforcer-plugin configuration.

(Please note that IDE will not use it's $MAVEN_HOME/conf/settings.xml for project resolution) SettingsPanel.lblDefault.text=Default SettingsPanel.lblCustom.text=Custom... SettingsPanel.cbShowInfoLevel.text=&Print Maven output logging level @@ -102,7 +97,6 @@ in the NetBeans cache directory and some time to asynchronously scan and recompu the index periodically. SettingsPanel.appearancePanel.border.title=Appearance SettingsPanel.dependenciesPanel.border.title=Dependency Download Strategy -SettingsPanel.experimentalPanel.border.title=Experimental SettingsPanel.lblIndexFilter.text=Index Filter: SettingsPanel.rb2Years.text=2 years SettingsPanel.rb5Years.text=5 years diff --git a/java/maven/src/org/netbeans/modules/maven/options/MavenSettings.java b/java/maven/src/org/netbeans/modules/maven/options/MavenSettings.java index a5bf8b940587..ba274a6f3724 100644 --- a/java/maven/src/org/netbeans/modules/maven/options/MavenSettings.java +++ b/java/maven/src/org/netbeans/modules/maven/options/MavenSettings.java @@ -74,9 +74,6 @@ public final class MavenSettings { private static final String PROP_COLLAPSE_FOLDS = "collapseSuccessFolds"; private static final String PROP_OUTPUT_TAB_CONFIG = "showConfigInOutputTab"; private static final String PROP_OUTPUT_TAB_NAME = "showOutputTabAs"; - private static final String PROP_EXPERIMENTAL_USE_BEST_MAVEN = "useBestMaven"; - private static final String PROP_EXPERIMENTAL_USE_ALTERNATE_LOCATION = "useBestMavenAltLocation"; - private static final String PROP_EXPERIMENTAL_ALTERNATE_LOCATION = "bestMavenAltLocation"; private static final String PROP_VM_OPTIONS_WRAP = "vmOptionsWrap"; private static final String PROP_DEFAULT_JDK = "defaultJdk"; private static final String PROP_PREFER_WRAPPER = "preferWrapper"; //NOI18N @@ -358,32 +355,55 @@ public void setPreferMavenWrapper(boolean preferWrapper) { getPreferences().putBoolean(PROP_PREFER_WRAPPER, preferWrapper); } + /** + * Deprecated for removal - use mvnw instead. + * Returns false. + */ + @Deprecated/*(forRemoval = true)*/ public boolean isUseBestMaven() { - return getPreferences().getBoolean(PROP_EXPERIMENTAL_USE_BEST_MAVEN, false); + return false; } + /** + * Deprecated for removal - use mvnw instead. + * No-op. + */ + @Deprecated/*(forRemoval = true)*/ public void setUseBestMaven(boolean bestMaven) { - getPreferences().putBoolean(PROP_EXPERIMENTAL_USE_BEST_MAVEN, bestMaven); } + /** + * Deprecated for removal - use mvnw instead. + * Returns false. + */ + @Deprecated/*(forRemoval = true)*/ public boolean isUseBestMavenAltLocation() { - return getPreferences().getBoolean(PROP_EXPERIMENTAL_USE_ALTERNATE_LOCATION, false); + return false; } + /** + * Deprecated for removal - use mvnw instead. + * No-op. + */ + @Deprecated/*(forRemoval = true)*/ public void setUseBestMavenAltLocation(boolean bestMavenAltLocation) { - getPreferences().putBoolean(PROP_EXPERIMENTAL_USE_ALTERNATE_LOCATION, bestMavenAltLocation); } + /** + * Deprecated for removal - use mvnw instead. + * No-op. + */ + @Deprecated/*(forRemoval = true)*/ public void setBestMavenAltLocation(String location) { - if (null == location) { - getPreferences().remove(PROP_EXPERIMENTAL_ALTERNATE_LOCATION); - } else { - putProperty(PROP_EXPERIMENTAL_ALTERNATE_LOCATION, location); - } } + /** + * Deprecated for removal - use mvnw instead. + * Returns null. + */ + @Deprecated/*(forRemoval = true)*/ public String getBestMavenAltLocation() { - return getPreferences().get(PROP_EXPERIMENTAL_ALTERNATE_LOCATION, null); //NOI18N + return null; } diff --git a/java/maven/src/org/netbeans/modules/maven/options/SettingsPanel.form b/java/maven/src/org/netbeans/modules/maven/options/SettingsPanel.form index 0d199fc593fc..d756d11a2ddc 100644 --- a/java/maven/src/org/netbeans/modules/maven/options/SettingsPanel.form +++ b/java/maven/src/org/netbeans/modules/maven/options/SettingsPanel.form @@ -558,145 +558,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1033,12 +894,11 @@ - + - diff --git a/java/maven/src/org/netbeans/modules/maven/options/SettingsPanel.java b/java/maven/src/org/netbeans/modules/maven/options/SettingsPanel.java index ba08cca35223..4b02c0ff4118 100644 --- a/java/maven/src/org/netbeans/modules/maven/options/SettingsPanel.java +++ b/java/maven/src/org/netbeans/modules/maven/options/SettingsPanel.java @@ -43,7 +43,6 @@ import javax.swing.JSeparator; import javax.swing.ListCellRenderer; import javax.swing.SwingUtilities; -import javax.swing.event.ChangeEvent; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import javax.swing.table.AbstractTableModel; @@ -204,12 +203,6 @@ public void actionPerformed(ActionEvent e) { cbEnableMultiThreading.addActionListener(listener); cbEnableIndexDownload.addActionListener(listener); cbPreferWrapper.addActionListener(listener); - cbUseBestMaven.addActionListener(listener); - cbAlternateLocation.addActionListener(listener); - cbAlternateLocation.addChangeListener((ChangeEvent e) -> { - txtDirectory.setEnabled(cbAlternateLocation.isSelected()); - }); - txtDirectory.getDocument().addDocumentListener(new DocumentListenerImpl()); txtOptions.getDocument().addDocumentListener(new DocumentListenerImpl()); txtProjectNodeNameCustomPattern.setVisible(false); txtProjectNodeNameCustomPattern.getDocument().addDocumentListener(new DocumentListenerImpl()); @@ -384,14 +377,6 @@ private void initComponents() { rbFullIndex = new javax.swing.JRadioButton(); rb5Years = new javax.swing.JRadioButton(); rb2Years = new javax.swing.JRadioButton(); - plnExperimental = new javax.swing.JPanel(); - javax.swing.JPanel experimentalPanel = new javax.swing.JPanel(); - cbUseBestMaven = new javax.swing.JCheckBox(); - lblHint = new javax.swing.JLabel(); - cbAlternateLocation = new javax.swing.JCheckBox(); - lblDirectory = new javax.swing.JLabel(); - txtDirectory = new javax.swing.JTextField(); - btnDirectory = new javax.swing.JButton(); pnlExecution = new javax.swing.JPanel(); lblCommandLine = new javax.swing.JLabel(); comMavenHome = new javax.swing.JComboBox(); @@ -684,83 +669,6 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { pnlCards.add(pnlIndex, "index"); - experimentalPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.experimentalPanel.border.title"))); // NOI18N - - org.openide.awt.Mnemonics.setLocalizedText(cbUseBestMaven, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.cbUseBestMaven.text")); // NOI18N - - org.openide.awt.Mnemonics.setLocalizedText(lblHint, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.lblHint.text")); // NOI18N - lblHint.setVerticalAlignment(javax.swing.SwingConstants.TOP); - - org.openide.awt.Mnemonics.setLocalizedText(cbAlternateLocation, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.cbAlternateLocation.text")); // NOI18N - - org.openide.awt.Mnemonics.setLocalizedText(lblDirectory, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.lblDirectory.text")); // NOI18N - - org.openide.awt.Mnemonics.setLocalizedText(btnDirectory, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.btnDirectory.text")); // NOI18N - btnDirectory.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnDirectoryActionPerformed(evt); - } - }); - - javax.swing.GroupLayout experimentalPanelLayout = new javax.swing.GroupLayout(experimentalPanel); - experimentalPanel.setLayout(experimentalPanelLayout); - experimentalPanelLayout.setHorizontalGroup( - experimentalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(experimentalPanelLayout.createSequentialGroup() - .addContainerGap() - .addGroup(experimentalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(experimentalPanelLayout.createSequentialGroup() - .addGroup(experimentalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(cbUseBestMaven) - .addComponent(cbAlternateLocation)) - .addGap(0, 179, Short.MAX_VALUE)) - .addGroup(experimentalPanelLayout.createSequentialGroup() - .addGap(29, 29, 29) - .addGroup(experimentalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(lblHint, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) - .addGroup(experimentalPanelLayout.createSequentialGroup() - .addComponent(lblDirectory) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(txtDirectory) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(btnDirectory))))) - .addContainerGap()) - ); - experimentalPanelLayout.setVerticalGroup( - experimentalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(experimentalPanelLayout.createSequentialGroup() - .addContainerGap() - .addComponent(cbUseBestMaven) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(lblHint, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(cbAlternateLocation) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(experimentalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(lblDirectory) - .addComponent(txtDirectory, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(btnDirectory)) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - ); - - javax.swing.GroupLayout plnExperimentalLayout = new javax.swing.GroupLayout(plnExperimental); - plnExperimental.setLayout(plnExperimentalLayout); - plnExperimentalLayout.setHorizontalGroup( - plnExperimentalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, plnExperimentalLayout.createSequentialGroup() - .addContainerGap() - .addComponent(experimentalPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - ); - plnExperimentalLayout.setVerticalGroup( - plnExperimentalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(plnExperimentalLayout.createSequentialGroup() - .addContainerGap() - .addComponent(experimentalPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap(209, Short.MAX_VALUE)) - ); - - pnlCards.add(plnExperimental, "experimental"); - lblCommandLine.setLabelFor(comMavenHome); org.openide.awt.Mnemonics.setLocalizedText(lblCommandLine, org.openide.util.NbBundle.getMessage(SettingsPanel.class, "SettingsPanel.lblCommandLine.text")); // NOI18N @@ -928,7 +836,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { pnlCards.add(pnlExecution, "execution"); lstCategory.setModel(new javax.swing.AbstractListModel() { - String[] strings = { "execution", "index", "appearance", "dependencies", "experimental" }; + String[] strings = { "execution", "index", "appearance", "dependencies" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } }); @@ -1022,28 +930,6 @@ private void lstCategoryValueChanged(javax.swing.event.ListSelectionEvent evt) { cl.show(pnlCards, (String) lstCategory.getSelectedValue()); }//GEN-LAST:event_lstCategoryValueChanged - private void btnDirectoryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDirectoryActionPerformed - JFileChooser chooser = new JFileChooser(); - chooser.setDialogTitle("Select alternate directory"); - chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); - chooser.setFileHidingEnabled(false); - String path = txtDirectory.getText(); - if (path == null || path.trim().length() == 0) { - path = new File(System.getProperty("user.home")).getAbsolutePath(); //NOI18N - } - if (path.length() > 0) { - File f = new File(path); - if (f.exists()) { - chooser.setSelectedFile(f); - } - } - if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this)) { - File projectDir = chooser.getSelectedFile(); - txtDirectory.setText(projectDir.getAbsolutePath()); - } - - }//GEN-LAST:event_btnDirectoryActionPerformed - private void comManageJdksActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comManageJdksActionPerformed PlatformsCustomizer.showCustomizer(findSelectedJdk(new String[1])); }//GEN-LAST:event_comManageJdksActionPerformed @@ -1070,12 +956,10 @@ private void updateIndexingControls() { // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.ButtonGroup bgIndexFilter; - private javax.swing.JButton btnDirectory; private javax.swing.JButton btnGoals; private javax.swing.JButton btnIndex; private javax.swing.JButton btnOptions; private javax.swing.ButtonGroup buttonGroup1; - private javax.swing.JCheckBox cbAlternateLocation; private javax.swing.JCheckBox cbAlwaysShow; private javax.swing.JCheckBox cbCollapseSuccessFolds; private javax.swing.JCheckBox cbEnableIndexDownload; @@ -1088,7 +972,6 @@ private void updateIndexingControls() { private javax.swing.JCheckBox cbReuse; private javax.swing.JCheckBox cbShowInfoLevel; private javax.swing.JCheckBox cbSkipTests; - private javax.swing.JCheckBox cbUseBestMaven; private javax.swing.JComboBox comBinaries; private javax.swing.JComboBox comIndex; private javax.swing.JComboBox comJavadoc; @@ -1103,9 +986,7 @@ private void updateIndexingControls() { private javax.swing.JLabel lblBinaries; private javax.swing.JLabel lblCategory; private javax.swing.JLabel lblCommandLine; - private javax.swing.JLabel lblDirectory; private javax.swing.JLabel lblExternalVersion; - private javax.swing.JLabel lblHint; private javax.swing.JLabel lblIndex; private javax.swing.JLabel lblIndexFilter; private javax.swing.JLabel lblJavadoc; @@ -1115,7 +996,6 @@ private void updateIndexingControls() { private javax.swing.JLabel lblSource; private javax.swing.JList lstCategory; private javax.swing.JTable permissionsTable; - private javax.swing.JPanel plnExperimental; private javax.swing.JPanel pnlAppearance; private javax.swing.JPanel pnlCards; private javax.swing.JPanel pnlDependencies; @@ -1126,7 +1006,6 @@ private void updateIndexingControls() { private javax.swing.JRadioButton rbFullIndex; private javax.swing.JRadioButton rbOutputTabId; private javax.swing.JRadioButton rbOutputTabName; - private javax.swing.JTextField txtDirectory; private javax.swing.JTextField txtOptions; private javax.swing.JTextField txtProjectNodeNameCustomPattern; // End of variables declaration//GEN-END:variables @@ -1166,7 +1045,7 @@ private void browseAddNewRuntime() { File projectDir = chooser.getSelectedFile(); String newRuntimePath = FileUtil.normalizeFile(projectDir).getAbsolutePath(); boolean existed = false; - List runtimes = new ArrayList(); + List runtimes = new ArrayList<>(); runtimes.addAll(predefinedRuntimes); runtimes.addAll(userDefinedMavenRuntimes); for (String runtime : runtimes) { @@ -1280,9 +1159,6 @@ public void run() { cbCollapseSuccessFolds.setSelected(MavenSettings.getDefault().isCollapseSuccessFolds()); cbOutputTabShowConfig.setSelected(MavenSettings.getDefault().isOutputTabShowConfig()); cbPreferWrapper.setSelected(MavenSettings.getDefault().isPreferMavenWrapper()); - cbUseBestMaven.setSelected(MavenSettings.getDefault().isUseBestMaven()); - cbAlternateLocation.setSelected(MavenSettings.getDefault().isUseBestMavenAltLocation()); - txtDirectory.setText(MavenSettings.getDefault().getBestMavenAltLocation()); updateIndexingControls(); updatePermissionsTable(); @@ -1366,11 +1242,6 @@ public void applyValues() { MavenSettings.getDefault().setCollapseSuccessFolds(cbCollapseSuccessFolds.isSelected()); MavenSettings.getDefault().setOutputTabShowConfig(cbOutputTabShowConfig.isSelected()); MavenSettings.getDefault().setPreferMavenWrapper(cbPreferWrapper.isSelected()); - MavenSettings.getDefault().setUseBestMaven(cbUseBestMaven.isSelected()); - MavenSettings.getDefault().setUseBestMavenAltLocation(cbAlternateLocation.isSelected()); - if (cbAlternateLocation.isSelected()) { - MavenSettings.getDefault().setBestMavenAltLocation(txtDirectory.getText()); - } MavenSettings.OutputTabName name = rbOutputTabName.isSelected() ? MavenSettings.OutputTabName.PROJECT_NAME : MavenSettings.OutputTabName.PROJECT_ID; MavenSettings.getDefault().setOutputTabName(name); @@ -1440,8 +1311,6 @@ private void fireChanged() { isChanged |= MavenSettings.getDefault().isCollapseSuccessFolds() != cbCollapseSuccessFolds.isSelected(); isChanged |= MavenSettings.getDefault().isOutputTabShowConfig() != cbOutputTabShowConfig.isSelected(); isChanged |= MavenSettings.getDefault().isPreferMavenWrapper() != cbPreferWrapper.isSelected(); - isChanged |= MavenSettings.getDefault().isUseBestMaven() != cbUseBestMaven.isSelected(); - isChanged |= MavenSettings.getDefault().isUseBestMavenAltLocation() != cbAlternateLocation.isSelected(); MavenSettings.OutputTabName name = rbOutputTabName.isSelected() ? MavenSettings.OutputTabName.PROJECT_NAME : MavenSettings.OutputTabName.PROJECT_ID; isChanged |= MavenSettings.getDefault().getOutputTabName().compareTo(name) != 0; String projectNodeNamePattern = MavenSettings.getDefault().getProjectNodeNamePattern();