diff options
author | RĂ¼diger Timm <rt@openoffice.org> | 2005-01-27 14:28:54 +0000 |
---|---|---|
committer | RĂ¼diger Timm <rt@openoffice.org> | 2005-01-27 14:28:54 +0000 |
commit | ff60a7b84b752def69726a937455968363a291a9 (patch) | |
tree | 5014616811dee7f0ac7d1fabe153ee118e7111ad /scripting | |
parent | e90e74ae4f19f5c9809602d2431027a5bfdde246 (diff) |
INTEGRATION: CWS scriptingf10 (1.2.60); FILE MERGED
2005/01/10 14:10:00 toconnor 1.2.60.2: #i39330# BeanShell editor should prompt before closing
2005/01/06 10:56:35 toconnor 1.2.60.1: #i39330# beanshell editor should prompt to save before closing
Diffstat (limited to 'scripting')
-rwxr-xr-x | scripting/java/com/sun/star/script/framework/provider/beanshell/PlainSourceView.java | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/scripting/java/com/sun/star/script/framework/provider/beanshell/PlainSourceView.java b/scripting/java/com/sun/star/script/framework/provider/beanshell/PlainSourceView.java index 1bb08c2b41bb..eae9ea13d0fc 100755 --- a/scripting/java/com/sun/star/script/framework/provider/beanshell/PlainSourceView.java +++ b/scripting/java/com/sun/star/script/framework/provider/beanshell/PlainSourceView.java @@ -2,9 +2,9 @@ * * $RCSfile: PlainSourceView.java,v $ * -* $Revision: 1.2 $ +* $Revision: 1.3 $ * -* last change: $Author: rt $ $Date: 2004-01-05 13:13:49 $ +* last change: $Author: rt $ $Date: 2005-01-27 15:28:53 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -106,12 +106,15 @@ public class PlainSourceView extends JScrollPane so we don't get a storm of DocumentEvents during loading */ ta.getDocument().removeDocumentListener(this); - if (model.isModified()) { - if (this.isModified()) { - // ouch, contention, prompt for what to do + if (isModified == false) + { + int pos = ta.getCaretPosition(); + ta.setText(model.getText()); + try { + ta.setCaretPosition(pos); } - else { - ta.insert(model.getText(), 0); + catch (IllegalArgumentException iae) { + // do nothing and allow JTextArea to set it's own position } } @@ -132,7 +135,11 @@ public class PlainSourceView extends JScrollPane } public boolean isModified() { - return this.isModified; + return isModified; + } + + public void setModified(boolean value) { + isModified = value; } private void initUI() { @@ -167,7 +174,7 @@ public class PlainSourceView extends JScrollPane /* If the number of lines in the JTextArea has changed then update the GlyphGutter */ public void doChanged(DocumentEvent e) { - this.isModified = true; + isModified = true; if (linecount != ta.getLineCount()) { gg.update(); |