com.sun.electric.tool.cvspm
Class CVS

java.lang.Object
  extended by com.sun.electric.tool.Tool
      extended by com.sun.electric.tool.Listener
          extended by com.sun.electric.tool.cvspm.CVS
All Implemented Interfaces:
Changes, java.lang.Comparable

public class CVS
extends Listener

The CVS Module


Field Summary
 
Fields inherited from class com.sun.electric.tool.Tool
prefs
 
Method Summary
static int askForChoice(java.lang.String message, java.lang.String title, java.util.List<Library> badLibs, java.util.List<Cell> badCells, java.lang.String[] choices, java.lang.String defaultChoice)
           
static boolean assertInCVS(Cell cell, java.lang.String cmd, boolean dialog)
          Returns true if the Cell is in CVS, otherwise generates an error message.
static boolean assertInCVS(Library lib, java.lang.String cmd, boolean dialog)
          Returns true if the library is in CVS, otherwise generates an error message.
static boolean assertNotModified(Cell cell, java.lang.String cmd, boolean dialog)
          Used by commands that require the library to be in sync with the disk.
static void checkoutFromRepository()
           
 void endBatch(Snapshot oldSnapshot, Snapshot newSnapshot, boolean undoRedo)
          Handles database changes of a Job.
static void fixStaleCellReferences(Library reloadedLib)
          Reloading libraries has the side affect that any EditWindows containing cells that were reloaded now point to old, unlinked cells instead of the new ones.
static void fixStaleCellReferences(java.util.List<Library> libs)
          Reloading libraries has the side affect that any EditWindows containing cells that were reloaded now point to old, unlinked cells instead of the new ones.
static java.io.File getCellFile(Cell cell)
          Get the file for the given Cell, assuming the library is in DELIB format.
static java.lang.String getCVSLastCommitMessage()
           
static java.lang.String getCVSProgram()
           
static java.lang.String getCVSRepository()
           
static CVS getCVSTool()
           
 void init()
          The initialization method for this Tool.
static boolean isDELIB(Library lib)
           
static boolean isEnabled()
           
static boolean isFileInCVS(java.io.File fd)
          Returns true if this file has is being maintained from a CVS respository, returns false otherwise.
static boolean isFileInCVS(java.io.File fd, boolean assertScheduledForAdd, boolean assertScheduledForRemove)
          Returns true if this file has is being maintained from a CVS respository, returns false otherwise.
static boolean isInCVS(Cell cell)
          This checks the CVS Entries file to see if the cell is in cvs.
static boolean isInCVS(Library lib)
          This checks the CVS Entries file to see if the library is in cvs (jelib/elib), or if the library dir + header file is in cvs (delib).
static int runCVSCommand(java.lang.String cmd, java.lang.String comment, java.lang.String workingDir, java.io.OutputStream out)
          This will run a CVS command in-thread; i.e.
static void runModalCVSCommand(java.lang.String cmd, java.lang.String comment, java.lang.String workingDir, java.io.OutputStream out)
          This will run a CVS command in a separate Thread and block the GUI until the command completes, or until the user hits 'cancel', which will try to terminate the external command.
static void setCVSLastCommitMessage(java.lang.String s)
           
static void setCVSProgram(java.lang.String s)
           
static void setCVSRepository(java.lang.String s)
           
static void setEnabled(boolean b)
           
static void showError(java.lang.String message, java.lang.String title, java.util.List<Library> badLibs, java.util.List<Cell> badCells)
          Issue an error message
static void testModal()
           
 
Methods inherited from class com.sun.electric.tool.Listener
eraseLibrary, examineCell, killObject, modifyArcInst, modifyCell, modifyCellGroup, modifyExport, modifyLibrary, modifyNodeInst, newObject, readLibrary, renameObject, request, slice, startBatch, writeLibrary
 
Methods inherited from class com.sun.electric.tool.Tool
clearAnalysis, clearBackground, clearFixErrors, clearIncremental, clearOn, clearSynthesis, compareTo, findTool, getIndex, getListeners, getName, getNumTools, getProjectSettings, getTools, initAllTools, initProjectSettings, isAnalysis, isBackground, isFixErrors, isIncremental, isOn, isSynthesis, makeBooleanSetting, makeDoubleSetting, makeIntSetting, makeLongSetting, makeStringSetting, setAnalysis, setBackground, setFixErrors, setIncremental, setOn, setSynthesis, setVarInJob, testAll, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

init

public void init()
Description copied from class: Tool
The initialization method for this Tool. Gets overridden by tools that want to do initialization.

Specified by:
init in interface Changes
Overrides:
init in class Tool

getCVSTool

public static CVS getCVSTool()

endBatch

public void endBatch(Snapshot oldSnapshot,
                     Snapshot newSnapshot,
                     boolean undoRedo)
Handles database changes of a Job.

Specified by:
endBatch in interface Changes
Specified by:
endBatch in class Listener
Parameters:
oldSnapshot - database snapshot before Job.
newSnapshot - database snapshot after Job and constraint propagation.
undoRedo - true if Job was Undo/Redo job.

checkoutFromRepository

public static void checkoutFromRepository()

runCVSCommand

public static int runCVSCommand(java.lang.String cmd,
                                java.lang.String comment,
                                java.lang.String workingDir,
                                java.io.OutputStream out)
This will run a CVS command in-thread; i.e. the current thread will block until the CVS command completes.

Parameters:
cmd - the command to run
comment - the message to display on the dialog
workingDir - the directory in which to run the CVS command (null for current working directory). I recommend you specify this as the current library dir.
out - where the result of the command gets printed. May be a ByteArrayOutputStream for storing it, or just System.out for printing it.
Returns:
the exit value

runModalCVSCommand

public static void runModalCVSCommand(java.lang.String cmd,
                                      java.lang.String comment,
                                      java.lang.String workingDir,
                                      java.io.OutputStream out)
This will run a CVS command in a separate Thread and block the GUI until the command completes, or until the user hits 'cancel', which will try to terminate the external command. This method returns after the cvs command has completed.

Parameters:
cmd - the command to run
comment - the message to display on the dialog
workingDir - the directory in which to run the CVS command (null for current working directory). I recommend you specify this as the current library dir.
out - where the result of the command gets printed. May be a ByteArrayOutputStream for storing it, or just System.out for printing it.

testModal

public static void testModal()

getCellFile

public static java.io.File getCellFile(Cell cell)
Get the file for the given Cell, assuming the library is in DELIB format.

Parameters:
cell - the Cell being examined.
Returns:
the File for the Cell. If its library is not in DELIB format, returns null.

isDELIB

public static boolean isDELIB(Library lib)

isFileInCVS

public static boolean isFileInCVS(java.io.File fd)
Returns true if this file has is being maintained from a CVS respository, returns false otherwise.


isFileInCVS

public static boolean isFileInCVS(java.io.File fd,
                                  boolean assertScheduledForAdd,
                                  boolean assertScheduledForRemove)
Returns true if this file has is being maintained from a CVS respository, returns false otherwise.


isInCVS

public static boolean isInCVS(Library lib)
This checks the CVS Entries file to see if the library is in cvs (jelib/elib), or if the library dir + header file is in cvs (delib).

Parameters:
lib -
Returns:
true if the library is in cvs, false otherwise.

isInCVS

public static boolean isInCVS(Cell cell)
This checks the CVS Entries file to see if the cell is in cvs. If the cell belongs to a delib, it checks the cell file. Otherwise, it checks the library file for jelib/elibs.

Parameters:
cell -
Returns:
true if the cell is in cvs, false otherwise

assertNotModified

public static boolean assertNotModified(Cell cell,
                                        java.lang.String cmd,
                                        boolean dialog)
Used by commands that require the library to be in sync with the disk.

Parameters:
cell -
dialog - true to pop up a dialog to tell the user, false to not do so.
Returns:
true if not modified, false if modified

assertInCVS

public static boolean assertInCVS(Library lib,
                                  java.lang.String cmd,
                                  boolean dialog)
Returns true if the library is in CVS, otherwise generates an error message.

Parameters:
lib - the library to check
cmd - the CVS command (for error message display)
dialog - true to show a modal dialog, false to write error to message window
Returns:
true if it is in cvs, false otherwise

assertInCVS

public static boolean assertInCVS(Cell cell,
                                  java.lang.String cmd,
                                  boolean dialog)
Returns true if the Cell is in CVS, otherwise generates an error message.

Parameters:
cell - the cell to check
cmd - the CVS command (for error message display)
dialog - true to show a modal dialog, false to write error to message window
Returns:
true if it is in cvs, false otherwise

showError

public static void showError(java.lang.String message,
                             java.lang.String title,
                             java.util.List<Library> badLibs,
                             java.util.List<Cell> badCells)
Issue an error message

Parameters:
message -
title -
badLibs -
badCells -

askForChoice

public static int askForChoice(java.lang.String message,
                               java.lang.String title,
                               java.util.List<Library> badLibs,
                               java.util.List<Cell> badCells,
                               java.lang.String[] choices,
                               java.lang.String defaultChoice)

fixStaleCellReferences

public static void fixStaleCellReferences(java.util.List<Library> libs)
Reloading libraries has the side affect that any EditWindows containing cells that were reloaded now point to old, unlinked cells instead of the new ones. This method checks for this state and fixes it.


fixStaleCellReferences

public static void fixStaleCellReferences(Library reloadedLib)
Reloading libraries has the side affect that any EditWindows containing cells that were reloaded now point to old, unlinked cells instead of the new ones. This method checks for this state and fixes it.


isEnabled

public static boolean isEnabled()

setEnabled

public static void setEnabled(boolean b)

getCVSProgram

public static java.lang.String getCVSProgram()

setCVSProgram

public static void setCVSProgram(java.lang.String s)

getCVSRepository

public static java.lang.String getCVSRepository()

setCVSRepository

public static void setCVSRepository(java.lang.String s)

getCVSLastCommitMessage

public static java.lang.String getCVSLastCommitMessage()

setCVSLastCommitMessage

public static void setCVSLastCommitMessage(java.lang.String s)