edu.rice.cs.drjava.ui
Class MainFrame

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by edu.rice.cs.util.swing.SwingFrame
                          extended by edu.rice.cs.drjava.ui.MainFrame
All Implemented Interfaces:
ClipboardOwner, DropTargetListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, RootPaneContainer, WindowConstants

public class MainFrame
extends SwingFrame
implements ClipboardOwner, DropTargetListener

DrJava's main window.

See Also:
Serialized Form

Nested Class Summary
static class MainFrame.GoToFileListEntry
          Wrapper class for the "Go to File" and "Auto-Complete" dialog list entries.
static class MainFrame.JavaAPIListEntry
          Wrapper class for the "Open Javadoc" and "Auto Import" dialog list entries.
 
Nested classes/interfaces inherited from class javax.swing.JFrame
JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  Action _clearLineAction
          Deletes text from the caret to the end of the current line.
protected  Action _cutLineAction
          Cuts from the caret to the end of the current line to the clipboard.
 FocusListener _focusListenerForRecentDocs
           
 KeyListener _historyListener
          These listeners support the traversal operations that cycle through recent documents.
 Component _lastFocusOwner
           
protected  Window _modalWindowAdapterOwner
          The owner of the modal window listener has already been taken by another window.
protected  HashMap<Window,WindowAdapter> _modalWindowAdapters
          Window adapter for "pseudo-modal" dialogs, i.e.
 Action _newFileFolderAction
          Creates a new untitled, empty file in the current folder.
 JTabbedPane _tabbedPane
           
 LinkedList<TabbedPanel> _tabs
           
static Icon FIND_ICON
           
static long UPDATE_DELAY
           
static int UPDATER_PRIORITY
           
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
MainFrame()
          Creates the main window, and shows it.
 
Method Summary
 JButton _createToolbarButton(Action a)
          Sets up all buttons for the toolbar except for undo and redo, which use _createManualToolbarButton.
protected  void _disableInteractionsPane()
          Ensures that the interactions pane is not editable during an interaction.
protected  void _enableInteractionsPane()
          Ensures that the interactions pane is editable after an interaction completes.
static List<MainFrame.JavaAPIListEntry> _generateJavaAPIList(String base, String stripPrefix, String suffix)
          Generate Java API class list.
 int _jumpToLine(int lineNum)
          Jump to the specified line and return the offset.
 JButton _updateToolbarButton(JButton b, Action a)
          Removes the button b from the toolbar and creates new button in its place.
 void addComponentListenerToOpenDocumentsList(ComponentListener listener)
           
 void addToBrowserHistory()
          Add the current location to the browser history.
 void clearStatusMessage()
          Sets the message text in the status bar to the null string.
 void commentLines()
          Comment current selection using wing commenting.
 void createBookmarks()
          Adds the bookmarks panel to the tabbed pane.
 void createBreakpoints()
          Adds the breakpoints panel to the tabbed pane.
 FindResultsPanel createFindResultsPanel(RegionManager<MovingDocumentRegion> rm, String title, String searchString, boolean searchAll, boolean matchCase, boolean wholeWord, boolean noComments, boolean noTestCases, WeakReference<OpenDefinitionsDocument> doc, edu.rice.cs.drjava.ui.FindReplacePanel findReplace)
          Create a new find results tab.
 void debuggerToggle()
          Toggles whether the debugger is enabled or disabled, and updates the display accordingly.
 void dragEnter(DropTargetDragEvent dropTargetDragEvent)
          User dragged something into the component.
 void dragExit(DropTargetEvent dropTargetEvent)
           
 void dragOver(DropTargetDragEvent dropTargetDragEvent)
           
 void drop(DropTargetDropEvent dropTargetDropEvent)
          User dropped something on the component.
 void dropActionChanged(DropTargetDragEvent dropTargetDragEvent)
           
 void enableResetInteractions()
           
 HashMap<OpenDefinitionsDocument,DocumentInfoGetter> gatherProjectDocInfo()
           
 void generateJavaAPIList()
          Generate Java API class list.
 boolean getAllowKeyEvents()
           
 DefinitionsPane getCurrentDefPane()
          Returns the current DefinitionsPane.
 File getCurrentProject()
           
 DefinitionsPane getDefPaneGivenODD(OpenDefinitionsDocument doc)
           
 JViewport getDefViewport()
           
 JMenu getEditMenu()
          For test purposes only.
static edu.rice.cs.drjava.ui.MainFrame.DJFileDisplayManager getFileDisplayManager20()
           
static edu.rice.cs.drjava.ui.MainFrame.DJFileDisplayManager getFileDisplayManager30()
           
 String getFileNameField()
          For test purposes only.
static ImageIcon getIcon(String name)
           
 long getLastChangeTime()
          Returns the changed status of the MainFrame.
 SingleDisplayModel getModel()
           
 DisplayManager<INavigatorItem> getNavPaneDisplayManager()
           
static edu.rice.cs.drjava.ui.MainFrame.OddDisplayManager getOddDisplayManager20()
           
static edu.rice.cs.drjava.ui.MainFrame.OddDisplayManager getOddDisplayManager30()
           
 File[] getOpenFiles(JFileChooser jfc)
          Prompt the user to select a place to open files from, then load them.
 File getSaveFile(JFileChooser jfc)
          Prompt the user to select a place to save the current document.
 ErrorPanel getSelectedErrorPanel()
          Returns the currently shown error panel if there is one.
 void gotoFileMatchingMask(String mask)
          Goes to the file matching the specified mask.
 void goToRegionAndHighlight(IDocumentRegion r)
           
 void hideDebugger()
          Hide the debugger tab and update the Debug menu accordingly.
 void hourglassOff()
          Return the cursor to normal.
 void hourglassOn()
          Make the cursor an hourglass.
 void installModalWindowAdapter(Window w, Runnable1<? super WindowEvent> toFrontAction, Runnable1<? super WindowEvent> closeAction)
          Return the modal window listener if available, otherwise returns a non-modal dummy listener.
 boolean isCompilerTabSelected()
          Returns whether the compiler output tab is currently showing.
 boolean isJavadocTabSelected()
          Returns whether the JavaDoc output tab is currently showing.
 boolean isTestTabSelected()
          Returns whether the test output tab is currently showing.
 void lostOwnership(Clipboard clipboard, Transferable contents)
          We lost ownership of what we put in the clipboard.
 void open(FileOpenSelector openSelector)
          Opens all the files returned by the FileOpenSelector prompting the user to handle the cases where files are already open, files are missing, or the action was canceled by the user
static void openExtProcessFile(File file)
          Open stand-alone external process file.
static void openExtProcessJarFile(File file)
          Open external process file in a jar file.
 void openFolder(DirectoryChooser chooser)
          Opens all the files in the directory returned by the FolderSelector.
 void openProject(FileOpenSelector projectSelector)
           
 void pack()
          Ensures that pack() is run in the event thread.
 void removeCurrentLocationHighlight()
          Removes the current highlight.
 void removeModalWindowAdapter(Window w)
          Removes the modal window adapter.
 void removeTab(Component c)
           
 void resetAutoImportDialogPosition()
          Reset the position of the "Open Javadoc" dialog.
 void resetClipboardHistoryDialogPosition()
          Reset the position of the "Clipboard History" dialog.
 void resetCompleteWordDialogPosition()
          Reset the position of the "Complete Word" dialog.
 void resetDebugFrame()
          Reset the position of the "Debugger" dialog.
 void resetEditExternalProcessPosition()
          Reset the position of the "Edit External Process" dialog.
 void resetExecuteExternalProcessPosition()
          Reset the position of the "Execute External Process" dialog.
 void resetGotoFileDialogPosition()
          Reset the position of the "Go to File" dialog.
 void resetJarOptionsDialogPosition()
          Reset the position of the "Create Jar from Project" dialog.
 void resetOpenJavadocDialogPosition()
          Reset the position of the "Open Javadoc" dialog.
 void resetTabbedPanesFrame()
          Reset the position of the "Tabbed Panes" dialog.
 void resetUndo()
          Resets the undo/redo menu items
 boolean saveEnabledHuh()
          Supports MainFrameTest.
 void scrollToDocumentAndOffset(OpenDefinitionsDocument doc, int offset, boolean shouldHighlight)
          Called when a specific document and offset should be displayed.
 void scrollToDocumentAndOffset(OpenDefinitionsDocument doc, int offset, boolean shouldHighlight, boolean shouldAddToHistory)
          Called when a specific document and offset should be displayed.
 void setAllowKeyEvents(boolean a)
           
 void setPopupLoc(Window popup)
          Wrapper for setPopupLoc(Window, Component) that uses the window's owner as the owner to center the popup on.
static void setPopupLoc(Window popup, Component owner)
          Determines the location of the popup using a simple, uniform protocol.
 void setStatusMessage(String msg)
          Changes the message text toward the right of the status bar
 void setStatusMessageColor(Color c)
          Sets the color of the text in the status bar message
 void setStatusMessageFont(Font f)
          Sets the font of the status bar message
 void setUpDrJavaProperties()
          This method sets up all the DrJava properties that can be used as variables in external process command lines.
 void setVisible(boolean b)
           
 void showDebugger()
          Display the debugger tab and update the Debug menu accordingly.
 void showFindResultsPanel(FindResultsPanel panel)
          Action that shows a find results tab.
 void showTab(Component c, boolean showDetachedWindow)
          Shows the components passed in the appropriate place in the tabbedPane depending on the position of the component in the _tabs list.
 void start()
          Realizes this MainFrame by setting it visibile and configures the tabbed Pane.
 void toggleBookmark()
          Toggle a bookmark.
 void uncommentLines()
          Uncomment current selection using wing commenting.
 void updateStatusField()
          Updates the status field with the current status of the Definitions Pane.
 void updateStatusField(String text)
          ONLY executes in event thread.
 void viewInteractionsClassPath()
          Displays the interactions classpath.
 
Methods inherited from class edu.rice.cs.util.swing.SwingFrame
duringInit, initDone
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
 
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

_tabs

public final LinkedList<TabbedPanel> _tabs

_tabbedPane

public final JTabbedPane _tabbedPane

_lastFocusOwner

public volatile Component _lastFocusOwner

_modalWindowAdapters

protected HashMap<Window,WindowAdapter> _modalWindowAdapters
Window adapter for "pseudo-modal" dialogs, i.e. non-modal dialogs that insist on keeping the focus.


_modalWindowAdapterOwner

protected volatile Window _modalWindowAdapterOwner
The owner of the modal window listener has already been taken by another window.


_newFileFolderAction

public final Action _newFileFolderAction
Creates a new untitled, empty file in the current folder.


_cutLineAction

protected final Action _cutLineAction
Cuts from the caret to the end of the current line to the clipboard.


_clearLineAction

protected final Action _clearLineAction
Deletes text from the caret to the end of the current line.


_historyListener

public KeyListener _historyListener
These listeners support the traversal operations that cycle through recent documents.


_focusListenerForRecentDocs

public FocusListener _focusListenerForRecentDocs

UPDATE_DELAY

public static long UPDATE_DELAY

UPDATER_PRIORITY

public static int UPDATER_PRIORITY

FIND_ICON

public static final Icon FIND_ICON
Constructor Detail

MainFrame

public MainFrame()
Creates the main window, and shows it.

Method Detail

resetJarOptionsDialogPosition

public void resetJarOptionsDialogPosition()
Reset the position of the "Create Jar from Project" dialog.


resetTabbedPanesFrame

public void resetTabbedPanesFrame()
Reset the position of the "Tabbed Panes" dialog.


resetDebugFrame

public void resetDebugFrame()
Reset the position of the "Debugger" dialog.


getLastChangeTime

public long getLastChangeTime()
Returns the changed status of the MainFrame.


pack

public void pack()
Ensures that pack() is run in the event thread. Only used in test code

Overrides:
pack in class Window

saveEnabledHuh

public boolean saveEnabledHuh()
Supports MainFrameTest.


lostOwnership

public void lostOwnership(Clipboard clipboard,
                          Transferable contents)
We lost ownership of what we put in the clipboard.

Specified by:
lostOwnership in interface ClipboardOwner

resetClipboardHistoryDialogPosition

public void resetClipboardHistoryDialogPosition()
Reset the position of the "Clipboard History" dialog.


resetGotoFileDialogPosition

public void resetGotoFileDialogPosition()
Reset the position of the "Go to File" dialog.


gotoFileMatchingMask

public void gotoFileMatchingMask(String mask)
Goes to the file matching the specified mask.

Parameters:
mask - word specifying the file to go to

resetOpenJavadocDialogPosition

public void resetOpenJavadocDialogPosition()
Reset the position of the "Open Javadoc" dialog.


_generateJavaAPIList

public static List<MainFrame.JavaAPIListEntry> _generateJavaAPIList(String base,
                                                                    String stripPrefix,
                                                                    String suffix)
Generate Java API class list.


generateJavaAPIList

public void generateJavaAPIList()
Generate Java API class list.


resetCompleteWordDialogPosition

public void resetCompleteWordDialogPosition()
Reset the position of the "Complete Word" dialog.


enableResetInteractions

public void enableResetInteractions()

viewInteractionsClassPath

public void viewInteractionsClassPath()
Displays the interactions classpath.


toggleBookmark

public void toggleBookmark()
Toggle a bookmark.


addToBrowserHistory

public void addToBrowserHistory()
Add the current location to the browser history.


createFindResultsPanel

public FindResultsPanel createFindResultsPanel(RegionManager<MovingDocumentRegion> rm,
                                               String title,
                                               String searchString,
                                               boolean searchAll,
                                               boolean matchCase,
                                               boolean wholeWord,
                                               boolean noComments,
                                               boolean noTestCases,
                                               WeakReference<OpenDefinitionsDocument> doc,
                                               edu.rice.cs.drjava.ui.FindReplacePanel findReplace)
Create a new find results tab.

Parameters:
rm - the region manager that will contain the regions
title - the title for the panel
searchString - string that was searched for
searchAll - whether all files were searched
doc - weak reference to document in which search occurred (or started, if all documents were searched)
findReplace - the FindReplacePanel that created this FindResultsPanel
Returns:
new find results tab.

showFindResultsPanel

public void showFindResultsPanel(FindResultsPanel panel)
Action that shows a find results tab. Only runs in event thread.


getFileDisplayManager20

public static edu.rice.cs.drjava.ui.MainFrame.DJFileDisplayManager getFileDisplayManager20()

getFileDisplayManager30

public static edu.rice.cs.drjava.ui.MainFrame.DJFileDisplayManager getFileDisplayManager30()

getOddDisplayManager20

public static edu.rice.cs.drjava.ui.MainFrame.OddDisplayManager getOddDisplayManager20()

getOddDisplayManager30

public static edu.rice.cs.drjava.ui.MainFrame.OddDisplayManager getOddDisplayManager30()

getNavPaneDisplayManager

public DisplayManager<INavigatorItem> getNavPaneDisplayManager()

setVisible

public void setVisible(boolean b)
Overrides:
setVisible in class Window

setUpDrJavaProperties

public void setUpDrJavaProperties()
This method sets up all the DrJava properties that can be used as variables in external process command lines.


getModel

public SingleDisplayModel getModel()
Returns:
The model providing the logic for this view.

hourglassOn

public void hourglassOn()
Make the cursor an hourglass. Only runs in the event thread.


hourglassOff

public void hourglassOff()
Return the cursor to normal. Only runs in the event thread.


setAllowKeyEvents

public void setAllowKeyEvents(boolean a)

getAllowKeyEvents

public boolean getAllowKeyEvents()

debuggerToggle

public void debuggerToggle()
Toggles whether the debugger is enabled or disabled, and updates the display accordingly. Only runs in the event thread.


showDebugger

public void showDebugger()
Display the debugger tab and update the Debug menu accordingly.


hideDebugger

public void hideDebugger()
Hide the debugger tab and update the Debug menu accordingly.


updateStatusField

public void updateStatusField(String text)
ONLY executes in event thread.


updateStatusField

public void updateStatusField()
Updates the status field with the current status of the Definitions Pane.


getOpenFiles

public File[] getOpenFiles(JFileChooser jfc)
                    throws OperationCanceledException
Prompt the user to select a place to open files from, then load them. Ask the user if they'd like to save previous changes (if the current document has been modified) before opening.

Parameters:
jfc - the open dialog from which to extract information
Returns:
an array of the files that were chosen
Throws:
OperationCanceledException

getSaveFile

public File getSaveFile(JFileChooser jfc)
                 throws OperationCanceledException
Prompt the user to select a place to save the current document.

Throws:
OperationCanceledException

getCurrentDefPane

public DefinitionsPane getCurrentDefPane()
Returns the current DefinitionsPane.


getSelectedErrorPanel

public ErrorPanel getSelectedErrorPanel()
Returns the currently shown error panel if there is one. Otherwise returns null.


isCompilerTabSelected

public boolean isCompilerTabSelected()
Returns whether the compiler output tab is currently showing.


isTestTabSelected

public boolean isTestTabSelected()
Returns whether the test output tab is currently showing.


isJavadocTabSelected

public boolean isJavadocTabSelected()
Returns whether the JavaDoc output tab is currently showing.


setStatusMessage

public void setStatusMessage(String msg)
Changes the message text toward the right of the status bar

Parameters:
msg - The message to place in the status bar

clearStatusMessage

public void clearStatusMessage()
Sets the message text in the status bar to the null string.


setStatusMessageFont

public void setStatusMessageFont(Font f)
Sets the font of the status bar message

Parameters:
f - The new font of the status bar message

setStatusMessageColor

public void setStatusMessageColor(Color c)
Sets the color of the text in the status bar message

Parameters:
c - The color of the text

openProject

public void openProject(FileOpenSelector projectSelector)

getCurrentProject

public File getCurrentProject()

open

public void open(FileOpenSelector openSelector)
Opens all the files returned by the FileOpenSelector prompting the user to handle the cases where files are already open, files are missing, or the action was canceled by the user

Parameters:
openSelector - the selector that returns the files to open

openFolder

public void openFolder(DirectoryChooser chooser)
Opens all the files in the directory returned by the FolderSelector.

Parameters:
chooser - the selector that returns the files to open TODO: change the dialog title to give the current path rather than "..."

gatherProjectDocInfo

public HashMap<OpenDefinitionsDocument,DocumentInfoGetter> gatherProjectDocInfo()

_jumpToLine

public int _jumpToLine(int lineNum)
Jump to the specified line and return the offset. Only runs in event thread.

Returns:
offset

getIcon

public static ImageIcon getIcon(String name)

_createToolbarButton

public JButton _createToolbarButton(Action a)
Sets up all buttons for the toolbar except for undo and redo, which use _createManualToolbarButton.


_updateToolbarButton

public JButton _updateToolbarButton(JButton b,
                                    Action a)
Removes the button b from the toolbar and creates new button in its place. Only runs in the event thread.


start

public void start()
Realizes this MainFrame by setting it visibile and configures the tabbed Pane. Only runs in the event thread.


resetUndo

public void resetUndo()
Resets the undo/redo menu items


getDefPaneGivenODD

public DefinitionsPane getDefPaneGivenODD(OpenDefinitionsDocument doc)

removeCurrentLocationHighlight

public void removeCurrentLocationHighlight()
Removes the current highlight.


_disableInteractionsPane

protected void _disableInteractionsPane()
Ensures that the interactions pane is not editable during an interaction.


_enableInteractionsPane

protected void _enableInteractionsPane()
Ensures that the interactions pane is editable after an interaction completes.


commentLines

public void commentLines()
Comment current selection using wing commenting. public for testing purposes only. Runs in event thread.


uncommentLines

public void uncommentLines()
Uncomment current selection using wing commenting. Public for testing purposes only. Runs in event thread.


scrollToDocumentAndOffset

public void scrollToDocumentAndOffset(OpenDefinitionsDocument doc,
                                      int offset,
                                      boolean shouldHighlight)
Called when a specific document and offset should be displayed. Must be executed only in the event thread.

Parameters:
doc - Document to display
offset - Offset to display
shouldHighlight - true iff the line should be highlighted. Only done in debugger.

goToRegionAndHighlight

public void goToRegionAndHighlight(IDocumentRegion r)

scrollToDocumentAndOffset

public void scrollToDocumentAndOffset(OpenDefinitionsDocument doc,
                                      int offset,
                                      boolean shouldHighlight,
                                      boolean shouldAddToHistory)
Called when a specific document and offset should be displayed. Must be executed only in the event thread.

Parameters:
doc - Document to display
offset - Offset to display
shouldHighlight - true iff the line should be highlighted.
shouldAddToHistory - true if the location before and after the switch should be added to the browser history

getDefViewport

public JViewport getDefViewport()

removeTab

public void removeTab(Component c)

createBookmarks

public void createBookmarks()
Adds the bookmarks panel to the tabbed pane.


createBreakpoints

public void createBreakpoints()
Adds the breakpoints panel to the tabbed pane.


showTab

public void showTab(Component c,
                    boolean showDetachedWindow)
Shows the components passed in the appropriate place in the tabbedPane depending on the position of the component in the _tabs list. Only runs in the event thread.

Parameters:
c - the component to show in the tabbedPane
showDetachedWindow - true if the "Detached Panes" window should be shown

addComponentListenerToOpenDocumentsList

public void addComponentListenerToOpenDocumentsList(ComponentListener listener)
Parameters:
listener - The ComponentListener to add to the open documents list This method allows for testing of the dancing UI (See MainFrameTest.testDancingUI()).

getFileNameField

public String getFileNameField()
For test purposes only. Returns the text in the status bar. Is used to test brace matching


getEditMenu

public JMenu getEditMenu()
For test purposes only. Returns the edit menu


setPopupLoc

public void setPopupLoc(Window popup)
Wrapper for setPopupLoc(Window, Component) that uses the window's owner as the owner to center the popup on.

Parameters:
popup - the Popup window

setPopupLoc

public static void setPopupLoc(Window popup,
                               Component owner)
Determines the location of the popup using a simple, uniform protocol. If the popup has an owner, the popup is centered over the owner. If the popup has no owner(owner == null), the popup is centered over the first monitor. In either case, the popup is moved and scaled if any part of it is not on the screen. This method should be called for all popups to maintain uniformity in the DrJava UI.

Parameters:
popup - the popup window
owner - the parent component for the popup

dragEnter

public void dragEnter(DropTargetDragEvent dropTargetDragEvent)
User dragged something into the component.

Specified by:
dragEnter in interface DropTargetListener

dragExit

public void dragExit(DropTargetEvent dropTargetEvent)
Specified by:
dragExit in interface DropTargetListener

dragOver

public void dragOver(DropTargetDragEvent dropTargetDragEvent)
Specified by:
dragOver in interface DropTargetListener

dropActionChanged

public void dropActionChanged(DropTargetDragEvent dropTargetDragEvent)
Specified by:
dropActionChanged in interface DropTargetListener

drop

public void drop(DropTargetDropEvent dropTargetDropEvent)
User dropped something on the component.

Specified by:
drop in interface DropTargetListener

openExtProcessFile

public static void openExtProcessFile(File file)
Open stand-alone external process file.


openExtProcessJarFile

public static void openExtProcessJarFile(File file)
Open external process file in a jar file.


resetAutoImportDialogPosition

public void resetAutoImportDialogPosition()
Reset the position of the "Open Javadoc" dialog.


resetExecuteExternalProcessPosition

public void resetExecuteExternalProcessPosition()
Reset the position of the "Execute External Process" dialog.


resetEditExternalProcessPosition

public void resetEditExternalProcessPosition()
Reset the position of the "Edit External Process" dialog.


installModalWindowAdapter

public void installModalWindowAdapter(Window w,
                                      Runnable1<? super WindowEvent> toFrontAction,
                                      Runnable1<? super WindowEvent> closeAction)
Return the modal window listener if available, otherwise returns a non-modal dummy listener. Note that the WindowEvent passed to the toFrontAction runnable may not be the WindowEvent that caused the window w to be pushed off the front, it may also be the WindowEvent that restores w as front window after a modal dialog that trumped w was closed.

Parameters:
w - window trying to get the modal window listener
toFrontAction - action to be performed after the window has been moved to the front again
closeAction - action to be performed when the window is closing

removeModalWindowAdapter

public void removeModalWindowAdapter(Window w)
Removes the modal window adapter.

Parameters:
w - window releasing the modal window adapter