Buix-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
April 2008
- 1 participants
- 373 discussions
r523 - in trunk/lutinvcs/core/src/main/java/org/codelutin/vcs: . event runner util
by tchemit@users.labs.libre-entreprise.org 15 Apr '08
by tchemit@users.labs.libre-entreprise.org 15 Apr '08
15 Apr '08
Author: tchemit
Date: 2008-04-15 08:48:00 +0000 (Tue, 15 Apr 2008)
New Revision: 523
Added:
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/event/VCSActionThreadEvent.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/event/VCSActionThreadEventListener.java
Removed:
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/event/VCSEntryStateChangedEvent.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/event/VCSEntryStateChangedEventListener.java
Modified:
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSConnexionConfig.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSEntries.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSEntry.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/runner/VCSActionManager.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/runner/VCSActionThread.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/VCSConnexionConfigImpl.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/VCSEntriesImpl.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/VCSEntryImpl.java
Log:
mise en place listener sur action du thread (et non plus sur chaque entr?\195?\169e ?\195?\160 traiter).
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSConnexionConfig.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSConnexionConfig.java 2008-04-15 08:47:01 UTC (rev 522)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSConnexionConfig.java 2008-04-15 08:48:00 UTC (rev 523)
@@ -18,6 +18,7 @@
* ##% */
package org.codelutin.vcs;
+import org.codelutin.vcs.type.VCSConnexionMode;
import org.codelutin.vcs.type.VCSTypeRepo;
import java.io.File;
@@ -34,6 +35,8 @@
/** @return the type of vcs used */
String getType();
+ VCSConnexionMode getMode();
+
/** @return <code>true</code> if ssh connexion is used */
boolean isUseSshConnexion();
@@ -87,4 +90,6 @@
void setUserName(String userName);
void setUseSshConnexion(boolean newValue);
+
+ void setConnexionMode(VCSConnexionMode mode);
}
\ No newline at end of file
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSEntries.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSEntries.java 2008-04-15 08:47:01 UTC (rev 522)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSEntries.java 2008-04-15 08:48:00 UTC (rev 523)
@@ -75,10 +75,21 @@
* @param timestamp global timestamp to apply
* @param entries entries to refresh
* @throws IllegalStateException if entry was never populated
+ * @throws VCSException if vcs io pb
*/
- void refresh(long timestamp, List<VCSEntry> entries) throws IllegalStateException;
+ void refresh(long timestamp, List<VCSEntry> entries) throws IllegalStateException, VCSException;
/**
+ * refresh state of the entry.
+ *
+ * @param timestamp global timestamp to apply
+ * @param entries entries to refresh
+ * @throws IllegalStateException if entry was never populated
+ * @throws VCSException if vcs io pb
+ */
+ void refresh(long timestamp, VCSEntry entries) throws IllegalStateException, VCSException;
+
+ /**
* //TODO update javadoc, use efficient algo
* obtain the array of all {@link VCSAction} found in the given entries
*
@@ -141,4 +152,9 @@
* @return list of all entries for a given connexion
*/
List<VCSEntry> filter(VCSAction action, List<VCSEntry> entries);
+
+ void addEntry(VCSEntry entry);
+
+ void removeEntry(VCSEntry entry);
+
}
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSEntry.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSEntry.java 2008-04-15 08:47:01 UTC (rev 522)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSEntry.java 2008-04-15 08:48:00 UTC (rev 523)
@@ -14,7 +14,6 @@
*/
package org.codelutin.vcs;
-import org.codelutin.vcs.event.VCSEntryStateChangedEventListener;
import org.codelutin.vcs.type.VCSEntryLocation;
import org.codelutin.vcs.type.VCSState;
@@ -59,7 +58,7 @@
*
* @throws VCSException if any pb with vcs io
* @throws IllegalStateException if entry was never populated
- * @throws IOException if io pb
+ * @throws IOException if io pb
*/
void populateDiff() throws IllegalStateException, VCSException, IOException;
@@ -139,15 +138,15 @@
/**
* @return the changelog of entry from local against remote (compute it if necessary)
* @throws IllegalStateException if entry was never populated
- * @throws VCSException if vcs io pb while computing changelog
+ * @throws VCSException if vcs io pb while computing changelog
*/
BufferedReader getChangeLog() throws IllegalStateException, VCSException;
/**
* @return the diff of entry from local against remote (compute it if necessary)
* @throws IllegalStateException if entry was never populated
- * @throws VCSException if vcs io pb while computing diff
- * @throws IOException if io pb while computing diff
+ * @throws VCSException if vcs io pb while computing diff
+ * @throws IOException if io pb while computing diff
*/
BufferedReader getDiff() throws IllegalStateException, IOException, VCSException;
@@ -163,10 +162,4 @@
*/
BufferedReader getRemoteContent() throws IllegalStateException;
- /** @param l the listener to add */
- void addVCSEntryStateChangedEventListener(VCSEntryStateChangedEventListener l);
-
- /** @param l the listener to remove */
- void removeVCSEntryStateChangedEventListener(VCSEntryStateChangedEventListener l);
-
}
\ No newline at end of file
Copied: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/event/VCSActionThreadEvent.java (from rev 511, trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/event/VCSEntryStateChangedEvent.java)
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/event/VCSActionThreadEvent.java (rev 0)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/event/VCSActionThreadEvent.java 2008-04-15 08:48:00 UTC (rev 523)
@@ -0,0 +1,58 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package org.codelutin.vcs.event;
+
+import org.codelutin.vcs.VCSEntry;
+import org.codelutin.vcs.type.VCSAction;
+
+import java.util.EventObject;
+
+/**
+ * Events to be used by {@link org.codelutin.vcs.runner.VCSActionThread}
+ *
+ * @author chemit
+ */
+public class VCSActionThreadEvent extends EventObject {
+
+ private static final long serialVersionUID = 1L;
+
+ protected VCSAction action;
+
+ /**
+ * Constructs a prototypical Event.
+ *
+ * @param source The object on which the Event initially occurred.
+ * @param action action to be performed
+ * @throws IllegalArgumentException if source is null.
+ */
+ public VCSActionThreadEvent(VCSEntry[] source, VCSAction action) {
+ super(source);
+ this.action = action;
+ }
+
+ @Override
+ public VCSEntry[] getSource() {
+ return (VCSEntry[]) super.getSource();
+ }
+
+ public VCSAction getAction() {
+ return action;
+ }
+
+ @Override
+ public String toString() {
+ return super.toString() + " " + action + " , " + (getSource() == null ? 0 : getSource().length);
+ }
+}
\ No newline at end of file
Copied: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/event/VCSActionThreadEventListener.java (from rev 511, trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/event/VCSConnexionEventListener.java)
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/event/VCSActionThreadEventListener.java (rev 0)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/event/VCSActionThreadEventListener.java 2008-04-15 08:48:00 UTC (rev 523)
@@ -0,0 +1,39 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package org.codelutin.vcs.event;
+
+/**
+ * A listener on {@link org.codelutin.vcs.runner.VCSActionThread} life cycle.
+ *
+ * @author chemit
+ */
+public interface VCSActionThreadEventListener extends java.util.EventListener {
+
+ /**
+ * call when one action start on thread
+ *
+ * @param event current event
+ */
+ public void onActionStarted(VCSActionThreadEvent event);
+
+ /**
+ * call when one action is done by thread
+ *
+ * @param event current event
+ */
+ public void onActionDone(VCSActionThreadEvent event);
+
+
+}
\ No newline at end of file
Deleted: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/event/VCSEntryStateChangedEvent.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/event/VCSEntryStateChangedEvent.java 2008-04-15 08:47:01 UTC (rev 522)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/event/VCSEntryStateChangedEvent.java 2008-04-15 08:48:00 UTC (rev 523)
@@ -1,60 +0,0 @@
-/**
- * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
- * This program is free software; you
- * can redistribute it and/or modify it under the terms of the GNU General
- * Public License as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. This program is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
- * should have received a copy of the GNU General Public License along with this
- * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
- * - Suite 330, Boston, MA 02111-1307, USA.
- * ##%
- */
-package org.codelutin.vcs.event;
-
-import org.codelutin.vcs.VCSEntry;
-import org.codelutin.vcs.type.VCSState;
-
-import java.util.EventObject;
-
-/**
- * Events to be used when the state of a {@link org.codelutin.vcs.VCSEntry} has changed.
- *
- * @author chemit
- */
-public class VCSEntryStateChangedEvent extends EventObject {
-
- private static final long serialVersionUID = 1L;
-
- protected VCSState oldState;
- protected VCSState newState;
-
- /**
- * Constructs a prototypical Event.
- *
- * @param source The object on which the Event initially occurred.
- * @param oldState old state of the entry
- * @param newState new state of event
- * @throws IllegalArgumentException if source is null.
- */
- public VCSEntryStateChangedEvent(VCSEntry source, VCSState oldState, VCSState newState) {
- super(source);
- this.oldState = oldState;
- this.newState = newState;
- }
-
- @Override
- public VCSEntry getSource() {
- return (VCSEntry) super.getSource();
- }
-
- public VCSState getOldState() {
- return oldState;
- }
-
- public VCSState getNewState() {
- return newState;
- }
-}
\ No newline at end of file
Deleted: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/event/VCSEntryStateChangedEventListener.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/event/VCSEntryStateChangedEventListener.java 2008-04-15 08:47:01 UTC (rev 522)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/event/VCSEntryStateChangedEventListener.java 2008-04-15 08:48:00 UTC (rev 523)
@@ -1,77 +0,0 @@
-/**
- * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
- * This program is free software; you
- * can redistribute it and/or modify it under the terms of the GNU General
- * Public License as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. This program is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
- * should have received a copy of the GNU General Public License along with this
- * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
- * - Suite 330, Boston, MA 02111-1307, USA.
- * ##%
- */
-package org.codelutin.vcs.event;
-
-import org.codelutin.vcs.type.VCSState;
-
-/**
- * A listener on state of a {@link org.codelutin.vcs.VCSEntry}.
- * <p/>
- * This listener reacts on every change of state of a {@link org.codelutin.vcs.VCSEntry}, locally and remotely.
- * <p/>
- * This listener can be used on UIs to update the render of an entry from his state.
- *
- * @author chemit
- */
-public interface VCSEntryStateChangedEventListener extends java.util.EventListener {
-
- /**
- * call when entry's state becomes {@link VCSState#UNVERSIONNED} :
- * <p/>
- * entry was added on local repository, or removed from remote repository.
- *
- * @param event current event
- */
- public void onAdded(VCSEntryStateChangedEvent event);
-
- /**
- * call when entry's state becomes {@link VCSState#MODIFIED} :
- * <p/>
- * entry was localy modified.
- *
- * @param event current event
- */
- public void onModified(VCSEntryStateChangedEvent event);
-
- /**
- * call when entry's state becomes {@link VCSState#OUT_OF_DATE_AND_MODIFIED} or {@link VCSState#OUT_OF_DATE} :
- * <p/>
- * entry is obsolete on local.
- * <p/>
- * Note: <b>if entry was locally modified, and just has a new version of remote, this method will also be invoked.</b>
- *
- * @param event current event
- */
- public void onObsoleted(VCSEntryStateChangedEvent event);
-
- /**
- * call when entry's state becomes {@link VCSState#MISSING} :
- * <p/>
- * entry was remotely deleted.
- *
- * @param event current event
- */
- public void onDeleted(VCSEntryStateChangedEvent event);
-
- /**
- * call when entry's state becomes {@link VCSState#UP_TO_DATE} :
- * <p/>
- * entry was just updated, or rollbacked, or checkouted...
- *
- * @param event current event
- */
- public void onUpdated(VCSEntryStateChangedEvent event);
-
-}
\ No newline at end of file
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/runner/VCSActionManager.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/runner/VCSActionManager.java 2008-04-15 08:47:01 UTC (rev 522)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/runner/VCSActionManager.java 2008-04-15 08:48:00 UTC (rev 523)
@@ -16,6 +16,7 @@
import org.codelutin.vcs.VCSConnexion;
import org.codelutin.vcs.VCSEntry;
+import org.codelutin.vcs.event.VCSActionThreadEventListener;
import org.codelutin.vcs.type.VCSAction;
import java.util.concurrent.PriorityBlockingQueue;
@@ -52,10 +53,7 @@
}
public void open() {
- if (thread != null) {
- // thread is already opend
- throw new IllegalStateException("thread is already opened");
- }
+ checkThreadNotInit();
(thread = new VCSActionThread(queue)).start();
}
@@ -73,4 +71,30 @@
}
}
+ public void addVCSActionThreadEventListener(VCSActionThreadEventListener l) {
+ checkThreadInit();
+ thread.addVCSActionThreadEventListener(l);
+ }
+
+ public void removeVCSActionThreadEventListener(VCSActionThreadEventListener l) {
+ if (thread!=null) {
+ thread.removeVCSActionThreadEventListener(l);
+ }
+ }
+
+ protected void checkThreadInit() throws IllegalStateException {
+ if (thread == null) {
+ // thread is already opend
+ throw new IllegalStateException("thread is not opened");
+ }
+ }
+
+ protected void checkThreadNotInit() throws IllegalStateException {
+ if (thread != null) {
+ // thread is already opend
+ throw new IllegalStateException("thread is already opened");
+ }
+ }
+
+
}
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/runner/VCSActionThread.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/runner/VCSActionThread.java 2008-04-15 08:47:01 UTC (rev 522)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/runner/VCSActionThread.java 2008-04-15 08:48:00 UTC (rev 523)
@@ -17,18 +17,21 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import static org.codelutin.i18n.I18n._;
+import org.codelutin.util.ListenerSet;
import org.codelutin.vcs.VCSConnexion;
import org.codelutin.vcs.VCSEntry;
import org.codelutin.vcs.VCSException;
+import org.codelutin.vcs.event.VCSActionThreadEvent;
+import org.codelutin.vcs.event.VCSActionThreadEventListener;
import org.codelutin.vcs.type.VCSAction;
import org.codelutin.vcs.type.VCSState;
-import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
+import java.util.EnumMap;
import java.util.List;
import java.util.Map.Entry;
import java.util.concurrent.BlockingQueue;
@@ -36,9 +39,6 @@
/** @author chemit */
public class VCSActionThread extends Thread {
- /** to notify when thread is busy or not */
- static public final String BUSY_STATE_PROPERTY_CHANGED = "thread.busy";
-
/** to use log facility, just put in your code: log.info(\"...\"); */
static private Log log = LogFactory.getLog(VCSActionThread.class);
@@ -48,6 +48,8 @@
/** support for change properties support */
protected PropertyChangeSupport changeSupport;
+ protected transient ListenerSet<VCSActionThreadEventListener> listeners = new ListenerSet<VCSActionThreadEventListener>();
+
public VCSActionThread(BlockingQueue<VCSActionQueueItem> queue) {
super("VCSActionThread");
this.queue = queue;
@@ -63,7 +65,7 @@
log.info("waiting for action...");
item = queue.take();
// acquire a first item, thread becomes busy TODO should synchronize thread
- firePropertyChange(BUSY_STATE_PROPERTY_CHANGED, false, true);
+ fireStateBusy(false, true);
do {
if (item.getAction() == null) {
// this is a special case to stop thread
@@ -75,7 +77,7 @@
item = !queue.isEmpty() ? queue.take() : null;
} while (run && item != null);
// queue is empty, thread is no more busy
- firePropertyChange(BUSY_STATE_PROPERTY_CHANGED, true, false);
+ fireStateBusy(true, false);
}
}
catch (Throwable eee) {
@@ -85,7 +87,7 @@
}
} finally {
// notify queue is dead
- firePropertyChange(BUSY_STATE_PROPERTY_CHANGED, null, false);
+ fireStateBusy(null, false);
log.info("Stop " + getName() + " at " + new Date());
}
}
@@ -94,8 +96,12 @@
for (Entry<VCSConnexion, VCSEntry[]> entry : item.getEntriesByConnexion().entrySet()) {
VCSConnexion connexion = entry.getKey();
if (connexion.isOpen()) {
- // only works on opened connexion
+ // after each 'atomic operation', notify listener operation is done
+ fireAction("onActionStarted", item.getAction(), entry);
+ // only works on opened connexion
doAction0(item.getAction(), connexion, entry.getValue(), item.getMessage());
+ // after each 'atomic operation', notify listener operation is done
+ fireAction("onActionDone", item.getAction(), entry);
}
}
}
@@ -118,14 +124,15 @@
for (VCSEntry entry : entries) {
connexion.checkoutFile(entry.getFile().getParentFile(), entry.getFile().getName());
}
- //updateState(VCSState.UP_TO_DATE, entries);
+ updateState(VCSState.UP_TO_DATE, entries);
break;
case COMMIT:
- //updateState(VCSState.UP_TO_DATE, entries);
+ connexion.commit(files, message);
+ updateState(VCSState.UP_TO_DATE, entries);
break;
case DELETE:
-
- //updateState(VCSState.UP_TO_DATE, entries);
+ connexion.delete(files, message);
+ updateState(VCSState.UP_TO_DATE, entries);
break;
case DIFF:
for (VCSEntry entry : entries) {
@@ -133,84 +140,85 @@
}
break;
case OVERWRITE_AND_UPDATE:
-
- //updateState(VCSState.UP_TO_DATE, entries);
+ connexion.revert(files);
+ for (File file : files) {
+ connexion.update(file);
+ }
+ updateState(VCSState.UP_TO_DATE, entries);
break;
case REFRESH:
break;
case REVERT:
- //updateState(VCSState.UP_TO_DATE, entries);
+ connexion.revert(files);
+ updateState(VCSState.UP_TO_DATE, getRevertMapper(), entries);
break;
case UPDATE:
-
- //updateState(VCSState.UP_TO_DATE, entries);
+ for (File file : files) {
+ connexion.update(file);
+ }
+ updateState(VCSState.UP_TO_DATE, entries);
break;
}
}
- protected void updateState(VCSState state, VCSEntry[] entries) {
- for (VCSEntry entry : entries) {
- entry.setState(state);
+ protected EnumMap<VCSState, VCSState> revertMapper;
+
+ protected EnumMap<VCSState, VCSState> getRevertMapper() {
+ if (revertMapper == null) {
+ revertMapper = new EnumMap<VCSState, VCSState>(VCSState.class);
+ revertMapper.put(VCSState.OUT_OF_DATE_AND_MODIFIED, VCSState.OUT_OF_DATE);
}
+ return revertMapper;
}
- protected List<File> getFiles(VCSEntry[] entries) {
- List<File> result = new ArrayList<File>();
- for (VCSEntry entry : entries) {
- result.add(entry.getFile());
+ protected void fireAction(String actionName, VCSAction action, Entry<VCSConnexion, VCSEntry[]> entry) {
+ VCSActionThreadEvent event = new VCSActionThreadEvent(entry.getValue(), action);
+ try {
+ listeners.fire(actionName, event);
+ } catch (Exception e) {
+ log.error(e);
}
- return result;
}
- public synchronized void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
- if (listener == null) {
- return;
- }
- if (changeSupport == null) {
- changeSupport = new PropertyChangeSupport(this);
- }
- changeSupport.addPropertyChangeListener(propertyName, listener);
+ protected void fireStateBusy(Boolean oldState, Boolean newState) {
+ log.info("old state : " + oldState + ", new state : " + newState);
}
- public synchronized void addPropertyChangeListener(PropertyChangeListener listener) {
- if (listener == null) {
- return;
+ protected void updateState(VCSState state, VCSEntry[] entries) {
+ for (VCSEntry entry : entries) {
+ entry.setState(state);
}
- if (changeSupport == null) {
- changeSupport = new PropertyChangeSupport(this);
- }
- changeSupport.addPropertyChangeListener(listener);
}
- public synchronized void removePropertyChangeListener(PropertyChangeListener listener) {
- if (listener == null || changeSupport == null) {
- return;
+ protected void updateState(VCSState state, EnumMap<VCSState, VCSState> mapper, VCSEntry[] entries) {
+
+ for (VCSEntry entry : entries) {
+ if (mapper.containsKey(entry.getState())) {
+ entry.setState(mapper.get(entry.getState()));
+ } else {
+ entry.setState(state);
+ }
}
- changeSupport.removePropertyChangeListener(listener);
}
- public synchronized void removePropertyChangeListeners() {
- if (changeSupport == null) {
- return;
+ protected List<File> getFiles(VCSEntry[] entries) {
+ List<File> result = new ArrayList<File>();
+ for (VCSEntry entry : entries) {
+ result.add(entry.getFile());
}
- for (PropertyChangeListener listener : getPropertyChangeListeners()) {
- changeSupport.removePropertyChangeListener(listener);
- }
+ return result;
}
- public synchronized PropertyChangeListener[] getPropertyChangeListeners() {
- if (changeSupport == null) {
- return new PropertyChangeListener[0];
- }
- return changeSupport.getPropertyChangeListeners();
+ /** @param l the listener to add */
+ public void addVCSActionThreadEventListener(VCSActionThreadEventListener l) {
+ listeners.add(l);
+ log.info("added listener on thread : " + listeners.size() + " : " + l);
}
- public void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
- if (changeSupport == null || (oldValue == null && newValue == null) ||
- (oldValue != null && oldValue.equals(newValue))) {
- return;
- }
- changeSupport.firePropertyChange(propertyName, oldValue, newValue);
+ /** @param l the listener to remove */
+ public void removeVCSActionThreadEventListener(VCSActionThreadEventListener l) {
+ listeners.remove(l);
+ log.info("removed listener on thread : " + listeners.size() + " : " + l);
}
}
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/VCSConnexionConfigImpl.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/VCSConnexionConfigImpl.java 2008-04-15 08:47:01 UTC (rev 522)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/VCSConnexionConfigImpl.java 2008-04-15 08:48:00 UTC (rev 523)
@@ -16,6 +16,7 @@
import org.codelutin.vcs.VCSConnexionConfig;
import org.codelutin.vcs.type.VCSTypeRepo;
+import org.codelutin.vcs.type.VCSConnexionMode;
import java.io.File;
@@ -33,6 +34,7 @@
protected String remoteDatabase;
protected VCSTypeRepo typeRepo;
protected File localDatabasePath;
+ protected VCSConnexionMode mode;
public String getType() {
return type;
@@ -54,11 +56,18 @@
return userName;
}
+ public VCSConnexionMode getMode() {
+ return mode;
+ }
+
public boolean isNoPassPhrase() {
return noPassPhrase;
}
public String getPassphrase() {
+ if (passPhrase==null) {
+ passPhrase="";
+ }
return passPhrase;
}
@@ -125,4 +134,8 @@
public void setUseSshConnexion(boolean useSshConnexion) {
this.useSshConnexion = useSshConnexion;
}
+
+ public void setConnexionMode(VCSConnexionMode mode) {
+ this.mode=mode;
+ }
}
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/VCSEntriesImpl.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/VCSEntriesImpl.java 2008-04-15 08:47:01 UTC (rev 522)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/VCSEntriesImpl.java 2008-04-15 08:48:00 UTC (rev 523)
@@ -24,7 +24,6 @@
import java.io.File;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.EnumMap;
import java.util.EnumSet;
import java.util.List;
@@ -74,7 +73,7 @@
for (String relativeLocalPath : relativeLocalPaths) {
VCSEntry entry = new VCSEntryImpl(connexion, relativeLocalPath);
entry.populateState(timestamp);
- entries.add(entry);
+ addEntry(entry);
}
}
@@ -82,13 +81,31 @@
if (this.entries == null) {
this.entries = new ArrayList<VCSEntry>();
}
- this.entries.addAll(Arrays.asList(entries));
+ for (VCSEntry entry : entries) {
+ addEntry(entry);
+ }
}
- public void refresh(long timestamp, List<VCSEntry> entries) throws IllegalStateException {
+ public void refresh(long timestamp, List<VCSEntry> entries) throws IllegalStateException, VCSException {
checkPopulated();
+ for (VCSEntry entry : entries) {
+ entry.populateState(timestamp);
+ /*if (entry.getState() == VCSState.UP_TO_DATE) {
+ removeEntry(entry);
+ }
+ it.remove();*/
+ }
}
+ public void refresh(long timestamp, VCSEntry entry) throws IllegalStateException, VCSException {
+ checkPopulated();
+ entry.populateState(timestamp);
+ /*if (entry.getState() == VCSState.UP_TO_DATE) {
+ System.out.println("refresh: remove up to date entry " + entry);
+ this.entries.remove(entry);
+ }*/
+ }
+
public List<VCSEntry> getEntries() throws IllegalStateException {
checkPopulated();
// always return a copy of the list, to be safe...
@@ -146,7 +163,6 @@
}
}
-
public EnumMap<VCSAction, Integer> countActions(List<VCSEntry> entries) {
EnumSet<VCSAction> set = EnumSet.allOf(VCSAction.class);
EnumMap<VCSAction, Integer> map = new EnumMap<VCSAction, Integer>(VCSAction.class);
@@ -163,18 +179,9 @@
map.put(vcsAction, tmp[index]);
}
return map;
- /*List<VCSAction> result = new ArrayList<VCSAction>();
- for (VCSState vcsFileState : getStates(entries)) {
- List<VCSAction> action = vcsFileState.getActions();
- for (VCSAction vcsAction : action) {
- if (vcsAction != null && !result.contains(vcsAction)) {
- result.add(vcsAction);
- }
- }
- }
- return result.toArray(new VCSAction[result.size()]);*/
}
+
public EnumMap<VCSState, Integer> countStates(List<VCSEntry> entries) {
EnumSet<VCSState> set = EnumSet.allOf(VCSState.class);
EnumMap<VCSState, Integer> map = new EnumMap<VCSState, Integer>(VCSState.class);
@@ -190,18 +197,16 @@
map.put(state, tmp[index]);
}
return map;
- /*
- List<VCSState> result = new ArrayList<VCSState>();
- for (VCSEntry entry : entries) {
- VCSState state = entry.getState();
- if (state != null && !result.contains(state)) {
- result.add(state);
- }
- }
- return result.toArray(new VCSState[result.size()]);
- */
}
+ public void addEntry(VCSEntry entry) {
+ entries.add(entry);
+ }
+
+ public void removeEntry(VCSEntry entry) {
+ entries.remove(entry);
+ }
+
protected List<String> transformToLocal(List<String> relativeRemotePath) {
List<String> result = new ArrayList<String>(relativeRemotePath.size());
for (String s : relativeRemotePath) {
@@ -215,4 +220,5 @@
throw new IllegalStateException(this + " was not populated...");
}
}
+
}
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/VCSEntryImpl.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/VCSEntryImpl.java 2008-04-15 08:47:01 UTC (rev 522)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/VCSEntryImpl.java 2008-04-15 08:48:00 UTC (rev 523)
@@ -14,12 +14,9 @@
*/
package org.codelutin.vcs.util;
-import org.codelutin.util.ListenerSet;
import org.codelutin.vcs.VCSConnexion;
import org.codelutin.vcs.VCSEntry;
import org.codelutin.vcs.VCSException;
-import org.codelutin.vcs.event.VCSEntryStateChangedEvent;
-import org.codelutin.vcs.event.VCSEntryStateChangedEventListener;
import org.codelutin.vcs.type.VCSEntryLocation;
import org.codelutin.vcs.type.VCSState;
@@ -49,8 +46,6 @@
protected String diff;
- protected transient ListenerSet<VCSEntryStateChangedEventListener> listeners = new ListenerSet<VCSEntryStateChangedEventListener>();
-
private static final long serialVersionUID = 1L;
public VCSEntryImpl(VCSConnexion connexion, String relativeLocalPath) {
@@ -80,8 +75,7 @@
public void populateState(long timestamp) throws VCSException {
this.timestamp = timestamp;
- VCSState newState = connexion.getState(getFile(), null);
- setState(newState);
+ this.state = connexion.getState(getFile(), null);
}
public void populateChangeLog() throws IllegalStateException, VCSException {
@@ -100,11 +94,9 @@
}
public void setState(VCSState state) {
- VCSState oldState = this.state;
- this.state = state;
// mark new timestamp
this.timestamp = System.nanoTime();
- fireStateChanged(oldState);
+ this.state = state;
}
public VCSEntryLocation getLocation() throws IllegalStateException {
@@ -137,7 +129,7 @@
public BufferedReader getDiff() throws IllegalStateException, IOException, VCSException {
checkPopulated();
- if (diff== null) {
+ if (diff == null) {
populateDiff();
}
return new BufferedReader(new StringReader(diff));
@@ -153,14 +145,6 @@
return null;
}
- public void addVCSEntryStateChangedEventListener(VCSEntryStateChangedEventListener l) {
- listeners.add(l);
- }
-
- public void removeVCSEntryStateChangedEventListener(VCSEntryStateChangedEventListener l) {
- listeners.remove(l);
- }
-
@Override
public String toString() {
return super.toString() + " " + localFile + " : " + state;
@@ -172,52 +156,4 @@
}
}
- protected void fireStateChanged(VCSState oldState) {
- if (oldState != null && oldState == state) {
- // nothing to do
- return;
- }
- // state has changed, must reset changelog and diff to be safe
- diff = changelog = null;
-
- String methodName = null;
-
- switch (state) {
- case MISSING:
- methodName = "onDeleted";
- break;
- case MODIFIED:
- methodName = "onModified";
- break;
- case OUT_OF_DATE:
- methodName = "onObsoleted";
- break;
- case OUT_OF_DATE_AND_MODIFIED:
- methodName = oldState == VCSState.OUT_OF_DATE ? "onModified" : "onObsoleted";
- break;
- case REMOVED:
- methodName = "onDeleted";
- break;
- case UNKNOWN:
- return;
- case UNVERSIONNED:
- case UNVERSIONNED_OR_MISSING:
- methodName = "onAdded";
- break;
- case UP_TO_DATE:
- methodName = "onUpdated";
- break;
- }
-
- if (methodName == null) {
- throw new IllegalStateException("could not find a disptacher property for state: " + state);
- }
- try {
- VCSEntryStateChangedEvent event = new VCSEntryStateChangedEvent(this, oldState, state);
- listeners.fire(methodName, event);
- } catch (Exception e) {
- //TODO
- }
- }
-
}
1
0
r522 - in trunk/lutinvcs/ui/jaxx/src/main/resources: i18n icons
by tchemit@users.labs.libre-entreprise.org 15 Apr '08
by tchemit@users.labs.libre-entreprise.org 15 Apr '08
15 Apr '08
Author: tchemit
Date: 2008-04-15 08:47:01 +0000 (Tue, 15 Apr 2008)
New Revision: 522
Added:
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-config.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-showconfig.png
Removed:
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/advanced.png
Modified:
trunk/lutinvcs/ui/jaxx/src/main/resources/i18n/jaxx-en_GB.properties
trunk/lutinvcs/ui/jaxx/src/main/resources/i18n/jaxx-fr_FR.properties
Log:
mise en place ui de config
Modified: trunk/lutinvcs/ui/jaxx/src/main/resources/i18n/jaxx-en_GB.properties
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/resources/i18n/jaxx-en_GB.properties 2008-04-15 08:46:45 UTC (rev 521)
+++ trunk/lutinvcs/ui/jaxx/src/main/resources/i18n/jaxx-en_GB.properties 2008-04-15 08:47:01 UTC (rev 522)
@@ -1,5 +1,29 @@
+isisfish.server.ssh.generateKey.title=
+lutinvcs.apply=
+lutinvcs.cancel=
lutinvcs.changelog.title=Changelog UI
lutinvcs.commit.message=Please fill a message for your commit
+lutinvcs.config.anonymous=
+lutinvcs.config.email=
+lutinvcs.config.firstname=
+lutinvcs.config.lastname=
+lutinvcs.config.message=
+lutinvcs.config.pass=
+lutinvcs.config.server.authenticationMethod=
+lutinvcs.config.server.login=
+lutinvcs.config.server.passphrase=
+lutinvcs.config.server.password=
+lutinvcs.config.server.ssh.confirm.passphrase=
+lutinvcs.config.server.ssh.key.change=
+lutinvcs.config.server.ssh.key.generate=
+lutinvcs.config.server.ssh.no.passphrase=
+lutinvcs.config.server.ssh.passphrase=
+lutinvcs.config.server.ssh.privateKeyFile=
+lutinvcs.config.server.ssh.publicKeyFile=
+lutinvcs.config.ssh=
+lutinvcs.config.test=
+lutinvcs.config.title=
lutinvcs.confirm.title=Confirm UI
lutinvcs.diff.title=Diff UI
+lutinvcs.reset=
lutinvcs.synch.title=Synch UI
Modified: trunk/lutinvcs/ui/jaxx/src/main/resources/i18n/jaxx-fr_FR.properties
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/resources/i18n/jaxx-fr_FR.properties 2008-04-15 08:46:45 UTC (rev 521)
+++ trunk/lutinvcs/ui/jaxx/src/main/resources/i18n/jaxx-fr_FR.properties 2008-04-15 08:47:01 UTC (rev 522)
@@ -1,5 +1,29 @@
+isisfish.server.ssh.generateKey.title=GenerateKey UI
+lutinvcs.apply=Appliquer
+lutinvcs.cancel=Annuler
lutinvcs.changelog.title=Changelog UI
lutinvcs.commit.message=Renseigner le message de publication
+lutinvcs.config.anonymous=anonyme
+lutinvcs.config.email=Courriel
+lutinvcs.config.firstname=Pr\u00E9nom
+lutinvcs.config.lastname=Nom
+lutinvcs.config.message=Configuration de la connexion
+lutinvcs.config.pass=password
+lutinvcs.config.server.authenticationMethod=Connexion
+lutinvcs.config.server.login=Login
+lutinvcs.config.server.passphrase=passe-phrase
+lutinvcs.config.server.password=Mot de passe
+lutinvcs.config.server.ssh.confirm.passphrase=Confirmation
+lutinvcs.config.server.ssh.key.change=changer la clef ssh
+lutinvcs.config.server.ssh.key.generate=g\u00E9n\u00E9rer la clef ssh
+lutinvcs.config.server.ssh.no.passphrase=pas de passe-phrase
+lutinvcs.config.server.ssh.passphrase=passe-phrase
+lutinvcs.config.server.ssh.privateKeyFile=clef priv\u00E9e
+lutinvcs.config.server.ssh.publicKeyFile=clef publique
+lutinvcs.config.ssh=ssh
+lutinvcs.config.test=tester la connexion
+lutinvcs.config.title=Config UI
lutinvcs.confirm.title=Confirm UI
lutinvcs.diff.title=Diff UI
+lutinvcs.reset=R\u00E9initialiser
lutinvcs.synch.title=Synch UI
Added: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-config.png
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-config.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-showconfig.png
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-showconfig.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/advanced.png
===================================================================
(Binary files differ)
1
0
r521 - trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui
by tchemit@users.labs.libre-entreprise.org 15 Apr '08
by tchemit@users.labs.libre-entreprise.org 15 Apr '08
15 Apr '08
Author: tchemit
Date: 2008-04-15 08:46:45 +0000 (Tue, 15 Apr 2008)
New Revision: 521
Added:
trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JVCSGenerateSshKey.jaxx
trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConfigUI.jaxx
trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/config.css
Modified:
trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxSynchUI.jaxx
trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxVCSUIProvider.java
Log:
mise en place ui de config
Added: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JVCSGenerateSshKey.jaxx
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JVCSGenerateSshKey.jaxx (rev 0)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JVCSGenerateSshKey.jaxx 2008-04-15 08:46:45 UTC (rev 521)
@@ -0,0 +1,148 @@
+<JDialog title='isisfish.server.ssh.generateKey.title' modal='true'>
+ <script>
+ import org.apache.commons.logging.Log;
+ import org.apache.commons.logging.LogFactory;
+
+ import java.io.File;
+ import java.io.IOException;
+ import java.util.ArrayList;
+ import java.util.Arrays;
+ import java.util.HashMap;
+ import java.util.Map;
+
+ static protected final Log log = LogFactory.getLog(JVCSGenerateSshKey.class);
+
+ private static JVCSGenerateSshKey instance;
+
+ public static JVCSGenerateSshKey getInstance(JDialog parent) {
+ if (instance == null) {
+ instance = new JVCSGenerateSshKey(parent);
+ }
+ return instance;
+ }
+
+ /*import com.sshtools.j2ssh.transport.publickey.OpenSSHPublicKeyFormat;
+ import com.sshtools.j2ssh.transport.publickey.SshKeyGenerator;
+ import org.codelutin.util.FileUtil;*/
+
+ public boolean cancel;
+ public boolean noPassPhrase;
+ public Exception error;
+ protected boolean invalidPassPhrase;
+ protected String vcsLogin;
+
+ private JVCSGenerateSshKey(JDialog instance) {
+ super(instance);
+ // block close operation
+ setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
+ }
+
+ public void setData(String vcsLogin, File privateKeyFile) {
+ this.vcsLogin = vcsLogin ;
+ serverPrivateKeyFile.setText(privateKeyFile.getAbsolutePath());
+ serverPublicKeyFile.setText(privateKeyFile.getAbsolutePath() + ".pub");
+ noPassPhrase=true;
+ error=null;
+ doCheck();
+ }
+
+ protected boolean doGenerate() {
+ /*File f = new File(getServerPrivateKeyFile().getText());
+ try {
+ SshKeyGenerator sshkeygenerator = new SshKeyGenerator();
+ char[] password = getServerPassPhrase().getPassword();
+ noPassPhrase=password.length==0;
+ if (password.length > 0) {
+ sshkeygenerator.generateKeyPair("dsa", 1024, f.getAbsolutePath(), vcsLogin, Arrays.toString(password));
+ Arrays.fill(password, '0');
+ } else {
+ sshkeygenerator.generateKeyPair("dsa", 1024, f.getAbsolutePath(), vcsLogin, "");
+ }
+ // convert to openSSH ?
+ File publicKeyFile = new File(serverPublicKeyFile.getText());
+ log.info("public key before OpenSsh : "+ FileUtil.readAsString(publicKeyFile));
+ String openSshPublicKey = SshKeyGenerator.convertPublicKeyFile(publicKeyFile, new
+ OpenSSHPublicKeyFormat(vcsLogin + "@forIsisFish 1024-bit dsa"));
+ log.info("public key OpenSsh : "+openSshPublicKey);
+ FileUtil.writeString(publicKeyFile, openSshPublicKey);
+ } catch (Exception e) {
+ error=e;
+ return true;
+ }*/
+ return false;
+ }
+ protected boolean check() {
+ invalidPassPhrase=!Arrays.equals(serverPassPhrase.getPassword(),serverConfirmPassPhrase.getPassword());
+ return !invalidPassPhrase;
+ }
+
+ protected void doCheck() {
+ ok.setEnabled(check());
+ setColor(invalidPassPhrase, serverPassPhraseLabel);
+ setColor(invalidPassPhrase, serverConfirmPassPhraseLabel);
+ }
+
+ protected void setColor(boolean invalid, JComponent component) {
+ component.setForeground(invalid ? Color.red: Color.black);
+ }
+ </script>
+ <Table>
+ <row fill='horizontal'>
+ <cell>
+ <JToolBar id='top'>
+ <JLabel id="actionLabel"/>
+ <Table fill='both' insets='0,0,0,0'>
+ <row>
+ <cell fill='both'/>
+ </row>
+ </Table>
+ <!--JSeparator orientation="vertical"/-->
+ <JButton id='help'/>
+ <!--JButton id='help' action='{createHelpAction()}'/-->
+ </JToolBar>
+
+ </cell>
+ </row>
+ <row fill='horizontal'>
+ <cell>
+ <JLabel text='lutinvcs.config.server.ssh.privateKeyFile'/>
+ </cell>
+ <cell>
+ <JTextField id='serverPrivateKeyFile' font-size='12' editable='false' columns='28' height='25'/>
+ </cell>
+ </row>
+ <row fill='horizontal'>
+ <cell>
+ <JLabel text='lutinvcs.config.server.ssh.publicKeyFile'/>
+ </cell>
+ <cell>
+ <JTextField id='serverPublicKeyFile' font-size='12' editable='false' columns='28' height='25'/>
+ </cell>
+ </row>
+ <row fill='horizontal'>
+ <cell>
+ <JLabel id='serverPassPhraseLabel' text='lutinvcs.config.server.ssh.passphrase'/>
+ </cell>
+ <cell>
+ <JPasswordField id='serverPassPhrase' onKeyReleased="doCheck()"/>
+ </cell>
+ </row>
+ <row fill='horizontal'>
+ <cell>
+ <JLabel id='serverConfirmPassPhraseLabel' text='lutinvcs.config.server.ssh.confirm.passphrase'/>
+ </cell>
+ <cell>
+ <JPasswordField id='serverConfirmPassPhrase' onKeyReleased="doCheck()"/>
+ </cell>
+ </row>
+ <row fill='horizontal'>
+ <cell columns="2">
+ <JPanel layout='{new GridLayout(0, 2, 2, 2)}'>
+ <JButton id='ok' text='lutinvcs.apply' enabled='false'
+ onActionPerformed="cancel = doGenerate();dispose()"/>
+ <JButton id='cancelAction' text='lutinvcs.cancel' onActionPerformed="cancel = true;dispose()"/>
+ </JPanel>
+ </cell>
+ </row>
+ </Table>
+</JDialog>
Added: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConfigUI.jaxx
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConfigUI.jaxx (rev 0)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConfigUI.jaxx 2008-04-15 08:46:45 UTC (rev 521)
@@ -0,0 +1,120 @@
+<ConfigUI title='lutinvcs.config.title' resizable='false'>
+ <style source="config.css"/>
+ <script>import static org.codelutin.vcs.type.VCSConnexionMode.*;</script>
+ <JToolBar id='top'>
+ <JLabel text='lutinvcs.config.message'/>
+ <Table fill='both' insets='0,0,0,0'>
+ <row>
+ <cell fill='both'/>
+ </row>
+ </Table>
+ <JButton id='help' action='{createHelpAction()}'/>
+ </JToolBar>
+ <Table fill='both' insets="1,1,1,1">
+ <row fill='horizontal'>
+ <cell columns='2'>
+ <JScrollPane height="60" columnHeaderView='{top}'>
+ <JEditorPane id="doc"/>
+ </JScrollPane>
+ </cell>
+ </row>
+ <row fill='horizontal'>
+ <cell>
+ <JLabel id='firstnameLabel'/>
+ </cell>
+ <cell>
+ <JTextField id='firstname' onKeyReleased="doCheck(Element.firstname)"/>
+ </cell>
+ </row>
+ <row fill='horizontal'>
+ <cell>
+ <JLabel id='lastnameLabel'/>
+ </cell>
+ <cell>
+ <JTextField id='lastname' onKeyReleased="doCheck(Element.lastname)"/>
+ </cell>
+ </row>
+ <row fill='horizontal'>
+ <cell>
+ <JLabel id='emailLabel'/>
+ </cell>
+ <cell>
+ <JTextField id='email' onKeyReleased="doCheck(Element.email)"/>
+ </cell>
+ </row>
+ <row fill='horizontal'>
+ <cell>
+ <JLabel width='150' height='20' id='serverAuthenticationMethodLabel'/>
+ </cell>
+ <cell>
+ <JPanel layout='{new GridLayout(0, 3, 2, 2)}'>
+ <JRadioButton id='serverAuthenticationMethodAnonymous' value='anonymous' onActionPerformed="changeAutheticationMode(ANONYMOUS)"/>
+ <JRadioButton id='serverAuthenticationMethodPassword' value='pass' onActionPerformed="changeAutheticationMode(PASSWORD)"/>
+ <JRadioButton id='serverAuthenticationMethodSsh' value='ssh' onActionPerformed="changeAutheticationMode(SSH)"/>
+ </JPanel>
+ </cell>
+ </row>
+ <row fill='horizontal'>
+ <cell>
+ <JLabel id='serverLoginLabel' visible='{!serverAuthenticationMethodAnonymous.isSelected()}'/>
+ </cell>
+ <cell>
+ <JTextField id='serverLogin' onKeyReleased="doCheck(Element.login)" visible='{!serverAuthenticationMethodAnonymous.isSelected()}'/>
+ </cell>
+ </row>
+ <row fill='horizontal'>
+ <cell>
+ <JLabel id='serverPasswordLabel' visible='{serverAuthenticationMethodPassword.isSelected()}'/>
+ </cell>
+ <cell>
+ <JPasswordField id='serverPassword' visible='{serverAuthenticationMethodPassword.isSelected()}' onKeyReleased="doCheck(Element.password)"/>
+ </cell>
+ </row>
+ <row fill='horizontal'>
+ <cell>
+ <JLabel id='serverLoginNoPassPhraseLabel' visible='{serverAuthenticationMethodSsh.isSelected()}'/>
+ </cell>
+ <cell>
+ <JCheckBox id='serverNoPassPhrase' onKeyReleased="doCheck(Element.nopassphrase)" visible='{serverAuthenticationMethodSsh.isSelected()}'/>
+ </cell>
+ </row>
+ <row fill='horizontal'>
+ <cell>
+ <JLabel id='serverPassphraseLabel' visible='{serverAuthenticationMethodSsh.isSelected()}' enabled='{!serverNoPassPhrase.isSelected()}'/>
+ </cell>
+ <cell>
+ <JPasswordField id='serverPassphrase' onKeyReleased="doCheck(Element.passphrase)" visible='{serverAuthenticationMethodSsh.isSelected()}' enabled='{!serverNoPassPhrase.isSelected()}'/>
+ </cell>
+ </row>
+ <row fill='horizontal'>
+ <cell>
+ <JLabel id='serverPrivateKeyFileLabel' visible='{serverAuthenticationMethodSsh.isSelected()}'/>
+ </cell>
+ <cell>
+ <JTextField id='serverPrivateKeyFile' onKeyReleased="doCheck(Element.privatekey)" visible='{serverAuthenticationMethodSsh.isSelected()}'/>
+ </cell>
+ </row>
+ <row fill='horizontal'>
+ <cell columns="2">
+ <JToolBar>
+ <JPanel layout='{new GridLayout(0, 3, 2, 2)}'>
+ <JButton id='serverPrivateKeyChangeFile' text='lutinvcs.config.server.ssh.key.change' visible='{serverAuthenticationMethodSsh.isSelected()}' onActionPerformed="changePrivateKeyFile()"/>
+ <JButton id='serverPrivateKeyGenerate' text='lutinvcs.config.server.ssh.key.generate' visible='{serverAuthenticationMethodSsh.isSelected()}'/>
+ <JButton id='testConnection' text='lutinvcs.config.test'/>
+ </JPanel>
+ </JToolBar>
+ </cell>
+ </row>
+ <row fill='horizontal'>
+ <cell columns="2">
+ <JToolBar>
+ <JPanel layout='{new GridLayout(0, 3, 2, 2)}'>
+ <JButton id='ok' text='lutinvcs.apply' onActionPerformed="save();"/>
+ <JButton id='reset' text='lutinvcs.reset' onActionPerformed="reset();"/>
+ <JButton id='cancelAction' text='lutinvcs.cancel' onActionPerformed="dispose();"/>
+ </JPanel>
+ </JToolBar>
+ </cell>
+ </row>
+ </Table>
+</ConfigUI>
Modified: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxSynchUI.jaxx
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxSynchUI.jaxx 2008-04-15 08:46:05 UTC (rev 520)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxSynchUI.jaxx 2008-04-15 08:46:45 UTC (rev 521)
@@ -36,6 +36,7 @@
<JButton id='addAll' action='{createAction(ADD,false)}'/>
<JButton id='deleteAll' action='{createAction(DELETE,false)}'/>
<JSeparator orientation="vertical"/>
+ <JButton id='config' action='{createShowConfigAction()}'/>
<JButton id='help' action='{createHelpAction()}'/>
</JToolBar>
</cell>
Modified: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxVCSUIProvider.java
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxVCSUIProvider.java 2008-04-15 08:46:05 UTC (rev 520)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxVCSUIProvider.java 2008-04-15 08:46:45 UTC (rev 521)
@@ -18,6 +18,6 @@
public class JaxxVCSUIProvider extends VCSUIProvider {
public JaxxVCSUIProvider() {
- super("jaxx", JaxxSynchUI.class, JaxxDiffUI.class, JaxxChangelogUI.class,JaxxConfirmUI.class);
+ super("jaxx", JaxxSynchUI.class, JaxxDiffUI.class, JaxxChangelogUI.class,JaxxConfirmUI.class,JaxxConfigUI.class);
}
}
\ No newline at end of file
Copied: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/config.css (from rev 518, trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/common.css)
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/config.css (rev 0)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/config.css 2008-04-15 08:46:45 UTC (rev 521)
@@ -0,0 +1,69 @@
+JToolBar {
+ floatable: false;
+ focusable: false;
+ margin: 0;
+}
+
+JButton {
+ margin: 0; /*font-size:10;*/
+}
+
+JTextField {
+ columns: 30;
+}
+
+#top, #help {
+ borderPainted: false;
+ opaque: false;
+}
+
+#serverPrivateKeyFileLabel {
+ text: "lutinvcs.config.server.ssh.privateKeyFile";
+}
+
+#serverLoginNoPassPhraseLabel {
+ text: "lutinvcs.config.server.ssh.no.passphrase";
+}
+
+#serverLoginLabel {
+ text: "lutinvcs.config.server.login";
+}
+
+#firstnameLabel {
+ text: "lutinvcs.config.firstname";
+}
+
+#lastnameLabel {
+ text: "lutinvcs.config.lastname";
+}
+
+#emailLabel {
+ text: "lutinvcs.config.email";
+}
+
+#serverAuthenticationMethodLabel {
+ text: "lutinvcs.config.server.authenticationMethod";
+}
+
+#serverPasswordLabel {
+ text: "lutinvcs.config.server.password";
+}
+
+#serverPassphraseLabel {
+ text: "lutinvcs.config.server.passphrase";
+}
+
+#serverAuthenticationMethodAnonymous {
+ text: "lutinvcs.config.anonymous";
+ buttonGroup: "serverMethod";
+}
+
+#serverAuthenticationMethodPassword {
+ text: "lutinvcs.config.pass";
+ buttonGroup: "serverMethod";
+}
+
+#serverAuthenticationMethodSsh {
+ text: "lutinvcs.config.ssh";
+ buttonGroup: "serverMethod";
+}
1
0
r520 - trunk/lutinvcs/provider/mock/src/main/java/org/codelutin/vcs/provider/mock
by tchemit@users.labs.libre-entreprise.org 15 Apr '08
by tchemit@users.labs.libre-entreprise.org 15 Apr '08
15 Apr '08
Author: tchemit
Date: 2008-04-15 08:46:05 +0000 (Tue, 15 Apr 2008)
New Revision: 520
Modified:
trunk/lutinvcs/provider/mock/src/main/java/org/codelutin/vcs/provider/mock/MockConnexion.java
Log:
changement ?\195?\169tats de la connexion mock
Modified: trunk/lutinvcs/provider/mock/src/main/java/org/codelutin/vcs/provider/mock/MockConnexion.java
===================================================================
--- trunk/lutinvcs/provider/mock/src/main/java/org/codelutin/vcs/provider/mock/MockConnexion.java 2008-04-13 19:37:05 UTC (rev 519)
+++ trunk/lutinvcs/provider/mock/src/main/java/org/codelutin/vcs/provider/mock/MockConnexion.java 2008-04-15 08:46:05 UTC (rev 520)
@@ -38,13 +38,14 @@
@Override
public void close() throws IllegalStateException {
checkInit();
+ state = VCSConnectionState.CLOSE;
fireClosed();
}
@Override
public void open() throws IllegalStateException {
checkInit();
- state = VCSConnectionState.CLOSE;
+ state = VCSConnectionState.OPEN;
fireOpened();
}
1
0
r519 - trunk/lutinvcs/ui/common/src/main/resources/i18n
by tchemit@users.labs.libre-entreprise.org 13 Apr '08
by tchemit@users.labs.libre-entreprise.org 13 Apr '08
13 Apr '08
Author: tchemit
Date: 2008-04-13 19:37:05 +0000 (Sun, 13 Apr 2008)
New Revision: 519
Modified:
trunk/lutinvcs/ui/common/src/main/resources/i18n/common-en_GB.properties
trunk/lutinvcs/ui/common/src/main/resources/i18n/common-fr_FR.properties
Log:
next - prev file actions + diff and changelog
Modified: trunk/lutinvcs/ui/common/src/main/resources/i18n/common-en_GB.properties
===================================================================
--- trunk/lutinvcs/ui/common/src/main/resources/i18n/common-en_GB.properties 2008-04-13 19:29:47 UTC (rev 518)
+++ trunk/lutinvcs/ui/common/src/main/resources/i18n/common-en_GB.properties 2008-04-13 19:37:05 UTC (rev 519)
@@ -10,7 +10,9 @@
lutinvcs.action.message=Action ''{0}'' ({1} selected files)
lutinvcs.action.message.one=Action ''{0}'' (1 selected file)
lutinvcs.action.nextdiff.tip=goto next diff
+lutinvcs.action.nextfile.tip=select newt file
lutinvcs.action.previousdiff.tip=goto previous diff
+lutinvcs.action.previousfile.tip=select previous file
lutinvcs.action.showmessages.tip=show previous commit messages
lutinvcs.action.single.tip=Launch action ''{0}'' on selected file ''{1}''
lutinvcs.file=File
Modified: trunk/lutinvcs/ui/common/src/main/resources/i18n/common-fr_FR.properties
===================================================================
--- trunk/lutinvcs/ui/common/src/main/resources/i18n/common-fr_FR.properties 2008-04-13 19:29:47 UTC (rev 518)
+++ trunk/lutinvcs/ui/common/src/main/resources/i18n/common-fr_FR.properties 2008-04-13 19:37:05 UTC (rev 519)
@@ -10,7 +10,9 @@
lutinvcs.action.message=Action ''{0}'' ({1} fichiers s\u00E9lectionn\u00E9s)
lutinvcs.action.message.one=Action ''{0}'' (1 fichier s\u00E9lectionn\u00E9)
lutinvcs.action.nextdiff.tip=voir la prochaine diff\u00E9rence
+lutinvcs.action.nextfile.tip=S\u00E9lectionner le prochain fichier
lutinvcs.action.previousdiff.tip=voir la diff\u00E9rence pr\u00E9c\u00E9dente
+lutinvcs.action.previousfile.tip=S\u00E9lectionner le pr\u00E9c\u00E9dent fichier
lutinvcs.action.showmessages.tip=voir les messages de publication pr\u00E9c\u00E9dents
lutinvcs.action.single.tip=ex\u00E9cuter l''action ''{0}'' sur le fichier s\u00E9l\u00E9ctionn\u00E9 ''{1}''
lutinvcs.file=Fichier
1
0
r518 - in trunk/lutinvcs: core/src/main/java/org/codelutin/vcs core/src/main/java/org/codelutin/vcs/util provider/mock/src/main/java/org/codelutin/vcs/provider/mock ui/common/src/main/java/org/codelutin/vcs/ui ui/common/src/main/java/org/codelutin/vcs/ui/action ui/common/src/main/java/org/codelutin/vcs/ui/handler ui/common/src/main/java/org/codelutin/vcs/ui/model ui/common/src/main/java/org/codelutin/vcs/ui/util ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui
by tchemit@users.labs.libre-entreprise.org 13 Apr '08
by tchemit@users.labs.libre-entreprise.org 13 Apr '08
13 Apr '08
Author: tchemit
Date: 2008-04-13 19:29:47 +0000 (Sun, 13 Apr 2008)
New Revision: 518
Added:
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ChangeFileAction.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabOneFileUI.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabOneFileUIHandler.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabOneFileUIModel.java
Modified:
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSEntry.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/VCSEntryImpl.java
trunk/lutinvcs/provider/mock/src/main/java/org/codelutin/vcs/provider/mock/MockHandler.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ChangelogUI.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/DiffUI.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/SynchUI.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ChangelogUIHandler.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/DiffUIHandler.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ChangelogUIModel.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/DiffUIModel.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUI.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUIHandler.java
trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/common.css
Log:
next - prev file actions + diff and changelog
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSEntry.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSEntry.java 2008-04-13 19:14:00 UTC (rev 517)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSEntry.java 2008-04-13 19:29:47 UTC (rev 518)
@@ -59,7 +59,7 @@
*
* @throws VCSException if any pb with vcs io
* @throws IllegalStateException if entry was never populated
- * @throws java.io.IOException if io pb
+ * @throws IOException if io pb
*/
void populateDiff() throws IllegalStateException, VCSException, IOException;
@@ -137,16 +137,19 @@
String getRev() throws IllegalStateException;
/**
- * @return the changelog of entry from local aginst remote
+ * @return the changelog of entry from local against remote (compute it if necessary)
* @throws IllegalStateException if entry was never populated
+ * @throws VCSException if vcs io pb while computing changelog
*/
- BufferedReader getChangeLog() throws IllegalStateException;
+ BufferedReader getChangeLog() throws IllegalStateException, VCSException;
/**
- * @return the diff of entry from local aginst remote
+ * @return the diff of entry from local against remote (compute it if necessary)
* @throws IllegalStateException if entry was never populated
+ * @throws VCSException if vcs io pb while computing diff
+ * @throws IOException if io pb while computing diff
*/
- BufferedReader getDiff() throws IllegalStateException;
+ BufferedReader getDiff() throws IllegalStateException, IOException, VCSException;
/**
* @return the local entry content
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/VCSEntryImpl.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/VCSEntryImpl.java 2008-04-13 19:14:00 UTC (rev 517)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/VCSEntryImpl.java 2008-04-13 19:29:47 UTC (rev 518)
@@ -127,13 +127,19 @@
return rev;
}
- public BufferedReader getChangeLog() throws IllegalStateException {
+ public BufferedReader getChangeLog() throws IllegalStateException, VCSException {
checkPopulated();
+ if (changelog == null) {
+ populateChangeLog();
+ }
return new BufferedReader(new StringReader(changelog));
}
- public BufferedReader getDiff() throws IllegalStateException {
+ public BufferedReader getDiff() throws IllegalStateException, IOException, VCSException {
checkPopulated();
+ if (diff== null) {
+ populateDiff();
+ }
return new BufferedReader(new StringReader(diff));
}
Modified: trunk/lutinvcs/provider/mock/src/main/java/org/codelutin/vcs/provider/mock/MockHandler.java
===================================================================
--- trunk/lutinvcs/provider/mock/src/main/java/org/codelutin/vcs/provider/mock/MockHandler.java 2008-04-13 19:14:00 UTC (rev 517)
+++ trunk/lutinvcs/provider/mock/src/main/java/org/codelutin/vcs/provider/mock/MockHandler.java 2008-04-13 19:29:47 UTC (rev 518)
@@ -110,15 +110,15 @@
}
public String getChangeLog(File file) throws VCSException {
- return null;
+ return this+" changelog for : \n"+file+"... mock";
}
public String getDiff(File file) throws VCSException, IOException {
- return null;
+ return this+" diff for : \n"+file+"... mock";
}
public String getDiff(File file, Object againstRevision) throws VCSException, IOException {
- return null;
+ return this+" diff for : \n"+file+"... mock";
}
public boolean hasProtocoleChanged() throws VCSException {
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ChangelogUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ChangelogUI.java 2008-04-13 19:14:00 UTC (rev 517)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ChangelogUI.java 2008-04-13 19:29:47 UTC (rev 518)
@@ -14,23 +14,9 @@
*/
package org.codelutin.vcs.ui;
-import javax.swing.AbstractButton;
-
/** @author chemit */
-public abstract class ChangelogUI extends org.codelutin.vcs.ui.util.AbstractTabUI<org.codelutin.vcs.ui.handler.ChangelogUIHandler> {
+public abstract class ChangelogUI extends org.codelutin.vcs.ui.util.AbstractTabOneFileUI<org.codelutin.vcs.ui.handler.ChangelogUIHandler> {
- @Override
- public void setVisible(boolean b) {
- if (b) {
- AbstractButton button = getButton(getHandler().getLocation());
- if (button == null) {
- button = getAllTab();
- }
- button.doClick();
- if (getContentTable().getRowCount() > 0)
- getHandler().getSelectionModel().setSelectionInterval(0, 0);
- }
- super.setVisible(b);
- }
+ public abstract javax.swing.JTextArea getChangelogContent();
}
\ No newline at end of file
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/DiffUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/DiffUI.java 2008-04-13 19:14:00 UTC (rev 517)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/DiffUI.java 2008-04-13 19:29:47 UTC (rev 518)
@@ -16,9 +16,11 @@
import javax.swing.AbstractAction;
import javax.swing.AbstractButton;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
/** @author chemit */
-public abstract class DiffUI extends org.codelutin.vcs.ui.util.AbstractTabUI<org.codelutin.vcs.ui.handler.DiffUIHandler> {
+public abstract class DiffUI extends org.codelutin.vcs.ui.util.AbstractTabOneFileUI<org.codelutin.vcs.ui.handler.DiffUIHandler> {
public abstract AbstractButton getNextDiff();
@@ -26,20 +28,14 @@
public abstract AbstractButton getCommit();
- @Override
- public void setVisible(boolean b) {
- if (b) {
- AbstractButton button = getButton(getHandler().getLocation());
- if (button == null) {
- button = getAllTab();
- }
- button.doClick();
- if (getContentTable().getRowCount() > 0)
- getHandler().getSelectionModel().setSelectionInterval(0, 0);
- }
- super.setVisible(b);
- }
+ public abstract JScrollPane getRemoteEditorScroll();
+ public abstract JTextArea getRemoteEditorContent();
+
+ public abstract JScrollPane getLocalEditorScroll();
+
+ public abstract JTextArea getLocalEditorContent();
+
protected AbstractAction createDiffAction(boolean goUp) {
return org.codelutin.vcs.ui.action.DiffAction.createAction(goUp, this);
}
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/SynchUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/SynchUI.java 2008-04-13 19:14:00 UTC (rev 517)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/SynchUI.java 2008-04-13 19:29:47 UTC (rev 518)
@@ -48,16 +48,4 @@
public abstract JPopupMenu getPopup();
- @Override
- public void setVisible(boolean b) {
- if (b) {
- AbstractButton button = getButton(getHandler().getLocation());
- if (button == null) {
- button = getAllTab();
- }
- button.doClick();
- }
- super.setVisible(b);
- }
-
}
\ No newline at end of file
Copied: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ChangeFileAction.java (from rev 511, trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ChangeLocationAction.java)
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ChangeFileAction.java (rev 0)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ChangeFileAction.java 2008-04-13 19:29:47 UTC (rev 518)
@@ -0,0 +1,58 @@
+/**
+ * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * # #%
+ */
+package org.codelutin.vcs.ui.action;
+
+import org.codelutin.vcs.ui.util.AbstractTabOneFileUI;
+import org.codelutin.vcs.ui.util.AbstractTabOneFileUIHandler;
+import static org.codelutin.vcs.ui.util.UIHelper.createActionIcon;
+
+import javax.swing.AbstractAction;
+import java.awt.event.ActionEvent;
+
+/** @author chemit */
+public class ChangeFileAction extends org.codelutin.vcs.ui.util.AbstractUIAction<AbstractTabOneFileUIHandler<?, ?>> {
+
+ protected boolean goPrevious;
+
+ private static final long serialVersionUID = 1L;
+
+ public static AbstractAction createAction(boolean location, AbstractTabOneFileUI<?> ui) {
+ ChangeFileAction action = new ChangeFileAction(location);
+ action.setUi(ui);
+ return action;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ checkInit();
+ if (goPrevious) {
+ getHandler().gotoPreviousFile();
+ } else {
+ getHandler().gotoNextFile();
+ }
+ }
+
+ public boolean isGoPrevious() {
+ return goPrevious;
+ }
+
+ protected ChangeFileAction(boolean location) {
+ super(null, createActionIcon("file-" + (location ? "prev" : "next")));
+ this.goPrevious = location;
+ //putValue(SHORT_DESCRIPTION, location.getTip());
+ //putValue(DISPLAYED_MNEMONIC_INDEX_KEY, 0);
+ //putValue(MNEMONIC_KEY, (int) ((String) getValue(NAME)).charAt(0));
+ }
+
+}
\ No newline at end of file
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ChangelogUIHandler.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ChangelogUIHandler.java 2008-04-13 19:14:00 UTC (rev 517)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ChangelogUIHandler.java 2008-04-13 19:29:47 UTC (rev 518)
@@ -14,82 +14,43 @@
*/
package org.codelutin.vcs.ui.handler;
-import static org.codelutin.i18n.I18n._;
import org.codelutin.vcs.VCSEntry;
import org.codelutin.vcs.type.VCSAction;
import org.codelutin.vcs.ui.ChangelogUI;
import org.codelutin.vcs.ui.model.ChangelogUIModel;
-import org.codelutin.vcs.ui.model.DiffUIModel;
-import org.codelutin.vcs.ui.util.AbstractTabUIHandler;
+import org.codelutin.vcs.ui.util.AbstractTabOneFileUIHandler;
-import javax.swing.AbstractButton;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-import java.beans.PropertyChangeEvent;
import java.util.Collections;
import java.util.EnumMap;
/** @author chemit */
-public class ChangelogUIHandler extends AbstractTabUIHandler<ChangelogUIModel, ChangelogUI> {
+public class ChangelogUIHandler extends AbstractTabOneFileUIHandler<ChangelogUIModel, ChangelogUI> {
public ChangelogUIHandler(ChangelogUI ui) {
super(ui, new ChangelogUIModel());
ui.setHandler(this);
}
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- if (log.isDebugEnabled()) {
- log.debug(evt.getPropertyName() + " old:" + evt.getOldValue() + ", new:" + evt.getNewValue());
- }
- if (DiffUIModel.FILE_PROPERTY_CHANGED.equals(evt.getPropertyName())) {
- afterSelectionChanged();
- return;
- }
- super.propertyChange(evt);
- }
-
- @Override
- public void valueChanged(ListSelectionEvent e) {
- if (!e.getValueIsAdjusting()) {
- // update model selected file ? TODO Is this really necessary,
- ListSelectionModel selectionModel = (ListSelectionModel) e.getSource();
- VCSEntry vcsEntry = null;
- if (!selectionModel.isSelectionEmpty()) {
- vcsEntry = getModel().getEntriesModel().getDisplayedEntry(selectionModel.getMinSelectionIndex());
- }
- getModel().setFileModel(vcsEntry);
- }
- }
-
- public void afterLocationChanged() {
- if (getModel().getEntriesModel().getRowCount() > 0) {
- // select first row
- getSelectionModel().addSelectionInterval(0, 0);
- }
- }
-
protected void afterSelectionChanged() {
-
+ super.afterSelectionChanged();
VCSEntry vcsEntry = getModel().getFileModel();
EnumMap<VCSAction, Integer> actions = vcsEntry == null ? null : getModel().getEntriesModel().countActions(Collections.singletonList(vcsEntry));
boolean hasActions = actions != null && !actions.isEmpty();
ChangelogUI ui = getUi();
updateAction(actions, hasActions, ui.getUpdate(), VCSAction.UPDATE, vcsEntry);
- updateAction(actions, hasActions, ui.getRevert(), VCSAction.REVERT, vcsEntry);
+ updateAction(actions, hasActions, ui.getRevert(), VCSAction.REVERT, vcsEntry);
updateAction(actions, hasActions, ui.getRefresh(), VCSAction.REFRESH, vcsEntry);
- //TODO init changelog handler
- log.info("//TODO: show changleog for "+vcsEntry);
-
- }
-
- protected void updateAction(EnumMap<VCSAction, Integer> actions, boolean hasActions, AbstractButton ui, VCSAction action, VCSEntry vcsEntry) {
- super.updateAction(actions, hasActions, ui, action);
- boolean useAction = hasActions && actions.containsKey(action) && actions.get(action) > 0;
- String tip = null;
- if (useAction) {
- tip = _("lutinvcs.action.single.tip", action.getLibelle(), vcsEntry.getFile().getName());
+ if (vcsEntry == null) {
+ ui.getChangelogContent().setText("");
+ return;
}
- ui.setToolTipText(tip);
+ try {
+ ui.getChangelogContent().read(vcsEntry.getChangeLog(), "test");
+ } catch (Exception e) {
+ String message = "could not obtain changelog for file " + vcsEntry.getFile() + " for reason:\n" + e.getMessage();
+ log.warn(message);
+ ui.getChangelogContent().setText(message);
+ }
}
+
}
\ No newline at end of file
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/DiffUIHandler.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/DiffUIHandler.java 2008-04-13 19:14:00 UTC (rev 517)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/DiffUIHandler.java 2008-04-13 19:29:47 UTC (rev 518)
@@ -15,21 +15,19 @@
package org.codelutin.vcs.ui.handler;
import static org.codelutin.i18n.I18n._;
+import org.codelutin.util.FileUtil;
import org.codelutin.vcs.VCSEntry;
import org.codelutin.vcs.type.VCSAction;
import org.codelutin.vcs.ui.DiffUI;
import org.codelutin.vcs.ui.model.DiffUIModel;
-import org.codelutin.vcs.ui.util.AbstractTabUIHandler;
+import org.codelutin.vcs.ui.util.AbstractTabOneFileUIHandler;
-import javax.swing.AbstractButton;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
import java.beans.PropertyChangeEvent;
import java.util.Collections;
import java.util.EnumMap;
/** @author chemit */
-public class DiffUIHandler extends AbstractTabUIHandler<DiffUIModel, DiffUI> {
+public class DiffUIHandler extends AbstractTabOneFileUIHandler<DiffUIModel, DiffUI> {
public DiffUIHandler(DiffUI ui) {
super(ui, new DiffUIModel());
@@ -41,10 +39,6 @@
if (log.isDebugEnabled()) {
log.debug(evt.getPropertyName() + " old:" + evt.getOldValue() + ", new:" + evt.getNewValue());
}
- if (DiffUIModel.FILE_PROPERTY_CHANGED.equals(evt.getPropertyName())) {
- afterSelectionChanged();
- return;
- }
if (DiffUIModel.DIFF_PROPERTY_CHANGED.equals(evt.getPropertyName())) {
afterDiffAction();
return;
@@ -53,27 +47,8 @@
}
@Override
- public void valueChanged(ListSelectionEvent e) {
- if (!e.getValueIsAdjusting()) {
- // update model selected file ? TODO Is this really necessary,
- ListSelectionModel selectionModel = (ListSelectionModel) e.getSource();
- VCSEntry vcsEntry = null;
- if (!selectionModel.isSelectionEmpty()) {
- vcsEntry = getModel().getEntriesModel().getDisplayedEntry(selectionModel.getMinSelectionIndex());
- }
- getModel().setFileModel(vcsEntry);
- }
- }
-
- public void afterLocationChanged() {
- if (getModel().getEntriesModel().getRowCount() > 0) {
- // select first row
- getSelectionModel().addSelectionInterval(0, 0);
- }
- }
-
protected void afterSelectionChanged() {
-
+ super.afterSelectionChanged();
VCSEntry vcsEntry = getModel().getFileModel();
EnumMap<VCSAction, Integer> actions = vcsEntry == null ? null : getModel().getEntriesModel().countActions(Collections.singletonList(vcsEntry));
boolean hasActions = actions != null && !actions.isEmpty();
@@ -82,7 +57,21 @@
updateAction(actions, hasActions, ui.getRevert(), VCSAction.REVERT, vcsEntry);
updateAction(actions, hasActions, ui.getCommit(), VCSAction.COMMIT, vcsEntry);
updateAction(actions, hasActions, ui.getRefresh(), VCSAction.REFRESH, vcsEntry);
- //TODO init diff handler
+ if (vcsEntry == null) {
+ ui.getLocalEditorContent().setText("");
+ ui.getRemoteEditorContent().setText("");
+ return;
+ }
+ //TODO for the moment, just display local file content at right
+ //TODO abd diff at right
+ try {
+ ui.getRemoteEditorContent().read(vcsEntry.getDiff(), "diff-content " + vcsEntry.getFile());
+ ui.getLocalEditorContent().read(FileUtil.getReader(vcsEntry.getFile()), "local-content " + vcsEntry.getFile());
+ } catch (Exception e) {
+ String message = "could not obtain changelog for file " + vcsEntry.getFile() + " for reason:\n" + e.getMessage();
+ log.warn(message);
+ ui.getRemoteEditorContent().setText(message);
+ }
}
protected void afterDiffAction() {
@@ -107,14 +96,4 @@
getModel().setDiff(getModel().getDiff() - 1);
log.info("//TODO :" + this);
}
-
- protected void updateAction(EnumMap<VCSAction, Integer> actions, boolean hasActions, AbstractButton ui, VCSAction action, VCSEntry vcsEntry) {
- super.updateAction(actions, hasActions, ui, action);
- boolean useAction = hasActions && actions.containsKey(action) && actions.get(action) > 0;
- String tip = null;
- if (useAction) {
- tip = _("lutinvcs.action.single.tip", action.getLibelle(), vcsEntry.getFile().getName());
- }
- ui.setToolTipText(tip);
- }
}
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ChangelogUIModel.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ChangelogUIModel.java 2008-04-13 19:14:00 UTC (rev 517)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ChangelogUIModel.java 2008-04-13 19:29:47 UTC (rev 518)
@@ -16,30 +16,15 @@
import org.codelutin.vcs.VCSEntry;
import org.codelutin.vcs.type.VCSEntryLocation;
-import org.codelutin.vcs.ui.util.AbstractTabUIModel;
+import org.codelutin.vcs.ui.util.AbstractTabOneFileUIModel;
/**
* Model of a repository
*
* @author chemit
*/
-public class ChangelogUIModel extends AbstractTabUIModel {
+public class ChangelogUIModel extends AbstractTabOneFileUIModel {
- public static final String FILE_PROPERTY_CHANGED = "file";
-
- /** current file displayed */
- protected VCSEntry fileModel;
-
- public VCSEntry getFileModel() {
- return fileModel;
- }
-
- public void setFileModel(VCSEntry fileModel) {
- VCSEntry oldFileModel = this.fileModel;
- this.fileModel = fileModel;
- firePropertyChange(FILE_PROPERTY_CHANGED, oldFileModel, fileModel);
- }
-
public void init(VCSEntryLocation location, VCSEntry[] states) {
getEntriesModel().clear();
getEntriesModel().populate(VCSEntryLocation.ALL, states);
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/DiffUIModel.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/DiffUIModel.java 2008-04-13 19:14:00 UTC (rev 517)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/DiffUIModel.java 2008-04-13 19:29:47 UTC (rev 518)
@@ -16,29 +16,21 @@
import org.codelutin.vcs.VCSEntry;
import org.codelutin.vcs.type.VCSEntryLocation;
-import org.codelutin.vcs.ui.util.AbstractTabUIModel;
+import org.codelutin.vcs.ui.util.AbstractTabOneFileUIModel;
/**
* Model of a repository
*
* @author chemit
*/
-public class DiffUIModel extends AbstractTabUIModel {
+public class DiffUIModel extends AbstractTabOneFileUIModel {
- public static final String FILE_PROPERTY_CHANGED = "file";
public static final String DIFF_PROPERTY_CHANGED = "diff";
- /** current file displayed */
- protected VCSEntry fileModel;
-
protected int nbDiffs;
protected Integer diff;
- public VCSEntry getFileModel() {
- return fileModel;
- }
-
public int getNbDiffs() {
return nbDiffs;
}
@@ -69,10 +61,9 @@
return diff != null && diff > 0;
}
- public void setFileModel(VCSEntry fileModel) {
- VCSEntry oldFileModel = this.fileModel;
- this.fileModel = fileModel;
- firePropertyChange(FILE_PROPERTY_CHANGED, oldFileModel, fileModel);
+ @Override
+ public void setFileModel(Integer fileModel) {
+ super.setFileModel(fileModel);
// TODO acquire diff and prepare DiffModel...
setNbDiffs(0);
}
Copied: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabOneFileUI.java (from rev 514, trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUI.java)
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabOneFileUI.java (rev 0)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabOneFileUI.java 2008-04-13 19:29:47 UTC (rev 518)
@@ -0,0 +1,40 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package org.codelutin.vcs.ui.util;
+
+import org.codelutin.vcs.ui.action.ChangeFileAction;
+
+import javax.swing.AbstractAction;
+import javax.swing.AbstractButton;
+
+/** @author chemit */
+public abstract class AbstractTabOneFileUI<H extends AbstractTabOneFileUIHandler<?, ?>> extends AbstractTabUI<H> {
+
+ public abstract AbstractButton getNextFile();
+
+ public abstract AbstractButton getPreviousFile();
+
+ @Override
+ public void setVisible(boolean b) {
+ super.setVisible(b);
+ getContentTable().setAutoscrolls(true);
+ //TODO selected first file ?
+ }
+
+ protected AbstractAction createFileAction(boolean goPrevious) {
+ return ChangeFileAction.createAction(goPrevious, this);
+ }
+
+}
\ No newline at end of file
Copied: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabOneFileUIHandler.java (from rev 514, trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUIHandler.java)
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabOneFileUIHandler.java (rev 0)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabOneFileUIHandler.java 2008-04-13 19:29:47 UTC (rev 518)
@@ -0,0 +1,110 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package org.codelutin.vcs.ui.util;
+
+import static org.codelutin.i18n.I18n._;
+import org.codelutin.vcs.VCSEntry;
+import org.codelutin.vcs.type.VCSAction;
+import org.codelutin.vcs.ui.model.DiffUIModel;
+
+import javax.swing.AbstractButton;
+import javax.swing.ListSelectionModel;
+import javax.swing.event.ListSelectionEvent;
+import java.beans.PropertyChangeEvent;
+import java.util.EnumMap;
+
+/** @author chemit */
+public abstract class AbstractTabOneFileUIHandler<M extends AbstractTabOneFileUIModel, U extends AbstractTabOneFileUI<? extends AbstractTabUIHandler>> extends AbstractTabUIHandler<M, U> {
+
+ protected AbstractTabOneFileUIHandler(U ui, M model) {
+ super(ui, model);
+ }
+
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (log.isDebugEnabled()) {
+ log.debug(evt.getPropertyName() + " old:" + evt.getOldValue() + ", new:" + evt.getNewValue());
+ }
+ if (DiffUIModel.FILE_PROPERTY_CHANGED.equals(evt.getPropertyName())) {
+ afterSelectionChanged();
+ return;
+ }
+ super.propertyChange(evt);
+ }
+
+ @Override
+ public void valueChanged(ListSelectionEvent e) {
+ if (!e.getValueIsAdjusting()) {
+
+ ListSelectionModel selectionModel = (ListSelectionModel) e.getSource();
+
+ Integer selectionIndex = selectionModel.isSelectionEmpty() ? null : selectionModel.getMinSelectionIndex();
+
+ getModel().setFileModel(selectionIndex);
+ }
+ //super.valueChanged(e);
+ }
+
+ protected void afterSelectionChanged() {
+
+ U ui = getUi();
+ boolean hasNext = getModel().hasNextFile();
+ boolean hasPrevious = getModel().hasPreviousFile();
+ log.info("//TODO :" + this + " next:" + hasNext + ", prev:" + hasPrevious);
+ ui.getNextFile().setEnabled(hasNext);
+ ui.getPreviousFile().setEnabled(hasPrevious);
+ ui.getNextFile().setToolTipText(hasNext ? _("lutinvcs.action.nextfile.tip") : null);
+ ui.getPreviousFile().setToolTipText(hasPrevious ? _("lutinvcs.action.previousfile.tip") : null);
+ // always scroll to selected
+ Integer selectedRow = getModel().getFileIndex();
+ if (selectedRow != null) {
+ ui.getContentTable().scrollRectToVisible(ui.getContentTable().getCellRect(selectedRow, 0, true));
+ }
+ }
+
+ public void afterLocationChanged() {
+ if (getModel().getEntriesModel().getRowCount() > 0) {
+ // select first row
+ getSelectionModel().setSelectionInterval(0, 0);
+ } else {
+ // disable all actions
+ afterSelectionChanged();
+ }
+ }
+
+ public void gotoPreviousFile() {
+ Integer index = getModel().getFileIndex();
+ if (index != null && getModel().hasPreviousFile) {
+ getSelectionModel().setSelectionInterval(index - 1, index - 1);
+ }
+ }
+
+ public void gotoNextFile() {
+ Integer index = getModel().getFileIndex();
+ if (index != null && getModel().hasNextFile) {
+ getSelectionModel().setSelectionInterval(index + 1, index + 1);
+ }
+ }
+
+ protected void updateAction(EnumMap<VCSAction, Integer> actions, boolean hasActions, AbstractButton ui, VCSAction action, VCSEntry vcsEntry) {
+ super.updateAction(actions, hasActions, ui, action);
+ boolean useAction = hasActions && actions.containsKey(action) && actions.get(action) > 0;
+ String tip = null;
+ if (useAction) {
+ tip = _("lutinvcs.action.single.tip", action.getLibelle(), vcsEntry.getFile().getName());
+ }
+ ui.setToolTipText(tip);
+ }
+}
\ No newline at end of file
Copied: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabOneFileUIModel.java (from rev 511, trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUIModel.java)
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabOneFileUIModel.java (rev 0)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabOneFileUIModel.java 2008-04-13 19:29:47 UTC (rev 518)
@@ -0,0 +1,76 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package org.codelutin.vcs.ui.util;
+
+import org.codelutin.vcs.VCSEntry;
+
+/**
+ * Abstract for a dialog with location information (says one tab by location type (except UNKNOW type of course...)
+ *
+ * @author chemit
+ */
+public class AbstractTabOneFileUIModel extends AbstractTabUIModel {
+
+ public static final String FILE_PROPERTY_CHANGED = "file";
+
+ /** current file displayed */
+ protected VCSEntry fileModel;
+
+ protected boolean hasNextFile;
+ protected boolean hasPreviousFile;
+
+ protected Integer fileIndex;
+
+ public VCSEntry getFileModel() {
+ if (fileIndex == null) {
+ return null;
+ }
+ return getEntriesModel().getDisplayedEntry(fileIndex);
+ }
+
+ public void setFileModel(Integer fileIndex) {
+ VCSEntry oldFileModel = this.fileModel;
+ this.fileIndex = fileIndex;
+
+ int size = getEntriesModel().getRowCount();
+ if (fileIndex == null || size < 2) {
+ hasNextFile = hasPreviousFile = false;
+ } else {
+ hasNextFile = hasPreviousFile = true;
+ if (fileIndex == 0) {
+ // first row : no previous file
+ hasPreviousFile = false;
+ } else {
+ if (fileIndex == size - 1) {
+ // last row : no next file
+ hasNextFile = false;
+ }
+ }
+ }
+ firePropertyChange(FILE_PROPERTY_CHANGED, oldFileModel, fileIndex);
+ }
+
+ public boolean hasPreviousFile() {
+ return hasPreviousFile;
+ }
+
+ public boolean hasNextFile() {
+ return hasNextFile;
+ }
+
+ public Integer getFileIndex() {
+ return fileIndex;
+ }
+}
\ No newline at end of file
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUI.java 2008-04-13 19:14:00 UTC (rev 517)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUI.java 2008-04-13 19:29:47 UTC (rev 518)
@@ -36,9 +36,23 @@
public abstract AbstractButton getUpdate();
-
public abstract AbstractButton getRevert();
+ @Override
+ public void setVisible(boolean b) {
+ if (b) {
+
+ VCSEntryLocation vcsEntryLocation = getHandler().getLocation();
+ AbstractButton button = getButton(vcsEntryLocation);
+ if (button == null) {
+ button = getAllTab();
+ }
+ getHandler().getModel().setLocation(VCSEntryLocation.UNKNOW);
+ button.doClick();
+ }
+ super.setVisible(b);
+ }
+
public AbstractButton getButton(VCSEntryLocation modelName) {
switch (modelName) {
case ALL:
@@ -50,7 +64,7 @@
case UNKNOW:
return null;
}
- throw new IllegalStateException("no popup found for " + modelName);
+ throw new IllegalStateException("no button found for " + modelName);
}
protected AbstractAction createLocationAction(VCSEntryLocation location) {
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUIHandler.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUIHandler.java 2008-04-13 19:14:00 UTC (rev 517)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUIHandler.java 2008-04-13 19:29:47 UTC (rev 518)
@@ -16,6 +16,7 @@
import org.codelutin.vcs.VCSEntry;
import org.codelutin.vcs.type.VCSAction;
+import org.codelutin.vcs.type.VCSEntryLocation;
import org.codelutin.vcs.ui.ConfirmUI;
import org.codelutin.vcs.ui.DiffUI;
import org.codelutin.vcs.ui.VCSUIFactory;
@@ -66,6 +67,7 @@
entries = model.filter(VCSAction.DIFF, model.getEntries());
}
log.info("nb entries:" + entries.size());
+ ui.getButton(model.getLocation()).setSelected(false);
ui.getHandler().getModel().init(model.getLocation(), entries.toArray(new VCSEntry[entries.size()]));
ui.getContentScroll().setEnabled(entries.size() > 1);
ui.setVisible(true);
@@ -78,7 +80,7 @@
entries = model.filter(VCSAction.CHANGELOG, model.getEntries());
}
log.info("nb entries:" + entries.size());
- ui.getHandler().getModel().init(model.getLocation(), entries.toArray(new VCSEntry[entries.size()]));
+ ui.getHandler().getModel().init(VCSEntryLocation.REMOTE, entries.toArray(new VCSEntry[entries.size()]));
ui.getContentScroll().setEnabled(entries.size() > 1);
ui.setVisible(true);
}
@@ -90,6 +92,5 @@
// do refresh of all states
model.refresh(System.nanoTime(), entries);
}
-
-
+
}
\ No newline at end of file
Modified: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/common.css
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/common.css 2008-04-13 19:14:00 UTC (rev 517)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/common.css 2008-04-13 19:29:47 UTC (rev 518)
@@ -46,7 +46,9 @@
rowSelectionAllowed: true;
rowMargin: 0;
}
-
+#localEditorScroll,#remoteEditorScroll{
+ font-size:10;
+}
.updateTable, .confirmTable {
selectionMode: 2;
}
1
0
r517 - in trunk/lutinvcs/ui/jaxx/src/main: resources/icons uimodel/org/codelutin/vcs/ui
by tchemit@users.labs.libre-entreprise.org 13 Apr '08
by tchemit@users.labs.libre-entreprise.org 13 Apr '08
13 Apr '08
Author: tchemit
Date: 2008-04-13 19:14:00 +0000 (Sun, 13 Apr 2008)
New Revision: 517
Added:
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-file-next.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-file-prev.png
Modified:
trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxChangelogUI.jaxx
trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxDiffUI.jaxx
Log:
next - prev file actions
Added: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-file-next.png
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-file-next.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-file-prev.png
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-file-prev.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxChangelogUI.jaxx
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxChangelogUI.jaxx 2008-04-13 19:13:34 UTC (rev 516)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxChangelogUI.jaxx 2008-04-13 19:14:00 UTC (rev 517)
@@ -1,4 +1,4 @@
-<ChangelogUI title='lutinvcs.changelog.title' modal="true" defaultCloseOperation='DISPOSE_ON_CLOSE' height='600' width='500'>
+<ChangelogUI title='lutinvcs.changelog.title' modal="true" defaultCloseOperation='DISPOSE_ON_CLOSE' height='400' width='500'>
<style source="common.css"/>
<script>
import static org.codelutin.vcs.type.VCSAction.*;
@@ -12,10 +12,11 @@
<JToggleButton id='localTab' action='{createLocationAction(LOCAL)}'/>
<JToggleButton id='remoteTab' action='{createLocationAction(REMOTE)}'/>
<JSeparator orientation="vertical"/>
+ <JButton id='previousFile' action='{createFileAction(true)}'/>
+ <JButton id='nextFile' action='{createFileAction(false)}'/>
<JButton id='refresh' action='{createAction(REFRESH,true)}'/>
<JSeparator orientation="vertical"/>
<JButton id='update' action='{createAction(UPDATE,true)}'/>
- <!--JButton id='commit' action='{createAction(COMMIT,true)}'/-->
<JButton id='revert' action='{createAction(REVERT,true)}'/>
<JSeparator orientation="vertical"/>
<JButton id='help' action='{createHelpAction()}'/>
Modified: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxDiffUI.jaxx
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxDiffUI.jaxx 2008-04-13 19:13:34 UTC (rev 516)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxDiffUI.jaxx 2008-04-13 19:14:00 UTC (rev 517)
@@ -12,8 +12,10 @@
<JToggleButton id='localTab' action='{createLocationAction(LOCAL)}'/>
<JToggleButton id='remoteTab' action='{createLocationAction(REMOTE)}'/>
<JSeparator orientation="vertical"/>
+ <JButton id='previousFile' action='{createFileAction(true)}'/>
+ <JButton id='nextFile' action='{createFileAction(false)}'/>
<JButton id='refresh' action='{createAction(REFRESH,true)}'/>
- <JSeparator orientation="vertical"/>
+ <JSeparator orientation="vertical"/>
<JButton id='nextDiff' action='{createDiffAction(false)}'/>
<JButton id='previousDiff' action='{createDiffAction(true)}'/>
<JSeparator orientation="vertical"/>
1
0
r516 - trunk/lutinvcs/ui/jaxx/src/main/resources
by tchemit@users.labs.libre-entreprise.org 13 Apr '08
by tchemit@users.labs.libre-entreprise.org 13 Apr '08
13 Apr '08
Author: tchemit
Date: 2008-04-13 19:13:34 +0000 (Sun, 13 Apr 2008)
New Revision: 516
Removed:
trunk/lutinvcs/ui/jaxx/src/main/resources/vcs-jaxx.rules
Log:
no more i18n-ParserJaxx use
Deleted: trunk/lutinvcs/ui/jaxx/src/main/resources/vcs-jaxx.rules
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/resources/vcs-jaxx.rules 2008-04-13 17:13:21 UTC (rev 515)
+++ trunk/lutinvcs/ui/jaxx/src/main/resources/vcs-jaxx.rules 2008-04-13 19:13:34 UTC (rev 516)
@@ -1,3 +0,0 @@
-//SynchUI/@title
-//DiffUI/@title
-//ConfirmUI/@title
\ No newline at end of file
1
0
r515 - in trunk/lutinvcs/ui/jaxx/src/main: resources/i18n resources/icons uimodel/org/codelutin/vcs/ui
by tchemit@users.labs.libre-entreprise.org 13 Apr '08
by tchemit@users.labs.libre-entreprise.org 13 Apr '08
13 Apr '08
Author: tchemit
Date: 2008-04-13 17:13:21 +0000 (Sun, 13 Apr 2008)
New Revision: 515
Added:
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-changelog.png
trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxChangelogUI.jaxx
Modified:
trunk/lutinvcs/ui/jaxx/src/main/resources/i18n/jaxx-en_GB.properties
trunk/lutinvcs/ui/jaxx/src/main/resources/i18n/jaxx-fr_FR.properties
trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxSynchUI.jaxx
trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxVCSUIProvider.java
Log:
add changelog ui
Modified: trunk/lutinvcs/ui/jaxx/src/main/resources/i18n/jaxx-en_GB.properties
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/resources/i18n/jaxx-en_GB.properties 2008-04-13 17:12:54 UTC (rev 514)
+++ trunk/lutinvcs/ui/jaxx/src/main/resources/i18n/jaxx-en_GB.properties 2008-04-13 17:13:21 UTC (rev 515)
@@ -1,3 +1,4 @@
+lutinvcs.changelog.title=Changelog UI
lutinvcs.commit.message=Please fill a message for your commit
lutinvcs.confirm.title=Confirm UI
lutinvcs.diff.title=Diff UI
Modified: trunk/lutinvcs/ui/jaxx/src/main/resources/i18n/jaxx-fr_FR.properties
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/resources/i18n/jaxx-fr_FR.properties 2008-04-13 17:12:54 UTC (rev 514)
+++ trunk/lutinvcs/ui/jaxx/src/main/resources/i18n/jaxx-fr_FR.properties 2008-04-13 17:13:21 UTC (rev 515)
@@ -1,3 +1,4 @@
+lutinvcs.changelog.title=Changelog UI
lutinvcs.commit.message=Renseigner le message de publication
lutinvcs.confirm.title=Confirm UI
lutinvcs.diff.title=Diff UI
Added: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-changelog.png
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-changelog.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxChangelogUI.jaxx (from rev 511, trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxDiffUI.jaxx)
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxChangelogUI.jaxx (rev 0)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxChangelogUI.jaxx 2008-04-13 17:13:21 UTC (rev 515)
@@ -0,0 +1,40 @@
+<ChangelogUI title='lutinvcs.changelog.title' modal="true" defaultCloseOperation='DISPOSE_ON_CLOSE' height='600' width='500'>
+ <style source="common.css"/>
+ <script>
+ import static org.codelutin.vcs.type.VCSAction.*;
+ import static org.codelutin.vcs.type.VCSEntryLocation.*;
+ </script>
+ <Table>
+ <row fill='both'>
+ <cell fill='both' weightx='1'>
+ <JToolBar>
+ <JToggleButton id='allTab' action='{createLocationAction(ALL)}'/>
+ <JToggleButton id='localTab' action='{createLocationAction(LOCAL)}'/>
+ <JToggleButton id='remoteTab' action='{createLocationAction(REMOTE)}'/>
+ <JSeparator orientation="vertical"/>
+ <JButton id='refresh' action='{createAction(REFRESH,true)}'/>
+ <JSeparator orientation="vertical"/>
+ <JButton id='update' action='{createAction(UPDATE,true)}'/>
+ <!--JButton id='commit' action='{createAction(COMMIT,true)}'/-->
+ <JButton id='revert' action='{createAction(REVERT,true)}'/>
+ <JSeparator orientation="vertical"/>
+ <JButton id='help' action='{createHelpAction()}'/>
+ </JToolBar>
+ </cell>
+ </row>
+ <row fill='both'>
+ <cell fill='both'>
+ <JScrollPane id='contentScroll' styleClass='diffScroll' height='100'>
+ <JTable id="contentTable" styleClass='diffTable'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ <row fill='both'>
+ <cell fill='both' weighty='1' weightx='1'>
+ <JScrollPane id='changelogScroll' styleClass='diffScroll'>
+ <JTextArea id="changelogContent" editable='false'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ </Table>
+</ChangelogUI>
Modified: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxSynchUI.jaxx
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxSynchUI.jaxx 2008-04-13 17:12:54 UTC (rev 514)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxSynchUI.jaxx 2008-04-13 17:13:21 UTC (rev 515)
@@ -7,6 +7,7 @@
<JPopupMenu id="popup" invoker='{contentTable}'>
<JMenuItem id='refresh' action='{createAction(REFRESH,true)}' font-size='10'/>
<JMenuItem id='diff' action='{createAction(DIFF,true)}' font-size='10'/>
+ <JMenuItem id='changelog' action='{createAction(CHANGELOG,true)}' font-size='10'/>
<JSeparator/>
<JMenuItem id='update' action='{createAction(UPDATE,true)}' font-size='10'/>
<JMenuItem id='revert' action='{createAction(REVERT,true)}' font-size='10'/>
@@ -26,6 +27,7 @@
<JSeparator orientation="vertical"/>
<JButton id='refreshAll' action='{createAction(REFRESH,false)}'/>
<JButton id='diffAll' action='{createAction(DIFF,false)}'/>
+ <JButton id='changelogAll' action='{createAction(CHANGELOG,false)}'/>
<JSeparator orientation="vertical"/>
<JButton id='updateAll' action='{createAction(UPDATE,false)}'/>
<JButton id='revertAll' action='{createAction(REVERT,false)}'/>
Modified: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxVCSUIProvider.java
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxVCSUIProvider.java 2008-04-13 17:12:54 UTC (rev 514)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxVCSUIProvider.java 2008-04-13 17:13:21 UTC (rev 515)
@@ -18,6 +18,6 @@
public class JaxxVCSUIProvider extends VCSUIProvider {
public JaxxVCSUIProvider() {
- super("jaxx", JaxxSynchUI.class, JaxxDiffUI.class, JaxxConfirmUI.class);
+ super("jaxx", JaxxSynchUI.class, JaxxDiffUI.class, JaxxChangelogUI.class,JaxxConfirmUI.class);
}
}
\ No newline at end of file
1
0
r514 - in trunk/lutinvcs: core/src/main/java/org/codelutin/vcs/type ui/common/src/main/java/org/codelutin/vcs/ui/util
by tchemit@users.labs.libre-entreprise.org 13 Apr '08
by tchemit@users.labs.libre-entreprise.org 13 Apr '08
13 Apr '08
Author: tchemit
Date: 2008-04-13 17:12:54 +0000 (Sun, 13 Apr 2008)
New Revision: 514
Modified:
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSAction.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSState.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUI.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUIHandler.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIAction.java
Log:
add changelog ui
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSAction.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSAction.java 2008-04-13 17:12:21 UTC (rev 513)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSAction.java 2008-04-13 17:12:54 UTC (rev 514)
@@ -55,7 +55,7 @@
/** to acquire a file from repository */
CHECKOUT(n_("lutinvcs.action.checkout"), true, false, false, false),
/** to obtain the changelog of a file */
- CHANGELOG(n_("lutinvcs.action.changeLog"), false, false, false, false),
+ CHANGELOG(n_("lutinvcs.action.changeLog"), true, false, false, false),
/** to obtain diif */
DIFF(n_("lutinvcs.action.diff"), false, false, false, false);
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSState.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSState.java 2008-04-13 17:12:21 UTC (rev 513)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSState.java 2008-04-13 17:12:54 UTC (rev 514)
@@ -10,6 +10,9 @@
import static org.codelutin.vcs.type.VCSAction.OVERWRITE_AND_UPDATE;
import static org.codelutin.vcs.type.VCSAction.REVERT;
import static org.codelutin.vcs.type.VCSAction.UPDATE;
+import static org.codelutin.vcs.type.VCSEntryLocation.ALL;
+import static org.codelutin.vcs.type.VCSEntryLocation.LOCAL;
+import static org.codelutin.vcs.type.VCSEntryLocation.REMOTE;
import java.util.ArrayList;
import java.util.Arrays;
@@ -30,7 +33,7 @@
* <br/>
* The only action for this state is to delete the file, nothing else.
*/
- UP_TO_DATE("uptodate", n_("lutinvcs.state.uptodate"), VCSEntryLocation.ALL, DELETE),
+ UP_TO_DATE("uptodate", n_("lutinvcs.state.uptodate"), ALL, DELETE),
/**
* when a local file matches a remote copy but not the latest one.
@@ -42,7 +45,7 @@
* <li>{@link VCSAction#CHANGELOG}</li>
* </ul>
*/
- OUT_OF_DATE("outofdate", n_("lutinvcs.state.outofdate"), VCSEntryLocation.REMOTE, UPDATE, DIFF, CHANGELOG),
+ OUT_OF_DATE("outofdate", n_("lutinvcs.state.outofdate"), REMOTE, UPDATE, DIFF, CHANGELOG),
/**
* when a local file does not matches his remote latest copy, but is based
@@ -55,7 +58,7 @@
* <li>{@link VCSAction#DIFF}</li>
* </ul>
*/
- MODIFIED("modified", n_("lutinvcs.state.modified"), VCSEntryLocation.LOCAL, COMMIT, OVERWRITE_AND_UPDATE, REVERT, DIFF),
+ MODIFIED("modified", n_("lutinvcs.state.modified"), LOCAL, COMMIT, OVERWRITE_AND_UPDATE, REVERT, DIFF),
/**
* when a local file does not match the working version remote copy and
@@ -69,7 +72,7 @@
* <li>{@link VCSAction#CHANGELOG}</li>
* </ul>
*/
- OUT_OF_DATE_AND_MODIFIED("outofdateAndModified", n_("lutinvcs.state.outofdateAndModified"), VCSEntryLocation.ALL, OVERWRITE_AND_UPDATE, REVERT, DIFF, CHANGELOG),
+ OUT_OF_DATE_AND_MODIFIED("outofdateAndModified", n_("lutinvcs.state.outofdateAndModified"), ALL, OVERWRITE_AND_UPDATE, REVERT, DIFF, CHANGELOG),
/**
* when a local file does not exist on remote repository.
@@ -78,7 +81,7 @@
* <li>{@link VCSAction#ADD}</li>
* </ul>
*/
- UNVERSIONNED("unversionned", n_("lutinvcs.state.unversionned"), VCSEntryLocation.LOCAL, ADD, REVERT),
+ UNVERSIONNED("unversionned", n_("lutinvcs.state.unversionned"), LOCAL, ADD, REVERT),
/**
* when a file exists on remote repository but not locally.
@@ -87,7 +90,7 @@
* <li>{@link VCSAction#UPDATE}</li>
* </ul>
*/
- MISSING("missing", n_("lutinvcs.state.missing"), VCSEntryLocation.REMOTE, UPDATE),
+ MISSING("missing", n_("lutinvcs.state.missing"), REMOTE, UPDATE, CHANGELOG),
/**
* when a file is unversionned or missing : this special and durty state
@@ -103,9 +106,17 @@
* <p/>
* </ul>
*/
- UNVERSIONNED_OR_MISSING("unversionnedOrMissing", n_("lutinvcs.state.unversionnedOrMissing"), VCSEntryLocation.LOCAL, ADD, UPDATE),
+ UNVERSIONNED_OR_MISSING("unversionnedOrMissing", n_("lutinvcs.state.unversionnedOrMissing"), LOCAL, ADD, UPDATE),
- REMOVED("removed", n_("lutinvcs.state.removed"), VCSEntryLocation.LOCAL, DELETE, REVERT),
+ /**
+ * when a file was removed locally, and still exists on remote repository.
+ * <p/>
+ * this state owns 1 action :
+ * <ul>
+ * <li> {@link VCSAction#DELETE}</li>
+ * </ul>
+ */
+ REMOVED("removed", n_("lutinvcs.state.removed"), LOCAL, DELETE, REVERT),
/** to deal with other cases (...) */
UNKNOWN("unknown", n_("lutinvcs.state.unknown"), null);
@@ -150,11 +161,11 @@
}
public boolean isLocal() {
- return location != VCSEntryLocation.REMOTE;
+ return location != REMOTE;
}
public boolean isRemote() {
- return location != VCSEntryLocation.LOCAL;
+ return location != LOCAL;
}
public boolean authorizeAction(VCSAction... actions) {
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUI.java 2008-04-13 17:12:21 UTC (rev 513)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUI.java 2008-04-13 17:12:54 UTC (rev 514)
@@ -16,8 +16,6 @@
import org.codelutin.vcs.type.VCSAction;
import org.codelutin.vcs.type.VCSEntryLocation;
-import org.codelutin.vcs.ui.action.ChangeLocationAction;
-import org.codelutin.vcs.ui.action.TabUIAction;
import javax.swing.AbstractAction;
import javax.swing.AbstractButton;
@@ -38,7 +36,6 @@
public abstract AbstractButton getUpdate();
- public abstract AbstractButton getCommit();
public abstract AbstractButton getRevert();
@@ -57,11 +54,11 @@
}
protected AbstractAction createLocationAction(VCSEntryLocation location) {
- return ChangeLocationAction.createAction(location, this);
+ return org.codelutin.vcs.ui.action.ChangeLocationAction.createAction(location, this);
}
protected AbstractAction createAction(VCSAction action, boolean useSelection) {
- return TabUIAction.createAction(action, useSelection, this);
+ return org.codelutin.vcs.ui.action.TabUIAction.createAction(action, useSelection, this);
}
}
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUIHandler.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUIHandler.java 2008-04-13 17:12:21 UTC (rev 513)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUIHandler.java 2008-04-13 17:12:54 UTC (rev 514)
@@ -19,6 +19,7 @@
import org.codelutin.vcs.ui.ConfirmUI;
import org.codelutin.vcs.ui.DiffUI;
import org.codelutin.vcs.ui.VCSUIFactory;
+import org.codelutin.vcs.ui.ChangelogUI;
import javax.swing.AbstractButton;
import javax.swing.ListSelectionModel;
@@ -51,25 +52,37 @@
}
public void showConfirmUI(VCSAction action, AbstractVCSEntriesTableModel model, List<VCSEntry> entries) {
- ConfirmUI confirmUI = VCSUIFactory.newConfirmUI();
+ ConfirmUI ui = VCSUIFactory.newConfirmUI();
log.info("nb files:" + entries.size());
- confirmUI.getHandler().getModel().init(action, model.getLocation(), entries.toArray(new VCSEntry[entries.size()]));
- confirmUI.getContentScroll().setEnabled(entries.size() > 1);
- confirmUI.setVisible(true);
+ ui.getHandler().getModel().init(action, model.getLocation(), entries.toArray(new VCSEntry[entries.size()]));
+ ui.getContentScroll().setEnabled(entries.size() > 1);
+ ui.setVisible(true);
}
public void showDiffUI(boolean useSelection, AbstractVCSEntriesTableModel model, List<VCSEntry> entries) {
- DiffUI diffUI = VCSUIFactory.newDiffUI();
+ DiffUI ui = VCSUIFactory.newDiffUI();
if (!useSelection) {
// take all entries
entries = model.filter(VCSAction.DIFF, model.getEntries());
}
log.info("nb entries:" + entries.size());
- diffUI.getHandler().getModel().init(model.getLocation(), entries.toArray(new VCSEntry[entries.size()]));
- diffUI.getContentScroll().setEnabled(entries.size() > 1);
- diffUI.setVisible(true);
+ ui.getHandler().getModel().init(model.getLocation(), entries.toArray(new VCSEntry[entries.size()]));
+ ui.getContentScroll().setEnabled(entries.size() > 1);
+ ui.setVisible(true);
}
+ public void showChangelogUI(boolean useSelection, AbstractVCSEntriesTableModel model, List<VCSEntry> entries) {
+ ChangelogUI ui = VCSUIFactory.newChangelogUI();
+ if (!useSelection) {
+ // take all entries
+ entries = model.filter(VCSAction.CHANGELOG, model.getEntries());
+ }
+ log.info("nb entries:" + entries.size());
+ ui.getHandler().getModel().init(model.getLocation(), entries.toArray(new VCSEntry[entries.size()]));
+ ui.getContentScroll().setEnabled(entries.size() > 1);
+ ui.setVisible(true);
+ }
+
public void doRefresh(AbstractVCSEntriesTableModel model, List<VCSEntry> entries, ListSelectionModel selectionModel) {
log.info(selectionModel);
selectionModel.clearSelection();
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIAction.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIAction.java 2008-04-13 17:12:21 UTC (rev 513)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIAction.java 2008-04-13 17:12:54 UTC (rev 514)
@@ -31,6 +31,9 @@
super(name, icon);
}
+ public AbstractUIAction() {
+ }
+
protected H getHandler() {
checkInit();
if (handler == null) {
1
0