JBoss Tools SVN: r2202 - trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2007-06-27 21:18:02 -0400 (Wed, 27 Jun 2007)
New Revision: 2202
Modified:
trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/WebContentAssistProviderTest.java
Log:
Compilation error fix
Modified: trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/WebContentAssistProviderTest.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/WebContentAssistProviderTest.java 2007-06-27 18:59:10 UTC (rev 2201)
+++ trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/WebContentAssistProviderTest.java 2007-06-28 01:18:02 UTC (rev 2202)
@@ -83,7 +83,7 @@
try {
project.refreshLocal(IResource.DEPTH_INFINITE, null);
} catch (Exception e) {
- ModelPlugin.log(e);
+ ModelPlugin.getPluginLog().logError(e);
}
XModelObject xmo = EclipseResourceUtil.getObjectByResource(project);
assertNotNull("Can't get XModel Object for test project.", xmo);
17 years, 6 months
JBoss Tools SVN: r2201 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/META-INF.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-06-27 14:59:10 -0400 (Wed, 27 Jun 2007)
New Revision: 2201
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/META-INF/MANIFEST.MF
Log:
Code Cleanup - removing unused classes
Removed package (client) contained one file which did not work.
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/META-INF/MANIFEST.MF 2007-06-27 18:37:37 UTC (rev 2200)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/META-INF/MANIFEST.MF 2007-06-27 18:59:10 UTC (rev 2201)
@@ -22,7 +22,6 @@
org.apache.ant
Eclipse-LazyStart: true
Export-Package: org.jboss.ide.eclipse.as.core,
- org.jboss.ide.eclipse.as.core.client,
org.jboss.ide.eclipse.as.core.model,
org.jboss.ide.eclipse.as.core.packages,
org.jboss.ide.eclipse.as.core.packages.types,
17 years, 6 months
JBoss Tools SVN: r2199 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/client.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-06-27 14:31:41 -0400 (Wed, 27 Jun 2007)
New Revision: 2199
Removed:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/client/JBossLaunchAdapter.java
Log:
Code Cleanup - removing unused classes
Removed package (client) contained one file which did not work.
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/client/JBossLaunchAdapter.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/client/JBossLaunchAdapter.java 2007-06-27 18:14:55 UTC (rev 2198)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/client/JBossLaunchAdapter.java 2007-06-27 18:31:41 UTC (rev 2199)
@@ -1,119 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ide.eclipse.as.core.client;
-
-import java.net.URL;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Properties;
-
-import org.eclipse.jst.server.core.EJBBean;
-import org.eclipse.jst.server.core.JndiLaunchable;
-import org.eclipse.jst.server.core.JndiObject;
-import org.eclipse.jst.server.core.Servlet;
-import org.eclipse.wst.server.core.IModuleArtifact;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.model.IURLProvider;
-import org.eclipse.wst.server.core.model.LaunchableAdapterDelegate;
-import org.eclipse.wst.server.core.model.ServerDelegate;
-import org.eclipse.wst.server.core.util.HttpLaunchable;
-import org.eclipse.wst.server.core.util.WebResource;
-import org.jboss.ide.eclipse.as.core.server.JBossServer;
-
-public class JBossLaunchAdapter extends LaunchableAdapterDelegate {
- public JBossLaunchAdapter() {
- super();
- }
- private static final String JAVA_NAMING_PROVIDER_URL_PROPKEY = "java.naming.provider.url"; //$NON-NLS-1$
- private static final String JAVA_NAMING_FACTORY_INITIAL_PROPKEY = "java.naming.factory.initial"; //$NON-NLS-1$
-
- /*
- * @see ILaunchableAdapterDelegate#getLaunchable(IServer, IModuleObject)
- */
- public Object getLaunchable(IServer server, IModuleArtifact moduleObject) {
- ServerDelegate delegate = (ServerDelegate)server.loadAdapter(ServerDelegate.class,null);
- if (!(delegate instanceof JBossServer))
- return null;
- if ((moduleObject instanceof Servlet) ||(moduleObject instanceof WebResource))
- return prepareHttpLaunchable(moduleObject, (JBossServer) delegate);
-
- if((moduleObject instanceof EJBBean) || (moduleObject instanceof JndiObject))
- return prepareJndiLaunchable(moduleObject, (JBossServer)delegate);
- return null;
- }
-
- private Object prepareJndiLaunchable(IModuleArtifact moduleObject, JBossServer delegate) {
- JndiLaunchable launchable = null;
- Properties props = new Properties();
-// props.put(JAVA_NAMING_FACTORY_INITIAL_PROPKEY,definition.getJndiConnection().getInitialContextFactory());
-// props.put(JAVA_NAMING_PROVIDER_URL_PROPKEY,definition.getJndiConnection().getProviderUrl());
-// List jps = definition.getJndiConnection().getJndiProperty();
-// Iterator propsIt =jps.iterator();
-// while(propsIt.hasNext()){
-// ArgumentPair prop = (ArgumentPair)propsIt.next();
-// props.put(prop.getName(),prop.getValue());
-// }
-
- if(moduleObject instanceof EJBBean)
- {
- EJBBean bean = (EJBBean)moduleObject;
- launchable = new JndiLaunchable(props,bean.getJndiName());
- }
- if(moduleObject instanceof JndiObject)
- {
- JndiObject jndi = (JndiObject)moduleObject;
- launchable = new JndiLaunchable(props,jndi.getJndiName());
- }
- return launchable;
- }
-
- /**
- * @param moduleObject
- * @param delegate
- * @return object
- */
- private Object prepareHttpLaunchable(IModuleArtifact moduleObject, JBossServer delegate) {
- try {
- URL url = ((IURLProvider) delegate).getModuleRootURL(moduleObject.getModule());
- if (moduleObject instanceof Servlet) {
- Servlet servlet = (Servlet) moduleObject;
- if (servlet.getAlias() != null) {
- String path = servlet.getAlias();
- if (path.startsWith("/")) //$NON-NLS-1$
- path = path.substring(1);
- url = new URL(url, path);
- } else
- url = new URL(url, "servlet/" + servlet.getServletClassName()); //$NON-NLS-1$
- } else if (moduleObject instanceof WebResource) {
- WebResource resource = (WebResource) moduleObject;
- String path = resource.getPath().toString();
- if (path != null && path.startsWith("/") && path.length() > 0) //$NON-NLS-1$
- path = path.substring(1);
- if (path != null && path.length() > 0)
- url = new URL(url, path);
- }
- return new HttpLaunchable(url);
- } catch (Exception e) {
- return null;
- }
- }
-}
17 years, 6 months
JBoss Tools SVN: r2198 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/client.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-06-27 14:14:55 -0400 (Wed, 27 Jun 2007)
New Revision: 2198
Removed:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/client/DoNothingClient.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/client/NullLaunchable.java
Log:
Code Cleanup - removing unused classes
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/client/DoNothingClient.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/client/DoNothingClient.java 2007-06-27 17:51:15 UTC (rev 2197)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/client/DoNothingClient.java 2007-06-27 18:14:55 UTC (rev 2198)
@@ -1,60 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ide.eclipse.as.core.client;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.model.ClientDelegate;
-import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
-import org.jboss.ide.eclipse.as.core.util.ServerConverter;
-
-/**
- * This client will only copy to the deploy directory,
- * which is actually a side effect of the run-on-server action.
- *
- * Therefore, this client does absolutely nothing.
- *
- * It only shows up on the list for files that are deployable via
- * copying into a deploy directory.
- *
- * @author rstryker
- *
- */
-public class DoNothingClient extends ClientDelegate {
-
- public DoNothingClient() {
- super();
- }
-
- public boolean supports(IServer server, Object launchable, String launchMode) {
- if( ServerConverter.getDeployableServer(server) == null ) return false;
- return true;
- }
-
- public IStatus launch(IServer server, Object launchable, String launchMode,
- ILaunch launch) {
- return new Status(IStatus.OK, JBossServerCorePlugin.PLUGIN_ID, 0, "A-OK", null);
- }
-
-}
\ No newline at end of file
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/client/NullLaunchable.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/client/NullLaunchable.java 2007-06-27 17:51:15 UTC (rev 2197)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/client/NullLaunchable.java 2007-06-27 18:14:55 UTC (rev 2198)
@@ -1,26 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ide.eclipse.as.core.client;
-
-public class NullLaunchable {
-
-}
17 years, 6 months
JBoss Tools SVN: r2197 - in trunk/seam: plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2007-06-27 13:51:15 -0400 (Wed, 27 Jun 2007)
New Revision: 2197
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/BijectedAttributeType.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IBijectedAttribute.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamModelObject.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamXmlElement.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ScopeType.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponent.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProject.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProperty.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCoreBuilder.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCorePlugin.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponent.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProperty.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/JavaScanner.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLScanner.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamJavaHelper.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamJavaValidator.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/ScannerTest.java
Log:
Seam Tools Model
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/BijectedAttributeType.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/BijectedAttributeType.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/BijectedAttributeType.java 2007-06-27 17:51:15 UTC (rev 2197)
@@ -0,0 +1,20 @@
+ /*******************************************************************************
+ * 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.core;
+
+/**
+ * @author igels
+ *
+ */
+public enum BijectedAttributeType {
+ IN,
+ OUT
+}
\ No newline at end of file
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IBijectedAttribute.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IBijectedAttribute.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IBijectedAttribute.java 2007-06-27 17:51:15 UTC (rev 2197)
@@ -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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.core;
+
+import org.eclipse.jdt.core.IMember;
+
+/**
+ * @author igels
+ */
+public interface IBijectedAttribute {
+
+ /**
+ * @return name
+ */
+ public String getName();
+
+ /**
+ * @return type
+ */
+ public BijectedAttributeType getType();
+
+ /**
+ * @return java source element
+ */
+ public IMember getJavaElement();
+}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponent.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponent.java 2007-06-27 16:59:56 UTC (rev 2196)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponent.java 2007-06-27 17:51:15 UTC (rev 2197)
@@ -10,36 +10,86 @@
******************************************************************************/
package org.jboss.tools.seam.core;
-public interface ISeamComponent {
-
- //Common to all components attributes
- public static String NAME = "name";
- public static String CLASS = "class";
- public static String SCOPE = "scope";
- public static String PRECEDENCE = "precedence";
- public static String INSTALLED = "installed";
- public static String AUTO_CREATE = "auto-create";
- public static String JNDI_NAME = "jndi-name";
-
- //If property has default value but it cannot be resolved yet,
- //then set property value to this constant.
- //TODO specify string value
- public String DEFAULT = "";
+import java.util.List;
+import java.util.Set;
- public ISeamProperty<? extends Object> getProperty(String propertyName);
- public void addProperty(ISeamProperty<? extends Object> property);
+import org.eclipse.jdt.core.IType;
+public interface ISeamComponent extends ISeamModelObject {
+
/**
- * Convenient access methods to properties common for all components
- * Implementation has to create and access ISeamProperty instances for
- * these properties, to allow storing attribute location in source.
+ * @return Name
*/
public String getName();
+
+ /**
+ * @return qualified Class name of component
+ */
public String getClassName();
- public String getScope();
- public String getPrecedence();
- public boolean isInstalled();
- public boolean isAutoCreate();
- public String getJndiName();
-}
+ /**
+ * @return scope type
+ */
+ public ScopeType getScope();
+
+ /**
+ * @return bijected attributes
+ */
+ public Set<IBijectedAttribute> getBijectedAttributes();
+
+ /**
+ * Adds bijected attribute
+ */
+ public void addBijectedAttribute(IBijectedAttribute attribute);
+
+ /**
+ * Returns bijected attributes by name
+ * @param name
+ * @return
+ */
+ public Set<IBijectedAttribute> getBijectedAttributesByName(String name);
+
+ /**
+ * Returns bijected attributes by type
+ * @param type
+ * @return
+ */
+ public Set<IBijectedAttribute> getBijectedAttributesByType(BijectedAttributeType type);
+
+ /**
+ * Returns all properties from component.xml for that component.
+ * @param propertyName
+ * @return
+ */
+ public List<ISeamProperty<? extends Object>> getProperties(String propertyName);
+
+ /**
+ * Returns properties by name from component.xml.
+ * @param propertyName
+ * @return
+ */
+ public Set<ISeamProperty<? extends Object>> getProperties();
+
+ /**
+ * Adds property to component.
+ * @param property
+ */
+ public void addProperty(ISeamProperty<? extends Object> property);
+
+ /**
+ * @return Set of Java source classes
+ */
+ public Set<IType> getJavaSourceClasses();
+
+ /**
+ * @param sourceClass
+ */
+ public void addJavaSourceClass(IType sourceClass);
+
+ /**
+ * @return Set of source xml elements
+ */
+ public Set<ISeamXmlElement> getXmlSourceElements();
+
+ // TODO add @Rules @Factory ...
+}
\ No newline at end of file
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamModelObject.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamModelObject.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamModelObject.java 2007-06-27 17:51:15 UTC (rev 2197)
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.core;
+
+public interface ISeamModelObject {
+
+ /**
+ * @return ID of Model Object
+ */
+ public String getId();
+}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProject.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProject.java 2007-06-27 16:59:56 UTC (rev 2196)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProject.java 2007-06-27 17:51:15 UTC (rev 2197)
@@ -11,12 +11,39 @@
package org.jboss.tools.seam.core;
import java.util.Set;
+
import org.eclipse.core.resources.IProjectNature;
public interface ISeamProject extends IProjectNature {
+
public static String NATURE_ID = "org.jboss.tools.seam.core.seam";
-
- public ISeamComponent getComponent(String name);
+
+ /**
+ * @param name of component.
+ * @return Set of ISeamComponents by name.
+ */
+ public Set<ISeamComponent> getComponentsByName(String name);
+
+ /**
+ * @param type of scope.
+ * @return Set of ISeamComponents by Scope Type.
+ */
+ public Set<ISeamComponent> getComponentsByScope(ScopeType type);
+
+ /**
+ * @param className
+ * @return Set of ISeamComponents by class name.
+ */
+ public Set<ISeamComponent> getComponentsByClass(String className);
+
+ /**
+ * @param id of component.
+ * @return ISeamComponent by model object ID.
+ */
+ public ISeamComponent getComponent(String modelObjectId);
+
+ /**
+ * @return Set of ISeamComponents
+ */
public Set<ISeamComponent> getComponents();
-
-}
+}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProperty.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProperty.java 2007-06-27 16:59:56 UTC (rev 2196)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProperty.java 2007-06-27 17:51:15 UTC (rev 2197)
@@ -10,16 +10,18 @@
******************************************************************************/
package org.jboss.tools.seam.core;
-public interface ISeamProperty<T extends Object> {
-
+import org.eclipse.core.resources.IFile;
+
+/**
+ * Seam Property defined in Component.xml
+ * @param <T>
+ */
+public interface ISeamProperty<T extends Object> extends ISeamXmlElement {
+
public String getName();
- public int getStartPosition();
- public int getLength();
-
public T getValue();
public String getStringValue();
-
+
public void setObject(Object value);
-
-}
+}
\ No newline at end of file
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamXmlElement.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamXmlElement.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamXmlElement.java 2007-06-27 17:51:15 UTC (rev 2197)
@@ -0,0 +1,24 @@
+ /*******************************************************************************
+ * 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.core;
+
+import org.eclipse.core.resources.IFile;
+
+/**
+ * @author igels
+ * TODO should we use WTP's stuff instead?
+ */
+public interface ISeamXmlElement {
+
+ public IFile getSourceFile();
+ public int getStartPosition();
+ public int getLength();
+}
\ No newline at end of file
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ScopeType.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ScopeType.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ScopeType.java 2007-06-27 17:51:15 UTC (rev 2197)
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * 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.core;
+
+/**
+ * Types of Seam Scopes.
+ * @author igels
+ */
+public enum ScopeType {
+ STATELESS,
+ METHOD,
+ EVENT,
+ PAGE,
+ CONVERSATION,
+ SESSION,
+ APPLICATION,
+ BUSINESS_PROCESS,
+ UNSPECIFIED;
+}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCoreBuilder.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCoreBuilder.java 2007-06-27 16:59:56 UTC (rev 2196)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCoreBuilder.java 2007-06-27 17:51:15 UTC (rev 2197)
@@ -89,7 +89,7 @@
try {
c = scanner.parse(f);
} catch (Exception e) {
- SeamCorePlugin.log(e);
+ SeamCorePlugin.getDefault().logError(e);
}
if(c != null) componentsLoaded(c, f);
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCorePlugin.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCorePlugin.java 2007-06-27 16:59:56 UTC (rev 2196)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCorePlugin.java 2007-06-27 17:51:15 UTC (rev 2197)
@@ -10,15 +10,14 @@
******************************************************************************/
package org.jboss.tools.seam.core;
-import org.eclipse.core.runtime.Status;
import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.jboss.tools.common.log.BaseUIPlugin;
import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
*/
-public class SeamCorePlugin extends AbstractUIPlugin {
+public class SeamCorePlugin extends BaseUIPlugin {
// The plug-in ID
public static final String PLUGIN_ID = "org.jboss.tools.seam.core";
@@ -69,9 +68,4 @@
public static ImageDescriptor getImageDescriptor(String path) {
return imageDescriptorFromPlugin(PLUGIN_ID, path);
}
-
- static public void log(Exception ex) {
- getDefault().getLog().log(new Status(Status.ERROR, PLUGIN_ID, Status.OK, "No message", ex));
- }
-
-}
+}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponent.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponent.java 2007-06-27 16:59:56 UTC (rev 2196)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponent.java 2007-06-27 17:51:15 UTC (rev 2197)
@@ -11,31 +11,26 @@
package org.jboss.tools.seam.internal.core;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IType;
+import org.jboss.tools.seam.core.BijectedAttributeType;
+import org.jboss.tools.seam.core.IBijectedAttribute;
import org.jboss.tools.seam.core.ISeamComponent;
import org.jboss.tools.seam.core.ISeamProperty;
+import org.jboss.tools.seam.core.ISeamXmlElement;
+import org.jboss.tools.seam.core.ScopeType;
public class SeamComponent implements ISeamComponent {
protected Map<String,ISeamProperty<? extends Object>> properties = new HashMap<String, ISeamProperty<? extends Object>>();
protected IPath source;
-
+
public SeamComponent () {
- properties.put(NAME, new SeamProperty<String>(NAME));
- properties.put(CLASS, new SeamProperty<String>(CLASS));
- properties.put(SCOPE, new SeamProperty<String>(SCOPE, DEFAULT));
}
- public String getName() {
- return getStringProperty(NAME);
- }
-
- public void setName(String name) {
- setStringProperty(NAME, name);
- }
-
public Set<String> getPropertyNames() {
return properties.keySet();
}
@@ -53,11 +48,11 @@
Object value = o.getValue();
return value == null ? null : value.toString();
}
-
+
public ISeamProperty<? extends Object> getProperty(String propertyName) {
return properties.get(propertyName);
}
-
+
public void addProperty(ISeamProperty<? extends Object> property) {
properties.put(property.getName(), property);
}
@@ -71,63 +66,125 @@
}
properties.put(propertyName, p);
}
-
+
public void setSource(IPath path) {
source = path;
}
- public String getClassName() {
- return getStringProperty(CLASS);
+ /**
+ * @return ID of Seam Component. It's unique within Project.
+ */
+ public String getId() {
+ return getClassName() + ":" + getName();
}
-
- public void setClassName(String className) {
- setStringProperty(CLASS, className);
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.core.ISeamComponent#addBijectedAttribute(org.jboss.tools.seam.core.IBijectedAttribute)
+ */
+ public void addBijectedAttribute(IBijectedAttribute attribute) {
+ // TODO Auto-generated method stub
+
}
-
- public String getScope() {
- return getStringProperty(SCOPE);
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.core.ISeamComponent#addJavaSourceClass(org.eclipse.jdt.core.IType)
+ */
+ public void addJavaSourceClass(IType sourceClass) {
+ // TODO Auto-generated method stub
+
}
- public void setScope(String scope) {
- setStringProperty(SCOPE, scope);
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.core.ISeamComponent#getBijectedAttributes()
+ */
+ public Set<IBijectedAttribute> getBijectedAttributes() {
+ // TODO Auto-generated method stub
+ return null;
}
-
- public String getJndiName() {
- return getStringProperty(JNDI_NAME);
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.core.ISeamComponent#getBijectedAttributesByName(java.lang.String)
+ */
+ public Set<IBijectedAttribute> getBijectedAttributesByName(String name) {
+ // TODO Auto-generated method stub
+ return null;
}
- public void setJndiName(String jndiName) {
- setStringProperty(JNDI_NAME, jndiName);
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.core.ISeamComponent#getBijectedAttributesByType(org.jboss.tools.seam.core.BijectedAttributeType)
+ */
+ public Set<IBijectedAttribute> getBijectedAttributesByType(
+ BijectedAttributeType type) {
+ // TODO Auto-generated method stub
+ return null;
}
-
- public String getPrecedence() {
- return getStringProperty(PRECEDENCE);
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.core.ISeamComponent#getClassName()
+ */
+ public String getClassName() {
+ // TODO Auto-generated method stub
+ return null;
}
- public void setPrecedence(String precedence) {
- setStringProperty(PRECEDENCE, precedence);
+ public void setClassName(String name) {
+ // TODO Auto-generated method stub
}
-
- public boolean isAutoCreate() {
- return getBooleanProperty(AUTO_CREATE);
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.core.ISeamComponent#getJavaSourceClasses()
+ */
+ public Set<IType> getJavaSourceClasses() {
+ // TODO Auto-generated method stub
+ return null;
}
- public void setAutoCreate(String autoCreate) {
- if(DEFAULT.equals(autoCreate) || autoCreate == null || autoCreate.length() == 0) {
- setStringProperty(AUTO_CREATE, DEFAULT);
- }
- addProperty(new SeamProperty<Boolean>(AUTO_CREATE, Boolean.parseBoolean(autoCreate)));
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.core.ISeamComponent#getName()
+ */
+ public String getName() {
+ // TODO Auto-generated method stub
+ return null;
}
-
- public boolean isInstalled() {
- return getBooleanProperty(INSTALLED);
- }
- public void setInstalled(String installed) {
- if(DEFAULT.equals(installed) || installed == null || installed.length() == 0) {
- setStringProperty(INSTALLED, DEFAULT);
- }
- addProperty(new SeamProperty<Boolean>(INSTALLED, Boolean.parseBoolean(installed)));
+ public void setName(String name) {
+ // TODO Auto-generated method stub
}
-
-}
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.core.ISeamComponent#getProperties(java.lang.String)
+ */
+ public List<ISeamProperty<? extends Object>> getProperties(
+ String propertyName) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.core.ISeamComponent#getProperties()
+ */
+ public Set<ISeamProperty<? extends Object>> getProperties() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.core.ISeamComponent#getScope()
+ */
+ public ScopeType getScope() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void setScope(ScopeType scope) {
+ // TODO Auto-generated method stub
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.core.ISeamComponent#getXmlSourceElements()
+ */
+ public Set<ISeamXmlElement> getXmlSourceElements() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2007-06-27 16:59:56 UTC (rev 2196)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2007-06-27 17:51:15 UTC (rev 2197)
@@ -21,6 +21,7 @@
import org.eclipse.core.runtime.IPath;
import org.jboss.tools.seam.core.ISeamComponent;
import org.jboss.tools.seam.core.ISeamProject;
+import org.jboss.tools.seam.core.ScopeType;
/**
*
@@ -29,9 +30,9 @@
public class SeamProject implements ISeamProject {
IProject project;
Map<String,SeamComponent> components = new HashMap<String, SeamComponent>();
-
- public SeamProject() {}
+ public SeamProject() {}
+
public void configure() throws CoreException {
}
@@ -46,26 +47,24 @@
this.project = project;
load();
}
-
+
/**
* Loads results of last build, which are considered
* actual until next build.
*/
protected void load() {
-
}
-
+
/**
* Stores results of last build, so that on exit/enter Eclipse
* load them without rebuilding project
*/
protected void store() {
-
}
- public ISeamComponent getComponent(String name) {
- return components.get(name);
- }
+// public ISeamComponent getComponentByName(String name) {
+// return components.get(name);
+// }
public Set<ISeamComponent> getComponents() {
//TODO store cash
@@ -73,7 +72,7 @@
set.addAll(components.values());
return set;
}
-
+
/**
* Package local method called by builder.
* @param component
@@ -87,7 +86,7 @@
components.put(list[i].getName(), list[i]);
}
}
-
+
/**
* Package local method called by builder.
* @param source
@@ -102,4 +101,35 @@
}
}
-}
+ public ISeamComponent getComponent(String modelObjectId) {
+ return components.get(modelObjectId);
+ }
+
+ public Set<ISeamComponent> getComponentsByName(String name) {
+ Set<ISeamComponent> result = new HashSet<ISeamComponent>();
+ Iterator<SeamComponent> iterator = components.values().iterator();
+ while(iterator.hasNext()) {
+ SeamComponent component = iterator.next();
+ if(name.equals(component.getName())) {
+ result.add(component);
+ }
+ }
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.core.ISeamProject#getComponentsByClass(java.lang.String)
+ */
+ public Set<ISeamComponent> getComponentsByClass(String className) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.core.ISeamProject#getComponentsByScope(org.jboss.tools.seam.core.ScopeType)
+ */
+ public Set<ISeamComponent> getComponentsByScope(ScopeType type) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProperty.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProperty.java 2007-06-27 16:59:56 UTC (rev 2196)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProperty.java 2007-06-27 17:51:15 UTC (rev 2197)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.seam.internal.core;
+import org.eclipse.core.resources.IFile;
import org.jboss.tools.seam.core.ISeamProperty;
public class SeamProperty<T extends Object> implements ISeamProperty<T> {
@@ -66,4 +67,11 @@
this.value = (T)value;
}
-}
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.core.ISeamXmlElement#getSourceFile()
+ */
+ public IFile getSourceFile() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/JavaScanner.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/JavaScanner.java 2007-06-27 16:59:56 UTC (rev 2196)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/JavaScanner.java 2007-06-27 17:51:15 UTC (rev 2197)
@@ -137,7 +137,8 @@
component.setClassName(n);
component.setName(visitor.name);
if(visitor.scope != null) {
- component.setScope(visitor.scope);
+ //TODO
+ //component.setScope(visitor.scope);
}
}
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLScanner.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLScanner.java 2007-06-27 16:59:56 UTC (rev 2196)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLScanner.java 2007-06-27 17:51:15 UTC (rev 2197)
@@ -73,13 +73,14 @@
static Set<String> COMMON_ATTRIBUTES = new HashSet<String>();
static {
- COMMON_ATTRIBUTES.add(ISeamComponent.NAME);
- COMMON_ATTRIBUTES.add(ISeamComponent.CLASS);
- COMMON_ATTRIBUTES.add(ISeamComponent.SCOPE);
- COMMON_ATTRIBUTES.add(ISeamComponent.PRECEDENCE);
- COMMON_ATTRIBUTES.add(ISeamComponent.INSTALLED);
- COMMON_ATTRIBUTES.add(ISeamComponent.AUTO_CREATE);
- COMMON_ATTRIBUTES.add(ISeamComponent.JNDI_NAME);
+ //TODO
+// COMMON_ATTRIBUTES.add(ISeamComponent.NAME);
+// COMMON_ATTRIBUTES.add(ISeamComponent.CLASS);
+// COMMON_ATTRIBUTES.add(ISeamComponent.SCOPE);
+// COMMON_ATTRIBUTES.add(ISeamComponent.PRECEDENCE);
+// COMMON_ATTRIBUTES.add(ISeamComponent.INSTALLED);
+// COMMON_ATTRIBUTES.add(ISeamComponent.AUTO_CREATE);
+// COMMON_ATTRIBUTES.add(ISeamComponent.JNDI_NAME);
}
public SeamComponent[] parse(XModelObject o) {
@@ -91,13 +92,14 @@
if(componentEntity.getAttribute("class") != null) {
//This is a component model object
SeamComponent component = new SeamComponent();
- component.setName(os[i].getAttributeValue(ISeamComponent.NAME));
- component.setClassName(os[i].getAttributeValue(ISeamComponent.CLASS));
- component.setScope(os[i].getAttributeValue(ISeamComponent.SCOPE));
- component.setPrecedence(os[i].getAttributeValue(ISeamComponent.PRECEDENCE));
- component.setInstalled(os[i].getAttributeValue(ISeamComponent.INSTALLED));
- component.setAutoCreate(os[i].getAttributeValue(ISeamComponent.AUTO_CREATE));
- component.setJndiName(os[i].getAttributeValue(ISeamComponent.JNDI_NAME));
+ //TODO
+// component.setName(os[i].getAttributeValue(ISeamComponent.NAME));
+// component.setClassName(os[i].getAttributeValue(ISeamComponent.CLASS));
+// component.setScope(os[i].getAttributeValue(ISeamComponent.SCOPE));
+// component.setPrecedence(os[i].getAttributeValue(ISeamComponent.PRECEDENCE));
+// component.setInstalled(os[i].getAttributeValue(ISeamComponent.INSTALLED));
+// component.setAutoCreate(os[i].getAttributeValue(ISeamComponent.AUTO_CREATE));
+// component.setJndiName(os[i].getAttributeValue(ISeamComponent.JNDI_NAME));
XAttribute[] attributes = componentEntity.getAttributes();
for (int ia = 0; ia < attributes.length; ia++) {
@@ -145,8 +147,9 @@
} else if(os[i].getModelEntity().getName().startsWith("SeamFactory")) {
//TODO what is the best way for factory?
SeamComponent component = new SeamComponent();
- component.setName(os[i].getAttributeValue(ISeamComponent.NAME));
- component.setScope(os[i].getAttributeValue(ISeamComponent.SCOPE));
+ //TODO
+// component.setName(os[i].getAttributeValue(ISeamComponent.NAME));
+// component.setScope(os[i].getAttributeValue(ISeamComponent.SCOPE));
String value = os[i].getAttributeValue("value");
//TODO how should we resolve value?
if(value != null) component.setStringProperty("value", value);
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamJavaHelper.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamJavaHelper.java 2007-06-27 16:59:56 UTC (rev 2196)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamJavaHelper.java 2007-06-27 17:51:15 UTC (rev 2197)
@@ -10,8 +10,20 @@
******************************************************************************/
package org.jboss.tools.seam.internal.core.validation;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.wst.validation.internal.operations.WorkbenchContext;
+import org.jboss.tools.seam.core.ISeamProject;
+import org.jboss.tools.seam.core.SeamCorePlugin;
public class SeamJavaHelper extends WorkbenchContext {
+ public ISeamProject getSeamProject() {
+ ISeamProject project = null;
+ try {
+ project = (ISeamProject)getProject().getNature(ISeamProject.NATURE_ID);
+ } catch (CoreException e) {
+ SeamCorePlugin.getDefault().logError("Can't get Seam Project", e);
+ }
+ return project;
+ }
}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamJavaValidator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamJavaValidator.java 2007-06-27 16:59:56 UTC (rev 2196)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamJavaValidator.java 2007-06-27 17:51:15 UTC (rev 2197)
@@ -10,12 +10,20 @@
******************************************************************************/
package org.jboss.tools.seam.internal.core.validation;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.wst.validation.internal.core.ValidationException;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
import org.eclipse.wst.validation.internal.provisional.core.IValidationContext;
import org.eclipse.wst.validation.internal.provisional.core.IValidatorJob;
+import org.jboss.tools.seam.core.ISeamComponent;
+import org.jboss.tools.seam.core.ISeamProject;
public class SeamJavaValidator implements IValidatorJob {
@@ -26,7 +34,23 @@
public IStatus validateInJob(IValidationContext helper, IReporter reporter) throws ValidationException {
SeamJavaHelper seamJavaHelper = (SeamJavaHelper)helper;
- System.out.println("Validate");
+ ISeamProject project = seamJavaHelper.getSeamProject();
+ Set<ISeamComponent> components = project.getComponents();
+ for (ISeamComponent seamComponent : components) {
+// seamComponent.
+ }
+ String[] uris = seamJavaHelper.getURIs();
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ if (uris.length > 0) {
+ IFile currentFile = null;
+ for (int i = 0; i < uris.length && !reporter.isCancelled(); i++) {
+ currentFile = root.getFile(new Path(uris[i]));
+ if (currentFile != null && currentFile.exists()) {
+ System.out.println(currentFile);
+ }
+ }
+ }
+
return OK_STATUS;
}
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/ScannerTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/ScannerTest.java 2007-06-27 16:59:56 UTC (rev 2196)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/ScannerTest.java 2007-06-27 17:51:15 UTC (rev 2197)
@@ -10,8 +10,12 @@
******************************************************************************/
package org.jboss.tools.seam.core.test;
+import java.util.Iterator;
import java.util.List;
+import java.util.Set;
+import junit.framework.TestCase;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@@ -26,8 +30,6 @@
import org.jboss.tools.seam.internal.core.SeamProject;
import org.jboss.tools.seam.internal.core.scanner.IFileScanner;
-import junit.framework.TestCase;
-
public class ScannerTest extends TestCase {
TestProjectProvider provider = null;
IProject project = null;
@@ -80,18 +82,21 @@
//After having tested details of xml scanner now let us check
// that it succeeded in build.
- ISeamComponent c = seamProject.getComponent("myComponent");
-
- assertTrue("Seam builder must put myComponent to project.", c != null);
-
- //We have list property in this component
- ISeamProperty<?> property = c.getProperty("myList");
- Object o = property.getValue();
- assertTrue("Property myList in myComponent must be instanceof java.util.List.", o instanceof List);
- List<?> oList = (List<?>)o;
- assertTrue("Property myList misses value 'value1.", "value1".equals(oList.get(0)));
-
-
+ Set<ISeamComponent> components = seamProject.getComponentsByName("myComponent");
+
+ assertTrue("Seam builder must put myComponent to project.", components.size() == 1);
+
+ for (Iterator iterator = components.iterator(); iterator.hasNext();) {
+ ISeamComponent c = (ISeamComponent) iterator.next();
+ //We have list property in this component
+ List<ISeamProperty<?>> prs = c.getProperties("myList");
+ assertTrue("Property myList is not found in components.xml", prs.size() == 1);
+ ISeamProperty<?> property = prs.get(0);
+ Object o = property.getValue();
+ assertTrue("Property myList in myComponent must be instanceof java.util.List.", o instanceof List);
+ List<?> oList = (List<?>)o;
+ assertTrue("Property myList misses value 'value1.", "value1".equals(oList.get(0)));
+ }
}
public void testJavaScanner() {
@@ -128,9 +133,9 @@
//After having tested details of java scanner now let us check
//that it succeeded in build.
- ISeamComponent c = seamProject.getComponent("myUser");
+ Set<ISeamComponent> components = seamProject.getComponentsByName("myUser");
- assertTrue("Seam builder must put myUser to project.", c != null);
+ assertTrue("Seam builder must put myUser to project.", components.size() == 1);
}
@@ -183,10 +188,8 @@
* After having tested details of library scanner now let us check
* that it succeeded in build.
*/
- ISeamComponent c = seamProject.getComponent("actor");
-
- assertTrue("Seam builder must put actor to project.", c != null);
+ Set<ISeamComponent> components = seamProject.getComponentsByName("actor");
+ assertTrue("Seam builder must put actor to project.", components.size()==1);
}
-
-}
+}
\ No newline at end of file
17 years, 6 months
JBoss Tools SVN: r2196 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/parts.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2007-06-27 12:59:56 -0400 (Wed, 27 Jun 2007)
New Revision: 2196
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/parts/OrmEditPart.java
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/parts/DiagramEditPart.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/parts/ShapeEditPart.java
Log:
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/parts/DiagramEditPart.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/parts/DiagramEditPart.java 2007-06-27 16:22:23 UTC (rev 2195)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/parts/DiagramEditPart.java 2007-06-27 16:59:56 UTC (rev 2196)
@@ -32,6 +32,7 @@
import org.eclipse.gef.LayerConstants;
import org.eclipse.gef.Request;
import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editparts.AbstractConnectionEditPart;
import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
import org.eclipse.gef.editpolicies.XYLayoutEditPolicy;
@@ -54,7 +55,7 @@
* @author Konstantin Mishin
*
*/
-class DiagramEditPart extends AbstractGraphicalEditPart implements PropertyChangeListener{
+class DiagramEditPart extends OrmEditPart implements PropertyChangeListener{
protected void createEditPolicies() {
installEditPolicy(EditPolicy.LAYOUT_ROLE, new ShapesXYLayoutEditPolicy());
@@ -193,6 +194,13 @@
}
}
+ public void setToFront(EditPart ep){
+ int index = getChildren().indexOf(ep);
+ if(index == -1) return;
+ if(index != getChildren().size()-1)
+ reorderChild(ep, getChildren().size()-1);
+ }
+
public void deactivate() {
if (isActive()) {
super.deactivate();
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/parts/OrmEditPart.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/parts/OrmEditPart.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/parts/OrmEditPart.java 2007-06-27 16:59:56 UTC (rev 2196)
@@ -0,0 +1,168 @@
+/*******************************************************************************
+ * 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.hibernate.veditor.editors.parts;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartListener;
+import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
+
+public class OrmEditPart extends AbstractGraphicalEditPart implements EditPartListener{
+
+ public void setModel(Object model) {
+ super.setModel(model);
+ addEditPartListener(this);
+ }
+
+ public void childAdded(EditPart child, int index) {
+ }
+
+ public void partActivated(EditPart editpart) {
+ }
+
+ public void partDeactivated(EditPart editpart) {
+ }
+
+ public void removingChild(EditPart child, int index) {
+ }
+
+ public void selectedStateChanged(EditPart editpart) {
+ if(this.getSelected() == EditPart.SELECTED_PRIMARY && OrmEditPart.this.getParent() instanceof DiagramEditPart) {
+ ((DiagramEditPart)OrmEditPart.this.getParent()).setToFront(this);
+ }
+ }
+
+ protected IFigure createFigure() {
+ return null;
+ }
+
+ protected void createEditPolicies() {
+ }
+
+ protected void refreshSourceConnections() {
+ int i;
+ org.eclipse.gef.ConnectionEditPart editPart;
+ Object model;
+
+ Map modelToEditPart = new HashMap();
+ List editParts = getSourceConnections();
+
+ for (i = 0; i < editParts.size(); i++) {
+ editPart = (ConnectionEditPart) editParts.get(i);
+ modelToEditPart.put(editPart.getModel(), editPart);
+ }
+
+ List modelObjects = getModelSourceConnections();
+ if (modelObjects == null)
+ modelObjects = new ArrayList();
+
+ for (i = 0; i < modelObjects.size(); i++) {
+ model = modelObjects.get(i);
+
+ if (i < editParts.size()) {
+ editPart = (ConnectionEditPart) editParts.get(i);
+ if (editPart.getModel() == model) {
+ if (editPart.getSource() != this)
+ editPart.setSource(this);
+ continue;
+ }
+ }
+
+ editPart = (ConnectionEditPart) modelToEditPart.get(model);
+ if (editPart != null)
+ reorderSourceConnection(editPart, i);
+ else {
+ editPart = createOrFindConnection(model);
+ addSourceConnection(editPart, i);
+ }
+ }
+
+ // Remove the remaining EditParts
+ List trash = new ArrayList();
+ for (; i < editParts.size(); i++)
+ trash.add(editParts.get(i));
+ for (i = 0; i < trash.size(); i++)
+ removeSourceConnection((ConnectionEditPart) trash.get(i));
+ }
+
+ protected void refreshTargetConnections() {
+ int i;
+ org.eclipse.gef.ConnectionEditPart editPart;
+ Object model;
+
+ Map mapModelToEditPart = new HashMap();
+ List connections = getTargetConnections();
+
+ for (i = 0; i < connections.size(); i++) {
+ editPart = (ConnectionEditPart) connections.get(i);
+ mapModelToEditPart.put(editPart.getModel(), editPart);
+ }
+
+ List modelObjects = getModelTargetConnections();
+ if (modelObjects == null)
+ modelObjects = new ArrayList();
+
+ for (i = 0; i < modelObjects.size(); i++) {
+ model = modelObjects.get(i);
+
+ if (i < connections.size()) {
+ editPart = (org.eclipse.gef.ConnectionEditPart) connections
+ .get(i);
+ if (editPart.getModel() == model) {
+ if (editPart.getTarget() != this)
+ editPart.setTarget(this);
+ continue;
+ }
+ }
+
+ editPart = (org.eclipse.gef.ConnectionEditPart) mapModelToEditPart
+ .get(model);
+ if (editPart != null)
+ reorderTargetConnection(editPart, i);
+ else {
+ editPart = createOrFindConnection(model);
+ addTargetConnection(editPart, i);
+ }
+ }
+
+ // Remove the remaining Connection EditParts
+ List trash = new ArrayList();
+ for (; i < connections.size(); i++)
+ trash.add(connections.get(i));
+ for (i = 0; i < trash.size(); i++)
+ removeTargetConnection((ConnectionEditPart) trash.get(i));
+ }
+
+ protected void removeSourceConnection(ConnectionEditPart connection) {
+ if (connection.getSource() != this)
+ return;
+ fireRemovingSourceConnection(connection, getSourceConnections()
+ .indexOf(connection));
+ connection.deactivate();
+ connection.setSource(null);
+ primRemoveSourceConnection(connection);
+ }
+
+ protected void removeTargetConnection(ConnectionEditPart connection) {
+ if (connection.getTarget() != this)
+ return;
+ fireRemovingTargetConnection(connection, getTargetConnections()
+ .indexOf(connection));
+ connection.setTarget(null);
+ primRemoveTargetConnection(connection);
+ }
+
+}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/parts/ShapeEditPart.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/parts/ShapeEditPart.java 2007-06-27 16:22:23 UTC (rev 2195)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/parts/ShapeEditPart.java 2007-06-27 16:59:56 UTC (rev 2196)
@@ -53,7 +53,7 @@
public class ShapeEditPart extends
- AbstractGraphicalEditPart implements PropertyChangeListener, NodeEditPart {
+OrmEditPart implements PropertyChangeListener, NodeEditPart {
static protected OrmLabelProvider ormLabelProvider =
new OrmLabelProvider(new OrmModelImageVisitor(), new OrmModelNameVisitor(null));
17 years, 6 months
JBoss Tools SVN: r2195 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/model.
by jbosstools-commits@lists.jboss.org
Author: mdryakhlenkov
Date: 2007-06-27 12:22:23 -0400 (Wed, 27 Jun 2007)
New Revision: 2195
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/model/OrmDiagram.java
Log:
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/model/OrmDiagram.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/model/OrmDiagram.java 2007-06-27 16:06:14 UTC (rev 2194)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/model/OrmDiagram.java 2007-06-27 16:22:23 UTC (rev 2195)
@@ -317,7 +317,7 @@
if (valueType.isCollectionType()) {
Collection collection = (Collection)property.getValue();
Value component = collection.getElement();
- if (valueType.isAssociationType()) {//valueType.isComponentType()
+ if (component instanceof Component) {//valueType.isComponentType()
OrmShape childShape = (OrmShape)elements.get(((Component)component).getComponentClassName());
if(childShape == null) childShape = getOrCreateComponentClass(property);
new Connection((Shape)(componentShape.getChildren().get(1)), childShape);
17 years, 6 months
JBoss Tools SVN: r2194 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views.
by jbosstools-commits@lists.jboss.org
Author: mdryakhlenkov
Date: 2007-06-27 12:06:14 -0400 (Wed, 27 Jun 2007)
New Revision: 2194
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OrmLabelProvider.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OrmModelNameVisitor.java
Log:
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OrmLabelProvider.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OrmLabelProvider.java 2007-06-27 16:05:30 UTC (rev 2193)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OrmLabelProvider.java 2007-06-27 16:06:14 UTC (rev 2194)
@@ -32,6 +32,7 @@
import org.hibernate.mapping.Property;
import org.hibernate.mapping.RootClass;
import org.hibernate.mapping.SimpleValue;
+import org.hibernate.mapping.SingleTableSubclass;
import org.hibernate.mapping.Table;
/**
@@ -104,6 +105,13 @@
} else {
return name;
}
+ } else if (element instanceof SingleTableSubclass) {
+ String name = (String)ormModelNameVisitor.visitPersistentClass((SingleTableSubclass)element, null);
+ if (name == null) {
+ return "OrmElement";
+ } else {
+ return name;
+ }
} else if (element instanceof Property) {
String name = (String)ormModelNameVisitor.visitPersistentField((Property)element, null);
if (name == null) {
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OrmModelNameVisitor.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OrmModelNameVisitor.java 2007-06-27 16:05:30 UTC (rev 2193)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OrmModelNameVisitor.java 2007-06-27 16:06:14 UTC (rev 2194)
@@ -19,6 +19,7 @@
import org.hibernate.mapping.DependantValue;
import org.hibernate.mapping.Property;
import org.hibernate.mapping.RootClass;
+import org.hibernate.mapping.SingleTableSubclass;
import org.hibernate.mapping.Table;
/**
@@ -494,6 +495,31 @@
return name.toString();
}
+ public Object visitPersistentClass(SingleTableSubclass clazz, Object argument) {
+
+ StringBuffer name = new StringBuffer();
+// if (((OrmContentProvider) viewer.getContentProvider()).getTip() == OrmContentProvider.PACKAGE_CLASS_FIELD_CONTENT_PROVIDER) {
+ name.append(clazz.getEntityName());
+// } else {
+// name.append(clazz.getClassName());
+// }
+
+ //edit tau 24.04.2006
+ Table table = clazz.getTable(); // upd tau 06.06.2005
+ //IDatabaseTable table = HibernateAutoMappingHelper.getPrivateTable(classMapping); // upd tau 18.04.2005
+ if (table != null) {
+ String tableName = table.getName();
+ if (tableName != null) {
+ //name.append(" (");
+ name.append(POINTER);
+ name.append(tableName);
+ //name.append(")");
+ }
+ }
+
+ return name.toString();
+ }
+
/**
* @see org.jboss.tools.hibernate.core.IOrmModelVisitor#visitPersistentField(org.jboss.tools.hibernate.core.IPersistentField, java.lang.Object)
*/
17 years, 6 months
JBoss Tools SVN: r2193 - in trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors: parts and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: mdryakhlenkov
Date: 2007-06-27 12:05:30 -0400 (Wed, 27 Jun 2007)
New Revision: 2193
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/model/OrmDiagram.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/model/OrmShape.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/parts/OrmShapeEditPart.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/parts/ShapeEditPart.java
Log:
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/model/OrmDiagram.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/model/OrmDiagram.java 2007-06-27 13:26:38 UTC (rev 2192)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/model/OrmDiagram.java 2007-06-27 16:05:30 UTC (rev 2193)
@@ -33,9 +33,11 @@
import org.hibernate.mapping.Map;
import org.hibernate.mapping.OneToMany;
import org.hibernate.mapping.OneToOne;
+import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.Property;
import org.hibernate.mapping.RootClass;
import org.hibernate.mapping.SimpleValue;
+import org.hibernate.mapping.SingleTableSubclass;
import org.hibernate.mapping.Table;
import org.hibernate.mapping.Value;
import org.hibernate.type.EntityType;
@@ -162,11 +164,15 @@
// Property property = (Property)ormElement;
// elements.put(property.getPersistentClass().getEntityName() + "." + property.getName(), ormShape);
elements.put(specialRootClass.getClassName(), ormShape);
+ } else if (ormElement instanceof SingleTableSubclass) {
+ ormShape = new OrmShape(ormElement);
+ shapes.add(ormShape);
+ elements.put(((SingleTableSubclass)ormElement).getEntityName(), ormShape);
}
return ormShape;
}
- private OrmShape getOrCreatePersistentClass(RootClass persistentClass, Table componentClassDatabaseTable){
+ private OrmShape getOrCreatePersistentClass(PersistentClass persistentClass, Table componentClassDatabaseTable){
OrmShape classShape = null;
OrmShape shape = null;
if(persistentClass != null) {
@@ -203,11 +209,17 @@
tableShape = createShape(databaseTable);
Iterator iterator = getConfiguration().getClassMappings();
while (iterator.hasNext()) {
- RootClass cls = (RootClass)iterator.next();
- Table table = cls.getTable();
- if (tableName.equals(table.getName() + "." + table.getName())) {
- if (elements.get(cls.getClassName()) == null)
- getOrCreatePersistentClass(cls, null);
+ Object clazz = iterator.next();
+ if (clazz instanceof RootClass) {
+ RootClass cls = (RootClass)clazz;
+ Table table = cls.getTable();
+ if (tableName.equals(table.getName() + "." + table.getName())) {
+ if (elements.get(cls.getClassName()) == null)
+ getOrCreatePersistentClass(cls, null);
+ }
+ } else if (clazz instanceof SingleTableSubclass) {
+ SingleTableSubclass singleTableSubclass = (SingleTableSubclass)clazz;
+ getOrCreatePersistentClass(singleTableSubclass, null);
}
}
// IPersistentClassMapping persistentClassMappings[] = databaseTable.getPersistentClassMappings();
@@ -305,7 +317,7 @@
if (valueType.isCollectionType()) {
Collection collection = (Collection)property.getValue();
Value component = collection.getElement();
- if (valueType.isComponentType()) {
+ if (valueType.isAssociationType()) {//valueType.isComponentType()
OrmShape childShape = (OrmShape)elements.get(((Component)component).getComponentClassName());
if(childShape == null) childShape = getOrCreateComponentClass(property);
new Connection((Shape)(componentShape.getChildren().get(1)), childShape);
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/model/OrmShape.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/model/OrmShape.java 2007-06-27 13:26:38 UTC (rev 2192)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/model/OrmShape.java 2007-06-27 16:05:30 UTC (rev 2193)
@@ -19,6 +19,7 @@
import org.hibernate.mapping.KeyValue;
import org.hibernate.mapping.Property;
import org.hibernate.mapping.RootClass;
+import org.hibernate.mapping.SingleTableSubclass;
import org.hibernate.mapping.Table;
/**
@@ -68,6 +69,19 @@
}
shapes.add(bodyOrmShape);
}
+ } else if (ormElement instanceof SingleTableSubclass) {
+ Iterator iterator = ((SingleTableSubclass)ormElement).getRootClass().getPropertyIterator();
+ while (iterator.hasNext()) {
+ Property field = (Property)iterator.next();
+ if (field.getValue().getType().isEntityType()) {
+ bodyOrmShape = new ExpandeableShape(field);
+ } else if (field.getValue().getType().isCollectionType()) {
+ bodyOrmShape = new ComponentShape(field);
+ } else {
+ bodyOrmShape = new Shape(field);
+ }
+ shapes.add(bodyOrmShape);
+ }
} else if (ormElement instanceof Table) {
Iterator iterator = ((Table)getOrmElement()).getColumnIterator();
while (iterator.hasNext()) {
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/parts/OrmShapeEditPart.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/parts/OrmShapeEditPart.java 2007-06-27 13:26:38 UTC (rev 2192)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/parts/OrmShapeEditPart.java 2007-06-27 16:05:30 UTC (rev 2193)
@@ -28,6 +28,7 @@
import org.hibernate.mapping.Bag;
import org.hibernate.mapping.Collection;
import org.hibernate.mapping.Component;
+import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.Property;
import org.hibernate.mapping.RootClass;
import org.hibernate.mapping.Table;
@@ -53,8 +54,8 @@
TitleLabel label = new TitleLabel();
String text = "";
Object element = getCastedModel().getOrmElement();
- if (element instanceof RootClass) {
- text = ormLabelProvider.getText((RootClass)element);
+ if (element instanceof PersistentClass) {
+ text = ormLabelProvider.getText((PersistentClass)element);
} else if (element instanceof Table) {
Table table = (Table)element;
text = table.getSchema() + "." + table.getName();
@@ -119,7 +120,7 @@
protected Color getBackgroundColor() {
Object element = getCastedModel().getOrmElement();
//R if (getCastedModel().getOrmElement() instanceof IPersistentClass)
- if (element instanceof RootClass || element instanceof Component)
+ if (element instanceof PersistentClass || element instanceof Component)
return ResourceManager.getInstance().getColor(new RGB(0,0,0));
//R else if (getCastedModel().getOrmElement() instanceof IDatabaseTable)
else if (element instanceof Table || element instanceof Property)
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/parts/ShapeEditPart.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/parts/ShapeEditPart.java 2007-06-27 13:26:38 UTC (rev 2192)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/parts/ShapeEditPart.java 2007-06-27 16:05:30 UTC (rev 2193)
@@ -36,6 +36,7 @@
import org.hibernate.mapping.Component;
import org.hibernate.mapping.DependantValue;
import org.hibernate.mapping.OneToMany;
+import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.Property;
import org.hibernate.mapping.RootClass;
import org.hibernate.mapping.SimpleValue;
@@ -182,7 +183,7 @@
protected Color getColor() {
Object element = getCastedModel().getOrmElement();
- if (element instanceof RootClass || element instanceof Component)
+ if (element instanceof PersistentClass || element instanceof Component)
return ResourceManager.getInstance().getColor(new RGB(
Integer.parseInt(Messages.Colors_PersistentClassR),
Integer.parseInt(Messages.Colors_PersistentClassG),
@@ -222,7 +223,7 @@
protected Color getSelectionColor() {
//R if (getCastedModel().getOrmElement() instanceof IPersistentClass || getCastedModel().getOrmElement() instanceof IPersistentField || getCastedModel().getOrmElement() instanceof IHibernateValueMapping)
- if (getCastedModel().getOrmElement() instanceof RootClass ||
+ if (getCastedModel().getOrmElement() instanceof PersistentClass ||
getCastedModel().getOrmElement() instanceof Property ||
getCastedModel().getOrmElement() instanceof Component ||
getCastedModel().getOrmElement() instanceof DependantValue)
17 years, 6 months