Cancel funktioniert jetzt.
This commit is contained in:
parent
157a4c18c2
commit
9e78c6e91c
@ -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();
|
||||
}
|
||||
|
@ -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()));
|
||||
|
@ -1,2 +1,3 @@
|
||||
/.settings/
|
||||
*.project
|
||||
/target/
|
||||
|
@ -5,7 +5,13 @@
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
|
Loading…
Reference in New Issue
Block a user