JBoss Tools SVN: r2421 - in trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam: internal/core and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-07-13 04:29:44 -0400 (Fri, 13 Jul 2007)
New Revision: 2421
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCoreBuilder.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationContext.java
Log:
EXIN-217 Seam model serialization to xml implemented; validation context stored/loaded
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCoreBuilder.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCoreBuilder.java 2007-07-13 07:19:17 UTC (rev 2420)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCoreBuilder.java 2007-07-13 08:29:44 UTC (rev 2421)
@@ -97,7 +97,11 @@
incrementalBuild(delta, monitor);
}
}
- sp.store();
+ try {
+ sp.store();
+ } catch (Exception e) {
+ SeamCorePlugin.getPluginLog().logError("Error storing build results");
+ }
return null;
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2007-07-13 07:19:17 UTC (rev 2420)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2007-07-13 08:29:44 UTC (rev 2421)
@@ -29,7 +29,7 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
-import org.jboss.tools.common.util.FileUtil;
+import org.jboss.tools.common.xml.XMLUtilities;
import org.jboss.tools.seam.core.IBijectedAttribute;
import org.jboss.tools.seam.core.ISeamComponent;
import org.jboss.tools.seam.core.ISeamComponentDeclaration;
@@ -49,6 +49,7 @@
import org.jboss.tools.seam.internal.core.scanner.LoadedDeclarations;
import org.jboss.tools.seam.internal.core.scanner.lib.ClassPath;
import org.jboss.tools.seam.internal.core.validation.SeamValidationContext;
+import org.w3c.dom.Element;
/**
* @author Viacheslav Kabanovich
@@ -130,7 +131,11 @@
public void resolveStorage(boolean load) {
if(isStorageResolved) return;
if(load) {
- load();
+ try {
+ load();
+ } catch (Exception e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
} else {
isStorageResolved = true;
}
@@ -155,15 +160,10 @@
}
File file = getStorageFile();
if(file == null || !file.isFile()) return;
- String s = FileUtil.readFile(file);
- String[] ps = s.split("\n");
- for (int i = 0; i < ps.length; i++) {
- IPath path = new Path(ps[i].trim());
- if(sourcePaths.contains(path)) continue;
- IFile f = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
- if(f == null || !f.exists() || !f.isSynchronized(IResource.DEPTH_ZERO)) continue;
- SeamResourceVisitor b = new SeamResourceVisitor(this);
- b.visit(f);
+ Element root = XMLUtilities.getElement(file, null);
+ if(root != null) {
+ loadSourcePaths(root);
+ getValidationContext().load(root);
}
long e = System.currentTimeMillis();
@@ -175,16 +175,41 @@
* Stores results of last build, so that on exit/enter Eclipse
* load them without rebuilding project
*/
- public void store() {
+ public void store() throws Exception {
File file = getStorageFile();
file.getParentFile().mkdirs();
- StringBuffer sb = new StringBuffer();
+
+ Element root = XMLUtilities.createDocumentElement("seam-project");
+ storeSourcePaths(root);
+ if(validationContext != null) validationContext.store(root);
+
+ XMLUtilities.serialize(root, file.getAbsolutePath());
+ }
+
+ private void storeSourcePaths(Element root) {
+ Element sourcePathsElement = XMLUtilities.createElement(root, "source-paths");
for (IPath path : sourcePaths) {
- sb.append(path.toString()).append('\n');
- }
- FileUtil.writeFile(file, sb.toString());
+ Element pathElement = XMLUtilities.createElement(sourcePathsElement, "path");
+ pathElement.setAttribute("value", path.toString());
+ }
}
+ private void loadSourcePaths(Element root) {
+ Element sourcePathsElement = XMLUtilities.getUniqueChild(root, "source-paths");
+ if(sourcePathsElement == null) return;
+ Element[] paths = XMLUtilities.getChildren(sourcePathsElement, "path");
+ if(paths != null) for (int i = 0; i < paths.length; i++) {
+ String p = paths[i].getAttribute("value");
+ if(p == null || p.trim().length() == 0) continue;
+ IPath path = new Path(p.trim());
+ if(sourcePaths.contains(path)) continue;
+ IFile f = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
+ if(f == null || !f.exists() || !f.isSynchronized(IResource.DEPTH_ZERO)) continue;
+ SeamResourceVisitor b = new SeamResourceVisitor(this);
+ b.visit(f);
+ }
+ }
+
private File getStorageFile() {
IPath path = SeamCorePlugin.getDefault().getStateLocation();
File file = new File(path.toFile(), "projects/" + project.getName());
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-13 07:19:17 UTC (rev 2420)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationContext.java 2007-07-13 08:29:44 UTC (rev 2421)
@@ -16,6 +16,10 @@
import java.util.Set;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.jboss.tools.common.xml.XMLUtilities;
+import org.jboss.tools.seam.core.SeamCorePlugin;
+import org.w3c.dom.Element;
/**
* Contains information for seam validators that must be saved between
@@ -80,4 +84,37 @@
resourcesByVariableName.clear();
variableNamesByResource.clear();
}
+
+ public void store(Element root) {
+ Element validation = XMLUtilities.createElement(root, "validation");
+ Set<String> variables = resourcesByVariableName.keySet();
+ for (String name: variables) {
+ Set<IPath> paths = resourcesByVariableName.get(name);
+ if(paths == null) continue;
+ for (IPath path: paths) {
+ Element linkedResource = XMLUtilities.createElement(validation, "linked-resource");
+ linkedResource.setAttribute("name", name);
+ linkedResource.setAttribute("path", path.toString());
+ }
+ }
+ }
+
+ public void load(Element root) {
+ Element validation = XMLUtilities.getUniqueChild(root, "validation");
+ if(validation == null) return;
+ Element[] linkedResources = XMLUtilities.getChildren(validation, "inked-resource");
+ if(linkedResources != null) for (int i = 0; i < linkedResources.length; i++) {
+ String name = linkedResources[i].getAttribute("name");
+ if(name == null || name.trim().length() == 0) continue;
+ String path = linkedResources[i].getAttribute("path");
+ if(path == null || path.trim().length() == 0) continue;
+ IPath pathObject = null;
+ try {
+ pathObject = new Path(path);
+ } catch (Exception e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+ addLinkedResource(name, pathObject);
+ }
+ }
}
\ No newline at end of file
17 years, 5 months
JBoss Tools SVN: r2420 - trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-07-13 03:19:17 -0400 (Fri, 13 Jul 2007)
New Revision: 2420
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamComponentProperties.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamElementProperties.java
Log:
EXIN-218 Annotations @Entity and @Stateful processed in properties.
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamComponentProperties.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamComponentProperties.java 2007-07-13 07:18:24 UTC (rev 2419)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamComponentProperties.java 2007-07-13 07:19:17 UTC (rev 2420)
@@ -41,14 +41,21 @@
ISeamComponent element;
static IPropertyDescriptor[] DESCRIPTORS = {
- NAME_DESCRIPTOR, SCOPE_DESCRIPTOR, CLASS_DESCRIPTOR, PRECEDENCE_DESCRIPTOR
+ NAME_DESCRIPTOR, SCOPE_DESCRIPTOR, CLASS_DESCRIPTOR, PRECEDENCE_DESCRIPTOR,
+ ENTITY_DESCRIPTOR
};
+ static IPropertyDescriptor[] ENTITY_DESCRIPTORS = {
+ NAME_DESCRIPTOR, SCOPE_DESCRIPTOR, CLASS_DESCRIPTOR, PRECEDENCE_DESCRIPTOR,
+ ENTITY_DESCRIPTOR, STATEFUL_DESCRIPTOR
+ };
+
public SeamComponentProperties(ISeamComponent element) {
this.element = element;
}
public IPropertyDescriptor[] getPropertyDescriptors() {
+ if(element != null && element.isEntity()) return ENTITY_DESCRIPTORS;
return DESCRIPTORS;
}
@@ -61,6 +68,10 @@
return element.getClassName();
} else if(PRECEDENCE.equals(id)) {
return Precedence.getStringValue(element.getPrecedence());
+ } if(ENTITY.equals(id)) {
+ return "" + element.isEntity();
+ } if(STATEFUL.equals(id)) {
+ return "" + element.isStateful();
}
return null;
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamElementProperties.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamElementProperties.java 2007-07-13 07:18:24 UTC (rev 2419)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamElementProperties.java 2007-07-13 07:19:17 UTC (rev 2420)
@@ -23,14 +23,18 @@
static String CLASS = "class";
static String PRECEDENCE = "precedence";
static String INSTALLED = "installed";
+
+ static String ENTITY = "entity";
static String STATEFUL = "stateful";
-
static IPropertyDescriptor NAME_DESCRIPTOR = new PropertyDescriptor(NAME, NAME);
static IPropertyDescriptor SCOPE_DESCRIPTOR = new PropertyDescriptor(SCOPE, SCOPE);
static IPropertyDescriptor CLASS_DESCRIPTOR = new PropertyDescriptor(CLASS, CLASS);
static IPropertyDescriptor PRECEDENCE_DESCRIPTOR = new PropertyDescriptor(PRECEDENCE, PRECEDENCE);
-
+
+ static IPropertyDescriptor ENTITY_DESCRIPTOR = new PropertyDescriptor(ENTITY, ENTITY);
+ static IPropertyDescriptor STATEFUL_DESCRIPTOR = new PropertyDescriptor(STATEFUL, STATEFUL);
+
public SeamElementProperties() {
}
17 years, 5 months
JBoss Tools SVN: r2419 - in trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core: scanner/java and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-07-13 03:18:24 -0400 (Fri, 13 Jul 2007)
New Revision: 2419
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.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/ClassScanner.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/TypeScanner.java
Log:
EXIN-217 Annotation @Entity processed.
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java 2007-07-13 06:41:45 UTC (rev 2418)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java 2007-07-13 07:18:24 UTC (rev 2419)
@@ -331,6 +331,16 @@
}
}
+ public void setEntity(ValueInfo value) {
+ attributes.put("entity", value);
+ setEntity(value != null && "true".equals(value.getValue()));
+ }
+
+ public void setStateful(ValueInfo value) {
+ attributes.put("stateful", value);
+ setStateful(value != null && "true".equals(value.getValue()));
+ }
+
public void open() {
if(type == null) return;
try {
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-07-13 06:41:45 UTC (rev 2418)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ComponentBuilder.java 2007-07-13 07:18:24 UTC (rev 2419)
@@ -91,9 +91,14 @@
stateful.value = "true";
stateful.valueStartPosition = as[i].getAnnotation().getStartPosition();
stateful.valueLength = as[i].getAnnotation().getLength();
- component.setStateful(true);
+ component.setStateful(stateful);
+ } else if(ENTITY_ANNOTATION_TYPE.equals(type)) {
+ ValueInfo entity = new ValueInfo();
+ entity.value = "true";
+ entity.valueStartPosition = as[i].getAnnotation().getStartPosition();
+ entity.valueLength = as[i].getAnnotation().getLength();
+ component.setEntity(entity);
}
- //TODO entity
}
processFactories();
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassScanner.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassScanner.java 2007-07-13 06:41:45 UTC (rev 2418)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassScanner.java 2007-07-13 07:18:24 UTC (rev 2419)
@@ -128,6 +128,10 @@
if(a != null) {
component.setStateful(true);
}
+ a = map.get(ENTITY_ANNOTATION_TYPE);
+ if(a != null) {
+ component.setEntity(true);
+ }
}
Method[] ms = null;
try {
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-07-13 06:41:45 UTC (rev 2418)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/TypeScanner.java 2007-07-13 07:18:24 UTC (rev 2419)
@@ -139,6 +139,10 @@
if(a != null) {
component.setStateful(true);
}
+ a = map.get(ENTITY_ANNOTATION_TYPE);
+ if(a != null) {
+ component.setEntity(true);
+ }
}
IBinaryMethod[] ms = null;
try {
17 years, 5 months
JBoss Tools SVN: r2418 - in trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam: internal/core and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-07-13 02:41:45 -0400 (Fri, 13 Jul 2007)
New Revision: 2418
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/Util.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponentMethod.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamComponentMethodType.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentMethod.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ASTVisitorImpl.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/java/SeamAnnotations.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassScanner.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/TypeScanner.java
Log:
EXIN-217 Annotation @Remove processed.
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponentMethod.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponentMethod.java 2007-07-13 06:16:10 UTC (rev 2417)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponentMethod.java 2007-07-13 06:41:45 UTC (rev 2418)
@@ -10,6 +10,8 @@
******************************************************************************/
package org.jboss.tools.seam.core;
+import java.util.Set;
+
/**
* Represents method of seam component.
* This interface represents only methods with types enumerated in SeamComponentMethodType
@@ -18,16 +20,11 @@
public interface ISeamComponentMethod extends ISeamJavaSourceReference, ISeamElement {
/**
- * @return is @ Create method
+ * @return is types of the method
*/
- public boolean isCreate();
+ public Set<SeamComponentMethodType> getTypes();
/**
- * @return is @ Destroy method
- */
- public boolean isDestroy();
-
- /**
* Returns create or destroy depending on type
* @param type
* @return
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamComponentMethodType.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamComponentMethodType.java 2007-07-13 06:16:10 UTC (rev 2417)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamComponentMethodType.java 2007-07-13 06:41:45 UTC (rev 2418)
@@ -10,11 +10,24 @@
******************************************************************************/
package org.jboss.tools.seam.core;
+import org.jboss.tools.seam.internal.core.scanner.java.SeamAnnotations;
+
/**
* @author Alexey Kazakov
*/
-public enum SeamComponentMethodType {
- CREATE,
- DESTROY,
- REMOVE
-}
\ No newline at end of file
+public enum SeamComponentMethodType implements SeamAnnotations {
+ CREATE(CREATE_ANNOTATION_TYPE),
+ DESTROY(DESTROY_ANNOTATION_TYPE),
+ REMOVE(REMOVE_ANNOTATION_TYPE);
+
+ String annotationType;
+
+ SeamComponentMethodType(String annotationType) {
+ this.annotationType = annotationType;
+ }
+
+ public String getAnnotationType() {
+ return annotationType;
+ }
+
+}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentMethod.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentMethod.java 2007-07-13 06:16:10 UTC (rev 2417)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentMethod.java 2007-07-13 06:41:45 UTC (rev 2418)
@@ -1,38 +1,47 @@
+ /*******************************************************************************
+ * 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.HashSet;
+import java.util.List;
+import java.util.Set;
+
import org.eclipse.core.resources.IResource;
import org.eclipse.jdt.core.IMember;
+import org.eclipse.jdt.core.JavaModelException;
import org.jboss.tools.seam.core.ISeamComponentMethod;
import org.jboss.tools.seam.core.SeamComponentMethodType;
+import org.jboss.tools.seam.core.event.Change;
+/**
+ * @author Viacheslav Kabanovich
+ */
public class SeamComponentMethod extends SeamObject implements ISeamComponentMethod {
- boolean create = false;
- boolean destroy = false;
+ Set<SeamComponentMethodType> types = new HashSet<SeamComponentMethodType>();
IMember javaSource = null;
+
+ public SeamComponentMethod() {}
- public boolean isCreate() {
- return create;
+ /**
+ * @return is types of the method
+ */
+ public Set<SeamComponentMethodType> getTypes() {
+ return types;
}
-
- public void setCreate(boolean b) {
- create = b;
- }
public boolean isOfType(SeamComponentMethodType type) {
- if(type == SeamComponentMethodType.CREATE) return isCreate();
- if(type == SeamComponentMethodType.DESTROY) return isDestroy();
- return false;
+ return types.contains(type);
}
- public boolean isDestroy() {
- return destroy;
- }
-
- public void setDestroy(boolean b) {
- destroy = b;
- }
-
public IMember getSourceMember() {
return javaSource;
}
@@ -42,7 +51,14 @@
}
public int getLength() {
- return 0;
+ if(javaSource == null) return 0;
+ try {
+ if(javaSource.getSourceRange() == null) return 0;
+ return javaSource.getSourceRange().getLength();
+ } catch (JavaModelException e) {
+ //ignore
+ return 0;
+ }
}
public IResource getResource() {
@@ -54,7 +70,34 @@
}
public int getStartPosition() {
- return 0;
+ if(javaSource == null) return 0;
+ try {
+ if(javaSource.getSourceRange() == null) return 0;
+ return javaSource.getSourceRange().getOffset();
+ } catch (JavaModelException e) {
+ //ignore
+ return 0;
+ }
}
+ public List<Change> merge(SeamObject s) {
+ List<Change> changes = super.merge(s);
+ SeamComponentMethod m = (SeamComponentMethod)s;
+ if(!typesAreEqual(types, m.types)) {
+ changes = Change.addChange(changes, new Change(this, "types", types, m.types));
+ this.types = m.types;
+ }
+ return changes;
+ }
+
+ boolean typesAreEqual(Set<SeamComponentMethodType> types1, Set<SeamComponentMethodType> types2) {
+ if(types1 == null || types2 == null) return types2 == types1;
+ if(types1.size() != types2.size()) return false;
+ for (SeamComponentMethodType t : types2) {
+ if(!types1.contains(t)) return false;
+ }
+ return true;
+
+ }
+
}
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/Util.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/Util.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/Util.java 2007-07-13 06:41:45 UTC (rev 2418)
@@ -0,0 +1,43 @@
+ /*******************************************************************************
+ * 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.scanner;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jboss.tools.seam.internal.core.scanner.java.SeamAnnotations;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class Util implements SeamAnnotations {
+
+ static Set<String> EJB_ANNOTATION_TYPES = new HashSet<String>();
+
+ static {
+ EJB_ANNOTATION_TYPES.add(STATEFUL_ANNOTATION_TYPE);
+ EJB_ANNOTATION_TYPES.add(ENTITY_ANNOTATION_TYPE);
+ EJB_ANNOTATION_TYPES.add(REMOVE_ANNOTATION_TYPE);
+ }
+
+ /**
+ * Returns true if parameter is qualified name of annotation type
+ * used to build seam model.
+ * @param qualifiedTypeName
+ * @return
+ */
+ public static boolean isSeamAnnotationType(String qualifiedTypeName) {
+ return qualifiedTypeName != null
+ && (qualifiedTypeName.startsWith(SEAM_ANNOTATION_TYPE_PREFIX)
+ || EJB_ANNOTATION_TYPES.contains(qualifiedTypeName));
+ }
+
+}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ASTVisitorImpl.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ASTVisitorImpl.java 2007-07-13 06:16:10 UTC (rev 2417)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ASTVisitorImpl.java 2007-07-13 06:41:45 UTC (rev 2418)
@@ -28,6 +28,7 @@
import org.eclipse.jdt.core.dom.SingleMemberAnnotation;
import org.eclipse.jdt.core.dom.TypeDeclaration;
import org.eclipse.jdt.core.dom.VariableDeclaration;
+import org.jboss.tools.seam.internal.core.scanner.Util;
/**
* Processes AST tree to find annotated type, fields and methods.
@@ -54,7 +55,7 @@
public boolean visit(SingleMemberAnnotation node) {
String type = resolveType(node);
- if(isSeamAnnotationType(type) && currentAnnotatedNode != null) {
+ if(Util.isSeamAnnotationType(type) && currentAnnotatedNode != null) {
currentAnnotatedNode.addAnnotation(new ResolvedAnnotation(type, node));
}
return false;
@@ -62,7 +63,7 @@
public boolean visit(NormalAnnotation node) {
String type = resolveType(node);
- if(isSeamAnnotationType(type) && currentAnnotatedNode != null) {
+ if(Util.isSeamAnnotationType(type) && currentAnnotatedNode != null) {
currentAnnotatedNode.addAnnotation(new ResolvedAnnotation(type, node));
}
return false;
@@ -70,7 +71,7 @@
public boolean visit(MarkerAnnotation node) {
String type = resolveType(node);
- if(isSeamAnnotationType(type) && currentAnnotatedNode != null) {
+ if(Util.isSeamAnnotationType(type) && currentAnnotatedNode != null) {
currentAnnotatedNode.addAnnotation(new ResolvedAnnotation(type, node));
}
return true;
@@ -100,11 +101,6 @@
return null;
}
- static boolean isSeamAnnotationType(String n) {
- return n != null && (n.startsWith(SEAM_ANNOTATION_TYPE_PREFIX)
- || n.equals(STATEFUL_ANNOTATION_TYPE));
- }
-
public boolean visit(Block node) {
return false;
}
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-07-13 06:16:10 UTC (rev 2417)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ComponentBuilder.java 2007-07-13 06:41:45 UTC (rev 2418)
@@ -30,6 +30,7 @@
import org.eclipse.jdt.core.dom.VariableDeclaration;
import org.jboss.tools.seam.core.BijectedAttributeType;
import org.jboss.tools.seam.core.ISeamXmlComponentDeclaration;
+import org.jboss.tools.seam.core.SeamComponentMethodType;
import org.jboss.tools.seam.internal.core.BijectedAttribute;
import org.jboss.tools.seam.internal.core.Role;
import org.jboss.tools.seam.internal.core.SeamAnnotatedFactory;
@@ -202,18 +203,20 @@
void processComponentMethods() {
for (AnnotatedASTNode<MethodDeclaration> n: annotatedMethods) {
- Annotation aCreate = findAnnotation(n, CREATE_ANNOTATION_TYPE);
- Annotation aDestroy = findAnnotation(n, DESTROY_ANNOTATION_TYPE);
- if(aCreate == null || aDestroy == null) continue;
- MethodDeclaration m = n.getNode();
-
- SeamComponentMethod cm = new SeamComponentMethod();
- component.addMethod(cm);
-
- if(aCreate != null) cm.setCreate(true);
- if(aDestroy != null) cm.setDestroy(true);
-
- cm.setSourceMember(findMethod(m));
+ SeamComponentMethod cm = null;
+ for (int i = 0; i < SeamComponentMethodType.values().length; i++) {
+ SeamComponentMethodType type = SeamComponentMethodType.values()[i];
+ Annotation a = findAnnotation(n, type.getAnnotationType());
+ if(a == null) continue;
+ if(cm == null) {
+ cm = new SeamComponentMethod();
+ component.addMethod(cm);
+ MethodDeclaration m = n.getNode();
+ component.addMethod(cm);
+ cm.setSourceMember(findMethod(m));
+ }
+ cm.getTypes().add(type);
+ }
}
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/SeamAnnotations.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/SeamAnnotations.java 2007-07-13 06:16:10 UTC (rev 2417)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/SeamAnnotations.java 2007-07-13 06:41:45 UTC (rev 2418)
@@ -1,5 +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.internal.core.scanner.java;
+/**
+ * Java annotations processed in building seam model
+ *
+ * @author Viacheslav Kabanovich
+ */
public interface SeamAnnotations {
public static String SEAM_ANNOTATION_TYPE_PREFIX = "org.jboss.seam.annotations.";
@@ -15,12 +30,14 @@
public static String CREATE_ANNOTATION_TYPE = SEAM_ANNOTATION_TYPE_PREFIX + "Create";
public static String DESTROY_ANNOTATION_TYPE = SEAM_ANNOTATION_TYPE_PREFIX + "Destroy";
+ public static String REMOVE_ANNOTATION_TYPE = "javax.ejb.Remove";
public static String FACTORY_ANNOTATION_TYPE = SEAM_ANNOTATION_TYPE_PREFIX + "Factory";
public static String ROLES_ANNOTATION_TYPE = SEAM_ANNOTATION_TYPE_PREFIX + "Roles";
public static String ROLE_ANNOTATION_TYPE = SEAM_ANNOTATION_TYPE_PREFIX + "Role";
+ public static String ENTITY_ANNOTATION_TYPE = "javax.persistence.Entity";
public static String STATEFUL_ANNOTATION_TYPE = "javax.ejb.Stateful";
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassScanner.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassScanner.java 2007-07-13 06:16:10 UTC (rev 2417)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassScanner.java 2007-07-13 06:41:45 UTC (rev 2418)
@@ -29,6 +29,7 @@
import org.jboss.tools.seam.internal.core.SeamAnnotatedFactory;
import org.jboss.tools.seam.internal.core.SeamJavaComponentDeclaration;
import org.jboss.tools.seam.internal.core.scanner.LoadedDeclarations;
+import org.jboss.tools.seam.internal.core.scanner.Util;
import org.jboss.tools.seam.internal.core.scanner.java.SeamAnnotations;
/**
@@ -85,7 +86,7 @@
Annotation[] as = cls.getAnnotations();
for (int i = 0; i < as.length; i++) {
Class<?> acls = as[i].annotationType();
- if(acls.getName().startsWith(SEAM_ANNOTATION_TYPE_PREFIX)) {
+ if(Util.isSeamAnnotationType(acls.getName())) {
return true;
}
}
@@ -97,9 +98,7 @@
Map<String,Annotation> map = null;
for (int i = 0; i < as.length; i++) {
Class<?> acls = as[i].annotationType();
- if(acls.getName().startsWith(SEAM_ANNOTATION_TYPE_PREFIX) ||
- //TODO put all non-seam relevant annotations to set
- acls.getName().equals(STATEFUL_ANNOTATION_TYPE)) {
+ if(Util.isSeamAnnotationType(acls.getName())) {
if(map == null) map = new HashMap<String, Annotation>();
map.put(acls.getName(), as[i]);
}
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-07-13 06:16:10 UTC (rev 2417)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/TypeScanner.java 2007-07-13 06:41:45 UTC (rev 2418)
@@ -29,6 +29,7 @@
import org.jboss.tools.seam.internal.core.SeamAnnotatedFactory;
import org.jboss.tools.seam.internal.core.SeamJavaComponentDeclaration;
import org.jboss.tools.seam.internal.core.scanner.LoadedDeclarations;
+import org.jboss.tools.seam.internal.core.scanner.Util;
import org.jboss.tools.seam.internal.core.scanner.java.SeamAnnotations;
public class TypeScanner implements SeamAnnotations {
@@ -80,7 +81,7 @@
IBinaryAnnotation[] as = cls.getAnnotations();
if(as != null) for (int i = 0; i < as.length; i++) {
String type = getTypeName(as[i]);
- if(type.startsWith(SEAM_ANNOTATION_TYPE_PREFIX)) {
+ if(Util.isSeamAnnotationType(type)) {
return true;
}
}
@@ -103,9 +104,7 @@
Map<String,IBinaryAnnotation> map = null;
for (int i = 0; i < as.length; i++) {
String type = getTypeName(as[i]);
- if(type.startsWith(SEAM_ANNOTATION_TYPE_PREFIX) ||
- //TODO put all non-seam relevant annotations to set
- type.equals(STATEFUL_ANNOTATION_TYPE)) {
+ if(Util.isSeamAnnotationType(type)) {
if(map == null) map = new HashMap<String, IBinaryAnnotation>();
map.put(type, as[i]);
}
17 years, 5 months
JBoss Tools SVN: r2417 - in trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views: properties and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-07-13 02:16:10 -0400 (Fri, 13 Jul 2007)
New Revision: 2417
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamComponentProperties.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamElementAdapterFactory.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamElementProperties.java
Log:
EXIN-218 Properties of component added.
Added: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamComponentProperties.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamComponentProperties.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamComponentProperties.java 2007-07-13 06:16:10 UTC (rev 2417)
@@ -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.ui.views.properties;
+
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.jboss.tools.seam.core.ISeamComponent;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class SeamComponentProperties extends SeamElementProperties {
+ enum Precedence {
+ BUILT_IN(0),
+ FRAMEWORK(10),
+ APPLICATION(20),
+ DEPLOYMENT(30),
+ MOCK(40);
+
+ int value;
+
+ Precedence(int value) {
+ this.value = value;
+ }
+
+ static String getStringValue(int v) {
+ for (int i = 0; i < Precedence.values().length; i++) {
+ if(v == Precedence.values()[i].value) return Precedence.values()[i].toString();
+ }
+ return "" + v;
+ }
+ }
+
+ ISeamComponent element;
+
+ static IPropertyDescriptor[] DESCRIPTORS = {
+ NAME_DESCRIPTOR, SCOPE_DESCRIPTOR, CLASS_DESCRIPTOR, PRECEDENCE_DESCRIPTOR
+ };
+
+ public SeamComponentProperties(ISeamComponent element) {
+ this.element = element;
+ }
+
+ public IPropertyDescriptor[] getPropertyDescriptors() {
+ return DESCRIPTORS;
+ }
+
+ public Object getPropertyValue(Object id) {
+ if(NAME.equals(id)) {
+ return element.getName();
+ } else if(SCOPE.equals(id)) {
+ return element.getScope().toString();
+ } else if(CLASS.equals(id)) {
+ return element.getClassName();
+ } else if(PRECEDENCE.equals(id)) {
+ return Precedence.getStringValue(element.getPrecedence());
+ }
+ return null;
+ }
+
+}
Added: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamElementAdapterFactory.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamElementAdapterFactory.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamElementAdapterFactory.java 2007-07-13 06:16:10 UTC (rev 2417)
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * 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.ui.views.properties;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.jboss.tools.seam.core.ISeamComponent;
+import org.jboss.tools.seam.core.ISeamElement;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class SeamElementAdapterFactory implements IAdapterFactory {
+
+ private static Class[] PROPERTIES = new Class[] {
+ IPropertySource.class,
+ };
+
+ public Object getAdapter(Object object, Class key) {
+ if(!(object instanceof ISeamElement)) return null;
+ ISeamElement element = (ISeamElement)object;
+ if (IPropertySource.class.equals(key)) {
+ return getProperties(element);
+ }
+ return null;
+ }
+
+ public Class[] getAdapterList() {
+ return PROPERTIES;
+ }
+
+ private IPropertySource getProperties(ISeamElement element) {
+ if(element instanceof ISeamComponent) {
+ return new SeamComponentProperties((ISeamComponent)element);
+ }
+ return null;
+ }
+
+}
Added: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamElementProperties.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamElementProperties.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamElementProperties.java 2007-07-13 06:16:10 UTC (rev 2417)
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * 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.ui.views.properties;
+
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.eclipse.ui.views.properties.PropertyDescriptor;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class SeamElementProperties implements IPropertySource {
+ static String NAME = "name";
+ static String SCOPE = "scope";
+ static String CLASS = "class";
+ static String PRECEDENCE = "precedence";
+ static String INSTALLED = "installed";
+ static String STATEFUL = "stateful";
+
+
+ static IPropertyDescriptor NAME_DESCRIPTOR = new PropertyDescriptor(NAME, NAME);
+ static IPropertyDescriptor SCOPE_DESCRIPTOR = new PropertyDescriptor(SCOPE, SCOPE);
+ static IPropertyDescriptor CLASS_DESCRIPTOR = new PropertyDescriptor(CLASS, CLASS);
+ static IPropertyDescriptor PRECEDENCE_DESCRIPTOR = new PropertyDescriptor(PRECEDENCE, PRECEDENCE);
+
+ public SeamElementProperties() {
+ }
+
+ public Object getEditableValue() {
+ return this;
+ }
+
+ public IPropertyDescriptor[] getPropertyDescriptors() {
+ return null;
+ }
+
+ public Object getPropertyValue(Object id) {
+ return null;
+ }
+
+ public boolean isPropertySet(Object id) {
+ return false;
+ }
+
+ public void resetPropertyValue(Object id) {
+ }
+
+ public void setPropertyValue(Object id, Object value) {
+ }
+
+}
17 years, 5 months
JBoss Tools SVN: r2416 - trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2007-07-12 21:35:13 -0400 (Thu, 12 Jul 2007)
New Revision: 2416
Removed:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/ProjectSelectionFieldEditor.java
Log:
Not used
Deleted: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/ProjectSelectionFieldEditor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/ProjectSelectionFieldEditor.java 2007-07-13 01:33:13 UTC (rev 2415)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/ProjectSelectionFieldEditor.java 2007-07-13 01:35:13 UTC (rev 2416)
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * 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.ui.widget.editor;
-
-/**
- * @author eskimo
- *
- */
-public class ProjectSelectionFieldEditor extends BaseFieldEditor {
-
- /**
- * @param name
- * @param label
- * @param defaultValue
- */
- public ProjectSelectionFieldEditor(String name, String label,
- Object defaultValue) {
- super(name, label, defaultValue);
- // TODO Auto-generated constructor stub
- }
-
- /* (non-Javadoc)
- * @see org.jboss.tools.seam.ui.widget.editor.BaseFieldEditor#doFillIntoGrid(java.lang.Object)
- */
- @Override
- public void doFillIntoGrid(Object parent) {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.jboss.tools.seam.ui.widget.editor.BaseFieldEditor#getEditorControls(java.lang.Object)
- */
- @Override
- public Object[] getEditorControls(Object composite) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.jboss.tools.seam.ui.widget.editor.BaseFieldEditor#getEditorControls()
- */
- @Override
- public Object[] getEditorControls() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.jboss.tools.seam.ui.widget.editor.IFieldEditor#isEditable()
- */
- public boolean isEditable() {
- // TODO Auto-generated method stub
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.jboss.tools.seam.ui.widget.editor.IFieldEditor#setEditable(boolean)
- */
- public void setEditable(boolean ediatble) {
- // TODO Auto-generated method stub
-
- }
-
-}
17 years, 5 months
JBoss Tools SVN: r2415 - in trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui: widget/editor and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2007-07-12 21:33:13 -0400 (Thu, 12 Jul 2007)
New Revision: 2415
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/IParameter.java
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/SeamBaseWizard.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizardPage.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectSelectionDialog.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardFactory.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardUtils.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SelectSeamProjectAction.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/operation/
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SwtFieldEditorFactory.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/BaseFieldEditor.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/ButtonFieldEditor.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/CheckBoxFieldEditor.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/ComboFieldEditor.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/CompositeEditor.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/IFieldEditorFactory.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/LabelFieldEditor.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/TaggedComboFieldEditor.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/field/ComboBoxField.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizard.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizardPage1.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizard.java
Log:
http://jira.jboss.org/jira/browse/EXIN-221
database parameters page updated to provide general information for supported DB
http://jira.jboss.org/jira/browse/EXIN-222
Initial implementation
http://jira.jboss.org/jira/browse/EXIN-223
Initial implementation
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java 2007-07-12 21:08:33 UTC (rev 2414)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java 2007-07-13 01:33:13 UTC (rev 2415)
@@ -14,6 +14,10 @@
import java.beans.PropertyChangeListener;
import java.util.Arrays;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.window.Window;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jst.j2ee.project.facet.IJ2EEModuleFacetInstallDataModelProperties;
import org.eclipse.swt.SWT;
@@ -21,6 +25,9 @@
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.ListDialog;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.frameworks.datamodel.IDataModelListener;
@@ -28,6 +35,7 @@
import org.eclipse.wst.common.project.facet.ui.IFacetWizardPage;
import org.hibernate.eclipse.console.utils.DriverClassHelpers;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
+import org.jboss.tools.seam.ui.widget.editor.ButtonFieldEditor;
import org.jboss.tools.seam.ui.widget.editor.IFieldEditor;
import org.jboss.tools.seam.ui.widget.editor.IFieldEditorFactory;
import org.jboss.tools.seam.ui.widget.editor.ITaggedFieldEditor;
@@ -227,21 +235,21 @@
validatorDelegate.addValidatorForProperty(pathToJdbcDriverJar.getName(), ValidatorFactory.FILESYSTEM_FILE_EXISTS_VALIDATOR);
jBossAsDbTypeEditor.addPropertyChangeListener(new PropertyChangeListener() {
-
public void propertyChange(PropertyChangeEvent evt) {
jBossHibernateDialectEditor.setValue(HIBERNATE_HELPER.getDialectClass(evt.getNewValue().toString()));
jdbcDriverClassname.setTags(HIBERNATE_HELPER.getDriverClasses(HIBERNATE_HELPER.getDialectClass(evt.getNewValue().toString())));
-
}
});
jdbcDriverClassname.addPropertyChangeListener(new PropertyChangeListener(){
-
public void propertyChange(PropertyChangeEvent evt) {
- jdbcUrlForDb.setTags(HIBERNATE_HELPER.getConnectionURLS(evt.getNewValue().toString()));
+ if(evt.getNewValue()==null) {
+ jdbcUrlForDb.setTags(new String[]{});
+ } else {
+ jdbcUrlForDb.setTags(HIBERNATE_HELPER.getConnectionURLS(evt.getNewValue().toString()));
+ }
}
});
-
}
/**
@@ -255,4 +263,5 @@
}
}
+
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SwtFieldEditorFactory.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SwtFieldEditorFactory.java 2007-07-12 21:08:33 UTC (rev 2414)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SwtFieldEditorFactory.java 2007-07-13 01:33:13 UTC (rev 2415)
@@ -96,6 +96,14 @@
return editor;
}
+
+ public IFieldEditor createButtonFieldEditor(String name, String label, String defaultValue, ButtonFieldEditor.ButtonPressedAction action, IValidator validator ) {
+ CompositeEditor editor = new CompositeEditor(name,label, defaultValue);
+ editor.addFieldEditors(new IFieldEditor[]{new LabelFieldEditor(name,label),
+ new TextFieldEditor(name,label, defaultValue),
+ new ButtonFieldEditor(name,action,defaultValue)});
+ return editor;
+ }
/**
*
* @param buttonName
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/BaseFieldEditor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/BaseFieldEditor.java 2007-07-12 21:08:33 UTC (rev 2414)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/BaseFieldEditor.java 2007-07-13 01:33:13 UTC (rev 2415)
@@ -14,7 +14,10 @@
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
+import org.eclipse.core.runtime.Assert;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
@@ -50,7 +53,29 @@
/**
*
+ * @param parent
*/
+ public void doFillIntoGrid(Object parent) {
+ Assert.isTrue(parent instanceof Composite, "Parent control should be Composite");
+ Assert.isTrue(((Composite)parent).getLayout() instanceof GridLayout,"Editor supports only grid layout");
+ Composite aComposite = (Composite) parent;
+ Control[] controls = (Control[])getEditorControls(aComposite);
+ GridLayout gl = (GridLayout)((Composite)parent).getLayout();
+
+ doFillIntoGrid(aComposite,gl.numColumns);
+ }
+
+ /**
+ * @param composite
+ * @param numColumns
+ */
+ protected void doFillIntoGrid(Composite composite, int numColumns) {
+
+ }
+
+ /**
+ *
+ */
public void addPropertyChangeListener(PropertyChangeListener listener) {
pcs.addPropertyChangeListener(listener);
}
@@ -85,10 +110,6 @@
public Label getLabelControl() {
return createLabelControl(null);
}
- /**
- *
- */
- abstract public void doFillIntoGrid(Object parent);
/**
*
@@ -111,9 +132,7 @@
/**
*
*/
- public int getNumberOfControls() {
- return getEditorControls().length;
- }
+ public abstract int getNumberOfControls();
/**
*
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/ButtonFieldEditor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/ButtonFieldEditor.java 2007-07-12 21:08:33 UTC (rev 2414)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/ButtonFieldEditor.java 2007-07-13 01:33:13 UTC (rev 2415)
@@ -93,4 +93,13 @@
run();
}
}
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.ui.widget.editor.BaseFieldEditor#getNumberOfControls()
+ */
+ @Override
+ public int getNumberOfControls() {
+ // TODO Auto-generated method stub
+ return 1;
+ }
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/CheckBoxFieldEditor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/CheckBoxFieldEditor.java 2007-07-12 21:08:33 UTC (rev 2414)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/CheckBoxFieldEditor.java 2007-07-13 01:33:13 UTC (rev 2415)
@@ -103,4 +103,13 @@
setValue(evt.getNewValue());
}
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.ui.widget.editor.BaseFieldEditor#getNumberOfControls()
+ */
+ @Override
+ public int getNumberOfControls() {
+ // TODO Auto-generated method stub
+ return 1;
+ }
+
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/ComboFieldEditor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/ComboFieldEditor.java 2007-07-12 21:08:33 UTC (rev 2414)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/ComboFieldEditor.java 2007-07-13 01:33:13 UTC (rev 2415)
@@ -22,7 +22,7 @@
import org.eclipse.swt.widgets.Control;
import org.jboss.tools.seam.ui.widget.field.ComboBoxField;
-public class ComboFieldEditor extends BaseFieldEditor implements PropertyChangeListener{
+public class ComboFieldEditor extends BaseFieldEditor implements ITaggedFieldEditor,PropertyChangeListener{
List values = null;
@@ -34,7 +34,7 @@
this.flat = flat;
}
- private Control comboControl;
+ private ComboBoxField comboField;
@Override
public Object[] getEditorControls(Object composite) {
@@ -48,14 +48,13 @@
public Control getComboControl(Composite composite) {
// TODO Auto-generated method stub
- if(comboControl == null) {
- ComboBoxField comboField = new ComboBoxField(composite,values,getValue(),flat);
- comboControl = comboField.getComboControl();
+ if(comboField == null) {
+ comboField = new ComboBoxField(composite,values,getValue(),flat);
comboField.addPropertyChangeListener(this);
} else if(composite!=null) {
- Assert.isTrue(comboControl.getParent()==composite);
+ Assert.isTrue(comboField.getControl().getParent()==composite);
}
- return comboControl;
+ return comboField.getControl();
}
@Override
@@ -64,23 +63,34 @@
return null;
}
- public boolean isEditable() {
- // TODO Auto-generated method stub
- return false;
+ public void save(Object object) {
}
- public void save(Object object) {
- // TODO Auto-generated method stub
+ public void propertyChange(PropertyChangeEvent evt) {
+ setValue(evt.getNewValue());
+ }
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.ui.widget.editor.ITaggedFieldEditor#getTags()
+ */
+ public String[] getTags() {
+ return comboField.getComboControl().getItems();
}
- public void setEditable(boolean ediatble) {
- // TODO Auto-generated method stub
-
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.ui.widget.editor.ITaggedFieldEditor#setTags(java.lang.String[])
+ */
+ public void setTags(String[] tags) {
+ comboField.setTags(tags);
}
- public void propertyChange(PropertyChangeEvent evt) {
- setValue(evt.getNewValue());
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.ui.widget.editor.BaseFieldEditor#getNumberOfControls()
+ */
+ @Override
+ public int getNumberOfControls() {
+ // TODO Auto-generated method stub
+ return 1;
}
-
+
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/CompositeEditor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/CompositeEditor.java 2007-07-12 21:08:33 UTC (rev 2414)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/CompositeEditor.java 2007-07-13 01:33:13 UTC (rev 2415)
@@ -50,8 +50,8 @@
@Override
public Object[] getEditorControls() {
- if(controls.size()>0) return controls.toArray();
- else throw new IllegalStateException("This metod can be invoked after getEditorControls(parent) only");
+ if(controls.size()>0) return controls.toArray();
+ else throw new IllegalStateException("This metod can be invoked after getEditorControls(parent) only");
}
@@ -62,6 +62,10 @@
return controls.toArray(new Control[]{});
}
+ public int getNumberOfControls() {
+ return editors.size();
+ }
+
public boolean isEditable() {
return true;
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/IFieldEditorFactory.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/IFieldEditorFactory.java 2007-07-12 21:08:33 UTC (rev 2414)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/IFieldEditorFactory.java 2007-07-13 01:33:13 UTC (rev 2415)
@@ -12,6 +12,7 @@
import java.util.List;
+import org.jboss.tools.seam.ui.internal.project.facet.IValidator;
import org.jboss.tools.seam.ui.internal.project.facet.SwtFieldEditorFactory;
public interface IFieldEditorFactory {
@@ -61,6 +62,7 @@
* @return
*/
IFieldEditor createBrowseFileEditor(String name, String label, String defaultValue);
+
/**
* @param jdbcDriverClassName
* @param string
@@ -69,5 +71,16 @@
*/
IFieldEditor createUneditableTextEditor(String jdbcDriverClassName,
String string, String string2);
+
+ /**
+ *
+ * @param name
+ * @param label
+ * @param defaultValue
+ * @param action
+ * @param validator
+ * @return
+ */
+ public IFieldEditor createButtonFieldEditor(String name, String label, String defaultValue, ButtonFieldEditor.ButtonPressedAction action, IValidator validator );
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/LabelFieldEditor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/LabelFieldEditor.java 2007-07-12 21:08:33 UTC (rev 2414)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/LabelFieldEditor.java 2007-07-13 01:33:13 UTC (rev 2415)
@@ -66,4 +66,13 @@
public void setValue(Object value) {
// supress parent method
}
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.ui.widget.editor.BaseFieldEditor#getNumberOfControls()
+ */
+ @Override
+ public int getNumberOfControls() {
+ // TODO Auto-generated method stub
+ return 1;
+ }
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/TaggedComboFieldEditor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/TaggedComboFieldEditor.java 2007-07-12 21:08:33 UTC (rev 2414)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/TaggedComboFieldEditor.java 2007-07-13 01:33:13 UTC (rev 2415)
@@ -45,9 +45,7 @@
* @see org.jboss.tools.seam.ui.widget.editor.ITaggedFieldEditor#setTags(java.lang.String[])
*/
public void setTags(String[] tags) {
- ((Combo)getEditorControls()[1]).setItems(tags);
- combo.setValue(tags.length==0? "":tags[0]);
- ((Combo)getEditorControls()[1]).getParent().layout(new Control[]{(Combo)getEditorControls()[1]});
+ combo.setTags(tags);
}
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/field/ComboBoxField.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/field/ComboBoxField.java 2007-07-12 21:08:33 UTC (rev 2414)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/field/ComboBoxField.java 2007-07-13 01:33:13 UTC (rev 2415)
@@ -11,11 +11,10 @@
package org.jboss.tools.seam.ui.widget.field;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import org.eclipse.jface.viewers.ComboViewer;
-import org.eclipse.jface.viewers.IBaseLabelProvider;
-import org.eclipse.jface.viewers.IContentProvider;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.ISelectionChangedListener;
@@ -115,5 +114,16 @@
return getComboControl();
}
+ public void setValue(Object newValue) {
+ comboControl.setSelection(new StructuredSelection(newValue));
+ comboControl.getCombo().setText(newValue.toString());
+ }
+ public void setTags(String[] tags) {
+ values = Arrays.asList(tags);
+ comboControl.removeSelectionChangedListener(this);
+ comboControl.refresh(true);
+ comboControl.addPostSelectionChangedListener(this);
+ comboControl.setSelection(new StructuredSelection(tags.length>0?tags[0]:new String[]{}));
+ }
}
Added: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/IParameter.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/IParameter.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/IParameter.java 2007-07-13 01:33:13 UTC (rev 2415)
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * 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.ui.wizard;
+
+/**
+ * @author eskimo
+ *
+ */
+public interface IParameter {
+
+ public static String SEAM_PROJECT_NAME = "seam.project.name";
+ public static String SEAM_COMPONENT_NAME = "seam.component.name";
+ public static String SEAM_LOCAL_INTERFACE_NAME = "seam.local.interface.name.";
+ public static String SEAM_BEAN_NAME = "seam.bean.name";
+ public static String SEAM_METHOD_NAME = "seam.method.name";
+ public static String SEAM_PAGE_NAME = "seam.page.name";
+ public static String SEAM_MASTER_PAGE_NAME = "seam.master.page.name";
+
+}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizard.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizard.java 2007-07-12 21:08:33 UTC (rev 2414)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizard.java 2007-07-13 01:33:13 UTC (rev 2415)
@@ -10,26 +10,37 @@
******************************************************************************/
package org.jboss.tools.seam.ui.wizard;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
+import java.util.Map;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.IUndoableOperation;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IWorkbench;
-public class SeamActionWizard extends Wizard implements INewWizard {
+public class SeamActionWizard extends SeamBaseWizard implements INewWizard {
public SeamActionWizard() {
- // TODO Auto-generated constructor stub
+ super(CREATE_SEAM_ACTION);
+ setWindowTitle("Create New Action");
+ //setDefaultPageImageDescriptor();
+ addPage(new SeamActionWizardPage1());
+
}
- @Override
- public boolean performFinish() {
- // TODO Auto-generated method stub
- return false;
- }
+ // TODO move operations to core plugin
+ public static final IUndoableOperation CREATE_SEAM_ACTION = new SeamBaseOperation("Action creating operation"){
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- // TODO Auto-generated method stub
+ @Override
+ public IStatus execute(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+ Map params = (Map)info.getAdapter(Map.class);
+
+ return Status.OK_STATUS;
+ }
+
+ };
- }
-
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizardPage1.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizardPage1.java 2007-07-12 21:08:33 UTC (rev 2414)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizardPage1.java 2007-07-13 01:33:13 UTC (rev 2415)
@@ -11,21 +11,31 @@
package org.jboss.tools.seam.ui.wizard;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.PlatformUI;
+import org.jboss.tools.seam.ui.internal.project.facet.SwtFieldEditorFactory;
+import org.jboss.tools.seam.ui.internal.project.facet.ValidatorFactory;
+import org.jboss.tools.seam.ui.widget.editor.IFieldEditor;
/**
* @author eskimo
*
*/
-public class SeamActionWizardPage1 extends WizardPage {
+public class SeamActionWizardPage1 extends SeamBaseWizardPage {
- /**
- * @param pageName
- */
+
+ public SeamActionWizardPage1(String pageName, String title,
+ ImageDescriptor titleImage) {
+ super(pageName, title, titleImage);
+ }
+
public SeamActionWizardPage1(String pageName) {
super(pageName);
- // TODO Auto-generated constructor stub
}
/**
@@ -33,18 +43,8 @@
* @param title
* @param titleImage
*/
- public SeamActionWizardPage1(String pageName, String title,
- ImageDescriptor titleImage) {
- super(pageName, title, titleImage);
- // TODO Auto-generated constructor stub
+ public SeamActionWizardPage1() {
+ super("Create New Action", "Create a new Java interface and SLSB with key Seam/EJB annotations.", null);
+ addEditors(SeamWizardFactory.createDefaultWizardEditors(SeamWizardUtils.getSelectedProjectName()));
}
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
- // TODO Auto-generated method stub
-
- }
-
}
Added: 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 (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseOperation.java 2007-07-13 01:33:13 UTC (rev 2415)
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * 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.ui.wizard;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.AbstractOperation;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+
+/**
+ * @author eskimo
+ *
+ */
+public class SeamBaseOperation extends AbstractOperation {
+
+ /**
+ * @param label
+ */
+ public SeamBaseOperation(String label) {
+ super(label);
+ // TODO Auto-generated constructor stub
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+ */
+ @Override
+ public IStatus execute(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+ throw new IllegalStateException("Execute method should be overiden");
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+ */
+ @Override
+ public IStatus redo(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+ return Status.OK_STATUS;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+ */
+ @Override
+ public IStatus undo(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+ return Status.OK_STATUS;
+ }
+
+ @Override
+ public boolean canRedo() {
+ return false;
+ }
+
+ @Override
+ public boolean canUndo() {
+ return false;
+ }
+}
Added: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizard.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizard.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizard.java 2007-07-13 01:33:13 UTC (rev 2415)
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * 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.ui.wizard;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.IOperationHistory;
+import org.eclipse.core.commands.operations.IUndoContext;
+import org.eclipse.core.commands.operations.IUndoableOperation;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.actions.WorkspaceModifyOperation;
+import org.eclipse.wst.common.frameworks.internal.ui.RunnableWithProgressWrapper;
+import org.jboss.tools.seam.core.SeamCorePlugin;
+
+/**
+ * @author eskimo
+ *
+ */
+public abstract class SeamBaseWizard extends Wizard {
+
+ private IUndoableOperation operation;
+
+ private IWorkbench workbench;
+
+ /**
+ *
+ * @param operation
+ */
+ public SeamBaseWizard(IUndoableOperation operation) {
+ this.operation = operation;
+ }
+
+ /**
+ *
+ */
+ @Override
+ public boolean performFinish() {
+ try {
+ getContainer().run(false,false, new WorkspaceModifyOperation(){
+ @Override
+ protected void execute(IProgressMonitor monitor)
+ throws CoreException, InvocationTargetException,
+ InterruptedException {
+ IUndoableOperation operation = getOperation();
+ IOperationHistory operationHistory = workbench.getOperationSupport().getOperationHistory();
+ IUndoContext undoContext = workbench.getOperationSupport().getUndoContext();
+ operation.addContext(undoContext);
+ try {
+ operationHistory.execute(operation, monitor, (IAdaptable)getPages()[0]);
+ } catch (ExecutionException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+ }
+ });
+ } catch (Exception e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+ return true;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public IUndoableOperation getOperation() {
+ throw new IllegalStateException("Operation is not defined for wizard");
+ }
+
+ /**
+ *
+ * @param workbench
+ * @param selection
+ */
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ this.workbench = workbench;
+ }
+}
Added: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizardPage.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizardPage.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizardPage.java 2007-07-13 01:33:13 UTC (rev 2415)
@@ -0,0 +1,119 @@
+/*******************************************************************************
+ * 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.ui.wizard;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.jboss.tools.seam.ui.widget.editor.IFieldEditor;
+
+/**
+ * @author eskimo
+ *
+ */
+public class SeamBaseWizardPage extends WizardPage implements IAdaptable {
+
+ /**
+ *
+ * @param pageName
+ * @param title
+ * @param titleImage
+ */
+ public SeamBaseWizardPage(String pageName, String title,
+ ImageDescriptor titleImage) {
+ super(pageName, title, titleImage);
+ }
+
+ /**
+ * @param pageName
+ */
+ protected SeamBaseWizardPage(String pageName) {
+ super(pageName);
+
+ }
+
+ Map<String,IFieldEditor> editorRegistry = new HashMap<String,IFieldEditor>();
+
+ List<IFieldEditor> editorOrder = new ArrayList<IFieldEditor>();
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ setControl(new GridLayoutComposite(parent));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
+ */
+ public Object getAdapter(Class adapter) {
+ if(adapter == Map.class)
+ return editorRegistry;
+ return null;
+ }
+
+ /**
+ *
+ * @param id
+ * @param editor
+ */
+ public void addEditor(IFieldEditor editor) {
+ editorRegistry.put(editor.getName(), editor);
+ editorOrder.add(editor);
+ }
+ /**
+ *
+ * @param id
+ * @param editor
+ */
+ public void addEditors(IFieldEditor[] editors) {
+ for (IFieldEditor fieldEditor : editors) {
+ editorRegistry.put(fieldEditor.getName(), fieldEditor);
+ editorOrder.add(fieldEditor);
+ }
+ }
+
+ /**
+ *
+ * @author eskimo
+ *
+ */
+ public class GridLayoutComposite extends Composite {
+
+ public GridLayoutComposite(Composite parent, int style) {
+ super(parent, style);
+ int columnNumber = 1;
+ for (IFieldEditor fieldEditor : editorOrder) {
+ if(fieldEditor.getNumberOfControls()>columnNumber)
+ columnNumber=fieldEditor.getNumberOfControls();
+ }
+ GridLayout gl = new GridLayout(columnNumber,false);
+ setLayout(gl);
+ for (IFieldEditor fieldEditor2 : editorOrder) {
+ fieldEditor2.doFillIntoGrid(this);
+ }
+ }
+
+ public GridLayoutComposite(Composite parent) {
+ this(parent, SWT.NONE);
+
+ }
+ }
+}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizard.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizard.java 2007-07-12 21:08:33 UTC (rev 2414)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizard.java 2007-07-13 01:33:13 UTC (rev 2415)
@@ -10,26 +10,37 @@
******************************************************************************/
package org.jboss.tools.seam.ui.wizard;
+import java.util.Map;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.IUndoableOperation;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
-public class SeamConversationWizard extends Wizard implements INewWizard {
+public class SeamConversationWizard extends SeamBaseWizard implements INewWizard {
public SeamConversationWizard() {
- // TODO Auto-generated constructor stub
+ super(CREATE_SEAM_CONVERSATION);
+ setWindowTitle("reate New Conversation");
+ addPage(new SeamActionWizardPage1());
}
- @Override
- public boolean performFinish() {
- // TODO Auto-generated method stub
- return false;
- }
+ public static final IUndoableOperation CREATE_SEAM_CONVERSATION = new SeamBaseOperation("Action creating operation"){
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- // TODO Auto-generated method stub
+ @Override
+ public IStatus execute(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+ Map params = (Map)info.getAdapter(Map.class);
+
+ return Status.OK_STATUS;
+ }
+
+ };
- }
-
}
Added: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectSelectionDialog.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectSelectionDialog.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectSelectionDialog.java 2007-07-13 01:33:13 UTC (rev 2415)
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * 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.ui.wizard;
+
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.dialogs.ListDialog;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+
+/**
+ * @author eskimo
+ *
+ */
+public class SeamProjectSelectionDialog extends ListDialog implements ISelectionChangedListener {
+
+ /**
+ * @param parent
+ */
+ public SeamProjectSelectionDialog(Shell parent) {
+ super(parent);
+ setTitle("Seam Projects");
+ setMessage("Select Seam Project");
+ setLabelProvider(new WorkbenchLabelProvider());
+ setInput(new Object());
+ setContentProvider(new IStructuredContentProvider() {
+ public Object[] getElements(Object inputElement) {
+ return ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ }
+ public void dispose() {
+ }
+ public void inputChanged(Viewer viewer,
+ Object oldInput, Object newInput) {
+ }
+ });
+ }
+
+ /**
+ *
+ */
+ @Override
+ protected void createButtonsForButtonBar(Composite parent) {
+ super.createButtonsForButtonBar(parent);
+ getOkButton().setEnabled(false);
+ getTableViewer().addSelectionChangedListener(this);
+ }
+
+ /**
+ *
+ */
+ public void selectionChanged(SelectionChangedEvent event) {
+ getOkButton().setEnabled(!event.getSelection().isEmpty());
+ }
+}
Added: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardFactory.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardFactory.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardFactory.java 2007-07-13 01:33:13 UTC (rev 2415)
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * 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.ui.wizard;
+
+import org.eclipse.core.resources.IProject;
+import org.jboss.tools.seam.ui.internal.project.facet.SwtFieldEditorFactory;
+import org.jboss.tools.seam.ui.internal.project.facet.ValidatorFactory;
+import org.jboss.tools.seam.ui.widget.editor.IFieldEditor;
+import org.jboss.tools.seam.ui.widget.editor.ButtonFieldEditor.ButtonPressedAction;
+
+/**
+ * @author eskimo
+ *
+ */
+public class SeamWizardFactory {
+ public static IFieldEditor createSeamProjctSelectionFieldEditor(
+ String defaultSelection) {
+ return SwtFieldEditorFactory.INSTANCE.createButtonFieldEditor(
+ IParameter.SEAM_PROJECT_NAME, "Seam Project:", defaultSelection,
+ new SelectSeamProjectAction(), ValidatorFactory.NO_ERRORS_VALIDATOR);
+ }
+
+ /**
+ * @return
+ */
+ public static IFieldEditor createSeamLocalInterfaceNameFieldEditor() {
+ // TODO Auto-generated method stub
+ return SwtFieldEditorFactory.INSTANCE.createTextEditor(
+ IParameter.SEAM_LOCAL_INTERFACE_NAME, "Local interface name:", "");
+ }
+
+ /**
+ * @return
+ */
+ public static IFieldEditor createSeamBeanNameFieldEditor() {
+ return SwtFieldEditorFactory.INSTANCE.createTextEditor(
+ IParameter.SEAM_BEAN_NAME, "Bean name:", "");
+
+ }
+
+ /**
+ * @return
+ */
+ public static IFieldEditor createSeamMethodNameFieldEditor() {
+ return SwtFieldEditorFactory.INSTANCE.createTextEditor(
+ IParameter.SEAM_METHOD_NAME, "Method name:", "");
+
+ }
+
+ /**
+ * @return
+ */
+ public static IFieldEditor createSeamPageNameFieldEditor() {
+ return SwtFieldEditorFactory.INSTANCE.createTextEditor(
+ IParameter.SEAM_PAGE_NAME, "Page name:", "");
+ }
+
+ /**
+ * @return
+ */
+ public static IFieldEditor createSeamMasterPageNameFieldEditor() {
+ return SwtFieldEditorFactory.INSTANCE.createTextEditor(
+ IParameter.SEAM_PAGE_NAME, "Master page name:", "");
+ }
+
+ public static final IFieldEditor[] createDefaultWizardEditors(String defaultSelection) {
+ return new IFieldEditor[]{
+ SeamWizardFactory.createSeamProjctSelectionFieldEditor(SeamWizardUtils.getSelectedProjectName()),
+ SeamWizardFactory.createSeamLocalInterfaceNameFieldEditor(),
+ SeamWizardFactory.createSeamBeanNameFieldEditor(),
+ SeamWizardFactory.createSeamMethodNameFieldEditor(),
+ SeamWizardFactory.createSeamPageNameFieldEditor()
+ };
+ }
+}
Added: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardUtils.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardUtils.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardUtils.java 2007-07-13 01:33:13 UTC (rev 2415)
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * 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.ui.wizard;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @author eskimo
+ *
+ */
+public class SeamWizardUtils {
+
+ /**
+ * @return
+ */
+ public static String getSelectedProjectName() {
+ ISelection sel =
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
+ if(sel != null && sel instanceof IStructuredSelection) {
+ IStructuredSelection structSel = (IStructuredSelection)sel;
+ Object selElem = structSel.getFirstElement();
+ if(selElem instanceof IAdaptable) {
+ IProject project = (IProject)((IAdaptable)selElem).getAdapter(IProject.class);
+ if(project!=null)return project.getName();
+ }
+ }
+ return "";
+ }
+
+}
Added: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SelectSeamProjectAction.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SelectSeamProjectAction.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SelectSeamProjectAction.java 2007-07-13 01:33:13 UTC (rev 2415)
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * 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.ui.wizard;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.dialogs.ListDialog;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+import org.jboss.tools.seam.ui.widget.editor.ButtonFieldEditor;
+
+public class SelectSeamProjectAction extends ButtonFieldEditor.ButtonPressedAction {
+
+ /**
+ * @param label
+ */
+ public SelectSeamProjectAction() {
+ super("Browse");
+ // TODO Auto-generated constructor stub
+ }
+
+ @Override
+ public void run() {
+ ListDialog dialog = new SeamProjectSelectionDialog(
+ Display.getCurrent().getActiveShell());
+ if(!"".equals(this.getFieldEditor().getValueAsString()))
+ dialog.setInitialSelections(new Object[] {
+ ResourcesPlugin.getWorkspace().getRoot().getProject(this.getFieldEditor().getValueAsString())});
+ if (dialog.open() == Window.CANCEL) {
+ return;
+ }
+ getFieldEditor().setValue(((IProject)dialog.getResult()[0]).getName());
+ }
+}
\ No newline at end of file
17 years, 5 months
JBoss Tools SVN: r2414 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages.
by jbosstools-commits@lists.jboss.org
Author: mculpepper(a)jboss.com
Date: 2007-07-12 17:08:33 -0400 (Thu, 12 Jul 2007)
New Revision: 2414
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/ArchivesModelModuleContributor.java
Log:
added a null check for "mods" .. if it's null, the module creation step never happens for new projects / new packages
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/ArchivesModelModuleContributor.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/ArchivesModelModuleContributor.java 2007-07-12 17:19:28 UTC (rev 2413)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/ArchivesModelModuleContributor.java 2007-07-12 21:08:33 UTC (rev 2414)
@@ -84,11 +84,14 @@
ArrayList mods = (ArrayList)projectToModules.get(projectLoc);
IModule mod;
IArchive arc;
- for( Iterator i = mods.iterator(); i.hasNext();) {
- mod = (IModule)i.next();
- arc = ((PackagedModuleDelegate)moduleDelegates.get(mod)).getPackage();
- packageToModule.remove(arc);
- moduleDelegates.remove(mod);
+ if (mods != null)
+ {
+ for( Iterator i = mods.iterator(); i.hasNext();) {
+ mod = (IModule)i.next();
+ arc = ((PackagedModuleDelegate)moduleDelegates.get(mod)).getPackage();
+ packageToModule.remove(arc);
+ moduleDelegates.remove(mod);
+ }
}
createModules(findProject(projectLoc));
factory.clearModuleCache();
17 years, 5 months
JBoss Tools SVN: r2413 - trunk/seam/plugins/org.jboss.tools.seam.ui.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-07-12 13:19:28 -0400 (Thu, 12 Jul 2007)
New Revision: 2413
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml
Log:
EXIN-218 Properties of component added.
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml 2007-07-12 17:19:04 UTC (rev 2412)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml 2007-07-12 17:19:28 UTC (rev 2413)
@@ -150,4 +150,13 @@
</navigatorContent>
</extension>
+<extension point="org.eclipse.core.runtime.adapters">
+ <factory
+ class="org.jboss.tools.seam.ui.views.properties.SeamElementAdapterFactory"
+ adaptableType="org.jboss.tools.seam.core.ISeamElement">
+
+ <adapter type="org.eclipse.ui.views.properties.IPropertySource"/>
+ </factory>
+</extension>
+
</plugin>
17 years, 5 months