Commit 19c5a3d1 authored by Ubbo Veentjer's avatar Ubbo Veentjer
Browse files

saving and changeState

parent a0201078
......@@ -15,8 +15,11 @@ import org.eclipse.swt.SWTError;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.browser.ProgressEvent;
import org.eclipse.swt.browser.ProgressListener;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.EditorPart;
......@@ -30,11 +33,13 @@ public class SammlungsDbEditor extends EditorPart {
private Browser browser;
private boolean browserReady = false;
private ArrayList<UIJob> browserJobs = new ArrayList<UIJob>();
private boolean dirty = false;
@Override
public void doSave(IProgressMonitor arg0) {
// TODO Auto-generated method stub
scheduleJavascript("save();");
setDirty(false);
}
@Override
......@@ -71,7 +76,30 @@ public class SammlungsDbEditor extends EditorPart {
@Override
public boolean isDirty() {
// TODO Auto-generated method stub
return false;
//return false;
//scheduleJavascript("isDirty();");
/*Boolean dirty = false;
if(browserReady){
try {
Object bdirty = browser.evaluate("isDirty()");
System.out.println("bready " + bdirty + " - " + bdirty.getClass().getName());
} catch(Exception e) {
System.out.println("catched " + e.getMessage());
}
//System.out.println(bready);
}*/
//System.out.println("isDirty called " + dirty);
return dirty;
}
private void setDirty(boolean dirty) {
if (dirty != this.dirty) {
this.dirty = dirty;
firePropertyChange(IEditorPart.PROP_DIRTY);
}
}
@Override
......@@ -117,8 +145,25 @@ public class SammlungsDbEditor extends EditorPart {
}
}
});
browser.addKeyListener(new KeyListener() {
@Override
public void keyPressed(KeyEvent e) {
setDirty(true);
}
@Override
public void keyReleased(KeyEvent e) {
//dirty = true;
//System.out.println("key released");
}
});
}
/**
......
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