diff --git a/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/src/typinferenzplugin/Typinferenz.java b/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/src/typinferenzplugin/Typinferenz.java
index b7b9d63..c37a5bd 100644
--- a/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/src/typinferenzplugin/Typinferenz.java
+++ b/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/src/typinferenzplugin/Typinferenz.java
@@ -25,7 +25,6 @@ import org.eclipse.core.runtime.Status;
import de.dhbwstuttgart.bytecode.BytecodeGen;
import de.dhbwstuttgart.bytecode.Exception.BytecodeGeneratorError;
-import de.dhbwstuttgart.bytecode.descriptor.TypeToDescriptor;
import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.GenericGenratorResultForSourceFile;
import de.dhbwstuttgart.core.JavaTXCompiler;
import de.dhbwstuttgart.exceptions.TypeinferenceException;
@@ -200,7 +199,7 @@ public class Typinferenz {
public void cancel() {
try {
- // compiler.usedTasks.cancel();
+ compiler.usedTasks.cancel();
} catch (Exception e) {
e.printStackTrace();
}
diff --git a/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/src/typinferenzplugin/editor/JavEditor.java b/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/src/typinferenzplugin/editor/JavEditor.java
index c58c8b2..6acce39 100644
--- a/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/src/typinferenzplugin/editor/JavEditor.java
+++ b/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/src/typinferenzplugin/editor/JavEditor.java
@@ -30,6 +30,7 @@ import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.Position;
import org.eclipse.jface.text.source.Annotation;
import org.eclipse.jface.text.source.IAnnotationModel;
+import org.eclipse.jface.wizard.ProgressMonitorPart;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IFileEditorInput;
@@ -126,14 +127,38 @@ public class JavEditor extends TextEditor implements UnifyResultListener {
*/
private void typeReconstruction() {
Job job = Job.create("Doing type recoustruction...", (ICoreRunnable) monitor -> {
+ Runnable cancelledChecker = new Runnable() {
+
+ @Override
+ public void run() {
+ boolean finished = false;
+ while (!finished && !Thread.interrupted()) {
+ try {
+ Thread.sleep(200);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ }
+
+ if (monitor.isCanceled()) {
+ typeinference.cancel();
+ finished = true;
+ }
+ }
+ }
+ };
+
+ Thread cancelledCheckerThread = new Thread(cancelledChecker, "TypeinferenceCancelledChecker");
+ cancelledCheckerThread.setDaemon(true);
+
// do something long running
if (!this.typeReplaceMarkers.isEmpty() || !this.errorMarkers.isEmpty()) {
LOG.log(new Status(ERROR, PLUGIN_ID,
- "Fehler: Zuerst Marker löschen, bevor Typinferenz durchgeführt werden kann"));
+ "Fehler: Zuerst Marker löschen, bevor Typinferenz durchgeführt werden kann"));
return;
}
try {
+ cancelledCheckerThread.start();
typeinference.run(this);
} catch (TypeinferenceException texc) {
ErrorMarker errorMarker = new ErrorMarker(texc.getMessage(), new CodePoint(texc.getOffset()));
diff --git a/JavaCompilerPlugin/releng/JavaCompilerPlugin.Target/.gitignore b/JavaCompilerPlugin/releng/JavaCompilerPlugin.Target/.gitignore
index 9ead5fd..33ebcf0 100644
--- a/JavaCompilerPlugin/releng/JavaCompilerPlugin.Target/.gitignore
+++ b/JavaCompilerPlugin/releng/JavaCompilerPlugin.Target/.gitignore
@@ -1,2 +1,3 @@
/.settings/
*.project
+/target/
diff --git a/JavaCompilerPlugin/releng/JavaCompilerPlugin.Target/.project b/JavaCompilerPlugin/releng/JavaCompilerPlugin.Target/.project
index da06dc9..e400cc6 100644
--- a/JavaCompilerPlugin/releng/JavaCompilerPlugin.Target/.project
+++ b/JavaCompilerPlugin/releng/JavaCompilerPlugin.Target/.project
@@ -5,7 +5,13 @@
+
+ org.eclipse.m2e.core.maven2Builder
+
+
+
+ org.eclipse.m2e.core.maven2Nature