JBoss Tools SVN: r4566 - 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-10-29 13:16:38 -0400 (Mon, 29 Oct 2007)
New Revision: 4566
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1193
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-10-29 17:14:56 UTC (rev 4565)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java 2007-10-29 17:16:38 UTC (rev 4566)
@@ -29,7 +29,6 @@
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.osgi.util.NLS;
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.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.seam.core.BijectedAttributeType;
@@ -52,6 +51,7 @@
import org.jboss.tools.seam.core.SeamCoreMessages;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.SeamPreferences;
+import org.jboss.tools.seam.internal.core.DataModelSelectionAttribute;
import org.jboss.tools.seam.internal.core.SeamComponentDeclaration;
import org.jboss.tools.seam.internal.core.SeamJavaComponentDeclaration;
import org.jboss.tools.seam.internal.core.SeamProject;
@@ -592,7 +592,7 @@
return;
}
}
- addError(UNKNOWN_DATA_MODEL_MESSAGE_ID, SeamPreferences.UNKNOWN_DATA_MODEL, new String[]{selectionName}, coreHelper.getLocationOfName(bijection), declaration.getResource());
+ addError(UNKNOWN_DATA_MODEL_MESSAGE_ID, SeamPreferences.UNKNOWN_DATA_MODEL, new String[]{dataModelName}, coreHelper.getLocationOfAttribute(bijection, DataModelSelectionAttribute.VALUE), declaration.getResource());
}
}
17 years, 2 months
JBoss Tools SVN: r4565 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-10-29 13:14:56 -0400 (Mon, 29 Oct 2007)
New Revision: 4565
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/DataModelSelectionAttribute.java
Log:
JBIDE-1193
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/DataModelSelectionAttribute.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/DataModelSelectionAttribute.java 2007-10-29 17:12:25 UTC (rev 4564)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/DataModelSelectionAttribute.java 2007-10-29 17:14:56 UTC (rev 4565)
@@ -40,7 +40,7 @@
List<Change> changes = super.merge(s);
if(s instanceof DataModelSelectionAttribute) {
DataModelSelectionAttribute sf = (DataModelSelectionAttribute)s;
- if(stringsEqual(this.value, sf.value)) {
+ if(!stringsEqual(this.value, sf.value)) {
changes = Change.addChange(changes, new Change(this, VALUE, this.value, sf.value));
this.value = sf.value;
}
17 years, 2 months
JBoss Tools SVN: r4564 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-10-29 13:12:25 -0400 (Mon, 29 Oct 2007)
New Revision: 4564
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ComponentBuilder.java
Log:
JBIDE-1193
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ComponentBuilder.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ComponentBuilder.java 2007-10-29 16:58:48 UTC (rev 4563)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ComponentBuilder.java 2007-10-29 17:12:25 UTC (rev 4564)
@@ -164,6 +164,8 @@
att.setValue(name);
if(name == null || isDataModelSelectionType) {
name = new ValueInfo();
+ name.valueStartPosition = m.getStartPosition();
+ name.valueLength = m.getLength();
name.value = m.getName().getIdentifier();
}
@@ -191,6 +193,8 @@
att.setValue(name);
if(name == null || isDataModelSelectionType) {
name = new ValueInfo();
+ name.valueStartPosition = m.getStartPosition();
+ name.valueLength = m.getLength();
name.value = getFieldName(m);
}
17 years, 2 months
JBoss Tools SVN: r4563 - 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-10-29 12:58:48 -0400 (Mon, 29 Oct 2007)
New Revision: 4563
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1193
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-10-29 16:53:51 UTC (rev 4562)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java 2007-10-29 16:58:48 UTC (rev 4563)
@@ -571,25 +571,28 @@
}
private void validateDataModelSelection(ISeamJavaComponentDeclaration declaration, IBijectedAttribute bijection) {
- String name = bijection.getName();
- if(name==null) {
+ String dataModelName = bijection.getValue();
+ String selectionName = bijection.getName();
+ // save link between java source and variable name
+ validationContext.addLinkedCoreResource(selectionName, declaration.getSourcePath());
+ if(dataModelName==null) {
// here must be the only one @DataModel in the component
Set<IBijectedAttribute> dataBinders = declaration.getBijectedAttributesByType(BijectedAttributeType.DATA_BINDER);
- if(dataBinders.size()>0) {
+ if(dataBinders.size()>1) {
for (IBijectedAttribute dataBinder : dataBinders) {
addError(MULTIPLE_DATA_BINDER_MESSAGE_ID, SeamPreferences.MULTIPLE_DATA_BINDER, dataBinder, declaration.getResource());
}
}
} else {
- // save link between java source and variable name
- validationContext.addLinkedCoreResource(name, declaration.getSourcePath());
- Set<IBijectedAttribute> dataBinders = declaration.getBijectedAttributesByName(name);
+ // save link between java source and Data Model name
+ validationContext.addLinkedCoreResource(dataModelName, declaration.getSourcePath());
+ Set<IBijectedAttribute> dataBinders = declaration.getBijectedAttributesByName(selectionName);
for (IBijectedAttribute dataBinder : dataBinders) {
if(dataBinder.isOfType(BijectedAttributeType.DATA_BINDER) || dataBinder.isOfType(BijectedAttributeType.OUT)) {
return;
}
}
- addError(UNKNOWN_DATA_MODEL_MESSAGE_ID, SeamPreferences.UNKNOWN_DATA_MODEL, new String[]{name}, coreHelper.getLocationOfName(bijection), declaration.getResource());
+ addError(UNKNOWN_DATA_MODEL_MESSAGE_ID, SeamPreferences.UNKNOWN_DATA_MODEL, new String[]{selectionName}, coreHelper.getLocationOfName(bijection), declaration.getResource());
}
}
17 years, 2 months
JBoss Tools SVN: r4562 - trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-10-29 12:53:51 -0400 (Mon, 29 Oct 2007)
New Revision: 4562
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ProjectArchivesView.java
Log:
Archives node error introduced in view. Fixed.
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ProjectArchivesView.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ProjectArchivesView.java 2007-10-29 16:52:07 UTC (rev 4561)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ProjectArchivesView.java 2007-10-29 16:53:51 UTC (rev 4562)
@@ -311,10 +311,26 @@
public void run () {
for( int i = 0; i < topChanges.length; i++ ) {
if( topChanges.length == 1 && topChanges[0] instanceof IArchiveModelNode) {
- packageViewer.setInput(ArchivesModel.instance().getRoot(project.getLocation()));
+ // we have a changed IArchiveModelNode. Something's different
+ IArchiveModelNode inputModel = (IArchiveModelNode) packageViewer.getInput();
+ IArchiveModelNode newModel = (IArchiveModelNode)topChanges[0];
+ if( inputModel != null ) {
+ if( inputModel.getProjectPath().equals(newModel.getProjectPath()) && inputModel != newModel ) {
+ // they have the same path but are different objects.
+ // Model was probably reloaded from disk and could be completely different
+ packageViewer.setInput(newModel);
+ packageViewer.expandAll();
+ return;
+ } else {
+ packageViewer.refresh();
+ return;
+ }
+ }
book.showPage(viewerComposite);
- } else
+ } else {
+ // just refresh whatever is the top changed element (archive probably)
packageViewer.refresh(topChanges[i]);
+ }
}
}
});
17 years, 2 months
JBoss Tools SVN: r4561 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-10-29 12:52:07 -0400 (Mon, 29 Oct 2007)
New Revision: 4561
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/DataModelSelectionAttribute.java
Log:
JBIDE-1193
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/DataModelSelectionAttribute.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/DataModelSelectionAttribute.java 2007-10-29 16:52:03 UTC (rev 4560)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/DataModelSelectionAttribute.java 2007-10-29 16:52:07 UTC (rev 4561)
@@ -42,7 +42,7 @@
DataModelSelectionAttribute sf = (DataModelSelectionAttribute)s;
if(stringsEqual(this.value, sf.value)) {
changes = Change.addChange(changes, new Change(this, VALUE, this.value, sf.value));
- this.types = sf.types;
+ this.value = sf.value;
}
}
return changes;
17 years, 2 months
JBoss Tools SVN: r4560 - trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-10-29 12:52:03 -0400 (Mon, 29 Oct 2007)
New Revision: 4560
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/WorkspaceChangeListener.java
Log:
JBIDE-1199 workspace change listener NPE
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/WorkspaceChangeListener.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/WorkspaceChangeListener.java 2007-10-29 16:28:12 UTC (rev 4559)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/WorkspaceChangeListener.java 2007-10-29 16:52:03 UTC (rev 4560)
@@ -54,7 +54,8 @@
try {
delta.accept(new IResourceDeltaVisitor() {
public boolean visit(IResourceDelta delta) throws CoreException {
- if( delta.getResource() != null && delta.getResource().getLocation().lastSegment().equals(ArchivesModel.PROJECT_PACKAGES_FILE)) {
+ if( delta.getResource() != null && delta.getResource().getLocation() != null &&
+ delta.getResource().getLocation().lastSegment().equals(ArchivesModel.PROJECT_PACKAGES_FILE)) {
projects.add(delta.getResource().getProject());
}
return true;
17 years, 2 months
JBoss Tools SVN: r4559 - trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2007-10-29 12:28:12 -0400 (Mon, 29 Oct 2007)
New Revision: 4559
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseOperation.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1057 Refresh package explorer after generating seam artifacts by our wizards
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseOperation.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseOperation.java 2007-10-29 16:24:58 UTC (rev 4558)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseOperation.java 2007-10-29 16:28:12 UTC (rev 4559)
@@ -33,6 +33,8 @@
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart;
+import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.ide.IDE;
@@ -156,10 +158,18 @@
IVirtualFile manifest = webComp.getRootFolder().getFile("/META-INF/MANIFEST.MF");
manifest.getUnderlyingFile().getParent().touch(monitor);
manifest.getUnderlyingFile().touch(monitor);
-
+
// to keep workspace in sync
seamPrjSet.refreshLocal(monitor);
-
+
+ // We need refresh PackageExplorer because of bug of Eclipse. See http://jira.jboss.com/jira/browse/JBIDE-1057
+ PackageExplorerPart p = PackageExplorerPart.getFromActivePerspective();
+ if(p!=null) {
+ TreeViewer tv = p.getTreeViewer();
+ if(tv!=null) {
+ tv.refresh();
+ }
+ }
} catch (CoreException e) {
result = new Status(IStatus.ERROR,SeamGuiPlugin.PLUGIN_ID,e.getMessage(),e);
}
17 years, 2 months
JBoss Tools SVN: r4558 - trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/build.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-10-29 12:24:58 -0400 (Mon, 29 Oct 2007)
New Revision: 4558
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/build/ModelChangeListenerWithRefresh.java
Log:
JBIDE-1199 workspace change listener NPE
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/build/ModelChangeListenerWithRefresh.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/build/ModelChangeListenerWithRefresh.java 2007-10-29 15:05:13 UTC (rev 4557)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/build/ModelChangeListenerWithRefresh.java 2007-10-29 16:24:58 UTC (rev 4558)
@@ -8,6 +8,8 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.QualifiedName;
+import org.jboss.ide.eclipse.archives.core.ArchivesCorePlugin;
import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
import org.jboss.ide.eclipse.archives.core.model.IArchive;
import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
@@ -29,21 +31,31 @@
protected void postChange(IArchiveNode node) {
IArchive pack = node.getRootArchive();
if( pack != null ) {
- if( pack.isDestinationInWorkspace() ) {
- // refresh the root package node
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- IResource res = root.getContainerForLocation(pack.getGlobalDestinationPath());
- if( res != null ) {
- try {
- res.getParent().refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
- } catch( CoreException ce ) {
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ IContainer proj = root.getContainerForLocation(pack.getProjectPath());
+ try {
+ proj.setSessionProperty(new QualifiedName(ArchivesCorePlugin.PLUGIN_ID, "localname"), "inUse");
+ if( pack.isDestinationInWorkspace() ) {
+ // refresh the root package node
+ IResource res = root.getContainerForLocation(pack.getGlobalDestinationPath());
+ if( res != null ) {
+ try {
+ // refresh infinitely in case the output is exploded
+ res.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
+ } catch( CoreException ce ) {
+ }
}
}
+
+ try {
+ proj.getFile(new Path(ArchivesModel.PROJECT_PACKAGES_FILE)).refreshLocal(IResource.DEPTH_ONE, new NullProgressMonitor());
+ } catch( CoreException ce ) {
+ }
+ } catch( CoreException ce ) {
}
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- IContainer proj = root.getContainerForLocation(pack.getProjectPath());
+
try {
- proj.getFile(new Path(ArchivesModel.PROJECT_PACKAGES_FILE)).refreshLocal(IResource.DEPTH_ONE, new NullProgressMonitor());
+ proj.setSessionProperty(new QualifiedName(ArchivesCorePlugin.PLUGIN_ID, "localname"), null);
} catch( CoreException ce ) {
}
17 years, 2 months
JBoss Tools SVN: r4557 - in trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam: internal/core and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-10-29 11:05:13 -0400 (Mon, 29 Oct 2007)
New Revision: 4557
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/DataModelSelectionAttribute.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IBijectedAttribute.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/BijectedAttribute.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ComponentBuilder.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/TypeScanner.java
Log:
JBIDE-1193
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IBijectedAttribute.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IBijectedAttribute.java 2007-10-29 14:22:54 UTC (rev 4556)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IBijectedAttribute.java 2007-10-29 15:05:13 UTC (rev 4557)
@@ -35,6 +35,13 @@
*/
public boolean isContextVariable();
+ /**
+ * Returns value of annotation attribute 'value'.
+ * If value is not set but bijection type defaults value to field name, returns it.
+ * @return
+ */
+ public String getValue();
+
public IBijectedAttribute clone() throws CloneNotSupportedException;
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/BijectedAttribute.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/BijectedAttribute.java 2007-10-29 14:22:54 UTC (rev 4556)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/BijectedAttribute.java 2007-10-29 15:05:13 UTC (rev 4557)
@@ -14,13 +14,14 @@
import org.jboss.tools.seam.core.BijectedAttributeType;
import org.jboss.tools.seam.core.IBijectedAttribute;
+import org.jboss.tools.seam.core.IValueInfo;
import org.jboss.tools.seam.core.event.Change;
/**
* @author Viacheslav Kabanovich
*/
public class BijectedAttribute extends SeamJavaContextVariable implements IBijectedAttribute {
- BijectedAttributeType[] types = null;
+ protected BijectedAttributeType[] types = null;
public BijectedAttribute() {
}
@@ -46,6 +47,14 @@
public void setTypes(BijectedAttributeType[] types) {
this.types = types;
}
+
+ public String getValue() {
+ return getName();
+ }
+
+ public void setValue(String value) {}
+
+ public void setValue(IValueInfo value) {}
public List<Change> merge(SeamObject s) {
List<Change> changes = super.merge(s);
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/DataModelSelectionAttribute.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/DataModelSelectionAttribute.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/DataModelSelectionAttribute.java 2007-10-29 15:05:13 UTC (rev 4557)
@@ -0,0 +1,51 @@
+ /*******************************************************************************
+ * 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.internal.core;
+
+import java.util.List;
+import org.jboss.tools.seam.core.IValueInfo;
+import org.jboss.tools.seam.core.event.Change;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class DataModelSelectionAttribute extends BijectedAttribute {
+ public static String VALUE = "value";
+ String value;
+
+ public DataModelSelectionAttribute() {}
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public void setValue(IValueInfo value) {
+ attributes.put(VALUE, value);
+ this.value = value == null ? null : value.getValue();
+ }
+
+ public List<Change> merge(SeamObject s) {
+ List<Change> changes = super.merge(s);
+ if(s instanceof DataModelSelectionAttribute) {
+ DataModelSelectionAttribute sf = (DataModelSelectionAttribute)s;
+ if(stringsEqual(this.value, sf.value)) {
+ changes = Change.addChange(changes, new Change(this, VALUE, this.value, sf.value));
+ this.types = sf.types;
+ }
+ }
+ return changes;
+ }
+
+}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ComponentBuilder.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ComponentBuilder.java 2007-10-29 14:22:54 UTC (rev 4556)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ComponentBuilder.java 2007-10-29 15:05:13 UTC (rev 4557)
@@ -35,6 +35,7 @@
import org.jboss.tools.seam.core.IValueInfo;
import org.jboss.tools.seam.core.SeamComponentMethodType;
import org.jboss.tools.seam.internal.core.BijectedAttribute;
+import org.jboss.tools.seam.internal.core.DataModelSelectionAttribute;
import org.jboss.tools.seam.internal.core.Role;
import org.jboss.tools.seam.internal.core.SeamAnnotatedFactory;
import org.jboss.tools.seam.internal.core.SeamComponentMethod;
@@ -146,29 +147,22 @@
}
void processBijections() {
+ Map<BijectedAttributeType, Annotation> as = new HashMap<BijectedAttributeType, Annotation>();
+ List<BijectedAttributeType> types = new ArrayList<BijectedAttributeType>();
+
for (AnnotatedASTNode<MethodDeclaration> n: annotatedMethods) {
- Map<BijectedAttributeType, Annotation> as = new HashMap<BijectedAttributeType, Annotation>();
- List<BijectedAttributeType> types = new ArrayList<BijectedAttributeType>();
- Annotation main = null;
- for (int i = 0; i < BijectedAttributeType.values().length; i++) {
- Annotation a = findAnnotation(n, BijectedAttributeType.values()[i].getAnnotationType());
- if(a != null) {
- as.put(BijectedAttributeType.values()[i], a);
- if(main == null) main = a;
- types.add(BijectedAttributeType.values()[i]);
- }
- }
+ Annotation main = getBijectedType(n, as, types);
+
if(as.size() == 0) continue;
+ boolean isDataModelSelectionType = !types.get(0).isUsingMemberName();
MethodDeclaration m = n.getNode();
- BijectedAttribute att = new BijectedAttribute();
- component.addBijectedAttribute(att);
-
- att.setTypes(types.toArray(new BijectedAttributeType[0]));
+ BijectedAttribute att = createBijectedAttribute(types);
ValueInfo name = ValueInfo.getValueInfo(main, null);
- if(name == null && types.size() > 0 && types.get(0).isUsingMemberName()) {
+ att.setValue(name);
+ if(name == null || isDataModelSelectionType) {
name = new ValueInfo();
name.value = m.getName().getIdentifier();
}
@@ -184,28 +178,18 @@
}
for (AnnotatedASTNode<FieldDeclaration> n: annotatedFields) {
- Map<BijectedAttributeType, Annotation> as = new HashMap<BijectedAttributeType, Annotation>();
- List<BijectedAttributeType> types = new ArrayList<BijectedAttributeType>();
- Annotation main = null;
- for (int i = 0; i < BijectedAttributeType.values().length; i++) {
- Annotation a = findAnnotation(n, BijectedAttributeType.values()[i].getAnnotationType());
- if(a != null) {
- as.put(BijectedAttributeType.values()[i], a);
- if(main == null) main = a;
- types.add(BijectedAttributeType.values()[i]);
- }
- }
+ Annotation main = getBijectedType(n, as, types);
+
if(as.size() == 0) continue;
+ boolean isDataModelSelectionType = !types.get(0).isUsingMemberName();
FieldDeclaration m = n.getNode();
- BijectedAttribute att = new BijectedAttribute();
- component.addBijectedAttribute(att);
-
- att.setTypes(types.toArray(new BijectedAttributeType[0]));
+ BijectedAttribute att = createBijectedAttribute(types);
ValueInfo name = ValueInfo.getValueInfo(main, null);
- if(name == null) {
+ att.setValue(name);
+ if(name == null || isDataModelSelectionType) {
name = new ValueInfo();
name.value = getFieldName(m);
}
@@ -220,6 +204,30 @@
att.setId(f);
}
}
+ private Annotation getBijectedType(AnnotatedASTNode<?> n,
+ Map<BijectedAttributeType, Annotation> as, List<BijectedAttributeType> types) {
+ as.clear();
+ types.clear();
+ Annotation main = null;
+ for (int i = 0; i < BijectedAttributeType.values().length; i++) {
+ Annotation a = findAnnotation(n, BijectedAttributeType.values()[i].getAnnotationType());
+ if(a != null) {
+ as.put(BijectedAttributeType.values()[i], a);
+ if(main == null) main = a;
+ types.add(BijectedAttributeType.values()[i]);
+ }
+ }
+ return main;
+ }
+ private BijectedAttribute createBijectedAttribute(List<BijectedAttributeType> types) {
+ boolean isDataModelSelectionType = !types.get(0).isUsingMemberName();
+ BijectedAttribute att = (!isDataModelSelectionType)
+ ? new BijectedAttribute() : new DataModelSelectionAttribute();
+ component.addBijectedAttribute(att);
+ att.setTypes(types.toArray(new BijectedAttributeType[0]));
+
+ return att;
+ }
void processComponentMethods() {
for (AnnotatedASTNode<MethodDeclaration> n: annotatedMethods) {
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/TypeScanner.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/TypeScanner.java 2007-10-29 14:22:54 UTC (rev 4556)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/TypeScanner.java 2007-10-29 15:05:13 UTC (rev 4557)
@@ -42,6 +42,7 @@
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.internal.core.AbstractContextVariable;
import org.jboss.tools.seam.internal.core.BijectedAttribute;
+import org.jboss.tools.seam.internal.core.DataModelSelectionAttribute;
import org.jboss.tools.seam.internal.core.SeamAnnotatedFactory;
import org.jboss.tools.seam.internal.core.SeamComponentMethod;
import org.jboss.tools.seam.internal.core.SeamJavaComponentDeclaration;
@@ -240,14 +241,18 @@
}
}
if(as.size() == 0) return;
+
+ boolean isDataModelSelectionType = !types.get(0).isUsingMemberName();
- BijectedAttribute att = new BijectedAttribute();
+ BijectedAttribute att = (!isDataModelSelectionType)
+ ? new BijectedAttribute() : new DataModelSelectionAttribute();
component.addBijectedAttribute(att);
att.setTypes(types.toArray(new BijectedAttributeType[0]));
String name = (String)getValue(main, "value"); //$NON-NLS-1$
- if(name == null || name.length() == 0) {
+ att.setValue(name);
+ if(name == null || name.length() == 0 || isDataModelSelectionType) {
name = new String(m.getSelector());
}
att.setName(name);
17 years, 2 months