[hg] main-silver: issue finder cleanup, javadoc, etc.

  • From: Tomas Stupka < >
  • To:
  • Subject: [hg] main-silver: issue finder cleanup, javadoc, etc.
  • Date: Thu, 10 Oct 2013 18:54:40 -0700

changeset 44fe8fc12166 in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/44fe8fc12166
description:
        issue finder cleanup, javadoc, etc.

diffstat:

 bugtracking/src/org/netbeans/modules/bugtracking/DelegatingConnector.java    
  |   6 ---
 bugtracking/src/org/netbeans/modules/bugtracking/RepositoryImpl.java         
  |   9 ++++-
 
bugtracking/src/org/netbeans/modules/bugtracking/spi/BugtrackingConnector.java
 |  13 ------
 bugtracking/src/org/netbeans/modules/bugtracking/spi/BugtrackingFactory.java 
  |   8 ++-
 bugtracking/src/org/netbeans/modules/bugtracking/spi/IssueFinder.java        
  |  19 +++++++--
 bugtracking/src/org/netbeans/modules/bugtracking/util/IssueFinderUtils.java  
  |   8 ++-
 bugtracking/src/org/netbeans/modules/bugtracking/util/SimpleIssueFinder.java 
  |   2 +-
 bugtracking/test/unit/src/org/netbeans/modules/bugtracking/TestKit.java      
  |   2 +-
 bugzilla/src/org/netbeans/modules/bugzilla/BugzillaConnector.java            
  |   5 --
 bugzilla/src/org/netbeans/modules/bugzilla/util/BugzillaUtil.java            
  |   5 +-
 jira/src/org/netbeans/modules/jira/JiraConnector.java                        
  |   5 --
 jira/src/org/netbeans/modules/jira/issue/JiraIssueFinder.java                
  |   2 +-
 jira/src/org/netbeans/modules/jira/util/JiraUtils.java                       
  |   4 +-
 odcs.tasks/src/org/netbeans/modules/odcs/tasks/ODCSConnector.java            
  |   5 --
 odcs.tasks/src/org/netbeans/modules/odcs/tasks/util/ODCSUtil.java            
  |   4 +-
 15 files changed, 45 insertions(+), 52 deletions(-)

diffs (348 lines):

diff --git 
a/bugtracking/src/org/netbeans/modules/bugtracking/DelegatingConnector.java 
b/bugtracking/src/org/netbeans/modules/bugtracking/DelegatingConnector.java
--- 
a/bugtracking/src/org/netbeans/modules/bugtracking/DelegatingConnector.java
+++ 
b/bugtracking/src/org/netbeans/modules/bugtracking/DelegatingConnector.java
@@ -132,12 +132,6 @@
     }
 
     @Override
-    public IssueFinder getIssueFinder() {
-        BugtrackingConnector d = getDelegate();
-        return d != null ? d.getIssueFinder() : null;
-    }
-
-    @Override
     public Repository createRepository() {
         BugtrackingConnector d = getDelegate();
         return d != null ? d.createRepository() : null;
diff --git 
a/bugtracking/src/org/netbeans/modules/bugtracking/RepositoryImpl.java 
b/bugtracking/src/org/netbeans/modules/bugtracking/RepositoryImpl.java
--- a/bugtracking/src/org/netbeans/modules/bugtracking/RepositoryImpl.java
+++ b/bugtracking/src/org/netbeans/modules/bugtracking/RepositoryImpl.java
@@ -95,6 +95,7 @@
     private final Map<Q, QueryImpl> queryMap = new HashMap<Q, QueryImpl>();
     private Repository repository;
     private IssuePrioritySupport prioritySupport;
+    private final IssueFinder issueFinder;
     
     public RepositoryImpl(
             final R r, 
@@ -103,7 +104,8 @@
             IssueProvider<I> issueProvider, 
             IssueStatusProvider<I> issueStatusProvider, 
             IssueSchedulingProvider<I> issueSchedulingProvider,
-            IssuePriorityProvider<I> issuePriorityProvider) 
+            IssuePriorityProvider<I> issuePriorityProvider,
+            IssueFinder issueFinder) 
     {
         this.repositoryProvider = repositoryProvider;
         this.issueProvider = issueProvider;
@@ -111,6 +113,7 @@
         this.issueStatusProvider = issueStatusProvider;
         this.issueSchedulingProvider = issueSchedulingProvider;
         this.issuePriorityProvider = issuePriorityProvider;
+        this.issueFinder = issueFinder;
         this.r = r;
         
         support = new PropertyChangeSupport(this);
@@ -162,6 +165,10 @@
         return repository;
     }
     
+    public IssueFinder getIssueFinder() {
+        return issueFinder;
+    }
+    
     /**
      * Returns the icon for this repository
      * @return
diff --git 
a/bugtracking/src/org/netbeans/modules/bugtracking/spi/BugtrackingConnector.java
 
b/bugtracking/src/org/netbeans/modules/bugtracking/spi/BugtrackingConnector.java
--- 
a/bugtracking/src/org/netbeans/modules/bugtracking/spi/BugtrackingConnector.java
+++ 
b/bugtracking/src/org/netbeans/modules/bugtracking/spi/BugtrackingConnector.java
@@ -70,19 +70,6 @@
      */
     public abstract Repository createRepository();
 
-    /**
-     * Returns an {@code IssueFinder} for the connector, or {@code null}
-     * if no {@code IssueFinder} is available.
-     * The default implementation returns {@code null}.
-     *
-     * @return  an instance of {@code IssueFinder} corresponding to this
-     *          type of bugtracker, or {@code null}
-     */
-    // XXX provide via lookup
-    public IssueFinder getIssueFinder() {
-        return null;
-    }
-
     @Retention(RetentionPolicy.SOURCE)
     @Target({ElementType.TYPE, ElementType.METHOD})
     public @interface Registration {    
diff --git 
a/bugtracking/src/org/netbeans/modules/bugtracking/spi/BugtrackingFactory.java
 
b/bugtracking/src/org/netbeans/modules/bugtracking/spi/BugtrackingFactory.java
--- 
a/bugtracking/src/org/netbeans/modules/bugtracking/spi/BugtrackingFactory.java
+++ 
b/bugtracking/src/org/netbeans/modules/bugtracking/spi/BugtrackingFactory.java
@@ -77,7 +77,7 @@
                 return repo;
             }
         }
-        RepositoryImpl<R, Q, I> impl = new RepositoryImpl<R, Q, I>(r, rp, 
qp, ip, null, null, null);
+        RepositoryImpl<R, Q, I> impl = new RepositoryImpl<R, Q, I>(r, rp, 
qp, ip, null, null, null, null);
         return impl.getRepository();
     }
     
@@ -90,6 +90,7 @@
      * @param iscp
      * @param ipp
      * @param qp
+     * @param isf
      * @return 
      */
     public Repository createRepository(R r, 
@@ -98,7 +99,8 @@
             IssueProvider<I> ip,
             IssueStatusProvider<I> isp,
             IssueSchedulingProvider<I> iscp, 
-            IssuePriorityProvider<I> ipp) 
+            IssuePriorityProvider<I> ipp,
+            IssueFinder isf)
     {
         RepositoryInfo info = rp.getInfo(r);
         if(info != null) {
@@ -109,7 +111,7 @@
                 return repo;
             }
         }
-        RepositoryImpl<R, Q, I> impl = new RepositoryImpl<R, Q, I>(r, rp, 
qp, ip, isp, iscp, ipp);
+        RepositoryImpl<R, Q, I> impl = new RepositoryImpl<R, Q, I>(r, rp, 
qp, ip, isp, iscp, ipp, isf);
         return impl.getRepository();
     }
     
diff --git 
a/bugtracking/src/org/netbeans/modules/bugtracking/spi/IssueFinder.java 
b/bugtracking/src/org/netbeans/modules/bugtracking/spi/IssueFinder.java
--- a/bugtracking/src/org/netbeans/modules/bugtracking/spi/IssueFinder.java
+++ b/bugtracking/src/org/netbeans/modules/bugtracking/spi/IssueFinder.java
@@ -43,12 +43,17 @@
 package org.netbeans.modules.bugtracking.spi;
 
 /**
- * Recognizes references to issues in text.
+ * Recognizes references to issues in text as in the editor or in 
+ * Versioning commit messages. Such references are then hyperlinked to 
+ * easily access the issue in the IDE.
+ * <p>
+ * Note that an implementation of this interface is not mandatory for a 
+ * NetBeans bugtracking plugin. 
  *
  * @author Tomas Stupka
  * @author Marian Petras
  */
-public abstract class IssueFinder {
+public interface IssueFinder {
 
     /**
      * Finds boundaries of one or more references to issues in the given 
text.
@@ -69,21 +74,27 @@
      * #1. In other words, only (boundaries of) substrings that method
      * {@link #getIssueId} is able to transform the actual issue identifier,
      * should be returned by this method.
+     * <p>
+     * <b>Please note</b> that this method might be called in EDT and should 
avoid any 
+     * excessive computation.
      *
      * @param  text  text to be searched for references
      * @return  non-{@code null} array of boundaries of hyperlink references
      *          in the given text
      */
-    public abstract int[] getIssueSpans(CharSequence text);
+    public int[] getIssueSpans(CharSequence text);
 
     /**
      * Transforms the given text to an issue identifier.
      * The format of the returned value is specific for the type of issue
      * tracker - it may but may not be a number.
+     * <p>
+     * <b>Please note</b> that this method might be called in EDT and should 
avoid any 
+     * excessive computation.
      * 
      * @param  issueHyperlinkText  text that refers to a bug/issue
      * @return  unique identifier of the bug/issue
      */
-    public abstract String getIssueId(String issueHyperlinkText);
+    public String getIssueId(String issueHyperlinkText);
 
 }
diff --git 
a/bugtracking/src/org/netbeans/modules/bugtracking/util/IssueFinderUtils.java 
b/bugtracking/src/org/netbeans/modules/bugtracking/util/IssueFinderUtils.java
--- 
a/bugtracking/src/org/netbeans/modules/bugtracking/util/IssueFinderUtils.java
+++ 
b/bugtracking/src/org/netbeans/modules/bugtracking/util/IssueFinderUtils.java
@@ -46,6 +46,8 @@
 import java.util.logging.Logger;
 import org.netbeans.modules.bugtracking.BugtrackingManager;
 import org.netbeans.modules.bugtracking.DelegatingConnector;
+import org.netbeans.modules.bugtracking.RepositoryImpl;
+import org.netbeans.modules.bugtracking.RepositoryRegistry;
 import org.netbeans.modules.bugtracking.spi.IssueFinder;
 
 /**
@@ -58,9 +60,9 @@
         
     public static Collection<IssueFinder> getIssueFinders() {
         List<IssueFinder> ret = new LinkedList<IssueFinder>();
-        DelegatingConnector[] dcs = 
BugtrackingManager.getInstance().getConnectors();
-        for (DelegatingConnector dc : dcs) {
-            IssueFinder issueFinder = dc.getIssueFinder();
+        Collection<RepositoryImpl> repos = 
RepositoryRegistry.getInstance().getKnownRepositories(false);
+        for (RepositoryImpl r : repos) {
+            IssueFinder issueFinder = r.getIssueFinder();
             if(issueFinder != null) {
                 ret.add(issueFinder);
             }
diff --git 
a/bugtracking/src/org/netbeans/modules/bugtracking/util/SimpleIssueFinder.java
 
b/bugtracking/src/org/netbeans/modules/bugtracking/util/SimpleIssueFinder.java
--- 
a/bugtracking/src/org/netbeans/modules/bugtracking/util/SimpleIssueFinder.java
+++ 
b/bugtracking/src/org/netbeans/modules/bugtracking/util/SimpleIssueFinder.java
@@ -53,7 +53,7 @@
  * @author Tomas Stupka
  * @author Marian Petras
  */
-public class SimpleIssueFinder extends IssueFinder {
+public class SimpleIssueFinder implements IssueFinder {
     
     private static SimpleIssueFinder instance;
     
diff --git 
a/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/TestKit.java 
b/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/TestKit.java
--- a/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/TestKit.java
+++ b/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/TestKit.java
@@ -59,7 +59,7 @@
                 new TestQueryProvider(),
                 new TestIssueProvider(),
                 new TestStatusProvider(),
-                null, null);
+                null, null, null);
     }
     
     public static IssueImpl getIssue(RepositoryImpl repo, TestIssue issue) {
diff --git 
a/bugzilla/src/org/netbeans/modules/bugzilla/BugzillaConnector.java 
b/bugzilla/src/org/netbeans/modules/bugzilla/BugzillaConnector.java
--- a/bugzilla/src/org/netbeans/modules/bugzilla/BugzillaConnector.java
+++ b/bugzilla/src/org/netbeans/modules/bugzilla/BugzillaConnector.java
@@ -94,11 +94,6 @@
         return NbBundle.getMessage(BugzillaConnector.class, 
"LBL_ConnectorName");           // NOI18N
     }
 
-    @Override
-    public IssueFinder getIssueFinder() {
-        return SimpleIssueFinder.getInstance();
-    }
-
     
/******************************************************************************
      * Kenai
      
******************************************************************************/
diff --git 
a/bugzilla/src/org/netbeans/modules/bugzilla/util/BugzillaUtil.java 
b/bugzilla/src/org/netbeans/modules/bugzilla/util/BugzillaUtil.java
--- a/bugzilla/src/org/netbeans/modules/bugzilla/util/BugzillaUtil.java
+++ b/bugzilla/src/org/netbeans/modules/bugzilla/util/BugzillaUtil.java
@@ -44,7 +44,6 @@
 
 import java.awt.Color;
 import java.util.Collections;
-import java.util.List;
 import java.util.MissingResourceException;
 import org.netbeans.modules.bugtracking.util.ListValuePicker;
 import java.util.logging.Level;
@@ -56,6 +55,7 @@
 import org.netbeans.modules.bugtracking.api.Repository;
 import org.netbeans.modules.bugtracking.spi.RepositoryProvider;
 import org.netbeans.modules.bugtracking.util.NBBugzillaUtils;
+import org.netbeans.modules.bugtracking.util.SimpleIssueFinder;
 import org.netbeans.modules.bugzilla.Bugzilla;
 import org.netbeans.modules.bugzilla.BugzillaConnector;
 import org.netbeans.modules.bugzilla.repository.BugzillaRepository;
@@ -202,7 +202,8 @@
                 Bugzilla.getInstance().getIssueProvider(),
                 Bugzilla.getInstance().getStatusProvider(),
                 null, 
-                
Bugzilla.getInstance().createPriorityProvider(bugzillaRepository));
+                
Bugzilla.getInstance().createPriorityProvider(bugzillaRepository),
+                SimpleIssueFinder.getInstance());
     }
 
     public static void openIssue(BugzillaIssue bugzillaIssue) {
diff --git a/jira/src/org/netbeans/modules/jira/JiraConnector.java 
b/jira/src/org/netbeans/modules/jira/JiraConnector.java
--- a/jira/src/org/netbeans/modules/jira/JiraConnector.java
+++ b/jira/src/org/netbeans/modules/jira/JiraConnector.java
@@ -101,11 +101,6 @@
         return NbBundle.getMessage(JiraConnector.class, 
"LBL_ConnectorName");           // NOI18N
     }
 
-    @Override
-    public IssueFinder getIssueFinder() {
-        return JiraIssueFinder.getInstance();
-    }
-
     
/******************************************************************************
      * Kenai
      
******************************************************************************/
diff --git a/jira/src/org/netbeans/modules/jira/issue/JiraIssueFinder.java 
b/jira/src/org/netbeans/modules/jira/issue/JiraIssueFinder.java
--- a/jira/src/org/netbeans/modules/jira/issue/JiraIssueFinder.java
+++ b/jira/src/org/netbeans/modules/jira/issue/JiraIssueFinder.java
@@ -49,7 +49,7 @@
  *
  * @author Marian Petras
  */
-public class JiraIssueFinder extends IssueFinder {
+public class JiraIssueFinder implements IssueFinder {
 
     private static JiraIssueFinder instance;
     private static final int[] EMPTY_INT_ARR = new int[0];
diff --git a/jira/src/org/netbeans/modules/jira/util/JiraUtils.java 
b/jira/src/org/netbeans/modules/jira/util/JiraUtils.java
--- a/jira/src/org/netbeans/modules/jira/util/JiraUtils.java
+++ b/jira/src/org/netbeans/modules/jira/util/JiraUtils.java
@@ -68,6 +68,7 @@
 import org.netbeans.modules.bugtracking.api.Repository;
 import org.netbeans.modules.jira.Jira;
 import org.netbeans.modules.jira.JiraConnector;
+import org.netbeans.modules.jira.issue.JiraIssueFinder;
 import org.netbeans.modules.jira.issue.NbJiraIssue;
 import org.netbeans.modules.jira.query.JiraQuery;
 import org.netbeans.modules.jira.repository.JiraConfiguration;
@@ -360,7 +361,8 @@
                 Jira.getInstance().getIssueProvider(),
                 Jira.getInstance().getStatusProvider(),
                 null, 
-                Jira.getInstance().getPriorityProvider(jiraRepository));
+                Jira.getInstance().getPriorityProvider(jiraRepository),
+                JiraIssueFinder.getInstance());
     }
     
     public static void openIssue(NbJiraIssue jiraIssue) {
diff --git 
a/odcs.tasks/src/org/netbeans/modules/odcs/tasks/ODCSConnector.java 
b/odcs.tasks/src/org/netbeans/modules/odcs/tasks/ODCSConnector.java
--- a/odcs.tasks/src/org/netbeans/modules/odcs/tasks/ODCSConnector.java
+++ b/odcs.tasks/src/org/netbeans/modules/odcs/tasks/ODCSConnector.java
@@ -74,11 +74,6 @@
         return ODCSUtil.createRepository(new ODCSRepository());
     }
 
-    @Override
-    public IssueFinder getIssueFinder() {
-        return SimpleIssueFinder.getInstance();
-    }
-
     
/***************************************************************************
      * Team Support
      
***************************************************************************/
diff --git 
a/odcs.tasks/src/org/netbeans/modules/odcs/tasks/util/ODCSUtil.java 
b/odcs.tasks/src/org/netbeans/modules/odcs/tasks/util/ODCSUtil.java
--- a/odcs.tasks/src/org/netbeans/modules/odcs/tasks/util/ODCSUtil.java
+++ b/odcs.tasks/src/org/netbeans/modules/odcs/tasks/util/ODCSUtil.java
@@ -75,6 +75,7 @@
 import org.netbeans.modules.bugtracking.team.spi.TeamProject;
 import org.netbeans.modules.bugtracking.team.spi.TeamUtil;
 import org.netbeans.modules.bugtracking.util.ListValuePicker;
+import org.netbeans.modules.bugtracking.util.SimpleIssueFinder;
 import org.netbeans.modules.odcs.tasks.ODCS;
 import org.netbeans.modules.odcs.tasks.ODCSConnector;
 import org.netbeans.modules.odcs.tasks.issue.ODCSIssue;
@@ -205,7 +206,8 @@
                 ODCS.getInstance().getIssueProvider(),
                 ODCS.getInstance().getStatusProvider(),
                 null, 
-                ODCS.getInstance().getPriorityProvider(odcsRepository));
+                ODCS.getInstance().getPriorityProvider(odcsRepository),
+                SimpleIssueFinder.getInstance());
     }
 
     public static TaskResolution 
getResolutionByValue(RepositoryConfiguration rc, String value) {

[hg] main-silver: issue finder cleanup, javadoc, etc.

Tomas Stupka 10/11/2013

Project Features

About this Project

ConnectedDeveloper was started in November 2009, is owned by tpavek, and has 64 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20131025.e7cbc9d). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close