Java Doc for DefinitionsDocument.java in  » IDE » DrJava » edu » rice » cs » drjava » model » definitions » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE » DrJava » edu.rice.cs.drjava.model.definitions 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


edu.rice.cs.drjava.model.AbstractDJDocument
   edu.rice.cs.drjava.model.definitions.DefinitionsDocument

DefinitionsDocument
public class DefinitionsDocument extends AbstractDJDocument implements Finalizable<DefinitionsDocument>(Code)
The document model for the definitions pane. This implementation of Document contains a "reduced model". The reduced model is automatically kept in sync when this document is updated. Also, that synchronization is maintained even across undo/redo -- this is done by making the undo/redo commands know how to restore the reduced model state. The reduced model is not thread-safe, so it is essential that ONLY this DefinitionsDocument call methods on it. Any information from the reduced model should be obtained through helper methods on DefinitionsDocument, and ALL methods in DefinitionsDocument which reference the reduced model (via the _reduced field) MUST be synchronized. This prevents any thread from seeing an inconsistent state in the middle of another thread's changes.
See Also:   BraceReduction
See Also:   ReducedModelControl
See Also:   ReducedModelComment
See Also:   ReducedModelBrace

Inner Class :public static class WrappedPosition implements Position

Field Summary
final public static  Log_log
    

Constructor Summary
public  DefinitionsDocument(Indenter indenter, GlobalEventNotifier notifier)
     Convenience constructor for using a custom indenter.
public  DefinitionsDocument(GlobalEventNotifier notifier)
     Main constructor.
public  DefinitionsDocument(GlobalEventNotifier notifier, CompoundUndoManager undoManager)
     Main constructor.

Method Summary
 int_getAnonymousInnerClassIndex(int pos)
     Return the index of the anonymous inner class being instantiated at the specified position.
protected  String_getPackageQualifier()
     Gets an appropriate prefix to fully qualify a class name.
static  String_removeTabs(String source)
     Given a String, return a new String will all tabs converted to spaces.
protected  void_styleChanged()
    
public  voidaddDocumentClosedListener(DocumentClosedListener l)
    
public  voidaddFinalizationListener(FinalizationListener<DefinitionsDocument> fl)
     Registers a finalization listener with the specific instance of the ddoc

NOTE:This should only be used by test cases.

protected  voidaddUndoRedo(AbstractDocument.DefaultDocumentEvent chng, Runnable undoCommand, Runnable doCommand)
    
public  voidclose()
     Called when this is kicked out of the document cache so that the references made to it may be released so that this can be GC'd.
public  intcommentLines(int selStart, int selEnd)
     Comments out all lines between selStart and selEnd, inclusive.
public  PositioncreatePosition(int offs)
     Factory method for created WrappedPositions.
public  voiddocumentSaved()
     Informs this document's undo manager that the document has been saved.
protected  voidendCompoundEdit(int key)
    
protected  voidendLastCompoundEdit()
    
protected  voidfinalize()
     This is called when this method is GC'd.
public  intgetCurrentCol()
     Return the current column of the cursor position.
public  intgetCurrentLine()
     Return the current line of the cursor position.
public  StringgetEnclosingClassName(int pos, boolean qual)
     Searching backwards finds the name of the enclosing named class or interface.
public  StringgetEnclosingTopLevelClassName(int pos)
     Returns the name of the class or interface enclosing the caret position at the top level.
public  List<FinalizationListener<DefinitionsDocument>>getFinalizationListeners()
    
public  StringgetFirstTopLevelClassName()
     Gets the name of the top level class in this source file.
public  StringgetMainClassName()
     Gets the name of the document's main class: the document's only public class/interface or first top level class if document contains no public classes or interfaces.
public  UndoableEditgetNextRedo()
     Public accessor for the next undo action.
public  StringgetNextTopLevelClassName(int startPos, int endPos)
    
public  UndoableEditgetNextUndo()
     Public accessor for the next undo action.
public  intgetOffset(int lineNum)
     Returns the offset corresponding to the first character of the given line number, or -1 if the lineNum is not found.
public  OpenDefinitionsDocumentgetOpenDefDoc()
     the OpenDefinitonsDocument that is associated with this DefinitionsDocument.
public  StringgetPackageName()
     Gets the package name embedded in the text of this document by minimally parsing the document to find the package statement.
public  StringgetQualifiedClassName()
    
public  StringgetQualifiedClassName(int pos)
     Gets fully qualified class name of the top level class enclosing the given position.
public  CompoundUndoManagergetUndoManager()
    
public  WeakHashMap<WrappedPosition, Integer>getWrappedPositionOffsets()
     Remove all positions that have been garbage-collected from the list of positions, then return a weakly-linked hashmap with positions and their current offsets.
public  voidgotoLine(int line)
     Goes to a particular line in the document.
public  voidinsertString(int offset, String str, AttributeSet a)
     Inserts a string of text into the document.
public  booleanisModifiedSinceSave()
     Determines if the document has been modified since the last save.
protected  IndentermakeNewIndenter(int indentLevel)
     Returns a new indenter.
public  voidremove(int offset, int len)
     Removes a block of text from the specified location.
public  voidremoveDocumentClosedListener(DocumentClosedListener l)
    
public  voidresetModification()
     Resets the modification state of this document.
public  voidresetUndoManager()
     Resets the undo manager.
public  voidsetOpenDefDoc(OpenDefinitionsDocument odd)
     Sets the OpenDefinitionsDocument that holds this DefinitionsDocument (the odd can only be set once).
public  voidsetWrappedPositionOffsets(WeakHashMap<WrappedPosition, Integer> whm)
     Re-create the wrapped positions in the hashmap, update the wrapped position, and add them to the list.
protected  intstartCompoundEdit()
    
public  booleantabsRemoved()
     Returns true iff tabs are to removed on text insertion.
public  StringtoString()
    
public  intuncommentLines(int selStart, int selEnd)
     Uncomments all lines between selStart and selEnd, inclusive.
public  voidupdateModifiedSinceSave()
     Resets the modification state of this document to be consistent with state of _undoManager.

Field Detail
_log
final public static Log _log(Code)




Constructor Detail
DefinitionsDocument
public DefinitionsDocument(Indenter indenter, GlobalEventNotifier notifier)(Code)
Convenience constructor for using a custom indenter.
Parameters:
  indenter - custom indenter class
Parameters:
  notifier - used by CompoundUndoManager to announce undoable edits



DefinitionsDocument
public DefinitionsDocument(GlobalEventNotifier notifier)(Code)
Main constructor. This has an obnoxious dependency on GlobalEventNotifier, which is passed through here only for a single usage in CompoundUndoManager. TODO: find a better way.
Parameters:
  notifier - used by CompoundUndoManager to announce undoable edits



DefinitionsDocument
public DefinitionsDocument(GlobalEventNotifier notifier, CompoundUndoManager undoManager)(Code)
Main constructor. This has an obnoxious dependency on GlobalEventNotifier, which is passed through here only for a single usage in CompoundUndoManager. TODO: find a better way.
Parameters:
  notifier - used by CompoundUndoManager to announce undoable edits




Method Detail
_getAnonymousInnerClassIndex
int _getAnonymousInnerClassIndex(int pos) throws BadLocationException, ClassNameNotFoundException(Code)
Return the index of the anonymous inner class being instantiated at the specified position.
Parameters:
  position - of the opening curly brace of the anonymous inner class anonymous class index



_getPackageQualifier
protected String _getPackageQualifier()(Code)
Gets an appropriate prefix to fully qualify a class name. Returns this class's package followed by a dot, or the empty string if no package name is found.



_removeTabs
static String _removeTabs(String source)(Code)
Given a String, return a new String will all tabs converted to spaces. Each tab is converted to one space, since changing the number of characters within insertString screws things up.
Parameters:
  source - the String to be converted. a String will all the tabs converted to spaces



_styleChanged
protected void _styleChanged()(Code)



addDocumentClosedListener
public void addDocumentClosedListener(DocumentClosedListener l)(Code)



addFinalizationListener
public void addFinalizationListener(FinalizationListener<DefinitionsDocument> fl)(Code)
Registers a finalization listener with the specific instance of the ddoc

NOTE:This should only be used by test cases. This is to ensure that we don't spring memory leaks by allowing our unit tests to keep track of whether objects are being finalized (garbage collected)


Parameters:
  fl - the listener to register



addUndoRedo
protected void addUndoRedo(AbstractDocument.DefaultDocumentEvent chng, Runnable undoCommand, Runnable doCommand)(Code)



close
public void close()(Code)
Called when this is kicked out of the document cache so that the references made to it may be released so that this can be GC'd.



commentLines
public int commentLines(int selStart, int selEnd)(Code)
Comments out all lines between selStart and selEnd, inclusive. The current cursor position is maintained after the operation.
Parameters:
  selStart - the document offset for the start of the selection
Parameters:
  selEnd - the document offset for the end of the selection



createPosition
public Position createPosition(int offs) throws BadLocationException(Code)
Factory method for created WrappedPositions. Stores the created Position instance so it can be linked to a different DefinitionsDocument later.



documentSaved
public void documentSaved()(Code)
Informs this document's undo manager that the document has been saved.



endCompoundEdit
protected void endCompoundEdit(int key)(Code)



endLastCompoundEdit
protected void endLastCompoundEdit()(Code)



finalize
protected void finalize()(Code)
This is called when this method is GC'd. Since this class implements edu.rice.cs.drjava.model.Finalizable, it must notify its listeners



getCurrentCol
public int getCurrentCol()(Code)
Return the current column of the cursor position. Uses a 0 based index.



getCurrentLine
public int getCurrentLine()(Code)
Return the current line of the cursor position. Uses a 1-based index.



getEnclosingClassName
public String getEnclosingClassName(int pos, boolean qual) throws BadLocationException, ClassNameNotFoundException(Code)
Searching backwards finds the name of the enclosing named class or interface. NB: ignores comments. WARNING: In long source files and when contained in anonymous inner classes, this function might take a LONG time.
Parameters:
  pos - Position to start from
Parameters:
  qual - true to find the fully qualified class name name of the enclosing named class or interface



getEnclosingTopLevelClassName
public String getEnclosingTopLevelClassName(int pos) throws ClassNameNotFoundException(Code)
Returns the name of the class or interface enclosing the caret position at the top level. Name of enclosing class or interface
throws:
  ClassNameNotFoundException - if no enclosing class found



getFinalizationListeners
public List<FinalizationListener<DefinitionsDocument>> getFinalizationListeners()(Code)



getFirstTopLevelClassName
public String getFirstTopLevelClassName() throws ClassNameNotFoundException(Code)
Gets the name of the top level class in this source file. This attempts to find the first declaration of a class or interface. The name of first class in the file
throws:
  ClassNameNotFoundException - if no top level class found



getMainClassName
public String getMainClassName() throws ClassNameNotFoundException(Code)
Gets the name of the document's main class: the document's only public class/interface or first top level class if document contains no public classes or interfaces.



getNextRedo
public UndoableEdit getNextRedo()(Code)
Public accessor for the next undo action.



getNextTopLevelClassName
public String getNextTopLevelClassName(int startPos, int endPos) throws ClassNameNotFoundException(Code)



getNextUndo
public UndoableEdit getNextUndo()(Code)
Public accessor for the next undo action.



getOffset
public int getOffset(int lineNum)(Code)
Returns the offset corresponding to the first character of the given line number, or -1 if the lineNum is not found. Avoid locking the document by copying its text.
Parameters:
  lineNum - the line number for which to calculate the offset. the offset of the first character in the given line number



getOpenDefDoc
public OpenDefinitionsDocument getOpenDefDoc()(Code)
the OpenDefinitonsDocument that is associated with this DefinitionsDocument.



getPackageName
public String getPackageName()(Code)
Gets the package name embedded in the text of this document by minimally parsing the document to find the package statement. If package statement is not found or is ill-formed, returns "" as the package name. The name of package embedded in this document. If there is no well-formed package statement, returns "" as the package name.



getQualifiedClassName
public String getQualifiedClassName() throws ClassNameNotFoundException(Code)
Gets the package and main class/interface name of this OpenDefinitionsDocument the qualified main class/interface name



getQualifiedClassName
public String getQualifiedClassName(int pos) throws ClassNameNotFoundException(Code)
Gets fully qualified class name of the top level class enclosing the given position.



getUndoManager
public CompoundUndoManager getUndoManager()(Code)
Getter method for CompoundUndoManager _undoManager



getWrappedPositionOffsets
public WeakHashMap<WrappedPosition, Integer> getWrappedPositionOffsets()(Code)
Remove all positions that have been garbage-collected from the list of positions, then return a weakly-linked hashmap with positions and their current offsets. list of weak references to all positions that have been created and that have not been garbage-collected yet.



gotoLine
public void gotoLine(int line)(Code)
Goes to a particular line in the document.



insertString
public void insertString(int offset, String str, AttributeSet a) throws BadLocationException(Code)
Inserts a string of text into the document. This is not where we do custom processing of the insert; that is done in DefinitionsDocument.insertUpdate .



isModifiedSinceSave
public boolean isModifiedSinceSave()(Code)
Determines if the document has been modified since the last save. true if the document has been modified



makeNewIndenter
protected Indenter makeNewIndenter(int indentLevel)(Code)
Returns a new indenter.



remove
public void remove(int offset, int len) throws BadLocationException(Code)
Removes a block of text from the specified location. We don't update the reduced model here; that happens in DefinitionsDocument.removeUpdate .



removeDocumentClosedListener
public void removeDocumentClosedListener(DocumentClosedListener l)(Code)



resetModification
public void resetModification()(Code)
Resets the modification state of this document. Used after a document has been saved or reverted.



resetUndoManager
public void resetUndoManager()(Code)
Resets the undo manager.



setOpenDefDoc
public void setOpenDefDoc(OpenDefinitionsDocument odd)(Code)
Sets the OpenDefinitionsDocument that holds this DefinitionsDocument (the odd can only be set once).
Parameters:
  odd - the OpenDefinitionsDocument to set as this DD's holder



setWrappedPositionOffsets
public void setWrappedPositionOffsets(WeakHashMap<WrappedPosition, Integer> whm) throws BadLocationException(Code)
Re-create the wrapped positions in the hashmap, update the wrapped position, and add them to the list.
Parameters:
  whm - weakly-linked hashmap of wrapped positions and their offsets



startCompoundEdit
protected int startCompoundEdit()(Code)



tabsRemoved
public boolean tabsRemoved()(Code)
Returns true iff tabs are to removed on text insertion.



toString
public String toString()(Code)



uncommentLines
public int uncommentLines(int selStart, int selEnd)(Code)
Uncomments all lines between selStart and selEnd, inclusive. The current cursor position is maintained after the operation.
Parameters:
  selStart - the document offset for the start of the selection
Parameters:
  selEnd - the document offset for the end of the selection



updateModifiedSinceSave
public void updateModifiedSinceSave()(Code)
Resets the modification state of this document to be consistent with state of _undoManager. Called whenever an undo or redo is performed.



Fields inherited from edu.rice.cs.drjava.model.AbstractDJDocument
final public static int DOCSTART(Code)(Java Doc)
final public static int ERROR_INDEX(Code)(Java Doc)
protected volatile boolean _cacheInUse(Code)(Java Doc)
protected volatile int _currentLocation(Code)(Java Doc)
protected volatile int _indent(Code)(Java Doc)
final protected static HashSet<String> _keywords(Code)(Java Doc)
final protected static HashSet<String> _normEndings(Code)(Java Doc)
final protected static HashSet<String> _primTypes(Code)(Java Doc)
final public BraceReduction _reduced(Code)(Java Doc)

Methods inherited from edu.rice.cs.drjava.model.AbstractDJDocument
protected Object _checkCache(String key)(Code)(Java Doc)
public boolean _indentLine(Indenter.IndentReason reason)(Code)(Java Doc)
protected static boolean _isReversteStartOfComment(String text, int pos)(Code)(Java Doc)
protected static boolean _isStartOfComment(String text, int pos)(Code)(Java Doc)
protected static HashSet<String> _makeKeywords()(Code)(Java Doc)
protected static HashSet<String> _makeNormEndings()(Code)(Java Doc)
protected static HashSet<String> _makePrimTypes()(Code)(Java Doc)
protected void _removeIndenter()(Code)(Java Doc)
protected void _storeInCache(String key, Object result)(Code)(Java Doc)
abstract protected void _styleChanged()(Code)(Java Doc)
abstract protected void addUndoRedo(AbstractDocument.DefaultDocumentEvent chng, Runnable undoCommand, Runnable doCommand)(Code)(Java Doc)
public int balanceBackward()(Code)(Java Doc)
public int balanceForward()(Code)(Java Doc)
public void clear()(Code)(Java Doc)
protected void clearCache()(Code)(Java Doc)
abstract protected void endCompoundEdit(int i)(Code)(Java Doc)
abstract protected void endLastCompoundEdit()(Code)(Java Doc)
public boolean findCharInStmtBeforePos(char findChar, int position)(Code)(Java Doc)
public int findCharOnLine(int pos, char findChar)(Code)(Java Doc)
public int findNextEnclosingBrace(int pos, char opening, char closing) throws BadLocationException(Code)(Java Doc)
public int findPrevCharPos(int pos, char[] whitespace) throws BadLocationException(Code)(Java Doc)
public int findPrevDelimiter(int pos, char[] delims) throws BadLocationException(Code)(Java Doc)
public int findPrevDelimiter(int pos, char[] delims, boolean skipParenPhrases) throws BadLocationException(Code)(Java Doc)
public int findPrevEnclosingBrace(int pos, char opening, char closing) throws BadLocationException(Code)(Java Doc)
public int findPrevNonWSCharPos(int pos) throws BadLocationException(Code)(Java Doc)
public byte[] getBytes()(Code)(Java Doc)
public int getCurrentLocation()(Code)(Java Doc)
public int getFirstNonWSCharPos(int pos) throws BadLocationException(Code)(Java Doc)
public int getFirstNonWSCharPos(int pos, boolean acceptComments) throws BadLocationException(Code)(Java Doc)
public int getFirstNonWSCharPos(int pos, char[] whitespace, boolean acceptComments) throws BadLocationException(Code)(Java Doc)
public Vector<HighlightStatus> getHighlightStatus(int start, int end)(Code)(Java Doc)
public int getIndent()(Code)(Java Doc)
public IndentInfo getIndentInformation()(Code)(Java Doc)
public String getIndentOfCurrStmt(int pos) throws BadLocationException(Code)(Java Doc)
public String getIndentOfCurrStmt(int pos, char[] delims) throws BadLocationException(Code)(Java Doc)
public String getIndentOfCurrStmt(int pos, char[] delims, char[] whitespace) throws BadLocationException(Code)(Java Doc)
public int getIntelligentBeginLinePos(int currPos) throws BadLocationException(Code)(Java Doc)
public int getLineEndPos(int pos)(Code)(Java Doc)
public int getLineFirstCharPos(int pos) throws BadLocationException(Code)(Java Doc)
public int getLineStartPos(int pos)(Code)(Java Doc)
public BraceReduction getReduced()(Code)(Java Doc)
public ReducedModelState getStateAtCurrent()(Code)(Java Doc)
public String getText()(Code)(Java Doc)
public int getWhiteSpace()(Code)(Java Doc)
public void indentLines(int selStart, int selEnd)(Code)(Java Doc)
public void indentLines(int selStart, int selEnd, Indenter.IndentReason reason, ProgressMonitor pm) throws OperationCanceledException(Code)(Java Doc)
public void insertString(int offset, String str, AttributeSet a) throws BadLocationException(Code)(Java Doc)
protected void insertUpdate(AbstractDocument.DefaultDocumentEvent chng, AttributeSet attr)(Code)(Java Doc)
abstract protected Indenter makeNewIndenter(int indentLevel)(Code)(Java Doc)
public void move(int dist)(Code)(Java Doc)
public boolean posInParenPhrase(int pos)(Code)(Java Doc)
public boolean posInParenPhrase()(Code)(Java Doc)
protected boolean posNotInBlock(int pos)(Code)(Java Doc)
public void remove(int offset, int len) throws BadLocationException(Code)(Java Doc)
protected void removeUpdate(AbstractDocument.DefaultDocumentEvent chng)(Code)(Java Doc)
public void resetReducedModelLocation()(Code)(Java Doc)
public void setCurrentLocation(int loc)(Code)(Java Doc)
public void setIndent(int indent)(Code)(Java Doc)
public void setTab(String tab, int pos)(Code)(Java Doc)
abstract protected int startCompoundEdit()(Code)(Java Doc)
public ReducedModelState stateAtRelLocation(int dist)(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.