JBoss Tools SVN: r2532 - trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2007-07-19 14:13:34 -0400 (Thu, 19 Jul 2007)
New Revision: 2532
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.properties
Log:
http://jira.jboss.com/jira/browse/EXIN-327 Preferences
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.properties
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.properties 2007-07-19 18:05:31 UTC (rev 2531)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.properties 2007-07-19 18:13:34 UTC (rev 2532)
@@ -1,3 +1,13 @@
+ /*******************************************************************************
+ * 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
+ ******************************************************************************/
#Preferences Page
SeamValidatorConfigurationBlock_common_description=Select the severity level for the following optional Seam Validator problems:
@@ -7,9 +17,9 @@
##Section Components
SeamValidatorConfigurationBlock_section_component=Components
-SeamValidatorConfigurationBlock_pb_nonUniqueComponentName_label=Non-unique component name:
-SeamValidatorConfigurationBlock_pb_statefulComponentDoesNotContainRemove_label=Stateful component does not contain remove:
-SeamValidatorConfigurationBlock_pb_statefulComponentDoesNotContainDestroy_label=Stateful component does not contain destroy:
+SeamValidatorConfigurationBlock_pb_nonUniqueComponentName_label=Duplicate component name:
+SeamValidatorConfigurationBlock_pb_statefulComponentDoesNotContainRemove_label=Stateful component does not contain @Remove method:
+SeamValidatorConfigurationBlock_pb_statefulComponentDoesNotContainDestroy_label=Stateful component does not contain @Destroy method:
SeamValidatorConfigurationBlock_pb_statefulComponentHasWrongScope_label=Stateful component has wrong scope:
SeamValidatorConfigurationBlock_pb_unknownComponentClassName_label=Component class name cannot be resolved to a type:
SeamValidatorConfigurationBlock_pb_unknownComponentProperty_label=Component class does not contain setter for property:
@@ -17,17 +27,17 @@
##Section Entities
SeamValidatorConfigurationBlock_section_entities=Entities
SeamValidatorConfigurationBlock_pb_entityComponentHasWrongScope_label=Entity component has wrong scope:
-SeamValidatorConfigurationBlock_pb_duplicateRemove_label=Duplicate remove:
+SeamValidatorConfigurationBlock_pb_duplicateRemove_label=Duplicate @Remove method:
##Section Component life-cycle methods
SeamValidatorConfigurationBlock_section_lifecycle=Component life-cycle methods:
-SeamValidatorConfigurationBlock_pb_duplicateDestroy_label=Duplicate destroy:
-SeamValidatorConfigurationBlock_pb_duplicateCreate_label=Duplicate create:
-SeamValidatorConfigurationBlock_pb_duplicateUnwrap_label=Duplicate unwrap:
-SeamValidatorConfigurationBlock_pb_destroyDoesNotBelongToComponent_label=Destroy does not belong to component:
-SeamValidatorConfigurationBlock_pb_createDoesNotBelongToComponent_label=Create does not belong to component:
-SeamValidatorConfigurationBlock_pb_unwrapDoesNotBelongToComponent_label=Unwrap does not belong to component:
-SeamValidatorConfigurationBlock_pb_observerDoesNotBelongToComponent_label=Observer does not belong to component:
+SeamValidatorConfigurationBlock_pb_duplicateDestroy_label=Duplicate @Destroy method:
+SeamValidatorConfigurationBlock_pb_duplicateCreate_label=Duplicate @Create method:
+SeamValidatorConfigurationBlock_pb_duplicateUnwrap_label=Duplicate @Unwrap method:
+SeamValidatorConfigurationBlock_pb_destroyDoesNotBelongToComponent_label=@Destroy method must be declared in component class:
+SeamValidatorConfigurationBlock_pb_createDoesNotBelongToComponent_label=@Create method must be declared in component class:
+SeamValidatorConfigurationBlock_pb_unwrapDoesNotBelongToComponent_label=@Unwrap method must be declared in component class:
+SeamValidatorConfigurationBlock_pb_observerDoesNotBelongToComponent_label=@Observer method must be declared in component class:
##Section Factories
SeamValidatorConfigurationBlock_section_factory=Factories
@@ -36,7 +46,7 @@
##Section Bijections
SeamValidatorConfigurationBlock_section_bijection=Bijections
SeamValidatorConfigurationBlock_pb_multipleDataBinder_label=Multiple data binder:
-SeamValidatorConfigurationBlock_pb_unknownDataModel_label=Unknown data model:
+SeamValidatorConfigurationBlock_pb_unknownDataModel_label=Unknown @DataModel/@Out name:
##Section Context variables
SeamValidatorConfigurationBlock_section_variable=Context variables
17 years, 5 months
JBoss Tools SVN: r2531 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2007-07-19 14:05:31 -0400 (Thu, 19 Jul 2007)
New Revision: 2531
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidator.java
Log:
http://jira.jboss.com/jira/browse/EXIN-327 Preferences
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidator.java 2007-07-19 17:49:11 UTC (rev 2530)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidator.java 2007-07-19 18:05:31 UTC (rev 2531)
@@ -78,16 +78,20 @@
return "org.jboss.tools.seam.internal.core.validation.messages";
}
- protected void addError(String preferenceKey, String messageId, String[] messageArguments, ISeamTextSourceReference location, IResource target, String messageGroup) {
- addError(preferenceKey, messageId, messageArguments, location.getLength(), location.getStartPosition(), target, messageGroup);
+ protected void addError(String messageId, String preferenceKey, String[] messageArguments, ISeamTextSourceReference location, IResource target, String messageGroup) {
+ addError(messageId, preferenceKey, messageArguments, location.getLength(), location.getStartPosition(), target, messageGroup);
}
- protected void addError(String preferenceKey, String messageId, String[] messageArguments, int length, int offset, IResource target, String messageGroup) {
+ protected void addError(String messageId, String preferenceKey, ISeamTextSourceReference location, IResource target, String messageGroup) {
+ addError(messageId, preferenceKey, new String[0], location, target, messageGroup);
+ }
+
+ protected void addError(String messageId, String preferenceKey, String[] messageArguments, int length, int offset, IResource target, String messageGroup) {
String preferenceValue = SeamPreferences.getProjectPreference(project, preferenceKey);
boolean ignore = false;
int messageSeverity = IMessage.HIGH_SEVERITY;
if(SeamPreferences.WARNING.equals(preferenceValue)) {
- messageSeverity = IMessage.HIGH_SEVERITY;
+ messageSeverity = IMessage.NORMAL_SEVERITY;
} else if(SeamPreferences.IGNORE.equals(preferenceValue)) {
ignore = true;
}
@@ -95,16 +99,11 @@
IMessage message = new Message(getBaseName(), messageSeverity, messageId, messageArguments, target, messageGroup);
message.setLength(length);
message.setOffset(offset);
- message.setSeverity(IMessage.HIGH_SEVERITY);
if(!ignore) {
reporter.addMessage(this, message);
}
}
- protected void addError(String preferenceKey, String messageId, ISeamTextSourceReference location, IResource target, String messageGroup) {
- addError(preferenceKey, messageId, new String[0], location, target, messageGroup);
- }
-
protected void removeMessagesFromResources(Set<IResource> resources, String messageGroup) {
for (IResource r : resources) {
reporter.removeMessageSubset(this, r, messageGroup);
17 years, 5 months
JBoss Tools SVN: r2530 - in trunk/seam/plugins: org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2007-07-19 13:49:11 -0400 (Thu, 19 Jul 2007)
New Revision: 2530
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamPreferences.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidator.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/messages.properties
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.properties
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamValidatorConfigurationBlock.java
Log:
http://jira.jboss.com/jira/browse/EXIN-327 Peferences
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamPreferences.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamPreferences.java 2007-07-19 17:33:15 UTC (rev 2529)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamPreferences.java 2007-07-19 17:49:11 UTC (rev 2530)
@@ -14,7 +14,6 @@
import java.util.Set;
import org.eclipse.core.resources.ProjectScope;
-import org.eclipse.core.runtime.preferences.ConfigurationScope;
import org.eclipse.core.runtime.preferences.DefaultScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
@@ -52,6 +51,8 @@
public static final String STATEFUL_COMPONENT_DOES_NOT_CONTENT_REMOVE = createSeverityOption("statefulComponentDoesNotContainRemove");
public static final String STATEFUL_COMPONENT_DOES_NOT_CONTENT_DESTROY = createSeverityOption("statefulComponentDoesNotContainDestroy");
public static final String STATEFUL_COMPONENT_WRONG_SCOPE = createSeverityOption("statefulComponentHasWrongScope");
+ public static final String UNKNOWN_COMPONENT_CLASS_NAME = createSeverityOption("unknownComponentClassName");
+ public static final String UNKNOWN_COMPONENT_PROPERTY = createSeverityOption("unknownComponentProperty");
//Entities
public static final String ENTITY_COMPONENT_WRONG_SCOPE = createSeverityOption("entityComponentHasWrongScope");
@@ -75,7 +76,7 @@
//Context variables
public static final String DUPLICATE_VARIABLE_NAME = createSeverityOption("duplicateVariableName");
- public static final String UNKNOWN_INJECTION_NAME = createSeverityOption("unknownInjectionName");
+ public static final String UNKNOWN_VARIABLE_NAME = createSeverityOption("unknownVariableName");
private static String createSeverityOption(String shortName) {
String name = SeamCorePlugin.PLUGIN_ID + ".validator.problem." + shortName;
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java 2007-07-19 17:33:15 UTC (rev 2529)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java 2007-07-19 17:49:11 UTC (rev 2530)
@@ -42,7 +42,6 @@
import org.jboss.tools.seam.core.ISeamContextVariable;
import org.jboss.tools.seam.core.ISeamFactory;
import org.jboss.tools.seam.core.ISeamJavaComponentDeclaration;
-import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.ISeamProperty;
import org.jboss.tools.seam.core.ISeamTextSourceReference;
import org.jboss.tools.seam.core.ISeamXmlComponentDeclaration;
@@ -50,6 +49,7 @@
import org.jboss.tools.seam.core.ScopeType;
import org.jboss.tools.seam.core.SeamComponentMethodType;
import org.jboss.tools.seam.core.SeamCorePlugin;
+import org.jboss.tools.seam.core.SeamPreferences;
import org.jboss.tools.seam.internal.core.SeamComponentDeclaration;
import org.jboss.tools.seam.internal.core.SeamJavaComponentDeclaration;
import org.jboss.tools.seam.internal.core.SeamProject;
@@ -63,27 +63,7 @@
private static final String MARKED_SEAM_RESOURCE_MESSAGE_GROUP = "markedSeamResource";
- private static final String NONUNIQUE_COMPONENT_NAME_MESSAGE_ID = "NONUNIQUE_COMPONENT_NAME_MESSAGE";
- private static final String UNKNOWN_INJECTION_NAME_MESSAGE_ID = "UNKNOWN_INJECTION_NAME";
- private static final String STATEFUL_COMPONENT_DOES_NOT_CONTAIN_METHOD_SUFIX_MESSAGE_ID = "STATEFUL_COMPONENT_DOES_NOT_CONTAIN_";
- private static final String DUPLICATE_METHOD_PREFIX_MESSAGE_ID = "DUPLICATE_";
- private static final String REMOVE_METHOD_SUFIX_MESSAGE_ID = "REMOVE";
- private static final String DESTROY_METHOD_SUFIX_MESSAGE_ID = "DESTROY";
- private static final String CREATE_METHOD_SUFIX_MESSAGE_ID = "CREATE";
- private static final String UNWRAP_METHOD_SUFIX_MESSAGE_ID = "UNWRAP";
- private static final String OBSERVER_METHOD_SUFIX_MESSAGE_ID = "OBSERVER";
- private static final String NONCOMPONENTS_METHOD_SUFIX_MESSAGE_ID = "_DOESNT_BELONG_TO_COMPONENT";
- private static final String STATEFUL_COMPONENT_WRONG_SCOPE_MESSAGE_ID = "STATEFUL_COMPONENT_WRONG_SCOPE";
- private static final String ENTITY_COMPONENT_WRONG_SCOPE_MESSAGE_ID = "ENTITY_COMPONENT_WRONG_SCOPE";
- private static final String UNKNOWN_FACTORY_NAME_MESSAGE_ID = "UNKNOWN_FACTORY_NAME";
- private static final String MULTIPLE_DATA_BINDER_MESSAGE_ID = "MULTIPLE_DATA_BINDER";
- private static final String DUPLICATE_VARIABLE_NAME_MESSAGE_ID = "DUPLICATE_VARIABLE_NAME";
- private static final String UNKNOWN_DATA_MODEL_MESSAGE_ID = "UNKNOWN_DATA_MODEL";
- private static final String UNKNOWN_COMPONENT_CLASS_NAME_MESSAGE_ID = "UNKNOWN_COMPONENT_CLASS_NAME";
- private static final String UNKNOWN_COMPONENT_PROPERTY_MESSAGE_ID = "UNKNOWN_COMPONENT_PROPERTY";
-
private SeamValidationContext validationContext;
- private ISeamProject project;
public ISchedulingRule getSchedulingRule(IValidationContext helper) {
return null;
@@ -91,7 +71,6 @@
public IStatus validateInJob(IValidationContext helper, IReporter reporter) throws ValidationException {
super.validateInJob(helper, reporter);
- project = coreHelper.getSeamProject();
validationContext = ((SeamProject)project).getValidationContext();
Set<IFile> changedFiles = coreHelper.getChangedFiles();
validationContext.getRemovedFiles().clear();
@@ -265,14 +244,14 @@
// mark original factory
validationContext.addLinkedResource(factoryName, factory.getSourcePath());
location = coreHelper.getLocationOfName(factory);
- this.addError(DUPLICATE_VARIABLE_NAME_MESSAGE_ID, new String[]{factoryName}, location, factory.getResource(), MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
+ this.addError(DUPLICATE_VARIABLE_NAME_MESSAGE_ID, SeamPreferences.DUPLICATE_VARIABLE_NAME, new String[]{factoryName}, location, factory.getResource(), MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
}
// mark duplicate variable
IResource resource = coreHelper.getComponentResourceWithName(variable);
if(!coreHelper.isJar(resource)) {
validationContext.addLinkedResource(factoryName, resource.getFullPath());
location = coreHelper.getLocationOfName(variable);
- this.addError(DUPLICATE_VARIABLE_NAME_MESSAGE_ID, new String[]{factoryName}, location, resource, MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
+ this.addError(DUPLICATE_VARIABLE_NAME_MESSAGE_ID, SeamPreferences.DUPLICATE_VARIABLE_NAME, new String[]{factoryName}, location, resource, MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
}
markedDuplicateFactoryNames.add(factoryName);
}
@@ -286,7 +265,7 @@
// mark unknown factory name
// save link to factory resource
validationContext.addLinkedResource(factoryName, factory.getSourcePath());
- this.addError(UNKNOWN_FACTORY_NAME_MESSAGE_ID, new String[]{factoryName}, coreHelper.getLocationOfName(factory), factory.getResource(), MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
+ this.addError(UNKNOWN_FACTORY_NAME_MESSAGE_ID, SeamPreferences.UNKNOWN_FACTORY_NAME, new String[]{factoryName}, coreHelper.getLocationOfName(factory), factory.getResource(), MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
}
}
@@ -356,7 +335,7 @@
IResource checkedDeclarationResource = checkedDeclaration.getResource();
ISeamTextSourceReference location = ((SeamComponentDeclaration)checkedDeclaration).getLocationFor(SeamComponentDeclaration.PATH_OF_NAME);
if(location!=null) {
- addError(NONUNIQUE_COMPONENT_NAME_MESSAGE_ID, new String[]{component.getName()}, location, checkedDeclarationResource, MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
+ addError(NONUNIQUE_COMPONENT_NAME_MESSAGE_ID, SeamPreferences.NONUNIQUE_COMPONENT_NAME, new String[]{component.getName()}, location, checkedDeclarationResource, MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
}
markedDeclarations.add(checkedDeclaration);
}
@@ -364,7 +343,7 @@
markedDeclarations.add(javaDeclaration);
ISeamTextSourceReference location = ((SeamComponentDeclaration)javaDeclaration).getLocationFor(SeamComponentDeclaration.PATH_OF_NAME);
if(location!=null) {
- addError(NONUNIQUE_COMPONENT_NAME_MESSAGE_ID, new String[]{component.getName()}, location, javaDeclarationResource, MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
+ addError(NONUNIQUE_COMPONENT_NAME_MESSAGE_ID, SeamPreferences.NONUNIQUE_COMPONENT_NAME, new String[]{component.getName()}, location, javaDeclarationResource, MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
}
}
}
@@ -390,10 +369,12 @@
validationContext.addLinkedResource(componentName, declaration.getSourcePath());
String className = declaration.getClassName();
if(className!=null) {
+ IType type = null;
// validate class name
try {
IProject p = project.getProject();
- IType type = EclipseResourceUtil.getJavaProject(p).findType(className);
+// type = EclipseJavaUtil.findType(EclipseResourceUtil.getJavaProject(p), className);
+ type = EclipseResourceUtil.getJavaProject(p).findType(className);
if(type==null) {
// Mark wrong class name
ISeamTextSourceReference location = ((SeamComponentDeclaration)declaration).getLocationFor(ISeamXmlComponentDeclaration.CLASS);
@@ -403,7 +384,9 @@
if(location==null) {
location = declaration;
}
- addError(UNKNOWN_COMPONENT_CLASS_NAME_MESSAGE_ID, new String[]{className}, location, declaration.getResource(), MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
+ addError(UNKNOWN_COMPONENT_CLASS_NAME_MESSAGE_ID, SeamPreferences.UNKNOWN_COMPONENT_CLASS_NAME, new String[]{className}, location, declaration.getResource(), MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
+ } else if(!type.isBinary()) {
+ validationContext.addLinkedResource(componentName, type.getResource().getFullPath());
}
} catch (JavaModelException e) {
SeamCorePlugin.getDefault().logError(e);
@@ -418,15 +401,9 @@
if(name==null) {
return;
}
- ISeamJavaComponentDeclaration javaDeclaration = component.getJavaDeclaration();
- if(javaDeclaration==null) {
- return;
- }
-
- IType type = (IType)javaDeclaration.getSourceMember();
boolean ok = type.isBinary() || coreHelper.findSetter(type, name)!=null;
if(!ok) {
- addError(UNKNOWN_COMPONENT_PROPERTY_MESSAGE_ID, new String[]{type.getElementName(), componentName, name}, property, declaration.getResource(), MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
+ addError(UNKNOWN_COMPONENT_PROPERTY_MESSAGE_ID, SeamPreferences.UNKNOWN_COMPONENT_PROPERTY, new String[]{type.getElementName(), componentName, name}, property, declaration.getResource(), MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
}
}
}
@@ -440,7 +417,7 @@
ScopeType scope = component.getScope();
if(scope == ScopeType.STATELESS) {
ISeamTextSourceReference location = getScopeLocation(component);
- addError(ENTITY_COMPONENT_WRONG_SCOPE_MESSAGE_ID, new String[]{component.getName()}, location, javaDeclaration.getResource(), MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
+ addError(ENTITY_COMPONENT_WRONG_SCOPE_MESSAGE_ID, SeamPreferences.ENTITY_COMPONENT_WRONG_SCOPE, new String[]{component.getName()}, location, javaDeclaration.getResource(), MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
}
}
}
@@ -469,40 +446,40 @@
private void validateStatefulComponent(ISeamComponent component) {
if(component.isStateful()) {
ISeamJavaComponentDeclaration javaDeclaration = component.getJavaDeclaration();
- validateStatefulComponentMethods(SeamComponentMethodType.DESTROY, component, DESTROY_METHOD_SUFIX_MESSAGE_ID);
- validateStatefulComponentMethods(SeamComponentMethodType.REMOVE, component, REMOVE_METHOD_SUFIX_MESSAGE_ID);
+ validateStatefulComponentMethods(SeamComponentMethodType.DESTROY, component, DESTROY_METHOD_SUFIX_MESSAGE_ID, SeamPreferences.STATEFUL_COMPONENT_DOES_NOT_CONTENT_DESTROY);
+ validateStatefulComponentMethods(SeamComponentMethodType.REMOVE, component, REMOVE_METHOD_SUFIX_MESSAGE_ID, SeamPreferences.STATEFUL_COMPONENT_DOES_NOT_CONTENT_REMOVE);
ScopeType scope = component.getScope();
if(scope == ScopeType.PAGE || scope == ScopeType.STATELESS) {
ISeamTextSourceReference location = getScopeLocation(component);
- addError(STATEFUL_COMPONENT_WRONG_SCOPE_MESSAGE_ID, new String[]{component.getName()}, location, javaDeclaration.getResource(), MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
+ addError(STATEFUL_COMPONENT_WRONG_SCOPE_MESSAGE_ID, SeamPreferences.STATEFUL_COMPONENT_WRONG_SCOPE, new String[]{component.getName()}, location, javaDeclaration.getResource(), MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
}
}
}
- private void validateStatefulComponentMethods(SeamComponentMethodType methodType, ISeamComponent component, String postfixMessageId) {
+ private void validateStatefulComponentMethods(SeamComponentMethodType methodType, ISeamComponent component, String postfixMessageId, String preferenceKey) {
ISeamJavaComponentDeclaration javaDeclaration = component.getJavaDeclaration();
ISeamTextSourceReference classNameLocation = getClassNameLocation(javaDeclaration);
Set<ISeamComponentMethod> methods = javaDeclaration.getMethodsByType(methodType);
if(methods==null || methods.size()==0) {
- addError(STATEFUL_COMPONENT_DOES_NOT_CONTAIN_METHOD_SUFIX_MESSAGE_ID + postfixMessageId, new String[]{component.getName()}, classNameLocation, javaDeclaration.getResource(), MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
+ addError(STATEFUL_COMPONENT_DOES_NOT_CONTAIN_METHOD_SUFIX_MESSAGE_ID + postfixMessageId, preferenceKey, new String[]{component.getName()}, classNameLocation, javaDeclaration.getResource(), MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
}
}
private void validateDuplicateComponentMethods(ISeamComponent component) {
- validateDuplicateComponentMethod(SeamComponentMethodType.DESTROY, component, DESTROY_METHOD_SUFIX_MESSAGE_ID);
- validateDuplicateComponentMethod(SeamComponentMethodType.REMOVE, component, REMOVE_METHOD_SUFIX_MESSAGE_ID);
- validateDuplicateComponentMethod(SeamComponentMethodType.CREATE, component, CREATE_METHOD_SUFIX_MESSAGE_ID);
- validateDuplicateComponentMethod(SeamComponentMethodType.UNWRAP, component, UNWRAP_METHOD_SUFIX_MESSAGE_ID);
+ validateDuplicateComponentMethod(SeamComponentMethodType.DESTROY, component, DESTROY_METHOD_SUFIX_MESSAGE_ID, SeamPreferences.DUPLICATE_DESTROY);
+ validateDuplicateComponentMethod(SeamComponentMethodType.REMOVE, component, REMOVE_METHOD_SUFIX_MESSAGE_ID, SeamPreferences.DUPLICATE_REMOVE);
+ validateDuplicateComponentMethod(SeamComponentMethodType.CREATE, component, CREATE_METHOD_SUFIX_MESSAGE_ID, SeamPreferences.DUPLICATE_CREATE);
+ validateDuplicateComponentMethod(SeamComponentMethodType.UNWRAP, component, UNWRAP_METHOD_SUFIX_MESSAGE_ID, SeamPreferences.DUPLICATE_UNWRAP);
}
- private void validateDuplicateComponentMethod(SeamComponentMethodType methodType, ISeamComponent component, String postfixMessageId) {
+ private void validateDuplicateComponentMethod(SeamComponentMethodType methodType, ISeamComponent component, String postfixMessageId, String preferenceKey) {
ISeamJavaComponentDeclaration javaDeclaration = component.getJavaDeclaration();
Set<ISeamComponentMethod> methods = javaDeclaration.getMethodsByType(methodType);
if(methods!=null && methods.size()>1) {
for (ISeamComponentMethod method : methods) {
IMethod javaMethod = (IMethod)method.getSourceMember();
String methodName = javaMethod.getElementName();
- addError(DUPLICATE_METHOD_PREFIX_MESSAGE_ID + postfixMessageId, new String[]{methodName}, method, javaDeclaration.getResource(), MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
+ addError(DUPLICATE_METHOD_PREFIX_MESSAGE_ID + postfixMessageId, preferenceKey, new String[]{methodName}, method, javaDeclaration.getResource(), MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
}
}
}
@@ -543,7 +520,7 @@
if(variables==null || variables.size()<1) {
// Injection has unknown name. Mark it.
IResource declarationResource = declaration.getResource();
- addError(UNKNOWN_INJECTION_NAME_MESSAGE_ID, new String[]{name}, bijection, declarationResource, MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
+ addError(UNKNOWN_VARIABLE_NAME_MESSAGE_ID, SeamPreferences.UNKNOWN_VARIABLE_NAME, new String[]{name}, bijection, declarationResource, MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
}
}
}
@@ -555,7 +532,7 @@
Set<IBijectedAttribute> dataBinders = declaration.getBijectedAttributesByType(BijectedAttributeType.DATA_BINDER);
if(dataBinders.size()>0) {
for (IBijectedAttribute dataBinder : dataBinders) {
- addError(MULTIPLE_DATA_BINDER_MESSAGE_ID, dataBinder, declaration.getResource(), MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
+ addError(MULTIPLE_DATA_BINDER_MESSAGE_ID, SeamPreferences.MULTIPLE_DATA_BINDER, dataBinder, declaration.getResource(), MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
}
}
} else {
@@ -567,7 +544,7 @@
return;
}
}
- addError(UNKNOWN_DATA_MODEL_MESSAGE_ID, new String[]{name}, coreHelper.getLocationOfName(bijection), declaration.getResource(), MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
+ addError(UNKNOWN_DATA_MODEL_MESSAGE_ID, SeamPreferences.UNKNOWN_DATA_MODEL, new String[]{name}, coreHelper.getLocationOfName(bijection), declaration.getResource(), MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
}
}
@@ -579,19 +556,19 @@
validationContext.removeUnnamedResource(declaration.getSourcePath());
return;
}
- validateMethodOfUnknownComponent(SeamComponentMethodType.DESTROY, declaration, DESTROY_METHOD_SUFIX_MESSAGE_ID);
- validateMethodOfUnknownComponent(SeamComponentMethodType.CREATE, declaration, CREATE_METHOD_SUFIX_MESSAGE_ID);
- validateMethodOfUnknownComponent(SeamComponentMethodType.UNWRAP, declaration, UNWRAP_METHOD_SUFIX_MESSAGE_ID);
- validateMethodOfUnknownComponent(SeamComponentMethodType.OBSERVER, declaration, OBSERVER_METHOD_SUFIX_MESSAGE_ID);
+ validateMethodOfUnknownComponent(SeamComponentMethodType.DESTROY, declaration, DESTROY_METHOD_SUFIX_MESSAGE_ID, SeamPreferences.DESTROY_DOESNT_BELONG_TO_COMPONENT);
+ validateMethodOfUnknownComponent(SeamComponentMethodType.CREATE, declaration, CREATE_METHOD_SUFIX_MESSAGE_ID, SeamPreferences.CREATE_DOESNT_BELONG_TO_COMPONENT);
+ validateMethodOfUnknownComponent(SeamComponentMethodType.UNWRAP, declaration, UNWRAP_METHOD_SUFIX_MESSAGE_ID, SeamPreferences.UNWRAP_DOESNT_BELONG_TO_COMPONENT);
+ validateMethodOfUnknownComponent(SeamComponentMethodType.OBSERVER, declaration, OBSERVER_METHOD_SUFIX_MESSAGE_ID, SeamPreferences.OBSERVER_DOESNT_BELONG_TO_COMPONENT);
}
- private void validateMethodOfUnknownComponent(SeamComponentMethodType methodType, ISeamJavaComponentDeclaration declaration, String sufixMessageId) {
+ private void validateMethodOfUnknownComponent(SeamComponentMethodType methodType, ISeamJavaComponentDeclaration declaration, String sufixMessageId, String preferenceKey) {
Set<ISeamComponentMethod> methods = declaration.getMethodsByType(methodType);
if(methods!=null && methods.size()>0) {
for (ISeamComponentMethod method : methods) {
IMethod javaMethod = (IMethod)method.getSourceMember();
String methodName = javaMethod.getElementName();
- addError(sufixMessageId + NONCOMPONENTS_METHOD_SUFIX_MESSAGE_ID, new String[]{methodName}, method, declaration.getResource(), MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
+ addError(sufixMessageId + NONCOMPONENTS_METHOD_SUFIX_MESSAGE_ID, preferenceKey, new String[]{methodName}, method, declaration.getResource(), MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
validationContext.addUnnamedResource(declaration.getSourcePath());
}
} else {
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidator.java 2007-07-19 17:33:15 UTC (rev 2529)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidator.java 2007-07-19 17:49:11 UTC (rev 2530)
@@ -14,13 +14,16 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.wst.validation.internal.core.Message;
import org.eclipse.wst.validation.internal.core.ValidationException;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
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.ISeamProject;
import org.jboss.tools.seam.core.ISeamTextSourceReference;
+import org.jboss.tools.seam.core.SeamPreferences;
/**
* Basic seam validator.
@@ -28,9 +31,30 @@
*/
public abstract class SeamValidator implements IValidatorJob {
+ protected static final String NONUNIQUE_COMPONENT_NAME_MESSAGE_ID = "NONUNIQUE_COMPONENT_NAME_MESSAGE";
+ protected static final String UNKNOWN_VARIABLE_NAME_MESSAGE_ID = "UNKNOWN_VARIABLE_NAME";
+ protected static final String STATEFUL_COMPONENT_DOES_NOT_CONTAIN_METHOD_SUFIX_MESSAGE_ID = "STATEFUL_COMPONENT_DOES_NOT_CONTAIN_";
+ protected static final String DUPLICATE_METHOD_PREFIX_MESSAGE_ID = "DUPLICATE_";
+ protected static final String REMOVE_METHOD_SUFIX_MESSAGE_ID = "REMOVE";
+ protected static final String DESTROY_METHOD_SUFIX_MESSAGE_ID = "DESTROY";
+ protected static final String CREATE_METHOD_SUFIX_MESSAGE_ID = "CREATE";
+ protected static final String UNWRAP_METHOD_SUFIX_MESSAGE_ID = "UNWRAP";
+ protected static final String OBSERVER_METHOD_SUFIX_MESSAGE_ID = "OBSERVER";
+ protected static final String NONCOMPONENTS_METHOD_SUFIX_MESSAGE_ID = "_DOESNT_BELONG_TO_COMPONENT";
+ protected static final String STATEFUL_COMPONENT_WRONG_SCOPE_MESSAGE_ID = "STATEFUL_COMPONENT_WRONG_SCOPE";
+ protected static final String ENTITY_COMPONENT_WRONG_SCOPE_MESSAGE_ID = "ENTITY_COMPONENT_WRONG_SCOPE";
+ protected static final String UNKNOWN_FACTORY_NAME_MESSAGE_ID = "UNKNOWN_FACTORY_NAME";
+ protected static final String MULTIPLE_DATA_BINDER_MESSAGE_ID = "MULTIPLE_DATA_BINDER";
+ protected static final String DUPLICATE_VARIABLE_NAME_MESSAGE_ID = "DUPLICATE_VARIABLE_NAME";
+ protected static final String UNKNOWN_DATA_MODEL_MESSAGE_ID = "UNKNOWN_DATA_MODEL";
+ protected static final String UNKNOWN_COMPONENT_CLASS_NAME_MESSAGE_ID = "UNKNOWN_COMPONENT_CLASS_NAME";
+ protected static final String UNKNOWN_COMPONENT_PROPERTY_MESSAGE_ID = "UNKNOWN_COMPONENT_PROPERTY";
+
protected SeamCoreValidationHelper coreHelper;
protected IReporter reporter;
+ protected ISeamProject project;
+
public SeamValidator() {
super();
}
@@ -38,6 +62,7 @@
public IStatus validateInJob(IValidationContext helper, IReporter reporter) throws ValidationException {
this.coreHelper = (SeamCoreValidationHelper)helper;
this.reporter = reporter;
+ this.project = coreHelper.getSeamProject();
return OK_STATUS;
}
@@ -53,20 +78,31 @@
return "org.jboss.tools.seam.internal.core.validation.messages";
}
- protected void addError(String messageId, String[] messageArguments, ISeamTextSourceReference location, IResource target, String messageGroup) {
- addError(messageId, messageArguments, location.getLength(), location.getStartPosition(), target, messageGroup);
+ protected void addError(String preferenceKey, String messageId, String[] messageArguments, ISeamTextSourceReference location, IResource target, String messageGroup) {
+ addError(preferenceKey, messageId, messageArguments, location.getLength(), location.getStartPosition(), target, messageGroup);
}
- protected void addError(String messageId, String[] messageArguments, int length, int offset, IResource target, String messageGroup) {
- IMessage message = new Message(getBaseName(), IMessage.HIGH_SEVERITY, messageId, messageArguments, target, messageGroup);
+ protected void addError(String preferenceKey, String messageId, String[] messageArguments, int length, int offset, IResource target, String messageGroup) {
+ String preferenceValue = SeamPreferences.getProjectPreference(project, preferenceKey);
+ boolean ignore = false;
+ int messageSeverity = IMessage.HIGH_SEVERITY;
+ if(SeamPreferences.WARNING.equals(preferenceValue)) {
+ messageSeverity = IMessage.HIGH_SEVERITY;
+ } else if(SeamPreferences.IGNORE.equals(preferenceValue)) {
+ ignore = true;
+ }
+
+ IMessage message = new Message(getBaseName(), messageSeverity, messageId, messageArguments, target, messageGroup);
message.setLength(length);
message.setOffset(offset);
message.setSeverity(IMessage.HIGH_SEVERITY);
- reporter.addMessage(this, message);
+ if(!ignore) {
+ reporter.addMessage(this, message);
+ }
}
- protected void addError(String messageId, ISeamTextSourceReference location, IResource target, String messageGroup) {
- addError(messageId, new String[0], location, target, messageGroup);
+ protected void addError(String preferenceKey, String messageId, ISeamTextSourceReference location, IResource target, String messageGroup) {
+ addError(preferenceKey, messageId, new String[0], location, target, messageGroup);
}
protected void removeMessagesFromResources(Set<IResource> resources, String messageGroup) {
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/messages.properties
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/messages.properties 2007-07-19 17:33:15 UTC (rev 2529)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/messages.properties 2007-07-19 17:49:11 UTC (rev 2530)
@@ -38,4 +38,4 @@
#Context variables
DUPLICATE_VARIABLE_NAME=Duplicate variable name: {0}
-UNKNOWN_INJECTION_NAME=Unknown context variable name: {0}
\ No newline at end of file
+UNKNOWN_VARIABLE_NAME=Unknown context variable name: {0}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.java 2007-07-19 17:33:15 UTC (rev 2529)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.java 2007-07-19 17:49:11 UTC (rev 2530)
@@ -31,6 +31,8 @@
public static String SeamValidatorConfigurationBlock_pb_statefulComponentDoesNotContainRemove_label;
public static String SeamValidatorConfigurationBlock_pb_statefulComponentDoesNotContainDestroy_label;
public static String SeamValidatorConfigurationBlock_pb_statefulComponentHasWrongScope_label;
+ public static String SeamValidatorConfigurationBlock_pb_unknownComponentClassName_label;
+ public static String SeamValidatorConfigurationBlock_pb_unknownComponentProperty_label;
//Section Entities
public static String SeamValidatorConfigurationBlock_section_entities;
@@ -59,7 +61,7 @@
//Section Context variables
public static String SeamValidatorConfigurationBlock_section_variable;
public static String SeamValidatorConfigurationBlock_pb_duplicateVariableName_label;
- public static String SeamValidatorConfigurationBlock_pb_unknownInjectionName_label;
+ public static String SeamValidatorConfigurationBlock_pb_unknownVariableName_label;
static {
NLS.initializeMessages(BUNDLE_NAME, SeamPreferencesMessages.class);
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.properties
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.properties 2007-07-19 17:33:15 UTC (rev 2529)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.properties 2007-07-19 17:49:11 UTC (rev 2530)
@@ -11,6 +11,8 @@
SeamValidatorConfigurationBlock_pb_statefulComponentDoesNotContainRemove_label=Stateful component does not contain remove:
SeamValidatorConfigurationBlock_pb_statefulComponentDoesNotContainDestroy_label=Stateful component does not contain destroy:
SeamValidatorConfigurationBlock_pb_statefulComponentHasWrongScope_label=Stateful component has wrong scope:
+SeamValidatorConfigurationBlock_pb_unknownComponentClassName_label=Component class name cannot be resolved to a type:
+SeamValidatorConfigurationBlock_pb_unknownComponentProperty_label=Component class does not contain setter for property:
##Section Entities
SeamValidatorConfigurationBlock_section_entities=Entities
@@ -39,4 +41,4 @@
##Section Context variables
SeamValidatorConfigurationBlock_section_variable=Context variables
SeamValidatorConfigurationBlock_pb_duplicateVariableName_label=Duplicate variable name:
-SeamValidatorConfigurationBlock_pb_unknownInjectionName_label=Unknown injection name:
+SeamValidatorConfigurationBlock_pb_unknownVariableName_label=Unknown variable name:
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamValidatorConfigurationBlock.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamValidatorConfigurationBlock.java 2007-07-19 17:33:15 UTC (rev 2529)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamValidatorConfigurationBlock.java 2007-07-19 17:49:11 UTC (rev 2530)
@@ -15,9 +15,7 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.jdt.internal.ui.dialogs.StatusInfo;
import org.eclipse.jdt.internal.ui.preferences.OptionsConfigurationBlock;
-import org.eclipse.jdt.internal.ui.preferences.PreferencesMessages;
import org.eclipse.jdt.internal.ui.preferences.ScrolledPageContent;
-import org.eclipse.jdt.internal.ui.preferences.OptionsConfigurationBlock.Key;
import org.eclipse.jdt.internal.ui.util.PixelConverter;
import org.eclipse.jdt.internal.ui.wizards.IStatusChangeListener;
import org.eclipse.jface.dialogs.IDialogSettings;
@@ -54,7 +52,7 @@
*/
public class SeamValidatorConfigurationBlock extends OptionsConfigurationBlock {
private static final String SETTINGS_SECTION_NAME = "SeamValidatorConfigurationBlock";
-
+
private static SectionDescription SECTION_COMPONENT = new SectionDescription(
SeamPreferencesMessages.SeamValidatorConfigurationBlock_section_component,
new String[][]{
@@ -62,6 +60,8 @@
{SeamPreferences.STATEFUL_COMPONENT_DOES_NOT_CONTENT_REMOVE, SeamPreferencesMessages.SeamValidatorConfigurationBlock_pb_statefulComponentDoesNotContainRemove_label},
{SeamPreferences.STATEFUL_COMPONENT_DOES_NOT_CONTENT_DESTROY, SeamPreferencesMessages.SeamValidatorConfigurationBlock_pb_statefulComponentDoesNotContainDestroy_label},
{SeamPreferences.STATEFUL_COMPONENT_WRONG_SCOPE, SeamPreferencesMessages.SeamValidatorConfigurationBlock_pb_statefulComponentHasWrongScope_label},
+ {SeamPreferences.UNKNOWN_COMPONENT_CLASS_NAME, SeamPreferencesMessages.SeamValidatorConfigurationBlock_pb_unknownComponentClassName_label},
+ {SeamPreferences.UNKNOWN_COMPONENT_PROPERTY, SeamPreferencesMessages.SeamValidatorConfigurationBlock_pb_unknownComponentProperty_label}
}
);
@@ -105,10 +105,10 @@
SeamPreferencesMessages.SeamValidatorConfigurationBlock_section_variable,
new String[][]{
{SeamPreferences.DUPLICATE_VARIABLE_NAME, SeamPreferencesMessages.SeamValidatorConfigurationBlock_pb_duplicateVariableName_label},
- {SeamPreferences.UNKNOWN_INJECTION_NAME, SeamPreferencesMessages.SeamValidatorConfigurationBlock_pb_unknownInjectionName_label},
+ {SeamPreferences.UNKNOWN_VARIABLE_NAME, SeamPreferencesMessages.SeamValidatorConfigurationBlock_pb_unknownVariableName_label},
}
);
-
+
private static SectionDescription[] ALL_SECTIONS = new SectionDescription[]{
SECTION_COMPONENT,
SECTION_ENTITY,
@@ -125,7 +125,7 @@
private static final String IGNORE = SeamPreferences.IGNORE;
private PixelConverter fPixelConverter;
-
+
private static Key[] getKeys() {
ArrayList<Key> keys = new ArrayList<Key>();
for (int i = 0; i < ALL_SECTIONS.length; i++) {
@@ -146,55 +146,55 @@
protected Control createContents(Composite parent) {
fPixelConverter = new PixelConverter(parent);
setShell(parent.getShell());
-
+
Composite mainComp = new Composite(parent, SWT.NONE);
mainComp.setFont(parent.getFont());
GridLayout layout= new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
mainComp.setLayout(layout);
-
+
Composite commonComposite = createStyleTabContent(mainComp);
GridData gridData = new GridData(GridData.FILL, GridData.FILL, true, true);
gridData.heightHint = fPixelConverter.convertHeightInCharsToPixels(20);
commonComposite.setLayoutData(gridData);
-
+
validateSettings(null, null, null);
-
+
return mainComp;
}
private Composite createStyleTabContent(Composite folder) {
String[] errorWarningIgnore = new String[] {ERROR, WARNING, IGNORE};
-
+
String[] errorWarningIgnoreLabels = new String[] {
"Error",
"Warning",
"Ignore"
};
-
+
int nColumns = 3;
-
+
final ScrolledPageContent sc1 = new ScrolledPageContent(folder);
-
+
Composite composite = sc1.getBody();
GridLayout layout= new GridLayout(nColumns, false);
layout.marginHeight= 0;
layout.marginWidth= 0;
composite.setLayout(layout);
-
+
Label description= new Label(composite, SWT.LEFT | SWT.WRAP);
description.setFont(description.getFont());
description.setText(SeamPreferencesMessages.SeamValidatorConfigurationBlock_common_description);
description.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, true, false, nColumns - 1, 1));
-
+
int defaultIndent = 0;
for (int i = 0; i < ALL_SECTIONS.length; i++) {
SectionDescription section = ALL_SECTIONS[i];
String label = section.label;
ExpandableComposite excomposite = createStyleSection(composite, label, nColumns);
-
+
Composite inner = new Composite(excomposite, SWT.NONE);
inner.setFont(composite.getFont());
inner.setLayout(new GridLayout(nColumns, false));
@@ -206,10 +206,10 @@
addComboBox(inner, label, option.key, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent);
}
}
-
+
IDialogSettings section = SeamCorePlugin.getDefault().getDialogSettings().getSection(SETTINGS_SECTION_NAME);
restoreSectionExpansionStates(section);
-
+
return sc1;
}
@@ -231,20 +231,20 @@
if (!areSettingsEnabled()) {
return;
}
-
+
//updateEnableStates();
-
+
fContext.statusChanged(new StatusInfo());
}
protected static Key getSeamKey(String key) {
return getKey(SeamCorePlugin.PLUGIN_ID, key);
}
-
+
static class SectionDescription {
String label;
OptionDescription[] options;
-
+
public SectionDescription(String label, String[][] optionLabelsAndKeys) {
this.label = label;
options = new OptionDescription[optionLabelsAndKeys.length];
@@ -253,15 +253,14 @@
}
}
}
-
+
static class OptionDescription {
String label;
Key key;
-
+
public OptionDescription(String keyName, String label) {
this.label = label;
key = getSeamKey(keyName);
}
}
-
-}
+}
\ No newline at end of file
17 years, 5 months
JBoss Tools SVN: r2529 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-07-19 13:33:15 -0400 (Thu, 19 Jul 2007)
New Revision: 2529
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamPreferences.java
Log:
EXIN-327 getInstancePreference method added
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamPreferences.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamPreferences.java 2007-07-19 16:42:00 UTC (rev 2528)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamPreferences.java 2007-07-19 17:33:15 UTC (rev 2529)
@@ -14,8 +14,10 @@
import java.util.Set;
import org.eclipse.core.resources.ProjectScope;
+import org.eclipse.core.runtime.preferences.ConfigurationScope;
import org.eclipse.core.runtime.preferences.DefaultScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.InstanceScope;
/**
* Constants for names of seam preferences.
@@ -95,12 +97,23 @@
return new DefaultScope().getNode(SeamCorePlugin.PLUGIN_ID);
}
+ public static IEclipsePreferences getInstancePreferences() {
+ return new InstanceScope().getNode(SeamCorePlugin.PLUGIN_ID);
+ }
+
public static String getProjectPreference(ISeamProject project, String key) {
IEclipsePreferences p = getProjectPreferences(project);
if(p == null) return null;
- return p.get(key, null);
+ String value = p.get(key, null);
+ return value != null ? value : getInstancePreference(key);
}
+ public static String getInstancePreference(String key) {
+ IEclipsePreferences p = getInstancePreferences();
+ String value = p == null ? null : p.get(key, null);
+ return value != null ? value : getDefaultPreference(key);
+ }
+
public static String getDefaultPreference(String key) {
IEclipsePreferences p = getDefaultPreferences();
if(p == null) return null;
17 years, 5 months
JBoss Tools SVN: r2528 - in trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam: core/event and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-07-19 12:42:00 -0400 (Thu, 19 Jul 2007)
New Revision: 2528
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/event/ISeamValue.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/event/ISeamValueList.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/event/ISeamValueMap.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/event/ISeamValueMapEntry.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/event/ISeamValueString.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/AbstractSeamDeclaration.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamValueList.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamValueMap.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamValueMapEntry.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamValueString.java
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/internal/core/AbstractContextVariable.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentDeclaration.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPropertiesDeclaration.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/xml/PropertiesScanner.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLScanner.java
Log:
EXIN-217 Property values implemented as objects implementing ISeamValue.
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-07-19 15:53:48 UTC (rev 2527)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProperty.java 2007-07-19 16:42:00 UTC (rev 2528)
@@ -10,6 +10,8 @@
******************************************************************************/
package org.jboss.tools.seam.core;
+import org.jboss.tools.seam.core.event.ISeamValue;
+
/**
* A property of Seam Component defined in component.xml or seam.properties files
*/
@@ -23,11 +25,11 @@
/**
* @return value of this property
*/
- public Object getValue();
+ public ISeamValue getValue();
/**
* Sets value of this property
* @param value
*/
- public void setValue(Object value);
+ public void setValue(ISeamValue value);
}
\ No newline at end of file
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/event/ISeamValue.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/event/ISeamValue.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/event/ISeamValue.java 2007-07-19 16:42:00 UTC (rev 2528)
@@ -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.event;
+
+import org.jboss.tools.seam.core.ISeamElement;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public interface ISeamValue extends ISeamElement {
+
+}
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/event/ISeamValueList.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/event/ISeamValueList.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/event/ISeamValueList.java 2007-07-19 16:42:00 UTC (rev 2528)
@@ -0,0 +1,22 @@
+ /*******************************************************************************
+ * 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.event;
+
+import java.util.List;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public interface ISeamValueList extends ISeamValue {
+
+ public List<ISeamValueString> getValues();
+
+}
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/event/ISeamValueMap.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/event/ISeamValueMap.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/event/ISeamValueMap.java 2007-07-19 16:42:00 UTC (rev 2528)
@@ -0,0 +1,22 @@
+ /*******************************************************************************
+ * 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.event;
+
+import java.util.List;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public interface ISeamValueMap extends ISeamValue {
+
+ public List<ISeamValueMapEntry> getEntries();
+
+}
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/event/ISeamValueMapEntry.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/event/ISeamValueMapEntry.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/event/ISeamValueMapEntry.java 2007-07-19 16:42:00 UTC (rev 2528)
@@ -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.event;
+
+import org.jboss.tools.seam.core.ISeamElement;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public interface ISeamValueMapEntry extends ISeamElement {
+
+ public ISeamValueString getKey();
+
+ public ISeamValueString getValue();
+
+}
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/event/ISeamValueString.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/event/ISeamValueString.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/event/ISeamValueString.java 2007-07-19 16:42:00 UTC (rev 2528)
@@ -0,0 +1,22 @@
+ /*******************************************************************************
+ * 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.event;
+
+import org.jboss.tools.seam.core.IValueInfo;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public interface ISeamValueString extends ISeamValue {
+
+ public IValueInfo getValue();
+
+}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/AbstractContextVariable.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/AbstractContextVariable.java 2007-07-19 15:53:48 UTC (rev 2527)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/AbstractContextVariable.java 2007-07-19 16:42:00 UTC (rev 2528)
@@ -10,12 +10,9 @@
******************************************************************************/
package org.jboss.tools.seam.internal.core;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import org.jboss.tools.seam.core.ISeamContextVariable;
-import org.jboss.tools.seam.core.ISeamTextSourceReference;
import org.jboss.tools.seam.core.ISeamXmlComponentDeclaration;
import org.jboss.tools.seam.core.IValueInfo;
import org.jboss.tools.seam.core.ScopeType;
@@ -24,22 +21,11 @@
/**
* @author Viacheslav Kabanovich
*/
-public class AbstractContextVariable extends SeamObject implements ISeamContextVariable, ISeamTextSourceReference {
+public class AbstractContextVariable extends AbstractSeamDeclaration implements ISeamContextVariable {
- protected String name;
protected ScopeType scopeType;
protected String scope;
- protected Map<String,IValueInfo> attributes = new HashMap<String, IValueInfo>();
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
public ScopeType getScope() {
return scopeType;
}
@@ -60,16 +46,6 @@
}
}
- public int getLength() {
- // TODO Auto-generated method stub
- return 0;
- }
-
- public int getStartPosition() {
- // TODO Auto-generated method stub
- return 0;
- }
-
/**
* Merges loaded data into currently used declaration.
* If changes were done returns a list of changes.
@@ -93,35 +69,6 @@
return changes;
}
- boolean stringsEqual(String s1, String s2) {
- return s1 == null ? s2 == null : s1.equals(s2);
- }
-
- /**
- * @param path
- * @return source reference for some member of declaration.
- * e.g. if you need source reference for @Name you have to
- * invoke getLocationFor("name");
- */
- public ISeamTextSourceReference getLocationFor(String path) {
- final IValueInfo valueInfo = attributes.get(path);
- ISeamTextSourceReference reference = new ISeamTextSourceReference() {
- public int getLength() {
- return valueInfo != null ? valueInfo.getLength() : 0;
- }
-
- public int getStartPosition() {
- return valueInfo != null ? valueInfo.getStartPosition() : 0;
- }
- };
- return reference;
- }
-
- public void setName(IValueInfo value) {
- attributes.put(ISeamXmlComponentDeclaration.NAME, value);
- name = value == null ? null : value.getValue();
- }
-
public void setScope(IValueInfo value) {
attributes.put(ISeamXmlComponentDeclaration.SCOPE, value);
setScopeAsString(value == null ? null : value.getValue());
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/AbstractSeamDeclaration.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/AbstractSeamDeclaration.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/AbstractSeamDeclaration.java 2007-07-19 16:42:00 UTC (rev 2528)
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.internal.core;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.tools.seam.core.IOpenableElement;
+import org.jboss.tools.seam.core.ISeamTextSourceReference;
+import org.jboss.tools.seam.core.ISeamXmlComponentDeclaration;
+import org.jboss.tools.seam.core.IValueInfo;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public abstract class AbstractSeamDeclaration extends SeamObject implements ISeamTextSourceReference, IOpenableElement {
+ public static final String PATH_OF_NAME = "name";
+
+ protected String name;
+
+ protected Map<String,IValueInfo> attributes = new HashMap<String, IValueInfo>();
+
+ public AbstractSeamDeclaration() {}
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void open() {}
+
+ public int getLength() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public int getStartPosition() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /**
+ * @param path
+ * @return source reference for some member of declaration.
+ * e.g. if you need source reference for @Name you have to
+ * invoke getLocationFor("name");
+ */
+ public ISeamTextSourceReference getLocationFor(String path) {
+ final IValueInfo valueInfo = attributes.get(path);
+ ISeamTextSourceReference reference = new ISeamTextSourceReference() {
+ public int getLength() {
+ return valueInfo != null ? valueInfo.getLength() : 0;
+ }
+
+ public int getStartPosition() {
+ return valueInfo != null ? valueInfo.getStartPosition() : 0;
+ }
+ };
+ return reference;
+ }
+
+ public void setName(IValueInfo value) {
+ attributes.put(ISeamXmlComponentDeclaration.NAME, value);
+ name = value == null ? null : value.getValue();
+ }
+
+ boolean stringsEqual(String s1, String s2) {
+ return s1 == null ? s2 == null : s1.equals(s2);
+ }
+
+}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentDeclaration.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentDeclaration.java 2007-07-19 15:53:48 UTC (rev 2527)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentDeclaration.java 2007-07-19 16:42:00 UTC (rev 2528)
@@ -10,58 +10,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.resources.IResource;
-import org.jboss.tools.seam.core.IOpenableElement;
import org.jboss.tools.seam.core.ISeamComponentDeclaration;
import org.jboss.tools.seam.core.ISeamContextVariable;
-import org.jboss.tools.seam.core.ISeamTextSourceReference;
-import org.jboss.tools.seam.core.ISeamXmlComponentDeclaration;
-import org.jboss.tools.seam.core.IValueInfo;
import org.jboss.tools.seam.core.ScopeType;
import org.jboss.tools.seam.core.event.Change;
/**
* @author Viacheslav Kabanovich
*/
-public abstract class SeamComponentDeclaration extends SeamObject implements ISeamComponentDeclaration, IOpenableElement {
+public abstract class SeamComponentDeclaration extends AbstractSeamDeclaration implements ISeamComponentDeclaration {
- public static final String PATH_OF_NAME = "name";
public static final String PATH_OF_SCOPE = "scope";
-
- /**
- * Seam component name.
- */
- protected String name;
- protected Map<String,IValueInfo> attributes = new HashMap<String, IValueInfo>();
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public int getLength() {
- // TODO Auto-generated method stub
- return 0;
- }
-
public void setResource(IResource resource) {
this.resource = resource;
}
- public int getStartPosition() {
- // TODO Auto-generated method stub
- return 0;
- }
-
public ScopeType getScope() {
return ScopeType.UNSPECIFIED;
}
@@ -91,41 +59,8 @@
return changes;
}
- boolean stringsEqual(String s1, String s2) {
- return s1 == null ? s2 == null : s1.equals(s2);
- }
-
- /**
- * @param path
- * @return source reference for some member of declaration.
- * e.g. if you need source reference for @Name you have to
- * invoke getLocationFor("name");
- */
- public ISeamTextSourceReference getLocationFor(String path) {
- final IValueInfo valueInfo = attributes.get(path);
- ISeamTextSourceReference reference = new ISeamTextSourceReference() {
- public int getLength() {
- return valueInfo != null ? valueInfo.getLength() : 0;
- }
-
- public int getStartPosition() {
- return valueInfo != null ? valueInfo.getStartPosition() : 0;
- }
- };
- return reference;
- }
-
- public void setName(IValueInfo value) {
- attributes.put(ISeamXmlComponentDeclaration.NAME, value);
- name = value == null ? null : value.getValue();
- }
-
public Set<ISeamContextVariable> getDeclaredVariables() {
return null;
}
- public void open() {
-
- }
-
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPropertiesDeclaration.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPropertiesDeclaration.java 2007-07-19 15:53:48 UTC (rev 2527)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPropertiesDeclaration.java 2007-07-19 16:42:00 UTC (rev 2528)
@@ -45,12 +45,6 @@
properties.remove(property.getName());
}
- public SeamProperty addStringProperty(String name, String value) {
- SeamProperty p = new SeamProperty(name, value);
- addProperty(p);
- return p;
- }
-
/**
* Merges loaded data into currently used declaration.
* If changes were done returns a list of changes.
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-07-19 15:53:48 UTC (rev 2527)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProperty.java 2007-07-19 16:42:00 UTC (rev 2528)
@@ -10,61 +10,24 @@
******************************************************************************/
package org.jboss.tools.seam.internal.core;
-import java.util.Iterator;
import java.util.List;
-import java.util.Map;
import org.jboss.tools.seam.core.ISeamProperty;
import org.jboss.tools.seam.core.event.Change;
+import org.jboss.tools.seam.core.event.ISeamValue;
-public class SeamProperty extends SeamObject implements ISeamProperty {
- protected String name;
- protected Object value;
- protected int startPosition = -1;
- protected int length = -1;
+public class SeamProperty extends AbstractSeamDeclaration implements ISeamProperty {
+ protected ISeamValue value;
public SeamProperty() {}
- public SeamProperty(String name) {
- this.name = name;
- }
-
- public SeamProperty(String name, String value) {
- this.name = name;
- this.value = value;
- }
-
- public SeamProperty(String name, Object value) {
- this.name = name;
- this.value = value;
- }
-
- public String getName() {
- return name;
- }
-
- public int getStartPosition() {
- return startPosition;
- }
-
- public void setStartPosition(int v) {
- startPosition = v;
- }
-
- public int getLength() {
- return length;
- }
-
- public void setLength(int v) {
- length = v;
- }
-
- public Object getValue() {
+ public ISeamValue getValue() {
return value;
}
- public void setValue(Object value) {
+ public void setValue(ISeamValue value) {
this.value = value;
+ adopt((SeamObject)value);
}
public List<Change> merge(SeamObject s) {
@@ -72,16 +35,15 @@
SeamProperty d = (SeamProperty)s;
- startPosition = d.startPosition;
- length = d.length;
-
if(!stringsEqual(name, d.name)) {
changes = Change.addChange(changes, new Change(this, "name", name, d.name));
name = d.name;
}
- if(!valuesEqual(value, d.value)) {
- changes = Change.addChange(changes, new Change(this, "value", value, d.value));
- value = d.value;
+
+ List<Change> cs = ((SeamObject)value).merge((SeamObject)d.value);
+ if(cs != null && cs.size() > 0) {
+ Change c = new Change(this, "value", value, value);
+ c.addChildren(cs);
}
return changes;
@@ -91,35 +53,4 @@
return s1 == null ? s2 == null : s1.equals(s2);
}
- boolean valuesEqual(Object v1, Object v2) {
- if(v1 == null) return v2 == null;
- if(v2 == null) return v1 == null;
- if(v1 == v2) return true;
- if(v1 instanceof List && v2 instanceof List) {
- List<?> l1 = (List<?>)v1;
- List<?> l2 = (List<?>)v2;
- if(l1.size() != l2.size()) return false;
- for (int i = 0; i < l1.size(); i++) {
- if(!valuesEqual(l1.get(i), l2.get(i))) return false;
- }
- return true;
- } else if(v1 instanceof Map && v2 instanceof Map) {
- Map<?,?> m1 = (Map<?,?>)v1;
- Map<?,?> m2 = (Map<?,?>)v2;
- if(m1.size() != m2.size()) return false;
- Iterator<?> it = m1.keySet().iterator();
- while(it.hasNext()) {
- Object key = it.next();
- Object o1 = m1.get(key);
- Object o2 = m2.get(key);
- if(o2 == null) return false;
- if(!valuesEqual(o1, o2)) return false;
- }
- return true;
- }
- if(v1.equals(v2)) return true;
-
- return false;
- }
-
}
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamValueList.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamValueList.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamValueList.java 2007-07-19 16:42:00 UTC (rev 2528)
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.internal.core;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.tools.seam.core.event.Change;
+import org.jboss.tools.seam.core.event.ISeamValueList;
+import org.jboss.tools.seam.core.event.ISeamValueString;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class SeamValueList extends SeamObject implements ISeamValueList {
+ List<ISeamValueString> values = new ArrayList<ISeamValueString>();
+
+ public SeamValueList() {}
+
+ public List<ISeamValueString> getValues() {
+ return values;
+ }
+
+ public void addValue(SeamValueString value) {
+ values.add(value);
+ adopt(value);
+ }
+
+ public List<Change> merge(SeamObject s) {
+ List<Change> changes = super.merge(s);
+ SeamValueList v = (SeamValueList)s;
+
+ //improve
+ if(values.size() != v.values.size()) {
+ changes = Change.addChange(changes, new Change(this, "value", values, v.values));
+ }
+ values = v.values;
+ for (int i = 0; i < values.size(); i++) {
+ adopt((SeamObject)values.get(i));
+ }
+
+ return changes;
+ }
+
+}
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamValueMap.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamValueMap.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamValueMap.java 2007-07-19 16:42:00 UTC (rev 2528)
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.internal.core;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.tools.seam.core.event.Change;
+import org.jboss.tools.seam.core.event.ISeamValueMap;
+import org.jboss.tools.seam.core.event.ISeamValueMapEntry;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class SeamValueMap extends SeamObject implements ISeamValueMap {
+ List<ISeamValueMapEntry> entries = new ArrayList<ISeamValueMapEntry>();
+
+ public SeamValueMap() {}
+
+ public List<ISeamValueMapEntry> getEntries() {
+ return entries;
+ }
+
+ public void addEntry(SeamValueMapEntry entry) {
+ entries.add(entry);
+ adopt(entry);
+ }
+
+ public List<Change> merge(SeamObject s) {
+ List<Change> changes = super.merge(s);
+ SeamValueMap v = (SeamValueMap)s;
+
+ //improve
+ if(entries.size() != v.entries.size()) {
+ changes = Change.addChange(changes, new Change(this, "value", entries, v.entries));
+ }
+ entries = v.entries;
+ for (int i = 0; i < entries.size(); i++) {
+ adopt((SeamObject)entries.get(i));
+ }
+
+ return changes;
+ }
+
+}
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamValueMapEntry.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamValueMapEntry.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamValueMapEntry.java 2007-07-19 16:42:00 UTC (rev 2528)
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.internal.core;
+
+import java.util.List;
+
+import org.jboss.tools.seam.core.event.Change;
+import org.jboss.tools.seam.core.event.ISeamValueMapEntry;
+import org.jboss.tools.seam.core.event.ISeamValueString;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class SeamValueMapEntry extends SeamObject implements ISeamValueMapEntry {
+ SeamValueString key;
+ SeamValueString value;
+
+ public SeamValueMapEntry() {}
+
+ public ISeamValueString getKey() {
+ return key;
+ }
+
+ public ISeamValueString getValue() {
+ return value;
+ }
+
+ public void setKey(SeamValueString key) {
+ this.key = key;
+ adopt(key);
+ }
+
+ public void setValue(SeamValueString value) {
+ this.value = value;
+ adopt(value);
+ }
+
+ public List<Change> merge(SeamObject s) {
+ List<Change> changes = super.merge(s);
+
+ SeamValueMapEntry e = (SeamValueMapEntry)s;
+
+ List<Change> keyChanges = key.merge(e.key);
+ if(keyChanges != null && keyChanges.size() > 0) {
+ Change keyChange = new Change(this, "key", key, key);
+ keyChange.addChildren(keyChanges);
+ changes = Change.addChange(changes, keyChange);
+ }
+
+ List<Change> valueChanges = value.merge(e.value);
+ if(valueChanges != null && valueChanges.size() > 0) {
+ Change valueChange = new Change(this, "value", value, value);
+ valueChange.addChildren(valueChanges);
+ changes = Change.addChange(changes, valueChange);
+ }
+
+ return changes;
+ }
+
+}
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamValueString.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamValueString.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamValueString.java 2007-07-19 16:42:00 UTC (rev 2528)
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.internal.core;
+
+import java.util.List;
+
+import org.jboss.tools.seam.core.IValueInfo;
+import org.jboss.tools.seam.core.event.Change;
+import org.jboss.tools.seam.core.event.ISeamValueString;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class SeamValueString extends SeamObject implements ISeamValueString {
+ IValueInfo value;
+
+ public SeamValueString() {}
+
+ public IValueInfo getValue() {
+ return value;
+ }
+
+ public void setValue(IValueInfo value) {
+ this.value = value;
+ }
+
+ public List<Change> merge(SeamObject s) {
+ List<Change> changes = super.merge(s);
+ SeamValueString v = (SeamValueString)s;
+ String v1 = value.getValue();
+ String v2 = v.value.getValue();
+ if(v1 == null || !v1.equals(v2)) {
+ changes = Change.addChange(changes, new Change(this, "value", v1, v2));
+ value = v.value;
+ adopt((SeamObject)value);
+ }
+ return changes;
+ }
+
+}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/PropertiesScanner.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/PropertiesScanner.java 2007-07-19 15:53:48 UTC (rev 2527)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/PropertiesScanner.java 2007-07-19 16:42:00 UTC (rev 2528)
@@ -20,6 +20,8 @@
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.seam.internal.core.InnerModelHelper;
import org.jboss.tools.seam.internal.core.SeamPropertiesDeclaration;
+import org.jboss.tools.seam.internal.core.SeamProperty;
+import org.jboss.tools.seam.internal.core.SeamValueString;
import org.jboss.tools.seam.internal.core.scanner.IFileScanner;
import org.jboss.tools.seam.internal.core.scanner.LoadedDeclarations;
@@ -71,7 +73,6 @@
Map<String, SeamPropertiesDeclaration> ds1 = new HashMap<String, SeamPropertiesDeclaration>();
for (int i = 0; i < properties.length; i++) {
String name = properties[i].getAttributeValue("name");
- String value = properties[i].getAttributeValue("value");
int q = name.lastIndexOf('.');
if(q < 0) continue;
String componentName = name.substring(0, q);
@@ -84,7 +85,14 @@
d.setName(componentName);
ds1.put(componentName, d);
}
- d.addStringProperty(propertyName, value);
+ SeamProperty p = new SeamProperty();
+ p.setId(properties[i]);
+ p.setName(new XMLValueInfo(properties[i], "name"));
+ p.setName(propertyName);
+ SeamValueString v = new SeamValueString();
+ v.setValue(new XMLValueInfo(properties[i], "value"));
+ p.setValue(v);
+ d.addProperty(p);
}
ds.getComponents().addAll(ds1.values());
return ds;
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-07-19 15:53:48 UTC (rev 2527)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLScanner.java 2007-07-19 16:42:00 UTC (rev 2528)
@@ -10,11 +10,7 @@
******************************************************************************/
package org.jboss.tools.seam.internal.core.scanner.xml;
-import java.util.ArrayList;
-import java.util.HashMap;
import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
import java.util.Set;
import org.eclipse.core.resources.IFile;
@@ -29,11 +25,18 @@
import org.jboss.tools.seam.core.ISeamXmlComponentDeclaration;
import org.jboss.tools.seam.internal.core.InnerModelHelper;
import org.jboss.tools.seam.internal.core.SeamProperty;
+import org.jboss.tools.seam.internal.core.SeamValueList;
+import org.jboss.tools.seam.internal.core.SeamValueMap;
+import org.jboss.tools.seam.internal.core.SeamValueMapEntry;
+import org.jboss.tools.seam.internal.core.SeamValueString;
import org.jboss.tools.seam.internal.core.SeamXmlComponentDeclaration;
import org.jboss.tools.seam.internal.core.SeamXmlFactory;
import org.jboss.tools.seam.internal.core.scanner.IFileScanner;
import org.jboss.tools.seam.internal.core.scanner.LoadedDeclarations;
+/**
+ * @author Viacheslav Kabanovich
+ */
public class XMLScanner implements IFileScanner {
public XMLScanner() {}
@@ -80,6 +83,7 @@
}
static Set<String> COMMON_ATTRIBUTES = new HashSet<String>();
+ static Set<String> INTERNAL_ATTRIBUTES = new HashSet<String>();
static {
COMMON_ATTRIBUTES.add(ISeamXmlComponentDeclaration.NAME);
@@ -89,6 +93,10 @@
COMMON_ATTRIBUTES.add(ISeamXmlComponentDeclaration.INSTALLED);
COMMON_ATTRIBUTES.add(ISeamXmlComponentDeclaration.AUTO_CREATE);
COMMON_ATTRIBUTES.add(ISeamXmlComponentDeclaration.JNDI_NAME);
+
+ INTERNAL_ATTRIBUTES.add("NAME");
+ INTERNAL_ATTRIBUTES.add("EXTENSION");
+ INTERNAL_ATTRIBUTES.add("#comment");
}
public LoadedDeclarations parse(XModelObject o, IPath source) {
@@ -139,42 +147,72 @@
for (int ia = 0; ia < attributes.length; ia++) {
XAttribute a = attributes[ia];
String xml = a.getXMLName();
- if(xml == null) continue;
+ if(xml == null || xml.length() == 0 || "#comment".equals(xml)) continue;
if(COMMON_ATTRIBUTES.contains(xml)) continue;
- String stringValue = c.getAttributeValue(a.getName());
- component.addStringProperty(xml, stringValue);
+ if(INTERNAL_ATTRIBUTES.contains(xml)) continue;
+ if(xml.indexOf(":") >= 0) continue;
+ if(xml.startsWith("xmlns")) continue;
+
+ SeamProperty p = new SeamProperty();
+ p.setId(xml);
+ p.setName(xml);
+ SeamValueString v = new SeamValueString();
+ v.setId("value");
+ p.setValue(v);
+ v.setValue(new XMLValueInfo(c, a.getName()));
+ component.addProperty(p);
}
XModelObject[] properties = c.getChildren();
for (int j = 0; j < properties.length; j++) {
XModelEntity entity = properties[j].getModelEntity();
- String propertyName = properties[j].getAttributeValue("name");
+
+ SeamProperty p = new SeamProperty();
+ p.setId(properties[j]);
+ p.setName(new XMLValueInfo(properties[j], "name"));
+
if(entity.getAttribute("value") != null) {
//this is simple value;
- String value = properties[j].getAttributeValue("value");
- component.addStringProperty(propertyName, value);
+ SeamValueString v = new SeamValueString();
+ v.setId(properties[j]);
+ v.setValue(new XMLValueInfo(properties[j], "value"));
+ p.setValue(v);
} else {
XModelObject[] entries = properties[j].getChildren();
if(entity.getChild("SeamListEntry") != null
|| "list".equals(entity.getProperty("childrenLoader"))) {
//this is list value
- List<String> listValues = new ArrayList<String>();
+
+ SeamValueList vl = new SeamValueList();
+ vl.setId(properties[j]);
+
for (int k = 0; k < entries.length; k++) {
- listValues.add(entries[k].getAttributeValue("value"));
+ SeamValueString v = new SeamValueString();
+ v.setId(entries[k]);
+ v.setValue(new XMLValueInfo(entries[k], "value"));
+ vl.addValue(v);
}
- component.addProperty(new SeamProperty(propertyName, listValues));
+ p.setValue(vl);
} else {
//this is map value
- Map<String,String> mapValues = new HashMap<String, String>();
+ SeamValueMap vm = new SeamValueMap();
+ vm.setId(properties[j]);
for (int k = 0; k < entries.length; k++) {
- String entryKey = entries[k].getAttributeValue("key");
- String entryValue = entries[k].getAttributeValue("value");
- mapValues.put(entryKey, entryValue);
+ SeamValueMapEntry e = new SeamValueMapEntry();
+ e.setId(entries[k]);
+ SeamValueString key = new SeamValueString();
+ key.setId(entries[k]);
+ key.setValue(new XMLValueInfo(entries[k], "key"));
+ e.setKey(key);
+ SeamValueString value = new SeamValueString();
+ value.setId(entries[k]);
+ value.setValue(new XMLValueInfo(entries[k], "value"));
+ e.setValue(value);
+ vm.addEntry(e);
}
- component.addProperty(new SeamProperty(propertyName, mapValues));
}
+ component.addProperty(p);
}
- //TODO assign positioning attributes to created ISeamProperty object
}
ds.getComponents().add(component);
17 years, 5 months
JBoss Tools SVN: r2527 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2007-07-19 11:53:48 -0400 (Thu, 19 Jul 2007)
New Revision: 2527
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidationHelper.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationContext.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/messages.properties
Log:
http://jira.jboss.com/jira/browse/EXIN-327 component.xml validation
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidationHelper.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidationHelper.java 2007-07-19 15:29:32 UTC (rev 2526)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidationHelper.java 2007-07-19 15:53:48 UTC (rev 2527)
@@ -10,12 +10,17 @@
******************************************************************************/
package org.jboss.tools.seam.internal.core.validation;
+import java.util.HashSet;
import java.util.Set;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Path;
import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
@@ -28,9 +33,12 @@
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.internal.core.AbstractContextVariable;
import org.jboss.tools.seam.internal.core.SeamComponentDeclaration;
+import org.jboss.tools.seam.internal.core.SeamProject;
public class SeamCoreValidationHelper extends WorkbenchContext {
+ private SeamValidationContext validationContext;
+
/**
* @return Seam project
*/
@@ -116,6 +124,33 @@
* @return IType of component for <ComponentName>.component.xml
*/
public IType getClassTypeForComponentXml(IFile componentXmlFile) {
+ String className = getClassNameForComponentXml(componentXmlFile);
+ if(className==null) {
+ return null;
+ }
+ return findType(className);
+ }
+
+ /**
+ * @param type name
+ * @return IType
+ */
+ public IType findType(String fullyQualifiedName) {
+ IProject p = getProject().getProject();
+ try {
+ IJavaProject jp = EclipseResourceUtil.getJavaProject(p);
+ return jp.findType(fullyQualifiedName);
+ } catch (JavaModelException e) {
+ SeamCorePlugin.getDefault().logError(e);
+ return null;
+ }
+ }
+
+ /**
+ * @param componentXmlFile
+ * @return name of component class for <ComponentName>.component.xml
+ */
+ public String getClassNameForComponentXml(IFile componentXmlFile) {
String fileName = componentXmlFile.getName();
int firstDot = fileName.indexOf('.');
if(firstDot==-1) {
@@ -129,10 +164,99 @@
if(packageFragment==null) {
return null;
}
- return jp.findType(packageFragment.getElementName(), className);
+ return packageFragment.getElementName() + "." + className;
} catch (JavaModelException e) {
SeamCorePlugin.getDefault().logError(e);
return null;
}
}
+
+ /**
+ * Find setter for property
+ * @param type
+ * @param propertyName
+ * @return
+ */
+ public IMethod findSetter(IType type, String propertyName) {
+ if(propertyName == null || propertyName.length()==0) {
+ return null;
+ }
+ String firstLetter = propertyName.substring(0, 1).toUpperCase();
+ String nameWithoutFirstLetter = propertyName.substring(1);
+ String setterName = "set" + firstLetter + nameWithoutFirstLetter;
+ try {
+ return findSetterInHierarchy(type, setterName);
+ } catch (JavaModelException e) {
+ SeamCorePlugin.getDefault().logError(e);
+ }
+ return null;
+ }
+
+ private IMethod findSetterInHierarchy(IType type, String setterName) throws JavaModelException {
+ IMethod[] methods = type.getMethods();
+ for (int i = 0; i < methods.length; i++) {
+ if(methods[i].getElementName().equals(setterName) && methods[i].getParameterNames().length==1) {
+ return methods[i];
+ }
+ }
+ String superclassName = type.getSuperclassName();
+ if(superclassName!=null) {
+ String[][] packages = type.resolveType(superclassName);
+ if(packages!=null) {
+ for (int i = 0; i < packages.length; i++) {
+ String packageName = packages[i][0];
+ if(packageName!=null && packageName.length()>0) {
+ packageName = packageName + ".";
+ } else {
+ packageName = "";
+ }
+ String qName = packageName + packages[i][1];
+ IType superclass = type.getJavaProject().findType(qName);
+ if(superclass!=null) {
+ IMethod method = findSetterInHierarchy(superclass, setterName);
+ if(method!=null) {
+ return method;
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.wst.validation.internal.operations.WorkbenchContext#registerResource(org.eclipse.core.resources.IResource)
+ */
+ @Override
+ public void registerResource(IResource resource) {
+ if(resource instanceof IFile) {
+ IFile file = (IFile)resource;
+ if(!file.exists()) {
+ getValidationContext().addRemovedFile(file);
+ }
+ }
+ }
+
+ /**
+ * @return Set of changed resources
+ */
+ public Set<IFile> getChangedFiles() {
+ Set<IFile> result = new HashSet<IFile>();
+ String[] uris = getURIs();
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ for (int i = 0; i < uris.length; i++) {
+ IFile currentFile = root.getFile(new Path(uris[i]));
+ result.add(currentFile);
+ }
+ result.addAll(getValidationContext().getRemovedFiles());
+ return result;
+ }
+
+ public SeamValidationContext getValidationContext() {
+ if(validationContext==null) {
+ validationContext = ((SeamProject)getSeamProject()).getValidationContext();
+ }
+ return validationContext;
+ }
}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java 2007-07-19 15:29:32 UTC (rev 2526)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java 2007-07-19 15:53:48 UTC (rev 2527)
@@ -23,12 +23,9 @@
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.wst.validation.internal.core.ValidationException;
@@ -46,6 +43,7 @@
import org.jboss.tools.seam.core.ISeamFactory;
import org.jboss.tools.seam.core.ISeamJavaComponentDeclaration;
import org.jboss.tools.seam.core.ISeamProject;
+import org.jboss.tools.seam.core.ISeamProperty;
import org.jboss.tools.seam.core.ISeamTextSourceReference;
import org.jboss.tools.seam.core.ISeamXmlComponentDeclaration;
import org.jboss.tools.seam.core.ISeamXmlFactory;
@@ -67,7 +65,7 @@
private static final String NONUNIQUE_COMPONENT_NAME_MESSAGE_ID = "NONUNIQUE_COMPONENT_NAME_MESSAGE";
private static final String UNKNOWN_INJECTION_NAME_MESSAGE_ID = "UNKNOWN_INJECTION_NAME";
- private static final String STATEFUL_COMPONENT_DOES_NOT_CONTENT_METHOD_SUFIX_MESSAGE_ID = "STATEFUL_COMPONENT_DOES_NOT_CONTENT_";
+ private static final String STATEFUL_COMPONENT_DOES_NOT_CONTAIN_METHOD_SUFIX_MESSAGE_ID = "STATEFUL_COMPONENT_DOES_NOT_CONTAIN_";
private static final String DUPLICATE_METHOD_PREFIX_MESSAGE_ID = "DUPLICATE_";
private static final String REMOVE_METHOD_SUFIX_MESSAGE_ID = "REMOVE";
private static final String DESTROY_METHOD_SUFIX_MESSAGE_ID = "DESTROY";
@@ -82,6 +80,7 @@
private static final String DUPLICATE_VARIABLE_NAME_MESSAGE_ID = "DUPLICATE_VARIABLE_NAME";
private static final String UNKNOWN_DATA_MODEL_MESSAGE_ID = "UNKNOWN_DATA_MODEL";
private static final String UNKNOWN_COMPONENT_CLASS_NAME_MESSAGE_ID = "UNKNOWN_COMPONENT_CLASS_NAME";
+ private static final String UNKNOWN_COMPONENT_PROPERTY_MESSAGE_ID = "UNKNOWN_COMPONENT_PROPERTY";
private SeamValidationContext validationContext;
private ISeamProject project;
@@ -92,21 +91,22 @@
public IStatus validateInJob(IValidationContext helper, IReporter reporter) throws ValidationException {
super.validateInJob(helper, reporter);
- String[] uris = coreHelper.getURIs();
project = coreHelper.getSeamProject();
validationContext = ((SeamProject)project).getValidationContext();
- if (uris.length > 0) {
+ Set<IFile> changedFiles = coreHelper.getChangedFiles();
+ validationContext.getRemovedFiles().clear();
+ if(changedFiles.size()>0) {
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- IFile currentFile = null;
Set<ISeamComponent> checkedComponents = new HashSet<ISeamComponent>();
Set<String> markedDuplicateFactoryNames = new HashSet<String>();
// Collect all resources which we must validate.
Set<IPath> resources = new HashSet<IPath>(); // Resources which we have to validate.
Set<IPath> newResources = new HashSet<IPath>(); // New (unlinked) resources file
- for (int i = 0; i < uris.length && !reporter.isCancelled(); i++) {
- currentFile = root.getFile(new Path(uris[i]));
- // Don't handle one resource twice.
- if (currentFile != null && currentFile.exists()) {
+ for(IFile currentFile : changedFiles) {
+ if(reporter.isCancelled()) {
+ break;
+ }
+ if (currentFile != null) {
// Get all variable names that were linked with this resource.
Set<String> oldVariablesNamesOfChangedFile = validationContext.getVariableNamesByResource(currentFile.getFullPath());
if(oldVariablesNamesOfChangedFile!=null) {
@@ -337,9 +337,7 @@
boolean sourceJavaDeclaration = !((IType)jd.getSourceMember()).isBinary();
if(sourceJavaDeclaration) {
// Save link between component name and java source file.
- validationContext.addLinkedResource(declaration.getName(), declaration.getSourcePath());
- // Validate all elements in declaration but @Name.
- validateJavaDeclaration(firstJavaDeclaration);
+ validationContext.addLinkedResource(component.getName(), declaration.getSourcePath());
}
if(declaration!=firstJavaDeclaration) {
// Validate @Name
@@ -374,9 +372,8 @@
}
boolean source = !((IType)firstJavaDeclaration.getSourceMember()).isBinary();
if(source) {
- validateStatefulComponent(component);
- validateDuplicateComponentMethods(component);
- validateEntityComponent(component);
+ // Validate all elements in first java declaration but @Name.
+ validateJavaDeclaration(component, firstJavaDeclaration);
}
}
validateXmlComponentDeclarations(component);
@@ -391,19 +388,47 @@
return;
}
validationContext.addLinkedResource(componentName, declaration.getSourcePath());
- // validate class name
String className = declaration.getClassName();
if(className!=null) {
+ // validate class name
try {
IProject p = project.getProject();
IType type = EclipseResourceUtil.getJavaProject(p).findType(className);
if(type==null) {
// Mark wrong class name
- addError(UNKNOWN_COMPONENT_CLASS_NAME_MESSAGE_ID, new String[]{className}, coreHelper.getLocationOfAttribute(declaration, ISeamXmlComponentDeclaration.CLASS), declaration.getResource(), MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
+ ISeamTextSourceReference location = ((SeamComponentDeclaration)declaration).getLocationFor(ISeamXmlComponentDeclaration.CLASS);
+ if(location==null) {
+ location = ((SeamComponentDeclaration)declaration).getLocationFor(ISeamXmlComponentDeclaration.NAME);
+ }
+ if(location==null) {
+ location = declaration;
+ }
+ addError(UNKNOWN_COMPONENT_CLASS_NAME_MESSAGE_ID, new String[]{className}, location, declaration.getResource(), MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
}
} catch (JavaModelException e) {
SeamCorePlugin.getDefault().logError(e);
}
+ // validate properties
+ Collection<ISeamProperty> properties = declaration.getProperties();
+ for (ISeamProperty property : properties) {
+ if(coreHelper.isJar(property)) {
+ return;
+ }
+ String name = property.getName();
+ if(name==null) {
+ return;
+ }
+ ISeamJavaComponentDeclaration javaDeclaration = component.getJavaDeclaration();
+ if(javaDeclaration==null) {
+ return;
+ }
+
+ IType type = (IType)javaDeclaration.getSourceMember();
+ boolean ok = type.isBinary() || coreHelper.findSetter(type, name)!=null;
+ if(!ok) {
+ addError(UNKNOWN_COMPONENT_PROPERTY_MESSAGE_ID, new String[]{type.getElementName(), componentName, name}, property, declaration.getResource(), MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
+ }
+ }
}
}
}
@@ -459,7 +484,7 @@
ISeamTextSourceReference classNameLocation = getClassNameLocation(javaDeclaration);
Set<ISeamComponentMethod> methods = javaDeclaration.getMethodsByType(methodType);
if(methods==null || methods.size()==0) {
- addError(STATEFUL_COMPONENT_DOES_NOT_CONTENT_METHOD_SUFIX_MESSAGE_ID + postfixMessageId, new String[]{component.getName()}, classNameLocation, javaDeclaration.getResource(), MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
+ addError(STATEFUL_COMPONENT_DOES_NOT_CONTAIN_METHOD_SUFIX_MESSAGE_ID + postfixMessageId, new String[]{component.getName()}, classNameLocation, javaDeclaration.getResource(), MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
}
}
@@ -482,9 +507,12 @@
}
}
- private void validateJavaDeclaration(ISeamJavaComponentDeclaration declaration) {
+ private void validateJavaDeclaration(ISeamComponent component, ISeamJavaComponentDeclaration declaration) {
validateBijections(declaration);
- // TODO
+ validateStatefulComponent(component);
+ validateDuplicateComponentMethods(component);
+ validateEntityComponent(component);
+
}
private void validateBijections(ISeamJavaComponentDeclaration declaration) {
@@ -514,7 +542,6 @@
Set<ISeamContextVariable> variables = project.getVariablesByName(name);
if(variables==null || variables.size()<1) {
// Injection has unknown name. Mark it.
- // TODO check preferences to mark it as Error or Warning or ignore it.
IResource declarationResource = declaration.getResource();
addError(UNKNOWN_INJECTION_NAME_MESSAGE_ID, new String[]{name}, bijection, declarationResource, MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationContext.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationContext.java 2007-07-19 15:29:32 UTC (rev 2526)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationContext.java 2007-07-19 15:53:48 UTC (rev 2527)
@@ -15,6 +15,7 @@
import java.util.Map;
import java.util.Set;
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.jboss.tools.common.xml.XMLUtilities;
@@ -31,12 +32,19 @@
private Map<String, Set<IPath>> resourcesByVariableName = new HashMap<String, Set<IPath>>();
private Map<IPath, Set<String>> variableNamesByResource = new HashMap<IPath, Set<String>>();
private Set<IPath> unnamedResources = new HashSet<IPath>();
+ private Set<IFile> removedFiles = new HashSet<IFile>();
/**
* Save link between resource and variable name.
* It's needed for incremental validation because we must save all linked resources of changed java file.
*/
public void addLinkedResource(String variableName, IPath linkedResourcePath) {
+ if(linkedResourcePath==null) {
+ throw new RuntimeException("Linked resource path must not be null!");
+ }
+ if(variableName==null) {
+ throw new RuntimeException("Variable name must not be null!");
+ }
Set<IPath> linkedResources = resourcesByVariableName.get(variableName);
if(linkedResources==null) {
// create set of linked resources with variable name.
@@ -128,6 +136,7 @@
resourcesByVariableName.clear();
variableNamesByResource.clear();
unnamedResources.clear();
+ removedFiles.clear();
}
public void store(Element root) {
@@ -175,4 +184,12 @@
}
}
}
+
+ public Set<IFile> getRemovedFiles() {
+ return removedFiles;
+ }
+
+ public void addRemovedFile(IFile file) {
+ removedFiles.add(file);
+ }
}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/messages.properties
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/messages.properties 2007-07-19 15:29:32 UTC (rev 2526)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/messages.properties 2007-07-19 15:53:48 UTC (rev 2527)
@@ -10,10 +10,11 @@
******************************************************************************/
#Components
NONUNIQUE_COMPONENT_NAME_MESSAGE=Duplicate component name: {0}
-STATEFUL_COMPONENT_DOES_NOT_CONTENT_REMOVE=Stateful component "{0}" must have a method marked @Remove
-STATEFUL_COMPONENT_DOES_NOT_CONTENT_DESTROY=Stateful component "{0}" must have a method marked @Destroy
+STATEFUL_COMPONENT_DOES_NOT_CONTAIN_REMOVE=Stateful component "{0}" must have a method marked @Remove
+STATEFUL_COMPONENT_DOES_NOT_CONTAIN_DESTROY=Stateful component "{0}" must have a method marked @Destroy
STATEFUL_COMPONENT_WRONG_SCOPE=Stateful component "{0}" should not have org.jboss.seam.ScopeType.PAGE, nor org.jboss.seam.ScopeType.STATELESS
-UNKNOWN_COMPONENT_CLASS_NAME={0} cannot be resolved to a type
+UNKNOWN_COMPONENT_CLASS_NAME="{0}" cannot be resolved to a type
+UNKNOWN_COMPONENT_PROPERTY=Class "{0}" of component "{1}" does not contain setter for property "{2}"
#Entities
ENTITY_COMPONENT_WRONG_SCOPE=Entity component "{0}" should not have org.jboss.seam.ScopeType.STATELESS
17 years, 5 months
JBoss Tools SVN: r2526 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model.
by jbosstools-commits@lists.jboss.org
Author: mdryakhlenkov
Date: 2007-07-19 11:29:32 -0400 (Thu, 19 Jul 2007)
New Revision: 2526
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmShape.java
Log:
EXIN-366: Adding elements on the diagram by double-click on fields of classes which have additional information in mapping files
Adding inner class bug fixed
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2007-07-19 14:46:22 UTC (rev 2525)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2007-07-19 15:29:32 UTC (rev 2526)
@@ -225,7 +225,8 @@
if (componentClassShape == null && persistentClass instanceof RootClass) {
componentClassShape = getOrCreateComponentClass(((RootClass)persistentClass).getIdentifierProperty());
OrmShape tableShape = getOrCreateDatabaseTable(identifier.getTable());
- createConnections(componentClassShape, tableShape);
+ if (componentClassShape != null)
+ createConnections(componentClassShape, tableShape);
}
}
}
@@ -446,28 +447,30 @@
public OrmShape getOrCreateComponentClass(Property property) {
OrmShape classShape = null;
- if (property.getValue() instanceof Collection) {
- Component component = (Component)((Collection)property.getValue()).getElement();
- if (component != null) {
+ if (property != null) {
+ if (property.getValue() instanceof Collection) {
+ Component component = (Component)((Collection)property.getValue()).getElement();
+ if (component != null) {
+ classShape = createShape(property);
+ OrmShape tableShape = (OrmShape)elements.get(component.getTable().getSchema() + "." + component.getTable().getName());
+ if (tableShape == null) tableShape = getOrCreateDatabaseTable(component.getTable());
+ createConnections(classShape, tableShape);
+ if(!isConnectionExist(classShape, tableShape)){
+ new Connection(classShape, tableShape);
+ classShape.firePropertyChange(REFRESH, null, null);
+ tableShape.firePropertyChange(REFRESH, null, null);
+ }
+ Shape parentShape = ((SpecialOrmShape)classShape).getParentShape();
+ OrmShape parentClassShape = (OrmShape)elements.get(((Property)parentShape.getOrmElement()).getPersistentClass().getEntityName());
+ if(!isConnectionExist(parentShape, parentClassShape)){
+ new Connection(parentShape, parentClassShape);
+ parentShape.firePropertyChange(REFRESH, null, null);
+ parentClassShape.firePropertyChange(REFRESH, null, null);
+ }
+ }
+ } else if (property.getValue() instanceof Component) {
classShape = createShape(property);
- OrmShape tableShape = (OrmShape)elements.get(component.getTable().getSchema() + "." + component.getTable().getName());
- if (tableShape == null) tableShape = getOrCreateDatabaseTable(component.getTable());
- createConnections(classShape, tableShape);
- if(!isConnectionExist(classShape, tableShape)){
- new Connection(classShape, tableShape);
- classShape.firePropertyChange(REFRESH, null, null);
- tableShape.firePropertyChange(REFRESH, null, null);
- }
- Shape parentShape = ((SpecialOrmShape)classShape).getParentShape();
- OrmShape parentClassShape = (OrmShape)elements.get(((Property)parentShape.getOrmElement()).getPersistentClass().getEntityName());
- if(!isConnectionExist(parentShape, parentClassShape)){
- new Connection(parentShape, parentClassShape);
- parentShape.firePropertyChange(REFRESH, null, null);
- parentClassShape.firePropertyChange(REFRESH, null, null);
- }
}
- } else if (property.getValue() instanceof Component) {
- classShape = createShape(property);
}
return classShape;
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmShape.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmShape.java 2007-07-19 14:46:22 UTC (rev 2525)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmShape.java 2007-07-19 15:29:32 UTC (rev 2526)
@@ -62,13 +62,21 @@
while (iterator.hasNext()) {
Property field = (Property)iterator.next();
if (!field.isComposite()) {
+ boolean typeIsAccessible = true;
+ if (field.getValue().isSimpleValue() && ((SimpleValue)field.getValue()).isTypeSpecified()) {
+ try {
+ field.getValue().getType();
+ } catch (Exception e) {
+ typeIsAccessible = false;
+ }
+ }
/* if (field.isComposite()) {
bodyOrmShape = new ExpandeableShape(field);
} else */if (field.getValue().isSimpleValue() && !((SimpleValue)field.getValue()).isTypeSpecified()) {
bodyOrmShape = new Shape(field);
- } else if (field.getValue().getType().isEntityType()) {
+ } else if (typeIsAccessible && field.getValue().getType().isEntityType()) {
bodyOrmShape = new ExpandeableShape(field);
- } else if (field.getValue().getType().isCollectionType()) {
+ } else if (typeIsAccessible && field.getValue().getType().isCollectionType()) {
bodyOrmShape = new ComponentShape(field);
} else {
bodyOrmShape = new Shape(field);
@@ -79,11 +87,13 @@
Iterator iter = component.getPropertyIterator();
while (iter.hasNext()) {
Property property = (Property)iter.next();
-/* if (property.getValue().isSimpleValue()) {
- bodyOrmShape = new Shape(property);
- } else */if (property.getValue().getType().isEntityType()) {
+ boolean typeIsAccesible = true;
+ try {property.getValue().getType();} catch (Exception e) {typeIsAccesible = false;}
+/* if (property.isComposite()) {
bodyOrmShape = new ExpandeableShape(property);
- } else if (property.getValue().getType().isCollectionType()) {
+ } else */if (typeIsAccesible && property.getValue().getType().isEntityType()) {
+ bodyOrmShape = new ExpandeableShape(property);
+ } else if (typeIsAccesible && property.getValue().getType().isCollectionType()) {
bodyOrmShape = new ComponentShape(property);
} else {
bodyOrmShape = new Shape(property);
17 years, 5 months
JBoss Tools SVN: r2525 - in trunk/seam/plugins/org.jboss.tools.seam.ui: src/org/jboss/tools/seam/ui/views and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-07-19 10:46:22 -0400 (Thu, 19 Jul 2007)
New Revision: 2525
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/AbstractSeamContentProvider.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/ProjectContentProvider.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/SeamProjectLabelProvider.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/RootContentProvider.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/SeamLabelProvider.java
Log:
EXIN-218 Seam Components content added to Project Explorer view - it adds "Seam Components" node to seam projects.
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml 2007-07-19 14:03:56 UTC (rev 2524)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml 2007-07-19 14:46:22 UTC (rev 2525)
@@ -127,10 +127,8 @@
id="org.jboss.tools.seam.ui.views.rootContent">
<triggerPoints>
<or>
- <instanceof
- value="org.eclipse.core.resources.IWorkspaceRoot" />
- <instanceof
- value="org.jboss.tools.seam.core.ISeamElement" />
+ <instanceof value="org.eclipse.core.resources.IWorkspaceRoot" />
+ <instanceof value="org.jboss.tools.seam.core.ISeamElement" />
</or>
</triggerPoints>
<possibleChildren>
@@ -151,6 +149,46 @@
</navigatorContent>
</extension>
+ <extension point="org.eclipse.ui.navigator.viewer">
+ <viewerContentBinding viewerId="org.eclipse.ui.navigator.ProjectExplorer">
+ <includes>
+ <contentExtension pattern="org.jboss.tools.seam.ui.views.projectContent" />
+ </includes>
+ </viewerContentBinding>
+ </extension>
+
+ <extension point="org.eclipse.ui.navigator.navigatorContent">
+ <navigatorContent
+ name="Seam Components"
+ priority="highest"
+ icon="icons/sample.gif"
+ activeByDefault="true"
+ contentProvider="org.jboss.tools.seam.ui.views.ProjectContentProvider"
+ labelProvider="org.jboss.tools.seam.ui.views.SeamProjectLabelProvider"
+ id="org.jboss.tools.seam.ui.views.projectContent">
+ <triggerPoints>
+ <or>
+ <instanceof value="org.eclipse.core.resources.IProject" />
+ <instanceof value="org.eclipse.jdt.core.IJavaProject" />
+ </or>
+ </triggerPoints>
+ <possibleChildren>
+ <or>
+ <instanceof value="org.jboss.tools.seam.core.ISeamElement" />
+ </or>
+ </possibleChildren>
+ <actionProvider
+ class="org.jboss.tools.seam.ui.views.actions.SeamActionProvider"
+ id="org.jboss.tools.seam.ui.views.actions.SeamActionProvider">
+ <enablement>
+ <or>
+ <instanceof value="org.jboss.tools.seam.core.ISeamElement"/>
+ </or>
+ </enablement>
+ </actionProvider>
+ </navigatorContent>
+ </extension>
+
<extension point="org.eclipse.core.runtime.adapters">
<factory
class="org.jboss.tools.seam.ui.views.properties.SeamElementAdapterFactory"
Added: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/AbstractSeamContentProvider.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/AbstractSeamContentProvider.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/AbstractSeamContentProvider.java 2007-07-19 14:46:22 UTC (rev 2525)
@@ -0,0 +1,171 @@
+/*******************************************************************************
+ * 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.ui.views;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IResourceDeltaVisitor;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.widgets.Display;
+import org.jboss.tools.seam.core.IRole;
+import org.jboss.tools.seam.core.ISeamComponent;
+import org.jboss.tools.seam.core.ISeamComponentDeclaration;
+import org.jboss.tools.seam.core.ISeamElement;
+import org.jboss.tools.seam.core.ISeamJavaComponentDeclaration;
+import org.jboss.tools.seam.core.ISeamProject;
+import org.jboss.tools.seam.core.ISeamScope;
+import org.jboss.tools.seam.core.SeamCorePlugin;
+import org.jboss.tools.seam.core.event.ISeamProjectChangeListener;
+import org.jboss.tools.seam.core.event.SeamProjectChangeEvent;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public abstract class AbstractSeamContentProvider implements ITreeContentProvider, ISeamProjectChangeListener {
+ protected Viewer viewer;
+ IResourceChangeListener listener = new ResourceChangeListener();
+ Set<ISeamProject> processed = new HashSet<ISeamProject>();
+
+ public AbstractSeamContentProvider() {}
+
+ public Object[] getElements(Object inputElement) {
+ return getChildren(inputElement);
+ }
+
+ public boolean hasChildren(Object element) {
+ if(element instanceof ISeamComponentDeclaration) return false;
+ if(element instanceof IRole) return false;
+ return true;
+ }
+
+ public Object[] getChildren(Object parentElement) {
+ if(parentElement instanceof ISeamProject) {
+ return ((ISeamProject)parentElement).getScopes();
+ } else if(parentElement instanceof ISeamScope) {
+ ((ISeamScope)parentElement).getSeamProject().resolve();
+ return ((ISeamScope)parentElement).getComponents().toArray(new Object[0]);
+ } else if(parentElement instanceof ISeamComponent) {
+ List<Object> children = new ArrayList<Object>();
+ Set<ISeamComponentDeclaration> ds = ((ISeamComponent)parentElement).getAllDeclarations();
+ children.addAll(ds);
+ for (ISeamComponentDeclaration d : ds) {
+ if(d instanceof ISeamJavaComponentDeclaration) {
+ Set<IRole> rs = ((ISeamJavaComponentDeclaration)d).getRoles();
+ children.addAll(rs);
+ }
+ }
+ return children.toArray(new Object[0]);
+ }
+ return null;
+ }
+
+ public Object getParent(Object element) {
+ if(element instanceof IRole) {
+ ISeamElement p = ((IRole)element).getParent();
+ return p == null ? p : p.getParent();
+ } else if(element instanceof ISeamElement) {
+ return ((ISeamElement)element).getParent();
+ }
+ return null;
+ }
+
+ public void projectChanged(SeamProjectChangeEvent event) {
+ if(viewer == null || viewer.getControl() == null || viewer.getControl().isDisposed()) return;
+ Object o = event.getSource();
+ if(o instanceof ISeamElement) {
+ refresh(o);
+ } else {
+ System.out.println("event without source");
+ }
+ }
+
+ void refresh(final Object o) {
+ if(viewer == null || viewer.getControl() == null || viewer.getControl().isDisposed()) return;
+ if(!(viewer instanceof StructuredViewer)) return;
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ if(o == null) {
+ ((StructuredViewer)viewer).refresh();
+ } else {
+ ((StructuredViewer)viewer).refresh(o);
+ }
+ }
+ });
+
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ this.viewer = viewer;
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(listener);
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(listener);
+ }
+
+ public void dispose() {
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(listener);
+ viewer = null;
+ if(processed != null) {
+ for (ISeamProject p : processed) p.removeSeamProjectListener(this);
+ processed.clear();
+ }
+ }
+
+ class ResourceChangeListener implements IResourceChangeListener {
+ ResourceDeltaVisitor visitor = new ResourceDeltaVisitor();
+
+ public void resourceChanged(IResourceChangeEvent event) {
+ try {
+ if(event.getDelta()==null) refresh(null);
+ else event.getDelta().accept(visitor);
+ } catch (Exception e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+ }
+
+ }
+
+ class ResourceDeltaVisitor implements IResourceDeltaVisitor {
+
+ public boolean visit(IResourceDelta delta) throws CoreException {
+ int kind = delta.getKind();
+ IResource r = delta.getResource();
+ if(kind == IResourceDelta.ADDED || kind == IResourceDelta.REMOVED) {
+ if(r instanceof IProject) {
+ refresh(null);
+ }
+ } else if(kind == IResourceDelta.CHANGED) {
+ IResourceDelta[] cs = delta.getAffectedChildren();
+ if(cs != null) for (int i = 0; i < cs.length; i++) {
+ IResource c = cs[i].getResource();
+ if(c instanceof IFile && c.getName().endsWith(".project")) {
+ refresh(null);
+ }
+ }
+ }
+ if(r instanceof IProject) return false;
+ return true;
+ }
+
+ }
+
+}
Added: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/ProjectContentProvider.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/ProjectContentProvider.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/ProjectContentProvider.java 2007-07-19 14:46:22 UTC (rev 2525)
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * 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.ui.views;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jdt.core.IJavaProject;
+import org.jboss.tools.seam.core.ISeamProject;
+import org.jboss.tools.seam.core.SeamCorePlugin;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class ProjectContentProvider extends AbstractSeamContentProvider {
+
+ public Object[] getChildren(Object parentElement) {
+ if(parentElement instanceof IJavaProject) {
+ parentElement = ((IJavaProject)parentElement).getProject();
+ }
+ if(parentElement instanceof IProject) {
+ ISeamProject p = SeamCorePlugin.getSeamProject((IProject)parentElement, false);
+ if (p == null) return null;
+ if(!processed.contains(p)) {
+ processed.add(p);
+ p.addSeamProjectListener(this);
+ }
+ return new Object[]{p};
+ } else {
+ return super.getChildren(parentElement);
+ }
+ }
+
+ public Object getParent(Object element) {
+ if(element instanceof ISeamProject) {
+ return ((ISeamProject)element).getProject();
+ } else {
+ return super.getParent(element);
+ }
+ }
+
+}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/RootContentProvider.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/RootContentProvider.java 2007-07-19 14:03:56 UTC (rev 2524)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/RootContentProvider.java 2007-07-19 14:46:22 UTC (rev 2525)
@@ -1,44 +1,33 @@
+/*******************************************************************************
+ * 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.ui.views;
import java.util.ArrayList;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
-import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.IResourceDeltaVisitor;
import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Display;
-import org.jboss.tools.seam.core.IRole;
-import org.jboss.tools.seam.core.ISeamComponent;
-import org.jboss.tools.seam.core.ISeamComponentDeclaration;
-import org.jboss.tools.seam.core.ISeamElement;
-import org.jboss.tools.seam.core.ISeamJavaComponentDeclaration;
import org.jboss.tools.seam.core.ISeamProject;
-import org.jboss.tools.seam.core.ISeamScope;
import org.jboss.tools.seam.core.SeamCorePlugin;
-import org.jboss.tools.seam.core.event.ISeamProjectChangeListener;
-import org.jboss.tools.seam.core.event.SeamProjectChangeEvent;
-public class RootContentProvider implements ITreeContentProvider, ISeamProjectChangeListener {
- protected Viewer viewer;
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class RootContentProvider extends AbstractSeamContentProvider {
IWorkspaceRoot root;
- Set<ISeamProject> processed = new HashSet<ISeamProject>();
+ public RootContentProvider() {}
- IResourceChangeListener listener = new ResourceChangeListener();
-
public Object[] getChildren(Object parentElement) {
if(parentElement instanceof IWorkspaceRoot) {
IWorkspaceRoot root = (IWorkspaceRoot)parentElement;
@@ -56,140 +45,34 @@
}
}
return children.toArray(new ISeamProject[0]);
- } else if(parentElement instanceof ISeamProject) {
- return ((ISeamProject)parentElement).getScopes();
- } else if(parentElement instanceof ISeamScope) {
- ((ISeamScope)parentElement).getSeamProject().resolve();
- return ((ISeamScope)parentElement).getComponents().toArray(new Object[0]);
- } else if(parentElement instanceof ISeamComponent) {
- List<Object> children = new ArrayList<Object>();
- Set<ISeamComponentDeclaration> ds = ((ISeamComponent)parentElement).getAllDeclarations();
- children.addAll(ds);
- for (ISeamComponentDeclaration d : ds) {
- if(d instanceof ISeamJavaComponentDeclaration) {
- Set<IRole> rs = ((ISeamJavaComponentDeclaration)d).getRoles();
- children.addAll(rs);
- }
- }
- return children.toArray(new Object[0]);
+ } else {
+ return super.getChildren(parentElement);
}
- return null;
}
public Object getParent(Object element) {
if(element instanceof ISeamProject) {
return root;
- } else if(element instanceof IRole) {
- ISeamElement p = ((IRole)element).getParent();
- return p == null ? p : p.getParent();
- } else if(element instanceof ISeamElement) {
- return ((ISeamElement)element).getParent();
+ } else {
+ return super.getParent(element);
}
- return null;
}
- public boolean hasChildren(Object element) {
- if(element instanceof ISeamComponentDeclaration) return false;
- if(element instanceof IRole) return false;
- return true;
- }
-
- public Object[] getElements(Object inputElement) {
- return getChildren(inputElement);
- }
-
- public void dispose() {
- if(root != null) {
- ResourcesPlugin.getWorkspace().removeResourceChangeListener(listener);
- }
- root = null;
- viewer = null;
- if(processed != null) {
- for (ISeamProject p : processed) p.removeSeamProjectListener(this);
- processed.clear();
- }
- }
-
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- this.viewer = viewer;
+ super.inputChanged(viewer, oldInput, newInput);
if(newInput instanceof IWorkspaceRoot || newInput == null) {
root = (IWorkspaceRoot)newInput;
- ResourcesPlugin.getWorkspace().addResourceChangeListener(listener);
}
}
-
- public void projectChanged(SeamProjectChangeEvent event) {
- if(viewer == null || viewer.getControl() == null || viewer.getControl().isDisposed()) return;
- Object o = event.getSource();
- if(o instanceof ISeamElement) {
- refresh(o);
- } else {
- System.out.println("event without source");
- }
+
+ public void dispose() {
+ super.dispose();
+ root = null;
}
- void refresh(final Object o) {
- if(viewer == null || viewer.getControl() == null || viewer.getControl().isDisposed()) return;
- if(!(viewer instanceof StructuredViewer)) return;
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if(o == null) {
- ((StructuredViewer)viewer).refresh();
- } else {
- ((StructuredViewer)viewer).refresh(o);
- }
- }
- });
-
- }
-
boolean isGoodProject(IProject project) {
- if(project == null || !project.exists() || !project.isOpen()) return false;
-// try {
-// if(!project.hasNature("org.jboss.tools.jsf.jsfnature")) return false;
-// } catch (CoreException e) {
-// //ignore - all checks are done above
-// return false;
-// }
+ if(project == null || !project.exists() || !project.isOpen()) return false;
return true;
}
- class ResourceChangeListener implements IResourceChangeListener {
- ResourceDeltaVisitor visitor = new ResourceDeltaVisitor();
-
- public void resourceChanged(IResourceChangeEvent event) {
- try {
- if(event.getDelta()==null) refresh(null);
- else event.getDelta().accept(visitor);
- } catch (Exception e) {
- SeamCorePlugin.getPluginLog().logError(e);
- }
- }
-
- }
-
- class ResourceDeltaVisitor implements IResourceDeltaVisitor {
-
- public boolean visit(IResourceDelta delta) throws CoreException {
- int kind = delta.getKind();
- IResource r = delta.getResource();
- if(kind == IResourceDelta.ADDED || kind == IResourceDelta.REMOVED) {
- if(r instanceof IProject) {
- refresh(null);
- }
- } else if(kind == IResourceDelta.CHANGED) {
- IResourceDelta[] cs = delta.getAffectedChildren();
- if(cs != null) for (int i = 0; i < cs.length; i++) {
- IResource c = cs[i].getResource();
- if(c instanceof IFile && c.getName().endsWith(".project")) {
- refresh(null);
- }
- }
- }
- if(r instanceof IProject) return false;
- return true;
- }
-
- }
-
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/SeamLabelProvider.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/SeamLabelProvider.java 2007-07-19 14:03:56 UTC (rev 2524)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/SeamLabelProvider.java 2007-07-19 14:46:22 UTC (rev 2525)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.ui.views;
import org.eclipse.core.resources.IProjectNature;
@@ -24,6 +34,9 @@
import org.jboss.tools.seam.internal.core.SeamComponentDeclaration;
import org.jboss.tools.seam.internal.core.SeamProject;
+/**
+ * @author Viacheslav Kabanovich
+ */
public class SeamLabelProvider extends LabelProvider {
JavaElementImageProvider jip = new JavaElementImageProvider();
Added: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/SeamProjectLabelProvider.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/SeamProjectLabelProvider.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/SeamProjectLabelProvider.java 2007-07-19 14:46:22 UTC (rev 2525)
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * 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.ui.views;
+
+import org.jboss.tools.seam.core.ISeamProject;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class SeamProjectLabelProvider extends SeamLabelProvider {
+
+ public SeamProjectLabelProvider() {}
+
+ public String getText(Object element) {
+ if(element instanceof ISeamProject) {
+ return "Seam Components";
+ }
+ return super.getText(element);
+ }
+
+}
17 years, 5 months
JBoss Tools SVN: r2524 - in trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping: id and 13 other directories.
by jbosstools-commits@lists.jboss.org
Author: mdryakhlenkov
Date: 2007-07-19 10:03:56 -0400 (Thu, 19 Jul 2007)
New Revision: 2524
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/id/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/id/Car.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/id/Car.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/id/Plane.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/id/Plane.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/id/Product.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/id/Product.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/id/Radio.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/id/Radio.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idbag/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idbag/Group.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idbag/User.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idbag/UserGroup.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idclass/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idclass/Customer.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idclass/Customer.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idclass/CustomerId.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idclass/FavoriteCustomer.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/forcedtable/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/forcedtable/Basic.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/forcedtable/Entity.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/forcedtable/HiLo.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/forcedtable/Pooled.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/sequence/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/sequence/Basic.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/sequence/Entity.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/sequence/HiLo.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/sequence/Pooled.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/table/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/table/Basic.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/table/Entity.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/table/HiLo.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/table/Pooled.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idprops/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idprops/LineItem.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idprops/LineItemPK.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idprops/Mapping.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idprops/Order.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idprops/Person.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/immutable/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/immutable/Contract.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/immutable/ContractVariation.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/immutable/ContractVariation.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/insertordering/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/insertordering/Group.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/insertordering/Mapping.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/insertordering/Membership.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/insertordering/User.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/instrument/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/instrument/domain/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/instrument/domain/CustomBlobType.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/instrument/domain/Document.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/instrument/domain/Documents.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/instrument/domain/Entity.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/instrument/domain/Folder.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/instrument/domain/Owner.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/instrument/domain/Problematic.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/instrument/domain/Problematic.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/interceptor/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/interceptor/CollectionInterceptor.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/interceptor/Image.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/interceptor/Image.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/interceptor/Log.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/interceptor/PropertyInterceptor.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/interceptor/StatefulInterceptor.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/interceptor/User.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/interceptor/User.java
Log:
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/id/Car.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/id/Car.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/id/Car.hbm.xml 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+
+ This mapping demonstrates the use of
+ the EJB3 compliant table hilo generator
+
+-->
+
+<hibernate-mapping package="mapping.id">
+
+ <class name="Car">
+
+ <id name="id">
+ <generator class="org.hibernate.id.MultipleHiLoPerTableGenerator">
+ <param name="max_lo">0</param>
+ </generator>
+ </id>
+ <property name="color"/>
+ </class>
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/id/Car.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/id/Car.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/id/Car.java 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,26 @@
+//$Id: Car.java 5686 2005-02-12 07:27:32Z steveebersole $
+package mapping.id;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class Car {
+ private Long id;
+ private String color;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getColor() {
+ return color;
+ }
+
+ public void setColor(String color) {
+ this.color = color;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/id/Plane.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/id/Plane.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/id/Plane.hbm.xml 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+
+ This mapping demonstrates the use of
+ the EJB3 compliant table hilo generator
+
+-->
+
+<hibernate-mapping package="mapping.id">
+
+ <class name="Plane">
+
+ <id name="id">
+ <generator class="org.hibernate.id.MultipleHiLoPerTableGenerator">
+ <param name="max_lo">2</param>
+ </generator>
+ </id>
+ <property name="nbrOfSeats"/>
+ </class>
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/id/Plane.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/id/Plane.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/id/Plane.java 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,26 @@
+//$Id: Plane.java 5686 2005-02-12 07:27:32Z steveebersole $
+package mapping.id;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class Plane {
+ private Long id;
+ private int nbrOfSeats;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public int getNbrOfSeats() {
+ return nbrOfSeats;
+ }
+
+ public void setNbrOfSeats(int nbrOfSeats) {
+ this.nbrOfSeats = nbrOfSeats;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/id/Product.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/id/Product.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/id/Product.hbm.xml 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+
+
+-->
+
+<hibernate-mapping package="mapping.id">
+
+ <class name="Product" table="t_product">
+ <id name="name">
+ <generator class="uuid"/>
+ </id>
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/id/Product.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/id/Product.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/id/Product.java 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,17 @@
+//$Id: $
+package mapping.id;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class Product {
+ private String name;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/id/Radio.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/id/Radio.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/id/Radio.hbm.xml 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+
+ This mapping demonstrates the use of
+ the EJB3 compliant table hilo generator
+ with all the parameters
+
+-->
+
+<hibernate-mapping package="mapping.id">
+
+ <class name="Radio">
+
+ <id name="id">
+ <generator class="org.hibernate.id.MultipleHiLoPerTableGenerator">
+ <param name="table">sequences</param>
+ <param name="value_column">hi_value</param>
+ <param name="primary_key_column">name</param>
+ <param name="primary_key_length">50</param>
+ <param name="max_lo">2</param>
+ <param name="primary_key_value">Radio</param>
+ </generator>
+ </id>
+ <property name="frequency"/>
+ </class>
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/id/Radio.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/id/Radio.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/id/Radio.java 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,26 @@
+//$Id: Radio.java 5686 2005-02-12 07:27:32Z steveebersole $
+package mapping.id;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class Radio {
+ private Integer id;
+ private String frequency;
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getFrequency() {
+ return frequency;
+ }
+
+ public void setFrequency(String frequency) {
+ this.frequency = frequency;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idbag/Group.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idbag/Group.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idbag/Group.java 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,24 @@
+//$Id: Group.java 6058 2005-03-11 17:05:19Z oneovthafew $
+package mapping.idbag;
+
+/**
+ * @author Gavin King
+ */
+public class Group {
+ private String name;
+
+ Group() {}
+
+ public Group(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ void setName(String name) {
+ this.name = name;
+ }
+
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idbag/User.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idbag/User.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idbag/User.java 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,37 @@
+//$Id: User.java 6058 2005-03-11 17:05:19Z oneovthafew $
+package mapping.idbag;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Gavin King
+ */
+public class User {
+ private String name;
+ private List groups = new ArrayList();
+
+ User() {}
+
+ public User(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+
+ void setName(String name) {
+ this.name = name;
+ }
+
+ public List getGroups() {
+ return groups;
+ }
+
+ void setGroups(List groups) {
+ this.groups = groups;
+ }
+
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idbag/UserGroup.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idbag/UserGroup.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idbag/UserGroup.hbm.xml 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+
+ This mapping demonstrates how to use an idbag to represent
+ a many-to-many association where the association table has
+ a surrogate key.
+
+-->
+
+<hibernate-mapping package="mapping.idbag">
+
+ <class name="User" table="`Users`">
+ <id name="name"/>
+
+ <idbag name="groups"
+ order-by="groupName asc"
+ table="`UserGroups`">
+ <collection-id column="userGroupId"
+ type="long">
+ <generator class="increment"/>
+ </collection-id>
+ <key column="userName"/>
+ <many-to-many column="groupName"
+ class="Group"/>
+ </idbag>
+
+ </class>
+
+ <class name="Group" table="`Groups`">
+ <id name="name"/>
+ </class>
+
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idclass/Customer.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idclass/Customer.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idclass/Customer.hbm.xml 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+
+ This mapping demonstrates how to use an id class not
+ embedded in the entity. Only the property values are
+ shared between the 2. This mimic the EJB2.1 and EJB3
+ semantic.
+
+-->
+
+<hibernate-mapping package="mapping.idclass">
+
+ <class name="Customer">
+ <composite-id class="CustomerId" mapped="true">
+ <key-property name="orgName" column="org_name"/>
+ <key-property name="customerName" column="cust_name"/>
+ </composite-id>
+ <discriminator column="disc"/>
+ <property name="address"/>
+ <subclass name="FavoriteCustomer"/>
+ </class>
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idclass/Customer.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idclass/Customer.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idclass/Customer.java 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,90 @@
+//$Id: Customer.java 7858 2005-08-11 21:46:58Z epbernard $
+
+package mapping.idclass;
+
+
+
+
+
+public class Customer {
+
+
+
+ public Customer() {
+
+ super();
+
+ }
+
+
+
+ public Customer(String orgName, String custName, String add) {
+
+ this.orgName = orgName;
+
+ this.customerName = custName;
+
+ this.address = add;
+
+ }
+
+
+
+ private String orgName;
+
+ private String customerName;
+
+ private String address;
+
+
+
+ public String getAddress() {
+
+ return address;
+
+ }
+
+
+
+ public void setAddress(String address) {
+
+ this.address = address;
+
+ }
+
+
+
+ public String getCustomerName() {
+
+ return customerName;
+
+ }
+
+
+
+ public void setCustomerName(String customerName) {
+
+ this.customerName = customerName;
+
+ }
+
+
+
+ public String getOrgName() {
+
+ return orgName;
+
+ }
+
+
+
+ public void setOrgName(String orgName) {
+
+ this.orgName = orgName;
+
+ }
+
+
+
+}
+
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idclass/CustomerId.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idclass/CustomerId.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idclass/CustomerId.java 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,36 @@
+//$Id: CustomerId.java 7239 2005-06-20 09:44:54Z oneovthafew $
+package mapping.idclass;
+
+import java.io.Serializable;
+
+public class CustomerId implements Serializable {
+
+ private String orgName;
+ private String customerName;
+
+ public CustomerId() {
+ super();
+ }
+
+ public CustomerId(String orgName, String custName) {
+ this.orgName = orgName;
+ this.customerName = custName;
+ }
+
+ public String getCustomerName() {
+ return customerName;
+ }
+
+ public void setCustomerName(String customerName) {
+ this.customerName = customerName;
+ }
+
+ public String getOrgName() {
+ return orgName;
+ }
+
+ public void setOrgName(String orgName) {
+ this.orgName = orgName;
+ }
+
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idclass/FavoriteCustomer.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idclass/FavoriteCustomer.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idclass/FavoriteCustomer.java 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,14 @@
+//$Id: FavoriteCustomer.java 7858 2005-08-11 21:46:58Z epbernard $
+package mapping.idclass;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class FavoriteCustomer extends Customer {
+ public FavoriteCustomer() {
+ }
+
+ public FavoriteCustomer(String orgName, String custName, String add) {
+ super( orgName, custName, add );
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/forcedtable/Basic.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/forcedtable/Basic.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/forcedtable/Basic.hbm.xml 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+ Demonstrates use of the enhanced sequence-based identifier
+ generator, with no performance optimizations (the DB is hit
+ everytime when generating a value).
+-->
+
+<hibernate-mapping package="mapping.idgen.enhanced.forcedtable">
+
+ <class name="Entity" table="ID_SEQ_TBL_BSC_ENTITY">
+ <id name="id" column="ID" type="long">
+ <generator class="org.hibernate.id.enhanced.SequenceStyleGenerator">
+ <param name="table_name">ID_SEQ_TBL_BSC_SEQ</param>
+ <param name="value_column">hi_val</param>
+ <param name="initial_value">1</param>
+ <param name="increment_size">1</param>
+ <param name="optimizer">none</param>
+ <param name="force_tbl_use">true</param>
+ </generator>
+ </id>
+ <property name="name" type="string"/>
+ </class>
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/forcedtable/Entity.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/forcedtable/Entity.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/forcedtable/Entity.java 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,34 @@
+package mapping.idgen.enhanced.forcedtable;
+
+/**
+ * {@inheritDoc}
+ *
+ * @author Steve Ebersole
+ */
+public class Entity {
+ private Long id;
+ private String name;
+
+ public Entity() {
+ }
+
+ public Entity(String name) {
+ this.name = name;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/forcedtable/HiLo.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/forcedtable/HiLo.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/forcedtable/HiLo.hbm.xml 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+ Demonstrates use of the enhanced table-based identifier
+ generator, using a hilo algorithm as the optimization (to
+ avoid hitting the database to generate each value).
+-->
+
+<hibernate-mapping package="mapping.idgen.enhanced.forcedtable">
+
+ <class name="Entity" table="ID_SEQ_TBL_HILO_ENTITY">
+ <id name="id" column="ID" type="long">
+ <generator class="org.hibernate.id.enhanced.SequenceStyleGenerator">
+ <param name="table_name">ID_SEQ_TBL_HILO_SEQ</param>
+ <param name="initial_value">1</param>
+ <param name="increment_size">10</param>
+ <param name="optimizer">hilo</param>
+ <param name="force_tbl_use">true</param>
+ </generator>
+ </id>
+ <property name="name" type="string"/>
+ </class>
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/forcedtable/Pooled.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/forcedtable/Pooled.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/forcedtable/Pooled.hbm.xml 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+ Demonstrates use of the enhanced table-based identifier
+ generator, using a hilo algorithm as the optimization (to
+ avoid hitting the database to generate each value).
+-->
+
+<hibernate-mapping package="mapping.idgen.enhanced.forcedtable">
+
+ <class name="Entity" table="ID_SEQ_TBL_POOL_ENTITY">
+ <id name="id" column="ID" type="long">
+ <generator class="org.hibernate.id.enhanced.SequenceStyleGenerator">
+ <param name="table_name">ID_SEQ_TBL_POOL_SEQ</param>
+ <param name="initial_value">1</param>
+ <param name="increment_size">10</param>
+ <param name="optimizer">pooled</param>
+ <param name="force_tbl_use">true</param>
+ </generator>
+ </id>
+ <property name="name" type="string"/>
+ </class>
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/sequence/Basic.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/sequence/Basic.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/sequence/Basic.hbm.xml 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+ Demonstrates use of the enhanced sequence-based identifier
+ generator, with no performance optimizations (the DB is hit
+ everytime when generating a value).
+-->
+
+<hibernate-mapping package="mapping.idgen.enhanced.sequence">
+
+ <class name="Entity" table="ID_SEQ_BSC_ENTITY">
+ <id name="id" column="ID" type="long">
+ <generator class="org.hibernate.id.enhanced.SequenceStyleGenerator">
+ <param name="sequence_name">ID_SEQ_BSC_SEQ</param>
+ <param name="initial_value">1</param>
+ <param name="increment_size">1</param>
+ <param name="optimizer">none</param>
+ </generator>
+ </id>
+ <property name="name" type="string"/>
+ </class>
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/sequence/Entity.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/sequence/Entity.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/sequence/Entity.java 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,34 @@
+package mapping.idgen.enhanced.sequence;
+
+/**
+ * {@inheritDoc}
+ *
+ * @author Steve Ebersole
+ */
+public class Entity {
+ private Long id;
+ private String name;
+
+ public Entity() {
+ }
+
+ public Entity(String name) {
+ this.name = name;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/sequence/HiLo.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/sequence/HiLo.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/sequence/HiLo.hbm.xml 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+ Demonstrates use of the enhanced sequence-based identifier
+ generator, using a hilo algorithm as the optimization (to
+ avoid hitting the database to generate each value).
+-->
+
+<hibernate-mapping package="mapping.idgen.enhanced.sequence">
+
+ <class name="Entity" table="ID_SEQ_HILO_ENTITY">
+ <id name="id" column="ID" type="long">
+ <generator class="org.hibernate.id.enhanced.SequenceStyleGenerator">
+ <param name="sequence_name">ID_SEQ_HILO_SEQ</param>
+ <param name="initial_value">1</param>
+ <param name="increment_size">10</param>
+ <param name="optimizer">hilo</param>
+ </generator>
+ </id>
+ <property name="name" type="string"/>
+ </class>
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/sequence/Pooled.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/sequence/Pooled.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/sequence/Pooled.hbm.xml 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+ Demonstrates use of the enhanced sequence-based identifier
+ generator, using a pooled algorithm as the optimization (to
+ avoid hitting the database to generate each value).
+-->
+
+<hibernate-mapping package="mapping.idgen.enhanced.sequence">
+
+ <class name="Entity" table="ID_SEQ_POOL_ENTITY">
+ <id name="id" column="ID" type="long">
+ <generator class="org.hibernate.id.enhanced.SequenceStyleGenerator">
+ <param name="sequence_name">ID_SEQ_POOL_SEQ</param>
+ <param name="initial_value">1</param>
+ <param name="increment_size">10</param>
+ <param name="optimizer">pooled</param>
+ </generator>
+ </id>
+ <property name="name" type="string"/>
+ </class>
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/table/Basic.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/table/Basic.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/table/Basic.hbm.xml 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="mapping.idgen.enhanced.table">
+
+ <class name="Entity" table="ID_TBL_BSC_ENTITY">
+ <id name="id" column="ID" type="long">
+ <generator class="org.hibernate.id.enhanced.TableGenerator">
+ <param name="table_name">ID_TBL_BSC_TBL</param>
+ <param name="segment_value">test</param>
+ <param name="initial_value">1</param>
+ <param name="increment_size">1</param>
+ <param name="optimizer">none</param>
+ </generator>
+ </id>
+ <property name="name" type="string"/>
+ </class>
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/table/Entity.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/table/Entity.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/table/Entity.java 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,34 @@
+package mapping.idgen.enhanced.table;
+
+/**
+ * {@inheritDoc}
+ *
+ * @author Steve Ebersole
+ */
+public class Entity {
+ private Long id;
+ private String name;
+
+ public Entity() {
+ }
+
+ public Entity(String name) {
+ this.name = name;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/table/HiLo.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/table/HiLo.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/table/HiLo.hbm.xml 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="mapping.idgen.enhanced.table">
+
+ <class name="Entity" table="ID_TBL_HILO_ENTITY">
+ <id name="id" column="ID" type="long">
+ <generator class="org.hibernate.id.enhanced.TableGenerator">
+ <param name="table_name">ID_TBL_HILO_TBL</param>
+ <param name="segment_value">test</param>
+ <param name="initial_value">1</param>
+ <param name="increment_size">10</param>
+ <param name="optimizer">hilo</param>
+ </generator>
+ </id>
+ <property name="name" type="string"/>
+ </class>
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/table/Pooled.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/table/Pooled.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idgen/enhanced/table/Pooled.hbm.xml 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+ Demonstrates use of the enhanced sequence-based identifier
+ generator, using a pooled algorithm as the optimization (to
+ avoid hitting the database to generate each value).
+-->
+
+<hibernate-mapping package="mapping.idgen.enhanced.table">
+
+ <class name="Entity" table="ID_TBL_POOL_ENTITY">
+ <id name="id" column="ID" type="long">
+ <generator class="org.hibernate.id.enhanced.TableGenerator">
+ <param name="table_name">ID_TBL_POOL_TBL</param>
+ <param name="segment_value">test</param>
+ <param name="initial_value">1</param>
+ <param name="increment_size">10</param>
+ <param name="optimizer">pooled</param>
+ </generator>
+ </id>
+ <property name="name" type="string"/>
+ </class>
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idprops/LineItem.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idprops/LineItem.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idprops/LineItem.java 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,49 @@
+package mapping.idprops;
+
+/**
+ * {@inheritDoc}
+ *
+ * @author Steve Ebersole
+ */
+public class LineItem {
+ private LineItemPK pk;
+ private int quantity;
+ private String id;
+
+ public LineItem() {
+ }
+
+ public LineItem(LineItemPK pk, int quantity) {
+ this.pk = pk;
+ this.quantity = quantity;
+ this.pk.getOrder().getLineItems().add( this );
+ }
+
+ public LineItem(Order order, String productCode, int quantity) {
+ this( new LineItemPK( order, productCode ), quantity );
+ }
+
+ public LineItemPK getPk() {
+ return pk;
+ }
+
+ public void setPk(LineItemPK pk) {
+ this.pk = pk;
+ }
+
+ public int getQuantity() {
+ return quantity;
+ }
+
+ public void setQuantity(int quantity) {
+ this.quantity = quantity;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idprops/LineItemPK.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idprops/LineItemPK.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idprops/LineItemPK.java 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,64 @@
+package mapping.idprops;
+
+import java.io.Serializable;
+
+/**
+ * {@inheritDoc}
+ *
+ * @author Steve Ebersole
+ */
+public class LineItemPK implements Serializable {
+ private Order order;
+ private String productCode;
+
+ public LineItemPK() {
+ }
+
+ public LineItemPK(Order order, String productCode) {
+ this.order = order;
+ this.productCode = productCode;
+ }
+
+ public Order getOrder() {
+ return order;
+ }
+
+ public void setOrder(Order order) {
+ this.order = order;
+ }
+
+ public String getProductCode() {
+ return productCode;
+ }
+
+ public void setProductCode(String productCode) {
+ this.productCode = productCode;
+ }
+
+ public boolean equals(Object o) {
+ if ( this == o ) {
+ return true;
+ }
+ if ( o == null || getClass() != o.getClass() ) {
+ return false;
+ }
+
+ LineItemPK that = ( LineItemPK ) o;
+
+ if ( !order.equals( that.order ) ) {
+ return false;
+ }
+ if ( !productCode.equals( that.productCode ) ) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public int hashCode() {
+ int result;
+ result = order.hashCode();
+ result = 31 * result + productCode.hashCode();
+ return result;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idprops/Mapping.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idprops/Mapping.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idprops/Mapping.hbm.xml 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,48 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
+
+<hibernate-mapping package="mapping.idprops">
+
+ <!--
+ Person has an identitifer property named something other than 'id';
+ additionally, it has a non-identitifer property named 'id'
+ -->
+ <class name="Person" table="T_ID_PERSON">
+ <id name="pk" column="PK" type="long">
+ <generator class="assigned"/>
+ </id>
+ <property name="name" column="NAME" type="string"/>
+ <property name="id" column="ID_NON_ID" type="int" />
+ </class>
+
+ <!--
+ Order has an identitifer property named something other than 'id';
+ it has no non-identitifer property named 'id'
+ -->
+ <class name="Order" table="T_ID_ORDER">
+ <id name="number" column="PK" type="long">
+ <generator class="assigned"/>
+ </id>
+ <property name="placed" column="ORDR_DT" type="timestamp"/>
+ <many-to-one name="orderee" class="Person" column="ORDEREE"/>
+ <set name="lineItems" cascade="all-delete-orphan" lazy="true" inverse="true">
+ <key column="ORDR_ID"/>
+ <one-to-many class="LineItem"/>
+ </set>
+ </class>
+
+ <!--
+ LineItem has a composite identitifer property named something other than 'id';
+ additionally, it has a non-identitifer property named 'id'
+ -->
+ <class name="LineItem" table="T_ID_LINE_ITEM">
+ <composite-id class="LineItemPK" name="pk">
+ <key-many-to-one name="order" class="Order" column="ORDR_ID" />
+ <key-property name="productCode" column="PROD_CODE" type="string"/>
+ </composite-id>
+ <property name="quantity" column="QTY" type="int"/>
+ <property name="id" column="ID_NON_ID2" type="string"/>
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idprops/Order.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idprops/Order.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idprops/Order.java 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,60 @@
+package mapping.idprops;
+
+import java.util.Date;
+import java.util.Set;
+import java.util.HashSet;
+
+/**
+ * {@inheritDoc}
+ *
+ * @author Steve Ebersole
+ */
+public class Order {
+ private Long number;
+ private Date placed;
+ private Person orderee;
+
+ private Set lineItems = new HashSet();
+
+ public Order() {
+ }
+
+ public Order(Long number, Person orderee) {
+ this.number = number;
+ this.orderee = orderee;
+ this.placed = new Date();
+ }
+
+ public Long getNumber() {
+ return number;
+ }
+
+ public void setNumber(Long number) {
+ this.number = number;
+ }
+
+ public Date getPlaced() {
+ return placed;
+ }
+
+ public void setPlaced(Date placed) {
+ this.placed = placed;
+ }
+
+ public Person getOrderee() {
+ return orderee;
+ }
+
+ public void setOrderee(Person orderee) {
+ this.orderee = orderee;
+ }
+
+
+ public Set getLineItems() {
+ return lineItems;
+ }
+
+ public void setLineItems(Set lineItems) {
+ this.lineItems = lineItems;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idprops/Person.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idprops/Person.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/idprops/Person.java 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,45 @@
+package mapping.idprops;
+
+/**
+ * {@inheritDoc}
+ *
+ * @author Steve Ebersole
+ */
+public class Person {
+ private Long pk;
+ private String name;
+ private int id;
+
+ public Person() {
+ }
+
+ public Person(Long pk, String name, int id) {
+ this.pk = pk;
+ this.name = name;
+ this.id = id;
+ }
+
+ public Long getPk() {
+ return pk;
+ }
+
+ public void setPk(Long pk) {
+ this.pk = pk;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/immutable/Contract.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/immutable/Contract.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/immutable/Contract.java 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,57 @@
+//$Id: Contract.java 7222 2005-06-19 17:22:01Z oneovthafew $
+package mapping.immutable;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+public class Contract implements Serializable {
+
+ private long id;
+ private String customerName;
+ private String type;
+ private List variations;
+
+ public Contract() {
+ super();
+ }
+
+ public Contract(String customerName, String type) {
+ this.customerName = customerName;
+ this.type = type;
+ variations = new ArrayList();
+ }
+
+ public String getCustomerName() {
+ return customerName;
+ }
+
+ public void setCustomerName(String customerName) {
+ this.customerName = customerName;
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public List getVariations() {
+ return variations;
+ }
+
+ public void setVariations(List variations) {
+ this.variations = variations;
+ }
+
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/immutable/ContractVariation.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/immutable/ContractVariation.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/immutable/ContractVariation.hbm.xml 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+
+ Test for immutable classes/collections.
+
+-->
+
+<hibernate-mapping package="mapping.immutable">
+
+ <class name="Contract" mutable="false">
+ <id name="id">
+ <generator class="increment"/>
+ </id>
+ <property name="customerName" not-null="true"/>
+ <property name="type" not-null="true"/>
+ <bag name="variations" inverse="true" order-by="version asc"
+ mutable="false" cascade="all" fetch="join">
+ <key column="contract"/>
+ <one-to-many class="ContractVariation"/>
+ </bag>
+ </class>
+
+ <class name="ContractVariation" mutable="false">
+ <composite-id>
+ <key-many-to-one name="contract"/>
+ <key-property name="version"/>
+ </composite-id>
+ <property name="text" type="text"/>
+ </class>
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/immutable/ContractVariation.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/immutable/ContractVariation.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/immutable/ContractVariation.java 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,45 @@
+//$Id: ContractVariation.java 7222 2005-06-19 17:22:01Z oneovthafew $
+package mapping.immutable;
+
+import java.io.Serializable;
+
+public class ContractVariation implements Serializable {
+
+ private int version;
+ private Contract contract;
+ private String text;
+
+ public Contract getContract() {
+ return contract;
+ }
+
+ public void setContract(Contract contract) {
+ this.contract = contract;
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ public int getVersion() {
+ return version;
+ }
+
+ public void setVersion(int version) {
+ this.version = version;
+ }
+
+ public ContractVariation() {
+ super();
+ }
+
+ public ContractVariation(int version, Contract contract) {
+ this.contract = contract;
+ this.version = version;
+ contract.getVariations().add(this);
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/insertordering/Group.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/insertordering/Group.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/insertordering/Group.java 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,29 @@
+package mapping.insertordering;
+
+/**
+ * {@inheritDoc}
+ *
+ * @author Steve Ebersole
+ */
+public class Group {
+ private Long id;
+ private String name;
+
+ /**
+ * for persistence
+ */
+ Group() {
+ }
+
+ public Group(String name) {
+ this.name = name;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public String getName() {
+ return name;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/insertordering/Mapping.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/insertordering/Mapping.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/insertordering/Mapping.hbm.xml 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="mapping.insertordering" default-access="field">
+
+ <class name="User" table="INS_ORD_USR">
+ <id name="id">
+ <generator class="increment"/>
+ </id>
+ <property name="username" column="USR_NM" />
+ <set name="memberships" fetch="select" lazy="true" inverse="true" cascade="all">
+ <key column="USR_ID"/>
+ <one-to-many class="Membership"/>
+ </set>
+ </class>
+
+ <class name="Group" table="INS_ORD_GRP">
+ <id name="id">
+ <generator class="increment"/>
+ </id>
+ <property name="name"/>
+ </class>
+
+ <class name="Membership" table="INS_ORD_MEM">
+ <id name="id">
+ <generator class="increment" />
+ </id>
+ <many-to-one name="user" class="User" column="USR_ID" cascade="all"/>
+ <many-to-one name="group" class="Group" column="GRP_ID" cascade="all"/>
+ <property name="activationDate" type="timestamp" column="JN_DT"/>
+ </class>
+</hibernate-mapping>
+
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/insertordering/Membership.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/insertordering/Membership.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/insertordering/Membership.java 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,47 @@
+package mapping.insertordering;
+
+import java.util.Date;
+
+/**
+ * {@inheritDoc}
+ *
+ * @author Steve Ebersole
+ */
+public class Membership {
+ private Long id;
+ private User user;
+ private Group group;
+ private Date activationDate;
+
+ /**
+ * For persistence
+ */
+ Membership() {
+ }
+
+ public Membership(User user, Group group) {
+ this( user, group, new Date() );
+ }
+
+ public Membership(User user, Group group, Date activationDate) {
+ this.user = user;
+ this.group = group;
+ this.activationDate = activationDate;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public User getUser() {
+ return user;
+ }
+
+ public Group getGroup() {
+ return group;
+ }
+
+ public Date getActivationDate() {
+ return activationDate;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/insertordering/User.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/insertordering/User.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/insertordering/User.java 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,44 @@
+package mapping.insertordering;
+
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Iterator;
+
+/**
+ * {@inheritDoc}
+ *
+ * @author Steve Ebersole
+ */
+public class User {
+ private Long id;
+ private String username;
+ private Set memberships = new HashSet();
+
+ /**
+ * for persistence
+ */
+ User() {
+ }
+
+ public User(String username) {
+ this.username = username;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public Iterator getMemberships() {
+ return memberships.iterator();
+ }
+
+ public Membership addMembership(Group group) {
+ Membership membership = new Membership( this, group );
+ memberships.add( membership );
+ return membership;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/instrument/domain/CustomBlobType.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/instrument/domain/CustomBlobType.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/instrument/domain/CustomBlobType.java 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,109 @@
+package mapping.instrument.domain;
+
+import java.io.Serializable;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Types;
+import java.util.Arrays;
+
+import org.hibernate.HibernateException;
+import org.hibernate.Hibernate;
+import org.hibernate.usertype.UserType;
+
+/**
+ * A simple byte[]-based custom type.
+ */
+public class CustomBlobType implements UserType {
+ /**
+ * {@inheritDoc}
+ */
+ public Object nullSafeGet(ResultSet rs, String names[], Object owner) throws SQLException {
+ // cast just to make sure...
+ return ( byte[] ) Hibernate.BINARY.nullSafeGet( rs, names );
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void nullSafeSet(PreparedStatement ps, Object value, int index) throws SQLException, HibernateException {
+ // cast just to make sure...
+ Hibernate.BINARY.nullSafeSet( ps, ( byte[] ) value, index );
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object deepCopy(Object value) {
+ byte result[] = null;
+
+ if ( value != null ) {
+ byte bytes[] = ( byte[] ) value;
+
+ result = new byte[bytes.length];
+ System.arraycopy( bytes, 0, result, 0, bytes.length );
+ }
+
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isMutable() {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int[] sqlTypes() {
+ return new int[] { Types.VARBINARY };
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Class returnedClass() {
+ return byte[].class;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean equals(Object x, Object y) {
+ return Arrays.equals( ( byte[] ) x, ( byte[] ) y );
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object assemble(Serializable arg0, Object arg1)
+ throws HibernateException {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Serializable disassemble(Object arg0)
+ throws HibernateException {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int hashCode(Object arg0)
+ throws HibernateException {
+ return 0;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object replace(Object arg0, Object arg1, Object arg2)
+ throws HibernateException {
+ return null;
+ }
+}
\ No newline at end of file
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/instrument/domain/Document.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/instrument/domain/Document.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/instrument/domain/Document.java 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,110 @@
+//$Id: Document.java 9538 2006-03-04 00:17:57Z steve.ebersole(a)jboss.com $
+package mapping.instrument.domain;
+
+import java.util.Date;
+
+/**
+ * @author Gavin King
+ */
+public class Document {
+ private Long id;
+ private String name;
+ private String upperCaseName;
+ private String summary;
+ private String text;
+ private Owner owner;
+ private Folder folder;
+ private Date lastTextModification = new Date();
+ /**
+ * @return Returns the folder.
+ */
+ public Folder getFolder() {
+ return folder;
+ }
+ /**
+ * @param folder The folder to set.
+ */
+ public void setFolder(Folder folder) {
+ this.folder = folder;
+ }
+ /**
+ * @return Returns the owner.
+ */
+ public Owner getOwner() {
+ return owner;
+ }
+ /**
+ * @param owner The owner to set.
+ */
+ public void setOwner(Owner owner) {
+ this.owner = owner;
+ }
+ /**
+ * @return Returns the id.
+ */
+ public Long getId() {
+ return id;
+ }
+ /**
+ * @param id The id to set.
+ */
+ public void setId(Long id) {
+ this.id = id;
+ }
+ /**
+ * @return Returns the name.
+ */
+ public String getName() {
+ return name;
+ }
+ /**
+ * @param name The name to set.
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+ /**
+ * @return Returns the summary.
+ */
+ public String getSummary() {
+ return summary;
+ }
+ /**
+ * @param summary The summary to set.
+ */
+ public void setSummary(String summary) {
+ this.summary = summary;
+ }
+ /**
+ * @return Returns the text.
+ */
+ public String getText() {
+ return text;
+ }
+ /**
+ * @param text The text to set.
+ */
+ private void setText(String text) {
+ this.text = text;
+ }
+ /**
+ * @return Returns the upperCaseName.
+ */
+ public String getUpperCaseName() {
+ return upperCaseName;
+ }
+ /**
+ * @param upperCaseName The upperCaseName to set.
+ */
+ public void setUpperCaseName(String upperCaseName) {
+ this.upperCaseName = upperCaseName;
+ }
+
+ public void updateText(String newText) {
+ if ( !newText.equals(text) ) {
+ this.text = newText;
+ lastTextModification = new Date();
+ }
+ }
+
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/instrument/domain/Documents.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/instrument/domain/Documents.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/instrument/domain/Documents.hbm.xml 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,67 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+
+ This mapping demonstrates
+
+ (1) use of lazy properties - this feature requires buildtime
+ bytecode instrumentation; we don't think this is a very
+ necessary feature, but provide it for completeleness; if
+ Hibernate encounters uninstrumented classes, lazy property
+ fetching will be silently disabled, to enable testing
+
+ (2) use of a formula to define a "derived property"
+
+-->
+
+<hibernate-mapping package="mapping.instrument.domain" default-access="field">
+
+ <class name="Folder" table="folders">
+ <id name="id">
+ <generator class="increment"/>
+ </id>
+ <property name="name" not-null="true" length="50"/>
+ <many-to-one name="parent"/>
+ <bag name="subfolders" inverse="true" cascade="save-update">
+ <key column="parent"/>
+ <one-to-many class="Folder"/>
+ </bag>
+ <bag name="documents" inverse="true" cascade="all-delete-orphan">
+ <key column="folder"/>
+ <one-to-many class="Document"/>
+ </bag>
+ </class>
+
+ <class name="Owner" table="owners" lazy="false">
+ <id name="id">
+ <generator class="increment"/>
+ </id>
+ <property name="name" not-null="true" length="50"/>
+ </class>
+
+ <class name="Document" table="documents">
+ <id name="id">
+ <generator class="increment"/>
+ </id>
+ <property name="name" not-null="true" length="50"/>
+ <property name="upperCaseName" formula="upper(name)" lazy="true"/>
+ <property name="summary" not-null="true" length="200" lazy="true"/>
+ <many-to-one name="folder" not-null="true" lazy="no-proxy"/>
+ <many-to-one name="owner" not-null="true" lazy="no-proxy" fetch="select"/>
+ <property name="text" not-null="true" length="2000" lazy="true"/>
+ <property name="lastTextModification" not-null="true" lazy="true" access="field"/>
+ </class>
+
+ <class name="Entity" table="entity">
+ <id name="id" column="ID" type="long">
+ <generator class="increment"/>
+ </id>
+ <property name="name" column="NAME" type="string" lazy="true"/>
+ <many-to-one name="child" column="PRNT_ID" class="Entity" lazy="proxy" cascade="all" />
+ <many-to-one name="sibling" column="RIGHT_ID" class="Entity" lazy="no-proxy" cascade="all" />
+ </class>
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/instrument/domain/Entity.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/instrument/domain/Entity.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/instrument/domain/Entity.java 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,52 @@
+package mapping.instrument.domain;
+
+/**
+ * todo: describe Entity
+ *
+ * @author Steve Ebersole
+ */
+public class Entity {
+ private Long id;
+ private String name;
+ private Entity child;
+ private Entity sibling;
+
+ public Entity() {
+ }
+
+ public Entity(String name) {
+ this.name = name;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Entity getChild() {
+ return child;
+ }
+
+ public void setChild(Entity child) {
+ this.child = child;
+ }
+
+ public Entity getSibling() {
+ return sibling;
+ }
+
+ public void setSibling(Entity sibling) {
+ this.sibling = sibling;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/instrument/domain/Folder.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/instrument/domain/Folder.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/instrument/domain/Folder.java 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,80 @@
+//$Id: Folder.java 9538 2006-03-04 00:17:57Z steve.ebersole(a)jboss.com $
+package mapping.instrument.domain;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+/**
+ * @author Gavin King
+ */
+public class Folder {
+ private Long id;
+ private String name;
+ private Folder parent;
+ private Collection subfolders = new ArrayList();
+ private Collection documents = new ArrayList();
+
+ public boolean nameWasread;
+
+ /**
+ * @return Returns the id.
+ */
+ public Long getId() {
+ return id;
+ }
+ /**
+ * @param id The id to set.
+ */
+ public void setId(Long id) {
+ this.id = id;
+ }
+ /**
+ * @return Returns the name.
+ */
+ public String getName() {
+ nameWasread = true;
+ return name;
+ }
+ /**
+ * @param name The name to set.
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+ /**
+ * @return Returns the documents.
+ */
+ public Collection getDocuments() {
+ return documents;
+ }
+ /**
+ * @param documents The documents to set.
+ */
+ public void setDocuments(Collection documents) {
+ this.documents = documents;
+ }
+ /**
+ * @return Returns the parent.
+ */
+ public Folder getParent() {
+ return parent;
+ }
+ /**
+ * @param parent The parent to set.
+ */
+ public void setParent(Folder parent) {
+ this.parent = parent;
+ }
+ /**
+ * @return Returns the subfolders.
+ */
+ public Collection getSubfolders() {
+ return subfolders;
+ }
+ /**
+ * @param subfolders The subfolders to set.
+ */
+ public void setSubfolders(Collection subfolders) {
+ this.subfolders = subfolders;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/instrument/domain/Owner.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/instrument/domain/Owner.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/instrument/domain/Owner.java 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,34 @@
+//$Id: Owner.java 9538 2006-03-04 00:17:57Z steve.ebersole(a)jboss.com $
+package mapping.instrument.domain;
+
+/**
+ * @author Gavin King
+ */
+public class Owner {
+ private Long id;
+ private String name;
+ /**
+ * @return Returns the id.
+ */
+ public Long getId() {
+ return id;
+ }
+ /**
+ * @param id The id to set.
+ */
+ public void setId(Long id) {
+ this.id = id;
+ }
+ /**
+ * @return Returns the name.
+ */
+ public String getName() {
+ return name;
+ }
+ /**
+ * @param name The name to set.
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/instrument/domain/Problematic.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/instrument/domain/Problematic.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/instrument/domain/Problematic.hbm.xml 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="mapping.instrument.domain">
+ <class name="Problematic">
+ <id name="id" type="long" column="ID">
+ <generator class="increment" />
+ </id>
+ <property name="name" type="string" column="NAME" />
+ <property name="bytes" type="org.hibernate.test.instrument.domain.CustomBlobType" column="DATA" lazy="true" />
+ </class>
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/instrument/domain/Problematic.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/instrument/domain/Problematic.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/instrument/domain/Problematic.java 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,69 @@
+package mapping.instrument.domain;
+
+/**
+ * {@inheritDoc}
+ *
+ * @author Steve Ebersole
+ */
+public class Problematic {
+ private Long id;
+ private String name;
+ private byte[] bytes;
+
+ private Representation representation;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public byte[] getBytes() {
+ return bytes;
+ }
+
+ public void setBytes(byte[] bytes) {
+ this.bytes = bytes;
+ }
+
+ public Representation getRepresentation() {
+ if ( representation == null ) {
+ representation = ( ( bytes == null ) ? null : new Representation( bytes ) );
+ }
+ return representation;
+ }
+
+ public void setRepresentation(Representation rep) {
+ bytes = rep.getBytes();
+ }
+
+ public static class Representation {
+ private byte[] bytes;
+
+ public Representation(byte[] bytes) {
+ this.bytes = bytes;
+ }
+
+ public byte[] getBytes() {
+ return bytes;
+ }
+
+ public String toString() {
+ String result = "";
+ for ( int i = 0; i < bytes.length; i++ ) {
+ result += bytes[i];
+ }
+ return result;
+ }
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/interceptor/CollectionInterceptor.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/interceptor/CollectionInterceptor.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/interceptor/CollectionInterceptor.java 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,21 @@
+//$Id: CollectionInterceptor.java 7700 2005-07-30 05:02:47Z oneovthafew $
+package mapping.interceptor;
+
+import java.io.Serializable;
+
+import org.hibernate.EmptyInterceptor;
+import org.hibernate.type.Type;
+
+public class CollectionInterceptor extends EmptyInterceptor {
+
+ public boolean onFlushDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types) {
+ ( (User) entity ).getActions().add("updated");
+ return false;
+ }
+
+ public boolean onSave(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) {
+ ( (User) entity ).getActions().add("created");
+ return false;
+ }
+
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/interceptor/Image.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/interceptor/Image.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/interceptor/Image.hbm.xml 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
+
+<hibernate-mapping package="mapping.interceptor">
+
+ <class name="Image" table="image" abstract="false" select-before-update="true" >
+ <id name="id" type="java.lang.Long" column="id">
+ <generator class="native"/>
+ </id>
+ <component name="details" class="Image$Details">
+ <property name="perm1" not-null="true" type="long" column="permissions"/>
+ <property name="comment" type="string" column="comment_txt"/>
+ </component>
+ <property name="name" type="java.lang.String" column="name" not-null="true"/>
+ </class>
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/interceptor/Image.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/interceptor/Image.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/interceptor/Image.java 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,63 @@
+package mapping.interceptor;
+
+public class Image {
+
+ private Long id;
+ private String name;
+ private Details details;
+
+ public Details getDetails() {
+ return details;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setDetails(Details details) {
+ this.details = details;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String toString() {
+ return "Image/" + ( details == null ? "no details" : details.toString() );
+ }
+
+ public static class Details {
+ private long perm1 = -1; // all bits turned on.
+ private String comment;
+
+ protected long getPerm1() {
+ return this.perm1;
+ }
+
+ protected void setPerm1(long value) {
+ this.perm1 = value;
+ }
+
+ public String getComment() {
+ return comment;
+ }
+
+ public void setComment(String comment) {
+ this.comment = comment;
+ }
+
+ public String toString() {
+ return "Details=" + perm1;
+ }
+ }
+
+}
+
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/interceptor/Log.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/interceptor/Log.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/interceptor/Log.java 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,53 @@
+//$Id: Log.java 7700 2005-07-30 05:02:47Z oneovthafew $
+package mapping.interceptor;
+
+import java.util.Calendar;
+
+public class Log {
+ private Long id;
+ private String entityName;
+ private String entityId;
+ private String action;
+ private Calendar time;
+
+ public Log(String action, String id, String name) {
+ super();
+ this.action = action;
+ entityId = id;
+ entityName = name;
+ time = Calendar.getInstance();
+ }
+ public Log() {
+ super();
+ }
+ public String getAction() {
+ return action;
+ }
+ public void setAction(String action) {
+ this.action = action;
+ }
+ public String getEntityId() {
+ return entityId;
+ }
+ public void setEntityId(String entityId) {
+ this.entityId = entityId;
+ }
+ public String getEntityName() {
+ return entityName;
+ }
+ public void setEntityName(String entityName) {
+ this.entityName = entityName;
+ }
+ public Long getId() {
+ return id;
+ }
+ public void setId(Long id) {
+ this.id = id;
+ }
+ public Calendar getTime() {
+ return time;
+ }
+ public void setTime(Calendar time) {
+ this.time = time;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/interceptor/PropertyInterceptor.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/interceptor/PropertyInterceptor.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/interceptor/PropertyInterceptor.java 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,22 @@
+//$Id: PropertyInterceptor.java 7700 2005-07-30 05:02:47Z oneovthafew $
+package mapping.interceptor;
+
+import java.io.Serializable;
+import java.util.Calendar;
+
+import org.hibernate.EmptyInterceptor;
+import org.hibernate.type.Type;
+
+public class PropertyInterceptor extends EmptyInterceptor {
+
+ public boolean onFlushDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types) {
+ currentState[1] = Calendar.getInstance();
+ return true;
+ }
+
+ public boolean onSave(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) {
+ state[2] = Calendar.getInstance();
+ return true;
+ }
+
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/interceptor/StatefulInterceptor.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/interceptor/StatefulInterceptor.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/interceptor/StatefulInterceptor.java 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,47 @@
+//$Id: StatefulInterceptor.java 7701 2005-07-30 05:07:01Z oneovthafew $
+package mapping.interceptor;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.hibernate.EmptyInterceptor;
+import org.hibernate.Session;
+import org.hibernate.type.Type;
+
+public class StatefulInterceptor extends EmptyInterceptor {
+
+ private Session session;
+
+ private List list = new ArrayList();
+
+ public boolean onSave(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) {
+ if ( !(entity instanceof Log) ) {
+ list.add( new Log( "insert", (String) id, entity.getClass().getName() ) );
+ }
+ return false;
+ }
+
+ public boolean onFlushDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types) {
+ if ( !(entity instanceof Log) ) {
+ list.add( new Log( "update", (String) id, entity.getClass().getName() ) );
+ }
+ return false;
+ }
+
+ public void postFlush(Iterator entities) {
+ if ( list.size()>0 ) {
+ for ( Iterator iter = list.iterator(); iter.hasNext(); ) {
+ session.persist( iter.next() );
+ }
+ list.clear();
+ session.flush();
+ }
+ }
+
+ public void setSession(Session s) {
+ session = s;
+ }
+
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/interceptor/User.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/interceptor/User.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/interceptor/User.hbm.xml 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+
+
+-->
+
+<hibernate-mapping
+ package="mapping.interceptor">
+
+ <class name="User" table="users">
+ <id name="name"/>
+ <property name="password"/>
+ <property name="lastUpdated"/>
+ <property name="created"/>
+ <set name="actions" lazy="false" fetch="join">
+ <key column="user_name"/>
+ <element column="action" type="string"/>
+ </set>
+ </class>
+
+ <class name="Log" table="log_entries">
+ <id name="id">
+ <generator class="increment"/>
+ </id>
+ <property name="entityName" column="entity_name"/>
+ <property name="entityId" column="entity_id"/>
+ <property name="action"/>
+ <property name="time" column="action_time"/>
+ </class>
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/interceptor/User.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/interceptor/User.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/interceptor/User.java 2007-07-19 14:03:56 UTC (rev 2524)
@@ -0,0 +1,53 @@
+//$Id: User.java 7700 2005-07-30 05:02:47Z oneovthafew $
+package mapping.interceptor;
+
+import java.util.Calendar;
+import java.util.HashSet;
+import java.util.Set;
+
+public class User {
+ private String name;
+ private String password;
+ private Set actions = new HashSet();
+ private Calendar lastUpdated;
+ private Calendar created;
+
+ public User(String name, String password) {
+ super();
+ this.name = name;
+ this.password = password;
+ }
+ public User() {
+ super();
+ }
+ public Calendar getLastUpdated() {
+ return lastUpdated;
+ }
+ public void setLastUpdated(Calendar lastUpdated) {
+ this.lastUpdated = lastUpdated;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public String getPassword() {
+ return password;
+ }
+ public void setPassword(String password) {
+ this.password = password;
+ }
+ public Set getActions() {
+ return actions;
+ }
+ public void setActions(Set actions) {
+ this.actions = actions;
+ }
+ public Calendar getCreated() {
+ return created;
+ }
+ public void setCreated(Calendar created) {
+ this.created = created;
+ }
+}
17 years, 5 months
JBoss Tools SVN: r2523 - trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-07-19 10:00:23 -0400 (Thu, 19 Jul 2007)
New Revision: 2523
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FolderImpl.java
Log:
JBIDE-545
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FolderImpl.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FolderImpl.java 2007-07-19 11:36:51 UTC (rev 2522)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FolderImpl.java 2007-07-19 14:00:23 UTC (rev 2523)
@@ -12,6 +12,7 @@
import java.io.File;
import java.util.*;
+
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
@@ -32,6 +33,7 @@
import org.jboss.tools.common.model.impl.XModelImpl;
import org.jboss.tools.common.model.loaders.Reloadable;
import org.jboss.tools.common.model.loaders.XObjectLoader;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.common.model.util.Paths;
import org.jboss.tools.common.model.util.XModelObjectLoaderUtil;
import org.jboss.tools.common.util.FileUtil;
@@ -41,6 +43,8 @@
protected boolean loaded = false;
protected IContainer resource = null;
protected String pathForResource = null;
+ protected Map<String, File> linked = new HashMap<String, File>();
+ protected Map<String, IResource> linkedResources = new HashMap<String, IResource>();
public FolderImpl() {}
@@ -59,9 +63,8 @@
public boolean isChildEditable(XModelObject o) {
if(!isObjectEditable()) return false;
- File f = getFile();
+ File f = getChildIOFile(o);
if(f == null) return true;
- f = new File(f, o.getPathPart());
return (!f.isFile() || f.canWrite());
}
@@ -73,7 +76,7 @@
public BodySource getBodySource(String filename) {
File f = getFile();
- return (f == null) ? null : getBodySource(new File(f, filename));
+ return (f == null) ? null : getBodySource(getChildIOFile(filename));
}
BodySource getBodySource(File f) {
@@ -87,7 +90,11 @@
}
protected String getAbsolutePath() {
- String p = (getParent() == null) ? null : ((FolderImpl)getParent()).getAbsolutePath();
+ FolderImpl parent = (FolderImpl)getParent();
+ String p = (parent == null) ? null : parent.getAbsolutePath();
+ if(parent.linked.containsKey(getPathPart())) {
+ return parent.linked.get(getPathPart()).getAbsolutePath();
+ }
return (p == null) ? null : p + "/" + name();
}
@@ -125,20 +132,34 @@
}
private void loadChildren(File[] fs, IResource[] rs) {
FileSystemPeer peer = getFileSystem().getPeer();
- Properties p = new Properties();
for (int i = 0; i < fs.length; i++) {
- if(fs[i].isDirectory()) {
- p.clear();
- p.setProperty("name", fs[i].getName());
- XModelObject c = getModel().createModelObject("FileFolder", p);
- addChild(c);
- } else {
- createFileObject(fs[i]);
- }
- peer.register(fs[i]);
+ _loadChild(peer, fs[i]);
}
+ for (int i = 0; i < rs.length; i++) {
+ if(!rs[i].isAccessible()) continue;
+ if(!rs[i].isLinked()) continue;
+ File f = rs[i].getLocation().toFile();
+ linked.put(f.getName().toLowerCase(), f);
+ linkedResources.put(f.getName().toLowerCase(), rs[i]);
+ _loadChild(peer, f);
+ }
fire = true;
}
+
+ private void _loadChild(FileSystemPeer peer, File f) {
+ if(f.isDirectory()) {
+ Properties p = new Properties();
+ p.setProperty("name", f.getName());
+ XModelObject c = getModel().createModelObject("FileFolder", p);
+ if(linked.containsKey(f.getName().toLowerCase())) {
+ c.setObject("file", linked.get(f.getName().toLowerCase()));
+ }
+ addChild(c);
+ } else {
+ createFileObject(f);
+ }
+ peer.register(f);
+ }
private Properties getEntityProperties(File f) {
Properties p = new Properties();
@@ -185,6 +206,9 @@
c.set("_file", f.getAbsolutePath());
}
}
+ if(linked.containsValue(f)) {
+ c.setObject("file", f);
+ }
addChild(c);
}
@@ -194,6 +218,8 @@
if(!loaded) return true;
if(updateLock > 0) return true;
updateLock++;
+ Map<String,File> mf = new HashMap<String,File>();
+ linked.clear();
try {
FileSystemsImpl fsi = (FileSystemsImpl)getFileSystem().getParent();
if(resource != null && resource.exists() && !resource.isSynchronized(IResource.DEPTH_ONE)) try {
@@ -212,8 +238,22 @@
} finally {
fsi.unlockUpdate();
}
+ if(resource != null && resource.exists()) try {
+ IResource[] rs = resource.members();
+ for (int i = 0; i < rs.length; i++) {
+ if(rs[i].isLinked()) {
+ File f = rs[i].getLocation().toFile();
+ String p = f.getName().toLowerCase();
+ mf.put(p, f);
+ linked.put(p, f);
+ linkedResources.put(p, rs[i]);
+ }
+ }
+ } catch (Exception e) {
+ ModelPlugin.getPluginLog().logError("Exception caught in FolderImpl.update()");
+ }
+
File[] fs = getFiles();
- Map<String,File> mf = new HashMap<String,File>();
for (int i = 0; i < fs.length; i++) mf.put(fs[i].getName().toLowerCase(), fs[i]);
Map<String,XModelObject> mc = children.getObjectsMap();
@@ -226,8 +266,7 @@
String nm = (String)io.next();
if(mf.containsKey(nm)) continue;
XModelObject o = (XModelObject)mc.get(nm);
- String s = FileAnyImpl.toFileName(o);
- File of = new File(getFile(), s);
+ File of = getChildIOFile(o);
if(o.getFileType() == XModelObject.FOLDER) {
if(!getFileSystem().getPeer().containsDir(of)) continue;
} else {
@@ -265,7 +304,30 @@
}
return true;
}
+
+ protected File getChildIOFile(XModelObject o) {
+ String s = FileAnyImpl.toFileName(o);
+ File f = (File)o.getObject("file"); //for links
+ if(f == null && linked.containsKey(o.getPathPart())) {
+ f = linked.get(o.getPathPart());
+ }
+ if(f == null) {
+ f = new File(getFile(), s);
+ }
+ return f;
+ }
+ protected File getChildIOFile(String filename) {
+ File f = null;
+ if(linked.containsKey(filename.toLowerCase())) {
+ f = linked.get(filename.toLowerCase());
+ }
+ if(f == null) {
+ f = new File(getFile(), filename);
+ }
+ return f;
+ }
+
private void updateAuxiliary(Map mc, Map mf) {
Iterator it = mf.keySet().iterator();
while(it.hasNext()) {
@@ -461,6 +523,9 @@
Properties p = new Properties();
p.setProperty("name", f.getName());
c = getModel().createModelObject("FileFolder", p);
+ if(linked.containsKey(f.getName().toLowerCase())) {
+ c.setObject("file", linked.get(f.getName().toLowerCase()));
+ }
} else {
Properties ep = getEntityProperties(f);
XModelObject old = findOldObject(ep.getProperty("entity"), toRemove);
@@ -499,16 +564,14 @@
protected void updateRemove(XModelObject o) {
boolean d = (o instanceof FolderImpl);
FileSystemPeer peer = getFileSystem().getPeer();
- File f = getFile();
- String p = o.getPathPart();
- File rf = new File(f, p);
+ File rf = getChildIOFile(o);
boolean c = (d && peer.containsDir(rf)) || ((!d) && peer.contains(rf));
if(!c) return;
int i = (!o.isModified()) ? 1 : question(o);
if(i != 0) {
o.removeFromParent();
} else {
- saveChild(o, peer, f);
+ saveChild(o, peer, rf);
XActionInvoker.invoke("Open", o, null);
}
if(d) peer.unregisterDir(rf); else peer.unregister(rf);
@@ -517,9 +580,7 @@
public void removeChildFile(XModelObject o) {
boolean d = (o instanceof FolderImpl);
FileSystemPeer peer = getFileSystem().getPeer();
- File f = getFile();
- String p = o.getPathPart();
- File rf = new File(f, p);
+ File rf = getChildIOFile(o);
boolean c = (d && peer.containsDir(rf)) || ((!d) && peer.contains(rf));
if(!c) return;
if(o.getModel().getModelBuffer().source() == o && rf.exists() && o.getModelEntity().getAttribute("_file") != null) {
@@ -572,6 +633,10 @@
public boolean hasChildren() {
boolean q = super.hasChildren();
if (q || loaded) return q;
+ if(getParent() instanceof FolderImpl) {
+ FolderImpl p = (FolderImpl)getParent();
+ if(p.linked.containsKey(getPathPart())) return true;
+ }
File[] fs = getFiles();
q = (fs != null && fs.length > 0);
if(!q) loaded = fire = true;
@@ -607,14 +672,18 @@
if(cs[i] instanceof FolderLoader) {
b &= ((FolderLoader)cs[i]).save();
} else {
- b &= saveChild(cs[i], peer, f);
+ File d = linked.get(cs[i].getPathPart());
+ if(d == null) {
+ d = new File(f, FileAnyImpl.toFileName(cs[i]));
+ }
+ b &= saveChild(cs[i], peer, d);
}
t.remove(cs[i].getPathPart());
}
cs = getChildren(FileAuxiliary.AUX_FILE_ENTITY);
for (int i = 0; i < cs.length; i++) {
- File cf = new File(f, FileAnyImpl.toFileName(cs[i]));
+ File cf = getChildIOFile(cs[i]);
if(!cf.exists()) continue;
peer.register(cf);
FileAnyImpl impl = (FileAnyImpl)cs[i];
@@ -643,7 +712,11 @@
updateLock++;
boolean b = false;
try {
- saveChild(c, getFileSystem().getPeer(), folder);
+ File d = linked.get(c.getPathPart());
+ if(d == null) {
+ d = new File(folder, FileAnyImpl.toFileName(c));
+ }
+ saveChild(c, getFileSystem().getPeer(), d);
if(b) XModelObjectLoaderUtil.updateModifiedOnSave(c);
} finally {
updateLock--;
@@ -653,9 +726,8 @@
return b;
}
- private boolean saveChild(XModelObject c, FileSystemPeer peer, File folder) {
+ private boolean saveChild(XModelObject c, FileSystemPeer peer, File cf) {
boolean b = true;
- File cf = new File(folder, FileAnyImpl.toFileName(c));
if(!cf.exists()) c.setModified(true);
if(!c.isModified()) return true;
XObjectLoader loader = XModelObjectLoaderUtil.getObjectLoader(c);
@@ -806,11 +878,19 @@
}
public IContainer getChildContainer(String name) {
+ if(linked.containsKey(name)) {
+ IResource r = linkedResources.get(name);
+ return r instanceof IContainer ? (IContainer)r : null;
+ }
IContainer c = getResource();
return (c == null) ? null : c.getFolder(new Path("/" + name));
}
public IFile getChildFile(String name) {
+ if(linked.containsKey(name)) {
+ IResource r = linkedResources.get(name);
+ return r instanceof IFile ? (IFile)r : null;
+ }
IContainer c = getResource();
return (c == null) ? null : c.getFile(new Path("/" + name));
}
17 years, 5 months