### Eclipse Workspace Patch 1.0 #P org.jboss.tools.seam.xml.ui Index: src/org/jboss/tools/seam/xml/ui/editor/form/core/PropertyListFormLayoutData.java =================================================================== --- src/org/jboss/tools/seam/xml/ui/editor/form/core/PropertyListFormLayoutData.java (revision 20196) +++ src/org/jboss/tools/seam/xml/ui/editor/form/core/PropertyListFormLayoutData.java (working copy) @@ -33,6 +33,9 @@ static String ENT_RESTRICTIONS = "SeamFrameworkRestrictions"; //$NON-NLS-1$ static String ENT_HINTS = "SeamFrameworkHints"; //$NON-NLS-1$ + static String ENT_NAVIGATION_PAGES = "SeamNavigationPages"; //$NON-NLS-1$ + static String ENT_NAVIGATION_RESOURCES = "SeamNavigationResources"; //$NON-NLS-1$ + static String ENT_THEME_SELECTOR = "SeamThemeSelector"; //$NON-NLS-1$ static String ENT_AVAILABLE_THEMES = "SeamThemeAvailableThemes"; //$NON-NLS-1$ @@ -225,6 +228,23 @@ ENT_FILTER, new String[]{null}, FILTER_DEFINITIONS); /** + * Navigation + */ + private final static IFormData[] NAVIGATION_RESOURCES_DEFINITIONS = new IFormData[] { + createListDefinition("Resources") //$NON-NLS-1$ + }; + + final static IFormData NAVIGATION_RESOURCES_FORM_DEFINITION = new FormData( + ENT_NAVIGATION_RESOURCES, new String[]{null}, NAVIGATION_RESOURCES_DEFINITIONS); + + private final static IFormData[] NAVIGATION_PAGES_DEFINITIONS = + createDefinitionsForListHolder("Navigation Pages", ENT_NAVIGATION_PAGES, "Resources", "resources"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + final static IFormData NAVIGATION_PAGES_FORM_DEFINITION = new FormData( + ENT_NAVIGATION_PAGES, new String[]{null}, NAVIGATION_PAGES_DEFINITIONS); + + + /** * Theme */ private final static IFormData[] AVAILABLE_THEMES_DEFINITIONS = new IFormData[] { Index: src/org/jboss/tools/seam/xml/ui/editor/form/core/SeamComponentsCoreFormLayoutData.java =================================================================== --- src/org/jboss/tools/seam/xml/ui/editor/form/core/SeamComponentsCoreFormLayoutData.java (revision 20196) +++ src/org/jboss/tools/seam/xml/ui/editor/form/core/SeamComponentsCoreFormLayoutData.java (working copy) @@ -43,6 +43,9 @@ PropertyListFormLayoutData.HINTS_FORM_DEFINITION, PropertyListFormLayoutData.RESTRICTIONS_FORM_DEFINITION, + PropertyListFormLayoutData.NAVIGATION_PAGES_FORM_DEFINITION, + PropertyListFormLayoutData.NAVIGATION_RESOURCES_FORM_DEFINITION, + PropertyListFormLayoutData.THEME_SELECTOR_FORM_DEFINITION, PropertyListFormLayoutData.AVAILABLE_THEMES_FORM_DEFINITION, #P org.jboss.tools.seam.xml.test Index: projects/Test/components22.xml =================================================================== --- projects/Test/components22.xml (revision 0) +++ projects/Test/components22.xml (revision 0) @@ -0,0 +1,20 @@ + + + + + + + + + v2 + + + + Index: META-INF/MANIFEST.MF =================================================================== --- META-INF/MANIFEST.MF (revision 22171) +++ META-INF/MANIFEST.MF (working copy) @@ -3,6 +3,10 @@ Bundle-Name: Seam XML Tests Bundle-SymbolicName: org.jboss.tools.seam.xml.test;singleton:=true Bundle-Version: 3.1.0.qualifier -Require-Bundle: org.eclipse.core.runtime +Require-Bundle: org.eclipse.core.runtime, + org.junit, + org.jboss.tools.seam.xml, + org.jboss.tools.common.test, + org.jboss.tools.tests Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: J2SE-1.5 Index: src/org/jboss/tools/seam/xml/test/SeamXMLAllTests.java =================================================================== --- src/org/jboss/tools/seam/xml/test/SeamXMLAllTests.java (revision 0) +++ src/org/jboss/tools/seam/xml/test/SeamXMLAllTests.java (revision 0) @@ -0,0 +1,31 @@ +/******************************************************************************* + * 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.seam.xml.test; + +import junit.framework.Test; +import junit.framework.TestSuite; + + +/** + * @author V.Kabanovich + * + */ +public class SeamXMLAllTests { + public static final String PLUGIN_ID = "org.jboss.tools.seam.xml"; + + public static Test suite() { + TestSuite suite = new TestSuite(); + suite.setName("All tests for " + PLUGIN_ID); + suite.addTest(new SeamXMLTestSetup(SeamXMLTestSuite.suite())); + + return suite; + } +}\ No newline at end of file Index: src/org/jboss/tools/seam/xml/test/SeamXMLTestSuite.java =================================================================== --- src/org/jboss/tools/seam/xml/test/SeamXMLTestSuite.java (revision 0) +++ src/org/jboss/tools/seam/xml/test/SeamXMLTestSuite.java (revision 0) @@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2010 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.seam.xml.test; + +import junit.framework.Test; +import junit.framework.TestSuite; + +/** + * @author V. Kabanovich + */ +public class SeamXMLTestSuite extends TestSuite { + + public static Test suite() { + TestSuite suite = new TestSuite("Seam XML Tests"); + suite.addTestSuite(SeamXMLModelTest.class); + return suite; + } +}\ No newline at end of file Index: src/org/jboss/tools/seam/xml/test/SeamXMLModelTest.java =================================================================== --- src/org/jboss/tools/seam/xml/test/SeamXMLModelTest.java (revision 0) +++ src/org/jboss/tools/seam/xml/test/SeamXMLModelTest.java (revision 0) @@ -0,0 +1,100 @@ +/******************************************************************************* + * 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.seam.xml.test; + +import junit.framework.TestCase; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.Path; +import org.jboss.tools.common.model.XModelObject; +import org.jboss.tools.common.model.util.EclipseResourceUtil; +import org.jboss.tools.seam.xml.components.model.SeamComponentConstants; + +public class SeamXMLModelTest extends TestCase { + IProject project = null; + + public SeamXMLModelTest() { + super("Seam Scanner test"); + project = getTestProject(); + } + + public IProject getTestProject() { + if(project==null) { + try { + project = findTestProject(); + if(project==null || !project.exists()) { +// project = importPreparedProject("/"); + } + } catch (Exception e) { + e.printStackTrace(); + fail("Can't import Seam XML test project: " + e.getMessage()); + } + } + return project; + } + + public static IProject findTestProject() { + return ResourcesPlugin.getWorkspace().getRoot().getProject("Test"); + } + + + /** + * This test is to check different cases of declaring components in xml. + * It does not check interaction of xml declaration with other declarations. + */ + public void testXMLModel() { + IFile f = project.getFile(new Path("components22.xml")); + assertNotNull("File components22.xml is not found in Test project.", f); + + XModelObject fileObject = EclipseResourceUtil.createObjectForResource(f); + assertNotNull("Cannot create XModel object for file components22.xml.", fileObject); + + String entity = fileObject.getModelEntity().getName(); + assertEquals("File components22.xml is incorrectly parsed by XModel.", SeamComponentConstants.ENT_SEAM_COMPONENTS_22, entity); + + //TODO continue test + } + + protected XModelObject getComponents22Object() { + if(project == null) return null; + IFile f = project.getFile(new Path("components22.xml")); + return f == null ? null : EclipseResourceUtil.createObjectForResource(f); + + } + + public void testNavigationPagesComponent() { + XModelObject fileObject = getComponents22Object(); + assertNotNull("Cannot create XModel object for file components22.xml.", fileObject); + + XModelObject navigationPages = fileObject.getChildByPath("org.jboss.seam.navigation.pages"); + assertNotNull("Cannot find org.jboss.seam.navigation.pages", navigationPages); + + XModelObject resources = navigationPages.getChildByPath("resources"); + assertNotNull("Cannot find resources in org.jboss.seam.navigation.pages", resources); + + XModelObject[] resourcesList = resources.getChildren(); + assertEquals(1, resourcesList.length); + + assertAttribute(navigationPages, "no-conversation-view-id", "a.xhtml"); + assertAttribute(navigationPages, "login-view-id", "b.xhtml"); + assertAttribute(navigationPages, "http-port", "1111"); + assertAttribute(navigationPages, "https-port", "1112"); + + } + + protected void assertAttribute(XModelObject object, String name, String value) { + String actual = object.getAttributeValue(name); + assertEquals("Attribute " + name + " in " + object.getPresentationString() + " is incorrect.", value, actual); + } + +} Index: src/org/jboss/tools/seam/xml/test/SeamXMLTestSetup.java =================================================================== --- src/org/jboss/tools/seam/xml/test/SeamXMLTestSetup.java (revision 0) +++ src/org/jboss/tools/seam/xml/test/SeamXMLTestSetup.java (revision 0) @@ -0,0 +1,50 @@ +/******************************************************************************* + * Copyright (c) 2010 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.seam.xml.test; + +import junit.extensions.TestSetup; +import junit.framework.Test; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.jboss.tools.test.util.JobUtils; +import org.jboss.tools.test.util.ResourcesUtils; +import org.jboss.tools.test.util.xpl.EditorTestHelper; + +/** + * @author Viacheslav Kabanovich + */ +public class SeamXMLTestSetup extends TestSetup { + + protected IProject project; + + public SeamXMLTestSetup(Test test) { + super(test); + } + + @Override + protected void setUp() throws Exception { + project = ResourcesUtils.importProject( + "org.jboss.tools.seam.xml.test","/projects/Test" , new NullProgressMonitor()); + project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor()); + EditorTestHelper.joinBackgroundActivities(); + } + + @Override + protected void tearDown() throws Exception { + boolean saveAutoBuild = ResourcesUtils.setBuildAutomatically(false); + JobUtils.waitForIdle(); + project.delete(true, true, null); + JobUtils.waitForIdle(); + ResourcesUtils.setBuildAutomatically(saveAutoBuild); + } +}\ No newline at end of file #P org.jboss.tools.seam.xml Index: plugin.xml =================================================================== --- plugin.xml (revision 18499) +++ plugin.xml (working copy) @@ -11,6 +11,7 @@ + Index: resources/meta/seam-navigation.meta =================================================================== --- resources/meta/seam-navigation.meta (revision 0) +++ resources/meta/seam-navigation.meta (revision 0) @@ -0,0 +1,226 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: resources/help/keys-seam-menu.properties =================================================================== --- resources/help/keys-seam-menu.properties (revision 17617) +++ resources/help/keys-seam-menu.properties (working copy) @@ -73,6 +73,8 @@ Seam.AddContextLoader.menu=Context Loader... Seam.AddTaskDispatcher.menu=Task Dispatcher... Seam.AddTransaction.menu=Transaction... +Seam.Navigation.menu=Navigation +Seam.AddNavigationPages.menu=Navigation Pages... Seam.Theme.menu=Theme Seam.AddThemeSelector.menu=Theme Selector... Seam.Transaction.menu=Transaction Index: resources/help/keys-seam.properties =================================================================== --- resources/help/keys-seam.properties (revision 17617) +++ resources/help/keys-seam.properties (working copy) @@ -975,6 +975,9 @@ FileSeamComponents20_AddThemeSelector.WindowTitle=Add Theme Selector FileSeamComponents20_AddThemeSelector.Title=Seam Theme Selector +FileSeamComponents20_AddNavigationPages.WindowTitle=Add Navigation Pages +FileSeamComponents20_AddNavigationPages.Title=Seam Navigation Pages + FileSeamComponents20_EditorActionList_AddThemeSelector.WindowTitle=Add Theme Selector FileSeamComponents20_EditorActionList_AddThemeSelector.Title=Seam Theme Selector @@ -1317,6 +1320,9 @@ FileSeamComponents21_AddThemeSelector.WindowTitle=Add Theme Selector FileSeamComponents21_AddThemeSelector.Title=Seam Theme Selector +FileSeamComponents21_AddNavigationPages.WindowTitle=Add Navigation Pages +FileSeamComponents21_AddNavigationPages.Title=Seam Navigation Pages + FileSeamComponents21_AddEjb.WindowTitle=Add Ejb FileSeamComponents21_AddEjb.Title=Seam Transaction Ejb @@ -1413,6 +1419,9 @@ FileSeamComponents22_AddThemeSelector.WindowTitle=Add Theme Selector FileSeamComponents22_AddThemeSelector.Title=Seam Theme Selector +FileSeamComponents22_AddNavigationPages.WindowTitle=Add Navigation Pages +FileSeamComponents22_AddNavigationPages.Title=Seam Navigation Pages + FileSeamComponents22_AddEjb.WindowTitle=Add Ejb FileSeamComponents22_AddEjb.Title=Seam Transaction Ejb