Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: b1b6e1bc5615cbecd1289c5e307d507dc24a98c4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*******************************************************************************
 * Copyright (c) 2001, 2006 Oracle Corporation and others.
 * 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 Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.jst.jsf.validation.internal.appconfig;

import java.util.List;

import org.eclipse.core.resources.IFile;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;

/**
 * Recursive validator for navigation-rule
 * 
 * @author cbateman
 *
 */
public class NavigationRuleValidator extends EObjectValidationVisitor 
{
    /**
     * Constructor
     * @param version 
     */
    public NavigationRuleValidator(final String version) 
    {
        super(FacesConfigPackage.eINSTANCE.getFacesConfigType_NavigationRule()
                , version);
    }

    protected void doValidate(EObject eobj, List messages, IFile file) 
    {
        // nothing to do
    }

    protected EObjectValidationVisitor[] getChildNodeValidators() 
    {
        return new EObjectValidationVisitor[]
        {
            new NavigationCaseValidationVisitor(getVersion())
        };
    }
//    private static class FromViewIdValidator extends ViewIdValidator
//    {
//        FromViewIdValidator()
//        {
//            super(Node.ELEMENT_NODE, "from-view-id");
//        }
//
//        protected void doValidate(Node node, List messages, IFile file) 
//        {
//            // only validate if a custom navigation handler is not set
//            // since we can only validate against what the default navigation
//            // handler will expect
//            if (!hasCustomNavigationHandler(file))
//            {
//                final String textContent = node.getTextContent();
//                final IProject project = file.getProject();
//                
//                
//            }
//        }
//        
//        private boolean hasCustomNavigationHandler(IFile file)
//        {
//            JSFAppConfigManager configManager = 
//                JSFAppConfigManager.getInstance(file.getProject());
//            
//            for (final Iterator appIt = configManager.getApplications().iterator(); appIt.hasNext();)
//            {
//                ApplicationType appType = (ApplicationType) appIt.next();
//                if (appType.getNavigationHandler().size() > 0)
//                {
//                    return true;
//                }
//            }
//            
//            return false;
//        }
//
//        protected NodeValidationVisitor[] getChildNodeValidators() {
//            return EMPTY_CHILDREN;
//        }
//    }
}

Back to the top