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
86c008d2
Commit
86c008d2
authored
Nov 27, 2014
by
Johannes Roith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Add javacup runtime library to newly created project.
- Run parser in example project.
parent
d0e782b8
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
14 deletions
+47
-14
CupPlugin/src/de/tum/in/www2/cupplugin/controller/RegisterForControllerChanges.java
...w2/cupplugin/controller/RegisterForControllerChanges.java
+11
-0
CupPlugin/src/de/tum/in/www2/cupplugin/wizards/CupJavaProjectWizard.java
...e/tum/in/www2/cupplugin/wizards/CupJavaProjectWizard.java
+28
-12
CupPlugin/templates/Driver.java
CupPlugin/templates/Driver.java
+5
-1
CupPlugin/templates/input.txt
CupPlugin/templates/input.txt
+1
-1
CupPlugin/templates/parser.cup
CupPlugin/templates/parser.cup
+2
-0
No files found.
CupPlugin/src/de/tum/in/www2/cupplugin/controller/RegisterForControllerChanges.java
0 → 100644
View file @
86c008d2
package
de.tum.in.www2.cupplugin.controller
;
import
java.util.EnumSet
;
import
de.tum.in.www2.cupplugin.controller.Controller.JobsToDo
;
public
interface
RegisterForControllerChanges
{
EnumSet
<
JobsToDo
>
getRequiredJobs
();
}
CupPlugin/src/de/tum/in/www2/cupplugin/wizards/CupJavaProjectWizard.java
View file @
86c008d2
...
...
@@ -35,7 +35,10 @@ import org.eclipse.ui.PartInitException;
import
org.eclipse.ui.PlatformUI
;
import
org.eclipse.ui.ide.IDE
;
import
org.eclipse.ui.part.ISetSelectionTarget
;
import
org.eclipse.jdt.core.IClasspathEntry
;
import
org.eclipse.jdt.core.IJavaProject
;
import
org.eclipse.jdt.core.JavaCore
;
import
org.eclipse.jdt.core.JavaModelException
;
import
org.eclipse.jdt.ui.wizards.NewJavaProjectWizardPageOne
;
import
org.eclipse.jdt.ui.wizards.NewJavaProjectWizardPageTwo
;
...
...
@@ -83,20 +86,11 @@ public class CupJavaProjectWizard extends Wizard implements INewWizard {
@Override
public
boolean
performFinish
()
{
IJavaProject
jp
=
secondPage
.
getJavaProject
();
IProject
project
=
jp
.
getProject
();
/*
* IWorkingSet[] workingSets = fFirstPage.getWorkingSets(); if
* (workingSets.length > 0) {
* PlatformUI.getWorkbench().getWorkingSetManager
* ().addToWorkingSets(project, workingSets); }
*/
IRunnableWithProgress
op
=
new
IRunnableWithProgress
()
{
public
void
run
(
IProgressMonitor
monitor
)
throws
InvocationTargetException
{
try
{
doFinish
(
project
,
monitor
);
doFinish
(
jp
,
monitor
);
}
finally
{
monitor
.
done
();
}
...
...
@@ -219,10 +213,12 @@ public class CupJavaProjectWizard extends Wizard implements INewWizard {
return
true
;
}
private
void
doFinish
(
I
Project
project
,
IProgressMonitor
monitor
)
{
private
void
doFinish
(
I
JavaProject
jp
,
IProgressMonitor
monitor
)
{
monitor
.
beginTask
(
"Creating project ..."
,
2
);
IProject
project
=
jp
.
getProject
();
try
{
project
.
open
(
monitor
);
}
catch
(
CoreException
e1
)
{
...
...
@@ -253,11 +249,31 @@ public class CupJavaProjectWizard extends Wizard implements INewWizard {
IFolder
folder
=
createDirectory
(
project
,
monitor
,
"tools"
);
createFile
(
folder
,
monitor
,
"JFlex.jar"
,
getTemplate
(
"JFlex.jar"
));
createFile
(
folder
,
monitor
,
"java-cup-11b-runtime.jar"
,
IFile
runtimeFile
=
createFile
(
folder
,
monitor
,
"java-cup-11b-runtime.jar"
,
getTemplate
(
"java-cup-11b-runtime.jar"
));
createFile
(
folder
,
monitor
,
"java-cup-11b.jar"
,
getTemplate
(
"java-cup-11b.jar"
));
IClasspathEntry
[]
oldClassPath
=
null
;
try
{
oldClassPath
=
jp
.
getRawClasspath
();
}
catch
(
JavaModelException
e2
)
{
e2
.
printStackTrace
();
}
if
(
oldClassPath
!=
null
)
{
IClasspathEntry
[]
newClassPath
=
new
IClasspathEntry
[
oldClassPath
.
length
+
1
];
for
(
int
i
=
0
;
i
<
oldClassPath
.
length
;
i
++)
newClassPath
[
i
]
=
oldClassPath
[
i
];
newClassPath
[
oldClassPath
.
length
]
=
JavaCore
.
newLibraryEntry
(
runtimeFile
.
getFullPath
(),
null
,
null
);
try
{
jp
.
setRawClasspath
(
newClassPath
,
monitor
);
}
catch
(
JavaModelException
e1
)
{
e1
.
printStackTrace
();
}
}
setBuilder
(
project
);
monitor
.
worked
(
1
);
...
...
CupPlugin/templates/Driver.java
View file @
86c008d2
package
cup.example
;
import
java_cup.runtime.*
;
class
Driver
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
System
.
out
.
println
(
"Hello from Driver!"
);
Parser
parser
=
new
Parser
();
parser
.
parse
();
}
}
\ No newline at end of file
CupPlugin/templates/input.txt
View file @
86c008d2
my input file.
\ No newline at end of file
my
\ No newline at end of file
CupPlugin/templates/parser.cup
View file @
86c008d2
...
...
@@ -26,4 +26,6 @@ terminal MYTERMINAL, OTHERTERMINAL;
non
terminal
Integer
expr
;
expr
::=
MYTERMINAL
{:
//
action
code
here
System
.
out
.
println
(
"hello myterminal!"
);
:}
|
OTHERTERMINAL
;
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