001: /*BEGIN_COPYRIGHT_BLOCK
002: *
003: * Copyright (c) 2001-2007, JavaPLT group at Rice University (javaplt@rice.edu)
004: * All rights reserved.
005: *
006: * Redistribution and use in source and binary forms, with or without
007: * modification, are permitted provided that the following conditions are met:
008: * * Redistributions of source code must retain the above copyright
009: * notice, this list of conditions and the following disclaimer.
010: * * Redistributions in binary form must reproduce the above copyright
011: * notice, this list of conditions and the following disclaimer in the
012: * documentation and/or other materials provided with the distribution.
013: * * Neither the names of DrJava, the JavaPLT group, Rice University, nor the
014: * names of its contributors may be used to endorse or promote products
015: * derived from this software without specific prior written permission.
016: *
017: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
018: * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
019: * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
020: * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
021: * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
022: * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
023: * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
024: * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
025: * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
026: * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
027: * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
028: *
029: * This software is Open Source Initiative approved Open Source Software.
030: * Open Source Initative Approved is a trademark of the Open Source Initiative.
031: *
032: * This file is part of DrJava. Download the current version of this project
033: * from http://www.drjava.org/ or http://sourceforge.net/projects/drjava/
034: *
035: * END_COPYRIGHT_BLOCK*/
036:
037: package edu.rice.cs.drjava.model;
038:
039: import java.util.List;
040:
041: /**
042: * A GlobalModel that enforces invariants associated with having
043: * one active document at a time.
044: *
045: * Invariants:
046: * <OL>
047: * <LI>{@link #getOpenDefinitionsDocuments} will always return an array of
048: * at least size 1.
049: * </LI>
050: * <LI>(follows from previous) If there is ever no document in the model,
051: * a new one will be created.
052: * </LI>
053: * <LI>There is always exactly one active document, which can be get/set
054: * via {@link #getActiveDocument} and {@link #setActiveDocument}.
055: * </LI>
056: * </OL>
057: *
058: * Other functions added by this class:
059: * <OL>
060: * <LI>When calling {@link #openFile}, if there is currently only one open
061: * document, and it is untitled and unchanged, it will be closed after the
062: * new document is opened. This means that, in one atomic transaction, the
063: * model goes from having one totally empty document open to having one
064: * document (the requested one) open.
065: * </LI>
066: * </OL>
067: *
068: * @version $Id: SingleDisplayModel.java 4257 2007-09-12 00:29:25Z mgricken $
069: */
070: public interface SingleDisplayModel extends GlobalModel {
071: /**
072: * @return the currently active document.
073: */
074: public OpenDefinitionsDocument getActiveDocument();
075:
076: /** Sets the currently active document by updating the selection model.
077: * @param doc Document to set as active
078: */
079: public void setActiveDocument(OpenDefinitionsDocument doc);
080:
081: /** Invokes the activeDocumentChanged method in the global listener on the argument _activeDocument. */
082: public void refreshActiveDocument();
083:
084: /** @return the IDocumentNavigator container expressed as an AWT component. */
085: public java.awt.Container getDocCollectionWidget();
086:
087: /** Sets the active document to be the next one in the list. */
088: public void setActiveNextDocument();
089:
090: /** Sets the active document to be the previous one in the list. */
091: public void setActivePreviousDocument();
092:
093: /** Shared code between close project and close All files which only sets the new active document after all documents
094: * to be closed have been closed.
095: * @param docList the list of files to close
096: * @return whether all files were closed
097: */
098: public boolean closeFiles(List<OpenDefinitionsDocument> docList);
099:
100: public void setActiveFirstDocument();
101:
102: public void dispose();
103:
104: /** Disposes of external resources, e.g. other VMs. */
105: public void disposeExternalResources();
106:
107: public boolean closeAllFilesOnQuit();
108:
109: // Any lightweight parsing has been disabled until we have something that is beneficial and works better in the background.
110: // /** @return the parsing control */
111: // public LightWeightParsingControl getParsingControl();
112: }
|