com.sun.electric.tool.user.menus
Class FileMenu

java.lang.Object
  extended by com.sun.electric.tool.user.menus.FileMenu

public class FileMenu
extends java.lang.Object

Class to handle the commands in the "File" pulldown menu.


Nested Class Summary
static class FileMenu.ClearCellDate
          Class to clear the date information on a Cell.
static class FileMenu.CreateCellWindow
          Class to display a new window.
static class FileMenu.ImportLibrary
          Class to import a library in a new thread.
static class FileMenu.QuitJob
          Class to quit Electric in a Job.
static class FileMenu.ReadLibrary
          Class to read a library in a new thread.
static class FileMenu.SaveAllLibrariesInFormatJob
           
 
Field Summary
static EMenu openRecentLibs
           
 
Constructor Summary
FileMenu()
           
 
Method Summary
static void closeLibraryCommand(Library lib)
           
static void exportCommand(FileType type, boolean isNetlist)
          This method implements the export cell command for different export types.
static void forceQuit()
          Unsafe way to force Electric to quit.
static boolean forceSave(boolean confirm)
          Force saving of libraries.
static FileType getLibraryFormat(java.lang.String fileName, FileType defaultType)
          Get the type from the fileName, or if no valid Library type found, return defaultType.
static void importLibraryCommand(FileType type)
          This method implements the command to import a library (Readable Dump or JELIB format).
static void importToCurrentCellCommand(FileType type)
          This method implements the command to import a file to a library It is interactive, and pops up a dialog box.
static void newLibraryCommand()
           
static void openLibraryCommand()
          This method implements the command to read a library.
static void openLibraryCommand(java.net.URL file)
          This method implements the command to read a library.
static void pageSetupCommand()
           
static java.util.Collection<com.sun.electric.tool.user.menus.FileMenu.RenameAndSaveLibraryTask> preventLoss(Library desiredLib, int action)
          Method to check if one or more libraries are saved.
static void printCommand()
          This method implements the command to print the current window.
static boolean quitCommand()
          This method implements the command to quit Electric.
static void saveAllLibrariesCommand()
          This method implements the command to save all libraries.
static void saveAllLibrariesCommand(FileType type, boolean compatibleWith6, boolean forceToType)
           
static void saveAllLibrariesInFormatCommand()
           
static void saveAsLibraryCommand(Library lib)
          This method implements the command to save a library to a different file.
static boolean saveLibraryCommand(Library lib)
          This method implements the command to save a library.
static boolean saveLibraryCommand(Library lib, FileType type, boolean compatibleWith6, boolean forceToType, boolean saveAs)
          This method implements the command to save a library.
static com.sun.electric.tool.user.menus.FileMenu.RenameAndSaveLibraryTask saveLibraryRequest(Library lib, FileType type, boolean compatibleWith6, boolean forceToType, boolean saveAs)
          This method ask user anout details to save a library.
static int showFileMenuOptionDialog(java.awt.Component parentComponent, java.lang.Object message, java.lang.String title, int optionType, int messageType, javax.swing.Icon icon, java.lang.Object[] options, java.lang.Object initialValue, java.lang.String toolTipMessage)
          Based on JOptionPane but allows ToolTip text
static void updateRecentlyOpenedLibrariesList()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

openRecentLibs

public static final EMenu openRecentLibs
Constructor Detail

FileMenu

public FileMenu()
Method Detail

newLibraryCommand

public static void newLibraryCommand()

openLibraryCommand

public static void openLibraryCommand()
This method implements the command to read a library. It is interactive, and pops up a dialog box.


openLibraryCommand

public static void openLibraryCommand(java.net.URL file)
This method implements the command to read a library. It takes library URL from a parameter.

Parameters:
file - URL of a library

getLibraryFormat

public static FileType getLibraryFormat(java.lang.String fileName,
                                        FileType defaultType)
Get the type from the fileName, or if no valid Library type found, return defaultType.


updateRecentlyOpenedLibrariesList

public static void updateRecentlyOpenedLibrariesList()

importToCurrentCellCommand

public static void importToCurrentCellCommand(FileType type)
This method implements the command to import a file to a library It is interactive, and pops up a dialog box.


importLibraryCommand

public static void importLibraryCommand(FileType type)
This method implements the command to import a library (Readable Dump or JELIB format). It is interactive, and pops up a dialog box.


closeLibraryCommand

public static void closeLibraryCommand(Library lib)

saveLibraryCommand

public static boolean saveLibraryCommand(Library lib)
This method implements the command to save a library. It is interactive, and pops up a dialog box.

Parameters:
lib - the Library to save.
Returns:
true if library saved, false otherwise.

saveLibraryCommand

public static boolean saveLibraryCommand(Library lib,
                                         FileType type,
                                         boolean compatibleWith6,
                                         boolean forceToType,
                                         boolean saveAs)
This method implements the command to save a library. It is interactive, and pops up a dialog box.

Parameters:
lib - the Library to save.
type - the format of the library (OpenFile.Type.ELIB, OpenFile.Type.READABLEDUMP, or OpenFile.Type.JELIB).
compatibleWith6 - true to write a library that is compatible with version 6 Electric.
forceToType -
saveAs - true if this is a "save as" and should always prompt for a file name.
Returns:
true if library saved, false otherwise.

saveLibraryRequest

public static com.sun.electric.tool.user.menus.FileMenu.RenameAndSaveLibraryTask saveLibraryRequest(Library lib,
                                                                                                    FileType type,
                                                                                                    boolean compatibleWith6,
                                                                                                    boolean forceToType,
                                                                                                    boolean saveAs)
This method ask user anout details to save a library. It is interactive, and pops up a dialog box.

Parameters:
lib - the Library to save.
type - the format of the library (OpenFile.Type.ELIB, OpenFile.Type.READABLEDUMP, or OpenFile.Type.JELIB).
compatibleWith6 - true to write a library that is compatible with version 6 Electric.
forceToType -
saveAs - true if this is a "save as" and should always prompt for a file name.
Returns:
save details if library saved, null otherwise.

saveAsLibraryCommand

public static void saveAsLibraryCommand(Library lib)
This method implements the command to save a library to a different file. It is interactive, and pops up a dialog box.


saveAllLibrariesCommand

public static void saveAllLibrariesCommand()
This method implements the command to save all libraries.


saveAllLibrariesCommand

public static void saveAllLibrariesCommand(FileType type,
                                           boolean compatibleWith6,
                                           boolean forceToType)

saveAllLibrariesInFormatCommand

public static void saveAllLibrariesInFormatCommand()

exportCommand

public static void exportCommand(FileType type,
                                 boolean isNetlist)
This method implements the export cell command for different export types. It is interactive, and pops up a dialog box.


pageSetupCommand

public static void pageSetupCommand()

printCommand

public static void printCommand()
This method implements the command to print the current window.


quitCommand

public static boolean quitCommand()
This method implements the command to quit Electric.


preventLoss

public static java.util.Collection<com.sun.electric.tool.user.menus.FileMenu.RenameAndSaveLibraryTask> preventLoss(Library desiredLib,
                                                                                                                   int action)
Method to check if one or more libraries are saved. If the quit/close/replace operation may be continued, returns libraries to be saved before. This Collection can be empty. If the operation should be aborted, returns null

Parameters:
desiredLib - the library to check for being saved. If desiredLib is null, all libraries are checked.
action - the type of action that will occur: 0: quit; 1: close a library; 2: replace a library.
Returns:
libraries to be saved or null

showFileMenuOptionDialog

public static int showFileMenuOptionDialog(java.awt.Component parentComponent,
                                           java.lang.Object message,
                                           java.lang.String title,
                                           int optionType,
                                           int messageType,
                                           javax.swing.Icon icon,
                                           java.lang.Object[] options,
                                           java.lang.Object initialValue,
                                           java.lang.String toolTipMessage)
                                    throws java.awt.HeadlessException
Based on JOptionPane but allows ToolTip text

Parameters:
parentComponent -
message -
title -
optionType -
messageType -
icon -
options -
initialValue -
Returns:
the return value of the JOptionPane choice. Returns -1 if aborted
Throws:
java.awt.HeadlessException

forceQuit

public static void forceQuit()
Unsafe way to force Electric to quit. If this method returns, it obviously did not kill electric (because of user input or some other reason).


forceSave

public static boolean forceSave(boolean confirm)
Force saving of libraries. This does not run in a Job, and could generate corrupt libraries. This saves all libraries to a new directory called "panic" in the current directory.

Parameters:
confirm - true to pop up confirmation dialog, false to just try to save
Returns:
true if libraries saved (if they needed saving), false otherwise