Commit 783411a9 authored by Benedikt Engeser's avatar Benedikt Engeser

restdateien

parent ba9e8bdb
package de.tum.in.www2.cupplugin.controller;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.text.IDocument;
import org.eclipse.ui.progress.UIJob;
public class DocumentDidChangeJob extends Job {
boolean iAmCurrentlyRunning = false;
IDocument myDocument = null;
public DocumentDidChangeJob(IDocument doc) {
super(""+ doc.hashCode());
myDocument = doc;
}
public boolean running(){
return iAmCurrentlyRunning;
}
@Override
protected IStatus run(IProgressMonitor monitor) {
iAmCurrentlyRunning = true;
/*
* TODO: Job bestücken, vll mit callbacks
*/
//nichts mehr ändern ab hier
iAmCurrentlyRunning = false;
CallbackJob cb = new CallbackJob(myDocument);
cb.setSystem(true);
cb.schedule();
return Status.OK_STATUS;
}
class CallbackJob extends UIJob{
IDocument myDocument = null;
public CallbackJob(IDocument doc) {
super(""+ doc.hashCode());
myDocument = doc;
}
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
Controller.getInstance(myDocument).notifyChangeJobFinished();
return Status.OK_STATUS;
}
}
}
package de.tum.in.www2.cupplugin.controller;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.ui.PlatformUI;
public final class Utility {
public static void showMessage(String message) {
MessageBox mb = new MessageBox(PlatformUI.getWorkbench().getDisplay().getActiveShell());
mb.setMessage(message);
mb.open();
}
}
\ No newline at end of file
package de.tum.in.www2.cupplugin.editors;
import org.eclipse.jface.text.DocumentEvent;
import org.eclipse.jface.text.IDocumentListener;
import de.tum.in.www2.cupplugin.controller.Controller;
class CTEDocumentListener implements IDocumentListener {
@Override
public void documentAboutToBeChanged(DocumentEvent event) {
return;
}
@Override
public void documentChanged(DocumentEvent event) {
System.out.println("starting job chain"); // Log message TODO: DELETE!
Controller controller = Controller.getInstance(event.getDocument());
controller.notifyChange();
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment