Author: yradtsevich
Date: 2009-12-02 05:05:14 -0500 (Wed, 02 Dec 2009)
New Revision: 18971
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/CSSModel.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4407
workaround applied
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/CSSModel.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/CSSModel.java 2009-12-02
10:03:37 UTC (rev 18970)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/CSSModel.java 2009-12-02
10:05:14 UTC (rev 18971)
@@ -58,6 +58,9 @@
private CSSStyleSheet styleSheet = null;
private static final String COPY_SUFFIX = "_copy"; //$NON-NLS-1$
private boolean copy = false;
+
+ // workaround for JBIDE-4407
+ private String oldText = null;
/**
* Constructor.
@@ -105,6 +108,9 @@
partitioner.connect(model.getStructuredDocument());
}
+ // workaround for JBIDE-4407
+ oldText = model.getStructuredDocument().get();
+
if (model instanceof ICSSModel) {
ICSSModel cssModel = (ICSSModel) model;
@@ -221,6 +227,9 @@
}
model = null;
+ // workaround for JBIDE-4407
+ oldText = null;
+
}
public void save() {
@@ -242,7 +251,15 @@
buffer.setDirty(false);
}
- model.save();
+ // workaround for JBIDE-4407
+ // if the model is unchanged the text CSS editor
+ // loses highlighting. When the problem will be fixed on
+ // the WTP side, the following checking will not be needed.
+ String newText = model.getStructuredDocument().get();
+ if (!oldText.equals(newText)) {
+ model.save();
+ oldText = newText;
+ }
} catch (IOException e) {
JspEditorPlugin.getPluginLog().logError(e.getMessage());
} catch (CoreException e) {
@@ -253,7 +270,6 @@
public void setFile(final IFile file) {
this.styleFile = file;
-
}
public void updateCSSStyle(final String selectorLabel,