Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CUP Eclipse Plugin
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Michael Schwarz
CUP Eclipse Plugin
Commits
79495e5b
Commit
79495e5b
authored
Feb 27, 2016
by
Michael Schwarz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
separate decls and precs in outline
parent
55fa1d48
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
21 deletions
+37
-21
CupPlugin/src/de/tum/in/www2/cupplugin/editors/CupContentOutlinePage.java
.../tum/in/www2/cupplugin/editors/CupContentOutlinePage.java
+37
-21
No files found.
CupPlugin/src/de/tum/in/www2/cupplugin/editors/CupContentOutlinePage.java
View file @
79495e5b
...
...
@@ -159,18 +159,19 @@ public class CupContentOutlinePage extends ContentOutlinePage implements
// We currently will only expand if there is a small number of items.
if
(
visitor
.
getProductionCount
()
<
AUTO_EXPAND_L3_MAX_ITEMS
&&
visitor
.
getDecl
Prec
Count
()
<
AUTO_EXPAND_L3_MAX_ITEMS
)
&&
visitor
.
getDecl
AndPrecs
Count
()
<
AUTO_EXPAND_L3_MAX_ITEMS
)
{
viewer
.
expandToLevel
(
3
);
}
else
if
(
visitor
.
getProductionCount
()
<
AUTO_EXPAND_L2_MAX_ITEMS
&&
visitor
.
getDecl
Prec
Count
()
<
AUTO_EXPAND_L2_MAX_ITEMS
)
&&
visitor
.
getDecl
AndPrecs
Count
()
<
AUTO_EXPAND_L2_MAX_ITEMS
)
{
viewer
.
expandToLevel
(
2
);
}
// Even though we expanded before, we want to collapse decls and precs
// and imports
viewer
.
setExpandedState
(
visitor
.
getDeclsAndPrec
(),
false
);
viewer
.
setExpandedState
(
visitor
.
getDecls
(),
false
);
viewer
.
setExpandedState
(
visitor
.
getPrecs
(),
false
);
viewer
.
setExpandedState
(
visitor
.
getImports
(),
false
);
}
finally
{
...
...
@@ -250,10 +251,11 @@ public class CupContentOutlinePage extends ContentOutlinePage implements
static
public
class
OutlineVisitor
extends
Visitor
<
OutlineEntry
>
{
private
OutlineEntry
root
;
private
int
shortenListsTo
;
private
int
decl
Prec
Count
;
private
int
decl
AndPrecs
Count
;
private
int
productionCount
;
private
OutlineEntry
declsAndPrec
;
private
OutlineEntry
decls
;
private
OutlineEntry
precs
;
private
OutlineEntry
productions
;
private
OutlineEntry
imports
;
...
...
@@ -261,8 +263,12 @@ public class CupContentOutlinePage extends ContentOutlinePage implements
return
root
;
}
public
OutlineEntry
getDeclsAndPrec
(){
return
declsAndPrec
;
public
OutlineEntry
getDecls
(){
return
decls
;
}
public
OutlineEntry
getPrecs
(){
return
precs
;
}
public
OutlineEntry
getImports
(){
...
...
@@ -273,8 +279,8 @@ public class CupContentOutlinePage extends ContentOutlinePage implements
return
productionCount
;
}
public
int
getDecl
Prec
Count
()
{
return
decl
Prec
Count
;
public
int
getDecl
AndPrecs
Count
()
{
return
decl
AndPrecs
Count
;
}
public
OutlineVisitor
()
{
...
...
@@ -282,14 +288,24 @@ public class CupContentOutlinePage extends ContentOutlinePage implements
this
.
shortenListsTo
=
3
;
}
private
void
addDeclOrPrec
(
OutlineEntry
entry
)
{
if
(
declsAndPrec
==
null
)
{
this
.
declsAndPrec
=
OutlineEntry
.
folderFromNode
(
"Declarations and Precedences"
);
root
.
children
.
add
(
declsAndPrec
);
private
void
addDecl
(
OutlineEntry
entry
)
{
if
(
decls
==
null
)
{
this
.
decls
=
OutlineEntry
.
folderFromNode
(
"Declarations"
);
root
.
children
.
add
(
decls
);
}
decls
.
children
.
add
(
entry
);
declAndPrecsCount
++;
}
private
void
addPrec
(
OutlineEntry
entry
)
{
if
(
precs
==
null
)
{
this
.
precs
=
OutlineEntry
.
folderFromNode
(
"Precedences"
);
root
.
children
.
add
(
precs
);
}
declsAndPrec
.
children
.
add
(
entry
);
decl
Prec
Count
++;
precs
.
children
.
add
(
entry
);
decl
AndPrecs
Count
++;
}
private
void
addImport
(
OutlineEntry
entry
)
{
...
...
@@ -359,7 +375,7 @@ public class CupContentOutlinePage extends ContentOutlinePage implements
builder
.
append
(
Utility
.
shortenedList
(
node
.
getTerminals
(),
t
->
t
.
getNameStringOrNull
(),
this
.
shortenListsTo
));
}
add
DeclOr
Prec
(
OutlineEntry
.
fromNode
(
builder
.
toString
(),
node
));
addPrec
(
OutlineEntry
.
fromNode
(
builder
.
toString
(),
node
));
}
@Override
...
...
@@ -419,27 +435,27 @@ public class CupContentOutlinePage extends ContentOutlinePage implements
@Override
public
void
postVisit
(
NonTerminalDeclaration
node
,
OutlineEntry
data
)
{
addDecl
OrPrec
(
OutlineEntry
.
fromNode
(
addDecl
(
OutlineEntry
.
fromNode
(
shortenNonTerminals
(
node
.
getNonTerminals
()),
node
));
}
@Override
public
void
postVisit
(
TerminalDeclaration
node
,
OutlineEntry
data
)
{
addDecl
OrPrec
(
OutlineEntry
.
fromNode
(
addDecl
(
OutlineEntry
.
fromNode
(
shortenTerminals
(
node
.
getTerminals
()),
node
));
}
@Override
public
void
postVisit
(
TypedNonTerminalDeclaration
node
,
OutlineEntry
data
)
{
addDecl
OrPrec
(
OutlineEntry
.
fromNode
(
addDecl
(
OutlineEntry
.
fromNode
(
shortenNonTerminals
(
node
.
getNonTerminals
()),
node
.
type
,
node
));
}
@Override
public
void
postVisit
(
TypedTerminalDeclaration
node
,
OutlineEntry
data
)
{
addDecl
OrPrec
(
OutlineEntry
.
fromNode
(
addDecl
(
OutlineEntry
.
fromNode
(
shortenTerminals
(
node
.
getTerminals
()),
node
.
type
,
node
));
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment