This is an automated email from the ASF dual-hosted git repository.

mbien 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 610d6d2a82 enable versioning labels by default.
     new 23b8a9b5ad Merge pull request #5831 from mbien/enable-versioning-labels
610d6d2a82 is described below

commit 610d6d2a8298fb5a9667dc32b6b1ed45b1d0551b
Author: Michael Bien <[email protected]>
AuthorDate: Sun Apr 16 03:40:50 2023 +0200

    enable versioning labels by default.
---
 ide/git/src/org/netbeans/modules/git/Annotator.java            |  4 ++--
 .../src/org/netbeans/modules/mercurial/MercurialAnnotator.java |  6 +++---
 .../src/org/netbeans/modules/subversion/Annotator.java         |  4 ++--
 .../modules/versioning/core/ShowTextAnnotationsAction.java     |  4 ++--
 .../modules/versioning/core/api/VersioningSupport.java         | 10 +++++++++-
 .../modules/versioning/ui/options/GeneralOptionsPanel.java     |  2 +-
 .../org/netbeans/modules/versioning/spi/VersioningSupport.java | 10 +++++++++-
 7 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/ide/git/src/org/netbeans/modules/git/Annotator.java 
b/ide/git/src/org/netbeans/modules/git/Annotator.java
index 29f32328ec..0cf6d64453 100644
--- a/ide/git/src/org/netbeans/modules/git/Annotator.java
+++ b/ide/git/src/org/netbeans/modules/git/Annotator.java
@@ -395,7 +395,7 @@ public class Annotator extends VCSAnnotator implements 
PropertyChangeListener {
     private final Map<RepositoryInfo, Set<File>> 
filesWithRepositoryAnnotations = new WeakHashMap<RepositoryInfo, Set<File>>(3);
     
     private String annotateFolderNameHtml (String name, VCSContext context, 
FileInformation mostImportantInfo, File mostImportantFile) {
-        boolean annotationsVisible = 
VersioningSupport.getPreferences().getBoolean(VersioningSupport.PREF_BOOLEAN_TEXT_ANNOTATIONS_VISIBLE,
 false);
+        boolean annotationsVisible = 
VersioningSupport.isTextAnnotationVisible();
         String nameHtml = htmlEncode(name);
         File repository = 
Git.getInstance().getRepositoryRoot(mostImportantFile);
         if (!mostImportantFile.equals(repository) && 
mostImportantInfo.containsStatus(Status.NOTVERSIONED_EXCLUDED)) {
@@ -512,7 +512,7 @@ public class Annotator extends VCSAnnotator implements 
PropertyChangeListener {
         name = htmlEncode(name);
 
         String textAnnotation;
-        boolean annotationsVisible = 
VersioningSupport.getPreferences().getBoolean(VersioningSupport.PREF_BOOLEAN_TEXT_ANNOTATIONS_VISIBLE,
 false);
+        boolean annotationsVisible = 
VersioningSupport.isTextAnnotationVisible();
 
         if (annotationsVisible && mostImportantFile != null && 
mostImportantInfo.containsStatus(STATUS_IS_IMPORTANT)) {
             String statusText = mostImportantInfo.getShortStatusText();
diff --git 
a/ide/mercurial/src/org/netbeans/modules/mercurial/MercurialAnnotator.java 
b/ide/mercurial/src/org/netbeans/modules/mercurial/MercurialAnnotator.java
index 15a727b861..7d1a40ccfa 100644
--- a/ide/mercurial/src/org/netbeans/modules/mercurial/MercurialAnnotator.java
+++ b/ide/mercurial/src/org/netbeans/modules/mercurial/MercurialAnnotator.java
@@ -404,7 +404,7 @@ public class MercurialAnnotator extends VCSAnnotator 
implements PropertyChangeLi
         name = htmlEncode(name);
         
         String textAnnotation;
-        boolean annotationsVisible = 
VersioningSupport.getPreferences().getBoolean(VersioningSupport.PREF_BOOLEAN_TEXT_ANNOTATIONS_VISIBLE,
 false);
+        boolean annotationsVisible = 
VersioningSupport.isTextAnnotationVisible();
         int status = mostImportantInfo.getStatus();
         
         if (annotationsVisible && mostImportantFile != null && (status & 
STATUS_TEXT_ANNOTABLE) != 0) {
@@ -508,7 +508,7 @@ public class MercurialAnnotator extends VCSAnnotator 
implements PropertyChangeLi
         if (mostImportantInfo.getStatus() == 
FileInformation.STATUS_NOTVERSIONED_EXCLUDED){
             return 
getAnnotationProvider().EXCLUDED_FILE.getFormat().format(new Object [] { 
nameHtml, ""}); // NOI18N
         }
-        boolean annotationsVisible = 
VersioningSupport.getPreferences().getBoolean(VersioningSupport.PREF_BOOLEAN_TEXT_ANNOTATIONS_VISIBLE,
 false);
+        boolean annotationsVisible = 
VersioningSupport.isTextAnnotationVisible();
         MessageFormat uptodateFormat = 
getAnnotationProvider().UP_TO_DATE_FILE.getFormat();
 
         final Set<File> rootFiles = context.getRootFiles();
@@ -689,7 +689,7 @@ public class MercurialAnnotator extends VCSAnnotator 
implements PropertyChangeLi
     }
 
     private Image addToolTip (Image icon, VCSContext context) {
-        if 
(!VersioningSupport.getPreferences().getBoolean(VersioningSupport.PREF_BOOLEAN_TEXT_ANNOTATIONS_VISIBLE,
 false)) {
+        if (!VersioningSupport.isTextAnnotationVisible()) {
             return icon;
         }
         File root = null;
diff --git a/ide/subversion/src/org/netbeans/modules/subversion/Annotator.java 
b/ide/subversion/src/org/netbeans/modules/subversion/Annotator.java
index bd61483cd3..98377c034f 100644
--- a/ide/subversion/src/org/netbeans/modules/subversion/Annotator.java
+++ b/ide/subversion/src/org/netbeans/modules/subversion/Annotator.java
@@ -144,7 +144,7 @@ public class Annotator {
         name = htmlEncode(name);
         int status = info.getStatus();
         String textAnnotation;
-        boolean annotationsVisible = 
VersioningSupport.getPreferences().getBoolean(VersioningSupport.PREF_BOOLEAN_TEXT_ANNOTATIONS_VISIBLE,
 false);
+        boolean annotationsVisible = 
VersioningSupport.isTextAnnotationVisible();
         if (annotationsVisible && file != null && (status & 
STATUS_TEXT_ANNOTABLE) != 0) {
             if (format != null) {
                 textAnnotation = formatAnnotation(info, file);
@@ -257,7 +257,7 @@ public class Annotator {
         name = htmlEncode(name);
         int status = info.getStatus();
         String textAnnotation;
-        boolean annotationsVisible = 
VersioningSupport.getPreferences().getBoolean(VersioningSupport.PREF_BOOLEAN_TEXT_ANNOTATIONS_VISIBLE,
 false);
+        boolean annotationsVisible = 
VersioningSupport.isTextAnnotationVisible();
         if (annotationsVisible && file != null && (status & 
FileInformation.STATUS_MANAGED) != 0) {
 
             if (format != null) {
diff --git 
a/ide/versioning.core/src/org/netbeans/modules/versioning/core/ShowTextAnnotationsAction.java
 
b/ide/versioning.core/src/org/netbeans/modules/versioning/core/ShowTextAnnotationsAction.java
index ecfc8c89af..68e1230ece 100644
--- 
a/ide/versioning.core/src/org/netbeans/modules/versioning/core/ShowTextAnnotationsAction.java
+++ 
b/ide/versioning.core/src/org/netbeans/modules/versioning/core/ShowTextAnnotationsAction.java
@@ -66,7 +66,7 @@ public class ShowTextAnnotationsAction extends SystemAction 
implements DynamicMe
     }
     
     private void updateState() {
-        boolean tav = 
VersioningSupport.getPreferences().getBoolean(VersioningSupport.PREF_BOOLEAN_TEXT_ANNOTATIONS_VISIBLE,
 false);
+        boolean tav = VersioningSupport.isTextAnnotationVisible();
         menuItems[0].setSelected(tav);
     }
     
@@ -96,7 +96,7 @@ public class ShowTextAnnotationsAction extends SystemAction 
implements DynamicMe
 
     @Override
     public void actionPerformed(ActionEvent e) {
-        boolean tav = 
VersioningSupport.getPreferences().getBoolean(VersioningSupport.PREF_BOOLEAN_TEXT_ANNOTATIONS_VISIBLE,
 false);
+        boolean tav = VersioningSupport.isTextAnnotationVisible();
         
VersioningSupport.getPreferences().putBoolean(VersioningSupport.PREF_BOOLEAN_TEXT_ANNOTATIONS_VISIBLE,
 !tav); 
     }
 }
diff --git 
a/ide/versioning.core/src/org/netbeans/modules/versioning/core/api/VersioningSupport.java
 
b/ide/versioning.core/src/org/netbeans/modules/versioning/core/api/VersioningSupport.java
index 20baa7057b..7d3eac77f6 100644
--- 
a/ide/versioning.core/src/org/netbeans/modules/versioning/core/api/VersioningSupport.java
+++ 
b/ide/versioning.core/src/org/netbeans/modules/versioning/core/api/VersioningSupport.java
@@ -57,7 +57,15 @@ public final class VersioningSupport {
     public static Preferences getPreferences() {
         return VersioningConfig.getDefault().getPreferences();
     }
-        
+
+    /**
+     * Returns the value of {@link #PREF_BOOLEAN_TEXT_ANNOTATIONS_VISIBLE}.
+     * @see #getPreferences()
+     */
+    public static boolean isTextAnnotationVisible() {
+        return 
getPreferences().getBoolean(PREF_BOOLEAN_TEXT_ANNOTATIONS_VISIBLE, true);
+    }
+
     /**
      * Queries the Versioning infrastructure for file ownership.
      * 
diff --git 
a/ide/versioning.ui/src/org/netbeans/modules/versioning/ui/options/GeneralOptionsPanel.java
 
b/ide/versioning.ui/src/org/netbeans/modules/versioning/ui/options/GeneralOptionsPanel.java
index 2b24cf8c75..1abdee9e6d 100644
--- 
a/ide/versioning.ui/src/org/netbeans/modules/versioning/ui/options/GeneralOptionsPanel.java
+++ 
b/ide/versioning.ui/src/org/netbeans/modules/versioning/ui/options/GeneralOptionsPanel.java
@@ -203,7 +203,7 @@ final class GeneralOptionsPanel extends javax.swing.JPanel 
implements ActionList
 
     void load () {
         fillVersioningSystems();
-        originalLabels = 
VersioningSupport.getPreferences().getBoolean(VersioningSupport.PREF_BOOLEAN_TEXT_ANNOTATIONS_VISIBLE,
 false);
+        originalLabels = VersioningSupport.isTextAnnotationVisible();
         cbShowLabels.setSelected(originalLabels);
         cmbVersioningSystems.setSelectedIndex(selectedIndex);
         for (int i = 0; i < cmbVersioningSystems.getItemCount(); i++) {
diff --git 
a/ide/versioning/src/org/netbeans/modules/versioning/spi/VersioningSupport.java 
b/ide/versioning/src/org/netbeans/modules/versioning/spi/VersioningSupport.java
index 0d5107066d..ce97cbf2fd 100644
--- 
a/ide/versioning/src/org/netbeans/modules/versioning/spi/VersioningSupport.java
+++ 
b/ide/versioning/src/org/netbeans/modules/versioning/spi/VersioningSupport.java
@@ -51,7 +51,15 @@ public final class VersioningSupport {
     public static Preferences getPreferences() {
         return 
org.netbeans.modules.versioning.core.api.VersioningSupport.getPreferences();
     }
-        
+
+    /**
+     * Returns the value of {@link #PREF_BOOLEAN_TEXT_ANNOTATIONS_VISIBLE}.
+     * @see #getPreferences()
+     */
+    public static boolean isTextAnnotationVisible() {
+        return 
getPreferences().getBoolean(PREF_BOOLEAN_TEXT_ANNOTATIONS_VISIBLE, true);
+    }
+
     /**
      * Queries the Versioning infrastructure for file ownership.
      * 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to