Login | Register
My pages Projects Community openCollabNet

Discussions > cvs > subclipse commit: r806 - branches/subclipse-3/ui/src/org/tigris/subversion/subclipse/ui/history

subclipse
Discussion topic

Back to topic list

subclipse commit: r806 - branches/subclipse-3/ui/src/org/tigris/subversion/subclipse/ui/history

Author pkorros
Full name Panagiotis Korros
Date 2004-08-03 08:23:43 PDT
Message Author: pkorros
Date: Tue Aug 3 10:23:43 2004
New Revision: 806

Modified:
   branches/subclipse-3​/ui/src/org/tigris/s​ubversion/subclipse/​ui/history/HistoryVi​ew.java
Log:
The HistoryView now listens for Resource state changes and updates the ui accordingly

Modified: branches/subclipse-3​/ui/src/org/tigris/s​ubversion/subclipse/​ui/history/HistoryVi​ew.java
Url: http://svn.collab.ne​t/viewcvs/subclipse/​branches/subclipse-3​/ui/src/org/tigris/s​ubversion/subclipse/​ui/history/HistoryVi​ew.java?view=diff​&rev=806&p1=bra​nches/subclipse-3/ui​/src/org/tigris/subv​ersion/subclipse/ui/​history/HistoryView.​java&r1=805&​p2=branches/subclips​e-3/ui/src/org/tigri​s/subversion/subclip​se/ui/history/Histor​yView.java&r2=80​6
====================​====================​====================​==================
--- branches/subclipse-3​/ui/src/org/tigris/s​ubversion/subclipse/​ui/history/HistoryVi​ew.java (original)
+++ branches/subclipse-3​/ui/src/org/tigris/s​ubversion/subclipse/​ui/history/HistoryVi​ew.java Tue Aug 3 10:23:43 2004
@@ -16,6 +16,7 @@
 import java.lang.reflect.In​vocationTargetExcept​ion;
 
 import org.eclipse.core.res​ources.IFile;
+import org.eclipse.core.res​ources.IProject;
 import org.eclipse.core.res​ources.IResource;
 import org.eclipse.core.res​ources.IWorkspaceRun​nable;
 import org.eclipse.core.run​time.CoreException;
@@ -75,6 +76,7 @@
 import org.eclipse.ui.part.​ResourceTransfer;
 import org.eclipse.ui.part.ViewPart;
 import org.eclipse.ui.texte​ditor.ITextEditorAct​ionConstants;
+import org.tigris.subversio​n.subclipse.core.IRe​sourceStateChangeLis​tener;
 import org.tigris.subversio​n.subclipse.core.ISV​NLocalFile;
 import org.tigris.subversio​n.subclipse.core.ISV​NLocalResource;
 import org.tigris.subversio​n.subclipse.core.ISV​NRemoteFile;
@@ -101,7 +103,7 @@
  * - showHistory(IResource resource, boolean refetch) or
  * - showHistory(ISVNRemoteFile remoteFile, boolean refetch)
  */
-public class HistoryView extends ViewPart {
+public class HistoryView extends ViewPart implements IResourceStateChangeListener {
     // the resource for which we want to see the history or null if we use showHistory(ISVNRemoteResource)
     private IResource resource;
 
@@ -134,6 +136,10 @@
 
     public static final String VIEW_ID = "org.tigris.subversi​on.subclipse.ui.hist​ory.HistoryView"; //$NON-NLS-1$
 
+ public HistoryView() {
+ SVNProviderPlugin.ad​dResourceStateChange​Listener(this);
+ }
+
     private IPartListener partListener = new IPartListener() {
         public void partActivated(IWorkbenchPart part) {
             if (part instanceof IEditorPart)
@@ -404,6 +410,7 @@
         shutdown = true;
         getSite().getPage().​removePartListener(p​artListener);
         getSite().getPage().​removePartListener(p​artListener2);
+ SVNProviderPlugin.re​moveResourceStateCha​ngeListener(this);
     }
 
     /**
@@ -759,6 +766,28 @@
         }
     }
 
+ /**
+ * This method updates the history table, highlighting the current revison
+ * without refetching the log entries to preserve bandwidth.
+ * The user has to a manual refresh to get the new log entries.
+ */
+ private void resourceChanged() {
+ getSite().getShell()​.getDisplay().asyncE​xec(new Runnable() {
+ public void run() {
+ ISVNLocalResource localResource = SVNWorkspaceRoot.get​SVNResourceFor(resou​rce);
+ try {
+ if (localResource != null && !localResource.getSt​atus().isAdded()) {
+ ISVNRemoteResource baseResource = localResource.getBas​eResource();
+ historyTableProvider​.setRemoteResource(b​aseResource);
+ tableViewer.refresh();
+ }
+ } catch (SVNException e) {
+ SVNUIPlugin.openErro​r(getViewSite().getS​hell(), null, null, e);
+ }
+ }
+ });
+ }
+
     private class FetchLogEntriesJob extends Job {
         public ISVNRemoteResource remoteResource;
         public FetchLogEntriesJob() {
@@ -786,6 +815,36 @@
                 return e.getStatus();
             }
         }
- };
+ }
+
+ /* (non-Javadoc)
+ * @see org.tigris.subversio​n.subclipse.core.IRe​sourceStateChangeLis​tener#resourceSyncIn​foChanged(org.eclips​e.core.resources.IRe​source[])
+ */
+ public void resourceSyncInfoChan​ged(IResource[] changedResources) {
+ for (int i = 0; i < changedResources.length; i++) {
+ IResource changedResource = changedResources[i];
+ if( resource.equals( changedResource ) ) {
+ resourceChanged();
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.tigris.subversio​n.subclipse.core.IRe​sourceStateChangeLis​tener#resourceModifi​ed(org.eclipse.core.​resources.IResource[​])
+ */
+ public void resourceModified(IResource[] changedResources) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.tigris.subversio​n.subclipse.core.IRe​sourceStateChangeLis​tener#projectConfigu​red(org.eclipse.core​.resources.IProject)​
+ */
+ public void projectConfigured(IProject project) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.tigris.subversio​n.subclipse.core.IRe​sourceStateChangeLis​tener#projectDeconfi​gured(org.eclipse.co​re.resources.IProjec​t)
+ */
+ public void projectDeconfigured(IProject project) {
+ };
     
 }

--------------------​--------------------​--------------------​---------
To unsubscribe, e-mail: cvs-unsubscribe@subc​lipse.tigris.org
For additional commands, e-mail: cvs-help at subclipse dot tigris dot org

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

subclipse commit: r806 - branches/subclipse-3/ui/src/org/tigris/subversion/subclipse/ui/history pkorros Panagiotis Korros 2004-08-03 08:23:43 PDT
Messages per page: