Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
DARIAH-DE
TextGridLab
RDF Object Plugin
Commits
19c5a3d1
Commit
19c5a3d1
authored
Apr 17, 2014
by
Ubbo Veentjer
Browse files
saving and changeState
parent
a0201078
Changes
1
Hide whitespace changes
Inline
Side-by-side
de.blumenbach_online.tglab.sammlungsdb/src/de/blumenbach_online/tglab/sammlungsdb/views/SammlungsDbEditor.java
View file @
19c5a3d1
...
...
@@ -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");
}
});
}
/**
...
...
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