r358 - trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs
Author: tchemit Date: 2008-04-05 20:36:07 +0000 (Sat, 05 Apr 2008) New Revision: 358 Modified: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSState.java Log: use VCSEntryLocation as property to VCSState Modified: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSState.java =================================================================== --- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSState.java 2008-04-05 20:35:25 UTC (rev 357) +++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSState.java 2008-04-05 20:36:07 UTC (rev 358) @@ -30,7 +30,7 @@ * <br/> * The only action for this state is to delete the file, nothing else. */ - UP_TO_DATE("uptodate", n_("lutinvcs.state.uptodate"), false, false, DELETE), + UP_TO_DATE("uptodate", n_("lutinvcs.state.uptodate"), VCSEntryLocation.ALL, DELETE), /** * when a local file matches a remote copy but not the latest one. @@ -42,8 +42,7 @@ * <li>{@link VCSAction#CHANGELOG}</li> * </ul> */ - OUT_OF_DATE("outofdate", n_("lutinvcs.state.outofdate"), false, true, - UPDATE, DIFF, CHANGELOG), + OUT_OF_DATE("outofdate", n_("lutinvcs.state.outofdate"), VCSEntryLocation.REMOTE, UPDATE, DIFF, CHANGELOG), /** * when a local file does not matches his remote latest copy, but is based @@ -56,8 +55,7 @@ * <li>{@link VCSAction#DIFF}</li> * </ul> */ - MODIFIED("modified", n_("lutinvcs.state.modified"), true, false, - COMMIT, OVERWRITE_AND_UPDATE, REVERT, DIFF), + MODIFIED("modified", n_("lutinvcs.state.modified"), VCSEntryLocation.LOCAL, COMMIT, OVERWRITE_AND_UPDATE, REVERT, DIFF), /** * when a local file does not match the working version remote copy and @@ -71,9 +69,7 @@ * <li>{@link VCSAction#CHANGELOG}</li> * </ul> */ - OUT_OF_DATE_AND_MODIFIED("outofdateAndModified", - n_("lutinvcs.state.outofdateAndModified"), true, true, - OVERWRITE_AND_UPDATE, REVERT, DIFF, CHANGELOG), + OUT_OF_DATE_AND_MODIFIED("outofdateAndModified", n_("lutinvcs.state.outofdateAndModified"), VCSEntryLocation.ALL, OVERWRITE_AND_UPDATE, REVERT, DIFF, CHANGELOG), /** * when a local file does not exist on remote repository. @@ -82,7 +78,7 @@ * <li>{@link VCSAction#ADD}</li> * </ul> */ - UNVERSIONNED("unversionned", n_("lutinvcs.state.unversionned"), true, false, ADD, REVERT), + UNVERSIONNED("unversionned", n_("lutinvcs.state.unversionned"), VCSEntryLocation.LOCAL, ADD, REVERT), /** * when a file exists on remote repository but not locally. @@ -91,7 +87,7 @@ * <li>{@link VCSAction#UPDATE}</li> * </ul> */ - MISSING("missing", n_("lutinvcs.state.missing"), false, true, UPDATE), + MISSING("missing", n_("lutinvcs.state.missing"), VCSEntryLocation.REMOTE, UPDATE), /** * when a file is unversionned or missing : this special and durty state @@ -107,35 +103,34 @@ * <p/> * </ul> */ - UNVERSIONNED_OR_MISSING("unversionnedOrMissing", - n_("lutinvcs.state.unversionnedOrMissing"), true, true, ADD, UPDATE), + UNVERSIONNED_OR_MISSING("unversionnedOrMissing", n_("lutinvcs.state.unversionnedOrMissing"), VCSEntryLocation.LOCAL, ADD, UPDATE), - REMOVED("removed", n_("lutinvcs.state.removed"), true, false, DELETE, REVERT), + REMOVED("removed", n_("lutinvcs.state.removed"), VCSEntryLocation.LOCAL, DELETE, REVERT), /** to deal with other cases (...) */ - UNKNOWN("unknown", n_("lutinvcs.state.unknown"), true, false); + UNKNOWN("unknown", n_("lutinvcs.state.unknown"), null); /** libelle to be used */ private final String libelle; /** key of the state */ private final String key; - /** flag to indicate if state is on a local file */ - private final boolean local; - /** flag to indicate if state is on a remote file */ - private final boolean remote; + /** VCSAction associated with this state */ private final List<VCSAction> actions; - VCSState(String key, String libelle, boolean local, boolean remote, VCSAction... actions) { + /** location of the state */ + private VCSEntryLocation location; + + VCSState(String key, String libelle, VCSEntryLocation location, VCSAction... actions) { + this.location = location; this.libelle = libelle; List<VCSAction> actions1 = new ArrayList<VCSAction>(Arrays.asList(actions)); // refresh action is enabled for all states actions1.add(VCSAction.REFRESH); this.actions = Collections.unmodifiableList(actions1); this.key = key; - this.local = local; - this.remote = remote; + } public String libelle() { @@ -150,12 +145,16 @@ return key; } + public VCSEntryLocation getLocation() { + return location; + } + public boolean isLocal() { - return local; + return location != VCSEntryLocation.REMOTE; } public boolean isRemote() { - return remote; + return location != VCSEntryLocation.LOCAL; } public boolean authorizeAction(VCSAction... actions) {
participants (1)
-
tchemit@users.labs.libre-entreprise.org