Author: mareshkau
Date: 2008-10-13 08:55:28 -0400 (Mon, 13 Oct 2008)
New Revision: 10790
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeCSSFileValidator.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeCSSReferenceSupport.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/VpeElVariableValidator.java
trunk/vpe/plugins/org.jboss.tools.vpe/resources/meta/vpe.meta
Log:
=JBIDE-2828, validation for css file 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-13 11:51:31 UTC
(rev 10789)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/resources/meta/vpe.meta 2008-10-13 12:55:28 UTC
(rev 10790)
@@ -35,7 +35,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.VpeCSSReferenceSupport"
displayName="Add CSS Reference..." kind="action"
name="AddItem">
<EntityData EntityName="VPECSSReference">
<AttributeData AttributeName="location"/>
@@ -45,7 +45,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.VpeCSSReferenceSupport"
displayName="Edit CSS Reference..." kind="action"
name="EditItem">
<EntityData EntityName="VPECSSReference">
<AttributeData AttributeName="location"/>
@@ -85,7 +85,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.VpeCSSReferenceSupport"
displayName="Add CSS Reference..." kind="action"
name="AddItem">
<EntityData EntityName="VPECSSReferenceExt">
<AttributeData AttributeName="location"/>
@@ -95,7 +95,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.VpeCSSReferenceSupport"
displayName="Edit CSS Reference..." kind="action"
name="EditItem">
<EntityData EntityName="VPECSSReferenceExt">
<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-13 11:51:31 UTC (rev
10789)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/plugin.xml 2008-10-13 12:55:28 UTC (rev
10790)
@@ -6,5 +6,7 @@
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"/>
+ <xclass id="org.jboss.tools.vpe.resref.core.VpeCSSReferenceSupport"
+ class="org.jboss.tools.vpe.resref.core.VpeCSSReferenceSupport"/>
</extension>
</plugin>
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeCSSFileValidator.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeCSSFileValidator.java
(rev 0)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeCSSFileValidator.java 2008-10-13
12:55:28 UTC (rev 10790)
@@ -0,0 +1,53 @@
+/*******************************************************************************
+* 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.resref.core;
+
+import java.io.File;
+import java.util.Properties;
+
+import org.eclipse.osgi.util.NLS;
+import org.jboss.tools.common.meta.action.impl.DefaultWizardDataValidator;
+import org.jboss.tools.common.meta.action.impl.SpecialWizardSupport;
+import org.jboss.tools.jst.web.messages.xpl.WebUIMessages;
+
+/**
+ * @author mareshkau
+ *
+ */
+public class VpeCSSFileValidator extends DefaultWizardDataValidator {
+
+ /**
+ *
+ * @param support
+ * @param step
+ */
+ public VpeCSSFileValidator(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$
+ if(!new File(location).isFile()) {
+ message = NLS.bind(WebUIMessages.FILE_DOESNOT_EXIST,location);
+ }
+
+ }
+}
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeCSSReferenceSupport.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeCSSReferenceSupport.java
(rev 0)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeCSSReferenceSupport.java 2008-10-13
12:55:28 UTC (rev 10790)
@@ -0,0 +1,34 @@
+/*******************************************************************************
+* 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.resref.core;
+
+import org.jboss.tools.common.meta.action.impl.WizardDataValidator;
+
+/**
+ * @author mareshkau
+ *
+ */
+public class VpeCSSReferenceSupport extends VpeAddReferenceSupport{
+
+ private WizardDataValidator wizardDataValidator;
+ /* (non-Javadoc)
+ * @see org.jboss.tools.common.meta.action.impl.SpecialWizardSupport#getValidator(int)
+ */
+ @Override
+ public WizardDataValidator getValidator(int step) {
+ if(this.wizardDataValidator==null) {
+
+ this.wizardDataValidator = new VpeCSSFileValidator(this, step);
+ }
+ return this.wizardDataValidator;
+ }
+
+}
Modified:
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 2008-10-13
11:51:31 UTC (rev 10789)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeElVariableValidator.java 2008-10-13
12:55:28 UTC (rev 10790)
@@ -23,9 +23,10 @@
*/
public class VpeElVariableValidator extends DefaultWizardDataValidator {
-
/**
*
+ * @param support
+ * @param step
*/
public VpeElVariableValidator(SpecialWizardSupport support, int step) {
super.setSupport(support, step);