diff options
Diffstat (limited to 'jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/WebPathType.java')
-rw-r--r-- | jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/WebPathType.java | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/WebPathType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/WebPathType.java deleted file mode 100644 index c1c8c0dc4..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/WebPathType.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - -import java.net.MalformedURLException; -import java.net.URL; - -import org.eclipse.core.runtime.Path; -import org.eclipse.jst.jsf.metadataprocessors.IMetaDataEnabledFeature; -import org.eclipse.jst.jsf.metadataprocessors.features.IValidValues; -import org.eclipse.jst.jsf.metadataprocessors.features.ValidationMessage; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.resources.IVirtualContainer; -import org.eclipse.wst.common.componentcore.resources.IVirtualFile; - -/** - * Path relative to web root - * <b>EXPERIMENTAL</b> - may change or dissappear - * - */ -public class WebPathType extends PathType implements - IMetaDataEnabledFeature, IValidValues{ - - public boolean isValidValue(String value) { - //is this a relative path, or absolute url? - try { - URL url = new URL(value); - //if file protocol, see if it is valid? Otherwise assume ok. - if (url.getProtocol().equals("file")){ //$NON-NLS-1$ - validateFileRelativeToWebRoot(url.getPath()); - } - } catch (MalformedURLException e) { - //is this a valid path relative to the - validateFileRelativeToWebRoot(value); - } - return getValidationMessages().size() == 0; - - } - - private void validateFileRelativeToWebRoot(String value) { - IVirtualContainer webRoot = getWebRoot(); - if (! webRoot.exists()){ - getValidationMessages().add(new ValidationMessage( Messages.WebPathType_1)); - } - else { - IVirtualFile file = webRoot.getFile(new Path(value)); - if (!file.exists()) { - //was this a valid file path string, or bogus url? - getValidationMessages().add(new ValidationMessage(Messages.WebPathType_2)); - } - //we could also validate the expected file-extensions from meta data - } - - } - - private IVirtualContainer getWebRoot() - { - IVirtualContainer webRoot = - ComponentCore.createComponent(getProject()).getRootFolder(); - - return webRoot; - } -}
\ No newline at end of file |