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
Dr. Michael Petter
CUP Eclipse Plugin
Commits
774700de
Commit
774700de
authored
Nov 28, 2014
by
Johannes Roith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mixed debugger changes.
parent
d5875247
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
78 deletions
+37
-78
CupPlugin/src/de/tum/in/www2/cupplugin/debug/BreakpointListener.java
...rc/de/tum/in/www2/cupplugin/debug/BreakpointListener.java
+5
-6
CupPlugin/src/de/tum/in/www2/cupplugin/debug/BreakpointMapper.java
.../src/de/tum/in/www2/cupplugin/debug/BreakpointMapper.java
+11
-23
CupPlugin/src/de/tum/in/www2/cupplugin/debug/Debugger.java
CupPlugin/src/de/tum/in/www2/cupplugin/debug/Debugger.java
+5
-8
CupPlugin/src/de/tum/in/www2/cupplugin/debug/ToggleBreakpointsTarget.java
.../tum/in/www2/cupplugin/debug/ToggleBreakpointsTarget.java
+16
-41
No files found.
CupPlugin/src/de/tum/in/www2/cupplugin/debug/BreakpointListener.java
View file @
774700de
...
...
@@ -27,13 +27,12 @@ public class BreakpointListener implements IBreakpointListener {
@Override
public
void
breakpointAdded
(
IBreakpoint
breakpoint
)
{
// TODO Auto-generated method stub
System
.
out
.
println
(
"ADD: "
+
breakpoint
);
// System.err.println("ADD: " + breakpoint);
if
(
breakpoint
.
getMarker
().
getResource
()
!=
null
)
{
System
.
out
.
println
(
"AT: "
+
breakpoint
.
getMarker
().
getResource
()
.
getProjectRelativePath
().
toString
()+
" LINE: "
+
breakpoint
.
getMarker
().
getAttribute
(
IMarker
.
LINE_NUMBER
,
0
));
// System.err
.println("AT: "
//
+ breakpoint.getMarker().getResource()
//
.getProjectRelativePath().toString()+" LINE: "+breakpoint.getMarker().getAttribute(IMarker.LINE_NUMBER, 0));
PluginUtility
.
findGenerated
((
IFile
)
breakpoint
.
getMarker
().
getResource
());
}
...
...
@@ -47,7 +46,7 @@ public class BreakpointListener implements IBreakpointListener {
@Override
public
void
breakpointRemoved
(
IBreakpoint
breakpoint
,
IMarkerDelta
delta
)
{
System
.
out
.
println
(
"DELETE: "
+
breakpoint
+
" \n DELTA: "
+
delta
);
// System.err
.println("DELETE: " + breakpoint + " \n DELTA: " + delta);
if
(
breakpoint
instanceof
CupLineBreakpoint
){
mapper
.
remove
((
CupLineBreakpoint
)
breakpoint
);
}
...
...
CupPlugin/src/de/tum/in/www2/cupplugin/debug/BreakpointMapper.java
View file @
774700de
...
...
@@ -46,8 +46,8 @@ public class BreakpointMapper {
private
void
addRemoteBreakpoint
(
CupLineBreakpoint
origin
)
{
IResource
originResource
=
origin
.
getMarker
().
getResource
();
System
.
err
.
println
(
">>>>> CALLING FOR "
+
origin
.
getResource
());
System
.
err
.
println
(
">>>>> CALLING FOR getResource "
+
originResource
)
;
if
(
originResource
==
null
)
return
;
IDocument
document
=
null
;
if
(
originResource
instanceof
IDocument
)
{
...
...
@@ -67,22 +67,17 @@ public class BreakpointMapper {
}
Debugger
dbg
=
Debugger
.
getInstance
(
document
);
System
.
out
.
println
(
">>>>>>>>> originResource: "
+
originResource
);
if
(
originResource
==
null
)
return
;
ParserResult
astModel
=
dbg
.
getParserResult
();
if
(
astModel
==
null
)
if
(
astModel
==
null
)
{
// TODO: warn
return
;
}
System
.
out
.
println
(
"-------- begin locator"
);
IFile
resource
=
locator
.
find
((
IFile
)
originResource
,
astModel
);
System
.
out
.
println
(
"-------- end locator"
);
if
(
resource
==
null
)
if
(
resource
==
null
)
{
// TODO: warn
return
;
}
BufferedReader
reader
;
try
{
...
...
@@ -99,8 +94,10 @@ public class BreakpointMapper {
return
;
Mapping
debugId
=
dbg
.
getDebugId
(
originLineNumber
);
if
(
debugId
==
null
)
if
(
debugId
==
null
)
{
// TODO: warn
return
;
}
debugIds
.
add
(
debugId
.
getDebugId
());
...
...
@@ -112,21 +109,12 @@ public class BreakpointMapper {
private
void
doCreateTargetBreakpoint
(
CupLineBreakpoint
origin
,
IDocument
doc
,
IFile
remoteFile
,
int
remoteLineNumber
)
{
if
(
remoteLineNumber
==
-
1
)
return
;
System
.
err
.
println
(
"CREATING REMOTE BREAKPOINT for "
+
origin
.
getResource
()
+
" at remote file "
+
remoteFile
+
" line : "
+
remoteLineNumber
);
Map
<
String
,
Object
>
attributes
=
new
HashMap
<
String
,
Object
>();
attributes
.
put
(
IBreakpoint
.
PERSISTED
,
false
);
IJavaLineBreakpoint
remote
=
null
;
if
(
remoteFile
!=
null
)
{
try
{
// targetClass
String
targetClass
=
Debugger
.
getInstance
(
doc
).
getGeneratedTargetClass
(
origin
);
System
.
out
.
println
(
"targetClass: "
+
targetClass
);
remote
=
JDIDebugModel
.
createLineBreakpoint
(
remoteFile
,
targetClass
,
remoteLineNumber
,
-
1
,
-
1
,
0
,
true
,
attributes
);
...
...
CupPlugin/src/de/tum/in/www2/cupplugin/debug/Debugger.java
View file @
774700de
...
...
@@ -54,12 +54,9 @@ public class Debugger {
// the document, the instance is managing
// private CupTextEditor myEditor = null;
private
IDocument
document
=
null
;
private
static
IBreakpointManager
D
efaultBreakPointManager
=
null
;
private
static
IBreakpointManager
d
efaultBreakPointManager
=
null
;
public
static
Debugger
getInstance
(
IDocument
document
)
{
System
.
out
.
println
(
"GETTING DEBUGGER INSTANCE FOR: "
+
document
);
Debugger
instance
=
instances
.
get
(
document
);
if
(
instance
!=
null
)
{
/*
...
...
@@ -124,18 +121,18 @@ public class Debugger {
*/
public
Debugger
(
IDocument
document
)
{
this
.
document
=
document
;
D
efaultBreakPointManager
=
DebugPlugin
.
getDefault
()
d
efaultBreakPointManager
=
DebugPlugin
.
getDefault
()
.
getBreakpointManager
();
BreakpointListener
.
getInstance
();
}
public
static
IBreakpointManager
getBreakpointManager
()
{
if
(
D
efaultBreakPointManager
==
null
)
{
D
efaultBreakPointManager
=
DebugPlugin
.
getDefault
()
if
(
d
efaultBreakPointManager
==
null
)
{
d
efaultBreakPointManager
=
DebugPlugin
.
getDefault
()
.
getBreakpointManager
();
}
return
D
efaultBreakPointManager
;
return
d
efaultBreakPointManager
;
}
/**
...
...
CupPlugin/src/de/tum/in/www2/cupplugin/debug/ToggleBreakpointsTarget.java
View file @
774700de
...
...
@@ -30,9 +30,6 @@ public class ToggleBreakpointsTarget implements IToggleBreakpointsTarget {
textEditor
=
(
CupTextEditor
)
editor
;
}
if
(
textEditor
!=
null
)
{
// prepare everything
IResource
resource
=
(
IResource
)
textEditor
.
getEditorInput
()
.
getAdapter
(
IResource
.
class
);
...
...
@@ -53,27 +50,35 @@ public class ToggleBreakpointsTarget implements IToggleBreakpointsTarget {
doc
=
textEditor
.
getDocumentProvider
().
getDocument
(
textEditor
.
getEditorInput
());
if
(
doc
==
null
)
{
if
(
doc
==
null
)
return
;
}
// create breakpoint and give it to IDE
boolean
didRemove
=
false
;
IBreakpoint
[]
breakpoints
=
(
IBreakpoint
[])
Debugger
.
getBreakpointManager
().
getBreakpoints
();
if
(
breakpoints
!=
null
)
{
for
(
int
i
=
0
;
i
<
breakpoints
.
length
;
i
++)
{
IBreakpoint
breakpoint
=
breakpoints
[
i
];
if
(
resource
.
equals
(
breakpoint
.
getMarker
().
getResource
()))
{
if
(((
ILineBreakpoint
)
breakpoint
).
getLineNumber
()
==
(
lineNumber
+
1
))
{
// existing breakpoint; delete
Debugger
.
getBreakpointManager
().
removeBreakpoint
(
breakpoint
,
true
);
return
;
if
(
breakpoint
instanceof
CupLineBreakpoint
)
{
if
(
resource
.
equals
(
breakpoint
.
getMarker
().
getResource
()))
{
int
lnum
=
((
ILineBreakpoint
)
breakpoint
).
getLineNumber
();
if
(
lnum
==
lineNumber
+
1
)
{
// existing breakpoint; delete
Debugger
.
getBreakpointManager
().
removeBreakpoint
(
breakpoint
,
true
);
didRemove
=
true
;
}
}
}
}
}
if
(
didRemove
)
return
;
// new breakpoint; create
CupLineBreakpoint
lineBreakpoint
=
new
CupLineBreakpoint
(
resource
,
lineNumber
+
1
);
...
...
@@ -124,53 +129,23 @@ public class ToggleBreakpointsTarget implements IToggleBreakpointsTarget {
@Override
public
void
toggleMethodBreakpoints
(
IWorkbenchPart
part
,
ISelection
selection
)
throws
CoreException
{
// not implemented
// System.out.println("toggle watchpoints called");// TODO: DELETE
}
@Override
public
boolean
canToggleMethodBreakpoints
(
IWorkbenchPart
part
,
ISelection
selection
)
{
// default answer: false
return
false
;
// do this, if you want to toggle method bps
/*
* if (part instanceof CupTextEditor) return true; if (part instanceof
* MultiPageEditor) { Object editor = ((MultiPageEditor)
* part).getSelectedPage(); /*System.out.println("" + editor +
* " is a CupTextEditor(MethodBreakpoints):" + (editor instanceof
* CupTextEditor));
*/
// TODO: DELETE
/*
* return (editor instanceof CupTextEditor); } return false;
*/
}
@Override
public
void
toggleWatchpoints
(
IWorkbenchPart
part
,
ISelection
selection
)
throws
CoreException
{
// System.out.println("toggleWatchpoints called");
}
@Override
public
boolean
canToggleWatchpoints
(
IWorkbenchPart
part
,
ISelection
selection
)
{
return
false
;
/*
* if (part instanceof CupTextEditor) return true; if (part instanceof
* MultiPageEditor) { Object editor = ((MultiPageEditor)
* part).getSelectedPage(); /*System.out.println("" + editor +
* " is a CupTextEditor(Watchpoints):" + (editor instanceof
* CupTextEditor));
*/
// TODO: DELETE
/*
* return (editor instanceof CupTextEditor); } return false;
*/
}
}
\ No newline at end of file
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