[jbosstools-commits] JBoss Tools SVN: r17699 - in trunk/jst/plugins: org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common and 1 other directory.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Wed Sep 23 06:39:43 EDT 2009


Author: sdzmitrovich
Date: 2009-09-23 06:39:42 -0400 (Wed, 23 Sep 2009)
New Revision: 17699

Modified:
   trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/common/CSSStyleListener.java
   trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/common/CSSStyleRuleContainer.java
   trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/common/StyleContainer.java
   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/Constants.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4677

Modified: trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/common/CSSStyleListener.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/common/CSSStyleListener.java	2009-09-23 07:57:59 UTC (rev 17698)
+++ trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/common/CSSStyleListener.java	2009-09-23 10:39:42 UTC (rev 17699)
@@ -98,7 +98,7 @@
 
 			ISelection selectionToLiteners = null;
 
-			if (newStyle != null) {
+			if (newStyle != null && newStyle.isValid()) {
 				selectionToLiteners = new StructuredSelection(newStyle);
 			} else {
 				selectionToLiteners = StructuredSelection.EMPTY;

Modified: trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/common/CSSStyleRuleContainer.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/common/CSSStyleRuleContainer.java	2009-09-23 07:57:59 UTC (rev 17698)
+++ trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/common/CSSStyleRuleContainer.java	2009-09-23 10:39:42 UTC (rev 17699)
@@ -100,4 +100,11 @@
 
 	}
 
+	@Override
+	public boolean isValid() {
+		final String text = styleRule.getCssText();
+		if ((text != null) && (!text.endsWith(Constants.RIGHT_BRACE)))
+			return false;
+		return true;
+	}
 }

Modified: trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/common/StyleContainer.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/common/StyleContainer.java	2009-09-23 07:57:59 UTC (rev 17698)
+++ trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/common/StyleContainer.java	2009-09-23 10:39:42 UTC (rev 17699)
@@ -50,4 +50,8 @@
 
 	public abstract void removeNodelListener(INodeAdapter adapter);
 
+	public boolean isValid() {
+		return true;
+	}
+
 }

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-09-23 07:57:59 UTC (rev 17698)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/CSSModel.java	2009-09-23 10:39:42 UTC (rev 17699)
@@ -52,9 +52,6 @@
  */
 public class CSSModel implements ICSSDialogModel {
 
-	private static String startBraces = "{"; //$NON-NLS-1$
-	private static String endBraces = "}"; //$NON-NLS-1$
-
 	private IStructuredModel model = null;
 	private IFile styleFile = null;
 
@@ -131,7 +128,7 @@
 		if ((styleSheet != null) && (selector != null)
 				&& !selector.equals(Constants.EMPTY)) {
 			CSSStyleRule rule = (CSSStyleRule) ((ICSSDocument) styleSheet)
-					.createCSSRule(selector + startBraces + endBraces);
+					.createCSSRule(selector + Constants.LEFT_BRACE + Constants.RIGHT_BRACE);
 			((ICSSStyleSheet) styleSheet).appendRule(rule);
 
 			for (Map.Entry<String, CSSStyleRule> ruleEntry : getRulesMapping()
@@ -312,8 +309,8 @@
 		if ((rules != null) && (rules.getLength() > 0)) {
 			final CSSRule rule = rules.item(rules.getLength() - 1);
 			final String text = rule.getCssText();
-			if ((text != null) && (!text.endsWith(endBraces))) {
-				rule.setCssText(text + "\n" + endBraces); //$NON-NLS-1$
+			if ((text != null) && (!text.endsWith(Constants.RIGHT_BRACE))) {
+				rule.setCssText(text + "\n" + Constants.RIGHT_BRACE); //$NON-NLS-1$
 			}
 		}
 	}

Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/Constants.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/Constants.java	2009-09-23 07:57:59 UTC (rev 17698)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/Constants.java	2009-09-23 10:39:42 UTC (rev 17699)
@@ -7,7 +7,7 @@
  *
  * Contributors:
  *     Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/ 
+ ******************************************************************************/
 package org.jboss.tools.jst.jsp.outline.cssdialog.common;
 
 import java.util.Arrays;
@@ -26,57 +26,65 @@
  */
 public class Constants {
 
-    public static final String extSizes[] = new String[] { "", "em", "ex", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-	    "px", "in", "cm", "mm", "pt", "pc" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+	public static final String extSizes[] = new String[] { "", "em", "ex", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+			"px", "in", "cm", "mm", "pt", "pc" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
 
-    public static final Set elemFolder = Collections.unmodifiableSet(new HashSet(Arrays.asList(new String[] {
-	    "background-image", "list-style-image", "cursor", "cue-after", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-	    "cue-before" }))); //$NON-NLS-1$
+	public static final Set elemFolder = Collections
+			.unmodifiableSet(new HashSet(
+					Arrays
+							.asList(new String[] {
+									"background-image", "list-style-image", "cursor", "cue-after", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+									"cue-before" }))); //$NON-NLS-1$
 
-    public static final Set extElem = Collections.unmodifiableSet(new HashSet(Arrays.asList(new String[] {
-	    "border-bottom-width", "border-left-width", "borer-right-width", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-	    "border-top-width", "border-width", "bottom", "font-size", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-	    "height", "left", "letter-spacing", "line-height", "margin", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
-	    "margin-bottom", "margin-left", "margin-right", "margin-top", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-	    "margin-offset", "margin-bottom", "max-height", "max-width", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-	    "min-height", "min-width", "outline-width", "padding", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-	    "padding-bottom", "padding-left", "padding-right", "padding-top", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-	    "right", "size", "text-indent", "top", "vertical-align", "width", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
-	    "word-spacing" }))); //$NON-NLS-1$
+	public static final Set extElem = Collections
+			.unmodifiableSet(new HashSet(
+					Arrays
+							.asList(new String[] {
+									"border-bottom-width", "border-left-width", "borer-right-width", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+									"border-top-width", "border-width", "bottom", "font-size", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+									"height", "left", "letter-spacing", "line-height", "margin", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+									"margin-bottom", "margin-left", "margin-right", "margin-top", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+									"margin-offset", "margin-bottom", "max-height", "max-width", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+									"min-height", "min-width", "outline-width", "padding", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+									"padding-bottom", "padding-left", "padding-right", "padding-top", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+									"right", "size", "text-indent", "top", "vertical-align", "width", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+									"word-spacing" }))); //$NON-NLS-1$
 
-    public static final String NONE = "none"; //$NON-NLS-1$
+	public static final String NONE = "none"; //$NON-NLS-1$
 
-    public static final String IMAGE_COLOR_FILE_LOCATION = "images/cssdialog/color.gif"; //$NON-NLS-1$
-    public static final String IMAGE_FOLDER_FILE_LOCATION = "images/cssdialog/folder.gif"; //$NON-NLS-1$
-    public static final String IMAGE_FONT_FILE_LOCATION = "images/cssdialog/font.gif"; //$NON-NLS-1$
-    public static final String IMAGE_COLORLARGE_FILE_LOCATION = "images/cssdialog/color_large.gif"; //$NON-NLS-1$
-    public static final String IMAGE_FOLDERLARGE_FILE_LOCATION = "images/cssdialog/folder_large.gif"; //$NON-NLS-1$
-    public static final String IMAGE_FONTLARGE_FILE_LOCATION = "images/cssdialog/font_large.gif"; //$NON-NLS-1$
-    public static final String IMAGE_LEFT_FILE_LOCATION = "images/cssdialog/left.gif"; //$NON-NLS-1$
-    public static final String IMAGE_RIGHT_FILE_LOCATION = "images/cssdialog/right.gif"; //$NON-NLS-1$
-    public static final String IMAGE_SAMPLE_FILE_LOCATION = "images/cssdialog/sample.gif"; //$NON-NLS-1$
-    
-    public static final int FIRST_COLUMN = 0;
-    public static final int SECOND_COLUMN = 1;
+	public static final String IMAGE_COLOR_FILE_LOCATION = "images/cssdialog/color.gif"; //$NON-NLS-1$
+	public static final String IMAGE_FOLDER_FILE_LOCATION = "images/cssdialog/folder.gif"; //$NON-NLS-1$
+	public static final String IMAGE_FONT_FILE_LOCATION = "images/cssdialog/font.gif"; //$NON-NLS-1$
+	public static final String IMAGE_COLORLARGE_FILE_LOCATION = "images/cssdialog/color_large.gif"; //$NON-NLS-1$
+	public static final String IMAGE_FOLDERLARGE_FILE_LOCATION = "images/cssdialog/folder_large.gif"; //$NON-NLS-1$
+	public static final String IMAGE_FONTLARGE_FILE_LOCATION = "images/cssdialog/font_large.gif"; //$NON-NLS-1$
+	public static final String IMAGE_LEFT_FILE_LOCATION = "images/cssdialog/left.gif"; //$NON-NLS-1$
+	public static final String IMAGE_RIGHT_FILE_LOCATION = "images/cssdialog/right.gif"; //$NON-NLS-1$
+	public static final String IMAGE_SAMPLE_FILE_LOCATION = "images/cssdialog/sample.gif"; //$NON-NLS-1$
 
-    public static final String EMPTY = ""; //$NON-NLS-1$
+	public static final int FIRST_COLUMN = 0;
+	public static final int SECOND_COLUMN = 1;
+
+	public static final String EMPTY = ""; //$NON-NLS-1$
 	public static final String WHITE_SPACE = " "; //$NON-NLS-1$
-    public static String COLON = ":"; //$NON-NLS-1$
-    public static String SEMICOLON = ";"; //$NON-NLS-1$
-    public static String COMMA = ","; //$NON-NLS-1$
-    public static String DASH = "-"; //$NON-NLS-1$
-    public static String SLASH = "/"; //$NON-NLS-1$
+	public static String COLON = ":"; //$NON-NLS-1$
+	public static String SEMICOLON = ";"; //$NON-NLS-1$
+	public static String COMMA = ","; //$NON-NLS-1$
+	public static String DASH = "-"; //$NON-NLS-1$
+	public static String SLASH = "/"; //$NON-NLS-1$
 	public static final String START_BRACKET = "("; //$NON-NLS-1$
 	public static final String END_BRACKET = ")"; //$NON-NLS-1$
 
+	public static final String LEFT_BRACE = "{"; //$NON-NLS-1$
+	public static final String RIGHT_BRACE = "}"; //$NON-NLS-1$
 
-    public static final RGB RGB_BLACK = new RGB(0,0,0);
-    public static final RGB RGB_WHITE = new RGB(0xFF, 0xFF, 0xFF);
+	public static final RGB RGB_BLACK = new RGB(0, 0, 0);
+	public static final RGB RGB_WHITE = new RGB(0xFF, 0xFF, 0xFF);
 
-    public static final int DONT_CONTAIN = -1;
-    
-    public static String OPEN_SPAN_TAG = "<span style=\"width: 100%;"; //$NON-NLS-1$
-    public static String CLOSE_SPAN_TAG = "</span>"; //$NON-NLS-1$
-    public static String OPEN_DIV_TAG = "<div style=\"width: 100%;"; //$NON-NLS-1$
-    public static String CLOSE_DIV_TAG = "</div>"; //$NON-NLS-1$
+	public static final int DONT_CONTAIN = -1;
+
+	public static String OPEN_SPAN_TAG = "<span style=\"width: 100%;"; //$NON-NLS-1$
+	public static String CLOSE_SPAN_TAG = "</span>"; //$NON-NLS-1$
+	public static String OPEN_DIV_TAG = "<div style=\"width: 100%;"; //$NON-NLS-1$
+	public static String CLOSE_DIV_TAG = "</div>"; //$NON-NLS-1$
 }
\ No newline at end of file



More information about the jbosstools-commits mailing list