You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by lk...@apache.org on 2020/10/14 16:45:20 UTC
[netbeans] branch master updated: Bugfixes for VSCode and Gradle
(#2453)
This is an automated email from the ASF dual-hosted git repository.
lkishalmi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git
The following commit(s) were added to refs/heads/master by this push:
new 02cb755 Bugfixes for VSCode and Gradle (#2453)
02cb755 is described below
commit 02cb755767da54b364a8d6dfcb222e5e86459fb0
Author: Jaroslav Tulach <ja...@oracle.com>
AuthorDate: Wed Oct 14 18:44:56 2020 +0200
Bugfixes for VSCode and Gradle (#2453)
* Mention the possibility to use -D3rdparty.modules= property
* Don't print empty lines as the EOL character is implicit in the logMessage
* Avoiding NPE when debugger queries local variables
* Let npm run nbcode share the user directory with extension launcher
* Don't update the actions in headless mode
* Branding API to disable reuse of output tabs in Gradle
Co-authored-by: Jan Lahoda <ja...@oracle.com>
---
extide/gradle/apichanges.xml | 14 ++++++
extide/gradle/arch.xml | 8 +++
extide/gradle/manifest.mf | 2 +-
.../gradle/execute/AbstractGradleExecutor.java | 13 +++--
.../modules/gradle/spi/GradleSettings.java | 12 ++++-
.../modules/gradle/spi/Bundle_test.properties | 18 +++++++
.../modules/gradle/spi/GradleSettingsTest.java | 57 ++++++++++++++++++++++
.../netbeans/modules/gradle/spi/Bundle.properties | 18 +++++++
8 files changed, 137 insertions(+), 5 deletions(-)
diff --git a/extide/gradle/apichanges.xml b/extide/gradle/apichanges.xml
index 9fc9784..a26c468 100644
--- a/extide/gradle/apichanges.xml
+++ b/extide/gradle/apichanges.xml
@@ -83,6 +83,20 @@ is the proper place.
<!-- ACTUAL CHANGES BEGIN HERE: -->
<changes>
+ <change id="reusetabs">
+ <api name="general"/>
+ <summary>Default for reusing tabs</summary>
+ <version major="2" minor="5"/>
+ <date day="15" month="10" year="2020"/>
+ <author login="jtulach"/>
+ <compatibility semantic="compatible"/>
+ <description>
+ <p>
+ Introducing <a href="@TOP@architecture-summary.html#group-branding">branding APIs</a>
+ to configure default value for <b>reusing tabs</b> in Gradle projects.
+ </p>
+ </description>
+ </change>
<change id="gradle-buildsrc-project">
<api name="general"/>
<summary>GradleFiles SPI has the methods to deal with the buildSrc project.</summary>
diff --git a/extide/gradle/arch.xml b/extide/gradle/arch.xml
index 290b296..4364167 100644
--- a/extide/gradle/arch.xml
+++ b/extide/gradle/arch.xml
@@ -130,6 +130,14 @@
<answer id="exec-property">
+ <api category="devel" group="branding" name="DEFAULT_REUSE_OUTPUT" type="export">
+ Brand the <code>DEFAULT_REUSE_OUTPUT</code> key in a
+ <code>org.netbeans.modules.gradle.spi.Bundle</code> file
+ with one of the values <code>true</code> or <code>false</code>
+ to specify the default behavior of reusing output by your application.
+ Use <code>never</code> value, if the reuse shall never be done,
+ regardless of the settings value.
+ </api>
</answer>
<answer id="resources-file">
diff --git a/extide/gradle/manifest.mf b/extide/gradle/manifest.mf
index 58ebdd8..c49a1e5 100644
--- a/extide/gradle/manifest.mf
+++ b/extide/gradle/manifest.mf
@@ -3,4 +3,4 @@ AutoUpdate-Show-In-Client: false
OpenIDE-Module: org.netbeans.modules.gradle/2
OpenIDE-Module-Layer: org/netbeans/modules/gradle/layer.xml
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/gradle/Bundle.properties
-OpenIDE-Module-Specification-Version: 2.4
+OpenIDE-Module-Specification-Version: 2.5
diff --git a/extide/gradle/src/org/netbeans/modules/gradle/execute/AbstractGradleExecutor.java b/extide/gradle/src/org/netbeans/modules/gradle/execute/AbstractGradleExecutor.java
index 75555dd..5c12fc5 100644
--- a/extide/gradle/src/org/netbeans/modules/gradle/execute/AbstractGradleExecutor.java
+++ b/extide/gradle/src/org/netbeans/modules/gradle/execute/AbstractGradleExecutor.java
@@ -19,6 +19,8 @@
package org.netbeans.modules.gradle.execute;
+import java.awt.EventQueue;
+import java.awt.GraphicsEnvironment;
import org.netbeans.modules.gradle.api.GradleBaseProject;
import org.netbeans.modules.gradle.api.execute.RunConfig;
import org.netbeans.modules.gradle.api.execute.RunUtils;
@@ -36,7 +38,6 @@ import org.openide.util.RequestProcessor;
import static org.netbeans.modules.gradle.execute.Bundle.*;
import java.io.File;
import java.util.ArrayList;
-import javax.swing.SwingUtilities;
import org.netbeans.api.project.Project;
import org.netbeans.modules.gradle.api.execute.GradleCommandLine;
import static org.netbeans.modules.gradle.api.execute.RunConfig.ExecFlag.REPEATABLE;
@@ -128,7 +129,7 @@ public abstract class AbstractGradleExecutor extends OutputTabMaintainer<Abstrac
}
protected final void actionStatesAtStart() {
- SwingUtilities.invokeLater(new Runnable() {
+ invokeUILater(new Runnable() {
@Override
public void run() {
disableAction(tabContext.rerun);
@@ -139,7 +140,7 @@ public abstract class AbstractGradleExecutor extends OutputTabMaintainer<Abstrac
}
protected final void actionStatesAtFinish() {
- SwingUtilities.invokeLater(new Runnable() {
+ invokeUILater(new Runnable() {
@Override
public void run() {
enableAction(tabContext.rerun);
@@ -298,4 +299,10 @@ public abstract class AbstractGradleExecutor extends OutputTabMaintainer<Abstrac
}
}
+ private static void invokeUILater(Runnable runnable) {
+ if (GraphicsEnvironment.isHeadless()) {
+ return;
+ }
+ EventQueue.invokeLater(runnable);
+ }
}
diff --git a/extide/gradle/src/org/netbeans/modules/gradle/spi/GradleSettings.java b/extide/gradle/src/org/netbeans/modules/gradle/spi/GradleSettings.java
index d4cb7ee..aa63c46 100644
--- a/extide/gradle/src/org/netbeans/modules/gradle/spi/GradleSettings.java
+++ b/extide/gradle/src/org/netbeans/modules/gradle/spi/GradleSettings.java
@@ -24,6 +24,7 @@ import java.util.prefs.Preferences;
import org.gradle.util.GradleVersion;
import org.netbeans.modules.gradle.api.execute.GradleCommandLine.LogLevel;
import org.netbeans.modules.gradle.api.execute.GradleCommandLine.StackTrace;
+import org.openide.util.NbBundle;
import org.openide.util.NbBundle.Messages;
import org.openide.util.NbPreferences;
@@ -190,8 +191,17 @@ public final class GradleSettings {
getPreferences().putBoolean(PROP_REUSE_OUTPUT_TABS, b);
}
+ @NbBundle.Messages({
+ "#reuse output tabs: true, false, never",
+ "#NOI18N",
+ "DEFAULT_REUSE_OUTPUT=true"
+ })
public boolean isReuseOutputTabs() {
- return getPreferences().getBoolean(PROP_REUSE_OUTPUT_TABS, true);
+ String def = Bundle.DEFAULT_REUSE_OUTPUT();
+ if ("never".equals(def)) { // NOI18N
+ return false;
+ }
+ return getPreferences().getBoolean(PROP_REUSE_OUTPUT_TABS, "true".equals(def)); // NOI18N
}
public void setOffline(boolean b) {
diff --git a/extide/gradle/test/unit/src/org/netbeans/modules/gradle/spi/Bundle_test.properties b/extide/gradle/test/unit/src/org/netbeans/modules/gradle/spi/Bundle_test.properties
new file mode 100644
index 0000000..67f3c42
--- /dev/null
+++ b/extide/gradle/test/unit/src/org/netbeans/modules/gradle/spi/Bundle_test.properties
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+DEFAULT_REUSE_OUTPUT=never
diff --git a/extide/gradle/test/unit/src/org/netbeans/modules/gradle/spi/GradleSettingsTest.java b/extide/gradle/test/unit/src/org/netbeans/modules/gradle/spi/GradleSettingsTest.java
new file mode 100644
index 0000000..e4b0b1e
--- /dev/null
+++ b/extide/gradle/test/unit/src/org/netbeans/modules/gradle/spi/GradleSettingsTest.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.gradle.spi;
+
+import java.util.prefs.BackingStoreException;
+import java.util.prefs.Preferences;
+import org.junit.Test;
+import static org.junit.Assert.*;
+import org.junit.Before;
+import org.openide.util.NbBundle;
+import org.openide.util.NbPreferences;
+
+public class GradleSettingsTest {
+ @Before
+ public void cleanUpSettings() throws BackingStoreException {
+ Preferences p = NbPreferences.forModule(GradleSettings.class);
+ p.clear();
+ }
+
+ @Test
+ public void testReuseOutputTabsByDefault() {
+ NbBundle.setBranding(null);
+ final GradleSettings s = GradleSettings.getDefault();
+ assertTrue("By default reuse tabs in NetBeans IDE", s.isReuseOutputTabs());
+ s.setReuseOutputTabs(false);
+ assertFalse("Now set to false", s.isReuseOutputTabs());
+ s.setReuseOutputTabs(true);
+ assertTrue("Now set to true", s.isReuseOutputTabs());
+ }
+
+ @Test
+ public void testReuseOutputTabsWithBranding() {
+ NbBundle.setBranding("test");
+ final GradleSettings s = GradleSettings.getDefault();
+ assertFalse("Allow branding to disable reuse of tabs", s.isReuseOutputTabs());
+ s.setReuseOutputTabs(true);
+ assertFalse("Now set to true, but we branded to 'never'", s.isReuseOutputTabs());
+ }
+
+
+}
diff --git a/java/java.lsp.server/nbcode/branding/modules/org-netbeans-modules-gradle.jar/org/netbeans/modules/gradle/spi/Bundle.properties b/java/java.lsp.server/nbcode/branding/modules/org-netbeans-modules-gradle.jar/org/netbeans/modules/gradle/spi/Bundle.properties
new file mode 100644
index 0000000..67f3c42
--- /dev/null
+++ b/java/java.lsp.server/nbcode/branding/modules/org-netbeans-modules-gradle.jar/org/netbeans/modules/gradle/spi/Bundle.properties
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+DEFAULT_REUSE_OUTPUT=never
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists