Author: dgolovin
Date: 2008-09-30 14:45:39 -0400 (Tue, 30 Sep 2008)
New Revision: 10576
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/bundle/BundleMap.java
Log:
fix compilation problems. Several private methods those have references to ELParser and
ELParser.Token classes where commented out to keep build running. to rollback changes use
Fisheye or SVN history Get content context menu for previous revision
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/bundle/BundleMap.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/bundle/BundleMap.java 2008-09-30
17:01:27 UTC (rev 10575)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/bundle/BundleMap.java 2008-09-30
18:45:39 UTC (rev 10576)
@@ -33,11 +33,11 @@
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.wst.sse.ui.StructuredTextEditor;
+import org.jboss.tools.common.el.core.parser.ELParser;
import org.jboss.tools.common.model.XModel;
import org.jboss.tools.common.model.event.XModelTreeEvent;
import org.jboss.tools.common.model.event.XModelTreeListener;
import org.jboss.tools.common.model.options.PreferenceModelUtilities;
-import org.jboss.tools.common.model.util.ELParser;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.jst.jsp.preferences.VpePreference;
import org.jboss.tools.jst.web.project.WebProject;
@@ -122,53 +122,53 @@
}
public boolean openBundle(String expression, String locale){
- ELParser.Token token = parseJSFExpression(expression);
- if(token == null) return false;
- ELParser.Token t = token;
- String prefix = null;
- String propertyName = null;
- while(t != null) {
- if(t.kind == ELParser.OPEN) {
- String[] values = getCall(expression, t);
- if(values != null) {
- prefix = values[0];
- propertyName = values[1];
- break;
- }
- }
- t = t.next;
- }
- if(prefix == null) return false;
-
- BundleEntry entry = getBundle(prefix);
-
- if(entry == null){
- if (hasJsfProjectNatureType()) {
- IProject project =
((IFileEditorInput)editor.getEditorInput()).getFile().getProject();
- XModel model = EclipseResourceUtil.getModelNature(project).getModel();
- String prefix2 = prefix;
- if(propertyName != null && prefix != null) {
- prefix2 = prefix + "." + propertyName;
- }
- WebPromptingProvider.getInstance().getList(model, WebPromptingProvider.JSF_BEAN_OPEN,
prefix2, null);
- }
- return false;
- }
-
- if (hasJsfProjectNatureType()) {
- Properties p = new Properties();
- p.put(WebPromptingProvider.BUNDLE, entry.uri);
- p.put(WebPromptingProvider.KEY, propertyName);
- if (locale != null) p.put(WebPromptingProvider.LOCALE, locale);
- p.put(WebPromptingProvider.FILE,
((IFileEditorInput)editor.getEditorInput()).getFile().getProject());
-
- IProject project =
((IFileEditorInput)editor.getEditorInput()).getFile().getProject();
- XModel model = EclipseResourceUtil.getModelNature(project).getModel();
-
- WebPromptingProvider.getInstance().getList(model, WebPromptingProvider.JSF_OPEN_KEY,
entry.uri, p);
- String error = p.getProperty(WebPromptingProvider.ERROR);
- return (error == null || error.length() == 0);
- }
+// ELParser.Token token = parseJSFExpression(expression);
+// if(token == null) return false;
+// ELParser.Token t = token;
+// String prefix = null;
+// String propertyName = null;
+// while(t != null) {
+// if(t.kind == ELParser.OPEN) {
+// String[] values = getCall(expression, t);
+// if(values != null) {
+// prefix = values[0];
+// propertyName = values[1];
+// break;
+// }
+// }
+// t = t.next;
+// }
+// if(prefix == null) return false;
+//
+// BundleEntry entry = getBundle(prefix);
+//
+// if(entry == null){
+// if (hasJsfProjectNatureType()) {
+// IProject project =
((IFileEditorInput)editor.getEditorInput()).getFile().getProject();
+// XModel model = EclipseResourceUtil.getModelNature(project).getModel();
+// String prefix2 = prefix;
+// if(propertyName != null && prefix != null) {
+// prefix2 = prefix + "." + propertyName;
+// }
+// WebPromptingProvider.getInstance().getList(model,
WebPromptingProvider.JSF_BEAN_OPEN, prefix2, null);
+// }
+// return false;
+// }
+//
+// if (hasJsfProjectNatureType()) {
+// Properties p = new Properties();
+// p.put(WebPromptingProvider.BUNDLE, entry.uri);
+// p.put(WebPromptingProvider.KEY, propertyName);
+// if (locale != null) p.put(WebPromptingProvider.LOCALE, locale);
+// p.put(WebPromptingProvider.FILE,
((IFileEditorInput)editor.getEditorInput()).getFile().getProject());
+//
+// IProject project =
((IFileEditorInput)editor.getEditorInput()).getFile().getProject();
+// XModel model = EclipseResourceUtil.getModelNature(project).getModel();
+//
+// WebPromptingProvider.getInstance().getList(model, WebPromptingProvider.JSF_OPEN_KEY,
entry.uri, p);
+// String error = p.getProperty(WebPromptingProvider.ERROR);
+// return (error == null || error.length() == 0);
+// }
return false;
}
@@ -340,87 +340,89 @@
}
}
- private ELParser.Token parseJSFExpression(String expression){
- ELParser parser = new ELParser();
- ELParser.Token token = parser.parse(expression);
- return token;
- }
+// private ELParser.Token parseJSFExpression(String expression){
+// ELParser parser = new ELParser();
+// ELParser.Token token = parser.parse(expression);
+// return token;
+// return null;
+// }
public String getBundleValue(String name, int offset){
- if(isShowBundleUsageAsEL) return name;
- ELParser.Token token = parseJSFExpression(name);
- if(token == null) return null;
- ELParser.Token t = token;
- StringBuffer sb = new StringBuffer();
- while(t != null) {
- if(t.kind == ELParser.OPEN) {
- String[] values = getCall(name, t);
- ELParser.Token te = t;
- while(te.next != null && te.kind != ELParser.CLOSE) te = te.next;
- String dv = name.substring(t.start, te.end);
- String value = (values == null) ? null : getBundleValue(values[0], values[1],
offset);
- if(value == null) {
- sb.append(dv);
- } else {
- sb.append(value);
- }
- t = te;
- } else {
- sb.append(name.substring(t.start, t.end));
- }
- t = t.next;
- }
- return sb.toString();
+// if(isShowBundleUsageAsEL) return name;
+// ELParser.Token token = parseJSFExpression(name);
+// if(token == null) return null;
+// ELParser.Token t = token;
+// StringBuffer sb = new StringBuffer();
+// while(t != null) {
+// if(t.kind == ELParser.OPEN) {
+// String[] values = getCall(name, t);
+// ELParser.Token te = t;
+// while(te.next != null && te.kind != ELParser.CLOSE) te = te.next;
+// String dv = name.substring(t.start, te.end);
+// String value = (values == null) ? null : getBundleValue(values[0], values[1],
offset);
+// if(value == null) {
+// sb.append(dv);
+// } else {
+// sb.append(value);
+// }
+// t = te;
+// } else {
+// sb.append(name.substring(t.start, t.end));
+// }
+// t = t.next;
+// }
+// return sb.toString();
+ return "";
}
- private ELParser.Token next(ELParser.Token t) {
- if(t == null) return null;
- t = t.next;
- if(t != null && t.kind == ELParser.SPACES) t = t.next;
- return t;
- }
+// private ELParser.Token next(ELParser.Token t) {
+// if(t == null) return null;
+// t = t.next;
+// if(t != null && t.kind == ELParser.SPACES) t = t.next;
+// return t;
+// }
+//
+// String[] getCall(String expression, ELParser.Token t) {
+// if(t == null || t.kind != ELParser.OPEN) return null;
+// t = next(t);
+// if(t == null || t.kind != ELParser.NAME) return null;
+// String prefix = expression.substring(t.start, t.end);
+// String propName = null;
+// t = next(t);
+// if(t != null && t.kind == ELParser.DOT) {
+// t = next(t);
+// if(t == null || t.kind != ELParser.NAME) return null;
+// propName = expression.substring(t.start, t.end);
+// } else if(t != null && t.kind == ELParser.OPEN_ARG) {
+// t = next(t);
+// if(t == null || t.kind != ELParser.ARGUMENT) return null;
+// propName = expression.substring(t.start, t.end);
+// t = next(t);
+// if(t == null || t.kind != ELParser.CLOSE_ARG) return null;
+// }
+// t = next(t);
+// if(t == null || t.kind != ELParser.CLOSE) return null;
+// return propName == null ? null : new String[]{prefix, propName};
+// }
+//
+// private String getBundleValue(String prefix, String propertyName, int offset) {
+// BundleEntry entry = getBundle(prefix);
+// if(entry != null) {
+// //Added by estherbin fix JBIDE-2010 (issue with resources).
+// if(offset!=0 && (entry.offset > offset))return null;
+// String name = prefix + "." + propertyName;
+// try{
+// String value = (String)entry.bundle.getObject(propertyName);
+// if(!usedKeys.containsKey(name))
+// usedKeys.put(name, new UsedKey(entry.uri, prefix, propertyName, value,
entry.hashCode, entry.offset));
+// return value;
+// }catch(MissingResourceException ex){
+// return null;
+// }
+// }
+// return null;
+// }
- String[] getCall(String expression, ELParser.Token t) {
- if(t == null || t.kind != ELParser.OPEN) return null;
- t = next(t);
- if(t == null || t.kind != ELParser.NAME) return null;
- String prefix = expression.substring(t.start, t.end);
- String propName = null;
- t = next(t);
- if(t != null && t.kind == ELParser.DOT) {
- t = next(t);
- if(t == null || t.kind != ELParser.NAME) return null;
- propName = expression.substring(t.start, t.end);
- } else if(t != null && t.kind == ELParser.OPEN_ARG) {
- t = next(t);
- if(t == null || t.kind != ELParser.ARGUMENT) return null;
- propName = expression.substring(t.start, t.end);
- t = next(t);
- if(t == null || t.kind != ELParser.CLOSE_ARG) return null;
- }
- t = next(t);
- if(t == null || t.kind != ELParser.CLOSE) return null;
- return propName == null ? null : new String[]{prefix, propName};
- }
-
- private String getBundleValue(String prefix, String propertyName, int offset) {
- BundleEntry entry = getBundle(prefix);
- if(entry != null) {
- //Added by estherbin fix JBIDE-2010 (issue with resources).
- if(offset!=0 && (entry.offset > offset))return null;
- String name = prefix + "." + propertyName;
- try{
- String value = (String)entry.bundle.getObject(propertyName);
- if(!usedKeys.containsKey(name))
- usedKeys.put(name, new UsedKey(entry.uri, prefix, propertyName, value,
entry.hashCode, entry.offset));
- return value;
- }catch(MissingResourceException ex){
- return null;
- }
- }
- return null;
- }
-
public void addBundleMapListener(BundleMapListener listener) {
if (listener != null) {
BundleMapListener[] newBundleMapListener = new
BundleMapListener[bundleMapListeners.length + 1];