[hg] main-silver: make status values (new, modified, seen) optio...

  • From: Tomas Stupka < >
  • To: ,
  • Subject: [hg] main-silver: make status values (new, modified, seen) optio...
  • Date: Wed, 06 Mar 2013 11:57:58 -0800

changeset d68e61e463aa in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/d68e61e463aa
description:
        make status values (new, modified, seen) optional for BT implementors

diffstat:

 
bugtracking.bridge/test/unit/src/org/netbeans/modules/bugtracking/vcs/HookIssue.java
                  |  11 +
 bugtracking.kenai/nbproject/project.xml                                      
                         |   7 +-
 
bugtracking.kenai/src/org/netbeans/modules/bugtracking/kenai/QueryHandleImpl.java
                     |   5 +-
 
bugtracking.kenai/test/unit/src/org/netbeans/modules/bugtracking/kenai/IssueAccessorTest.java
         |  13 +-
 bugtracking/manifest.mf                                                      
                         |   2 +-
 bugtracking/src/org/netbeans/modules/bugtracking/IssueImpl.java              
                         |  33 +++
 bugtracking/src/org/netbeans/modules/bugtracking/api/Issue.java              
                         |  34 ++-
 bugtracking/src/org/netbeans/modules/bugtracking/issuetable/Filter.java      
                         |   7 +-
 bugtracking/src/org/netbeans/modules/bugtracking/issuetable/IssueNode.java   
                         |  14 +-
 bugtracking/src/org/netbeans/modules/bugtracking/issuetable/IssueTable.java  
                         |   6 +-
 
bugtracking/src/org/netbeans/modules/bugtracking/issuetable/QueryTableCellRenderer.java
               |  20 +-
 bugtracking/src/org/netbeans/modules/bugtracking/kenai/spi/KenaiUtil.java    
                         |   5 +-
 bugtracking/src/org/netbeans/modules/bugtracking/spi/IssueProvider.java      
                         |   8 +-
 
bugtracking/src/org/netbeans/modules/bugtracking/spi/IssueStatusProvider.java 
                        |  86 ++++++++++
 bugtracking/src/org/netbeans/modules/bugtracking/ui/issue/IssueAction.java   
                         |   5 +-
 
bugtracking/src/org/netbeans/modules/bugtracking/ui/issue/cache/IssueCache.java
                       |  52 ------
 
bugtracking/src/org/netbeans/modules/bugtracking/ui/issue/cache/IssueCacheUtils.java
                  |  71 --------
 
bugtracking/test/unit/src/org/netbeans/modules/bugtracking/RecentIssuesTest.java
                      |  11 +
 bugtracking/test/unit/src/org/netbeans/modules/bugtracking/TestIssue.java    
                         |   5 +
 
bugtracking/test/unit/src/org/netbeans/modules/bugtracking/TestIssueProvider.java
                     |  34 +++
 
bugtracking/test/unit/src/org/netbeans/modules/bugtracking/api/APITestIssue.java
                      |  11 +
 
bugtracking/test/unit/src/org/netbeans/modules/bugtracking/issuetable/QueryTableCellRendererTest.java
 |  45 ++++-
 
bugtracking/test/unit/src/org/netbeans/modules/bugtracking/ui/issue/cache/CacheTest.java
              |   9 +
 
bugtracking/test/unit/src/org/netbeans/modules/bugtracking/ui/issue/cache/StorageTest.java
            |  10 +
 bugzilla/nbproject/project.xml                                               
                         |   2 +-
 bugzilla/src/org/netbeans/modules/bugzilla/BugzillaIssueProvider.java        
                         |  32 +++
 bugzilla/src/org/netbeans/modules/bugzilla/issue/BugzillaIssue.java          
                         |  30 +++
 bugzilla/src/org/netbeans/modules/bugzilla/issue/IssuePanel.java             
                         |   8 +-
 jira/nbproject/project.xml                                                   
                         |   2 +-
 jira/src/org/netbeans/modules/jira/JiraIssueProvider.java                    
                         |  26 +++
 jira/src/org/netbeans/modules/jira/issue/IssuePanel.java                     
                         |   8 +-
 jira/src/org/netbeans/modules/jira/issue/NbJiraIssue.java                    
                         |  31 +++
 tasks.ui/nbproject/project.xml                                               
                         |   2 +-
 tasks.ui/src/org/netbeans/modules/tasks/ui/dashboard/TaskContainerNode.java  
                         |   2 +-
 34 files changed, 455 insertions(+), 192 deletions(-)

diffs (1401 lines):

diff --git 
a/bugtracking.bridge/test/unit/src/org/netbeans/modules/bugtracking/vcs/HookIssue.java
 
b/bugtracking.bridge/test/unit/src/org/netbeans/modules/bugtracking/vcs/HookIssue.java
--- 
a/bugtracking.bridge/test/unit/src/org/netbeans/modules/bugtracking/vcs/HookIssue.java
+++ 
b/bugtracking.bridge/test/unit/src/org/netbeans/modules/bugtracking/vcs/HookIssue.java
@@ -49,6 +49,7 @@
 import javax.swing.JPanel;
 import org.netbeans.modules.bugtracking.TestIssue;
 import org.netbeans.modules.bugtracking.spi.BugtrackingController;
+import org.netbeans.modules.bugtracking.spi.IssueStatusProvider;
 import org.openide.nodes.Node;
 import org.openide.util.HelpCtx;
 
@@ -162,4 +163,14 @@
         throw new UnsupportedOperationException("Not supported yet.");
     }    
 
+    @Override
+    public IssueStatusProvider.Status getStatus() {
+        throw new UnsupportedOperationException("Not supported yet."); //To 
change body of generated methods, choose Tools | Templates.
 }
+
+    @Override
+    public void setSeen(boolean seen) {
+        throw new UnsupportedOperationException("Not supported yet."); //To 
change body of generated methods, choose Tools | Templates.
+    }
+
+}
diff --git a/bugtracking.kenai/nbproject/project.xml 
b/bugtracking.kenai/nbproject/project.xml
--- a/bugtracking.kenai/nbproject/project.xml
+++ b/bugtracking.kenai/nbproject/project.xml
@@ -27,7 +27,7 @@
                     <build-prerequisite/>
                     <compile-dependency/>
                     <run-dependency>
-                        <specification-version>1.29</specification-version>
+                        <specification-version>1.44</specification-version>
                     </run-dependency>
                 </dependency>
                 <dependency>
@@ -209,6 +209,11 @@
                         <compile-dependency/>
                         <test/>
                     </test-dependency>
+                    <test-dependency>
+                        
<code-name-base>org.openide.util.lookup</code-name-base>
+                        <compile-dependency/>
+                        <test/>
+                    </test-dependency>                    
                 </test-type>
             </test-dependencies>
             <public-packages/>
diff --git 
a/bugtracking.kenai/src/org/netbeans/modules/bugtracking/kenai/QueryHandleImpl.java
 
b/bugtracking.kenai/src/org/netbeans/modules/bugtracking/kenai/QueryHandleImpl.java
--- 
a/bugtracking.kenai/src/org/netbeans/modules/bugtracking/kenai/QueryHandleImpl.java
+++ 
b/bugtracking.kenai/src/org/netbeans/modules/bugtracking/kenai/QueryHandleImpl.java
@@ -54,6 +54,7 @@
 import org.netbeans.modules.bugtracking.api.Issue;
 import org.netbeans.modules.bugtracking.api.Query;
 import org.netbeans.modules.bugtracking.kenai.spi.KenaiUtil;
+import org.netbeans.modules.bugtracking.spi.IssueStatusProvider;
 import org.netbeans.modules.bugtracking.ui.issue.cache.IssueCache;
 import org.netbeans.modules.team.ui.spi.QueryHandle;
 import org.netbeans.modules.team.ui.spi.QueryResultHandle;
@@ -115,7 +116,7 @@
         if(evt.getPropertyName().equals(Query.EVENT_QUERY_ISSUES_CHANGED)) {
             registerIssues();
             changeSupport.firePropertyChange(new PropertyChangeEvent(this, 
PROP_QUERY_RESULT, null, getQueryResults())); // XXX add result handles
-        } else 
if(evt.getPropertyName().equals(IssueCache.EVENT_ISSUE_SEEN_CHANGED)) {
+        } else 
if(evt.getPropertyName().equals(IssueStatusProvider.EVENT_SEEN_CHANGED)) {
             changeSupport.firePropertyChange(new PropertyChangeEvent(this, 
PROP_QUERY_RESULT, null, getQueryResults())); // XXX add result handles
         } 
     }
@@ -147,7 +148,7 @@
     private void registerIssues() {
         issues = query.getIssues();
         for (Issue issue : issues) {
-            KenaiUtil.addCacheListener(issue, this);
+            
issue.addPropertyChangeListener(WeakListeners.propertyChange(this, issue));
         }
     }
 
diff --git 
a/bugtracking.kenai/test/unit/src/org/netbeans/modules/bugtracking/kenai/IssueAccessorTest.java
 
b/bugtracking.kenai/test/unit/src/org/netbeans/modules/bugtracking/kenai/IssueAccessorTest.java
--- 
a/bugtracking.kenai/test/unit/src/org/netbeans/modules/bugtracking/kenai/IssueAccessorTest.java
+++ 
b/bugtracking.kenai/test/unit/src/org/netbeans/modules/bugtracking/kenai/IssueAccessorTest.java
@@ -69,9 +69,9 @@
 import org.netbeans.modules.kenai.api.KenaiProject;
 import org.netbeans.modules.kenai.ui.spi.KenaiIssueAccessor;
 import org.netbeans.modules.kenai.ui.spi.KenaiIssueAccessor.IssueHandle;
-import org.openide.nodes.Node;
 import org.openide.util.HelpCtx;
 import org.openide.util.Lookup;
+import org.openide.util.test.MockLookup;
 
 /**
  *
@@ -92,6 +92,7 @@
     @Override
     protected void setUp() throws Exception {
         super.setUp();
+        MockLookup.setLayersAndInstances();
         System.setProperty("netbeans.user", getWorkDir().getAbsolutePath());
         try {
             System.setProperty("kenai.com.url","https://testjava.net";);
@@ -295,6 +296,16 @@
         public String[] getSubtasks() {
             throw new UnsupportedOperationException("Not supported yet.");
         }        
+
+        @Override
+        public IssueStatusProvider.Status getStatus() {
+            throw new UnsupportedOperationException("Not supported yet."); 
//To change body of generated methods, choose Tools | Templates.
+        }
+
+        @Override
+        public void setSeen(boolean seen) {
+            throw new UnsupportedOperationException("Not supported yet."); 
//To change body of generated methods, choose Tools | Templates.
+        }
     }
 
     private static class TestIssueController extends BugtrackingController {
diff --git a/bugtracking/manifest.mf b/bugtracking/manifest.mf
--- a/bugtracking/manifest.mf
+++ b/bugtracking/manifest.mf
@@ -3,5 +3,5 @@
 OpenIDE-Module: org.netbeans.modules.bugtracking
 OpenIDE-Module-Layer: org/netbeans/modules/bugtracking/layer.xml
 OpenIDE-Module-Localizing-Bundle: 
org/netbeans/modules/bugtracking/Bundle.properties
-OpenIDE-Module-Specification-Version: 1.43
+OpenIDE-Module-Specification-Version: 1.44
 
diff --git a/bugtracking/src/org/netbeans/modules/bugtracking/IssueImpl.java 
b/bugtracking/src/org/netbeans/modules/bugtracking/IssueImpl.java
--- a/bugtracking/src/org/netbeans/modules/bugtracking/IssueImpl.java
+++ b/bugtracking/src/org/netbeans/modules/bugtracking/IssueImpl.java
@@ -49,6 +49,7 @@
 import org.netbeans.modules.bugtracking.kenai.spi.KenaiIssueProvider;
 import org.netbeans.modules.bugtracking.kenai.spi.OwnerInfo;
 import org.netbeans.modules.bugtracking.spi.BugtrackingController;
+import org.netbeans.modules.bugtracking.spi.IssueStatusProvider;
 import org.netbeans.modules.bugtracking.ui.issue.IssueAction;
 
 /**
@@ -194,4 +195,36 @@
     public boolean isData(Object obj) {
         return data == obj;
     }
+
+    public IssueStatusProvider.Status getStatus() {
+        IssueStatusProvider sp = issueProvider.getStatusProvider();
+        if(sp == null) {
+            return null;
 }
+        return sp.getStatus(data);
+    }
+
+    public void addIssueStatusListener(PropertyChangeListener l) {
+        IssueStatusProvider sp = issueProvider.getStatusProvider();
+        if(sp == null) {
+            return;
+        }
+        sp.addPropertyChangeListener(data, l);
+    }
+
+    public void removeIssueStatusListener(PropertyChangeListener l) {
+        IssueStatusProvider sp = issueProvider.getStatusProvider();
+        if(sp == null) {
+            return;
+        }
+        sp.removePropertyChangeListener(data, l);
+    }
+
+    public void setSeen(boolean isUptodate) {
+        IssueStatusProvider sp = issueProvider.getStatusProvider();
+        if(sp == null) {
+            return;
+        }
+        sp.setSeen(data, isUptodate);
+    }
+}
diff --git a/bugtracking/src/org/netbeans/modules/bugtracking/api/Issue.java 
b/bugtracking/src/org/netbeans/modules/bugtracking/api/Issue.java
--- a/bugtracking/src/org/netbeans/modules/bugtracking/api/Issue.java
+++ b/bugtracking/src/org/netbeans/modules/bugtracking/api/Issue.java
@@ -45,9 +45,8 @@
 import java.io.File;
 import org.netbeans.modules.bugtracking.IssueImpl;
 import org.netbeans.modules.bugtracking.spi.IssueProvider;
+import org.netbeans.modules.bugtracking.spi.IssueStatusProvider;
 import org.netbeans.modules.bugtracking.ui.issue.IssueAction;
-import org.netbeans.modules.bugtracking.ui.issue.cache.IssueCache;
-import org.netbeans.modules.bugtracking.ui.issue.cache.IssueCacheUtils;
 
 /**
  *
@@ -56,9 +55,18 @@
 public final class Issue {
     
     public enum Status {
+        /**
+         * the user hasn't seen this issue yet
+         */
         NEW,
+        /**
+         * the issue was modified since the issue was seen the last time
+         */
         MODIFIED,
-        UPTODATE
+        /**
+         * the user has seen the issue and there haven't been any changes 
since then
+         */
+        SEEN
     }
     
     /**
@@ -66,6 +74,11 @@
      */
     public static final String EVENT_ISSUE_REFRESHED = 
IssueProvider.EVENT_ISSUE_REFRESHED;
     
+    /**
+     * issues seen flag has changed 
+     */
+    public static final String EVENT_SEEN_CHANGED = 
IssueStatusProvider.EVENT_SEEN_CHANGED;
+    
     private final IssueImpl impl;
 
     Issue(IssueImpl impl) {
@@ -191,14 +204,17 @@
     }
     
     public Status getStatus() {
-        // XXX this is hacked
-        int status = IssueCacheUtils.getStatus(impl);
+        IssueStatusProvider.Status status = impl.getStatus();
+        if(status == null) {
+            // no status provided -> lets handle as if it was seen (uptodate)
+            return Status.SEEN;
+        }
         switch(status) {
-            case IssueCache.ISSUE_STATUS_SEEN:
-                return Status.UPTODATE;
-            case IssueCache.ISSUE_STATUS_NEW:
+            case SEEN:
+                return Status.SEEN;
+            case NEW:
                 return Status.NEW;
-            case IssueCache.ISSUE_STATUS_MODIFIED:
+            case MODIFIED:
                 return Status.MODIFIED;
             default:
                 throw new IllegalStateException("Unexpected status value " + 
status);
diff --git 
a/bugtracking/src/org/netbeans/modules/bugtracking/issuetable/Filter.java 
b/bugtracking/src/org/netbeans/modules/bugtracking/issuetable/Filter.java
--- a/bugtracking/src/org/netbeans/modules/bugtracking/issuetable/Filter.java
+++ b/bugtracking/src/org/netbeans/modules/bugtracking/issuetable/Filter.java
@@ -44,7 +44,6 @@
 
 package org.netbeans.modules.bugtracking.issuetable;
 
-import org.netbeans.modules.bugtracking.ui.issue.cache.IssueCacheUtils;
 import java.lang.reflect.Constructor;
 import java.util.HashMap;
 import java.util.Map;
@@ -52,7 +51,7 @@
 import java.util.logging.Level;
 import org.netbeans.modules.bugtracking.BugtrackingManager;
 import org.netbeans.modules.bugtracking.QueryImpl;
-import org.netbeans.modules.bugtracking.ui.issue.cache.IssueCache;
+import org.netbeans.modules.bugtracking.spi.IssueStatusProvider;
 import org.openide.util.NbBundle;
 
 /**
@@ -132,7 +131,7 @@
         }
         @Override
         public boolean accept(IssueNode node) {
-            return !IssueCacheUtils.wasSeen(node.getIssue()) && 
contains(query, node.getIssue().getID());
+            return node.getIssue().getStatus() != 
IssueStatusProvider.Status.SEEN && contains(query, node.getIssue().getID());
         }
     }
     private static class NewFilter extends Filter {
@@ -146,7 +145,7 @@
         }
         @Override
         public boolean accept(IssueNode node) {
-            return IssueCacheUtils.getStatus(node.getIssue()) == 
IssueCache.ISSUE_STATUS_NEW;
+            return node.getIssue().getStatus() == 
IssueStatusProvider.Status.NEW;
         }
     }
     private static class ObsoleteDateFilter extends Filter {
diff --git 
a/bugtracking/src/org/netbeans/modules/bugtracking/issuetable/IssueNode.java 
b/bugtracking/src/org/netbeans/modules/bugtracking/issuetable/IssueNode.java
--- 
a/bugtracking/src/org/netbeans/modules/bugtracking/issuetable/IssueNode.java
+++ 
b/bugtracking/src/org/netbeans/modules/bugtracking/issuetable/IssueNode.java
@@ -59,7 +59,7 @@
 import org.netbeans.modules.bugtracking.api.Issue;
 import org.netbeans.modules.bugtracking.api.Query;
 import org.netbeans.modules.bugtracking.api.Repository;
-import org.netbeans.modules.bugtracking.ui.issue.cache.IssueCache;
+import org.netbeans.modules.bugtracking.spi.IssueStatusProvider;
 import org.openide.util.NbBundle;
 
 /**
@@ -106,13 +106,13 @@
         this.issueData = issueData;
         initProperties();
         refreshHtmlDisplayName();
-        IssueCacheUtils.addCacheListener(issue, new PropertyChangeListener() 
{
+        issue.addIssueStatusListener(new PropertyChangeListener() {
             @Override
             public void propertyChange(PropertyChangeEvent evt) {
-                if(IssueNode.this.issue.getIssue() != evt.getSource()) {
+                if(!IssueNode.this.issue.isData(evt.getSource())) {
                     return;
                 }
-                
if(evt.getPropertyName().equals(IssueCache.EVENT_ISSUE_SEEN_CHANGED)) {
+                
if(evt.getPropertyName().equals(IssueStatusProvider.EVENT_SEEN_CHANGED)) {
                     fireSeenValueChanged((Boolean)evt.getOldValue(), 
(Boolean)evt.getNewValue());
                 }
             }
@@ -141,7 +141,7 @@
     }
 
     public boolean wasSeen() {
-        return IssueCacheUtils.wasSeen(issue);
+        return issue.getStatus() == IssueStatusProvider.Status.SEEN;
     }
 
     private void initProperties() {
@@ -268,13 +268,13 @@
         }
         @Override
         public Boolean getValue() {
-            return IssueCacheUtils.wasSeen(issue);
+            return issue.getStatus() == IssueStatusProvider.Status.SEEN;
         }
         @Override
         public int compareTo(IssueProperty p) {
             if(p == null) return 1;
             Boolean b1 = IssueNode.this.wasSeen();
-            Boolean b2 = 
IssueCacheUtils.wasSeen(APIAccessor.IMPL.getImpl(p.getIssue()));
+            Boolean b2 = APIAccessor.IMPL.getImpl(p.getIssue()).getStatus() 
== IssueStatusProvider.Status.SEEN;
             return b1.compareTo(b2);
         }
 
diff --git 
a/bugtracking/src/org/netbeans/modules/bugtracking/issuetable/IssueTable.java 
b/bugtracking/src/org/netbeans/modules/bugtracking/issuetable/IssueTable.java
--- 
a/bugtracking/src/org/netbeans/modules/bugtracking/issuetable/IssueTable.java
+++ 
b/bugtracking/src/org/netbeans/modules/bugtracking/issuetable/IssueTable.java
@@ -44,13 +44,11 @@
 
 package org.netbeans.modules.bugtracking.issuetable;
 
-import java.awt.BorderLayout;
 import javax.swing.JButton;
 import javax.swing.event.ChangeEvent;
 import javax.swing.event.ListSelectionEvent;
 import javax.swing.event.TableColumnModelEvent;
 import javax.swing.table.TableColumn;
-import org.netbeans.modules.bugtracking.ui.issue.cache.IssueCacheUtils;
 import java.beans.PropertyChangeEvent;
 import org.netbeans.modules.bugtracking.issuetable.IssueNode.IssueProperty;
 import org.openide.util.NbBundle;
@@ -95,6 +93,7 @@
 import javax.swing.table.TableColumnModel;
 import org.netbeans.modules.bugtracking.*;
 import org.netbeans.modules.bugtracking.api.Repository;
+import org.netbeans.modules.bugtracking.spi.IssueStatusProvider;
 import org.netbeans.modules.bugtracking.spi.QueryProvider;
 import org.netbeans.modules.bugtracking.util.UIUtils;
 import org.openide.awt.MouseUtils;
@@ -749,7 +748,8 @@
                     
BugtrackingManager.getInstance().getRequestProcessor().post(new Runnable() {
                         @Override
                         public void run() {
-                            IssueCacheUtils.switchSeen(issue);
+                            IssueStatusProvider.Status status = 
issue.getStatus();
+                            issue.setSeen(status != 
IssueStatusProvider.Status.SEEN);
                         }
                     });
                 }
diff --git 
a/bugtracking/src/org/netbeans/modules/bugtracking/issuetable/QueryTableCellRenderer.java
 
b/bugtracking/src/org/netbeans/modules/bugtracking/issuetable/QueryTableCellRenderer.java
--- 
a/bugtracking/src/org/netbeans/modules/bugtracking/issuetable/QueryTableCellRenderer.java
+++ 
b/bugtracking/src/org/netbeans/modules/bugtracking/issuetable/QueryTableCellRenderer.java
@@ -66,7 +66,7 @@
 import org.netbeans.modules.bugtracking.issuetable.IssueNode.IssueProperty;
 import org.netbeans.modules.bugtracking.QueryImpl;
 import org.netbeans.modules.bugtracking.api.Query;
-import org.netbeans.modules.bugtracking.ui.issue.cache.IssueCache;
+import org.netbeans.modules.bugtracking.spi.IssueStatusProvider;
 import org.netbeans.modules.bugtracking.util.TextUtils;
 import org.openide.util.ImageUtilities;
 import org.openide.util.NbBundle;
@@ -311,21 +311,21 @@
         TableCellStyle style = getDefaultCellStyle(table, issueTable, p, 
isSelected, row);
         try {
             // set text format and background depending on selection and 
issue status
-            int status = -2;
+            IssueStatusProvider.Status status = null;
             IssueImpl issue = APIAccessor.IMPL.getImpl(p.getIssue());
             if(!queryImpl.contains(issue.getID())) {
                 // archived issues
                 style.format     = isSelected ? style.format           : 
issueObsoleteFormat;
                 style.background = isSelected ? obsoleteHighlightColor : 
style.background;
             } else {
-                status = IssueCacheUtils.getStatus(issue);
-                if(!IssueCacheUtils.wasSeen(issue)) {
+                status = issue.getStatus();
+                if(status != IssueStatusProvider.Status.SEEN) {
                     switch(status) {
-                        case IssueCache.ISSUE_STATUS_NEW :
+                        case NEW :
                             style.format     = isSelected ? style.format     
 : issueNewFormat;
                             style.background = isSelected ? 
newHighlightColor : style.background;
                             break;
-                        case IssueCache.ISSUE_STATUS_MODIFIED :
+                        case MODIFIED :
                             style.format     = isSelected ? style.format     
      : issueModifiedFormat;
                             style.background = isSelected ? 
modifiedHighlightColor : style.background;
                             break;
@@ -345,15 +345,15 @@
                     sb.append("<br>").append(issueObsoleteFormat.format(new 
Object[] { labelObsolete }, new StringBuffer(), null)); // NOI18N
                     sb.append(msgObsolete);
                 } else {
-                    if(status == -2) {
-                        status = IssueCacheUtils.getStatus(issue);
+                    if(status == null) {
+                        status = issue.getStatus();
                     }
                     switch(status) {
-                        case IssueCache.ISSUE_STATUS_NEW :
+                        case NEW :
                             
sb.append("<br>").append(issueNewFormat.format(new Object[] { labelNew }, new 
StringBuffer(), null)); // NOI18N
                             sb.append(msgNew);
                             break;
-                        case IssueCache.ISSUE_STATUS_MODIFIED :
+                        case MODIFIED :
                             
sb.append("<br>").append(issueModifiedFormat.format(new Object[] { 
labelModified }, new StringBuffer(), null)); // NOI18N
                             sb.append(msgModified);
                             
sb.append(IssueCacheUtils.getRecentChanges(issue));
diff --git 
a/bugtracking/src/org/netbeans/modules/bugtracking/kenai/spi/KenaiUtil.java 
b/bugtracking/src/org/netbeans/modules/bugtracking/kenai/spi/KenaiUtil.java
--- 
a/bugtracking/src/org/netbeans/modules/bugtracking/kenai/spi/KenaiUtil.java
+++ 
b/bugtracking/src/org/netbeans/modules/bugtracking/kenai/spi/KenaiUtil.java
@@ -65,7 +65,6 @@
 import 
org.netbeans.modules.bugtracking.kenai.spi.KenaiBugtrackingConnector.BugtrackingType;
 import org.netbeans.modules.bugtracking.spi.BugtrackingConnector;
 import org.netbeans.modules.bugtracking.ui.issue.IssueAction;
-import org.netbeans.modules.bugtracking.ui.issue.cache.IssueCacheUtils;
 import org.netbeans.modules.bugtracking.ui.query.QueryAction;
 import org.netbeans.modules.bugtracking.ui.query.QueryTopComponent;
 import org.netbeans.modules.bugtracking.util.BugtrackingUtil;
@@ -423,11 +422,11 @@
     }
 
     public static void addCacheListener(Issue issue, PropertyChangeListener 
l) {
-        IssueCacheUtils.addCacheListener(APIAccessor.IMPL.getImpl(issue), l);
+        APIAccessor.IMPL.getImpl(issue).addIssueStatusListener(l);
     }
     
     public static void removeCacheListener(Issue issue, 
PropertyChangeListener l) {
-        IssueCacheUtils.removeCacheListener(APIAccessor.IMPL.getImpl(issue), 
l);
+        APIAccessor.IMPL.getImpl(issue).removeIssueStatusListener(l);
     }
 
     public static boolean isOpen(Issue issue) {
diff --git 
a/bugtracking/src/org/netbeans/modules/bugtracking/spi/IssueProvider.java 
b/bugtracking/src/org/netbeans/modules/bugtracking/spi/IssueProvider.java
--- a/bugtracking/src/org/netbeans/modules/bugtracking/spi/IssueProvider.java
+++ b/bugtracking/src/org/netbeans/modules/bugtracking/spi/IssueProvider.java
@@ -60,6 +60,10 @@
         SPIAccessorImpl.createAccesor();
     }
 
+    public IssueStatusProvider getStatusProvider() {
+        return null;
+    }
+    
     /**
      * Returns this issues display name
      * @return
@@ -90,8 +94,6 @@
      */
     public abstract String[] getSubtasks(I data);
 
-    
-    
     /**
      * Returns this issues summary
      * @return
@@ -105,7 +107,7 @@
     public abstract boolean isNew(I data);
     
     /**
-     * Determines if the issue has reached a status when is considered 
finished 
+     * Determines if the issue is considered finished 
      * in the means of the particular bugtracking.
      * 
      * @param data
diff --git 
a/bugtracking/src/org/netbeans/modules/bugtracking/spi/IssueStatusProvider.java
 
b/bugtracking/src/org/netbeans/modules/bugtracking/spi/IssueStatusProvider.java
new file mode 100644
--- /dev/null
+++ 
b/bugtracking/src/org/netbeans/modules/bugtracking/spi/IssueStatusProvider.java
@@ -0,0 +1,86 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2008-2010 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+ * Other names may be trademarks of their respective owners.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common
+ * Development and Distribution License("CDDL") (collectively, the
+ * "License"). You may not use this file except in compliance with the
+ * License. You can obtain a copy of the License at
+ * http://www.netbeans.org/cddl-gplv2.html
+ * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
+ * specific language governing permissions and limitations under the
+ * License.  When distributing the software, include this License Header
+ * Notice in each file and include the License file at
+ * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the
+ * License Header, with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * If you wish your version of this file to be governed by only the CDDL
+ * or only the GPL Version 2, indicate your decision by adding
+ * "[Contributor] elects to include this software in this distribution
+ * under the [CDDL or GPL Version 2] license." If you do not indicate a
+ * single choice of license, a recipient has the option to distribute
+ * your version of this file under either the CDDL, the GPL Version 2 or
+ * to extend the choice of license to its licensees as provided above.
+ * However, if you add GPL Version 2 code and therefore, elected the GPL
+ * Version 2 license, then the option applies only if the new code is
+ * made subject to such option by the copyright holder.
+ *
+ * Contributor(s):
+ *
+ * Portions Copyrighted 2008-2009 Sun Microsystems, Inc.
+ */
+package org.netbeans.modules.bugtracking.spi;
+
+import java.beans.PropertyChangeListener;
+import java.io.File;
+import org.netbeans.modules.bugtracking.api.Issue;
+
+/**
+ * 
+ *
+ * @author Tomas Stupka
+ */
+public interface IssueStatusProvider<I> {
+
+    public enum Status {
+        NEW,
+        MODIFIED,
+        SEEN
+    }
+        
+    /**
+     * issue status changed
+     */
+    public static final String EVENT_SEEN_CHANGED = "issue.status_changed"; 
// NOI18N
+
+    /*
+     * 
+     */
+    public Status getStatus(I issue);
+
+    /*
+     * 
+     */
+    public void setSeen(I issue, boolean seen);
+    
+    /*
+     * 
+     */
+    public void removePropertyChangeListener(I issue, PropertyChangeListener 
listener);
+
+    /*
+     * 
+     */
+    public void addPropertyChangeListener(I issue, PropertyChangeListener 
listener);
+
+}
diff --git 
a/bugtracking/src/org/netbeans/modules/bugtracking/ui/issue/IssueAction.java 
b/bugtracking/src/org/netbeans/modules/bugtracking/ui/issue/IssueAction.java
--- 
a/bugtracking/src/org/netbeans/modules/bugtracking/ui/issue/IssueAction.java
+++ 
b/bugtracking/src/org/netbeans/modules/bugtracking/ui/issue/IssueAction.java
@@ -55,7 +55,6 @@
 import org.netbeans.modules.bugtracking.BugtrackingManager;
 import org.netbeans.modules.bugtracking.IssueImpl;
 import org.netbeans.modules.bugtracking.RepositoryImpl;
-import org.netbeans.modules.bugtracking.ui.issue.cache.IssueCacheUtils;
 import org.netbeans.modules.bugtracking.util.BugtrackingOwnerSupport;
 import org.netbeans.modules.bugtracking.util.BugtrackingUtil;
 import org.netbeans.modules.bugtracking.util.UIUtils;
@@ -109,7 +108,7 @@
                             if (refresh && !issue.refresh()) {
                                 return;
                             }
-                            IssueCacheUtils.setSeen(issue, true);
+                            issue.setSeen(true);
                         } finally {
                             UIUtils.setWaitCursor(false);
                             if(handle != null) handle.finish();
@@ -221,7 +220,7 @@
                                         tc.setIssue(impl);
                                     }
                                 });
-                                IssueCacheUtils.setSeen(impl, true);
+                                impl.setSeen(true);
                             }
                         } finally {
                             if(handle != null) handle.finish();
diff --git 
a/bugtracking/src/org/netbeans/modules/bugtracking/ui/issue/cache/IssueCache.java
 
b/bugtracking/src/org/netbeans/modules/bugtracking/ui/issue/cache/IssueCache.java
--- 
a/bugtracking/src/org/netbeans/modules/bugtracking/ui/issue/cache/IssueCache.java
+++ 
b/bugtracking/src/org/netbeans/modules/bugtracking/ui/issue/cache/IssueCache.java
@@ -42,8 +42,6 @@
 
 package org.netbeans.modules.bugtracking.ui.issue.cache;
 
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeSupport;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -96,14 +94,8 @@
             ISSUE_STATUS_NEW |
             ISSUE_STATUS_MODIFIED;
 
-    /**
-     * issues seen state changed
-     */
-    // XXX this is a status change and should be fired by the issue in case 
it support status values
-    public static final String EVENT_ISSUE_SEEN_CHANGED = 
"issue.seen_changed"; // NOI18N
     private static final Logger LOG = 
Logger.getLogger("org.netbeans.modules.bugtracking.ui.issue.cache.IssueCache");
     private Map<String, IssueEntry> cache;
-    private final Map<String, PropertyChangeSupport> supports = new 
HashMap<String, PropertyChangeSupport>();
     private Map<String, Map<String, String>> lastSeenAttributes;
 
     private String nameSpace;
@@ -376,8 +368,6 @@
             entry.seen = seen;
             storeIssue(entry);
         }
-        Issue issue = getIssue(entry.issue);
-        fireSeenChanged(issue, oldValue, seen);
     }
 
     /**
@@ -601,48 +591,6 @@
         IssueStorage.getInstance().storeIssue(nameSpace, entry);
     }
 
-    public void addPropertyChangeListener(Issue issue, 
PropertyChangeListener propertyChangeListener) {
-        PropertyChangeSupport support = getChangeSupport(issue, true);
-        support.addPropertyChangeListener(propertyChangeListener);
-        
-    }
-    public void addPropertyChangeListener(I i, PropertyChangeListener l) {
-        addPropertyChangeListener(getIssue(i), l);
-    }
-
-    public void removePropertyChangeListener(I i, PropertyChangeListener l) {
-        removePropertyChangeListener(getIssue(i), l);
-    }
-    
-    public void removePropertyChangeListener(Issue issue, 
PropertyChangeListener l) {
-        PropertyChangeSupport support = getChangeSupport(issue, true);
-        support.removePropertyChangeListener(l);
-    }
-    
-    private PropertyChangeSupport getChangeSupport(Issue issue, boolean 
forceCreate) {
-        PropertyChangeSupport support = supports.get(issue.getID());
-        if (support == null && forceCreate) {
-            support = new PropertyChangeSupport(issue);
-            supports.put(issue.getID(), support);
-        }
-        return support;
-    }
-
-
-    /**
-     * Notify listeners on this issue that the seen state has chaged
-     *
-     * @param oldSeen the old seen state
-     * @param newSeen the new seen state
-     * @see #EVENT_ISSUE_SEEN_CHANGED
-     */
-    private void fireSeenChanged(Issue issue, boolean oldSeen, boolean 
newSeen) {
-        PropertyChangeSupport support = getChangeSupport(issue, false);
-        if(support != null) {
-            support.firePropertyChange(EVENT_ISSUE_SEEN_CHANGED, oldSeen, 
newSeen);
-        }
-    }
-
     private boolean isChanged(Map<String, String> oldAttr, Map<String, 
String> newAttr) {
         if(oldAttr == null) {
             return false; // can't be changed if it wasn't seen yet
diff --git 
a/bugtracking/src/org/netbeans/modules/bugtracking/ui/issue/cache/IssueCacheUtils.java
 
b/bugtracking/src/org/netbeans/modules/bugtracking/ui/issue/cache/IssueCacheUtils.java
--- 
a/bugtracking/src/org/netbeans/modules/bugtracking/ui/issue/cache/IssueCacheUtils.java
+++ 
b/bugtracking/src/org/netbeans/modules/bugtracking/ui/issue/cache/IssueCacheUtils.java
@@ -58,53 +58,6 @@
 public class IssueCacheUtils {
 
     /**
-     * Returns if the given issue was seen
-     * @param issue issue
-     * @return true if issue was seen otherwise false
-     */
-    public static boolean wasSeen(IssueImpl issue) {
-        IssueCache cache = getCache(issue);
-        return cache != null ? cache.wasSeen(issue.getID()) : true;
-    }
-
-    /**
-     * Changes the given issues seen value to ist opposite value
-     * @param issue
-     */
-    public static void switchSeen(IssueImpl issue) {
-        try {
-            IssueCache cache = getCache(issue);
-            if(cache != null) {
-                String id = issue.getID();
-                cache.setSeen(id, !cache.wasSeen(id));
-            }
-        } catch (IOException ex) {
-            BugtrackingManager.LOG.log(Level.SEVERE, null, ex);
-        }
-    }
-
-    /**
-     * Sets the given issues seen status
-     * @param issue issue
-     * @param seen value to be set
-     */
-    public static void setSeen(IssueImpl issue, boolean seen) {
-        try {
-            IssueCache cache = getCache(issue);
-            if(cache != null) {
-                cache.setSeen(issue.getID(), seen);
-            }
-        } catch (IOException ex) {
-            BugtrackingManager.LOG.log(Level.SEVERE, null, ex);
-        }
-    }
-    
-    public static int getStatus(IssueImpl issue) {
-        IssueCache cache = getCache(issue);
-        return cache != null ? cache.getStatus(issue.getID()) : 
IssueCache.ISSUE_STATUS_UNKNOWN; 
-    }    
-
-    /**
      * Returns a description summarizing the changes made
      * in the given issue since the last time it was as seen.
      *
@@ -126,30 +79,6 @@
         return changes;
     }
 
-    /**
-     * Registers the given listener with the given issue
-     * @param issue
-     * @param l
-     */
-    public static void addCacheListener (IssueImpl issue, 
PropertyChangeListener l) {
-        IssueCache cache = getCache(issue);
-        if(cache != null) {
-            cache.addPropertyChangeListener(issue.getIssue(), l);
-        }
-    }
-
-    /**
-     * Unregisters the given listener with the given issue
-     * @param issue
-     * @param l
-     */
-    public static void removeCacheListener (IssueImpl issue, 
PropertyChangeListener l) {
-        IssueCache cache = getCache(issue);
-        if(cache != null) {
-            cache.removePropertyChangeListener(issue.getIssue(), l);
-        }
-    }
-
     private static IssueCache getCache(IssueImpl issue) {
         RepositoryImpl repo = issue.getRepositoryImpl();
         IssueCache cache = repo.getLookup().lookup(IssueCache.class);
diff --git 
a/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/RecentIssuesTest.java
 
b/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/RecentIssuesTest.java
--- 
a/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/RecentIssuesTest.java
+++ 
b/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/RecentIssuesTest.java
@@ -284,6 +284,17 @@
         public void addPropertyChangeListener(PropertyChangeListener 
listener) {throw new UnsupportedOperationException("Not supported yet.");}
         public TestIssue createFor(String id) {throw new 
UnsupportedOperationException("Not supported yet.");}
         public String[] getSubtasks() {throw new 
UnsupportedOperationException("Not supported yet.");}
+
+        @Override
+        public IssueStatusProvider.Status getStatus() {
+            throw new UnsupportedOperationException("Not supported yet."); 
//To change body of generated methods, choose Tools | Templates.
+        }
+
+        @Override
+        public void setSeen(boolean seen) {
+            throw new UnsupportedOperationException("Not supported yet."); 
//To change body of generated methods, choose Tools | Templates.
+        }
+
     }
 
     private class RITestConector extends BugtrackingConnector {
diff --git 
a/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/TestIssue.java 
b/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/TestIssue.java
--- 
a/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/TestIssue.java
+++ 
b/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/TestIssue.java
@@ -44,6 +44,7 @@
 import java.beans.PropertyChangeListener;
 import java.io.File;
 import org.netbeans.modules.bugtracking.spi.BugtrackingController;
+import org.netbeans.modules.bugtracking.spi.IssueStatusProvider;
 import org.openide.nodes.Node;
 
 /**
@@ -78,4 +79,8 @@
 
     public abstract boolean isFinished();
     
+    public abstract IssueStatusProvider.Status getStatus();
+
+    public abstract void setSeen(boolean seen);
+
 }
diff --git 
a/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/TestIssueProvider.java
 
b/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/TestIssueProvider.java
--- 
a/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/TestIssueProvider.java
+++ 
b/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/TestIssueProvider.java
@@ -46,6 +46,7 @@
 import org.netbeans.modules.bugtracking.issuetable.IssueNode;
 import org.netbeans.modules.bugtracking.spi.BugtrackingController;
 import org.netbeans.modules.bugtracking.spi.IssueProvider;
+import org.netbeans.modules.bugtracking.spi.IssueStatusProvider;
 import org.openide.nodes.Node;
 
 /**
@@ -53,6 +54,7 @@
  * @author tomas
  */
 public class TestIssueProvider extends IssueProvider<TestIssue> {
+    private StatusProvider statusProvider;
 
     @Override
     public String[] getSubtasks(TestIssue data) {
@@ -119,4 +121,36 @@
         data.addPropertyChangeListener(listener);
     }
 
+    @Override
+    public IssueStatusProvider getStatusProvider() {
+        if(statusProvider == null) {
+            statusProvider = new StatusProvider();
 }
+        return statusProvider;
+    }
+    
+    private class StatusProvider implements IssueStatusProvider<TestIssue> {
+
+        @Override
+        public Status getStatus(TestIssue issue) {
+            return issue.getStatus();
+        }
+
+        @Override
+        public void setSeen(TestIssue issue, boolean seen) {
+            issue.setSeen(seen);
+        }
+
+        @Override
+        public void removePropertyChangeListener(TestIssue issue, 
PropertyChangeListener listener) {
+            issue.removePropertyChangeListener(listener);
+        }
+
+        @Override
+        public void addPropertyChangeListener(TestIssue issue, 
PropertyChangeListener listener) {
+            issue.addPropertyChangeListener(listener);
+        }
+        
+    }
+    
+}
diff --git 
a/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/api/APITestIssue.java
 
b/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/api/APITestIssue.java
--- 
a/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/api/APITestIssue.java
+++ 
b/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/api/APITestIssue.java
@@ -50,6 +50,7 @@
 import org.netbeans.modules.bugtracking.TestIssue;
 import org.netbeans.modules.bugtracking.spi.BugtrackingController;
 import org.netbeans.modules.bugtracking.spi.IssueProvider;
+import org.netbeans.modules.bugtracking.spi.IssueStatusProvider;
 import org.openide.util.HelpCtx;
 
 /**
@@ -176,4 +177,14 @@
         return idFinished;
     }
     
+    @Override
+    public IssueStatusProvider.Status getStatus() {
+        throw new UnsupportedOperationException("Not supported yet."); //To 
change body of generated methods, choose Tools | Templates.
 }
+
+    @Override
+    public void setSeen(boolean seen) {
+        throw new UnsupportedOperationException("Not supported yet."); //To 
change body of generated methods, choose Tools | Templates.
+    }
+
+}
diff --git 
a/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/issuetable/QueryTableCellRendererTest.java
 
b/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/issuetable/QueryTableCellRendererTest.java
--- 
a/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/issuetable/QueryTableCellRendererTest.java
+++ 
b/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/issuetable/QueryTableCellRendererTest.java
@@ -128,7 +128,7 @@
 
         
         // issue seen, not selected
-        RendererIssue rendererIssue = new RendererIssue("");
+        RendererIssue rendererIssue = new RendererIssue(rendererRepository, 
"");
         IssueProperty property = new RendererNode(rendererIssue, "some 
value", rendererRepository).createProperty();
         rendererQuery.containsIssue = true;
         boolean selected = false;
@@ -142,7 +142,7 @@
 
         // issue seen, selected
         rendererQuery.containsIssue = true;
-        rendererIssue = new RendererIssue("");
+        rendererIssue = new RendererIssue(rendererRepository, "");
         property = new RendererNode(rendererIssue, "some value", 
rendererRepository).createProperty();
         selected = true;
         setEntryValues(rendererRepository, rendererIssue, 
IssueCache.ISSUE_STATUS_SEEN, true);
@@ -155,7 +155,7 @@
 
         // obsolete issue, not selected
         rendererQuery.containsIssue = false;
-        rendererIssue = new RendererIssue("");
+        rendererIssue = new RendererIssue(rendererRepository, "");
         property = new RendererNode(rendererIssue, "some value", 
rendererRepository).createProperty();
         selected = false;
         result = QueryTableCellRenderer.getCellStyle(table, 
query.getQuery(), issueTable, property, selected, 0);
@@ -168,7 +168,7 @@
         // obsolete issue, selected
         rendererQuery.containsIssue = false;
         selected = true;
-        rendererIssue = new RendererIssue("");
+        rendererIssue = new RendererIssue(rendererRepository, "");
         property = new RendererNode(rendererIssue, "some value", 
rendererRepository).createProperty();
         result = QueryTableCellRenderer.getCellStyle(table, 
query.getQuery(), issueTable, property, selected, 0);
         defaultStyle = QueryTableCellRenderer.getDefaultCellStyle(table, 
issueTable, property, selected, 0);
@@ -180,7 +180,7 @@
         // modified issue, not selected
         rendererQuery.containsIssue = true;
         selected = false;
-        rendererIssue = new RendererIssue("changed");
+        rendererIssue = new RendererIssue(rendererRepository, "changed");
         property = new RendererNode(rendererIssue, "some value", 
rendererRepository).createProperty();
         setEntryValues(rendererRepository, rendererIssue, 
IssueCache.ISSUE_STATUS_MODIFIED, false);
         result = QueryTableCellRenderer.getCellStyle(table, 
query.getQuery(), issueTable, property, selected, 0);
@@ -194,7 +194,7 @@
         // modified issue, selected
         rendererQuery.containsIssue = true;
         selected = true;
-        rendererIssue = new RendererIssue("changed");
+        rendererIssue = new RendererIssue(rendererRepository, "changed");
         property = new RendererNode(rendererIssue, "some value", 
rendererRepository).createProperty();
         setEntryValues(rendererRepository, rendererIssue, 
IssueCache.ISSUE_STATUS_MODIFIED, false);
         result = QueryTableCellRenderer.getCellStyle(table, 
query.getQuery(), issueTable, property, selected, 0);
@@ -207,7 +207,7 @@
         // new issue, not selected
         rendererQuery.containsIssue = true;
         selected = false;
-        rendererIssue = new RendererIssue("");
+        rendererIssue = new RendererIssue(rendererRepository, "");
         property = new RendererNode(rendererIssue, "some value", 
rendererRepository).createProperty();
         setEntryValues(rendererRepository, rendererIssue, 
IssueCache.ISSUE_STATUS_NEW, false);
         result = QueryTableCellRenderer.getCellStyle(table, 
query.getQuery(), issueTable, property, selected, 0);
@@ -221,7 +221,7 @@
         // new issue, selected
         rendererQuery.containsIssue = true;
         selected = true;
-        rendererIssue = new RendererIssue("");
+        rendererIssue = new RendererIssue(rendererRepository, "");
         property = new RendererNode(rendererIssue, "some value", 
rendererRepository).createProperty();
         setEntryValues(rendererRepository, rendererIssue, 
IssueCache.ISSUE_STATUS_NEW, false);
         result = QueryTableCellRenderer.getCellStyle(table, 
query.getQuery(), issueTable, property, selected, 0);
@@ -240,8 +240,8 @@
     @Test
     public void testGetDefaultCellStyle() {
         JTable table = new JTable();
-        RendererIssue issue = new RendererIssue("");
         RendererRepository rendererRepository = new RendererRepository();
+        RendererIssue issue = new RendererIssue(rendererRepository, "");
         RendererQuery query = new RendererQuery(rendererRepository);
         IssueProperty property = new RendererNode(issue, "some value", 
rendererRepository).createProperty();
 
@@ -371,9 +371,11 @@
     private static class RendererIssue extends TestIssue {
         private static int id = 0;
         private String recentChanges;
-        public RendererIssue(String recentChanges) {
+        private final RendererRepository repo;
+        public RendererIssue(RendererRepository repo, String recentChanges) {
             id++;
             this.recentChanges = recentChanges;
+            this.repo = repo;
         }
 
         @Override
@@ -459,6 +461,29 @@
         public String[] getSubtasks() {
             throw new UnsupportedOperationException("Not supported yet.");
         }        
+
+        @Override
+        public IssueStatusProvider.Status getStatus() {
+            int s = repo.cache.getStatus(getID());
+            switch(s) {
+                case IssueCache.ISSUE_STATUS_NEW:
+                    return IssueStatusProvider.Status.NEW;
+                case IssueCache.ISSUE_STATUS_MODIFIED:
+                    return IssueStatusProvider.Status.MODIFIED;
+                case IssueCache.ISSUE_STATUS_SEEN:
+                    return IssueStatusProvider.Status.SEEN;
+            }
+            return null;
+        }
+
+        @Override
+        public void setSeen(boolean seen) {
+            try {
+                repo.cache.setSeen(getID(), seen);
+            } catch (IOException ex) {
+                Exceptions.printStackTrace(ex);
+            }
+        }
     }
 
     private class RendererRepository extends TestRepository {
diff --git 
a/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/ui/issue/cache/CacheTest.java
 
b/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/ui/issue/cache/CacheTest.java
--- 
a/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/ui/issue/cache/CacheTest.java
+++ 
b/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/ui/issue/cache/CacheTest.java
@@ -422,6 +422,15 @@
             throw new UnsupportedOperationException("Not supported yet.");
         }
 
+        @Override
+        public IssueStatusProvider.Status getStatus() {
+            throw new UnsupportedOperationException("Not supported yet."); 
//To change body of generated methods, choose Tools | Templates.
+        }
+
+        @Override
+        public void setSeen(boolean seen) {
+            throw new UnsupportedOperationException("Not supported yet."); 
//To change body of generated methods, choose Tools | Templates.
+        }
     }
 
     private class CTestRepository extends TestRepository {
diff --git 
a/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/ui/issue/cache/StorageTest.java
 
b/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/ui/issue/cache/StorageTest.java
--- 
a/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/ui/issue/cache/StorageTest.java
+++ 
b/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/ui/issue/cache/StorageTest.java
@@ -346,6 +346,16 @@
         public String[] getSubtasks() {
             throw new UnsupportedOperationException("Not supported yet.");
         }
+
+        @Override
+        public IssueStatusProvider.Status getStatus() {
+            throw new UnsupportedOperationException("Not supported yet."); 
//To change body of generated methods, choose Tools | Templates.
+        }
+
+        @Override
+        public void setSeen(boolean seen) {
+            throw new UnsupportedOperationException("Not supported yet."); 
//To change body of generated methods, choose Tools | Templates.
+        }
     }
     
     private IssueCache<DummyIssue, Object> getCache() {
diff --git a/bugzilla/nbproject/project.xml b/bugzilla/nbproject/project.xml
--- a/bugzilla/nbproject/project.xml
+++ b/bugzilla/nbproject/project.xml
@@ -91,7 +91,7 @@
                     <build-prerequisite/>
                     <compile-dependency/>
                     <run-dependency>
-                        <specification-version>1.41</specification-version>
+                        <specification-version>1.44</specification-version>
                     </run-dependency>
                 </dependency>
                 <dependency>
diff --git 
a/bugzilla/src/org/netbeans/modules/bugzilla/BugzillaIssueProvider.java 
b/bugzilla/src/org/netbeans/modules/bugzilla/BugzillaIssueProvider.java
--- a/bugzilla/src/org/netbeans/modules/bugzilla/BugzillaIssueProvider.java
+++ b/bugzilla/src/org/netbeans/modules/bugzilla/BugzillaIssueProvider.java
@@ -39,18 +39,25 @@
 
 import java.beans.PropertyChangeListener;
 import java.io.File;
+import java.io.IOException;
 import java.util.List;
+import java.util.logging.Level;
 import org.netbeans.modules.bugtracking.kenai.spi.KenaiIssueProvider;
 import org.netbeans.modules.bugtracking.kenai.spi.OwnerInfo;
 import org.netbeans.modules.bugtracking.spi.BugtrackingController;
+import org.netbeans.modules.bugtracking.spi.IssueStatusProvider;
+import org.netbeans.modules.bugtracking.ui.issue.cache.IssueCache;
+import org.netbeans.modules.bugtracking.ui.issue.cache.IssueCacheUtils;
 import org.netbeans.modules.bugzilla.issue.BugzillaIssue;
 import org.netbeans.modules.bugzilla.repository.IssueField;
+import org.openide.util.Exceptions;
 
 /**
  *
  * @author Tomas Stupka
  */
 public class BugzillaIssueProvider extends KenaiIssueProvider<BugzillaIssue> 
{
+    private IssueStatusProvider<BugzillaIssue> statusProvider;
 
     @Override
     public String getDisplayName(BugzillaIssue data) {
@@ -118,6 +125,31 @@
         data.addPropertyChangeListener(listener);
     }
 
+    @Override
+    public synchronized IssueStatusProvider getStatusProvider() {
+        if(statusProvider == null) {
+            statusProvider = new IssueStatusProvider<BugzillaIssue>() {
+                @Override
+                public IssueStatusProvider.Status getStatus(BugzillaIssue 
issue) {
+                    return issue.getStatus();
+                }
+                @Override
+                public void setSeen(BugzillaIssue issue, boolean uptodate) {
+                    issue.setUpToDate(uptodate);
+                }
+                @Override
+                public void removePropertyChangeListener(BugzillaIssue 
issue, PropertyChangeListener listener) {
+                    issue.removePropertyChangeListener(listener);
+                }
+                @Override
+                public void addPropertyChangeListener(BugzillaIssue issue, 
PropertyChangeListener listener) {
+                    issue.addPropertyChangeListener(listener);
+                }
+            };
+        }
+        return statusProvider;
+    }
+    
     
/************************************************************************************
      * Kenai
      
************************************************************************************/
diff --git 
a/bugzilla/src/org/netbeans/modules/bugzilla/issue/BugzillaIssue.java 
b/bugzilla/src/org/netbeans/modules/bugzilla/issue/BugzillaIssue.java
--- a/bugzilla/src/org/netbeans/modules/bugzilla/issue/BugzillaIssue.java
+++ b/bugzilla/src/org/netbeans/modules/bugzilla/issue/BugzillaIssue.java
@@ -86,6 +86,7 @@
 import org.netbeans.modules.bugtracking.spi.IssueProvider;
 import org.netbeans.modules.bugtracking.issuetable.ColumnDescriptor;
 import org.netbeans.modules.bugtracking.kenai.spi.OwnerInfo;
+import org.netbeans.modules.bugtracking.spi.IssueStatusProvider;
 import org.netbeans.modules.bugtracking.ui.issue.cache.IssueCache;
 import org.netbeans.modules.bugtracking.util.BugtrackingUtil;
 import org.netbeans.modules.bugtracking.util.UIUtils;
@@ -197,6 +198,9 @@
         support.firePropertyChange(IssueProvider.EVENT_ISSUE_REFRESHED, 
null, null);
     }
 
+    private void fireSeenChanged(boolean wasSeen, boolean seen) {
+        support.firePropertyChange(IssueStatusProvider.EVENT_SEEN_CHANGED, 
wasSeen, seen);
+    }
     
     public boolean isNew() {
         return data == null || data.isNew();
@@ -1084,6 +1088,32 @@
         return "RESOLVED".equals(value);
     }
 
+    public IssueStatusProvider.Status getStatus() {
+        int status = getRepository().getIssueCache().getStatus(getID());
+        switch(status) {
+            case IssueCache.ISSUE_STATUS_NEW:
+                return IssueStatusProvider.Status.NEW;
+            case IssueCache.ISSUE_STATUS_MODIFIED:
+                return IssueStatusProvider.Status.MODIFIED;
+            case IssueCache.ISSUE_STATUS_SEEN:
+                return IssueStatusProvider.Status.SEEN;
+        }
+        return null;
+    }
+
+    public void setUpToDate(boolean seen) {
+        try {
+            final IssueCache<BugzillaIssue, TaskData> issueCache = 
getRepository().getIssueCache();
+            boolean wasSeen = issueCache.wasSeen(getID());
+            if(seen != wasSeen) {
+                issueCache.setSeen(getID(), seen);
+                fireSeenChanged(wasSeen, seen);
+            }
+        } catch (IOException ex) {
+            Bugzilla.LOG.log(Level.WARNING, null, ex);
+        }
+    }
+
     class Comment {
         private final Date when;
         private final String author;
diff --git a/bugzilla/src/org/netbeans/modules/bugzilla/issue/IssuePanel.java 
b/bugzilla/src/org/netbeans/modules/bugzilla/issue/IssuePanel.java
--- a/bugzilla/src/org/netbeans/modules/bugzilla/issue/IssuePanel.java
+++ b/bugzilla/src/org/netbeans/modules/bugzilla/issue/IssuePanel.java
@@ -124,6 +124,7 @@
 import org.netbeans.modules.bugtracking.ui.issue.cache.IssueCache;
 import org.netbeans.modules.bugtracking.util.BugtrackingUtil;
 import org.netbeans.modules.bugtracking.kenai.spi.KenaiUtil;
+import org.netbeans.modules.bugtracking.spi.IssueStatusProvider;
 import org.netbeans.modules.bugtracking.util.*;
 import org.netbeans.modules.bugzilla.Bugzilla;
 import org.netbeans.modules.bugzilla.BugzillaConfig;
@@ -277,7 +278,7 @@
             if(evt.getSource() != IssuePanel.this.issue) {
                 return;
             }
-            if 
(IssueCache.EVENT_ISSUE_SEEN_CHANGED.equals(evt.getPropertyName())) {
+            if 
(IssueStatusProvider.EVENT_SEEN_CHANGED.equals(evt.getPropertyName())) {
                 updateFieldStatuses();
             }
         }
@@ -290,9 +291,8 @@
     public void setIssue(BugzillaIssue issue) {
         assert SwingUtilities.isEventDispatchThread() : "Accessing Swing 
components. Do not call outside event-dispatch thread!"; // NOI18N
         if (this.issue == null) {
-            IssueCache<BugzillaIssue, TaskData> cache = 
issue.getRepository().getIssueCache();
-            cache.removePropertyChangeListener(issue, cacheListener);
-            cache.addPropertyChangeListener(issue, cacheListener);
+            issue.removePropertyChangeListener(cacheListener);
+            issue.addPropertyChangeListener(cacheListener);
 
             summaryField.getDocument().addDocumentListener(new 
DocumentListener() {
                 @Override
diff --git a/jira/nbproject/project.xml b/jira/nbproject/project.xml
--- a/jira/nbproject/project.xml
+++ b/jira/nbproject/project.xml
@@ -93,7 +93,7 @@
                     <build-prerequisite/>
                     <compile-dependency/>
                     <run-dependency>
-                        <specification-version>1.41</specification-version>
+                        <specification-version>1.44</specification-version>
                     </run-dependency>
                 </dependency>
                 <dependency>
diff --git a/jira/src/org/netbeans/modules/jira/JiraIssueProvider.java 
b/jira/src/org/netbeans/modules/jira/JiraIssueProvider.java
--- a/jira/src/org/netbeans/modules/jira/JiraIssueProvider.java
+++ b/jira/src/org/netbeans/modules/jira/JiraIssueProvider.java
@@ -42,6 +42,7 @@
 import java.util.List;
 import org.netbeans.modules.bugtracking.spi.BugtrackingController;
 import org.netbeans.modules.bugtracking.spi.IssueProvider;
+import org.netbeans.modules.bugtracking.spi.IssueStatusProvider;
 import org.netbeans.modules.jira.issue.NbJiraIssue;
 
 /**
@@ -49,6 +50,7 @@
  * @author Tomas Stupka
  */
 public class JiraIssueProvider extends IssueProvider<NbJiraIssue> {
+    private IssueStatusProvider<NbJiraIssue> statusProvider;
 
     @Override
     public String getDisplayName(NbJiraIssue data) {
@@ -116,4 +118,28 @@
         data.addPropertyChangeListener(listener);
     }
 
+    @Override
+    public synchronized IssueStatusProvider getStatusProvider() {
+        if(statusProvider == null) {
+            statusProvider = new IssueStatusProvider<NbJiraIssue>() {
+                @Override
+                public Status getStatus(NbJiraIssue issue) {
+                    return issue.getIssueStatus();
 }
+                @Override
+                public void setSeen(NbJiraIssue issue, boolean uptodate) {
+                    issue.setUpToDate(uptodate);
+                }
+                @Override
+                public void addPropertyChangeListener(NbJiraIssue issue, 
PropertyChangeListener listener) {
+                    issue.addPropertyChangeListener(listener);
+                }
+                @Override
+                public void removePropertyChangeListener(NbJiraIssue issue, 
PropertyChangeListener listener) {
+                    issue.removePropertyChangeListener(listener);
+                }
+            };
+        }
+        return statusProvider;
+    }
+}
diff --git a/jira/src/org/netbeans/modules/jira/issue/IssuePanel.java 
b/jira/src/org/netbeans/modules/jira/issue/IssuePanel.java
--- a/jira/src/org/netbeans/modules/jira/issue/IssuePanel.java
+++ b/jira/src/org/netbeans/modules/jira/issue/IssuePanel.java
@@ -130,6 +130,7 @@
 import org.netbeans.modules.bugtracking.ui.issue.cache.IssueCache;
 import org.netbeans.modules.bugtracking.util.BugtrackingUtil;
 import org.netbeans.modules.bugtracking.kenai.spi.KenaiUtil;
+import org.netbeans.modules.bugtracking.spi.IssueStatusProvider;
 import org.netbeans.modules.bugtracking.util.LinkButton;
 import org.netbeans.modules.bugtracking.util.RepositoryUserRenderer;
 import org.netbeans.modules.bugtracking.util.UIUtils;
@@ -1031,16 +1032,15 @@
             if (evt.getSource() != issue) {
                 return;
             }
-            if 
(IssueCache.EVENT_ISSUE_SEEN_CHANGED.equals(evt.getPropertyName())) {
+            if 
(IssueStatusProvider.EVENT_SEEN_CHANGED.equals(evt.getPropertyName())) {
                 updateFieldStatuses();
             }
         }
     };
 
     private void attachIssueListener(final NbJiraIssue issue) {
-        final IssueCache<NbJiraIssue, TaskData> cache = 
issue.getRepository().getIssueCache();
-        cache.removePropertyChangeListener(issue, cacheListener);
-        cache.addPropertyChangeListener(issue, cacheListener);
+        issue.removePropertyChangeListener(cacheListener);
+        issue.addPropertyChangeListener(cacheListener);
     }
 
     private static void fixPrefSize(JTextField textField) {
diff --git a/jira/src/org/netbeans/modules/jira/issue/NbJiraIssue.java 
b/jira/src/org/netbeans/modules/jira/issue/NbJiraIssue.java
--- a/jira/src/org/netbeans/modules/jira/issue/NbJiraIssue.java
+++ b/jira/src/org/netbeans/modules/jira/issue/NbJiraIssue.java
@@ -96,6 +96,7 @@
 import org.netbeans.modules.bugtracking.spi.IssueProvider;
 import org.netbeans.modules.bugtracking.spi.BugtrackingController;
 import org.netbeans.modules.bugtracking.issuetable.ColumnDescriptor;
+import org.netbeans.modules.bugtracking.spi.IssueStatusProvider;
 import org.netbeans.modules.bugtracking.ui.issue.cache.IssueCache;
 import org.netbeans.modules.bugtracking.util.TextUtils;
 import org.netbeans.modules.bugtracking.util.UIUtils;
@@ -249,6 +250,10 @@
         support.firePropertyChange(IssueProvider.EVENT_ISSUE_REFRESHED, 
null, null);
     }
     
+    private void fireSeenChanged(boolean wasSeen, boolean seen) {
+        support.firePropertyChange(IssueStatusProvider.EVENT_SEEN_CHANGED, 
wasSeen, seen);
+    }
+    
     void opened() {
         if(Jira.LOG.isLoggable(Level.FINE)) Jira.LOG.log(Level.FINE, "issue 
{0} open start", new Object[] {getID()});
         if(!taskData.isNew()) {
@@ -519,6 +524,32 @@
         return refresh(getID(), false);
     }
 
+    public IssueStatusProvider.Status getIssueStatus() {
+        int status = getRepository().getIssueCache().getStatus(getID());
+        switch(status) {
+            case IssueCache.ISSUE_STATUS_NEW:
+                return IssueStatusProvider.Status.NEW;
+            case IssueCache.ISSUE_STATUS_MODIFIED:
+                return IssueStatusProvider.Status.MODIFIED;
+            case IssueCache.ISSUE_STATUS_SEEN:
+                return IssueStatusProvider.Status.SEEN;
+        }
+        return null;
+    }
+
+    public void setUpToDate(boolean seen) {
+        try {
+            final IssueCache<NbJiraIssue, TaskData> issueCache = 
getRepository().getIssueCache();
+            boolean wasSeen = issueCache.wasSeen(getID());
+            if(seen != wasSeen) {
+                issueCache.setSeen(getID(), seen);
+                fireSeenChanged(wasSeen, seen);
+            }
+        } catch (IOException ex) {
+            Jira.LOG.log(Level.WARNING, null, ex);
+        }
+    }    
+    
     /**
      * Reloads the task data and refreshes the issue cache
      * @param key key of the issue
diff --git a/tasks.ui/nbproject/project.xml b/tasks.ui/nbproject/project.xml
--- a/tasks.ui/nbproject/project.xml
+++ b/tasks.ui/nbproject/project.xml
@@ -37,7 +37,7 @@
                     <build-prerequisite/>
                     <compile-dependency/>
                     <run-dependency>
-                        <specification-version>1.43</specification-version>
+                        <specification-version>1.44</specification-version>
                     </run-dependency>
                 </dependency>
                 <dependency>
diff --git 
a/tasks.ui/src/org/netbeans/modules/tasks/ui/dashboard/TaskContainerNode.java 
b/tasks.ui/src/org/netbeans/modules/tasks/ui/dashboard/TaskContainerNode.java
--- 
a/tasks.ui/src/org/netbeans/modules/tasks/ui/dashboard/TaskContainerNode.java
+++ 
b/tasks.ui/src/org/netbeans/modules/tasks/ui/dashboard/TaskContainerNode.java
@@ -189,7 +189,7 @@
         synchronized (LOCK) {
             int count = 0;
             for (TaskNode taskNode : filteredTaskNodes) {
-                if (taskNode.getTask().getStatus() != Issue.Status.UPTODATE) 
{
+                if (taskNode.getTask().getStatus() != Issue.Status.SEEN) {
                     count++;
                 }
             }

[hg] main-silver: make status values (new, modified, seen) optio...

Tomas Stupka 03/06/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