[jbosstools-commits] JBoss Tools SVN: r9424 - trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Wed Jul 30 06:43:44 EDT 2008


Author: estherbin
Date: 2008-07-30 06:43:43 -0400 (Wed, 30 Jul 2008)
New Revision: 9424

Added:
   trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/ResourceUtil.java
Modified:
   trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/ElService.java
Log:
Move getBundleValue methods to the ResourceUtil class for (https://jira.jboss.org/jira/browse/JBIDE-2582) issue.

Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/ElService.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/ElService.java	2008-07-30 10:08:43 UTC (rev 9423)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/ElService.java	2008-07-30 10:43:43 UTC (rev 9424)
@@ -14,7 +14,6 @@
 
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.runtime.Assert;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
 import org.jboss.tools.vpe.editor.bundle.BundleMap;
 import org.jboss.tools.vpe.editor.context.VpePageContext;
 import org.jboss.tools.vpe.editor.css.ELReferenceList;
@@ -270,12 +269,9 @@
     public String replaceElAndResources(VpePageContext pageContext, Attr attributeNode) {
         final IFile file = pageContext.getVisualBuilder().getCurrentIncludeInfo().getFile();
         final String attribuString = attributeNode.getValue();
-        final BundleMap bundle = pageContext.getBundle();
         String rst  = attribuString;
-      
-        int offset = ((IDOMAttr) attributeNode).getValueRegionStartOffset();
-        rst = bundle.getBundleValue(attribuString, offset);
-
+        
+        rst = ResourceUtil.getBundleValue(pageContext, attributeNode);
         rst = replaceEl(file, rst);
 
         return rst;

Added: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/ResourceUtil.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/ResourceUtil.java	                        (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/ResourceUtil.java	2008-07-30 10:43:43 UTC (rev 9424)
@@ -0,0 +1,54 @@
+/******************************************************************************* 
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.vpe.editor.util;
+
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
+import org.jboss.tools.vpe.editor.bundle.BundleMap;
+import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.w3c.dom.Attr;
+
+/**
+ * @author Evgenij Stherbin
+ *
+ */
+ at SuppressWarnings("restriction")
+public class ResourceUtil {
+    /**
+     * Gets the bundle value.
+     * 
+     * @param value the value
+     * @param offfset      *
+     * param pageContext the page context
+     * @param pageContext the page context
+     * @param offset the offset
+     * 
+     * @return the bundle value
+     */
+    public static String getBundleValue(VpePageContext pageContext, String value, int offset) {
+        BundleMap bundle = pageContext.getBundle();
+        return bundle.getBundleValue(value, offset);
+
+    }
+
+    /**
+     * get bundle.
+     * 
+     * @param pageContext the page context
+     * @param attr the attr
+     * 
+     * @return the bundle value
+     */
+    public static String getBundleValue(VpePageContext pageContext, Attr attr) {
+        return getBundleValue(pageContext, attr.getNodeValue(), ((IDOMAttr) attr).getValueRegionStartOffset());
+    }
+
+}


Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/ResourceUtil.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Author Id Revision Date
Name: svn:eol-style
   + native




More information about the jbosstools-commits mailing list