JBoss Tools SVN: r2382 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-07-11 08:07:52 -0400 (Wed, 11 Jul 2007)
New Revision: 2382
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/TypeScanner.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/LibraryScanner.java
Log:
EXIN-217 ClassFileReader used to scan classes in jars for seam components.
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/LibraryScanner.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/LibraryScanner.java 2007-07-11 11:51:04 UTC (rev 2381)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/LibraryScanner.java 2007-07-11 12:07:52 UTC (rev 2382)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.seam.internal.core.scanner.lib;
+import java.io.ByteArrayInputStream;
import java.util.HashMap;
import java.util.Map;
@@ -25,6 +26,8 @@
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader;
+import org.eclipse.jdt.internal.compiler.env.IBinaryAnnotation;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.filesystems.impl.FileSystemsImpl;
import org.jboss.tools.common.model.plugin.ModelPlugin;
@@ -155,36 +158,77 @@
process((IPackageFragment)es[i], ds);
} else if(es[i] instanceof IClassFile) {
IClassFile typeRoot = (IClassFile)es[i];
- IType type = typeRoot.getType();
- String className = type.getFullyQualifiedName();
- if(className.equals("org.jboss.seam.core.TransactionListener")) {
-// System.out.println("!!");
- }
-
- Class<?> cls = null;
- try {
- cls = classPath.getClassLoader().loadClass(className);
- } catch (NoClassDefFoundError e) {
- //ignore
- } catch (ClassNotFoundException e) {
- //ignore
- }
- if(cls == null) continue;
- if(!CLASS_SCANNER.isLikelyComponentSource(cls)) continue;
- LoadedDeclarations ds1 = null;
- try {
- ds1 = CLASS_SCANNER.parse(type, cls, sourcePath);
- } catch (Exception e) {
- SeamCorePlugin.getPluginLog().logError(e);
- }
- if(ds1 != null) {
- ds.add(ds1);
- }
-// System.out.println(className);
+ processWithClassReader(typeRoot, ds);
+// processWithClassLoader(typeRoot, ds);
}
}
}
+ void processWithClassReader(IClassFile typeRoot, LoadedDeclarations ds) {
+ IType type = typeRoot.getType();
+
+ String className = type.getFullyQualifiedName();
+
+ byte[] bs = null;
+
+ try {
+ bs = typeRoot.getBytes();
+ } catch (JavaModelException e) {
+ return;
+ }
+
+ ClassFileReader reader = null;
+
+ try {
+ reader = ClassFileReader.read(new ByteArrayInputStream(bs), className, false);
+ } catch (Throwable t) {
+ //ignore
+ }
+
+ if(reader == null) return;
+ LoadedDeclarations ds1 = null;
+
+ TypeScanner scanner = new TypeScanner();
+ try {
+ if(!scanner.isLikelyComponentSource(reader)) return;
+ ds1 = scanner.parse(type, reader, sourcePath);
+ } catch (Throwable t) {
+ System.out.println("failed " + className);
+// SeamCorePlugin.getPluginLog().logError(t);
+ }
+
+ if(ds1 != null) {
+// System.out.println("declarations found in " + className);
+ ds.add(ds1);
+ }
+ }
+ void processWithClassLoader(IClassFile typeRoot, LoadedDeclarations ds) {
+ IType type = typeRoot.getType();
+ String className = type.getFullyQualifiedName();
+
+ Class<?> cls = null;
+ try {
+ cls = classPath.getClassLoader().loadClass(className);
+ } catch (NoClassDefFoundError e) {
+ //ignore
+ } catch (ClassNotFoundException e) {
+ //ignore
+ }
+ if(cls == null) return;
+ if(!CLASS_SCANNER.isLikelyComponentSource(cls)) return;
+ LoadedDeclarations ds1 = null;
+ try {
+ ds1 = CLASS_SCANNER.parse(type, cls, sourcePath);
+ } catch (Exception e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+ if(ds1 != null) {
+ ds.add(ds1);
+ }
+// System.out.println(className);
+ }
+
+
}
Added: 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 (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/TypeScanner.java 2007-07-11 12:07:52 UTC (rev 2382)
@@ -0,0 +1,274 @@
+package org.jboss.tools.seam.internal.core.scanner.lib;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.IMember;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
+import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader;
+import org.eclipse.jdt.internal.compiler.env.EnumConstantSignature;
+import org.eclipse.jdt.internal.compiler.env.IBinaryAnnotation;
+import org.eclipse.jdt.internal.compiler.env.IBinaryElementValuePair;
+import org.eclipse.jdt.internal.compiler.env.IBinaryField;
+import org.eclipse.jdt.internal.compiler.env.IBinaryMethod;
+import org.eclipse.jdt.internal.compiler.impl.Constant;
+import org.eclipse.jdt.internal.compiler.impl.IntConstant;
+import org.eclipse.jdt.internal.compiler.impl.StringConstant;
+import org.jboss.tools.seam.core.BijectedAttributeType;
+import org.jboss.tools.seam.core.SeamCorePlugin;
+import org.jboss.tools.seam.internal.core.AbstractContextVariable;
+import org.jboss.tools.seam.internal.core.BijectedAttribute;
+import org.jboss.tools.seam.internal.core.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.java.SeamAnnotations;
+
+public class TypeScanner implements SeamAnnotations {
+
+ /**
+ * Checks if class may be a source of seam components.
+ * @param f
+ * @return
+ */
+ public boolean isLikelyComponentSource(ClassFileReader cls) {
+ return cls != null && isSeamAnnotatedClass(cls);
+ }
+
+ /**
+ * Loads seam components from class.
+ * Returns object that contains loaded components or null;
+ * @param type
+ * @param cls
+ * @param path
+ * @return
+ */
+ public LoadedDeclarations parse(IType type, ClassFileReader cls, IPath path) {
+ if(!isLikelyComponentSource(cls)) return null;
+ LoadedDeclarations ds = new LoadedDeclarations();
+
+ SeamJavaComponentDeclaration component = new SeamJavaComponentDeclaration();
+ component.setSourcePath(path);
+ component.setId(type);
+ component.setType(type);
+ component.setClassName(type.getFullyQualifiedName());
+ process(cls, component, ds);
+
+ ds.getComponents().add(component);
+ for (int i = 0; i < ds.getFactories().size(); i++) {
+ AbstractContextVariable f = (AbstractContextVariable)ds.getFactories().get(i);
+ f.setSourcePath(path);
+ f.getId();
+ }
+ return ds;
+ }
+
+ /**
+ * Check if class has at least one seam annotation.
+ * @param cls
+ * @return
+ */
+ boolean isSeamAnnotatedClass(ClassFileReader cls) {
+ if(cls == null || ((cls.getModifiers() & ClassFileConstants.AccInterface) > 0)) return false;
+ 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)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ protected String getTypeName(IBinaryAnnotation a) {
+ if(a.getTypeName() == null) return "";
+ String t = new String(a.getTypeName());
+ if(t.startsWith("L") && t.endsWith(";")) {
+ t = t.substring(1, t.length() - 1);
+ }
+ t = t.replace('/', '.');
+
+ return t;
+ }
+
+ Map<String,IBinaryAnnotation> getSeamAnnotations(IBinaryAnnotation[] as) {
+ if(as == null || as.length == 0) return null;
+ 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(map == null) map = new HashMap<String, IBinaryAnnotation>();
+ map.put(type, as[i]);
+ }
+ }
+ return map;
+ }
+
+ private void process(ClassFileReader cls, SeamJavaComponentDeclaration component, LoadedDeclarations ds) {
+ Map<String, IBinaryAnnotation> map = getSeamAnnotations(cls.getAnnotations());
+ if(map != null) {
+ IBinaryAnnotation a = map.get(NAME_ANNOTATION_TYPE);
+ if(a != null) {
+ String name = (String)getValue(a, "value");
+ if(name != null) component.setName(name);
+ }
+ a = map.get(SCOPE_ANNOTATION_TYPE);
+ if(a != null) {
+ Object scope = getValue(a, "value");
+ if(scope != null) component.setScope(scope.toString());
+ }
+ a = map.get(INSTALL_ANNOTATION_TYPE);
+ if(a != null) {
+ Object precedence = getValue(a, "precedence");
+ if(precedence instanceof Integer) component.setPrecedence((Integer)precedence);
+ }
+ a = map.get(STATEFUL_ANNOTATION_TYPE);
+ if(a != null) {
+ component.setStateful(true);
+ }
+ }
+ IBinaryMethod[] ms = null;
+ try {
+ ms = cls.getMethods();
+ } catch (NoClassDefFoundError e) {
+ //ignore
+ }
+ if(ms != null) for (int i = 0; i < ms.length; i++) {
+ process(ms[i], component, ds);
+ }
+
+ IBinaryField[] fs = null;
+ try {
+ fs = cls.getFields();
+ } catch (NoClassDefFoundError e) {
+ //ignore
+ }
+ if(fs != null) for (int i = 0; i < fs.length; i++) {
+ //TODO
+ }
+ }
+
+ private void process(IBinaryMethod m, SeamJavaComponentDeclaration component, LoadedDeclarations ds) {
+ Map<String,IBinaryAnnotation> map = getSeamAnnotations(m.getAnnotations());
+ if(map == null || map.isEmpty()) return;
+ IBinaryAnnotation a = map.get(FACTORY_ANNOTATION_TYPE);
+ if(a != null) {
+ processFactory(m, a, component, ds);
+ }
+ IBinaryAnnotation in = map.get(IN_ANNOTATION_TYPE);
+ IBinaryAnnotation out = map.get(OUT_ANNOTATION_TYPE);
+ if(in != null || out != null) {
+ processBijection(m, in, out, component, ds);
+ }
+ }
+
+ private void processFactory(IBinaryMethod m, IBinaryAnnotation a, SeamJavaComponentDeclaration component, LoadedDeclarations ds) {
+ if(a == null) return;
+ String name = (String)getValue(a, "value");
+ if(name == null || name.length() == 0) {
+ name = new String(m.getSelector());
+ }
+ SeamAnnotatedFactory factory = new SeamAnnotatedFactory();
+ ds.getFactories().add(factory);
+ IMethod im = findIMethod(component, m);
+
+ factory.setId(im);
+ factory.setSourceMember(im);
+ factory.setName(name);
+
+ Object scope = getValue(a, "scope");
+ if(scope != null) factory.setScopeAsString(scope.toString());
+ Object autoCreate = getValue(a, "autoCreate");
+ if(autoCreate instanceof Boolean) {
+ factory.setAutoCreate((Boolean)autoCreate);
+ }
+ }
+
+ private void processBijection(IBinaryMethod m, IBinaryAnnotation in, IBinaryAnnotation out, SeamJavaComponentDeclaration component, LoadedDeclarations ds) {
+ if(in == null && out == null) return;
+ BijectedAttribute att = new BijectedAttribute();
+ component.addBijectedAttribute(att);
+
+ BijectedAttributeType[] types = (in == null) ? new BijectedAttributeType[]{BijectedAttributeType.OUT}
+ : (out == null) ? new BijectedAttributeType[]{BijectedAttributeType.IN}
+ : new BijectedAttributeType[]{BijectedAttributeType.IN, BijectedAttributeType.OUT};
+ att.setTypes(types);
+
+ String name = (String)getValue(in != null ? in : out, "value");
+ if(name == null || name.length() == 0) {
+ name = new String(m.getSelector());
+ }
+ att.setName(name);
+ Object scope = getValue(in != null ? in : out, "scope");
+ if(scope != null) att.setScopeAsString(scope.toString());
+
+ IMember im = findIMethod(component, m);
+ att.setSourceMember(im);
+
+ }
+
+ private String getValue(IBinaryAnnotation a, String method) {
+ try {
+ IBinaryElementValuePair[] ps = a.getElementValuePairs();
+ if(ps != null) for (int i = 0; i < ps.length; i++) {
+ if(method.equals(new String(ps[i].getName()))) {
+ Object v = ps[i].getValue();
+ if(v == null) return null;
+ if(v instanceof EnumConstantSignature) {
+ EnumConstantSignature cs = (EnumConstantSignature)v;
+ char[] cv = cs.getEnumConstantName();
+ return cv == null ? null : new String(cv);
+ } else if(v instanceof Constant) {
+ Constant ic = (Constant)v;
+ return ic.stringValue();
+ }
+ v = v.toString();
+ return (String)v;
+ }
+ }
+ } catch (Throwable e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+ return null;
+ }
+
+ private IMethod findIMethod(SeamJavaComponentDeclaration component, IBinaryMethod m) {
+ String name = new String(m.getSelector());
+ IType type = (IType)component.getSourceMember();
+ String signature = new String(m.getMethodDescriptor());
+ IMethod im = null;
+ IMethod[] ms = null;
+ try {
+ ms = type.getMethods();
+ } catch (Exception e) {
+ //ignore
+ }
+ if(ms != null) for (int i = 0; i < ms.length; i++) {
+ if(!ms[i].getElementName().equals(name)) continue;
+ //check parameters
+ try {
+ if(ms[i].getParameterNames().length != m.getArgumentNames().length) continue;
+ } catch (Exception e) {
+ continue;
+ }
+ //compare
+ return ms[i];
+ }
+ return null;
+ }
+
+ private IField findIField(SeamJavaComponentDeclaration component, Field m) {
+ IType type = (IType)component.getSourceMember();
+ return type.getField(m.getName());
+ }
+
+}
17 years, 5 months
JBoss Tools SVN: r2381 - in trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors: model and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2007-07-11 07:51:04 -0400 (Wed, 11 Jul 2007)
New Revision: 2381
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/figures/ComponentFigure.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ComponentShapeEditPart.java
Log:
http://jira.jboss.com/jira/browse/EXIN-367
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/figures/ComponentFigure.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/figures/ComponentFigure.java 2007-07-11 08:33:20 UTC (rev 2380)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/figures/ComponentFigure.java 2007-07-11 11:51:04 UTC (rev 2381)
@@ -38,6 +38,11 @@
}
public void setChildsHiden(boolean childsHiden) {
+
this.childsHiden = childsHiden;
+ for(int i=0;i<getChildren().size();i++){
+ if(getChildren().get(i) instanceof TitleLabel)
+ ((TitleLabel)getChildren().get(i)).setHiden(childsHiden);
+ }
}
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2007-07-11 08:33:20 UTC (rev 2380)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2007-07-11 11:51:04 UTC (rev 2381)
@@ -344,10 +344,16 @@
Collection collection = (Collection)property.getValue();
Value component = collection.getElement();
if (component instanceof Component) {
- getOrCreateComponentClass(property);
+ Component comp = (Component)((Collection)property.getValue()).getElement();
+ if (comp != null) {
+ OrmShape classShape = createShape(property);
+ OrmShape tableShape = (OrmShape)elements.get(component.getTable().getSchema() + "." + component.getTable().getName());
+ removeLinks(tableShape);
+ elements.remove(component.getTable().getSchema() + "." + component.getTable().getName());
+ }
} else if (collection.isOneToMany()) {
OneToMany comp = (OneToMany)((Collection)property.getValue()).getElement();
- if (component != null){
+ if (comp != null){
Shape sh = elements.get(comp.getAssociatedClass().getTable().getSchema() + "." + comp.getAssociatedClass().getTable().getName());
removeLinks(sh);
elements.remove(comp.getAssociatedClass().getTable().getSchema() + "." + comp.getAssociatedClass().getTable().getName());
@@ -356,7 +362,27 @@
elements.remove(comp.getAssociatedClass().getClassName());
}
} else if (collection.isMap() || collection.isSet()) {
- getOrCreateDatabaseTable(collection.getCollectionTable());
+ Table databaseTable = collection.getCollectionTable();
+ OrmShape tableShape = null;
+ if(databaseTable != null) {
+ String tableName = databaseTable.getSchema() + "." + databaseTable.getName();
+ tableShape = (OrmShape)elements.get(tableName);
+ if(tableShape != null) {
+ Iterator iterator = getConfiguration().getClassMappings();
+ while (iterator.hasNext()) {
+ Object clazz = iterator.next();
+ if (clazz instanceof RootClass) {
+ RootClass cls = (RootClass)clazz;
+ Table table = cls.getTable();
+ if (tableName.equals(table.getName() + "." + table.getName())) {
+ if (elements.get(cls.getClassName()) != null)
+ elements.remove(cls.getClassName());
+ }
+ }
+ }
+ elements.remove(tableName);
+ }
+ }
}
}
removeLinks(reference);
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ComponentShapeEditPart.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ComponentShapeEditPart.java 2007-07-11 08:33:20 UTC (rev 2380)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ComponentShapeEditPart.java 2007-07-11 11:51:04 UTC (rev 2381)
@@ -26,6 +26,7 @@
import org.eclipse.gef.RequestConstants;
import org.eclipse.swt.graphics.RGB;
import org.jboss.tools.hibernate.ui.veditor.editors.figures.ComponentFigure;
+import org.jboss.tools.hibernate.ui.veditor.editors.figures.TitleLabel;
import org.jboss.tools.hibernate.ui.veditor.editors.model.ComponentShape;
import org.jboss.tools.hibernate.ui.veditor.editors.model.OrmDiagram;
@@ -36,7 +37,7 @@
if (getModel() instanceof ComponentShape) {
IFigure figure = new ComponentFigure();
figure.setLayoutManager(new ToolbarLayout());
- Label label = new Label();
+ Label label = new TitleLabel();
label.setText(ormLabelProvider.getText(getCastedModel().getOrmElement()));
label.setBackgroundColor(getColor());
label.setOpaque(true);
@@ -63,6 +64,7 @@
if (ComponentShape.SET_CHILDS_HIDEN.equals(prop)) {
int i = figure.getPreferredSize().width;
((ComponentFigure)figure).setChildsHiden(((Boolean)evt.getNewValue()).booleanValue());
+
if(((Boolean)evt.getNewValue()).booleanValue())
figure.setSize(i,-1);
else
17 years, 5 months
JBoss Tools SVN: r2380 - in trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui: widget/editor and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2007-07-11 04:33:20 -0400 (Wed, 11 Jul 2007)
New Revision: 2380
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/ProjectSelectionFieldEditor.java
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/ButtonFieldEditor.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/IFieldEditorFactory.java
Log:
http://jira.jboss.org/jira/browse/EXIN-221
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-11 07:43:51 UTC (rev 2379)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java 2007-07-11 08:33:20 UTC (rev 2380)
@@ -93,7 +93,7 @@
IFieldEditor recreateTablesOnDeploy = IFieldEditorFactory.INSTANCE.createCheckboxEditor(
ISeamFacetDataModelProperties.RECREATE_TABLES_AND_DATA_ON_DEPLOY,
"Recreate database tables and data on deploy:", false);
- IFieldEditor pathToJdbcDriverJar = IFieldEditorFactory.INSTANCE.createBrowseFolderEditor(
+ IFieldEditor pathToJdbcDriverJar = IFieldEditorFactory.INSTANCE.createBrowseFileEditor(
ISeamFacetDataModelProperties. JDBC_DRIVER_JAR_PATH,
"JDBC Driver jar:", "");
@@ -231,6 +231,8 @@
if(event.getPropertyName().equals(IJ2EEModuleFacetInstallDataModelProperties.CONFIG_FOLDER)) {
model.setStringProperty(ISeamFacetDataModelProperties.WEB_CONTENTS_FOLDER, event.getProperty()
.toString());
+ } if (event.getPropertyName().equals(ISeamFacetDataModelProperties.DB_TYPE)) {
+
}
}
}
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-11 07:43:51 UTC (rev 2379)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SwtFieldEditorFactory.java 2007-07-11 08:33:20 UTC (rev 2380)
@@ -14,6 +14,7 @@
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.FileDialog;
import org.jboss.tools.seam.ui.widget.editor.ButtonFieldEditor;
import org.jboss.tools.seam.ui.widget.editor.CheckBoxFieldEditor;
import org.jboss.tools.seam.ui.widget.editor.ComboFieldEditor;
@@ -69,12 +70,24 @@
CompositeEditor editor = new CompositeEditor(name,label, defaultValue);
editor.addFieldEditors(new IFieldEditor[]{new LabelFieldEditor(name,label),
new TextFieldEditor(name,label, defaultValue),
- new ButtonFieldEditor(name,createSelectFolderAction("Browse"))});
+ new ButtonFieldEditor(name,createSelectFolderAction("Browse"),defaultValue)});
return editor;
}
+
/**
*
+ */
+ public IFieldEditor createBrowseFileEditor(String name, String label, String defaultValue) {
+ CompositeEditor editor = new CompositeEditor(name,label, defaultValue);
+ editor.addFieldEditors(new IFieldEditor[]{new LabelFieldEditor(name,label),
+ new TextFieldEditor(name,label, defaultValue),
+ new ButtonFieldEditor(name,createSelectFileAction("Browse"),defaultValue)});
+ return editor;
+ }
+
+ /**
+ *
* @param buttonName
* @return
*/
@@ -93,4 +106,25 @@
}
};
}
+
+ /**
+ *
+ * @param buttonName
+ * @return
+ */
+ public ButtonFieldEditor.ButtonPressedAction createSelectFileAction(String buttonName) {
+ return new ButtonFieldEditor.ButtonPressedAction(buttonName) {
+ @Override
+ public void run() {
+ FileDialog dialog = new FileDialog(Display.getCurrent().getActiveShell());
+ dialog.setFilterPath(getFieldEditor().getValueAsString());
+ dialog.setText("Select Seam Home Folder");
+ dialog.setFilterPath(getFieldEditor().getValueAsString());
+ String directory = dialog.open();
+ if(directory!=null) {
+ getFieldEditor().setValue(directory);
+ }
+ }
+ };
+ }
}
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-11 07:43:51 UTC (rev 2379)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/ButtonFieldEditor.java 2007-07-11 08:33:20 UTC (rev 2380)
@@ -34,8 +34,8 @@
super(name, label, new Object());
}
- public ButtonFieldEditor(String name, ButtonPressedAction action) {
- super(name, action.getText(), new Object());
+ public ButtonFieldEditor(String name, ButtonPressedAction action, Object defaultValue) {
+ super(name, action.getText(), defaultValue);
buttonAction = action;
buttonAction.setFieldEditor(this);
}
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-11 07:43:51 UTC (rev 2379)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/IFieldEditorFactory.java 2007-07-11 08:33:20 UTC (rev 2380)
@@ -52,5 +52,14 @@
* @return
*/
IFieldEditor createBrowseFolderEditor(String name, String label, String defaultValue);
+
+ /**
+ *
+ * @param name
+ * @param label
+ * @param defaultValue
+ * @return
+ */
+ IFieldEditor createBrowseFileEditor(String name, String label, String defaultValue);
}
Added: 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 (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/ProjectSelectionFieldEditor.java 2007-07-11 08:33:20 UTC (rev 2380)
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * 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: r2379 - in trunk: seam/plugins/org.jboss.tools.seam.core and 7 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2007-07-11 03:43:51 -0400 (Wed, 11 Jul 2007)
New Revision: 2379
Added:
trunk/releng/.project
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/AntCopyUtils.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamCoreConstants.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamFacetDataModelProperties.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDataModelProvider.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetUninstallDelegate.java
Removed:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/internal/project/facet/
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/AntCopyUtils.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamCoreConstants.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamFacetDataModelProperties.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDataModelProvider.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetUninstallDelegate.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/META-INF/MANIFEST.MF
trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml
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/internal/project/facet/ValidatorFactory.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/SeamFacetInstallDelegeteTest.java
Log:
http://jira.jboss.org/jira/browse/EXIN-221
Added: trunk/releng/.project
===================================================================
--- trunk/releng/.project (rev 0)
+++ trunk/releng/.project 2007-07-11 07:43:51 UTC (rev 2379)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>releng</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ </buildSpec>
+ <natures>
+ </natures>
+</projectDescription>
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/META-INF/MANIFEST.MF 2007-07-11 06:43:31 UTC (rev 2378)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/META-INF/MANIFEST.MF 2007-07-11 07:43:51 UTC (rev 2379)
@@ -26,9 +26,11 @@
org.jboss.tools.seam.internal.core.scanner
Bundle-Version: 2.0.0
Export-Package: org.jboss.tools.seam.core,
- org.jboss.tools.seam.core.internal.project.facet,
+ org.jboss.tools.seam.core.event,
org.jboss.tools.seam.internal.core,
+ org.jboss.tools.seam.internal.core.project.facet,
org.jboss.tools.seam.internal.core.scanner,
org.jboss.tools.seam.internal.core.scanner.java,
org.jboss.tools.seam.internal.core.scanner.lib,
- org.jboss.tools.seam.internal.core.scanner.xml
+ org.jboss.tools.seam.internal.core.scanner.xml,
+ org.jboss.tools.seam.internal.core.validation
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml 2007-07-11 06:43:31 UTC (rev 2378)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml 2007-07-11 07:43:51 UTC (rev 2379)
@@ -83,10 +83,10 @@
type="install"
version="2.0">
<delegate
- class="org.jboss.tools.seam.core.internal.project.facet.SeamFacetInstallDelegete">
+ class="org.jboss.tools.seam.internal.core.project.facet.SeamFacetInstallDelegete">
</delegate>
<config-factory
- class="org.jboss.tools.seam.core.internal.project.facet.SeamFacetInstallDataModelProvider">
+ class="org.jboss.tools.seam.internal.core.project.facet.SeamFacetInstallDataModelProvider">
</config-factory>
</action>
<action
@@ -95,7 +95,7 @@
type="uninstall"
version="2.0">
<delegate
- class="org.jboss.tools.seam.core.internal.project.facet.SeamFacetUninstallDelegate">
+ class="org.jboss.tools.seam.internal.core.project.facet.SeamFacetUninstallDelegate">
</delegate>
</action>
</extension>
Copied: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet (from rev 2334, trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/internal/project/facet)
Deleted: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/AntCopyUtils.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/internal/project/facet/AntCopyUtils.java 2007-07-05 18:06:31 UTC (rev 2334)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/AntCopyUtils.java 2007-07-11 07:43:51 UTC (rev 2379)
@@ -1,75 +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.core.internal.project.facet;
-import java.io.File;
-import java.io.IOException;
-import java.util.Properties;
-
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.types.FilterSet;
-import org.apache.tools.ant.types.FilterSetCollection;
-import org.apache.tools.ant.types.Resource;
-import org.apache.tools.ant.types.resources.FileResource;
-import org.apache.tools.ant.util.FileUtils;
-import org.apache.tools.ant.util.ResourceUtils;
-import org.jboss.tools.seam.core.internal.project.facet.SeamFacetInstallDelegete.FileSetFileFilter;
-import org.jboss.tools.seam.core.SeamCorePlugin;
-
-/**
- *
- * @author eskimo
- *
- */
-public class AntCopyUtils {
-
- public static void copyFilesAndFolders(File sourceFolder, File destinationFolder, FilterSetCollection set, boolean override) {
- copyFilesAndFolders(sourceFolder, destinationFolder, null, set, override);
- }
-
- public static void copyFilesAndFolders(File sourceFolder, File destinationFolder,
- FileSetFileFilter fileSetFilter,
- FilterSetCollection filterSetCollection, boolean override) {
- if(!destinationFolder.exists())
- destinationFolder.mkdirs();
- File[] files = fileSetFilter==null?sourceFolder.listFiles():sourceFolder.listFiles(fileSetFilter);
- for (File file : files) {
- if(file.isDirectory()) {
- copyFilesAndFolders(file,new File(destinationFolder,file.getName()),fileSetFilter,filterSetCollection,override);
- } else {
- try {
- FileUtils.getFileUtils().copyFile(file, new File(destinationFolder,file.getName()),filterSetCollection,override);
- } catch (IOException e) {
- e.printStackTrace();
- SeamCorePlugin.getPluginLog().logError(e);
- }
- }
- }
- }
-
- public static void copyFile(File source, File dest, boolean override) {
- copyFileToFolder(source, new File(dest,source.getName()),new FilterSetCollection(),override);
- }
-
- public static void copyFileToFolder(File source, File dest, FilterSetCollection filterSetCollection, boolean override ) {
- try {
- FileUtils.getFileUtils().copyFile(source, new File(dest,source.getName()),filterSetCollection,override);
- } catch (IOException e) {
- SeamCorePlugin.getPluginLog().logError(e);
- }
- }
- public static void copyFileToFile(File source, File dest, FilterSetCollection filterSetCollection, boolean override ) {
- try {
- FileUtils.getFileUtils().copyFile(source, dest,filterSetCollection,override);
- } catch (IOException e) {
- SeamCorePlugin.getPluginLog().logError(e);
- }
- }
-}
Copied: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/AntCopyUtils.java (from rev 2377, trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/internal/project/facet/AntCopyUtils.java)
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/AntCopyUtils.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/AntCopyUtils.java 2007-07-11 07:43:51 UTC (rev 2379)
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.internal.core.project.facet;
+import java.io.File;
+import java.io.IOException;
+import java.util.Properties;
+
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.types.FilterSet;
+import org.apache.tools.ant.types.FilterSetCollection;
+import org.apache.tools.ant.types.Resource;
+import org.apache.tools.ant.types.resources.FileResource;
+import org.apache.tools.ant.util.FileUtils;
+import org.apache.tools.ant.util.ResourceUtils;
+import org.jboss.tools.seam.core.SeamCorePlugin;
+import org.jboss.tools.seam.internal.core.project.facet.SeamFacetInstallDelegete.FileSetFileFilter;
+
+/**
+ *
+ * @author eskimo
+ *
+ */
+public class AntCopyUtils {
+
+ public static void copyFilesAndFolders(File sourceFolder, File destinationFolder, FilterSetCollection set, boolean override) {
+ copyFilesAndFolders(sourceFolder, destinationFolder, null, set, override);
+ }
+
+ public static void copyFilesAndFolders(File sourceFolder, File destinationFolder,
+ FileSetFileFilter fileSetFilter,
+ FilterSetCollection filterSetCollection, boolean override) {
+ File[] files = fileSetFilter==null?sourceFolder.listFiles():sourceFolder.listFiles(fileSetFilter);
+ for (File file : files) {
+ if(file.isDirectory()) {
+ copyFilesAndFolders(file,new File(destinationFolder,file.getName()),fileSetFilter,filterSetCollection,override);
+ } else {
+ try {
+ if(!destinationFolder.exists())
+ destinationFolder.mkdirs();
+ FileUtils.getFileUtils().copyFile(file, new File(destinationFolder,file.getName()),filterSetCollection,override);
+ } catch (IOException e) {
+ e.printStackTrace();
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+ }
+ }
+ }
+
+ public static void copyFileToFolder(File source, File dest, boolean override) {
+ copyFileToFolder(source, dest,new FilterSetCollection(),override);
+ }
+
+ public static void copyFileToFolder(File source, File dest, FilterSetCollection filterSetCollection, boolean override ) {
+ try {
+ FileUtils.getFileUtils().copyFile(source, new File(dest,source.getName()),filterSetCollection,override);
+ } catch (IOException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+ }
+ public static void copyFileToFile(File source, File dest, FilterSetCollection filterSetCollection, boolean override ) {
+ try {
+ FileUtils.getFileUtils().copyFile(source, dest,filterSetCollection,override);
+ } catch (IOException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+ }
+}
Deleted: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamCoreConstants.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/internal/project/facet/ISeamCoreConstants.java 2007-07-05 18:06:31 UTC (rev 2334)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamCoreConstants.java 2007-07-11 07:43:51 UTC (rev 2379)
@@ -1,18 +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.core.internal.project.facet;
-
-public interface ISeamCoreConstants {
-
- public static final String SEAM_CORE_FACET_ID = "jst.seam";
-
-}
Copied: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamCoreConstants.java (from rev 2377, trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/internal/project/facet/ISeamCoreConstants.java)
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamCoreConstants.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamCoreConstants.java 2007-07-11 07:43:51 UTC (rev 2379)
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.seam.internal.core.project.facet;
+
+public interface ISeamCoreConstants {
+
+ public static final String SEAM_CORE_FACET_ID = "jst.seam";
+
+}
Deleted: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamFacetDataModelProperties.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/internal/project/facet/ISeamFacetDataModelProperties.java 2007-07-05 18:06:31 UTC (rev 2334)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamFacetDataModelProperties.java 2007-07-11 07:43:51 UTC (rev 2379)
@@ -1,66 +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.core.internal.project.facet;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.wst.common.project.facet.core.IActionConfigFactory;
-
-/**
- * Seam facet properties
- * @author eskimo
- *
- */
-public interface ISeamFacetDataModelProperties extends IActionConfigFactory {
-
- public static final String PREFIX = "ISeamFacetDataModelProperties.";
-
- public static final String SEAM_PROJECT_NAME = "project.name";
-
- public static final String JBOSS_AS_HOME = "jboss.home";
-
- public static final String JBOSS_AS_DEPLOY_AS = "JBOSS_AS_DEPLOY_AS";
-
- public static final String DB_TYPE = "database.type";
-
- public static final String HIBERNATE_DIALECT = "hibernate.dialect";
-
- public static final String JDBC_DRIVER_CLASS_NAME = "hibernate.connection.driver_class";
-
- public static final String JDBC_URL_FOR_DB = "hibernate.connection.url";
-
- public static final String DB_USER_NAME = "hibernate.connection.username";
-
- public static final String DB_USERP_PASSWORD = "hibernate.connection.password";
-
- public static final String DB_SCHEMA_NAME = "schema.property";
-
- public static final String DB_CATALOG_NAME = "catalog.property";
-
- public static final String DB_ALREADY_EXISTS = "database.exists";
-
- public static final String RECREATE_TABLES_AND_DATA_ON_DEPLOY = "database.drop";
-
- public static final String JDBC_DRIVER_JAR_PATH = "driver.file";
-
- public static final String SESION_BEAN_PACKAGE_NAME = "action.package";
-
- public static final String ENTITY_BEAN_PACKAGE_NAME = "model.package";
-
- public static final String TEST_CASES_PACKAGE_NAME = "test.package";
-
- public static final String JBOSS_SEAM_HOME = "JBOSS_SEAM_HOME";
-
- public static final String WEB_CONTENTS_FOLDER = PREFIX + "WEB_CONTENTS_FOLDER";
-
-}
Copied: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamFacetDataModelProperties.java (from rev 2377, trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/internal/project/facet/ISeamFacetDataModelProperties.java)
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamFacetDataModelProperties.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamFacetDataModelProperties.java 2007-07-11 07:43:51 UTC (rev 2379)
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.seam.internal.core.project.facet;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.wst.common.project.facet.core.IActionConfigFactory;
+
+/**
+ * Seam facet properties
+ * @author eskimo
+ *
+ */
+public interface ISeamFacetDataModelProperties extends IActionConfigFactory {
+
+ public static final String PREFIX = "ISeamFacetDataModelProperties.";
+
+ public static final String SEAM_PROJECT_NAME = "project.name";
+
+ public static final String JBOSS_AS_HOME = "jboss.home";
+
+ public static final String JBOSS_AS_DEPLOY_AS = "JBOSS_AS_DEPLOY_AS";
+
+ public static final String DB_TYPE = "database.type";
+
+ public static final String HIBERNATE_DIALECT = "hibernate.dialect";
+
+ public static final String JDBC_DRIVER_CLASS_NAME = "hibernate.connection.driver_class";
+
+ public static final String JDBC_URL_FOR_DB = "hibernate.connection.url";
+
+ public static final String DB_USER_NAME = "hibernate.connection.username";
+
+ public static final String DB_USERP_PASSWORD = "hibernate.connection.password";
+
+ public static final String DB_SCHEMA_NAME = "schema.property";
+
+ public static final String DB_CATALOG_NAME = "catalog.property";
+
+ public static final String DB_ALREADY_EXISTS = "database.exists";
+
+ public static final String RECREATE_TABLES_AND_DATA_ON_DEPLOY = "database.drop";
+
+ public static final String JDBC_DRIVER_JAR_PATH = "driver.file";
+
+ public static final String SESION_BEAN_PACKAGE_NAME = "action.package";
+
+ public static final String ENTITY_BEAN_PACKAGE_NAME = "model.package";
+
+ public static final String TEST_CASES_PACKAGE_NAME = "test.package";
+
+ public static final String JBOSS_SEAM_HOME = "JBOSS_SEAM_HOME";
+
+ public static final String WEB_CONTENTS_FOLDER = PREFIX + "WEB_CONTENTS_FOLDER";
+
+}
Deleted: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDataModelProvider.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/internal/project/facet/SeamFacetInstallDataModelProvider.java 2007-07-05 18:06:31 UTC (rev 2334)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDataModelProvider.java 2007-07-11 07:43:51 UTC (rev 2379)
@@ -1,85 +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.core.internal.project.facet;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.wst.common.componentcore.datamodel.FacetInstallDataModelProvider;
-import org.eclipse.wst.common.project.facet.core.IActionConfigFactory;
-
-/**
- * Data model provider for Seam facet wizard page
- * @author eskimo
- *
- */
-public class SeamFacetInstallDataModelProvider extends
- FacetInstallDataModelProvider implements ISeamFacetDataModelProperties {
-
- public static final Map<String,String[]> SEAM_LIBRARIES= new HashMap<String,String[]>();
-
- static {
- SEAM_LIBRARIES.put("1.2",new String[] {
- });
- }
- /**
- * Returns set of facet properties for facet wizard page
- */
- @Override
- public Set getPropertyNames() {
- Set<String> names = super.getPropertyNames();
-
- // General group
- names.add(ISeamFacetDataModelProperties.JBOSS_AS_HOME);
- names.add(ISeamFacetDataModelProperties.JBOSS_SEAM_HOME);
- names.add(ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS);
-
- // Database group
- names.add(ISeamFacetDataModelProperties.DB_TYPE);
- names.add(ISeamFacetDataModelProperties.HIBERNATE_DIALECT);
- names.add(ISeamFacetDataModelProperties.JDBC_DRIVER_CLASS_NAME);
- names.add(ISeamFacetDataModelProperties.JDBC_URL_FOR_DB);
-
- names.add(ISeamFacetDataModelProperties.DB_USER_NAME);
- names.add(ISeamFacetDataModelProperties.DB_USERP_PASSWORD);
- names.add(ISeamFacetDataModelProperties.DB_SCHEMA_NAME);
- names.add(ISeamFacetDataModelProperties.DB_CATALOG_NAME);
-
- names.add(ISeamFacetDataModelProperties.DB_ALREADY_EXISTS);
- names.add(ISeamFacetDataModelProperties.RECREATE_TABLES_AND_DATA_ON_DEPLOY);
-
- names.add(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH);
-
- // Code generation group
- names.add(ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_NAME);
- names.add(ISeamFacetDataModelProperties.ENTITY_BEAN_PACKAGE_NAME);
- names.add(ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_NAME);
- names.add(ISeamFacetDataModelProperties.WEB_CONTENTS_FOLDER);
- names.add(ISeamFacetDataModelProperties.SEAM_PROJECT_NAME);
-
- return names;
- }
-
- /**
- * Returns default value for a given property
- */
- public Object getDefaultProperty(String propertyName) {
- if(JBOSS_AS_HOME.equals(propertyName)) {
- return "Jboss_AS_HOME";
- }else if(JBOSS_AS_DEPLOY_AS.equals(propertyName)) {
- return "Jboos_DEPLOY_AS";
- }else if (propertyName.equals(FACET_ID)) {
- return ISeamCoreConstants.SEAM_CORE_FACET_ID;
- }
- return super.getDefaultProperty(propertyName);
- }
-}
Copied: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDataModelProvider.java (from rev 2377, trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/internal/project/facet/SeamFacetInstallDataModelProvider.java)
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDataModelProvider.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDataModelProvider.java 2007-07-11 07:43:51 UTC (rev 2379)
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.internal.core.project.facet;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.wst.common.componentcore.datamodel.FacetInstallDataModelProvider;
+import org.eclipse.wst.common.project.facet.core.IActionConfigFactory;
+
+/**
+ * Data model provider for Seam facet wizard page
+ * @author eskimo
+ *
+ */
+public class SeamFacetInstallDataModelProvider extends
+ FacetInstallDataModelProvider implements ISeamFacetDataModelProperties {
+
+ public static final Map<String,String[]> SEAM_LIBRARIES= new HashMap<String,String[]>();
+
+ static {
+ SEAM_LIBRARIES.put("1.2",new String[] {
+ });
+ }
+ /**
+ * Returns set of facet properties for facet wizard page
+ */
+ @Override
+ public Set getPropertyNames() {
+ Set<String> names = super.getPropertyNames();
+
+ // General group
+ names.add(ISeamFacetDataModelProperties.JBOSS_AS_HOME);
+ names.add(ISeamFacetDataModelProperties.JBOSS_SEAM_HOME);
+ names.add(ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS);
+
+ // Database group
+ names.add(ISeamFacetDataModelProperties.DB_TYPE);
+ names.add(ISeamFacetDataModelProperties.HIBERNATE_DIALECT);
+ names.add(ISeamFacetDataModelProperties.JDBC_DRIVER_CLASS_NAME);
+ names.add(ISeamFacetDataModelProperties.JDBC_URL_FOR_DB);
+
+ names.add(ISeamFacetDataModelProperties.DB_USER_NAME);
+ names.add(ISeamFacetDataModelProperties.DB_USERP_PASSWORD);
+ names.add(ISeamFacetDataModelProperties.DB_SCHEMA_NAME);
+ names.add(ISeamFacetDataModelProperties.DB_CATALOG_NAME);
+
+ names.add(ISeamFacetDataModelProperties.DB_ALREADY_EXISTS);
+ names.add(ISeamFacetDataModelProperties.RECREATE_TABLES_AND_DATA_ON_DEPLOY);
+
+ names.add(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH);
+
+ // Code generation group
+ names.add(ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_NAME);
+ names.add(ISeamFacetDataModelProperties.ENTITY_BEAN_PACKAGE_NAME);
+ names.add(ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_NAME);
+ names.add(ISeamFacetDataModelProperties.WEB_CONTENTS_FOLDER);
+ names.add(ISeamFacetDataModelProperties.SEAM_PROJECT_NAME);
+
+ return names;
+ }
+
+ /**
+ * Returns default value for a given property
+ */
+ public Object getDefaultProperty(String propertyName) {
+ if(JBOSS_AS_HOME.equals(propertyName)) {
+ return "Jboss_AS_HOME";
+ }else if(JBOSS_AS_DEPLOY_AS.equals(propertyName)) {
+ return "Jboos_DEPLOY_AS";
+ }else if (propertyName.equals(FACET_ID)) {
+ return ISeamCoreConstants.SEAM_CORE_FACET_ID;
+ }
+ return super.getDefaultProperty(propertyName);
+ }
+}
Deleted: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/internal/project/facet/SeamFacetInstallDelegete.java 2007-07-05 18:06:31 UTC (rev 2334)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java 2007-07-11 07:43:51 UTC (rev 2379)
@@ -1,345 +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.core.internal.project.facet;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.regex.Pattern;
-
-import org.apache.tools.ant.types.FilterSet;
-import org.apache.tools.ant.types.FilterSetCollection;
-import org.apache.tools.ant.util.FileUtils;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.project.facet.core.IDelegate;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.jboss.tools.seam.core.SeamCorePlugin;
-
-public class SeamFacetInstallDelegete extends Object implements IDelegate {
-
- public static String PROFILE = "dev-war";
-
- public static FileSet VIEW_FILESET = new FileSet()
- .include("home\\.xhtml")
- .include("error\\.xhtml")
- .include("login\\.xhtml")
- .include("login\\.page.xml")
- .include("index\\.html")
- .include("layout")
- .include("layout/.*")
- .include("stylesheet/.*")
- .include("img/.*")
- .include("img")
- .exclude(".*/.*\\.ftl");
-
- public static FileSet SEAM_JARS = new FileSet()
- .include("jboss-seam.*\\.jar")
- .exclude("jboss-seam-gen\\.jar");
-
- public static FileSet JAVA_LIBS = new FileSet()
- .include(".[^/]*\\.jar")
- .include(".[^/]*\\.zip");
-
- public static FileSet JBOOS_WAR_RESOURCE_SET1 = new FileSet()
- .include("META-INF/jboss-beans\\.xml")
- .include("WEB-INF/pages\\.xml")
- .include("WEB-INF/faces-config\\.xml")
- .include("WEB-INF/web\\.xml");
-
- public static FileSet JBOOS_JAR_RESOURCE_SET1 = new FileSet()
- .include("META-INF/ejb-jar\\.xml")
- .include("META-INF/persistence-" + PROFILE + "\\.xml" )
- .include("import-" + PROFILE + "\\.sql");
-
-
- public static String DROOLS_LIB_SEAM_RELATED_PATH = "drools/lib";
-
- public static String SEAM_LIB_RELATED_PATH = "lib";
-
- public static String WEB_LIBRARIES_RELATED_PATH = "WEB-INF/lib";
-
- public void execute(IProject project, IProjectFacetVersion fv,
- Object config, IProgressMonitor monitor) throws CoreException {
- IDataModel model = (IDataModel)config;
-
- // get WebContents folder path from DWP model
- WebArtifactEdit edit =
- WebArtifactEdit.getWebArtifactEditForRead(project);
- IVirtualComponent com = ComponentCore.createComponent(project);
- IVirtualFolder webRootFolder = com.getRootFolder().getFolder(new Path("/"));
- IContainer folder = webRootFolder.getUnderlyingFolder();
-
- File webContentFolder = folder.getLocation().toFile();
-
- model.setProperty(ISeamFacetDataModelProperties.SEAM_PROJECT_NAME, project.getName());
-
- String seamHomePath = model.getProperty(ISeamFacetDataModelProperties.JBOSS_SEAM_HOME).toString();
- File seamHomeFolder = new File(seamHomePath);
- File seamLibFolder = new File(seamHomePath,SEAM_LIB_RELATED_PATH);
- File seamGenResFolder = new File(seamHomePath,"seam-gen/resources");
- File droolsLibFolder = new File(seamHomePath,DROOLS_LIB_SEAM_RELATED_PATH);
- File seamGenViewSource = new File(seamHomePath,"seam-gen/view");
- File jdbcDriverFile = new File(model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH).toString());
- File hibernateConsoleLaunchFile = new File(seamHomeFolder, "seam-gen/hibernatetools/hibernate-console.launch");
- File hibernateConsolePropsFile = new File(seamHomeFolder, "seam-gen/hibernatetools/hibernate-console.properties");
-
-
-
- FilterSet jdbcFilterSet = FilterSetFactory.createJdbcFilterSet(model);
- FilterSet projectFilterSet = FilterSetFactory.createProjectFilterSet(model);
-
- // ****************************************************************
- // Copy view folder from seam-gen installation to WebContent folder
- // ****************************************************************
-
- FileSet viewFileSet = new FileSet(VIEW_FILESET).dir(seamGenViewSource);
- FilterSetCollection viewFilterSetCollection = new FilterSetCollection();
- viewFilterSetCollection.addFilterSet(jdbcFilterSet);
- viewFilterSetCollection.addFilterSet(projectFilterSet);
- AntCopyUtils.copyFilesAndFolders(
- seamGenViewSource, webContentFolder, new FileSetFileFilter(viewFileSet), viewFilterSetCollection, true);
-
- // *******************************************************************
- // Copy manifest and configuration resources the same way as view
- // *******************************************************************
-
- FileSet res1FileSet = new FileSet(JBOOS_WAR_RESOURCE_SET1).dir(seamGenResFolder);
- AntCopyUtils.copyFilesAndFolders(
- seamGenResFolder,webContentFolder,new FileSetFileFilter(res1FileSet), viewFilterSetCollection, true);
-
- AntCopyUtils.copyFileToFile(
- hibernateConsoleLaunchFile,
- new File(project.getLocation().toFile(),project.getName()+".launch"),
- new FilterSetCollection(projectFilterSet), true);
-
- FilterSetCollection hibernateDialectFilterSet = new FilterSetCollection();
- hibernateDialectFilterSet.addFilterSet(jdbcFilterSet);
- hibernateDialectFilterSet.addFilterSet(projectFilterSet);
- hibernateDialectFilterSet.addFilterSet(FilterSetFactory.createHibernateDialectFilterSet(model));
-
- AntCopyUtils.copyFileToFolder(
- hibernateConsolePropsFile,
- project.getLocation().toFile(),
- hibernateDialectFilterSet, true);
-
- // TODO add copy for /hibernatetools/seam-gen.reveng.xml
-
- // *************************************
- // TODO modify existing faces-config.xml
- // *************************************
-
-
- // ********************************************************************************************
- // TODO copy libraries/link libraries (seam jars, seam dependencies jars, drols jars, jdbc jar)
- // ********************************************************************************************
-
- File webLibFolder = new File(webContentFolder,WEB_LIBRARIES_RELATED_PATH);
- copyFiles(seamHomeFolder,webLibFolder,new FileSetFileFilter(new FileSet(SEAM_JARS).dir(seamHomeFolder)));
- copyFiles(seamLibFolder,webLibFolder,new FileSetFileFilter(new FileSet(SEAM_JARS).dir(seamLibFolder)));
- copyFiles(droolsLibFolder,webLibFolder,new FileSetFileFilter(new FileSet(SEAM_JARS).dir(droolsLibFolder)));
-
- if(jdbcDriverFile.exists())
- AntCopyUtils.copyFile(jdbcDriverFile, webLibFolder, true);
-
- // TODO generate db support as seam-gen does
-
- // TODO may be generate RHDS studio feature to show it on projects view
-
- // TODO say JBoss AS adapter what kind of deployment to use
-
- // TODO generate build.xml
-
- project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
- }
-
- public static void copyFiles(File source, File dest, FileFilter filter) {
- dest.mkdir();
- for (File file:source.listFiles(filter)) {
- try {
- FileUtils.getFileUtils().copyFile(file, new File(dest,file.getName()),new FilterSetCollection(),true);
- } catch (IOException e) {
- SeamCorePlugin.getPluginLog().logError(e);
- }
- }
- }
-
- public static class FileSet {
-
- File dir = null;
-
- List<Pattern> include = new ArrayList<Pattern>();
-
- List<Pattern> exclude = new ArrayList<Pattern>();
-
- public FileSet(String dir) {
- this.dir = new File(dir);
- }
-
- public FileSet(File dir) {
- this.dir = dir;
- }
-
- public FileSet(FileSet template) {
- include.addAll(template.getIncluded());
- exclude.addAll(template.getExcluded());
- }
-
- public FileSet() {
-
- }
-
- public FileSet dir(String dir) {
- this.dir = new File(dir);
- return this;
- }
-
- public FileSet dir(File dir) {
- this.dir = dir;
- return this;
- }
-
- public FileSet include(String pattern) {
- include.add(Pattern.compile(pattern));
- return this;
-
- }
-
- public FileSet exclude(String pattern) {
- exclude.add(Pattern.compile(pattern));
- return this;
- }
-
- public boolean isIncluded(String file) {
- int i = dir.getAbsolutePath().length()+1;
- String relatedPath = file.substring(i);
- if(new File(file).isDirectory())return true;
- for (Pattern pattern : include) {
- if(pattern.matcher(relatedPath.replace('\\', '/')).matches() ) {
- return !isExcluded(relatedPath);
- }
- }
- return false;
- }
-
- public boolean isExcluded(String file){
- for (Pattern pattern : exclude) {
- if(pattern.matcher(file.replace('\\', '/')).matches()) return true;
- }
- return false;
- }
-
- public List<Pattern> getExcluded() {
- return Collections.unmodifiableList(exclude);
- }
-
- public List<Pattern> getIncluded() {
- return Collections.unmodifiableList(include);
- }
- }
-
- public static class FileSetFileFilter implements FileFilter {
-
- FileSet set;
- public FileSetFileFilter(FileSet set) {
- this.set = set;
- }
-
- public boolean accept(File pathname){
- return set.isIncluded(pathname.getAbsolutePath());
- }
- }
-
- public static class FilterSetFactory {
-
- public static FilterSet JDBC_TEMPLATE;
- public static FilterSet PROJECT_TEMPLATE;
- public static FilterSet FILTERS_TEMPLATE;
- public static FilterSet HIBERNATE_DIALECT_TEMPLATE;
-
- static {
- JDBC_TEMPLATE = new FilterSet();
- JDBC_TEMPLATE.addFilter("jdbcUrl","${hibernate.connection.url}");
- JDBC_TEMPLATE.addFilter("driverClass","${hibernate.connection.driver_class}");
- JDBC_TEMPLATE.addFilter("username","${hibernate.connection.username}");
- JDBC_TEMPLATE.addFilter("password","${hibernate.connection.password}");
- JDBC_TEMPLATE.addFilter("catalogProperty","${catalog.property}");
- JDBC_TEMPLATE.addFilter("schemaProperty","${schema.property}");
-
- PROJECT_TEMPLATE = new FilterSet();
- PROJECT_TEMPLATE.addFilter("projectName","${project.name}");
- PROJECT_TEMPLATE.addFilter("jbossHome","${jboss.home}");
- PROJECT_TEMPLATE.addFilter("hbm2ddl","${hibernate.hbm2ddl.auto}");
- PROJECT_TEMPLATE.addFilter("driverJar","${driver.file}");
-
- FILTERS_TEMPLATE = new FilterSet();
- FILTERS_TEMPLATE.addFilter("interfaceName","${interface.name}");
- FILTERS_TEMPLATE.addFilter("beanName","${bean.name}");
- FILTERS_TEMPLATE.addFilter("entityName","${entity.name}");
- FILTERS_TEMPLATE.addFilter("methodName","${method.name}");
- FILTERS_TEMPLATE.addFilter("componentName","${component.name}");
- FILTERS_TEMPLATE.addFilter("pageName","${page.name}");
- FILTERS_TEMPLATE.addFilter("masterPageName","${masterPage.name}");
- FILTERS_TEMPLATE.addFilter("actionPackage","${action.package}");
- FILTERS_TEMPLATE.addFilter("modelPackage","${model.package}");
- FILTERS_TEMPLATE.addFilter("testPackage","${test.package}");
- FILTERS_TEMPLATE.addFilter("listName","${component.name}List");
- FILTERS_TEMPLATE.addFilter("homeName","${component.name}Home");
- FILTERS_TEMPLATE.addFilter("query","${query.text}");
-
- HIBERNATE_DIALECT_TEMPLATE = new FilterSet();
- HIBERNATE_DIALECT_TEMPLATE.addFilter("hibernate.dialect","$hibernate.dialect");
- }
-
- public static FilterSet createJdbcFilterSet(IDataModel values) {
- return aplayProperties(JDBC_TEMPLATE, values);
- }
- public static FilterSet createProjectFilterSet(IDataModel values){
- return aplayProperties(PROJECT_TEMPLATE, values);
- }
-
- public static FilterSet createFiltersFilterSet(IDataModel values) {
- return aplayProperties(FILTERS_TEMPLATE, values);
- }
-
- public static FilterSet createHibernateDialectFilterSet(IDataModel values) {
- return aplayProperties(HIBERNATE_DIALECT_TEMPLATE, values);
- }
-
- private static FilterSet aplayProperties(FilterSet template,IDataModel values) {
- FilterSet result = new FilterSet();
- for (Object filter : template.getFilterHash().keySet()) {
- String value = template.getFilterHash().get(filter).toString();
- for (Object property : values.getAllProperties()) {
- if(value.contains("${"+property.toString()+"}")) {
- value = value.replace("${"+property.toString()+"}",values.getProperty(property.toString()).toString());
- }
- }
- result.addFilter(filter.toString(), value);
- }
- return result;
- }
- }
-
-
-}
Copied: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java (from rev 2377, trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/internal/project/facet/SeamFacetInstallDelegete.java)
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java 2007-07-11 07:43:51 UTC (rev 2379)
@@ -0,0 +1,496 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.internal.core.project.facet;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.regex.Pattern;
+
+import org.apache.tools.ant.types.FilterSet;
+import org.apache.tools.ant.types.FilterSetCollection;
+import org.apache.tools.ant.util.FileUtils;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.internal.core.JavaModel;
+import org.eclipse.jdt.internal.core.JavaProject;
+import org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.project.facet.core.IDelegate;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.jboss.tools.seam.core.SeamCorePlugin;
+
+public class SeamFacetInstallDelegete extends Object implements IDelegate {
+
+ public static String PROFILE = "dev-war";
+
+ public static FileSet TOMCAT_WAR_LIB_FILESET = new FileSet()
+ .include("activation\\.jar")
+ .include("ajax4jsf*.\\.jar")
+ .include("commons-beanutils.*\\.jar")
+ .include("commons-codec.*\\.jar")
+ .include("commons-collections.*\\.jar")
+ .include("commons-digester.*\\.jar")
+ .include("commons-el.*\\.jar")
+ .include("commons-lang.*\\.jar")
+ .include("hibernate-all\\.jar")
+ .include("itext.*\\.jar")
+ .include("jboss-aop-jdk50\\.jar")
+ .include("jboss-cache-jdk50\\.jar")
+ .include("jboss-ejb3-all\\.jar")
+ .include("jboss-seam-debug\\.jar")
+ .include("jboss-seam-ui\\.jar")
+ .include("jboss-seam\\.jar")
+ .include("jcaptcha-all.*\\.jar")
+ .include("jgroups\\.jar")
+ .include("jsf-facelets\\.jar")
+ .include("jstl.*\\.jar")
+ .include("mail-ra\\.jar")
+ .include("mail\\.jar")
+ .include("mc-conf\\.jar")
+ .include("myfaces-api.*\\.jar")
+ .include("myfaces-impl.*\\.jar")
+ .include("oscache.*\\.jar")
+ .include("portlet-api-lib\\.jar")
+ .include("richfaces.*\\.jar")
+ .include("spring\\.jar")
+ .include("thirdparty-all\\.jar");
+
+ public static FileSet JBOSS_WAR_LIB_FILESET = new FileSet()
+ .include("ajax4jsf.*\\.jar")
+ .include("antlr.*\\.jar")
+ .include("antlr.*\\.jar")
+ .include("commons-beanutils.*\\.jar")
+ .include("commons-collections.*\\.jar")
+ .include("commons-digester.*\\.jar")
+ .include("commons-jci-core.*\\.jar")
+ .include("commons-jci-janino.*\\.jar")
+ .include("drools-compiler.*\\.jar")
+ .include("drools-core.*\\.jar")
+ .include("janino.*\\.jar")
+ .include("jboss-seam-debug\\.jar")
+ .include("jboss-seam-ioc\\.jar")
+ .include("jboss-seam-mail\\.jar")
+ .include("jboss-seam-pdf\\.jar")
+ .include("jboss-seam-remoting\\.jar")
+ .include("jboss-seam-ui\\.jar")
+ .include("jboss-seam\\.jar")
+ .include("jbpm.*\\.jar")
+ .include("jsf-facelets\\.jar")
+ .include("oscache.*\\.jar")
+ .include("stringtemplate.*\\.jar");
+
+ public static FileSet EAR_LIB_FILESET = new FileSet()
+ .include("jboss-aop-jdk50\\.jar")
+ .include("jboss-cache-jdk50\\.jar")
+ .include("jboss-seam\\.jar")
+ .include("jgroups\\.jar");
+
+ public static FileSet VIEW_FILESET = new FileSet()
+ .include("home\\.xhtml")
+ .include("error\\.xhtml")
+ .include("login\\.xhtml")
+ .include("login\\.page.xml")
+ .include("index\\.html")
+ .include("layout")
+ .include("layout/.*")
+ .include("stylesheet/.*")
+ .include("img/.*")
+ .include("img")
+ .exclude(".*/.*\\.ftl");
+
+ public static FileSet JBOOS_WAR_WEBINF_SET = new FileSet()
+ .include("WEB-INF/web\\.xml")
+ .include("WEB-INF/pages\\.xml")
+ .include("WEB-INF/jboss-web\\.xml")
+ .include("WEB-INF/faces-config\\.xml")
+ .include("WEB-INF/componets\\.xml");
+
+ public static FileSet JBOOS_WAR_WEB_INF_CLASSES_SET = new FileSet()
+ .include("import\\.sql")
+ .include("security\\.drl")
+ .include("seam\\.properties")
+ .include("messages_en\\.properties");
+ // .include(project.getName()+"ds\\.xml")
+ // .include("META-INF/persistence-" + PROFILE + "\\.xml" )
+
+ public static String DROOLS_LIB_SEAM_RELATED_PATH = "drools/lib";
+
+ public static String SEAM_LIB_RELATED_PATH = "lib";
+
+ public static String WEB_LIBRARIES_RELATED_PATH = "WEB-INF/lib";
+
+ public void execute(IProject project, IProjectFacetVersion fv,
+ Object config, IProgressMonitor monitor) throws CoreException {
+ IDataModel model = (IDataModel)config;
+
+ // get WebContents folder path from DWP model
+ WebArtifactEdit edit = WebArtifactEdit.getWebArtifactEditForRead(project);
+ IVirtualComponent com = ComponentCore.createComponent(project);
+ IVirtualFolder webRootFolder = com.getRootFolder().getFolder(new Path("/"));
+ IVirtualFolder srcRootFolder = com.getRootFolder().getFolder(new Path("/WEB-INF/classes"));
+ IContainer folder = webRootFolder.getUnderlyingFolder();
+ model.setProperty(ISeamFacetDataModelProperties.SEAM_PROJECT_NAME, project.getName());
+
+ File webContentFolder = folder.getLocation().toFile();
+ File webInfFolder = new File(webContentFolder,"WEB-INF");
+ File webInfClasses = new File(webInfFolder,"classes");
+ File webInfClassesMetaInf = new File(webInfClasses, "META-INF");
+ webInfClassesMetaInf.mkdirs();
+ File webLibFolder = new File(webContentFolder,WEB_LIBRARIES_RELATED_PATH);
+ File srcFolder = srcRootFolder.getUnderlyingFolder().getLocation().toFile();
+ File srcWebInf = new File(srcFolder, "META-INF");
+ String seamHomePath = model.getProperty(ISeamFacetDataModelProperties.JBOSS_SEAM_HOME).toString();
+
+ File seamHomeFolder = new File(seamHomePath);
+ File seamLibFolder = new File(seamHomePath,SEAM_LIB_RELATED_PATH);
+ File seamGenResFolder = new File(seamHomePath,"seam-gen/resources");
+ File droolsLibFolder = new File(seamHomePath,DROOLS_LIB_SEAM_RELATED_PATH);
+ File securityDrools = new File(seamGenResFolder,"security.drl");
+ File seamGenHomeFolder = new File(seamHomePath,"seam-gen");
+ File seamGenViewSource = new File(seamGenHomeFolder,"view");
+ File dataSourceDsFile = new File(seamGenResFolder, "datasource-ds.xml");
+
+ File jdbcDriverFile = new File(model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH).toString());
+ File hibernateConsoleLaunchFile = new File(seamGenHomeFolder, "hibernatetools/hibernate-console.launch");
+ File hibernateConsolePropsFile = new File(seamGenHomeFolder, "hibernatetools/hibernate-console.properties");
+ File hibernateConsolePref = new File(seamGenHomeFolder, "hibernatetools/.settings/org.hibernate.eclipse.console.prefs");
+ File persistenceFile = new File(seamGenResFolder,"META-INF/persistence-" + PROFILE + ".xml");
+
+ FilterSet jdbcFilterSet = FilterSetFactory.createJdbcFilterSet(model);
+ FilterSet projectFilterSet = FilterSetFactory.createProjectFilterSet(model);
+ FilterSet filtersFilterSet = FilterSetFactory.createFiltersFilterSet(model);
+
+ // ****************************************************************
+ // Copy view folder from seam-gen installation to WebContent folder
+ // ****************************************************************
+
+ FileSet viewFileSet = new FileSet(VIEW_FILESET).dir(seamGenViewSource);
+ FilterSetCollection viewFilterSetCollection = new FilterSetCollection();
+ viewFilterSetCollection.addFilterSet(jdbcFilterSet);
+ viewFilterSetCollection.addFilterSet(projectFilterSet);
+ AntCopyUtils.copyFilesAndFolders(
+ seamGenViewSource,
+ webContentFolder,
+ new FileSetFileFilter(viewFileSet),
+ viewFilterSetCollection,
+ true);
+
+ // *******************************************************************
+ // Copy manifest and configuration resources the same way as view
+ // *******************************************************************
+
+ FileSet webInfSet = new FileSet(JBOOS_WAR_WEBINF_SET).dir(seamGenResFolder);
+ AntCopyUtils.copyFilesAndFolders(
+ seamGenResFolder,webContentFolder,new FileSetFileFilter(webInfSet), viewFilterSetCollection, true);
+
+ FileSet webInfClassesSet = new FileSet(JBOOS_WAR_WEB_INF_CLASSES_SET).dir(seamGenResFolder);
+ AntCopyUtils.copyFilesAndFolders(
+ seamGenResFolder,srcFolder,new FileSetFileFilter(webInfClassesSet), viewFilterSetCollection, true);
+
+ AntCopyUtils.copyFileToFile(
+ dataSourceDsFile,
+ new File(srcFolder,project.getName()+"-ds.xml"),
+ viewFilterSetCollection, true);
+
+ AntCopyUtils.copyFileToFile(
+ hibernateConsoleLaunchFile,
+ new File(project.getLocation().toFile(),project.getName()+".launch"),
+ new FilterSetCollection(projectFilterSet), true);
+
+
+ AntCopyUtils.copyFileToFile(
+ persistenceFile,
+ new File(srcWebInf,"persistence.xml"),
+ new FilterSetCollection(projectFilterSet), true);
+
+ FilterSetCollection hibernateDialectFilterSet = new FilterSetCollection();
+ hibernateDialectFilterSet.addFilterSet(jdbcFilterSet);
+ hibernateDialectFilterSet.addFilterSet(projectFilterSet);
+ hibernateDialectFilterSet.addFilterSet(FilterSetFactory.createHibernateDialectFilterSet(model));
+
+ AntCopyUtils.copyFileToFolder(
+ hibernateConsolePropsFile,
+ project.getLocation().toFile(),
+ hibernateDialectFilterSet, true);
+
+ // add copy for /hibernatetools/seam-gen.reveng.xml
+
+
+ AntCopyUtils.copyFileToFolder(
+ hibernateConsolePref,
+ new File(project.getLocation().toFile(),".settings"),
+ new FilterSetCollection(projectFilterSet), true);
+
+ // ********************************************************************************************
+ // Copy libraries libraries (seam jars, seam dependencies jars, drols jars, jdbc jar)
+ // ********************************************************************************************
+ copyFiles(seamHomeFolder,webLibFolder,new FileSetFileFilter(new FileSet(JBOSS_WAR_LIB_FILESET).dir(seamHomeFolder)));
+ copyFiles(seamLibFolder,webLibFolder,new FileSetFileFilter(new FileSet(JBOSS_WAR_LIB_FILESET).dir(seamLibFolder)));
+ copyFiles(droolsLibFolder,webLibFolder,new FileSetFileFilter(new FileSet(JBOSS_WAR_LIB_FILESET).dir(droolsLibFolder)));
+ copyFiles(seamHomeFolder,webLibFolder,new FileSetFileFilter(new FileSet(JBOSS_WAR_LIB_FILESET).dir(seamHomeFolder)));
+ copyFiles(seamLibFolder,webLibFolder,new FileSetFileFilter(new FileSet(JBOSS_WAR_LIB_FILESET).dir(seamLibFolder)));
+
+ // ********************************************************************************************
+ // Copy JDBC driver if there is any
+ // ********************************************************************************************
+ if(jdbcDriverFile.exists())
+ AntCopyUtils.copyFileToFolder(jdbcDriverFile, webLibFolder, true);
+
+ // Copy sources to src
+ AntCopyUtils.copyFileToFile(
+ new File(seamGenHomeFolder,"src/Authenticator.java"),
+ new File(project.getLocation().toFile(),"src/" + model.getProperty(ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_NAME).toString().replace('.', '/')+"/"+"Authenticator.java"),
+ new FilterSetCollection(filtersFilterSet), true);
+
+ // TODO may be generate RHDS studio feature to show it on projects view
+
+ // ********************************************************************************************
+ // Handle WAR/EAR configurations
+ // ********************************************************************************************
+ if(model.getProperty(ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS).equals("war")) {
+ AntCopyUtils.copyFileToFile(
+ new File(seamGenResFolder,"WEB-INF/components-war.xml"),
+ new File(webInfFolder,"components.xml"),
+ new FilterSetCollection(projectFilterSet), true);
+
+ // ********************************************************************************************
+ // TODO replace with appropriate one to handle Dynamic Web Project Structure
+ // ********************************************************************************************
+ AntCopyUtils.copyFileToFile(
+ new File(seamHomeFolder,"seam-gen/build-scripts/build-war.xml"),
+ new File(project.getLocation().toFile(),"build.xml"),
+ new FilterSetCollection(projectFilterSet), true);
+
+ // ********************************************************************************************
+ // Copy seam project indicator
+ // ********************************************************************************************
+ AntCopyUtils.copyFileToFolder(new File(seamGenResFolder,"seam.properties"), srcFolder, true);
+
+ } else {
+ // copy ear files
+ AntCopyUtils.copyFileToFile(
+ new File(seamGenResFolder,"WEB-INF/components.xml"),
+ new File(webInfFolder,"components.xml"),
+ new FilterSetCollection(projectFilterSet), true);
+ AntCopyUtils.copyFileToFile(
+ new File(seamHomeFolder,"seam-gen/build-scripts/build.xml"),
+ new File(project.getLocation().toFile(),"build.xml"),
+ new FilterSetCollection(projectFilterSet), true);
+ }
+
+
+ project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
+ }
+
+ public static void copyFiles(File source, File dest, FileFilter filter) {
+ dest.mkdir();
+ for (File file:source.listFiles(filter)) {
+ if(file.isDirectory())continue;
+ try {
+ FileUtils.getFileUtils().copyFile(file, new File(dest,file.getName()),new FilterSetCollection(),true);
+ } catch (IOException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+ }
+ }
+
+ public static class FileSet {
+
+ File dir = null;
+
+ List<Pattern> include = new ArrayList<Pattern>();
+
+ List<Pattern> exclude = new ArrayList<Pattern>();
+
+ public FileSet(String dir) {
+ this.dir = new File(dir);
+ }
+
+ public FileSet(File dir) {
+ this.dir = dir;
+ }
+
+ public FileSet(FileSet template) {
+ addTemplate(template);
+ }
+
+ public void addTemplate(FileSet template){
+ include.addAll(template.getIncluded());
+ exclude.addAll(template.getExcluded());
+ }
+
+ public FileSet() {
+
+ }
+
+ public FileSet add(FileSet set) {
+ addTemplate(set);
+ return this;
+ }
+
+ public FileSet dir(String dir) {
+ this.dir = new File(dir);
+ return this;
+ }
+
+ public FileSet dir(File dir) {
+ this.dir = dir;
+ return this;
+ }
+
+ public FileSet include(String pattern) {
+ include.add(Pattern.compile(pattern));
+ return this;
+
+ }
+
+ public FileSet exclude(String pattern) {
+ exclude.add(Pattern.compile(pattern));
+ return this;
+ }
+
+ public boolean isIncluded(String file) {
+ int i = dir.getAbsolutePath().length()+1;
+ String relatedPath = file.substring(i);
+ if(new File(file).isDirectory())return true;
+ for (Pattern pattern : include) {
+ if(pattern.matcher(relatedPath.replace('\\', '/')).matches() ) {
+ return !isExcluded(relatedPath);
+ }
+ }
+ return false;
+ }
+
+ public boolean isExcluded(String file){
+ for (Pattern pattern : exclude) {
+ if(pattern.matcher(file.replace('\\', '/')).matches()) return true;
+ }
+ return false;
+ }
+
+ public List<Pattern> getExcluded() {
+ return Collections.unmodifiableList(exclude);
+ }
+
+ public List<Pattern> getIncluded() {
+ return Collections.unmodifiableList(include);
+ }
+
+ /**
+ * @return
+ */
+ public File getDir() {
+ return dir;
+ }
+ }
+
+ public static class FileSetFileFilter implements FileFilter {
+
+ FileSet set;
+ public FileSetFileFilter(FileSet set) {
+ this.set = set;
+ }
+
+ public boolean accept(File pathname){
+ return set.isIncluded(pathname.getAbsolutePath());
+ }
+ }
+
+ public static class FilterSetFactory {
+
+ public static FilterSet JDBC_TEMPLATE;
+ public static FilterSet PROJECT_TEMPLATE;
+ public static FilterSet FILTERS_TEMPLATE;
+ public static FilterSet HIBERNATE_DIALECT_TEMPLATE;
+
+ static {
+ JDBC_TEMPLATE = new FilterSet();
+ JDBC_TEMPLATE.addFilter("jdbcUrl","${hibernate.connection.url}");
+ JDBC_TEMPLATE.addFilter("driverClass","${hibernate.connection.driver_class}");
+ JDBC_TEMPLATE.addFilter("username","${hibernate.connection.username}");
+ JDBC_TEMPLATE.addFilter("password","${hibernate.connection.password}");
+ JDBC_TEMPLATE.addFilter("catalogProperty","${catalog.property}");
+ JDBC_TEMPLATE.addFilter("schemaProperty","${schema.property}");
+
+ PROJECT_TEMPLATE = new FilterSet();
+ PROJECT_TEMPLATE.addFilter("projectName","${project.name}");
+ PROJECT_TEMPLATE.addFilter("jbossHome","${jboss.home}");
+ PROJECT_TEMPLATE.addFilter("hbm2ddl","${hibernate.hbm2ddl.auto}");
+ PROJECT_TEMPLATE.addFilter("driverJar","${driver.file}");
+ PROJECT_TEMPLATE.addFilter("jndiPattern","${project.name}/#{ejbName}/local");
+ PROJECT_TEMPLATE.addFilter("embeddedEjb","false");
+
+ FILTERS_TEMPLATE = new FilterSet();
+ FILTERS_TEMPLATE.addFilter("interfaceName","${interface.name}");
+ FILTERS_TEMPLATE.addFilter("beanName","${bean.name}");
+ FILTERS_TEMPLATE.addFilter("entityName","${entity.name}");
+ FILTERS_TEMPLATE.addFilter("methodName","${method.name}");
+ FILTERS_TEMPLATE.addFilter("componentName","${component.name}");
+ FILTERS_TEMPLATE.addFilter("pageName","${page.name}");
+ FILTERS_TEMPLATE.addFilter("masterPageName","${masterPage.name}");
+ FILTERS_TEMPLATE.addFilter("actionPackage","${action.package}");
+ FILTERS_TEMPLATE.addFilter("modelPackage","${model.package}");
+ FILTERS_TEMPLATE.addFilter("testPackage","${test.package}");
+ FILTERS_TEMPLATE.addFilter("listName","${component.name}List");
+ FILTERS_TEMPLATE.addFilter("homeName","${component.name}Home");
+ FILTERS_TEMPLATE.addFilter("query","${query.text}");
+
+
+ HIBERNATE_DIALECT_TEMPLATE = new FilterSet();
+ HIBERNATE_DIALECT_TEMPLATE.addFilter("hibernate.dialect","${hibernate.dialect}");
+
+
+ }
+
+ public static FilterSet createJdbcFilterSet(IDataModel values) {
+ return aplayProperties(JDBC_TEMPLATE, values);
+ }
+ public static FilterSet createProjectFilterSet(IDataModel values){
+ return aplayProperties(PROJECT_TEMPLATE, values);
+ }
+
+ public static FilterSet createFiltersFilterSet(IDataModel values) {
+ return aplayProperties(FILTERS_TEMPLATE, values);
+ }
+
+ public static FilterSet createHibernateDialectFilterSet(IDataModel values) {
+ return aplayProperties(HIBERNATE_DIALECT_TEMPLATE, values);
+ }
+
+ private static FilterSet aplayProperties(FilterSet template,IDataModel values) {
+ FilterSet result = new FilterSet();
+ for (Object filter : template.getFilterHash().keySet()) {
+ String value = template.getFilterHash().get(filter).toString();
+ for (Object property : values.getAllProperties()) {
+ if(value.contains("${"+property.toString()+"}")) {
+ value = value.replace("${"+property.toString()+"}",values.getProperty(property.toString()).toString());
+ }
+ }
+ result.addFilter(filter.toString(), value);
+ }
+ return result;
+ }
+ }
+
+
+}
Deleted: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetUninstallDelegate.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/internal/project/facet/SeamFacetUninstallDelegate.java 2007-07-05 18:06:31 UTC (rev 2334)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetUninstallDelegate.java 2007-07-11 07:43:51 UTC (rev 2379)
@@ -1,33 +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.core.internal.project.facet;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.project.facet.core.IDelegate;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-
-/**
- * This delegate uninstalls facet from project
- * @author eskimo
- */
-public class SeamFacetUninstallDelegate extends Object implements IDelegate {
-
- /**
- * @see IDelegate.execute(IProject,IProjectFacetVersion,Object,IProgressMonitor)
- */
- public void execute(IProject project, IProjectFacetVersion fv,
- Object config, IProgressMonitor monitor) throws CoreException {
- }
-
-}
Copied: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetUninstallDelegate.java (from rev 2377, trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/internal/project/facet/SeamFacetUninstallDelegate.java)
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetUninstallDelegate.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetUninstallDelegate.java 2007-07-11 07:43:51 UTC (rev 2379)
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.internal.core.project.facet;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.project.facet.core.IDelegate;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+
+/**
+ * This delegate uninstalls facet from project
+ * @author eskimo
+ */
+public class SeamFacetUninstallDelegate extends Object implements IDelegate {
+
+ /**
+ * @see IDelegate.execute(IProject,IProjectFacetVersion,Object,IProgressMonitor)
+ */
+ public void execute(IProject project, IProjectFacetVersion fv,
+ Object config, IProgressMonitor monitor) throws CoreException {
+ }
+
+}
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-11 06:43:31 UTC (rev 2378)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java 2007-07-11 07:43:51 UTC (rev 2379)
@@ -26,7 +26,7 @@
import org.eclipse.wst.common.project.facet.ui.AbstractFacetWizardPage;
import org.eclipse.wst.common.project.facet.ui.IFacetWizardPage;
import org.hibernate.eclipse.console.utils.DriverClassHelpers;
-import org.jboss.tools.seam.core.internal.project.facet.ISeamFacetDataModelProperties;
+import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
import org.jboss.tools.seam.ui.widget.editor.IFieldEditor;
import org.jboss.tools.seam.ui.widget.editor.IFieldEditorFactory;
@@ -93,9 +93,9 @@
IFieldEditor recreateTablesOnDeploy = IFieldEditorFactory.INSTANCE.createCheckboxEditor(
ISeamFacetDataModelProperties.RECREATE_TABLES_AND_DATA_ON_DEPLOY,
"Recreate database tables and data on deploy:", false);
- IFieldEditor pathToJdbcDriverJar = IFieldEditorFactory.INSTANCE.createTextEditor(
+ IFieldEditor pathToJdbcDriverJar = IFieldEditorFactory.INSTANCE.createBrowseFolderEditor(
ISeamFacetDataModelProperties. JDBC_DRIVER_JAR_PATH,
- "File :", "url://domain/");
+ "JDBC Driver jar:", "");
// Code generation group
IFieldEditor sessionBeanPkgNameditor = IFieldEditorFactory.INSTANCE.createTextEditor(
@@ -220,6 +220,7 @@
validatorDelegate.addValidatorForProperty(jBossSeamHomeEditor.getName(), ValidatorFactory.JBOSS_SEAM_HOME_FOLDER_VALIDATOR);
validatorDelegate.addValidatorForProperty(jBossAsHomeEditor.getName(), ValidatorFactory.JBOSS_AS_HOME_FOLDER_VALIDATOR);
+ validatorDelegate.addValidatorForProperty(pathToJdbcDriverJar.getName(), ValidatorFactory.FILESYSTEM_FILE_EXISTS_VALIDATOR);
}
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-11 06:43:31 UTC (rev 2378)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SwtFieldEditorFactory.java 2007-07-11 07:43:51 UTC (rev 2379)
@@ -83,6 +83,7 @@
@Override
public void run() {
DirectoryDialog dialog = new DirectoryDialog(Display.getCurrent().getActiveShell());
+ dialog.setFilterPath(getFieldEditor().getValueAsString());
dialog.setMessage("Select Seam Home Folder");
dialog.setFilterPath(getFieldEditor().getValueAsString());
String directory = dialog.open();
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/ValidatorFactory.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/ValidatorFactory.java 2007-07-11 06:43:31 UTC (rev 2378)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/ValidatorFactory.java 2007-07-11 07:43:51 UTC (rev 2379)
@@ -15,7 +15,7 @@
import java.util.Map;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.jboss.tools.seam.core.internal.project.facet.ISeamFacetDataModelProperties;
+import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
/**
*
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/SeamFacetInstallDelegeteTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/SeamFacetInstallDelegeteTest.java 2007-07-11 06:43:31 UTC (rev 2378)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/SeamFacetInstallDelegeteTest.java 2007-07-11 07:43:51 UTC (rev 2379)
@@ -3,7 +3,7 @@
*/
package org.jboss.tools.seam.core.test.project.facet;
-import org.jboss.tools.seam.core.internal.project.facet.SeamFacetInstallDelegete;
+import org.jboss.tools.seam.internal.core.project.facet.SeamFacetInstallDelegete;
import junit.framework.TestCase;
@@ -26,7 +26,7 @@
}
/**
- * Test method for {@link org.jboss.tools.seam.core.internal.project.facet.SeamFacetInstallDelegete#execute(org.eclipse.core.resources.IProject, org.eclipse.wst.common.project.facet.core.IProjectFacetVersion, java.lang.Object, org.eclipse.core.runtime.IProgressMonitor)}.
+ * Test method for {@link org.jboss.tools.seam.internal.core.project.facet.SeamFacetInstallDelegete#execute(org.eclipse.core.resources.IProject, org.eclipse.wst.common.project.facet.core.IProjectFacetVersion, java.lang.Object, org.eclipse.core.runtime.IProgressMonitor)}.
*/
public void testExecute() {
SeamFacetInstallDelegete seamDelegate = new SeamFacetInstallDelegete();
17 years, 5 months
JBoss Tools SVN: r2378 - trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/resources.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-07-11 02:43:31 -0400 (Wed, 11 Jul 2007)
New Revision: 2378
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/resources/ResourceLayoutManager.java
Log:
EXIN-562
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/resources/ResourceLayoutManager.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/resources/ResourceLayoutManager.java 2007-07-10 17:41:53 UTC (rev 2377)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/resources/ResourceLayoutManager.java 2007-07-11 06:43:31 UTC (rev 2378)
@@ -79,6 +79,7 @@
public Element getLayoutElement(IResource resource, String elementTag) {
Element element = null;
Document document = getLayoutDocument(resource);
+ if(document == null) return null;
NodeList nodeList = document.getElementsByTagName(elementTag);
if (nodeList==null || nodeList.getLength()==0 || nodeList.item(0)==null) {
// create new element
@@ -162,6 +163,7 @@
layoutLocation = resource.getPersistentProperty(new QualifiedName("",LAYOUT_PROPERTY));
} catch (CoreException e) {}
if (layoutLocation==null) layoutLocation = createNewLayoutLocation(resource);
+ if(!new File(layoutLocation).isFile()) return null;
//String fullLayoutLocation = getFullLocation(resource).addFileExtension(LAYOUT_EXT).toString();
Document document = null;
DocumentBuilder builder = null;
17 years, 5 months
JBoss Tools SVN: r2377 - in trunk/seam/plugins/org.jboss.tools.seam.core: src/org/jboss/tools/seam/internal/core/validation and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2007-07-10 13:41:53 -0400 (Tue, 10 Jul 2007)
New Revision: 2377
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamJavaValidator.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationContext.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidator.java
Log:
http://jira.jboss.com/jira/browse/EXIN-327 Saving problem markers between eclipse sessions.
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml 2007-07-10 17:22:42 UTC (rev 2376)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml 2007-07-10 17:41:53 UTC (rev 2377)
@@ -38,6 +38,15 @@
</persistent>
</extension>
<extension
+ id="seamProblem"
+ name="Seam Problem"
+ point="org.eclipse.core.resources.markers">
+ <super type="org.eclipse.wst.validation.problemmarker"/>
+ <persistent
+ value="true">
+ </persistent>
+ </extension>
+ <extension
point="org.eclipse.wst.common.project.facet.core.facets">
<project-facet
id="jst.seam">
@@ -127,7 +136,7 @@
objectClass="org.eclipse.core.resources.IFile"
nameFilter="*.java"/>
<markerId
- markerIdValue="SeamAnnatationValidatorMarker">
+ markerIdValue="seamProblem">
</markerId>
<helper
class="org.jboss.tools.seam.internal.core.validation.SeamJavaHelper">
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamJavaValidator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamJavaValidator.java 2007-07-10 17:22:42 UTC (rev 2376)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamJavaValidator.java 2007-07-10 17:41:53 UTC (rev 2377)
@@ -21,6 +21,7 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.wst.validation.internal.core.ValidationException;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -68,12 +69,12 @@
continue;
}
if (currentFile != null && currentFile.exists()) {
- String oldComponentNameOfChangedFile = validationContext.getNonuniqueNameOfComponent(currentFile.getLocation());
+ String oldComponentNameOfChangedFile = validationContext.getNonuniqueNameOfComponent(currentFile.getFullPath());
if(oldComponentNameOfChangedFile!=null) {
Set<IPath> resources = new HashSet<IPath>(); // Resources which we have to validate.
// Check if component name was changed in java file
- String newComponentNameOfChangedFile = getComponentNameByResource(currentFile.getLocation(), project);
+ String newComponentNameOfChangedFile = getComponentNameByResource(currentFile.getFullPath(), project);
if(newComponentNameOfChangedFile!=null && !oldComponentNameOfChangedFile.equals(newComponentNameOfChangedFile)) {
// Name was changed.
// Collect resources with new component name.
@@ -81,6 +82,9 @@
if(linkedResources!=null) {
resources.addAll(linkedResources);
}
+ // Check if changed file is not component anymore.
+ } else if(newComponentNameOfChangedFile == null) {
+ resources.add(currentFile.getFullPath());
}
// Collect resources with old component name.
@@ -102,7 +106,7 @@
}
} else {
// Validate new (unmarked) Java file.
- validateUniqueComponentName(project, currentFile.getLocation(), checkedComponents, helper, reporter);
+ validateUniqueComponentName(project, currentFile.getFullPath(), checkedComponents, helper, reporter);
}
// TODO
}
@@ -134,9 +138,12 @@
}
public void cleanup(IReporter reporter) {
+ super.cleanup(reporter);
}
private IStatus validateAll(ISeamProject project, IValidationContext helper, IReporter reporter) {
+ reporter.removeAllMessages(this);
+ validationContext.clear();
Set<ISeamComponent> components = project.getComponents();
for (ISeamComponent component : components) {
validateUniqueComponentName(project, component, helper, reporter);
@@ -173,11 +180,11 @@
ISeamTextSourceReference location = ((SeamComponentDeclaration)checkedDeclaration).getLocationFor(SeamComponentDeclaration.PATH_OF_NAME);
addError(NONUNIQUE_COMPONENT_NAME_MESSAGE_ID, location, checkedDeclarationResource, NONUNIQUE_NAME_MESSAGE_GROUP);
markedDeclarations.add(checkedDeclaration);
- validationContext.addLinkedResource(checkedDeclaration.getName(), checkedDeclarationResource.getLocation());
+ validationContext.addLinkedResource(checkedDeclaration.getName(), checkedDeclarationResource.getFullPath());
}
// Mark next wrong declaration with that name
markedDeclarations.add(javaDeclaration);
- validationContext.addLinkedResource(javaDeclaration.getName(), javaDeclaration.getResource().getLocation());
+ validationContext.addLinkedResource(javaDeclaration.getName(), javaDeclarationResource.getFullPath());
ISeamTextSourceReference location = ((SeamComponentDeclaration)javaDeclaration).getLocationFor(SeamComponentDeclaration.PATH_OF_NAME);
addError(NONUNIQUE_COMPONENT_NAME_MESSAGE_ID, location, javaDeclarationResource, NONUNIQUE_NAME_MESSAGE_GROUP);
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationContext.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationContext.java 2007-07-10 17:22:42 UTC (rev 2376)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationContext.java 2007-07-10 17:41:53 UTC (rev 2377)
@@ -53,4 +53,9 @@
public String getNonuniqueNameOfComponent(IPath sourcePath) {
return nonuniqueNames.get(sourcePath);
}
+
+ public void clear() {
+ markedNonuniqueNamedResources.clear();
+ nonuniqueNames.clear();
+ }
}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidator.java 2007-07-10 17:22:42 UTC (rev 2376)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidator.java 2007-07-10 17:41:53 UTC (rev 2377)
@@ -12,6 +12,7 @@
import java.util.Set;
+import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.wst.validation.internal.core.Message;
@@ -57,6 +58,9 @@
IMessage message = new Message(getBaseName(), IMessage.HIGH_SEVERITY, messageId, messageArguments, target, messageGroup);
message.setLength(location.getLength());
message.setOffset(location.getStartPosition());
+ message.setSeverity(IMessage.HIGH_SEVERITY);
+// message.setAttribute(IMarker.TRANSIENT, Boolean.TRUE);
+// message.setMarkerId("org.jboss.tools.seam.core.seamProblem");
reporter.addMessage(this, message);
}
17 years, 5 months
JBoss Tools SVN: r2376 - in trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam: internal/core and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-07-10 13:22:42 -0400 (Tue, 10 Jul 2007)
New Revision: 2376
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamElement.java
Removed:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamObject.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponentDeclaration.java
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/ISeamContextVariable.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProject.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProperty.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamObject.java
Log:
EXIN-217 ISeamObject renamed to ISeamElement
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponentDeclaration.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponentDeclaration.java 2007-07-10 17:10:55 UTC (rev 2375)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponentDeclaration.java 2007-07-10 17:22:42 UTC (rev 2376)
@@ -14,7 +14,7 @@
* Represents declaration of seam component.
* @author Alexey Kazakov
*/
-public interface ISeamComponentDeclaration extends ISeamObject, ISeamTextSourceReference {
+public interface ISeamComponentDeclaration extends ISeamElement, ISeamTextSourceReference {
/**
* @return name of component.
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-10 17:10:55 UTC (rev 2375)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponentMethod.java 2007-07-10 17:22:42 UTC (rev 2376)
@@ -15,7 +15,7 @@
* This interface represents only methods with types enumerated in SeamComponentMethodType
* @author Alexey Kazakov
*/
-public interface ISeamComponentMethod extends ISeamJavaSourceReference, ISeamObject {
+public interface ISeamComponentMethod extends ISeamJavaSourceReference, ISeamElement {
/**
* @return is @ Create method
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamContextVariable.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamContextVariable.java 2007-07-10 17:10:55 UTC (rev 2375)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamContextVariable.java 2007-07-10 17:22:42 UTC (rev 2376)
@@ -14,7 +14,7 @@
* Represents Seam Context Variable.
* @author Alexey Kazakov
*/
-public interface ISeamContextVariable extends ISeamObject {
+public interface ISeamContextVariable extends ISeamElement {
/**
* @return name of context variable
Copied: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamElement.java (from rev 2369, trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamObject.java)
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamElement.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamElement.java 2007-07-10 17:22:42 UTC (rev 2376)
@@ -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.core;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+
+/**
+ * Common interface for objects of seam model.
+ *
+ * @author Viacheslav Kabanovich
+ */
+public interface ISeamElement {
+
+ /**
+ * Returns seam project that contains this object.
+ * @return
+ */
+ public ISeamProject getSeamProject();
+
+ /**
+ * Returns parent object of seam model.
+ * @return
+ */
+ public ISeamElement getParent();
+
+ /**
+ * Returns path of resource that declares this object.
+ * @return
+ */
+ public IPath getSourcePath();
+
+ /**
+ * Returns resource that declares this object.
+ * @return resource
+ */
+ public IResource getResource();
+
+}
Deleted: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamObject.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamObject.java 2007-07-10 17:10:55 UTC (rev 2375)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamObject.java 2007-07-10 17:22:42 UTC (rev 2376)
@@ -1,47 +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.core;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IPath;
-
-/**
- * Common interface for objects of seam model.
- *
- * @author Viacheslav Kabanovich
- */
-public interface ISeamObject {
-
- /**
- * Returns seam project that contains this object.
- * @return
- */
- public ISeamProject getSeamProject();
-
- /**
- * Returns parent object of seam model.
- * @return
- */
- public ISeamObject getParent();
-
- /**
- * Returns path of resource that declares this object.
- * @return
- */
- public IPath getSourcePath();
-
- /**
- * Returns resource that declares this object.
- * @return resource
- */
- public IResource getResource();
-
-}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProject.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProject.java 2007-07-10 17:10:55 UTC (rev 2375)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProject.java 2007-07-10 17:22:42 UTC (rev 2376)
@@ -16,7 +16,7 @@
import org.eclipse.core.runtime.IPath;
import org.jboss.tools.seam.core.event.ISeamProjectChangeListener;
-public interface ISeamProject extends IProjectNature, ISeamObject {
+public interface ISeamProject extends IProjectNature, ISeamElement {
public static String NATURE_ID = "org.jboss.tools.seam.core.seam";
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProperty.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProperty.java 2007-07-10 17:10:55 UTC (rev 2375)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProperty.java 2007-07-10 17:22:42 UTC (rev 2376)
@@ -13,7 +13,7 @@
/**
* A property of Seam Component defined in component.xml or seam.properties files
*/
-public interface ISeamProperty extends ISeamObject, ISeamTextSourceReference {
+public interface ISeamProperty extends ISeamElement, ISeamTextSourceReference {
/**
* @return name of this property
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamObject.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamObject.java 2007-07-10 17:10:55 UTC (rev 2375)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamObject.java 2007-07-10 17:22:42 UTC (rev 2376)
@@ -15,14 +15,14 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
-import org.jboss.tools.seam.core.ISeamObject;
+import org.jboss.tools.seam.core.ISeamElement;
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.event.Change;
/**
* @author Viacheslav Kabanovich
*/
-public class SeamObject implements ISeamObject {
+public class SeamObject implements ISeamElement {
/**
* Object that allows to identify this object.
*/
@@ -41,7 +41,7 @@
/**
* Parent seam object in the seam model.
*/
- protected ISeamObject parent;
+ protected ISeamElement parent;
public SeamObject() {}
@@ -93,15 +93,15 @@
* Returns parent object of seam model.
* @return
*/
- public ISeamObject getParent() {
+ public ISeamElement getParent() {
return parent;
}
- public void setParent(ISeamObject parent) {
+ public void setParent(ISeamElement parent) {
this.parent = parent;
}
- protected void adopt(ISeamObject child) {
+ protected void adopt(ISeamElement child) {
((SeamObject)child).setParent(this);
}
17 years, 5 months
JBoss Tools SVN: r2375 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2007-07-10 13:10:55 -0400 (Tue, 10 Jul 2007)
New Revision: 2375
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/Shape.java
Log:
http://jira.jboss.com/jira/browse/EXIN-367
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2007-07-10 16:57:00 UTC (rev 2374)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2007-07-10 17:10:55 UTC (rev 2375)
@@ -344,6 +344,7 @@
Collection collection = (Collection)property.getValue();
Value component = collection.getElement();
if (component instanceof Component) {
+ getOrCreateComponentClass(property);
} else if (collection.isOneToMany()) {
OneToMany comp = (OneToMany)((Collection)property.getValue()).getElement();
if (component != null){
@@ -363,7 +364,7 @@
elements.remove(reference);
componentShape.setReference(null);
}
- //setDirty(true);
+ removeLinks(componentShape);
firePropertyChange(REFRESH, null, null);
}
@@ -372,18 +373,16 @@
for(int i=shape.getSourceConnections().size()-1;i>=0;i--){
con = shape.getSourceConnections().get(i);
con.getTarget().getTargetConnections().remove(con);
- shape.getSourceConnections().remove(i);
+ shape.getSourceConnections().remove(con);
}
for(int i=shape.getTargetConnections().size()-1;i>=0;i--){
con = shape.getTargetConnections().get(i);
con.getSource().getSourceConnections().remove(con);
- shape.getTargetConnections().remove(i);
+ shape.getTargetConnections().remove(con);
}
for(int i=shape.getChildren().size()-1;i>=0;i--){
removeLinks((Shape)shape.getChildren().get(i));
}
- //if(shape.getParent() != null)shape.getParent().getChildren().remove(shape);
- //elements.remove(shape);
}
protected void refreshComponentReferences(ComponentShape componentShape) {
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/Shape.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/Shape.java 2007-07-10 16:57:00 UTC (rev 2374)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/Shape.java 2007-07-10 17:10:55 UTC (rev 2375)
@@ -43,11 +43,11 @@
public List<Connection> getSourceConnections() {
- return new ArrayList<Connection>(sourceConnections);
+ return sourceConnections;
}
public List<Connection> getTargetConnections() {
- return new ArrayList<Connection>(targetConnections);
+ return targetConnections;
}
public Object getOrmElement() {
17 years, 5 months
JBoss Tools SVN: r2374 - trunk/as/features/org.jboss.ide.eclipse.as.feature.
by jbosstools-commits@lists.jboss.org
Author: mculpepper(a)jboss.com
Date: 2007-07-10 12:57:00 -0400 (Tue, 10 Jul 2007)
New Revision: 2374
Modified:
trunk/as/features/org.jboss.ide.eclipse.as.feature/feature.xml
Log:
dependencies for specific versions were changed from "equivalent" "greaterOrEquals", also got rid of non-sensical dependencies (JBIDE-500)
Modified: trunk/as/features/org.jboss.ide.eclipse.as.feature/feature.xml
===================================================================
--- trunk/as/features/org.jboss.ide.eclipse.as.feature/feature.xml 2007-07-10 16:55:23 UTC (rev 2373)
+++ trunk/as/features/org.jboss.ide.eclipse.as.feature/feature.xml 2007-07-10 16:57:00 UTC (rev 2374)
@@ -449,13 +449,11 @@
<import plugin="org.eclipse.debug.ui"/>
<import plugin="org.eclipse.ui.views"/>
<import plugin="org.eclipse.ui.editors"/>
- <import plugin="org.eclipse.ui.workbench.texteditor" version="3.2.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.wst.xml.ui"/>
<import plugin="org.eclipse.wst.sse.ui"/>
<import plugin="org.eclipse.wst.sse.core" version="1.1.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.jdt.ui" version="3.2.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.core.filesystem"/>
- <import plugin="org.eclipse.ui.ide" version="3.2.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.jst.server.tomcat.core"/>
<import plugin="org.eclipse.jst.servlet.ui"/>
<import plugin="org.eclipse.jst.j2ee.ui"/>
17 years, 5 months
JBoss Tools SVN: r2373 - trunk/as/features/org.jboss.ide.eclipse.as.feature.
by jbosstools-commits@lists.jboss.org
Author: mculpepper(a)jboss.com
Date: 2007-07-10 12:55:23 -0400 (Tue, 10 Jul 2007)
New Revision: 2373
Modified:
trunk/as/features/org.jboss.ide.eclipse.as.feature/feature.xml
Log:
dependencies for specific versions were changed from "equivalent" "greaterOrEquals"
Modified: trunk/as/features/org.jboss.ide.eclipse.as.feature/feature.xml
===================================================================
--- trunk/as/features/org.jboss.ide.eclipse.as.feature/feature.xml 2007-07-10 16:03:19 UTC (rev 2372)
+++ trunk/as/features/org.jboss.ide.eclipse.as.feature/feature.xml 2007-07-10 16:55:23 UTC (rev 2373)
@@ -426,39 +426,36 @@
<import plugin="org.eclipse.core.resources"/>
<import plugin="org.eclipse.jdt.launching"/>
<import plugin="org.eclipse.jdt.core"/>
- <import plugin="org.eclipse.jst.server.core" version="1.0.102" match="equivalent"/>
- <import plugin="org.eclipse.jst.server.generic.core" version="1.0.100" match="equivalent"/>
- <import plugin="org.eclipse.wst.server.core" version="1.0.102" match="equivalent"/>
+ <import plugin="org.eclipse.jst.server.core" version="1.0.102" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.wst.server.core" version="1.0.102" match="greaterOrEqual"/>
<import plugin="org.eclipse.core.boot"/>
- <import plugin="org.eclipse.debug.ui"/>
<import plugin="org.eclipse.jst.j2ee"/>
- <import plugin="org.eclipse.jst.j2ee.core" version="1.1.0" match="equivalent"/>
- <import plugin="org.eclipse.ant.ui"/>
- <import plugin="org.eclipse.ant.core"/>
- <import plugin="org.eclipse.ui.externaltools"/>
- <import plugin="org.eclipse.wst.common.project.facet.core" version="1.1.0" match="equivalent"/>
- <import plugin="org.eclipse.jst.common.project.facet.core" version="1.1.0" match="equivalent"/>
- <import plugin="org.eclipse.wst.xml.core" version="1.1.0" match="equivalent"/>
+ <import plugin="org.eclipse.jst.j2ee.core" version="1.1.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.wst.common.project.facet.core" version="1.1.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.jst.common.project.facet.core" version="1.1.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.wst.xml.core" version="1.1.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.ui"/>
<import plugin="org.eclipse.ui.forms"/>
<import plugin="org.eclipse.jst.server.ui"/>
- <import plugin="org.eclipse.wst.server.ui" version="1.0.102" match="equivalent"/>
+ <import plugin="org.eclipse.wst.server.ui" version="1.0.102" match="greaterOrEqual"/>
<import plugin="org.eclipse.wst.server.ui.doc.user"/>
+ <import plugin="org.eclipse.jst.server.generic.core" version="1.0.100" match="greaterOrEqual"/>
<import plugin="org.eclipse.jst.server.generic.ui"/>
<import plugin="org.eclipse.jdt.debug"/>
<import plugin="org.eclipse.jdt.debug.ui"/>
<import plugin="org.eclipse.ui.console"/>
<import plugin="org.eclipse.text"/>
<import plugin="org.eclipse.jface.text"/>
+ <import plugin="org.eclipse.debug.ui"/>
<import plugin="org.eclipse.ui.views"/>
<import plugin="org.eclipse.ui.editors"/>
- <import plugin="org.eclipse.ui.workbench.texteditor" version="3.2.0" match="equivalent"/>
+ <import plugin="org.eclipse.ui.workbench.texteditor" version="3.2.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.wst.xml.ui"/>
<import plugin="org.eclipse.wst.sse.ui"/>
- <import plugin="org.eclipse.wst.sse.core" version="1.1.0" match="equivalent"/>
- <import plugin="org.eclipse.jdt.ui" version="3.2.0" match="equivalent"/>
+ <import plugin="org.eclipse.wst.sse.core" version="1.1.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.jdt.ui" version="3.2.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.core.filesystem"/>
- <import plugin="org.eclipse.ui.ide" version="3.2.0" match="equivalent"/>
+ <import plugin="org.eclipse.ui.ide" version="3.2.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.jst.server.tomcat.core"/>
<import plugin="org.eclipse.jst.servlet.ui"/>
<import plugin="org.eclipse.jst.j2ee.ui"/>
@@ -475,6 +472,12 @@
<import plugin="org.eclipse.wst.ws"/>
<import plugin="org.eclipse.wst.ws.ui"/>
<import plugin="org.jboss.ide.eclipse.firstrun"/>
+ <import plugin="org.jboss.ide.eclipse.archives.core"/>
+ <import plugin="org.apache.ant"/>
+ <import plugin="org.jboss.ide.eclipse.archives.ui"/>
+ <import plugin="org.eclipse.jdt"/>
+ <import plugin="org.eclipse.wst.xml.ui.infopop"/>
+ <import plugin="org.jboss.ide.eclipse.ui"/>
</requires>
<plugin
17 years, 5 months