Author: sdzmitrovich
Date: 2009-09-24 10:56:02 -0400 (Thu, 24 Sep 2009)
New Revision: 17717
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/CSSPropertyPage.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/AbstractCSSDialog.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/StyleAttributes.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/Util.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/BaseTabControl.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabQuickEditControl.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4940
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/CSSPropertyPage.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/CSSPropertyPage.java 2009-09-24
13:53:59 UTC (rev 17716)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/CSSPropertyPage.java 2009-09-24
14:56:02 UTC (rev 17717)
@@ -14,7 +14,6 @@
import org.eclipse.core.databinding.DataBindingContext;
import org.eclipse.core.databinding.observable.ChangeEvent;
import org.eclipse.core.databinding.observable.IChangeListener;
-import org.eclipse.core.databinding.observable.IObservable;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
@@ -50,8 +49,7 @@
super(tabbedPropertySheetPageContributor);
bindingContext = new DataBindingContext();
styleAttributes = new StyleAttributes();
- ((IObservable) styleAttributes.getAttributeMap())
- .addChangeListener(this);
+ styleAttributes.addChangeListener(this);
this.part = part;
}
@@ -99,7 +97,7 @@
|| (!selectedObject.equals(newSelectedObject)))
super.selectionChanged(part, selection);
selectedObject = newSelectedObject;
-
+
update();
}
@@ -109,12 +107,10 @@
public void update() {
if (selectedObject instanceof StyleContainer) {
- ((IObservable) getStyleAttributes().getAttributeMap())
- .removeChangeListener(this);
+ getStyleAttributes().removeChangeListener(this);
getStyleAttributes().setStyleProperties(
((StyleContainer) selectedObject).getStyleAttributes());
- ((IObservable) getStyleAttributes().getAttributeMap())
- .addChangeListener(this);
+ getStyleAttributes().addChangeListener(this);
}
}
@@ -125,7 +121,7 @@
((StyleContainer) selectedObject)
.applyStyleAttributes(getStyleAttributes()
- .getAttributeMap());
+ .getStyleProperties());
}
notifySelectionChanged(getCurrentSelection());
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/AbstractCSSDialog.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/AbstractCSSDialog.java 2009-09-24
13:53:59 UTC (rev 17716)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/AbstractCSSDialog.java 2009-09-24
14:56:02 UTC (rev 17717)
@@ -104,15 +104,14 @@
dialogContainer.setLayoutData(new GridData(GridData.FILL,
GridData.BEGINNING, true, true));
- ((IObservable) getStyleAttributes().getAttributeMap())
- .addChangeListener(new IChangeListener() {
+ getStyleAttributes().addChangeListener(new IChangeListener() {
- public void handleChange(ChangeEvent event) {
- handleStyleChanged();
+ public void handleChange(ChangeEvent event) {
+ handleStyleChanged();
- }
+ }
- });
+ });
aggregateStatus = new AggregateValidationStatus(
getBindingContext().getValidationStatusProviders(),
@@ -230,7 +229,7 @@
StringBuffer html = new StringBuffer(Constants.OPEN_DIV_TAG);
for (Map.Entry<String, String> styleItem : getStyleAttributes()
- .getAttributeMap().entrySet()) {
+ .entrySet()) {
html.append(styleItem.getKey() + Constants.COLON
+ styleItem.getValue() + Constants.SEMICOLON);
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/StyleAttributes.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/StyleAttributes.java 2009-09-24
13:53:59 UTC (rev 17716)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/StyleAttributes.java 2009-09-24
14:56:02 UTC (rev 17717)
@@ -14,6 +14,8 @@
import java.util.Set;
import java.util.Map.Entry;
+import org.eclipse.core.databinding.observable.IChangeListener;
+import org.eclipse.core.databinding.observable.map.IObservableMap;
import org.eclipse.core.databinding.observable.map.WritableMap;
/**
@@ -21,7 +23,7 @@
*/
public class StyleAttributes {
- private Map<String, String> attributeMap = null;
+ private IObservableMap attributeMap = null;
/**
* Default constructor.
@@ -31,24 +33,16 @@
}
/**
- * Gets attribute map.
- *
- * @return map of attributes
- */
- public Map<String, String> getAttributeMap() {
- return attributeMap;
- }
-
- /**
* Add attribute with the given name and value.
*
* @param name
+ *
* the name of attribute
* @param value
* the value of attribute
*/
- public void addAttribute(String name, String value) {
- attributeMap.put(name, value);
+ public String put(String name, String value) {
+ return (String) attributeMap.put(name.toLowerCase(), value);
}
/**
@@ -57,8 +51,8 @@
* @param name
* the name of attribute to be removed
*/
- public void removeAttribute(String name) {
- attributeMap.remove(name);
+ public void remove(String name) {
+ attributeMap.remove(name.toLowerCase());
}
/**
@@ -75,8 +69,8 @@
* the name of attribute to be returned
* @return attribute value
*/
- public String getAttribute(String name) {
- String value = attributeMap.get(name);
+ public String get(Object name) {
+ String value = (String) attributeMap.get(name);
return value != null ? value : Constants.EMPTY;
}
@@ -99,9 +93,17 @@
*/
public void setStyleProperties(Map<String, String> properties) {
attributeMap.clear();
- attributeMap.putAll(properties);
+
+ for (Entry<String, String> entry : properties.entrySet()) {
+ attributeMap.put(entry.getKey().toLowerCase(), entry.getValue());
+ }
+
}
+ public Map<String, String> getStyleProperties() {
+ return attributeMap;
+ }
+
/**
* String representation of style attributes.
*
@@ -118,4 +120,17 @@
}
return buf.toString();
}
+
+ public IObservableMap getObservableMap() {
+ return attributeMap;
+ }
+
+ public void addChangeListener(IChangeListener listener) {
+ attributeMap.addChangeListener(listener);
+ }
+
+ public void removeChangeListener(IChangeListener listener) {
+ attributeMap.removeChangeListener(listener);
+ }
+
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/Util.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/Util.java 2009-09-24
13:53:59 UTC (rev 17716)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/Util.java 2009-09-24
14:56:02 UTC (rev 17717)
@@ -100,7 +100,7 @@
for (String str : set) {
ArrayList<String> list = elementMap.get(str);
- if(list.contains(name)) {
+ if(list.contains(name.toLowerCase())) {
return true;
}
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/BaseTabControl.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/BaseTabControl.java 2009-09-24
13:53:59 UTC (rev 17716)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/BaseTabControl.java 2009-09-24
14:56:02 UTC (rev 17717)
@@ -16,7 +16,6 @@
import org.eclipse.core.databinding.DataBindingContext;
import org.eclipse.core.databinding.UpdateValueStrategy;
import org.eclipse.core.databinding.observable.Observables;
-import org.eclipse.core.databinding.observable.map.IObservableMap;
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IAdaptable;
@@ -270,10 +269,10 @@
List<String> values = CSSConstants.CSS_STYLE_VALUES_MAP
.get(attribute);
-
+
if ((values != null) && !values.contains(value))
value = adjustBackgroundURL((String) value);
-
+
return super.doSet(observableValue, value);
}
}, null);
@@ -464,9 +463,8 @@
}
private IObservableValue createAttributeObservableValue(String attributeName) {
- return Observables.observeMapEntry(
- (IObservableMap) getStyleAttributes().getAttributeMap(),
- attributeName, String.class);
+ return Observables.observeMapEntry(getStyleAttributes()
+ .getObservableMap(), attributeName, String.class);
}
private void bind(Widget widget, String attribute) {
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabQuickEditControl.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabQuickEditControl.java 2009-09-24
13:53:59 UTC (rev 17716)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabQuickEditControl.java 2009-09-24
14:56:02 UTC (rev 17717)
@@ -61,7 +61,7 @@
for (String key : listKeys) {
- String value = getStyleAttributes().getAttribute(key);
+ String value = getStyleAttributes().get(key);
if (value != null && value.length() > 0) {
addLabel(this, key);
createControl(this, key);