Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
ComplexityParser
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
GitLab upgrade completed. Current version is 17.11.4.
Show more breadcrumbs
Emmanuel Hainry
ComplexityParser
Commits
ec1f8f7f
Commit
ec1f8f7f
authored
6 years ago
by
zyno1
Browse files
Options
Downloads
Patches
Plain Diff
base
parent
15e57b06
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/main/java/complexityparser/Model.java
+14
-6
14 additions, 6 deletions
src/main/java/complexityparser/Model.java
src/main/java/view/EditorView.java
+42
-0
42 additions, 0 deletions
src/main/java/view/EditorView.java
src/main/java/view/MainFrame.java
+7
-1
7 additions, 1 deletion
src/main/java/view/MainFrame.java
with
63 additions
and
7 deletions
src/main/java/complexityparser/Model.java
+
14
−
6
View file @
ec1f8f7f
...
...
@@ -22,12 +22,7 @@ public class Model extends Observable {
public
Model
()
{
code
=
"class MainClass {public static void main(String[] arg) {System.out.println(\"Hello World\");int i = 0;}}"
;
CharStream
input
=
CharStreams
.
fromString
(
code
);
lexer
=
new
Java8Lexer
(
input
);
token
=
new
CommonTokenStream
(
lexer
);
parser
=
new
Java8Parser
(
token
);
context
=
parser
.
compilationUnit
();
setCode
(
code
);
}
public
TreeViewer
getTreeComponent
()
{
...
...
@@ -38,4 +33,17 @@ public class Model extends Observable {
return
viewer
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
CharStream
input
=
CharStreams
.
fromString
(
code
);
lexer
=
new
Java8Lexer
(
input
);
token
=
new
CommonTokenStream
(
lexer
);
parser
=
new
Java8Parser
(
token
);
context
=
parser
.
compilationUnit
();
update
();
}
}
This diff is collapsed.
Click to expand it.
src/main/java/view/EditorView.java
0 → 100644
+
42
−
0
View file @
ec1f8f7f
package
view
;
import
complexityparser.Model
;
import
javax.swing.*
;
import
java.awt.*
;
public
class
EditorView
extends
JPanel
{
private
JScrollPane
panel
;
private
JTextArea
area
;
private
JButton
updateButton
;
private
Model
m
;
public
EditorView
(
Model
m
)
{
this
.
m
=
m
;
area
=
new
JTextArea
();
area
.
setCaretColor
(
Color
.
WHITE
);
area
.
getCaret
().
setBlinkRate
(
0
);
area
.
setTabSize
(
3
);
area
.
setFont
(
new
Font
(
"monospaced"
,
Font
.
PLAIN
,
12
));
panel
=
new
JScrollPane
(
area
);
updateButton
=
new
JButton
(
"update"
);
updateButton
.
addActionListener
((
e
)
->
{
String
code
=
area
.
getText
();
m
.
setCode
(
code
);
});
BorderLayout
layout
=
new
BorderLayout
();
setLayout
(
layout
);
add
(
panel
,
BorderLayout
.
CENTER
);
add
(
updateButton
,
BorderLayout
.
SOUTH
);
setPreferredSize
(
new
Dimension
(
600
,
600
));
}
}
This diff is collapsed.
Click to expand it.
src/main/java/view/MainFrame.java
+
7
−
1
View file @
ec1f8f7f
...
...
@@ -3,6 +3,7 @@ package view;
import
complexityparser.Model
;
import
javax.swing.*
;
import
java.awt.*
;
public
class
MainFrame
extends
JFrame
{
public
MainFrame
(
Model
m
)
{
...
...
@@ -11,7 +12,12 @@ public class MainFrame extends JFrame {
setDefaultCloseOperation
(
WindowConstants
.
EXIT_ON_CLOSE
);
setTitle
(
"ComplexityParser"
);
add
(
new
TreePanel
(
m
));
BorderLayout
layout
=
new
BorderLayout
();
setLayout
(
layout
);
add
(
new
EditorView
(
m
),
BorderLayout
.
WEST
);
add
(
new
TreePanel
(
m
),
BorderLayout
.
CENTER
);
pack
();
//setSize(600,600);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment