Download presentation
Presentation is loading. Please wait.
Published byAmber Parrish Modified over 9 years ago
1
Code Viewer Design April 5, 2004
2
Known feature requirements Icons for tree collapse / expand Code ellipsis Subtree highlighting Syntax coloring Multiple columns associated w/ main tree Preservation of widget settings Placemarkers “Control panel” of predicates
3
Implementation Issues Reuse of existing subsystems –Model-View chains –Fluid unparser support –Eclipse-based infrastructure –Base SWT widget (FluidSPTTable) Potential problems –Mismatches in text representation between these subsystems –Requirements of MV / SWT threading models
4
Features in Existing subsystems Model-View –Handling ellipsis, collapse/expand on IR-based trees UnparserManager –Handling unparsing and translation between IRNodes and TextCoords/Regions JavaPartitionScanner (using org.eclipse.jface.text) –Previously used in unparserEditor to provide typical Java syntax coloring FluidSPTTable –Implementing labeled regions of text w/ embedded icons Labels abstractly representing styling info –Providing event listeners for icons, mouse clicks / moves
5
Mismatches in text representation UnparserManager –Representing text as a String array –Indexing text by line and column JavaPartitionScanner –Operating on IDocument via ITextStore –Based on a single String –Indexing text by offset FluidSPTTable –Operating on FluidSPTText –Also based on a single String –Annotated with icons and labels
6
Solution for text representation ITreeRenderer –Encapsulating UnparserManager and exporting ITextStore –Providing internal mapping between line/col and offset JavaPartitionScanner –ITextStore used to create IDocument FluidSPTTable –ITextStore used to get String for FluidSPTText Alternative: –Unparser could be changed (transparently)
7
Requirements of MV threading ModelListeners required to run in thread with no Model locks Solutions already provided: –ThreadedModelAdapter, –SharedThreadModelAdapter
8
Requirements of SWT threading Like AWT? Updates to UI state need to be done in SWT thread Computation should be done elsewhere to prevent UI freezes Solutions already provided: –Display.asyncExec –Display.syncExec
9
Solution for threading issues Use SharedThreadModelAdapter to process ModelEvent and to create new FluidSPTText Use Display.asyncExec to change FluidSPTText and to frefresh Make sure that widget supports complete swap of FluidSPTText
10
Features handled by ConfigurableForestView Icons for tree collapse / expand Code ellipsis –State for both kept by CFV –Differing primarily in gesture to activate –Implemented by different event listeners on FluidSPTTable (icon event vs. mouse event) –Collapse / expand Can treat methods, fields, statements, etc specially Elide details (e.g. method body), not entire subtree
11
Features handled by FluidSPTTable Subtree highlighting Syntax coloring (stateless) –Implemented as styling on formatted text –Differing in input (annotated tree vs. text) –Allowing multiple maps from input to styles –Highlighting State kept as node attribute in MV chain State changed via mouse event listener
12
Multiple columns associated w/ main tree Main column renders IR tree structure into formatted text –Via ITreeRenderer –Different imps handle code, arbitrary trees, … Other columns can render IR tree attributes into text –Focused on derived attributes –Can use the same ITreeRenderer interface –Consults main ITreeRenderer to line up its display with main tree
13
Model-View Chain Configurable View ITreeRenderer Default TreeRenderer Unparser TreeRenderer Widget Controller INPUT Code Viewer Plugin Code Viewer Editor FluidSPTTable ITextStyle static Demo1 Keyword Style Promise Style Comment Style... Temporary relationships Class/Interface relationships Interface Eclipse-side class Temporary class Fluid-side class KEY Last Week’s Demo Design
14
Model-View Chain Styled View ITreeRenderer Event Listeners FluidSPTTable ITreeStyler Configurable View ITextStyler mouse / icon events text index -> IRNode translation collapse / expand events highlight events ASTs text / iconslabeled regions IRNode -> regions translation Dataflow – Next generation design
15
Model-View Chain Configurable Forest View ITreeRenderer (incl. Unparser) Widget Controller FluidSPTTable ITextStyler StyledForest View … Model Listener ITreeStyler MouseDragListener MouseListener (Subtree Highlighting) IconListener (Tree icon events) Placemarker Ellipsis Highlight IR Node Icon state change which IRNode text to style Tree highlighting info IRNode/Region Design for One-Column Table that is a Tree
16
Short-Term Development Plan Monday 4/12 – Demo with: –Unparsed text –Tree icon events –AST subtree highlighting Responsibilities for week 4/5 – 4/12 –Edwin: MV chain, WidgetController/ ModelListener, Unparser text-> IDocument, –Elissa: MouseListener, TreeStyler –Greg: persisting settings, separate rendering from FluidSPText, debug/assist, JavaDoc
17
Model-View Chain Configurable Forest View ITreeRenderer (incl. Unparser) Widget Controller FluidSPTTable ITextStyler StyledForest View … Model Listener ITreeStyler MouseDragListener MouseListener (Subtree Highlighting) IconListener (Tree icon events) Placemarker Ellipsis Highlight IR Node Icon state change which IRNode text to style Tree highlighting info IRNode/Region MOSTLY IMPLEMENTED 0 - EC 1 - EC 2 - EC 1 -EC 3 - EN 3 – EN 4 – EC or GM 0 - GM
18
Future Plans Need elaboration on scenarios of usage for: –Multiple columns associated with a tree As an further application of existing infrastructure Requires better way to specify what ITreeRenderers are used for each column –Preserved widget settings Widget should maintain settings across model updates Higher level support needed if across editor lifetimes –Placemarkers Issue of how to define sites (and for what purposes) –Predicates for highlighting and ellipsis Needs UI to define more complex predicates, so as to capture useful patterns
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.