From a194364fca3bd39e1178457247ca030d45698950 Mon Sep 17 00:00:00 2001 From: Eric Barboni Date: Fri, 23 Jan 2026 11:16:11 +0100 Subject: [PATCH 01/10] Update NOTICE to 2026 --- NOTICE | 2 +- nbbuild/notice-stub.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/NOTICE b/NOTICE index 0e2b9e3b9952..b09ec350398a 100644 --- a/NOTICE +++ b/NOTICE @@ -1,5 +1,5 @@ Apache NetBeans -Copyright 2017-2025 The Apache Software Foundation +Copyright 2017-2026 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). diff --git a/nbbuild/notice-stub.txt b/nbbuild/notice-stub.txt index 7cdf9ca76df0..33c832f5719c 100644 --- a/nbbuild/notice-stub.txt +++ b/nbbuild/notice-stub.txt @@ -1,5 +1,5 @@ Apache NetBeans -Copyright 2017-2025 The Apache Software Foundation +Copyright 2017-2026 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). From 1a5a46f6d7a54fa180ed537e9a5279124642aa99 Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Thu, 29 Jan 2026 12:05:34 +0100 Subject: [PATCH 02/10] Fix possible CCE during auto completion of invalid code javac was observed to return Elements of types other than ExecutableElement for paths with TypeMirror kind EXECUTABLE in some cases. adds an instanceof guard instead of assuming ExecutableElement --- .../netbeans/modules/java/completion/JavaCompletionTask.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/java.completion/src/org/netbeans/modules/java/completion/JavaCompletionTask.java b/java/java.completion/src/org/netbeans/modules/java/completion/JavaCompletionTask.java index c3001cffcd39..7cf25ed54e07 100644 --- a/java/java.completion/src/org/netbeans/modules/java/completion/JavaCompletionTask.java +++ b/java/java.completion/src/org/netbeans/modules/java/completion/JavaCompletionTask.java @@ -5996,7 +5996,7 @@ private Set getSmartTypesImpl(Env env) throws IOException path = new TreePath(path, mid); TypeMirror typeMirror = controller.getTrees().getTypeMirror(path); final ExecutableType midTM = typeMirror != null && typeMirror.getKind() == TypeKind.EXECUTABLE ? (ExecutableType) typeMirror : null; - final ExecutableElement midEl = midTM == null ? null : (ExecutableElement) controller.getTrees().getElement(path); + final ExecutableElement midEl = midTM != null && controller.getTrees().getElement(path) instanceof ExecutableElement ee ? ee : null; switch (mid.getKind()) { case MEMBER_SELECT: { String name = ((MemberSelectTree) mid).getIdentifier().toString(); From 53fc45b42e1479ce0b1f1103d47cf5d99220ec19 Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Fri, 30 Jan 2026 20:18:20 +0100 Subject: [PATCH 03/10] Fix and disable masterfs lockfile test which is failing since 17u18 this test was patched in past for similar reasons and can start failing again when the JDK updates. testLockFile() is now disabled in CI --- .../masterfs/filebasedfs/fileobjects/StatFilesTest.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/platform/masterfs/test/unit/src/org/netbeans/modules/masterfs/filebasedfs/fileobjects/StatFilesTest.java b/platform/masterfs/test/unit/src/org/netbeans/modules/masterfs/filebasedfs/fileobjects/StatFilesTest.java index 440017aae2a5..e24bd3c4bd14 100644 --- a/platform/masterfs/test/unit/src/org/netbeans/modules/masterfs/filebasedfs/fileobjects/StatFilesTest.java +++ b/platform/masterfs/test/unit/src/org/netbeans/modules/masterfs/filebasedfs/fileobjects/StatFilesTest.java @@ -18,6 +18,7 @@ */ package org.netbeans.modules.masterfs.filebasedfs.fileobjects; +import java.awt.GraphicsEnvironment; import java.io.File; import java.io.IOException; @@ -26,6 +27,7 @@ import java.util.List; import java.util.Stack; import org.netbeans.junit.NbTestCase; +import org.netbeans.junit.RandomlyFails; import org.netbeans.modules.masterfs.filebasedfs.FileBasedFileSystem; import org.netbeans.modules.masterfs.filebasedfs.naming.FileNaming; import org.netbeans.modules.masterfs.filebasedfs.naming.NamingFactory; @@ -49,6 +51,7 @@ public StatFilesTest(String testName) { @Override protected void setUp() throws java.lang.Exception { + GraphicsEnvironment.isHeadless(); // may cause file reads in a static initializer on linux FileObjectFactory.WARNINGS = false; clearWorkDir(); testFile = new File(getWorkDir(), "testLockFile.txt"); @@ -151,6 +154,7 @@ public void testGetChildrenCaches() throws IOException { monitor.getResults().assertResult(1, StatFiles.READ); } + @RandomlyFails // JDK update releases caused failures public void testLockFile() throws IOException { FileObject fobj = getFileObject(testFile); monitor.reset(); From d374b91b50ee303b576cee54a09c0f7c1fa38bd1 Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Mon, 2 Feb 2026 17:19:31 +0100 Subject: [PATCH 04/10] Fix possible NPE in ModuleInfoSelector SourceLevelQuery may return null. --- .../modules/maven/classpath/ClassPathProviderImpl.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/java/maven/src/org/netbeans/modules/maven/classpath/ClassPathProviderImpl.java b/java/maven/src/org/netbeans/modules/maven/classpath/ClassPathProviderImpl.java index fda13392d1e8..02041461a6ee 100644 --- a/java/maven/src/org/netbeans/modules/maven/classpath/ClassPathProviderImpl.java +++ b/java/maven/src/org/netbeans/modules/maven/classpath/ClassPathProviderImpl.java @@ -514,8 +514,7 @@ public ClassPath getActiveClassPath() { if(moduleInfoFile.exists()) { FileObject moduleInfo = FileUtil.toFileObject(moduleInfoFile); String sourceLevel = SourceLevelQuery.getSourceLevel2(moduleInfo).getSourceLevel(); - String ide_jdkvers = System.getProperty("java.version"); //NOI18N - if(!sourceLevel.startsWith("1.") && !ide_jdkvers.startsWith("1.")) { //NOI18N + if (sourceLevel != null && !sourceLevel.startsWith("1.")) { //NOI18N // both sourceLevel and ideJDK are 9+ ret = hasModuleInfoCP.get(); } From 9e5a53db599f302d361d9fdb33b23fa716e9667a Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Mon, 2 Feb 2026 18:02:21 +0100 Subject: [PATCH 05/10] README: Update pre-apache repo link previous link is no longer accessible --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 68a439d3f094..a73b134d9098 100644 --- a/README.md +++ b/README.md @@ -161,8 +161,8 @@ This gives you just few log entries including the initial checkin and change of the file headers to Apache. But then the magic comes: ```bash -$ git remote add emilian https://github.com/emilianbold/netbeans-releases.git -$ git fetch emilian # this takes a while, the history is huge! +$ git remote add archive https://github.com/codelerity/netbeans-releases.git +$ git fetch archive # this takes a while, the history is huge! $ git replace 6daa72c98 32042637 # the 1st donation $ git replace 6035076ee 32042637 # the 2nd donation ``` @@ -174,6 +174,6 @@ $ git log platform/uihandler/arch.xml $ git blame platform/uihandler/arch.xml ``` -Many thanks to Emilian Bold who converted the ancient history to his -[Git repository](https://github.com/emilianbold/netbeans-releases) -and made the magic possible! +You can browse the archived repo [here](https://github.com/codelerity/netbeans-releases). + +Many thanks to Emilian Bold who created the original archive repository. From 5c3228f4f1440a47c93a36cbe24f0ba707211e9e Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Thu, 29 Jan 2026 14:01:47 +0100 Subject: [PATCH 06/10] StaticImport hint should support records and other class kinds uses javac's Element.getKind().isDeclaredType() as filter which matches all class kinds (interfaces, records etc). minor code improvements and indentation fixes --- .../modules/java/hints/Bundle.properties | 4 +- .../modules/java/hints/StaticImport.java | 56 +++++++------------ .../modules/java/hints/StaticImportTest.java | 13 ++++- 3 files changed, 34 insertions(+), 39 deletions(-) diff --git a/java/java.hints/src/org/netbeans/modules/java/hints/Bundle.properties b/java/java.hints/src/org/netbeans/modules/java/hints/Bundle.properties index 62288327ac1d..693c631f1b43 100644 --- a/java/java.hints/src/org/netbeans/modules/java/hints/Bundle.properties +++ b/java/java.hints/src/org/netbeans/modules/java/hints/Bundle.properties @@ -283,7 +283,9 @@ HINT_SerialVersionUID_Generated=Add generated serialVersionUID FieldForUnusedParamCustomizer.finalFields.text=Fields are final ACSD_Final_Fields=Make fields created by this hint final. -DSC_StaticImport=Convert a static method/field/enum-field reference to use a static import. Feedback to http://www.netbeans.org/issues/show_bug.cgi?id=89258 +DSC_StaticImport=Convert a static method/field/enum-field reference to use a static import.\ +

Math.abs(-1) -> abs(-1)

+ DN_StaticImport=Static imports ERR_StaticImport=Convert to static import HINT_StaticImport=Convert {0} to static import diff --git a/java/java.hints/src/org/netbeans/modules/java/hints/StaticImport.java b/java/java.hints/src/org/netbeans/modules/java/hints/StaticImport.java index 0628ceeaef46..5e2967337127 100644 --- a/java/java.hints/src/org/netbeans/modules/java/hints/StaticImport.java +++ b/java/java.hints/src/org/netbeans/modules/java/hints/StaticImport.java @@ -28,7 +28,6 @@ import com.sun.source.tree.Tree; import com.sun.source.tree.Tree.Kind; import com.sun.source.util.TreePath; -import java.util.Collections; import java.util.EnumSet; import java.util.List; import java.util.Set; @@ -42,7 +41,6 @@ import javax.lang.model.type.TypeMirror; import javax.lang.model.util.Types; import org.netbeans.api.java.source.CompilationInfo; -import org.netbeans.api.java.source.ElementUtilities; import org.netbeans.api.java.source.GeneratorUtilities; import org.netbeans.api.java.source.TreeMaker; import org.netbeans.api.java.source.TreePathHandle; @@ -77,12 +75,13 @@ * * @author Sam Halliday * @author markiewb - * @see RFE 89258 - * @see Static Imports */ @Hint(category="rules15", displayName="#DN_StaticImport", description="#DSC_StaticImport", severity=Severity.HINT, enabled=false, suppressWarnings={"", "StaticImport"}, minSourceVersion = "5") public class StaticImport { + + private static final Set SUPPORTED_TYPES = EnumSet.of(ElementKind.METHOD, ElementKind.ENUM_CONSTANT, ElementKind.FIELD); @TriggerTreeKind(Kind.MEMBER_SELECT) public static List run(HintContext ctx) { @@ -90,23 +89,22 @@ public static List run(HintContext ctx) { TreePath treePath = ctx.getPath(); Element e = info.getTrees().getElement(treePath); - EnumSet supportedTypes = EnumSet.of(ElementKind.METHOD, ElementKind.ENUM_CONSTANT, ElementKind.FIELD); - if (e == null || !e.getModifiers().contains(Modifier.STATIC) || !supportedTypes.contains(e.getKind())) { + if (e == null || !e.getModifiers().contains(Modifier.STATIC) || !SUPPORTED_TYPES.contains(e.getKind())) { return null; } if (ElementKind.METHOD == e.getKind()) { TreePath mitp = treePath.getParentPath(); if (mitp == null || mitp.getLeaf().getKind() != Kind.METHOD_INVOCATION) { - return null; - } + return null; + } if (((MethodInvocationTree) mitp.getLeaf()).getMethodSelect() != treePath.getLeaf()) { - return null; - } + return null; + } List typeArgs = ((MethodInvocationTree) mitp.getLeaf()).getTypeArguments(); if (typeArgs != null && !typeArgs.isEmpty()) { - return null; - } + return null; + } } Element enclosingEl = e.getEnclosingElement(); if (enclosingEl == null) { @@ -122,7 +120,7 @@ public static List run(HintContext ctx) { return null; } Element klass = info.getTrees().getElement(cc); - if (klass == null || klass.getKind() != ElementKind.CLASS) { + if (klass == null || !klass.getKind().isDeclaredType()) { return null; } String fqn = null; @@ -143,7 +141,7 @@ public static List run(HintContext ctx) { if (ctx.isCanceled()) { return null; } - return Collections.singletonList(ed); + return List.of(ed); } public static final class FixImpl extends JavaFix { @@ -189,31 +187,18 @@ protected void performRewrite(TransformationContext ctx) throws Exception { return; } CompilationUnitTree cut = (CompilationUnitTree) copy.resolveRewriteTarget(copy.getCompilationUnit()); - CompilationUnitTree nue = GeneratorUtilities.get(copy).addImports(cut, Collections.singleton(e)); + CompilationUnitTree nue = GeneratorUtilities.get(copy).addImports(cut, Set.of(e)); copy.rewrite(cut, nue); } } - /** - * @param info - * @return true if the source level supports the static import language feature - */ - private static boolean supportsStaticImports(CompilationInfo info) { - return info.getSourceVersion().compareTo(SourceVersion.RELEASE_5) >= 0; - } - // returns true if a METHOD is enclosed in element with simple name sn private static boolean hasMethodWithSimpleName(CompilationInfo info, Element element, final String sn) { - Iterable members = - info.getElementUtilities().getMembers(element.asType(), new ElementUtilities.ElementAcceptor() { - - @Override - public boolean accept(Element e, TypeMirror type) { - return e.getKind() == ElementKind.METHOD && e.getSimpleName().toString().equals(sn); - } - }); - return members.iterator().hasNext(); + return info.getElementUtilities().getMembers( + element.asType(), + (elem, type) -> elem.getKind() == ElementKind.METHOD && elem.getSimpleName().toString().equals(sn) + ).iterator().hasNext(); } /** @@ -266,7 +251,7 @@ private static boolean hasStaticImportSimpleNameClash(CompilationInfo info, Stri */ private static boolean isSubTypeOrInnerOfSubType(CompilationInfo info, Element t1, Element t2) { boolean isSubtype = info.getTypes().isSubtype(t1.asType(), t2.asType()); - boolean isInnerClass = t1.getEnclosingElement().getKind() == ElementKind.CLASS; + boolean isInnerClass = t1.getEnclosingElement().getKind().isDeclaredType(); return isSubtype || (isInnerClass && info.getTypes().isSubtype(t1.getEnclosingElement().asType(), t2.asType())); } @@ -278,15 +263,12 @@ private static boolean isSubTypeOrInnerOfSubType(CompilationInfo info, Element t * methods in klass (which may be an inner or static class). */ private static boolean hasMethodNameClash(CompilationInfo info, Element klass, String simpleName) { - assert klass != null; - assert klass.getKind() == ElementKind.CLASS; - // check the members and inherited members of the klass if (hasMethodWithSimpleName(info, klass, simpleName)) { return true; } Element klassEnclosing = klass.getEnclosingElement(); - return (klassEnclosing != null && klassEnclosing.getKind() == ElementKind.CLASS && hasMethodWithSimpleName(info, klassEnclosing, simpleName)); + return klassEnclosing != null && klassEnclosing.getKind().isDeclaredType() && hasMethodWithSimpleName(info, klassEnclosing, simpleName); } /** diff --git a/java/java.hints/test/unit/src/org/netbeans/modules/java/hints/StaticImportTest.java b/java/java.hints/test/unit/src/org/netbeans/modules/java/hints/StaticImportTest.java index 07800c5a03ee..44af98fe3387 100644 --- a/java/java.hints/test/unit/src/org/netbeans/modules/java/hints/StaticImportTest.java +++ b/java/java.hints/test/unit/src/org/netbeans/modules/java/hints/StaticImportTest.java @@ -99,6 +99,12 @@ public void testStaticImportHint1() throws Exception { String golden = "package test; import static java.lang.Math.abs; public class Test { public Test() { abs(1); } }"; performFixTest(test, golden); } + + public void testStaticImportHint1_InRecord() throws Exception { + String test = "package test; public record Test(int n) { public Test { Math.|abs(n); } }"; + String golden = "package test; import static java.lang.Math.abs; public record Test(int n) { public Test { abs(n); } }"; + performFixTest(test, golden, 17); + } public void testStaticImportHint2() throws Exception { String test = "package test; public class Test { public Test() { Test.get|Logger(); } public static void getLogger() { } }"; @@ -161,10 +167,14 @@ public void testIgnoreClass() throws Exception { performAnalysisTest(test); } + private void performFixTest(String test, String golden) throws Exception { + performFixTest(test, golden, 8); + } + // test is single line source code for test.Test, | in the member select, space before // golden is the output to test against // sn is the simple name of the static method - private void performFixTest(String test, String golden) throws Exception { + private void performFixTest(String test, String golden, int level) throws Exception { int offset = test.indexOf("|"); assertTrue(offset != -1); int end = test.indexOf("(", offset) - 1; @@ -172,6 +182,7 @@ private void performFixTest(String test, String golden) throws Exception { int start = test.lastIndexOf(" ", offset) + 1; assertTrue(start > 0); HintTest.create() + .sourceLevel(level) .input(test.replace("|", "")) .run(StaticImport.class) .findWarning("0:" + start + "-0:" + end + ":hint:" + NbBundle.getMessage(StaticImport.class, "ERR_StaticImport")) From 669d5d993f7c055c026b10af6908cfa90d55df14 Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Thu, 29 Jan 2026 17:14:20 +0100 Subject: [PATCH 07/10] javadoc renderer: fix snippet rendering in deprecated sections italic tags don't mix very well with text sections of unclosed paragraph tags. --- .../src/org/netbeans/api/java/source/ui/ElementJavadoc.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/java.sourceui/src/org/netbeans/api/java/source/ui/ElementJavadoc.java b/java/java.sourceui/src/org/netbeans/api/java/source/ui/ElementJavadoc.java index 80c264d9ce05..edf484614538 100644 --- a/java/java.sourceui/src/org/netbeans/api/java/source/ui/ElementJavadoc.java +++ b/java/java.sourceui/src/org/netbeans/api/java/source/ui/ElementJavadoc.java @@ -856,7 +856,7 @@ private StringBuilder getElementDoc(final Element element, final CompilationInfo }); sb.append("

"); //NOI18N if (doc.containsKey(DocTree.Kind.DEPRECATED)) { - sb.append("").append(NbBundle.getMessage(ElementJavadoc.class, "JCD-deprecated")).append(" ").append(doc.get(DocTree.Kind.DEPRECATED)).append("

"); //NOI18N + sb.append("").append(NbBundle.getMessage(ElementJavadoc.class, "JCD-deprecated")).append("

").append(doc.get(DocTree.Kind.DEPRECATED)).append("

"); //NOI18N } if (doc.containsKey(null)) { sb.append(doc.get(null)); From 3111d548ef37ee345d3b22268b243da8f2fd7dee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Bl=C3=A4sing?= Date: Mon, 2 Feb 2026 21:32:58 +0100 Subject: [PATCH 08/10] java.api.common: Fix missing resource LBL_TestModuleFolder_DialogTitle Closes: #9184 --- .../java/api/common/project/ui/customizer/Bundle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/Bundle.properties b/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/Bundle.properties index 9758aab92ba5..c1e8cd9ebd21 100644 --- a/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/Bundle.properties +++ b/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/Bundle.properties @@ -69,7 +69,7 @@ TITLE_InvalidRoot=Invalid Source Roots LBL_SourceFolder_DialogTitle=Add Source Folder LBL_TestFolder_DialogTitle=Add Test Folder LBL_ModuleFolder_DialogTitle=Add Module Folder -LBL_TestFolder_DialogTitle=Add Test Module Folder +LBL_TestModuleFolder_DialogTitle=Add Test Module Folder LBL_InvalidRoot=Already used package folders: MNE_InvalidRoot=A AD_InvalidRoot=N/A From ee3db7db18c173f28f2cc5388cf36000f1fb18ad Mon Sep 17 00:00:00 2001 From: Neil C Smith Date: Wed, 4 Feb 2026 11:50:17 +0000 Subject: [PATCH 09/10] Only open Favorites when a file is first opened for editing. Use TopComponent.Registry and only open Favorites on first open of a file editing component. Do not open for non-file TopComponents like Dashboard. --- .../netbeans/modules/favorites/Module.java | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/platform/favorites/src/org/netbeans/modules/favorites/Module.java b/platform/favorites/src/org/netbeans/modules/favorites/Module.java index 90bd2cd0159b..0726ce1ef6a0 100644 --- a/platform/favorites/src/org/netbeans/modules/favorites/Module.java +++ b/platform/favorites/src/org/netbeans/modules/favorites/Module.java @@ -32,9 +32,10 @@ import org.netbeans.swing.plaf.LFCustoms; import org.openide.filesystems.FileObject; import org.openide.filesystems.FileUtil; +import org.openide.loaders.DataObject; import org.openide.util.NbPreferences; -import org.openide.windows.Mode; import org.openide.windows.OnShowing; +import org.openide.windows.TopComponent; import org.openide.windows.WindowManager; /** @@ -73,19 +74,20 @@ private void registerFavAppenderFunction() { UIManager.put(LFCustoms.FILECHOOSER_SHORTCUTS_FILESFUNCTION, favAppender); } - // very first on-editor-open event will also open the Favorites tab + // very first file editor opened will also open the Favorites tab private void attachFirstEditorOpenListener() { Preferences prefs = NbPreferences.forModule(Module.class); if (prefs.getBoolean(INITIAL_OPEN_DONE_KEY, false)) { return; } - WindowManager wm = WindowManager.getDefault(); - wm.addPropertyChangeListener(new PropertyChangeListener() { + TopComponent.Registry registry = TopComponent.getRegistry(); + registry.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { - if ("activeMode".equals(evt.getPropertyName()) //NOI18N - && evt.getNewValue() instanceof Mode mode - && wm.isEditorMode(mode)) { + if (TopComponent.Registry.PROP_TC_OPENED.equals(evt.getPropertyName()) + && evt.getNewValue() instanceof TopComponent tc + && hasFileReference(tc) + && WindowManager.getDefault().isEditorTopComponent(tc)) { try { Tab favTab = Tab.findDefault(); if (favTab != null && !favTab.wasOpened() && !favTab.isOpened()) { @@ -95,13 +97,18 @@ public void propertyChange(PropertyChangeEvent evt) { prefs.putBoolean(INITIAL_OPEN_DONE_KEY, true); PropertyChangeListener thisListener = this; SwingUtilities.invokeLater(() -> { - wm.removePropertyChangeListener(thisListener); + registry.removePropertyChangeListener(thisListener); }); } } + } }); } + + private boolean hasFileReference(TopComponent tc) { + return tc.getLookup().lookup(DataObject.class) != null; + } } } From 0aef5059ccc84366905d64511b9fc7e07d414a7a Mon Sep 17 00:00:00 2001 From: Neil C Smith Date: Wed, 4 Feb 2026 12:08:47 +0000 Subject: [PATCH 10/10] Make initial opening of the Favorites tab easier to brand in platform. --- .../netbeans/modules/favorites/Bundle.properties | 3 +++ .../src/org/netbeans/modules/favorites/Module.java | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/platform/favorites/src/org/netbeans/modules/favorites/Bundle.properties b/platform/favorites/src/org/netbeans/modules/favorites/Bundle.properties index af71a113b450..08be9f58a4fa 100644 --- a/platform/favorites/src/org/netbeans/modules/favorites/Bundle.properties +++ b/platform/favorites/src/org/netbeans/modules/favorites/Bundle.properties @@ -50,3 +50,6 @@ OpenIDE-Module-Long-Description=Favorites module enables you to create a view of # Options Export Favorites.Options.Export.displayName=Favorites + +# Automatically open when first file opened for editing +Favorites.openOnFirstFile=true diff --git a/platform/favorites/src/org/netbeans/modules/favorites/Module.java b/platform/favorites/src/org/netbeans/modules/favorites/Module.java index 0726ce1ef6a0..80d5e7296916 100644 --- a/platform/favorites/src/org/netbeans/modules/favorites/Module.java +++ b/platform/favorites/src/org/netbeans/modules/favorites/Module.java @@ -33,6 +33,7 @@ import org.openide.filesystems.FileObject; import org.openide.filesystems.FileUtil; import org.openide.loaders.DataObject; +import org.openide.util.NbBundle; import org.openide.util.NbPreferences; import org.openide.windows.OnShowing; import org.openide.windows.TopComponent; @@ -40,17 +41,26 @@ /** * For lifecycle tasks. + * * @author mbien */ public final class Module { private static final String INITIAL_OPEN_DONE_KEY = "initial-open-done"; //NOI18N + private static final String INITIAL_OPEN_BRANDING_KEY = "Favorites.openOnFirstFile"; //NOI18N private Module() {} @OnShowing public final static class EDTInit implements Runnable { + private final boolean openOnFirstFile; + + public EDTInit() { + openOnFirstFile = Boolean.parseBoolean( + NbBundle.getMessage(Module.class, INITIAL_OPEN_BRANDING_KEY)); + } + @Override public void run() { registerFavAppenderFunction(); @@ -76,6 +86,9 @@ private void registerFavAppenderFunction() { // very first file editor opened will also open the Favorites tab private void attachFirstEditorOpenListener() { + if (!openOnFirstFile) { + return; + } Preferences prefs = NbPreferences.forModule(Module.class); if (prefs.getBoolean(INITIAL_OPEN_DONE_KEY, false)) { return;