Author: mareshkau
Date: 2008-10-11 11:42:39 -0400 (Sat, 11 Oct 2008)
New Revision: 10783
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeELReferenceSupport.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeElVariableValidator.java
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/plugin.xml
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ElVariablesComposite.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/Messages.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ResourceReferencesDialogView.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeResourceReferencesComposite.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/messages.properties
trunk/vpe/plugins/org.jboss.tools.vpe/resources/meta/vpe.meta
Log:
=JBIDE-2828, validation for el expressions was added
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/resources/meta/vpe.meta
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/resources/meta/vpe.meta 2008-10-11 13:26:44 UTC
(rev 10782)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/resources/meta/vpe.meta 2008-10-11 15:42:39 UTC
(rev 10783)
@@ -138,7 +138,7 @@
<XActionItem kind="list">
<XActionItem kind="list" name="CreateActions">
<XActionItem HandlerClassName="%SpecialWizard%"
ICON="action.empty"
-
PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeAddReferenceSupport"
+
PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeELReferenceSupport"
displayName="Add El Reference..." kind="action"
name="AddItem">
<EntityData EntityName="VPEElReference">
<AttributeData AttributeName="location"/>
@@ -149,7 +149,7 @@
</XActionItem>
<XActionItem kind="list" name="EditActions">
<XActionItem HandlerClassName="%SpecialWizard%"
ICON="action.empty"
-
PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeAddReferenceSupport"
+
PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeELReferenceSupport"
displayName="Edit El Reference..." kind="action"
name="EditItem">
<EntityData EntityName="VPEElReference">
<AttributeData AttributeName="location"/>
@@ -192,7 +192,7 @@
<XActionItem kind="list">
<XActionItem kind="list" name="CreateActions">
<XActionItem HandlerClassName="%SpecialWizard%"
ICON="action.empty"
-
PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeAddReferenceSupport"
+
PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeELReferenceSupport"
displayName="Add El Reference..." kind="action"
name="AddItem">
<EntityData EntityName="VPEElReferenceExt">
<AttributeData AttributeName="location"/>
@@ -203,7 +203,7 @@
</XActionItem>
<XActionItem kind="list" name="EditActions">
<XActionItem HandlerClassName="%SpecialWizard%"
ICON="action.empty"
-
PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeAddReferenceSupport"
+
PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeELReferenceSupport"
displayName="Edit El Reference..." kind="action"
name="EditItem">
<EntityData EntityName="VPEElReference">
<AttributeData AttributeName="location"/>
@@ -244,7 +244,7 @@
<XActionItem kind="list">
<XActionItem kind="list" name="CreateActions">
<XActionItem HandlerClassName="%SpecialWizard%"
ICON="action.empty"
-
PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeAddReferenceSupport"
+
PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeELReferenceSupport"
displayName="Add El Reference..." kind="action"
name="AddItem">
<EntityData EntityName="VPEGlobalElReference">
<AttributeData AttributeName="location" Mandatory="no"/>
@@ -255,7 +255,7 @@
</XActionItem>
<XActionItem kind="list" name="EditActions">
<XActionItem HandlerClassName="%SpecialWizard%"
ICON="action.empty"
-
PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeAddReferenceSupport"
+
PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeELReferenceSupport"
displayName="Edit El Reference..." kind="action"
name="EditItem">
<EntityData EntityName="VPEGlobalElReference">
<AttributeData AttributeName="location"/>
@@ -297,7 +297,7 @@
<XActionItem kind="list">
<XActionItem kind="list" name="CreateActions">
<XActionItem HandlerClassName="%SpecialWizard%"
ICON="action.empty"
-
PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeAddReferenceSupport"
+
PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeELReferenceSupport"
displayName="Add El Reference..." kind="action"
name="AddItem">
<EntityData EntityName="VPEGlobalElReferenceExt">
<AttributeData AttributeName="location"/>
@@ -308,7 +308,7 @@
</XActionItem>
<XActionItem kind="list" name="EditActions">
<XActionItem HandlerClassName="%SpecialWizard%"
ICON="action.empty"
-
PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeAddReferenceSupport"
+
PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeELReferenceSupport"
displayName="Edit El Reference..." kind="action"
name="EditItem">
<EntityData EntityName="VPEGlobalElReferenceExt">
<AttributeData AttributeName="location"/>
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.resref/plugin.xml
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/plugin.xml 2008-10-11 13:26:44 UTC (rev
10782)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/plugin.xml 2008-10-11 15:42:39 UTC (rev
10783)
@@ -4,5 +4,7 @@
<extension point="org.jboss.tools.common.model.classes">
<xclass id="org.jboss.tools.vpe.resref.core.VpeAddReferenceSupport"
class="org.jboss.tools.vpe.resref.core.VpeAddReferenceSupport"/>
+ <xclass id="org.jboss.tools.vpe.resref.core.VpeELReferenceSupport"
+ class="org.jboss.tools.vpe.resref.core.VpeELReferenceSupport"/>
</extension>
</plugin>
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ElVariablesComposite.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ElVariablesComposite.java 2008-10-11
13:26:44 UTC (rev 10782)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ElVariablesComposite.java 2008-10-11
15:42:39 UTC (rev 10783)
@@ -3,13 +3,10 @@
import java.util.List;
import org.jboss.tools.common.el.core.ELReferenceList;
-import org.jboss.tools.common.meta.XAttribute;
-import org.jboss.tools.common.meta.XModelEntity;
-import org.jboss.tools.common.meta.constraint.impl.XAttributeConstraintFileFilter;
-import org.jboss.tools.common.meta.impl.XModelMetaDataImpl;
import org.jboss.tools.common.resref.core.ResourceReference;
import org.jboss.tools.common.resref.core.ResourceReferenceList;
import org.jboss.tools.common.resref.ui.AbstractResourceReferencesComposite;
+import org.jboss.tools.common.resref.ui.BaseAddReferenceSupport;
import org.jboss.tools.common.resref.ui.ResourceReferencesTableProvider;
/**
@@ -37,7 +34,7 @@
*/
@Override
protected String getEntity() {
- return (file != null) ? "VPEElReference" :
"VPEElReferenceExt";
+ return (file != null) ? "VPEElReference" :
"VPEElReferenceExt"; //$NON-NLS-1$//$NON-NLS-2$
}
/**c
@@ -64,7 +61,7 @@
ResourceReference css = getDefaultResourceReference();
initFilterInFileChooser();
- boolean ok = VpeAddReferenceSupport.add(file, css, getReferenceArray(),
+ boolean ok = BaseAddReferenceSupport.add(file, css, getReferenceArray(),
getEntity());
if (!ok)
return;
@@ -82,7 +79,7 @@
}
ResourceReference css = getReferenceArray()[index];
initFilterInFileChooser();
- boolean ok = VpeAddReferenceSupport.edit(file, css,
+ boolean ok = BaseAddReferenceSupport.edit(file, css,
getReferenceArray(), getEntity());
if (ok) {
update();
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/Messages.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/Messages.java 2008-10-11
13:26:44 UTC (rev 10782)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/Messages.java 2008-10-11
15:42:39 UTC (rev 10783)
@@ -42,4 +42,5 @@
public static String INCLUDED_TAG_LIBS;
public static String SUBSTITUTED_EL_EXPRESSIONS;
public static String ACTUAL_RUN_TIME_ABSOLUTE_FOLDER;
+ public static String INVALID_EL_EXPRESSION;
}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ResourceReferencesDialogView.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ResourceReferencesDialogView.java 2008-10-11
13:26:44 UTC (rev 10782)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ResourceReferencesDialogView.java 2008-10-11
15:42:39 UTC (rev 10783)
@@ -29,6 +29,7 @@
import org.jboss.tools.common.model.ui.wizards.query.AbstractQueryWizardView;
import org.jboss.tools.common.resref.core.ResourceReference;
import org.jboss.tools.common.resref.core.ResourceReferenceList;
+import org.jboss.tools.common.resref.ui.BaseAddReferenceSupport;
import org.jboss.tools.common.resref.ui.ResourceReferencesTableProvider;
public abstract class ResourceReferencesDialogView extends AbstractQueryWizardView {
@@ -124,7 +125,7 @@
protected void add(int index) {
ResourceReference css = new ResourceReference("",
ResourceReference.FOLDER_SCOPE);
- boolean ok = VpeAddReferenceSupport.add(file, css, getReferenceArray(), getEntity());
+ boolean ok = BaseAddReferenceSupport.add(file, css, getReferenceArray(), getEntity());
if(!ok) return;
dataList.add(css);
update();
@@ -134,7 +135,7 @@
protected void edit(int index) {
if(index < 0) return;
ResourceReference css = getReferenceArray()[index];
- boolean ok = VpeAddReferenceSupport.edit(file, css, getReferenceArray(), getEntity());
+ boolean ok = BaseAddReferenceSupport.edit(file, css, getReferenceArray(),
getEntity());
if(!ok) return;
update();
}
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeELReferenceSupport.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeELReferenceSupport.java
(rev 0)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeELReferenceSupport.java 2008-10-11
15:42:39 UTC (rev 10783)
@@ -0,0 +1,29 @@
+/*******************************************************************************
+* Copyright (c) 2007-2008 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
+*
+* Contributor:
+* Red Hat, Inc. - initial API and implementation
+******************************************************************************/
+package org.jboss.tools.vpe.resref.core;
+
+import org.jboss.tools.common.meta.action.impl.WizardDataValidator;
+
+/**
+ * @author mareshkau
+ *
+ */
+public class VpeELReferenceSupport extends VpeAddReferenceSupport {
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.common.meta.action.impl.SpecialWizardSupport#getValidator(int)
+ */
+ @Override
+ public WizardDataValidator getValidator(int step) {
+ return new VpeElVariableValidator(this ,getStepId());
+ }
+
+}
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeElVariableValidator.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeElVariableValidator.java
(rev 0)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeElVariableValidator.java 2008-10-11
15:42:39 UTC (rev 10783)
@@ -0,0 +1,54 @@
+/*******************************************************************************
+* Copyright (c) 2007-2008 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
+*
+* Contributor:
+* Red Hat, Inc. - initial API and implementation
+******************************************************************************/
+package org.jboss.tools.vpe.resref.core;
+
+import java.util.Properties;
+
+import org.jboss.tools.common.el.core.parser.ELParser;
+import org.jboss.tools.common.el.core.parser.ELParserUtil;
+import org.jboss.tools.common.meta.action.impl.DefaultWizardDataValidator;
+import org.jboss.tools.common.meta.action.impl.SpecialWizardSupport;
+
+/**
+ * @author mareshkau
+ *
+ */
+public class VpeElVariableValidator extends DefaultWizardDataValidator {
+
+
+ /**
+ *
+ */
+ public VpeElVariableValidator(SpecialWizardSupport support, int step) {
+ super.setSupport(support, step);
+ }
+
+ /* (non-Javadoc)
+ * @see
org.jboss.tools.common.meta.action.impl.DefaultWizardDataValidator#validate(java.util.Properties)
+ */
+ @Override
+ public void validate(Properties data) {
+
+ super.validate(data);
+ if( (getErrorMessage()!=null) ||
+ (getWarningMessage()!=null)) {
+ return;
+ }
+ String location = (String) data.get("location"); //$NON-NLS-1$
+ ELParser elParser = ELParserUtil.getDefaultFactory().createParser();
+ elParser.parse("#{"+location+'}'); //$NON-NLS-1$
+ if(elParser.getSyntaxErrors().size()>0) {
+ message=Messages.INVALID_EL_EXPRESSION;
+ }
+
+ }
+
+}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeResourceReferencesComposite.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeResourceReferencesComposite.java 2008-10-11
13:26:44 UTC (rev 10782)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeResourceReferencesComposite.java 2008-10-11
15:42:39 UTC (rev 10783)
@@ -16,6 +16,7 @@
import org.jboss.tools.common.resref.core.ResourceReference;
import org.jboss.tools.common.resref.core.ResourceReferenceList;
import org.jboss.tools.common.resref.ui.AbstractResourceReferencesComposite;
+import org.jboss.tools.common.resref.ui.BaseAddReferenceSupport;
import org.jboss.tools.common.resref.ui.ResourceReferencesTableProvider;
public abstract class VpeResourceReferencesComposite extends
AbstractResourceReferencesComposite {
@@ -41,7 +42,7 @@
ResourceReference css = getDefaultResourceReference();
initFilterInFileChooser();
- boolean ok = VpeAddReferenceSupport.add(file, css, getReferenceArray(), getEntity());
+ boolean ok = BaseAddReferenceSupport.add(file, css, getReferenceArray(), getEntity());
if(!ok) return;
dataList.add(css);
update();
@@ -52,7 +53,7 @@
if(index < 0) return;
ResourceReference css = getReferenceArray()[index];
initFilterInFileChooser();
- boolean ok = VpeAddReferenceSupport.edit(file, css, getReferenceArray(), getEntity());
+ boolean ok = BaseAddReferenceSupport.edit(file, css, getReferenceArray(),
getEntity());
if(!ok) return;
update();
}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/messages.properties
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/messages.properties 2008-10-11
13:26:44 UTC (rev 10782)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/messages.properties 2008-10-11
15:42:39 UTC (rev 10783)
@@ -1,4 +1,5 @@
INCLUDED_CSS_FILES=Included css files
INCLUDED_TAG_LIBS=Included tag libs
SUBSTITUTED_EL_EXPRESSIONS=Substituted El expressions
-ACTUAL_RUN_TIME_ABSOLUTE_FOLDER=Actual Run-Time Absolute Folder
\ No newline at end of file
+ACTUAL_RUN_TIME_ABSOLUTE_FOLDER=Actual Run-Time Absolute Folder
+INVALID_EL_EXPRESSION=Invalid El Expression