JBoss Tools SVN: r2262 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2007-07-03 12:48:03 -0400 (Tue, 03 Jul 2007)
New Revision: 2262
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponent.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamJavaComponentDeclaration.java
Log:
Organized imports
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponent.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponent.java 2007-07-03 16:45:24 UTC (rev 2261)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponent.java 2007-07-03 16:48:03 UTC (rev 2262)
@@ -14,10 +14,6 @@
import java.util.List;
import java.util.Set;
-import org.jboss.tools.seam.core.IRole;
-import org.jboss.tools.seam.core.ISeamAnnotatedFactory;
-import org.jboss.tools.seam.core.ISeamComponentMethod;
-
public interface ISeamComponent extends ISeamContextVariable {
public ISeamJavaComponentDeclaration getJavaDeclaration();
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamJavaComponentDeclaration.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamJavaComponentDeclaration.java 2007-07-03 16:45:24 UTC (rev 2261)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamJavaComponentDeclaration.java 2007-07-03 16:48:03 UTC (rev 2262)
@@ -12,10 +12,6 @@
import java.util.Set;
-import org.jboss.tools.seam.core.IRole;
-import org.jboss.tools.seam.core.ISeamAnnotatedFactory;
-import org.jboss.tools.seam.core.ISeamComponentMethod;
-
/**
* @author Alexey Kazakov
*
16 years, 10 months
JBoss Tools SVN: r2261 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2007-07-03 12:45:24 -0400 (Tue, 03 Jul 2007)
New Revision: 2261
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponent.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamJavaComponentDeclaration.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProject.java
Log:
http://jira.jboss.com/jira/browse/EXIN-216 Moved Factories from Seam Component to Seam Project
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponent.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponent.java 2007-07-03 16:34:03 UTC (rev 2260)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponent.java 2007-07-03 16:45:24 UTC (rev 2261)
@@ -79,11 +79,6 @@
public Set<ISeamComponentMethod> getMethodsByType(SeamComponentMethodType type);
/**
- * @return Factories methods of component
- */
- public Set<ISeamAnnotatedFactory> getFactories();
-
- /**
* Returns properties by name from component.xml.
* @param propertyName
* @return
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamJavaComponentDeclaration.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamJavaComponentDeclaration.java 2007-07-03 16:34:03 UTC (rev 2260)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamJavaComponentDeclaration.java 2007-07-03 16:45:24 UTC (rev 2261)
@@ -107,21 +107,4 @@
* @param method
*/
public void removeMethod(ISeamComponentMethod method);
-
- /**
- * @return Factories methods of component
- */
- public Set<ISeamAnnotatedFactory> getFactories();
-
- /**
- * Adds factory method
- * @param factory
- */
- public void addFactory(ISeamAnnotatedFactory factory);
-
- /**
- * Remove factory method
- * @param factory
- */
- public void removeFactory(ISeamAnnotatedFactory factory);
}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProject.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProject.java 2007-07-03 16:34:03 UTC (rev 2260)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProject.java 2007-07-03 16:45:24 UTC (rev 2261)
@@ -69,4 +69,36 @@
* @return all seam variables from specific context
*/
public Set<ISeamContextVariable> getVariablesByScope(ScopeType scope);
+
+ /**
+ * @return Factories methods of component
+ */
+ public Set<ISeamFactory> getFactories();
+
+ /**
+ * @return Factories methods of component
+ */
+ public Set<ISeamFactory> getFactories(String name, ScopeType scope);
+
+ /**
+ * @return Factories methods of component
+ */
+ public Set<ISeamFactory> getFactoriesByName(String name);
+
+ /**
+ * @return Factories methods of component
+ */
+ public Set<ISeamFactory> getFactoriesByScope(ScopeType scope);
+
+ /**
+ * Adds factory method
+ * @param factory
+ */
+ public void addFactory(ISeamFactory factory);
+
+ /**
+ * Remove factory method
+ * @param factory
+ */
+ public void removeFactory(ISeamFactory factory);
}
\ No newline at end of file
16 years, 10 months
JBoss Tools SVN: r2260 - in trunk/seam/plugins: org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2007-07-03 12:34:03 -0400 (Tue, 03 Jul 2007)
New Revision: 2260
Modified:
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/core/internal/project/facet/ISeamFacetDataModelProperties.java
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/core/internal/project/facet/SeamFacetInstallDelegete.java
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.ui/src/org/jboss/tools/seam/ui/wizard/SeamFormWizardPage1.java
Log:
http://jira.jboss.org/jira/browse/EXIN-221
remove System.out and main from code
Modified: 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/core/internal/project/facet/AntCopyUtils.java 2007-07-03 16:32:34 UTC (rev 2259)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/internal/project/facet/AntCopyUtils.java 2007-07-03 16:34:03 UTC (rev 2260)
@@ -7,8 +7,7 @@
*
* 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;
@@ -31,16 +30,6 @@
*/
public class AntCopyUtils {
- public static void main(String[] args) {
- Project prj = new Project();
- prj.setBaseDir(new File("C:\\java\\jboss-seam-1.2.1.GA\\seam-gen\\view"));
- Resource folder = new FileResource(new File("C:\\java\\jboss-seam-1.2.1.GA\\seam-gen\\view\\action.xhtml"));
- Resource dest = new FileResource();
- FilterSet set = new FilterSet();
- set.addFilter("methodName", "testValue");
- copyFilesAndFolders(new File("C:\\java\\jboss-seam-1.2.1.GA\\seam-gen\\view"), new File("C:\\temp\\WebContent"), new FilterSetCollection(set),true);
- }
-
public static void copyFilesAndFolders(File sourceFolder, File destinationFolder, FilterSetCollection set, boolean override) {
copyFilesAndFolders(sourceFolder, destinationFolder, null, set, override);
}
Modified: 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/core/internal/project/facet/ISeamFacetDataModelProperties.java 2007-07-03 16:32:34 UTC (rev 2259)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/internal/project/facet/ISeamFacetDataModelProperties.java 2007-07-03 16:34:03 UTC (rev 2260)
@@ -16,6 +16,11 @@
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.";
Modified: 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/core/internal/project/facet/SeamFacetInstallDataModelProvider.java 2007-07-03 16:32:34 UTC (rev 2259)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/internal/project/facet/SeamFacetInstallDataModelProvider.java 2007-07-03 16:34:03 UTC (rev 2260)
@@ -18,6 +18,7 @@
import org.eclipse.wst.common.project.facet.core.IActionConfigFactory;
/**
+ * Data model provider for Seam facet wizard page
* @author eskimo
*
*/
@@ -28,10 +29,11 @@
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();
@@ -67,6 +69,9 @@
return names;
}
+ /**
+ * Returns default value for a given property
+ */
public Object getDefaultProperty(String propertyName) {
if(JBOSS_AS_HOME.equals(propertyName)) {
return "Jboss_AS_HOME";
Modified: 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/core/internal/project/facet/SeamFacetInstallDelegete.java 2007-07-03 16:32:34 UTC (rev 2259)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/internal/project/facet/SeamFacetInstallDelegete.java 2007-07-03 16:34:03 UTC (rev 2260)
@@ -269,37 +269,7 @@
return set.isIncluded(pathname.getAbsolutePath());
}
}
-
-
- public static void main(String[] args) {
- System.out.println(Pattern.matches(".[^\\\\]*\\.jar", "tt\\test.jar"));
-// Properties props = new Properties();
-// props.put("hibernate.connection.username", "rooy");
-// FilterSet jdbcFs = FilterSetFactory.createJdbcFilterSet(props);
-// System.out.println(jdbcFs);
- FileSet include = VIEW_FILESET;
-// .dir("C:\\java\\jboss-seam-1.2.1.GA\\seam-gen\\view")
-// .include("home\\.xhtml")
-// .include("error\\.xhtml")
-// .include("login\\.xhtml")
-// .include("login\\.page.xml")
-// .include("index\\.html")
-// .include("layout\\.*")
-// .include("stylesheet\\.*")
-// .include("img\\.*")
-// .exclude(".*\\\\.*\\.ftl");
-//
- File file1 = new File("C:\\java\\jboss-seam-1.2.1.GA\\seam-gen\\view");
- FileSetFileFilter fileSetFilter = new FileSetFileFilter(include.dir(file1));
-// File[] copy = file1.listFiles(fileSetFilter);
-// for (File file : copy) {
-// System.out.println(file.getAbsolutePath());
-// }
-// copyFiles(file1,new File("c:\\temp\\4"),fileSetFilter);
- AntCopyUtils.copyFilesAndFolders(file1, new File("c:\\temp\\15"),fileSetFilter, new FilterSetCollection(), true);
- }
-
public static class FilterSetFactory {
public static FilterSet JDBC_TEMPLATE;
@@ -359,7 +329,6 @@
private static FilterSet aplayProperties(FilterSet template,IDataModel values) {
FilterSet result = new FilterSet();
for (Object filter : template.getFilterHash().keySet()) {
- System.out.println(filter + "=" +template.getFilterHash().get(filter));
String value = template.getFilterHash().get(filter).toString();
for (Object property : values.getAllProperties()) {
if(value.contains("${"+property.toString()+"}")) {
Modified: 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/core/internal/project/facet/SeamFacetUninstallDelegate.java 2007-07-03 16:32:34 UTC (rev 2259)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/internal/project/facet/SeamFacetUninstallDelegate.java 2007-07-03 16:34:03 UTC (rev 2260)
@@ -17,11 +17,17 @@
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/wizard/SeamFormWizardPage1.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamFormWizardPage1.java 2007-07-03 16:32:34 UTC (rev 2259)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamFormWizardPage1.java 2007-07-03 16:34:03 UTC (rev 2260)
@@ -50,29 +50,5 @@
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
*/
public void createControl(Composite parent) {
- // TODO Auto-generated method stub
-
}
-
- public static void main(String[] args) {
- Display d = new Display();
- Shell shell = new Shell(d);
- shell.setText("test");
- shell.open();
- GridLayout gl = new GridLayout(3,false);
- shell.setLayout(gl);
- IFieldEditor editor = IFieldEditorFactory.INSTANCE.createBrowseFolderEditor("test", "test1", "test2");
- editor.doFillIntoGrid(shell);
- editor = IFieldEditorFactory.INSTANCE.createTextEditor("test", "test1", "test2");
- editor.doFillIntoGrid(shell);
- editor = IFieldEditorFactory.INSTANCE.createComboEditor("test", "test1", Arrays.asList(new String[]{"war","ear"}),"test2");
- editor.doFillIntoGrid(shell);
- shell.update();
-
- while(!shell.isDisposed()) {
- if(!d.readAndDispatch()) d.sleep();
- }
-
- d.dispose();
- }
}
16 years, 10 months
JBoss Tools SVN: r2259 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/model.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2007-07-03 12:32:34 -0400 (Tue, 03 Jul 2007)
New Revision: 2259
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/model/OrmDiagram.java
Log:
http://jira.jboss.com/jira/browse/EXIN-368
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/model/OrmDiagram.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/model/OrmDiagram.java 2007-07-03 15:23:38 UTC (rev 2258)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/model/OrmDiagram.java 2007-07-03 16:32:34 UTC (rev 2259)
@@ -43,6 +43,9 @@
import org.hibernate.type.EntityType;
import org.hibernate.type.Type;
import org.jboss.tools.hibernate.veditor.VizualEditorPlugin;
+import org.jboss.tools.hibernate.veditor.editors.autolayout.IItemInfo;
+import org.jboss.tools.hibernate.veditor.editors.autolayout.ILinkInfo;
+import org.jboss.tools.hibernate.veditor.editors.autolayout.IProcessInfo;
/**
@@ -373,4 +376,158 @@
}
return classShape;
}
+
+ class DiagramInfo implements IProcessInfo {
+
+ ArrayList items = new ArrayList();
+
+ /**
+ *
+ * @param flow
+ */
+ public DiagramInfo() {
+ IItemInfo item;
+
+ for (int i = 0; i < getChildren().size(); i++) {
+ item = new DiagramElementInfo((OrmShape) getChildren().get(i));
+ addItem(item);
+ }
+ }
+
+ /**
+ *
+ */
+ public IItemInfo[] getItems() {
+ return (IItemInfo[]) items.toArray(new IItemInfo[0]);
+ }
+
+ /**
+ *
+ * @param item
+ */
+ public void addItem(IItemInfo item) {
+ items.add(item);
+ }
+ }
+
+ class DiagramElementInfo implements IItemInfo {
+ OrmShape element;
+
+ ArrayList links = new ArrayList();
+
+ /**
+ *
+ * @param element
+ */
+ public DiagramElementInfo(OrmShape element) {
+ ILinkInfo link;
+ this.element = element;
+ for (int i = 0; i < element.getSourceConnections().size(); i++) {
+ link = new LinkInfo((Connection) element.getSourceConnections().get(i));
+ addLink(link);
+ }
+ Shape child;
+ for (int j = 0; j < element.getChildren().size(); j++) {
+ child = (Shape) element.getChildren().get(j);
+ if (child.getSourceConnections().size() == 0) {
+ link = new LinkInfo(getID());
+ addLink(link);
+ }
+ for (int i = 0; i < child.getSourceConnections().size(); i++) {
+ link = new LinkInfo((Connection) child.getSourceConnections().get(i));
+ addLink(link);
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ public String getID() {
+ return element.toString();
+ }
+
+ /**
+ *
+ */
+ public boolean isComment() {
+ return false;
+ }
+
+ /**
+ *
+ */
+ public int[] getShape() {
+ int[] shape = new int[4];
+ shape[0] = element.getLocation().x;
+ shape[1] = element.getLocation().y;
+ shape[2] = 100;
+ shape[3] = 100;
+ return shape;
+ }
+
+ /**
+ *
+ */
+ public ILinkInfo[] getLinks() {
+ return (ILinkInfo[]) links.toArray(new ILinkInfo[0]);
+ }
+
+ /**
+ *
+ * @param link
+ */
+ public void addLink(ILinkInfo link) {
+ links.add(link);
+ }
+
+ /**
+ *
+ */
+ public void setShape(int[] s) {
+ element.setLocation(new Point(s[0], s[1]));
+ }
+
+ }
+
+ class LinkInfo implements ILinkInfo {
+ Connection link = null;
+
+ String id = null;
+
+ /**
+ *
+ * @param link
+ */
+ public LinkInfo(Connection link) {
+ this.link = link;
+ }
+
+ /**
+ *
+ * @param id
+ */
+ public LinkInfo(String id) {
+ this.id = id;
+ }
+
+ /**
+ *
+ */
+ public String getTargetID() {
+ if (id != null)
+ return id;
+ if (link.getTarget() != null)
+ return link.getTarget().toString();
+ else
+ return "";
+ }
+
+ /**
+ *
+ */
+ public void setLinkShape(int[] vs) {
+ }
+ }
+
}
\ No newline at end of file
16 years, 10 months
JBoss Tools SVN: r2258 - in trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam: internal/core and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-07-03 11:23:38 -0400 (Tue, 03 Jul 2007)
New Revision: 2258
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentDeclaration.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPropertiesDeclaration.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlComponentDeclaration.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamJavaComponentDeclaration.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamPropertiesDeclaration.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamXmlComponentDeclaration.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCoreBuilder.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponent.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProperty.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/IFileScanner.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/JavaScanner.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/LibraryScanner.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLScanner.java
Log:
EXIN-217
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamJavaComponentDeclaration.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamJavaComponentDeclaration.java 2007-07-03 15:22:27 UTC (rev 2257)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamJavaComponentDeclaration.java 2007-07-03 15:23:38 UTC (rev 2258)
@@ -21,6 +21,8 @@
*
*/
public interface ISeamJavaComponentDeclaration extends ISeamComponentDeclaration {
+
+ public String getClassName();
/**
* @return bijected attributes
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamPropertiesDeclaration.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamPropertiesDeclaration.java 2007-07-03 15:22:27 UTC (rev 2257)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamPropertiesDeclaration.java 2007-07-03 15:23:38 UTC (rev 2258)
@@ -10,8 +10,8 @@
******************************************************************************/
package org.jboss.tools.seam.core;
+import java.util.Collection;
import java.util.List;
-import java.util.Set;
/**
* @author Alexey Kazakov
@@ -38,7 +38,7 @@
* @param propertyName
* @return
*/
- public Set<ISeamProperty> getProperties();
+ public Collection<ISeamProperty> getProperties();
/**
* Adds property to component.
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamXmlComponentDeclaration.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamXmlComponentDeclaration.java 2007-07-03 15:22:27 UTC (rev 2257)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamXmlComponentDeclaration.java 2007-07-03 15:23:38 UTC (rev 2258)
@@ -15,6 +15,13 @@
*
*/
public interface ISeamXmlComponentDeclaration extends ISeamPropertiesDeclaration {
+ public String NAME = "name";
+ public String CLASS = "class";
+ public String SCOPE = "scope";
+ public String PRECEDENCE = "precedence";
+ public String INSTALLED = "installed";
+ public String AUTO_CREATE = "auto-create";
+ public String JNDI_NAME = "jndi-name";
public ScopeType getScope();
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCoreBuilder.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCoreBuilder.java 2007-07-03 15:22:27 UTC (rev 2257)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCoreBuilder.java 2007-07-03 15:23:38 UTC (rev 2258)
@@ -27,6 +27,7 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.jboss.tools.seam.internal.core.SeamComponent;
+import org.jboss.tools.seam.internal.core.SeamComponentDeclaration;
import org.jboss.tools.seam.internal.core.SeamProject;
import org.jboss.tools.seam.internal.core.scanner.IFileScanner;
import org.jboss.tools.seam.internal.core.scanner.java.JavaScanner;
@@ -85,7 +86,7 @@
IFileScanner scanner = FILE_SCANNERS[i];
if(scanner.isRelevant(f)) {
if(!scanner.isLikelyComponentSource(f)) return false;
- SeamComponent[] c = null;
+ SeamComponentDeclaration[] c = null;
try {
c = scanner.parse(f);
} catch (Exception e) {
@@ -100,7 +101,7 @@
}
}
- void componentsLoaded(SeamComponent[] c, IFile resource) {
+ void componentsLoaded(SeamComponentDeclaration[] c, IFile resource) {
if(c == null || c.length == 0) return;
SeamProject p = getSeamProject();
if(p == null) return;
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponent.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponent.java 2007-07-03 15:22:27 UTC (rev 2257)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponent.java 2007-07-03 15:23:38 UTC (rev 2258)
@@ -12,13 +12,10 @@
import java.util.ArrayList;
import java.util.Collection;
-import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
-import java.util.Map;
import java.util.Set;
-import org.eclipse.core.runtime.IPath;
import org.jboss.tools.seam.core.BijectedAttributeType;
import org.jboss.tools.seam.core.IBijectedAttribute;
import org.jboss.tools.seam.core.IRole;
@@ -29,126 +26,36 @@
import org.jboss.tools.seam.core.ISeamJavaComponentDeclaration;
import org.jboss.tools.seam.core.ISeamPropertiesDeclaration;
import org.jboss.tools.seam.core.ISeamProperty;
-import org.jboss.tools.seam.core.ISeamTextSourceReference;
import org.jboss.tools.seam.core.ISeamXmlComponentDeclaration;
import org.jboss.tools.seam.core.ScopeType;
import org.jboss.tools.seam.core.SeamComponentMethodType;
public class SeamComponent implements ISeamComponent {
- protected ISeamComponent base = null;
protected String name = null;
- protected String className = null;
- protected ScopeType scopeType = ScopeType.UNSPECIFIED;
- protected boolean stateful = false;
- protected boolean entity = false;
-
- protected Map<String,ISeamProperty> properties = new HashMap<String, ISeamProperty>();
- protected IPath source;
-
- protected Set<IBijectedAttribute> bijectedAttributes = new HashSet<IBijectedAttribute>();
- protected Set<ISeamAnnotatedFactory> annotatedFactories = new HashSet<ISeamAnnotatedFactory>();
- protected Set<ISeamComponentMethod> componentMethods = new HashSet<ISeamComponentMethod>();
- protected Set<IRole> roles = new HashSet<IRole>();
+ Set<ISeamComponentDeclaration> allDeclarations = new HashSet<ISeamComponentDeclaration>();
+ Set<ISeamJavaComponentDeclaration> javaDeclarations = new HashSet<ISeamJavaComponentDeclaration>();
+ Set<ISeamXmlComponentDeclaration> xmlDeclarations = new HashSet<ISeamXmlComponentDeclaration>();
+ Set<ISeamPropertiesDeclaration> propertyDeclarations = new HashSet<ISeamPropertiesDeclaration>();
+
public SeamComponent () {
}
- public void setBaseComponent(ISeamComponent base) {
- this.base = base;
- }
-
- public ISeamComponent getBaseComponent() {
- return base;
- }
-
- public Set<String> getPropertyNames() {
- return properties.keySet();
- }
-
- public boolean getBooleanProperty(String propertyName) {
- ISeamProperty o = getProperty(propertyName);
- Object value = o.getValue();
- if(value instanceof Boolean) return ((Boolean)value).booleanValue();
- if(value instanceof String && "true".equals(value));
- return false;
- }
-
- public String getStringProperty(String propertyName) {
- ISeamProperty o = getProperty(propertyName);
- Object value = o.getValue();
- return value == null ? null : value.toString();
- }
-
- public ISeamProperty getProperty(String propertyName) {
- return properties.get(propertyName);
- }
-
- public void addProperty(ISeamProperty property) {
- properties.put(property.getName(), property);
- }
-
- public void setStringProperty(String propertyName, String value) {
- ISeamProperty p = getProperty(propertyName);
- if(p == null) {
- p = new SeamProperty(propertyName, value);
- } else {
- p.setValue(value);
- }
- properties.put(propertyName, p);
- }
-
- public void setSourcePath(IPath path) {
- source = path;
- }
-
/**
- * @see org.jboss.tools.seam.core.ISeamComponent#addBijectedAttribute(org.jboss.tools.seam.core.IBijectedAttribute)
- */
- public void addBijectedAttribute(IBijectedAttribute attribute) {
- bijectedAttributes.add(attribute);
- }
-
- /**
- * @see org.jboss.tools.seam.core.ISeamComponent#addFactory(org.jboss.tools.seam.core.ISeamAnnotatedFactory)
- */
- public void addFactory(ISeamAnnotatedFactory factory) {
- annotatedFactories.add(factory);
- }
-
- /**
- * @see org.jboss.tools.seam.core.ISeamComponent#addMethod(org.jboss.tools.seam.core.ISeamComponentMethod)
- */
- public void addMethod(ISeamComponentMethod method) {
- componentMethods.add(method);
- }
-
- /**
- * @see org.jboss.tools.seam.core.ISeamComponent#addRole(org.jboss.tools.seam.core.IRole)
- */
- public void addRole(IRole role) {
- roles.add(role);
- }
-
- /**
* @see org.jboss.tools.seam.core.ISeamComponent#getBijectedAttributes()
*/
public Set<IBijectedAttribute> getBijectedAttributes() {
- return base != null ? base.getBijectedAttributes() : bijectedAttributes;
+ ISeamJavaComponentDeclaration javaDeclaration = getJavaDeclaration();
+ return (javaDeclaration == null) ? null : javaDeclaration.getBijectedAttributes();
}
/**
* @see org.jboss.tools.seam.core.ISeamComponent#getBijectedAttributesByName(java.lang.String)
*/
public Set<IBijectedAttribute> getBijectedAttributesByName(String name) {
- Set<IBijectedAttribute> result = null;
- for(IBijectedAttribute a: getBijectedAttributes()) {
- if(name.equals(a.getName())) {
- if(result == null) result = new HashSet<IBijectedAttribute>();
- result.add(a);
- }
- }
- return result;
+ ISeamJavaComponentDeclaration javaDeclaration = getJavaDeclaration();
+ return (javaDeclaration == null) ? null : javaDeclaration.getBijectedAttributesByName(name);
}
/**
@@ -156,35 +63,37 @@
*/
public Set<IBijectedAttribute> getBijectedAttributesByType(
BijectedAttributeType type) {
- Set<IBijectedAttribute> result = null;
- for(IBijectedAttribute a: getBijectedAttributes()) {
- if(type.equals(a.getType())) {
- if(result == null) result = new HashSet<IBijectedAttribute>();
- result.add(a);
- }
- }
- return result;
+ ISeamJavaComponentDeclaration javaDeclaration = getJavaDeclaration();
+ return (javaDeclaration == null) ? null : javaDeclaration.getBijectedAttributesByType(type);
}
/**
* @see org.jboss.tools.seam.core.ISeamComponent#getClassName()
*/
public String getClassName() {
- return className;
+ ISeamJavaComponentDeclaration javaDeclaration = getJavaDeclaration();
+ if(javaDeclaration != null) return javaDeclaration.getClassName();
+ Set<ISeamXmlComponentDeclaration> xml = getXmlDeclarations();
+ for(ISeamXmlComponentDeclaration d: xml) {
+ if(d.getClassName() != null) return d.getClassName();
+ }
+ return null;
}
/**
* @see org.jboss.tools.seam.core.ISeamComponent#getFactories()
*/
public Set<ISeamAnnotatedFactory> getFactories() {
- return base != null ? base.getFactories() : annotatedFactories;
+ ISeamJavaComponentDeclaration javaDeclaration = getJavaDeclaration();
+ return (javaDeclaration == null) ? null : javaDeclaration.getFactories();
}
/**
* @see org.jboss.tools.seam.core.ISeamComponent#getMethods()
*/
public Set<ISeamComponentMethod> getMethods() {
- return base != null ? base.getMethods() : componentMethods;
+ ISeamJavaComponentDeclaration javaDeclaration = getJavaDeclaration();
+ return (javaDeclaration == null) ? null : javaDeclaration.getMethods();
}
/**
@@ -192,93 +101,38 @@
*/
public Set<ISeamComponentMethod> getMethodsByType(
SeamComponentMethodType type) {
- Set<ISeamComponentMethod> result = null;
- for(ISeamComponentMethod a: getMethods()) {
- if(type.equals(a.getType())) {
- if(result == null) result = new HashSet<ISeamComponentMethod>();
- result.add(a);
- }
- }
- return result;
+ ISeamJavaComponentDeclaration javaDeclaration = getJavaDeclaration();
+ return (javaDeclaration == null) ? null : javaDeclaration.getMethodsByType(type);
}
/**
* @see org.jboss.tools.seam.core.ISeamComponent#getRoles()
*/
public Set<IRole> getRoles() {
- return base != null ? base.getRoles() : roles;
+ ISeamJavaComponentDeclaration javaDeclaration = getJavaDeclaration();
+ return (javaDeclaration == null) ? null : javaDeclaration.getRoles();
}
/**
* @see org.jboss.tools.seam.core.ISeamComponent#isEntity()
*/
public boolean isEntity() {
- return entity;
+ ISeamJavaComponentDeclaration javaDeclaration = getJavaDeclaration();
+ return (javaDeclaration != null) && javaDeclaration.isEntity();
}
/**
* @see org.jboss.tools.seam.core.ISeamComponent#isStateful()
*/
public boolean isStateful() {
- return stateful;
+ ISeamJavaComponentDeclaration javaDeclaration = getJavaDeclaration();
+ return (javaDeclaration != null) && javaDeclaration.isStateful();
}
/**
- * @see org.jboss.tools.seam.core.ISeamComponent#removeBijectedAttribute(org.jboss.tools.seam.core.IBijectedAttribute)
- */
- public void removeBijectedAttribute(IBijectedAttribute attribute) {
- bijectedAttributes.remove(attribute);
- }
-
- /**
- * @see org.jboss.tools.seam.core.ISeamComponent#removeFactory(org.jboss.tools.seam.core.ISeamAnnotatedFactory)
- */
- public void removeFactory(ISeamAnnotatedFactory factory) {
- annotatedFactories.remove(factory);
- }
-
- /**
- * @see org.jboss.tools.seam.core.ISeamComponent#removeMethod(org.jboss.tools.seam.core.ISeamComponentMethod)
- */
- public void removeMethod(ISeamComponentMethod method) {
- componentMethods.remove(method);
- }
-
- /**
- * @see org.jboss.tools.seam.core.ISeamComponent#removeRole(org.jboss.tools.seam.core.IRole)
- */
- public void removeRole(IRole role) {
- roles.remove(role);
- }
-
- /**
- * @see org.jboss.tools.seam.core.ISeamComponent#setClassName(java.lang.String)
- */
- public void setClassName(String className) {
- this.className = className;
- }
-
- /**
- * @see org.jboss.tools.seam.core.ISeamComponent#setEntity(boolean)
- */
- public void setEntity(boolean entity) {
- this.entity = entity;
- }
-
- /**
- * @see org.jboss.tools.seam.core.ISeamComponent#setStateful(boolean)
- */
- public void setStateful(boolean stateful) {
- this.stateful = stateful;
- }
-
- /**
* @see org.jboss.tools.seam.core.ISeamContextVariable#getName()
*/
public String getName() {
- if(name == null && base != null) {
- return base.getName();
- }
return name;
}
@@ -286,10 +140,8 @@
* @see org.jboss.tools.seam.core.ISeamContextVariable#getScope()
*/
public ScopeType getScope() {
- if(scopeType == ScopeType.UNSPECIFIED && base != null) {
- return base.getScope();
- }
- return scopeType;
+ //TODO
+ return null;
}
/**
@@ -303,7 +155,7 @@
* @see org.jboss.tools.seam.core.ISeamContextVariable#setScope(org.jboss.tools.seam.core.ScopeType)
*/
public void setScope(ScopeType type) {
- this.scopeType = type;
+ //TODO
}
/**
@@ -311,8 +163,10 @@
*/
public List<ISeamProperty> getProperties(String propertyName) {
List<ISeamProperty> list = new ArrayList<ISeamProperty>();
- ISeamProperty p = properties.get(propertyName);
- if(p != null) list.add(p);
+ Collection<ISeamProperty> ps = getProperties();
+ for (ISeamProperty p: ps) {
+ if(propertyName.equals(p.getName())) list.add(p);
+ }
return list;
}
@@ -320,34 +174,33 @@
* @see org.jboss.tools.seam.core.ISeamComponent#getProperties()
*/
public Collection<ISeamProperty> getProperties() {
- return properties.values();
+ Set<ISeamProperty> ps = new HashSet<ISeamProperty>();
+ Set<ISeamXmlComponentDeclaration> xml = getXmlDeclarations();
+ for (ISeamXmlComponentDeclaration d: xml) {
+ ps.addAll(d.getProperties());
+ }
+ Set<ISeamPropertiesDeclaration> pd = getPropertiesDeclarations();
+ for (ISeamPropertiesDeclaration d: pd) {
+ ps.addAll(d.getProperties());
+ }
+ return ps;
}
- /**
- * @see org.jboss.tools.seam.core.ISeamComponent#removeProperty(org.jboss.tools.seam.core.ISeamProperty)
- */
- public void removeProperty(ISeamProperty property) {
- properties.remove(property.getName());
- }
-
public Set<ISeamComponentDeclaration> getAllDeclarations() {
- // TODO Auto-generated method stub
- return null;
+ return allDeclarations;
}
public ISeamJavaComponentDeclaration getJavaDeclaration() {
- // TODO Auto-generated method stub
- return null;
+ if(javaDeclarations.size() == 0) return null;
+ return javaDeclarations.iterator().next();
}
public Set<ISeamPropertiesDeclaration> getPropertiesDeclarations() {
- // TODO Auto-generated method stub
- return null;
+ return propertyDeclarations;
}
public Set<ISeamXmlComponentDeclaration> getXmlDeclarations() {
- // TODO Auto-generated method stub
- return null;
+ return xmlDeclarations;
}
}
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentDeclaration.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentDeclaration.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentDeclaration.java 2007-07-03 15:23:38 UTC (rev 2258)
@@ -0,0 +1,25 @@
+package org.jboss.tools.seam.internal.core;
+
+import org.eclipse.core.runtime.IPath;
+import org.jboss.tools.seam.core.ISeamComponentDeclaration;
+
+public abstract class SeamComponentDeclaration implements ISeamComponentDeclaration {
+
+ protected IPath source;
+
+ protected String name;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setSourcePath(IPath path) {
+ source = path;
+ }
+
+
+}
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java 2007-07-03 15:23:38 UTC (rev 2258)
@@ -0,0 +1,131 @@
+package org.jboss.tools.seam.internal.core;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jboss.tools.seam.core.BijectedAttributeType;
+import org.jboss.tools.seam.core.IBijectedAttribute;
+import org.jboss.tools.seam.core.IRole;
+import org.jboss.tools.seam.core.ISeamAnnotatedFactory;
+import org.jboss.tools.seam.core.ISeamComponentMethod;
+import org.jboss.tools.seam.core.ISeamJavaComponentDeclaration;
+import org.jboss.tools.seam.core.ScopeType;
+import org.jboss.tools.seam.core.SeamComponentMethodType;
+
+public class SeamJavaComponentDeclaration extends SeamComponentDeclaration
+ implements ISeamJavaComponentDeclaration {
+
+ protected String className = null;
+ protected ScopeType scopeType = ScopeType.UNSPECIFIED;
+ protected boolean stateful = false;
+ protected boolean entity = false;
+
+ protected Set<IBijectedAttribute> bijectedAttributes = new HashSet<IBijectedAttribute>();
+ protected Set<ISeamAnnotatedFactory> annotatedFactories = new HashSet<ISeamAnnotatedFactory>();
+ protected Set<ISeamComponentMethod> componentMethods = new HashSet<ISeamComponentMethod>();
+ protected Set<IRole> roles = new HashSet<IRole>();
+
+ public String getClassName() {
+ return className;
+ }
+
+ public void setClassName(String className) {
+ this.className = className;
+ }
+
+ public void addBijectedAttribute(IBijectedAttribute attribute) {
+ bijectedAttributes.add(attribute);
+ }
+
+ public void addFactory(ISeamAnnotatedFactory factory) {
+ annotatedFactories.add(factory);
+ }
+
+ public void addMethod(ISeamComponentMethod method) {
+ componentMethods.add(method);
+ }
+
+ public void addRole(IRole role) {
+ roles.add(role);
+ }
+
+ public Set<IBijectedAttribute> getBijectedAttributes() {
+ return bijectedAttributes;
+ }
+
+ public Set<IBijectedAttribute> getBijectedAttributesByName(String name) {
+ Set<IBijectedAttribute> result = null;
+ for(IBijectedAttribute a: getBijectedAttributes()) {
+ if(name.equals(a.getName())) {
+ if(result == null) result = new HashSet<IBijectedAttribute>();
+ result.add(a);
+ }
+ }
+ return result;
+ }
+
+ public Set<IBijectedAttribute> getBijectedAttributesByType(
+ BijectedAttributeType type) {
+ Set<IBijectedAttribute> result = null;
+ for(IBijectedAttribute a: getBijectedAttributes()) {
+ if(type.equals(a.getType())) {
+ if(result == null) result = new HashSet<IBijectedAttribute>();
+ result.add(a);
+ }
+ }
+ return result;
+ }
+
+ public Set<ISeamAnnotatedFactory> getFactories() {
+ return annotatedFactories;
+ }
+
+ public Set<ISeamComponentMethod> getMethods() {
+ return componentMethods;
+ }
+
+ public Set<ISeamComponentMethod> getMethodsByType(
+ SeamComponentMethodType type) {
+ Set<ISeamComponentMethod> result = null;
+ for(ISeamComponentMethod a: getMethods()) {
+ if(type.equals(a.getType())) {
+ if(result == null) result = new HashSet<ISeamComponentMethod>();
+ result.add(a);
+ }
+ }
+ return result;
+ }
+
+ public Set<IRole> getRoles() {
+ return roles;
+ }
+
+ public boolean isEntity() {
+ return entity;
+ }
+
+ public boolean isStateful() {
+ return stateful;
+ }
+
+ public void removeBijectedAttribute(IBijectedAttribute attribute) {
+ bijectedAttributes.remove(attribute);
+ }
+
+ public void removeFactory(ISeamAnnotatedFactory factory) {
+ annotatedFactories.remove(factory);
+ }
+
+ public void removeMethod(ISeamComponentMethod method) {
+ componentMethods.remove(method);
+ }
+
+ public void removeRole(IRole role) {
+ roles.remove(role);
+ }
+
+ public void setEntity(boolean entity) {
+ this.entity = entity;
+ }
+
+}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2007-07-03 15:22:27 UTC (rev 2257)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2007-07-03 15:23:38 UTC (rev 2258)
@@ -18,6 +18,7 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.jboss.tools.seam.core.ISeamComponent;
+import org.jboss.tools.seam.core.ISeamComponentDeclaration;
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.ISeamContextVariable;
import org.jboss.tools.seam.core.ScopeType;
@@ -76,12 +77,15 @@
* @param component
* @param source
*/
- public void registerComponents(SeamComponent[] list, IPath source) {
+ public void registerComponents(SeamComponentDeclaration[] list, IPath source) {
pathRemoved(source);
if(list == null) return;
+ //TODO
for (int i = 0; i < list.length; i++) {
- list[i].setSourcePath(source);
- allComponents.add(list[i]);
+// list[i].setSourcePath(source);
+
+ //TODO !!!
+// allComponents.add(list[i]);
}
}
@@ -92,8 +96,13 @@
public void pathRemoved(IPath source) {
Iterator<SeamComponent> iterator = allComponents.iterator();
while(iterator.hasNext()) {
- SeamComponent c = iterator.next();
- if(c.source != null && source.isPrefixOf(c.source)) {
+ ISeamComponent c = iterator.next();
+ Iterator<ISeamComponentDeclaration> ds = c.getAllDeclarations().iterator();
+ while (ds.hasNext()) {
+ SeamComponentDeclaration di = (SeamComponentDeclaration)ds.next();
+ if(di.source.equals(source)) ds.remove();
+ }
+ if(c.getAllDeclarations().size() == 0) {
iterator.remove();
}
}
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPropertiesDeclaration.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPropertiesDeclaration.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPropertiesDeclaration.java 2007-07-03 15:23:38 UTC (rev 2258)
@@ -0,0 +1,45 @@
+package org.jboss.tools.seam.internal.core;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.tools.seam.core.ISeamPropertiesDeclaration;
+import org.jboss.tools.seam.core.ISeamProperty;
+
+public class SeamPropertiesDeclaration extends SeamComponentDeclaration
+ implements ISeamPropertiesDeclaration {
+
+ protected Map<String,ISeamProperty> properties = new HashMap<String, ISeamProperty>();
+
+ public void addProperty(ISeamProperty property) {
+ properties.put(property.getName(), property);
+ }
+
+ public List<ISeamProperty> getProperties(String propertyName) {
+ List<ISeamProperty> list = new ArrayList<ISeamProperty>();
+ ISeamProperty p = properties.get(propertyName);
+ if(p != null) list.add(p);
+ return list;
+ }
+
+ public Collection<ISeamProperty> getProperties() {
+ return properties.values();
+ }
+
+ public ISeamProperty getProperty(String propertyName) {
+ return properties.get(propertyName);
+ }
+
+ public void removeProperty(ISeamProperty property) {
+ properties.remove(property.getName());
+ }
+
+ public void addStringProperty(String name, String value) {
+ SeamProperty p = new SeamProperty(name, value);
+ addProperty(p);
+ }
+
+}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProperty.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProperty.java 2007-07-03 15:22:27 UTC (rev 2257)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProperty.java 2007-07-03 15:23:38 UTC (rev 2258)
@@ -30,6 +30,11 @@
this.value = value;
}
+ public SeamProperty(String name, Object value) {
+ this.name = name;
+ this.value = value;
+ }
+
public String getName() {
return name;
}
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlComponentDeclaration.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlComponentDeclaration.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlComponentDeclaration.java 2007-07-03 15:23:38 UTC (rev 2258)
@@ -0,0 +1,77 @@
+package org.jboss.tools.seam.internal.core;
+
+import org.jboss.tools.seam.core.ISeamXmlComponentDeclaration;
+import org.jboss.tools.seam.core.ScopeType;
+
+public class SeamXmlComponentDeclaration extends SeamPropertiesDeclaration
+ implements ISeamXmlComponentDeclaration {
+
+ String autoCreate = null;
+ String className = null;
+ String installed = null;
+ String jndiName = null;
+ String precedence = null;
+ String scope = null;
+
+ public String getAutoCreateAsString() {
+ return autoCreate;
+ }
+
+ public String getClassName() {
+ return className;
+ }
+
+ public boolean getInstalledAsString() {
+ return "true".equals(installed);
+ }
+
+ public String getJndiName() {
+ return jndiName;
+ }
+
+ public String getPrecedence() {
+ return precedence;
+ }
+
+ public ScopeType getScope() {
+ if(scope == null || scope.length() == 0) return ScopeType.UNSPECIFIED;
+ return ScopeType.valueOf(scope);
+ }
+
+ public String getScopeAsString() {
+ return scope;
+ }
+
+ public boolean isAutoCreate() {
+ return "true".equals(autoCreate);
+ }
+
+ public boolean isInstalled() {
+ return "true".equals(installed);
+ }
+
+ public void setClassName(String className) {
+ this.className = className;
+ }
+
+ public void setAutoCreate(String autoCreate) {
+ this.autoCreate = autoCreate;
+ }
+
+ public void setInstalled(String installed) {
+ this.installed = installed;
+ }
+
+ public void setJndiName(String jndiName) {
+ this.jndiName = jndiName;
+ }
+
+ public void setPrecedence(String precedence) {
+ this.precedence = precedence;
+ }
+
+ public void setScope(String scope) {
+ this.scope = scope;
+ }
+
+}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/IFileScanner.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/IFileScanner.java 2007-07-03 15:22:27 UTC (rev 2257)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/IFileScanner.java 2007-07-03 15:23:38 UTC (rev 2258)
@@ -12,6 +12,7 @@
import org.eclipse.core.resources.IFile;
import org.jboss.tools.seam.internal.core.SeamComponent;
+import org.jboss.tools.seam.internal.core.SeamComponentDeclaration;
public interface IFileScanner {
@@ -37,6 +38,6 @@
* @return
* @throws Exception
*/
- public SeamComponent[] parse(IFile f) throws Exception;
+ public SeamComponentDeclaration[] parse(IFile f) throws Exception;
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/JavaScanner.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/JavaScanner.java 2007-07-03 15:22:27 UTC (rev 2257)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/JavaScanner.java 2007-07-03 15:23:38 UTC (rev 2258)
@@ -26,7 +26,8 @@
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.common.util.FileUtil;
-import org.jboss.tools.seam.internal.core.SeamComponent;
+import org.jboss.tools.seam.internal.core.SeamComponentDeclaration;
+import org.jboss.tools.seam.internal.core.SeamJavaComponentDeclaration;
import org.jboss.tools.seam.internal.core.scanner.IFileScanner;
public class JavaScanner implements IFileScanner {
@@ -67,14 +68,14 @@
* @return
* @throws Exception
*/
- public SeamComponent[] parse(IFile f) throws Exception {
+ public SeamComponentDeclaration[] parse(IFile f) throws Exception {
ICompilationUnit u = getCompilationUnit(f);
if(u == null) return null;
ASTRequestorImpl requestor = new ASTRequestorImpl();
ICompilationUnit[] us = new ICompilationUnit[]{u};
ASTParser.newParser(AST.JLS3).createASTs(us, new String[0], requestor, null);
- SeamComponent component = requestor.getComponent();
- return component == null ? new SeamComponent[0] : new SeamComponent[]{component};
+ SeamComponentDeclaration component = requestor.getComponent();
+ return component == null ? new SeamComponentDeclaration[0] : new SeamComponentDeclaration[]{component};
}
private ICompilationUnit getCompilationUnit(IFile f) throws Exception {
@@ -96,9 +97,9 @@
class ASTRequestorImpl extends ASTRequestor {
private ASTVisitorImpl visitor = new ASTVisitorImpl();
- private SeamComponent component = null;
+ private SeamJavaComponentDeclaration component = null;
- public SeamComponent getComponent() {
+ public SeamComponentDeclaration getComponent() {
return component;
}
@@ -117,7 +118,7 @@
if(visitor.name != null && visitor.type != null) {
String n = visitor.type.getElementName();
n = getResolvedType(visitor.type, n);
- component = new SeamComponent();
+ component = new SeamJavaComponentDeclaration();
component.setClassName(n);
component.setName(visitor.name);
if(visitor.scope != null) {
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-03 15:22:27 UTC (rev 2257)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/LibraryScanner.java 2007-07-03 15:23:38 UTC (rev 2258)
@@ -17,6 +17,7 @@
import org.jboss.tools.common.model.filesystems.impl.FileSystemsImpl;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.seam.internal.core.SeamComponent;
+import org.jboss.tools.seam.internal.core.SeamComponentDeclaration;
import org.jboss.tools.seam.internal.core.scanner.IFileScanner;
import org.jboss.tools.seam.internal.core.scanner.xml.XMLScanner;
@@ -40,7 +41,7 @@
return false;
}
- public SeamComponent[] parse(IFile f) throws Exception {
+ public SeamComponentDeclaration[] parse(IFile f) throws Exception {
XModelObject o = EclipseResourceUtil.getObjectByResource(f);
if(o == null) return null;
if(!o.getModelEntity().getName().equals("FileSystemJar")) {
@@ -52,12 +53,12 @@
XModelObject componentsXML = o.getChildByPath("META-INF/components.xml");
if(componentsXML == null && seamProperties == null) return null;
- ArrayList<SeamComponent> list = new ArrayList<SeamComponent>();
+ ArrayList<SeamComponentDeclaration> list = new ArrayList<SeamComponentDeclaration>();
processJavaClasses(o, list);
if(componentsXML != null) {
- SeamComponent[] components = new XMLScanner().parse(componentsXML);
+ SeamComponentDeclaration[] components = new XMLScanner().parse(componentsXML);
if(components != null) {
for (int i = 0; i < components.length; i++) list.add(components[i]);
}
@@ -72,10 +73,10 @@
//TODO add components to list
}
- return list.toArray(new SeamComponent[0]);
+ return list.toArray(new SeamComponentDeclaration[0]);
}
- protected void processJavaClasses(XModelObject o, ArrayList<SeamComponent> list) {
+ protected void processJavaClasses(XModelObject o, ArrayList<SeamComponentDeclaration> list) {
//TODO
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLScanner.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLScanner.java 2007-07-03 15:22:27 UTC (rev 2257)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLScanner.java 2007-07-03 15:23:38 UTC (rev 2258)
@@ -22,7 +22,11 @@
import org.jboss.tools.common.meta.XModelEntity;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.seam.core.ISeamXmlComponentDeclaration;
import org.jboss.tools.seam.internal.core.SeamComponent;
+import org.jboss.tools.seam.internal.core.SeamComponentDeclaration;
+import org.jboss.tools.seam.internal.core.SeamProperty;
+import org.jboss.tools.seam.internal.core.SeamXmlComponentDeclaration;
import org.jboss.tools.seam.internal.core.scanner.IFileScanner;
public class XMLScanner implements IFileScanner {
@@ -63,7 +67,7 @@
* @return
* @throws Exception
*/
- public SeamComponent[] parse(IFile f) throws Exception {
+ public SeamComponentDeclaration[] parse(IFile f) throws Exception {
XModelObject o = EclipseResourceUtil.getObjectByResource(f);
return parse(o);
}
@@ -81,23 +85,22 @@
// COMMON_ATTRIBUTES.add(ISeamComponent.JNDI_NAME);
}
- public SeamComponent[] parse(XModelObject o) {
+ public SeamComponentDeclaration[] parse(XModelObject o) {
if(o == null) return null;
- ArrayList<SeamComponent> list = new ArrayList<SeamComponent>();
+ ArrayList<SeamComponentDeclaration> list = new ArrayList<SeamComponentDeclaration>();
XModelObject[] os = o.getChildren();
for (int i = 0; i < os.length; i++) {
XModelEntity componentEntity = os[i].getModelEntity();
if(componentEntity.getAttribute("class") != null) {
- //This is a component model object
- SeamComponent component = new SeamComponent();
+ SeamXmlComponentDeclaration component = new SeamXmlComponentDeclaration();
//TODO
-// component.setName(os[i].getAttributeValue(ISeamComponent.NAME));
-// component.setClassName(os[i].getAttributeValue(ISeamComponent.CLASS));
-// component.setScope(os[i].getAttributeValue(ISeamComponent.SCOPE));
-// component.setPrecedence(os[i].getAttributeValue(ISeamComponent.PRECEDENCE));
-// component.setInstalled(os[i].getAttributeValue(ISeamComponent.INSTALLED));
-// component.setAutoCreate(os[i].getAttributeValue(ISeamComponent.AUTO_CREATE));
-// component.setJndiName(os[i].getAttributeValue(ISeamComponent.JNDI_NAME));
+ component.setName(os[i].getAttributeValue(ISeamXmlComponentDeclaration.NAME));
+ component.setClassName(os[i].getAttributeValue(ISeamXmlComponentDeclaration.CLASS));
+ component.setScope(os[i].getAttributeValue(ISeamXmlComponentDeclaration.SCOPE));
+ component.setPrecedence(os[i].getAttributeValue(ISeamXmlComponentDeclaration.PRECEDENCE));
+ component.setInstalled(os[i].getAttributeValue(ISeamXmlComponentDeclaration.INSTALLED));
+ component.setAutoCreate(os[i].getAttributeValue(ISeamXmlComponentDeclaration.AUTO_CREATE));
+ component.setJndiName(os[i].getAttributeValue(ISeamXmlComponentDeclaration.JNDI_NAME));
XAttribute[] attributes = componentEntity.getAttributes();
for (int ia = 0; ia < attributes.length; ia++) {
@@ -106,7 +109,7 @@
if(xml == null) continue;
if(COMMON_ATTRIBUTES.contains(xml)) continue;
String stringValue = os[i].getAttributeValue(a.getName());
- component.setStringProperty(xml, stringValue);
+ component.addStringProperty(xml, stringValue);
}
XModelObject[] properties = os[i].getChildren();
@@ -116,7 +119,7 @@
if(entity.getAttribute("value") != null) {
//this is simple value;
String value = properties[j].getAttributeValue("value");
- component.setStringProperty(propertyName, value);
+ component.addStringProperty(propertyName, value);
} else {
XModelObject[] entries = properties[j].getChildren();
if(entity.getChild("SeamListEntry") != null
@@ -126,7 +129,7 @@
for (int k = 0; k < entries.length; k++) {
listValues.add(entries[k].getAttributeValue("value"));
}
-// component.addProperty(new SeamProperty<List<String>>(propertyName, listValues));
+ component.addProperty(new SeamProperty(propertyName, listValues));
} else {
//this is map value
Map<String,String> mapValues = new HashMap<String, String>();
@@ -135,7 +138,7 @@
String entryValue = entries[k].getAttributeValue("value");
mapValues.put(entryKey, entryValue);
}
-// component.addProperty(new SeamProperty<Map<String,String>>(propertyName, mapValues));
+ component.addProperty(new SeamProperty(propertyName, mapValues));
}
}
//TODO assign positioning attributes to created ISeamProperty object
@@ -150,12 +153,12 @@
// component.setScope(os[i].getAttributeValue(ISeamComponent.SCOPE));
String value = os[i].getAttributeValue("value");
//TODO how should we resolve value?
- if(value != null) component.setStringProperty("value", value);
+// if(value != null) component.addStringProperty("value", value);
- list.add(component);
+// list.add(component);
}
}
- return list.toArray(new SeamComponent[0]);
+ return list.toArray(new SeamComponentDeclaration[0]);
}
}
\ No newline at end of file
16 years, 10 months
JBoss Tools SVN: r2257 - in trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors: autolayout and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2007-07-03 11:22:27 -0400 (Tue, 03 Jul 2007)
New Revision: 2257
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/AutoLayout.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/Example.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/IItemInfo.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/ILinkInfo.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/IProcessInfo.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/impl/
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/impl/AutoLayoutImpl.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/impl/Group.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/impl/GroupArranger.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/impl/Groups.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/impl/Item.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/impl/Items.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/impl/LayuotConstants.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/impl/TransitionArranger.java
Log:
http://jira.jboss.com/jira/browse/EXIN-368
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/AutoLayout.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/AutoLayout.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/AutoLayout.java 2007-07-03 15:22:27 UTC (rev 2257)
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.hibernate.veditor.editors.autolayout;
+
+import org.jboss.tools.hibernate.veditor.editors.autolayout.impl.AutoLayoutImpl;
+import org.jboss.tools.hibernate.veditor.editors.autolayout.impl.Items;
+
+
+public class AutoLayout {
+ AutoLayoutImpl engine = new AutoLayoutImpl();
+
+ public AutoLayout() {
+ this(new Items());
+ }
+
+ public AutoLayout(Items items) {
+ setItems(items);
+ }
+
+ public void setGridStep(String gridStep) {
+ engine.setGridStep(gridStep);
+ }
+
+ public void setItems(Items items) {
+ engine.setItems(items);
+ }
+
+ public void setOverride(boolean b) {
+ engine.setOverride(b);
+ }
+
+ public void setProcess(IProcessInfo process) {
+ engine.setProcess(process);
+ }
+
+}
\ No newline at end of file
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/Example.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/Example.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/Example.java 2007-07-03 15:22:27 UTC (rev 2257)
@@ -0,0 +1,132 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.hibernate.veditor.editors.autolayout;
+
+import java.util.ArrayList;
+
+public class Example {
+
+ public static IProcessInfo generateRandomProcess(int nodeCount, int linkCount) {
+ ProcessInfoImpl process = new ProcessInfoImpl();
+ for (int i = 0; i < nodeCount; i++) {
+ ItemInfoImpl item = new ItemInfoImpl();
+ item.setID("n_" + i);
+ process.addItem(item);
+ }
+ IItemInfo[] items = process.getItems();
+ for (int i = 0; i < linkCount; i++) {
+ int n1 = (int)(nodeCount * Math.random());
+ int n2 = (int)(nodeCount * Math.random());
+ String target = ((ItemInfoImpl)items[n2]).getID();
+ LinkInfoImpl link = new LinkInfoImpl();
+ link.setTargetID(target);
+ ((ItemInfoImpl)items[n1]).addLink(link);
+ }
+ return process;
+ }
+
+ static void printProcess(IProcessInfo process) {
+ IItemInfo[] items = process.getItems();
+ for (int i = 0; i < items.length; i++) printItem(items[i]);
+ }
+
+ static void printItem(IItemInfo item) {
+ System.out.print(item.getID() + " (");
+ int[] shape = item.getShape();
+ for (int i = 0; i < shape.length; i++) {
+ if(i > 0) System.out.print(",");
+ System.out.print(shape[i]);
+ }
+ System.out.print(") -->");
+ ILinkInfo[] links = item.getLinks();
+ for (int i = 0; i < links.length; i++) {
+ if(i > 0) System.out.print(",");
+ System.out.print(links[i].getTargetID());
+ }
+ System.out.println("");
+ }
+
+ public static void main(String[] args) {
+ IProcessInfo process = generateRandomProcess(10, 17);
+ System.out.println("Before Layout");
+ printProcess(process);
+ AutoLayout layout = new AutoLayout();
+ layout.setGridStep("" + 8);
+ layout.setOverride(true);
+ layout.setProcess(process);
+ System.out.println("After Layout");
+ printProcess(process);
+ }
+}
+
+class ProcessInfoImpl implements IProcessInfo {
+ ArrayList items = new ArrayList();
+
+ public IItemInfo[] getItems() {
+ return (IItemInfo[])items.toArray(new IItemInfo[0]);
+ }
+
+ public void addItem(IItemInfo item) {
+ items.add(item);
+ }
+
+}
+
+class ItemInfoImpl implements IItemInfo {
+ String id = "";
+ int[] shape = new int[0];
+ ArrayList links = new ArrayList();
+
+ public void setID(String id) {
+ this.id = id;
+ }
+
+ public String getID() {
+ return id;
+ }
+
+ public boolean isComment() {
+ return false;
+ }
+
+ public int[] getShape() {
+ return shape;
+ }
+
+ public ILinkInfo[] getLinks() {
+ return (ILinkInfo[])links.toArray(new ILinkInfo[0]);
+ }
+
+ public void addLink(ILinkInfo link) {
+ links.add(link);
+ }
+
+ public void setShape(int[] s) {
+ this.shape = s;
+ }
+
+}
+
+class LinkInfoImpl implements ILinkInfo {
+ String target;
+
+ public void setTargetID(String target) {
+ this.target = target;
+ }
+
+ public String getTargetID() {
+ return target;
+ }
+
+ public void setLinkShape(int[] vs) {
+ }
+
+}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/IItemInfo.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/IItemInfo.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/IItemInfo.java 2007-07-03 15:22:27 UTC (rev 2257)
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.hibernate.veditor.editors.autolayout;
+
+public interface IItemInfo {
+ public String getID();
+ public boolean isComment();
+ public int[] getShape();
+ ILinkInfo[] getLinks();
+ public void setShape(int[] s);
+}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/ILinkInfo.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/ILinkInfo.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/ILinkInfo.java 2007-07-03 15:22:27 UTC (rev 2257)
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.hibernate.veditor.editors.autolayout;
+
+public interface ILinkInfo {
+ public String getTargetID();
+ public void setLinkShape(int[] vs);
+}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/IProcessInfo.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/IProcessInfo.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/IProcessInfo.java 2007-07-03 15:22:27 UTC (rev 2257)
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.hibernate.veditor.editors.autolayout;
+
+public interface IProcessInfo {
+ IItemInfo[] getItems();
+}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/impl/AutoLayoutImpl.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/impl/AutoLayoutImpl.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/impl/AutoLayoutImpl.java 2007-07-03 15:22:27 UTC (rev 2257)
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.hibernate.veditor.editors.autolayout.impl;
+
+import org.jboss.tools.hibernate.veditor.editors.autolayout.IItemInfo;
+import org.jboss.tools.hibernate.veditor.editors.autolayout.ILinkInfo;
+import org.jboss.tools.hibernate.veditor.editors.autolayout.IProcessInfo;
+
+
+public class AutoLayoutImpl {
+ LayuotConstants constants = new LayuotConstants();
+ protected Items items;
+
+ public AutoLayoutImpl() {}
+
+ public void setGridStep(String gridStep) {
+ constants.update(gridStep);
+ }
+
+ public void setItems(Items items) {
+ this.items = items;
+ items.setConstants(constants);
+ }
+
+ public void setOverride(boolean b) {
+ items.setOverride(b);
+ }
+
+ public void setProcess(IProcessInfo process) {
+// constants.update();
+ items.setProcess(process);
+ apply();
+ if(items.override) {
+ TransitionArranger a = new TransitionArranger();
+ a.setItems(items.items);
+ a.execute();
+ }
+ }
+
+ private void apply() {
+ resetTransitions(); // temporal
+
+ Item[] is = items.items;
+ int[] yDeltas = items.groups.yDeltas;
+ for (int i = 0; i < is.length; i++) {
+ if(is[i].isSet()) continue;
+ IItemInfo o = is[i].itemInfo;
+ int x = is[i].ix * constants.deltaX + constants.indentX;
+ int y = is[i].iy * constants.deltaY + constants.indentY;
+ if(is[i].ix % 2 == 1) y += 16;
+ x += is[i].group.xDeltas[is[i].ix] * constants.incX;
+ y += yDeltas[is[i].iy] * constants.incY + is[i].yIndent;
+ o.setShape(new int[]{x, y, 0, 0});
+ }
+ }
+
+ private void resetTransitions() {
+ if(!items.override) return;
+ Item[] is = items.items;
+ for (int i = 0; i < is.length; i++) {
+ IItemInfo o = is[i].itemInfo;
+ if(o instanceof ILinkInfo) {
+ ((ILinkInfo)o).setLinkShape(new int[0]);
+ }
+ ILinkInfo[] os = items.getOutput(o);
+ for (int j = 0; j < os.length; j++) {
+ os[j].setLinkShape(new int[0]);
+ }
+ }
+
+ }
+
+}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/impl/Group.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/impl/Group.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/impl/Group.java 2007-07-03 15:22:27 UTC (rev 2257)
@@ -0,0 +1,237 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.hibernate.veditor.editors.autolayout.impl;
+
+import java.util.*;
+
+public class Group {
+ LayuotConstants constants;
+ int number;
+ List itemList = new ArrayList();
+ Item[] allitems = null;
+ private int[] items = null;
+ int miny = -1;
+ int[] xDeltas = null;
+ GroupArranger arranger = new GroupArranger(this);
+
+ public Group() {}
+
+ public void setItems(Item[] items) {
+ allitems = items;
+ }
+
+ public void setConstants(LayuotConstants constants) {
+ this.constants = constants;
+ }
+
+ public void expandGroup(int _item) {
+ Item item = allitems[_item];
+ item.group = this;
+ itemList.add(new Integer(_item));
+ int[] is = item.comments;
+ for (int i = 0; i < is.length; i++) {
+ Item item2 = allitems[is[i]];
+ if(!item2.isSet()) {
+ allitems[is[i]].ix = item.ix;
+ }
+ expandGroup(is[i]);
+ }
+ is = item.inputs;
+ for (int i = 0; i < is.length; i++) {
+ Item item2 = allitems[is[i]];
+ if(item2.group != null) continue;
+ if(!item2.isSet()) {
+ item2.ix = item.ix - 1;
+ }
+ expandGroup(is[i]);
+ }
+ is = item.outputs;
+ for (int i = 0; i < is.length; i++) {
+ Item item2 = allitems[is[i]];
+ if(item2.group != null) continue;
+ if(!item2.isSet()) item2.ix = item.ix + 1;
+ expandGroup(is[i]);
+ }
+ }
+
+ int[] items() {
+ if(items == null) {
+ items = new int[itemList.size()];
+ for (int i = 0; i < items.length; i++)
+ items[i] = ((Integer)itemList.get(i)).intValue();
+ }
+ return items;
+ }
+
+ Item getItem(int i) {
+ return allitems[items[i]];
+ }
+
+ public void moveX() {
+ items();
+ int min = 0;
+ for (int i = 0; i < items.length; i++) {
+ if(getItem(i).ix < min) min = getItem(i).ix;
+ }
+ if(min == 0) return;
+ for (int i = 0; i < items.length; i++) {
+ if(!getItem(i).isSet()) {
+ getItem(i).ix -= min;
+ if(getItem(i).ix >= Groups.FX) getItem(i).ix = Groups.FX - 1;
+ }
+ }
+ }
+
+ public void buildY(Item item, int[][] field) {
+ field[item.ix][item.iy] = 1;
+ int[] is = item.comments;
+ for (int i = 0; i < is.length; i++) {
+ Item item2 = allitems[is[i]];
+ if(item2.yAssigned) continue;
+ item2.yAssigned = true;
+ if(!item2.isSet()) item2.iy = findFreeY(item2.ix, miny, item.iy, Groups.FY, field);
+ buildY(item2, field);
+ }
+ is = item.inputs;
+ for (int i = 0; i < is.length; i++) {
+ Item item2 = allitems[is[i]];
+ if(item2.yAssigned) continue;
+ item2.yAssigned = true;
+ if(!item2.isSet()) item2.iy = findFreeY(item2.ix, miny, item.iy, Groups.FY, field);
+ buildY(item2, field);
+ }
+ is = item.outputs;
+ for (int i = 0; i < is.length; i++) {
+ Item item2 = allitems[is[i]];
+ if(item2.yAssigned) continue;
+ item2.yAssigned = true;
+ if(!item2.isSet()) item2.iy = findFreeY(item2.ix, miny, item.iy, Groups.FY, field);
+ buildY(item2, field);
+ }
+ }
+
+ public void buildY_2(Item item, int[][] field) {
+ field[item.ix][item.iy] = 1;
+ int[] is = item.comments;
+ for (int i = 0; i < is.length; i++) {
+ Item item2 = allitems[is[i]];
+ if(item2.yAssigned) continue;
+ item2.yAssigned = true;
+ if(!item2.isSet()) item2.iy = findFreeY(item2.ix, miny, item.iy, Groups.FY, field);
+ buildY(item2, field);
+ }
+ is = item.inputs;
+ for (int i = 0; i < is.length; i++) {
+ Item item2 = allitems[is[i]];
+ if(item2.yAssigned) continue;
+ if(item.ix != item2.ix + 1) continue;
+ item2.yAssigned = true;
+ if(!item2.isSet()) item2.iy = findFreeY(item2.ix, miny, item.iy, Groups.FY, field);
+ buildY(item2, field);
+ }
+ is = item.outputs;
+ for (int i = 0; i < is.length; i++) {
+ Item item2 = allitems[is[i]];
+ if(item2.yAssigned) continue;
+ if(item.ix != item2.ix - 1) continue;
+ item2.yAssigned = true;
+ if(!item2.isSet()) item2.iy = findFreeY(item2.ix, miny, item.iy, Groups.FY, field);
+ buildY(item2, field);
+ }
+ }
+
+ private int findFreeY(int ix, int miny, int prefy, int maxy, int[][] field) {
+ for (int i = 0; i < 20; i++) {
+ int iy = prefy + i;
+ if(iy >= miny && iy < maxy && field[ix][iy] == 0) return iy;
+ iy = prefy - i;
+ if(iy >= miny && iy < maxy && field[ix][iy] == 0) return iy;
+ }
+ return prefy;
+ }
+
+ public int getMaxY() {
+ int maxy = 0;
+ for (int i = 0; i < items.length; i++)
+ if(getItem(i).iy > maxy) maxy = getItem(i).iy;
+ return maxy;
+ }
+
+ public boolean hasSetItems() {
+ items();
+ for (int i = 0; i < items.length; i++) if(getItem(i).isSet()) return true;
+ return false;
+ }
+
+ public void buildXDeltas() {
+ xDeltas = new int[getMaxX() + 1];
+ for (int i = 0; i < xDeltas.length; i++) xDeltas[i] = 0;
+ ///if(hasSetItems()) return;
+ for (int i = 0; i < items.length; i++) {
+ int c = getItem(i).ix;
+ if(c >= xDeltas.length) continue;
+ int sz = getItem(i).inputs.length - 1;
+ if(sz > xDeltas[c]) xDeltas[c] = sz;
+ ++c;
+ if(c >= xDeltas.length) continue;
+ sz = getItem(i).outputs.length - 1;
+ if(sz > xDeltas[c]) xDeltas[c] = sz;
+ }
+ for (int i = 0; i < xDeltas.length; i++) if(xDeltas[i] > 4) xDeltas[i] = 4;
+
+ for (int i = 0; i < items.length; i++) {
+ int c = getItem(i).ix;
+ ++c;
+ if(c >= xDeltas.length) continue;
+ int[] shape = getItem(i).getObject().getShape();
+ if(shape == null || shape.length < 4) continue;
+ int wi = (shape[2] - (constants.deltaX / 2)) / constants.incX;
+ if(wi > xDeltas[c]) xDeltas[c] = wi;
+ }
+ for (int i = 1; i < xDeltas.length; i++) xDeltas[i] += xDeltas[i - 1];
+
+ }
+
+ public int getMaxX() {
+ int maxx = 0;
+ for (int i = 0; i < items.length; i++) if(getItem(i).ix > maxx) maxx = getItem(i).ix;
+ return maxx;
+ }
+
+
+ //////////////////////////////////////////
+
+ public void createGroup(int _item) {
+ expandGroup2(_item);
+ int length = items().length;
+ for (int i = 0; i < length; i++) getItem(i).initActivities();
+ arranger.arrange();
+ }
+
+ private void expandGroup2(int _item) {
+ Item item = allitems[_item];
+ item.group = this;
+ itemList.add(new Integer(_item));
+ int[] is = item.comments;
+ for (int i = 0; i < is.length; i++) {
+ expandGroup2(is[i]);
+ }
+ is = item.inputs;
+ for (int i = 0; i < is.length; i++) {
+ if(allitems[is[i]].group == null) expandGroup2(is[i]);
+ }
+ is = item.outputs;
+ for (int i = 0; i < is.length; i++) {
+ if(allitems[is[i]].group == null) expandGroup2(is[i]);
+ }
+ }
+
+}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/impl/GroupArranger.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/impl/GroupArranger.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/impl/GroupArranger.java 2007-07-03 15:22:27 UTC (rev 2257)
@@ -0,0 +1,193 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.hibernate.veditor.editors.autolayout.impl;
+
+public class GroupArranger {
+ Group group;
+ int mgi = 0; // items with indefinite gravity
+ boolean inited = false;
+
+ public GroupArranger(Group group) {
+ this.group = group;
+ }
+
+ private void init() {
+ inited = true;
+ for (int i = 0; i < group.items().length; i++) {
+ Item item = group.getItem(i);
+ if(item.isOwned) {
+ item.gravity = -1;
+ } else if(item.inputs.length == 0) {
+ item.gravity = 0;
+ } else if(item.outputs.length == 0) {
+ item.gravity = 2000;
+ } else {
+ item.gravity = 1000;
+ ++mgi;
+ }
+ }
+ }
+
+ public void arrange() {
+ init();
+ while(mgi > 0) {
+ split();
+ if(mgi > 0) cut(findBestCutIndex());
+ }
+ reduce();
+ }
+
+ private void split() {
+ int length = group.items().length;
+ boolean work = true;
+ while(work) {
+ work = false;
+ for (int i = 0; i < length; i++) {
+ Item item = group.getItem(i);
+ if(item.gravity != 1000) continue;
+ int q = computeLowerWeight(i);
+ if(q < item.gravity) {
+ item.gravity = q;
+ work = true;
+ --mgi;
+ }
+ if(item.gravity != 1000) continue;
+ q = computeUpperWeight(i);
+ if(q > item.gravity) {
+ item.gravity = q;
+ work = true;
+ --mgi;
+ }
+ }
+ }
+ }
+
+ private int computeLowerWeight(int i0) {
+ Item item = group.getItem(i0);
+ int[] is = item.inputs;
+ int q = 0;
+ for (int i = 0; i < is.length; i++) {
+ if(!item.inputActivities[i]) continue;
+ Item si = group.allitems[is[i]];
+ if(si.gravity + 1 > q) q = si.gravity + 1;
+ }
+ return q;
+ }
+
+ private int computeUpperWeight(int i0) {
+ Item item = group.getItem(i0);
+ int[] is = item.outputs;
+ if(is.length == 0) return item.gravity;
+ int q = 2000;
+ for (int i = 0; i < is.length; i++) {
+ if(!item.outputActivities[i]) continue;
+ Item si = group.allitems[is[i]];
+ if(si.gravity - 1 < q) q = si.gravity - 1;
+ }
+ return (q == 2000) ? item.gravity : q;
+ }
+
+
+ void activateInput(Item item, int input, boolean b) {
+ item.inputActivities[input] = b;
+ Item i2 = group.allitems[item.inputs[input]];
+ int[] is = i2.outputs;
+ for (int i = 0; i < is.length; i++)
+ if(is[i] == item.n) i2.outputActivities[i] = b;
+ }
+
+ private int findBestCutIndex() {
+ int k = -1;
+ int w = 20000;
+ for (int i = 0; i < group.items().length; i++) {
+ Item item = group.getItem(i);
+ if(item.gravity != 1000) continue;
+ int w2 = getCuttingPreference(i);
+ if(w2 < w) {
+ w = w2;
+ k = i;
+ }
+ }
+ return k;
+ }
+
+ private int getCuttingPreference(int i0) {
+ Item item = group.getItem(i0);
+ int[] is = item.inputs;
+ int q = 0;
+ for (int i = 0; i < is.length; i++) {
+ if(!item.inputActivities[i]) continue;
+ Item si = group.allitems[is[i]];
+ if(si.gravity == 1000) ++q;
+ }
+ q = 10 * q;
+ is = item.outputs;
+ for (int i = 0; i < is.length; i++) {
+ if(!item.outputActivities[i]) continue;
+ Item si = group.allitems[is[i]];
+ if(si.gravity == 1000) --q;
+ }
+ return q;
+ }
+
+ private void cut(int i0) {
+ Item item = group.getItem(i0);
+ int[] is = item.inputs;
+ for (int i = 0; i < is.length; i++) {
+ if(!item.inputActivities[i]) continue;
+ Item si = group.allitems[is[i]];
+ if(si.gravity == 1000) {
+ activateInput(item, i, false);
+ }
+ }
+ }
+
+ private void reduce() {
+ boolean work = true;
+ while(work) {
+ work = false;
+ for (int i = 0; i < group.items().length; i++) {
+ Item item = group.getItem(i);
+ if(item.gravity < 0) continue;
+ int q = computeLowerWeight(i);
+ if(q < item.gravity) {
+ item.gravity = q;
+ work = true;
+ }
+ }
+ }
+ work = true;
+ while(work) {
+ work = false;
+ for (int i = 0; i < group.items().length; i++) {
+ Item item = group.getItem(i);
+ if(item.gravity < 0) continue;
+ int q = computeUpperWeight(i);
+ if(q > item.gravity) {
+ item.gravity = q;
+ work = true;
+ }
+ }
+ }
+ for (int i = 0; i < group.items().length; i++) {
+ Item item = group.getItem(i);
+ item.ix = item.gravity;
+ }
+ for (int i = 0; i < group.items().length; i++) {
+ Item item = group.getItem(i);
+ int[] cs = item.comments;
+ for (int j = 0; j < cs.length; j++) {
+ group.allitems[cs[j]].ix = item.ix;
+ }
+ }
+ }
+
+}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/impl/Groups.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/impl/Groups.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/impl/Groups.java 2007-07-03 15:22:27 UTC (rev 2257)
@@ -0,0 +1,189 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.hibernate.veditor.editors.autolayout.impl;
+
+import java.util.*;
+
+public class Groups {
+ protected LayuotConstants constants;
+ static int FX = 30, FY = 120;
+ List groups = new ArrayList();
+ Item[] items;
+ int[][] field;
+ int[] yDeltas = null;
+
+ public Groups() {}
+
+ public void setConstants(LayuotConstants constants) {
+ this.constants = constants;
+ }
+
+ public void load(Item[] items) {
+ this.items = items;
+ init();
+ initField();
+ buildY();
+ buildDeltas();
+ }
+
+ public void init() {
+ groups.clear();
+ int g = 0;
+ boolean isSomethingSet = isSomethingSet();
+ for (int i = 0; i < items.length; i++) {
+ if(items[i].group != null || items[i].isOwned) continue;
+ ++g;
+ Group group = new Group();
+ group.setConstants(constants);
+ group.number = g;
+ groups.add(group);
+ if(!items[i].isSet()) items[i].ix = 0;
+ group.setItems(items);
+ if(isSomethingSet) {
+ group.expandGroup(i);
+ } else {
+ group.createGroup(i);
+ }
+ group.moveX();
+ }
+ }
+
+ private boolean isSomethingSet() {
+ for (int i = 0; i < items.length; i++)
+ if(items[i].isSet) return true;
+ return false;
+ }
+
+ public void initField() {
+ field = new int[FX][];
+ for (int i = 0; i < FX; i++) {
+ field[i] = new int[FY];
+ for (int j = 0; j < FY; j++) field[i][j] = 0;
+ }
+ for (int i = 0; i < items.length; i++) {
+ if(items[i].isSet()) field[items[i].ix][items[i].iy] = 1;
+ }
+ }
+
+ static int MAX_SINGLES_PER_ROW = 5;
+ public void buildY() {
+ int miny = 0;
+ miny = buildYForSingleComments();
+ boolean isSomethingSet = isSomethingSet();
+ for (int i = 0; i < groups.size(); i++) {
+ Group group = (Group)groups.get(i);
+ if(group.items().length < 2) continue;
+ Item item = group.getItem(0);
+ if(item.yAssigned) continue;
+ group.miny = miny;
+ item.yAssigned = true;
+ if(!item.isSet()) item.iy = miny;
+ if(!isSomethingSet) group.buildY_2(item, field);
+ group.buildY(item, field);
+ miny = group.getMaxY() + 1;
+ if(miny > FY - 2) miny = FY - 2;
+ }
+ buildYForSingles(miny);
+ }
+
+ private int buildYForSingleComments() {
+ int miny = 0;
+ int ix = 0;
+ for (int i = 0; i < groups.size(); i++) {
+ Group group = (Group)groups.get(i);
+ if(group.items().length != 1) continue;
+ Item item = group.getItem(0);
+ if(!item.isComment()) continue;
+ if(!item.isSet()) {
+ group.miny = miny;
+ item.ix = ix;
+ item.iy = miny;
+ ix += 2;
+ if(ix > 2) {
+ ix = 0;
+ ++miny;
+ }
+ } else group.miny = 0;
+ }
+ if(ix > 0) ++miny;
+ return miny;
+ }
+
+ private void buildYForSingles(int miny) {
+ int ix = 0;
+ for (int i = 0; i < groups.size(); i++) {
+ Group group = (Group)groups.get(i);
+ if(group.items().length != 1 || group.miny >= 0) continue;
+ group.miny = miny;
+ Item item = group.getItem(0);
+ while(true) {
+ while(ix < field.length && field[ix][miny] == 1) ++ix;
+ if(ix > MAX_SINGLES_PER_ROW) {
+ ix = 0;
+ if(miny < FY - 1) ++miny; else break;
+ } else break;
+ }
+ if(!item.isSet()) {
+ item.iy = miny;
+ item.ix = ix;
+ ++ix;
+ }
+ field[item.ix][item.iy] = 1;
+ }
+ }
+
+ void buildXDeltasForSingles() {
+ int[] xDeltas = new int[100];
+ for (int i = 0; i < groups.size(); i++) {
+ Group group = (Group)groups.get(i);
+ if(group.items().length != 1) continue;
+ group.xDeltas = xDeltas;
+ Item item = group.getItem(0);
+ int c = item.ix;
+ c++;
+ if(c >= xDeltas.length) continue;
+ int[] shape = item.getObject().getShape();
+ if(shape == null || shape.length < 4) continue;
+ int wi = (shape[2] - (constants.deltaX / 2)) / constants.incX;
+ if(wi > xDeltas[c]) xDeltas[c] = wi;
+ }
+ for (int i = 1; i < xDeltas.length; i++) xDeltas[i] += xDeltas[i - 1];
+ }
+
+ public void buildDeltas() {
+ for (int i = 0; i < groups.size(); i++) {
+ Group group = (Group)groups.get(i);
+ group.buildXDeltas();
+ }
+ buildYDeltas();
+ buildXDeltasForSingles();
+ }
+
+ public void buildYDeltas() {
+ yDeltas = new int[getMaxY() + 1];
+ for (int i = 0; i < yDeltas.length; i++) yDeltas[i] = 0;
+ for (int i = 0; i < items.length; i++) {
+ int c = items[i].iy + 1;
+ if(c >= yDeltas.length) continue;
+ int sz = items[i].outputs.length - 1;
+ if(sz > yDeltas[c]) yDeltas[c] = sz;
+ }
+ for (int i = 1; i < yDeltas.length; i++) yDeltas[i] += yDeltas[i - 1];
+ }
+
+ public int getMaxY() {
+ int max = 0;
+ for (int i = 0; i < items.length; i++) if(items[i].iy > max) max = items[i].iy;
+ return max;
+ }
+
+
+}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/impl/Item.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/impl/Item.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/impl/Item.java 2007-07-03 15:22:27 UTC (rev 2257)
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.hibernate.veditor.editors.autolayout.impl;
+
+import java.util.*;
+
+import org.jboss.tools.hibernate.veditor.editors.autolayout.IItemInfo;
+import org.jboss.tools.hibernate.veditor.editors.autolayout.ILinkInfo;
+
+
+public class Item {
+ protected IItemInfo itemInfo;
+ protected int n;
+ protected int x = 0;
+ protected int y = 0;
+ protected int ix = -1;
+ protected int iy = -1;
+ protected int[] inputs = new int[0];
+ protected int[] outputs = new int[0];
+ protected int[] comments = new int[0];
+ protected ArrayList inputLinks = new ArrayList();
+ protected boolean isOwned = false;
+ protected int weight = 0;
+ protected Group group = null;
+ protected int yIndent = 1; // Page = 2; other = 1;
+
+ protected boolean isSet = false;
+ protected boolean yAssigned = false;
+
+ public Item() {}
+
+ public IItemInfo getObject() {
+ return itemInfo;
+ }
+
+ public boolean isSet() {
+ return isSet;
+ }
+
+ public void addInput(int i, ILinkInfo link) {
+ int[] k = new int[inputs.length + 1];
+ System.arraycopy(inputs, 0, k, 0, inputs.length);
+ k[inputs.length] = i;
+ inputs = k;
+ inputLinks.add(link);
+ }
+
+ public void addOutput(int i) {
+ int[] k = new int[outputs.length + 1];
+ System.arraycopy(outputs, 0, k, 0, outputs.length);
+ k[outputs.length] = i;
+ outputs = k;
+ }
+
+ public void addComment(int i) {
+ int[] k = new int[comments.length + 1];
+ System.arraycopy(comments, 0, k, 0, comments.length);
+ k[comments.length] = i;
+ comments = k;
+ }
+
+ public boolean isSingle() {
+ return inputs.length == 0 && outputs.length == 0;
+ }
+
+ public void print() {
+// StringBuffer sb = new StringBuffer();
+/// sb.append(object.getPathPart() + " " + n + " g = " + group + " ix = " + ix + " iy = " + iy);
+/// System.out.println(sb.toString());
+ }
+
+ public boolean isComment() {
+ return itemInfo != null && itemInfo.isComment();
+ }
+
+ int gravity;
+ boolean[] outputActivities;
+ boolean[] inputActivities;
+
+ public void initActivities() {
+ outputActivities = new boolean[outputs.length];
+ for (int i = 0; i < outputActivities.length; i++) outputActivities[i] = outputs[i] != n;
+ inputActivities = new boolean[inputs.length];
+ for (int i = 0; i < inputActivities.length; i++) inputActivities[i] = inputs[i] != n;
+ }
+
+ public void setWeight(int w) {
+ weight = w;
+ }
+
+ public void setYIndent(int y) {
+ yIndent = y;
+ }
+
+}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/impl/Items.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/impl/Items.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/impl/Items.java 2007-07-03 15:22:27 UTC (rev 2257)
@@ -0,0 +1,121 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.hibernate.veditor.editors.autolayout.impl;
+
+import java.util.*;
+
+import org.jboss.tools.hibernate.veditor.editors.autolayout.IItemInfo;
+import org.jboss.tools.hibernate.veditor.editors.autolayout.ILinkInfo;
+import org.jboss.tools.hibernate.veditor.editors.autolayout.IProcessInfo;
+
+
+public class Items {
+ protected LayuotConstants constants;
+ protected IProcessInfo process;
+ protected Item[] items;
+ protected Map paths = new HashMap();
+ protected Groups groups = new Groups();
+ protected boolean override = false;
+
+ public Items() {}
+
+ public void setConstants(LayuotConstants constants) {
+ this.constants = constants;
+ groups.setConstants(constants);
+ }
+
+ public void setOverride(boolean b) {
+ override = b;
+ }
+
+ public void setProcess(IProcessInfo process) {
+ this.process = process;
+ try { load(); } catch (Exception e) { e.printStackTrace(); }
+ }
+
+ private void load() {
+ initItems();
+ if(isAllSet()) return;
+ buildBinds();
+ groups.load(items);
+ print();
+ }
+
+ private void initItems() {
+ IItemInfo[] is = process.getItems();
+ items = new Item[is.length];
+ for (int i = 0; i < is.length; i++) {
+ Item item = new Item();
+ items[i] = item;
+ paths.put(is[i].getID(), item);
+ item.n = i;
+ item.itemInfo = is[i];
+ int[] shape = is[i].getShape();
+ if(!override && shape != null && shape.length > 1) {
+ item.x = shape[0];
+ item.y = shape[1];
+ if(item.x != 0 && item.y != 0) item.isSet = true;
+ item.ix = (item.x / constants.deltaX);
+ item.iy = (item.y / constants.deltaY);
+ if(item.ix < 0) item.ix = 0;
+ if(item.iy < 0) item.iy = 0;
+ if(item.ix >= Groups.FX) item.ix = Groups.FX - 1;
+ if(item.iy >= Groups.FY) item.iy = Groups.FY - 1;
+ }
+ initItem(item);
+ }
+ }
+
+ // override
+ protected void initItem(Item item) {}
+
+ // override
+
+ public ILinkInfo[] getOutput(IItemInfo itemObject) {
+ return itemObject.getLinks();
+ }
+
+ private boolean isAllSet() {
+ for (int i = 0; i < items.length; i++) if(!items[i].isSet()) return false;
+ return true;
+ }
+
+ private void buildBinds() {
+ for (int i = 0; i < items.length; i++) {
+ ILinkInfo[] ts = (items[i].itemInfo instanceof ILinkInfo)
+ ? new ILinkInfo[]{(ILinkInfo)items[i].itemInfo}
+ : getOutput(items[i].itemInfo);
+ for (int j = 0; j < ts.length; j++) {
+ String target = ts[j].getTargetID();
+ if(target == null || target.length() == 0) continue;
+ Item item2 = (Item)paths.get(target);
+ if(item2 == null) {
+ continue;
+ } if(items[i].isComment()) {
+ item2.addComment(items[i].n);
+ items[i].isOwned = true;
+ } else if(item2.weight < 0) {
+ continue;
+ } else {
+ item2.addInput(items[i].n, ts[j]);
+ items[i].addOutput(item2.n);
+ }
+ }
+ }
+ }
+
+ private void print() {
+ for (int i = 0; i < items.length; i++)
+ items[i].print();
+ }
+
+}
+
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/impl/LayuotConstants.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/impl/LayuotConstants.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/impl/LayuotConstants.java 2007-07-03 15:22:27 UTC (rev 2257)
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.hibernate.veditor.editors.autolayout.impl;
+
+public class LayuotConstants {
+ static int DELTA_X = 200;
+ static int DELTA_Y = 104;
+ static int X_INC = 32;
+ static int Y_INC = 24;
+
+ public int deltaX = DELTA_X;
+ public int deltaY = DELTA_Y;
+ public int incX = X_INC;
+ public int incY = Y_INC;
+ public int indentX = 24;
+ public int indentY = 16;
+
+ public void update(String gridStep) {
+ try {
+ int step = Integer.parseInt(gridStep);
+ indentX = (step < 24) ? 24 : step;
+ indentY = (step < 16) ? 16 : step;
+ if(step == 16) {
+ deltaX = 208;
+ deltaY = 112;
+ incX = 16;
+ incY = 32;
+ indentX = 32;
+ } else if(step == 24) {
+ deltaX = 240;
+ deltaY = 120;
+ incX = 24;
+ incY = 24;
+ } else if(step == 32) {
+ deltaX = 256;
+ deltaY = 128;
+ incX = 32;
+ incY = 32;
+ } else if(step == 40) {
+ deltaX = 240;
+ deltaY = 120;
+ incX = 40;
+ incY = 40;
+ } else {
+ deltaX = DELTA_X;
+ deltaY = DELTA_Y;
+ incX = X_INC;
+ incY = Y_INC;
+ }
+ } catch (Exception e) {
+ deltaX = DELTA_X;
+ deltaY = DELTA_Y;
+ incX = X_INC;
+ incY = Y_INC;
+ }
+ }
+
+}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/impl/TransitionArranger.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/impl/TransitionArranger.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/autolayout/impl/TransitionArranger.java 2007-07-03 15:22:27 UTC (rev 2257)
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.hibernate.veditor.editors.autolayout.impl;
+
+import java.util.ArrayList;
+
+import org.jboss.tools.hibernate.veditor.editors.autolayout.ILinkInfo;
+
+
+public class TransitionArranger {
+ Item[] items;
+
+ public void setItems(Item[] items) {
+ this.items = items;
+ }
+
+ public void execute() {
+ int maxX = getMaxX();
+ int maxY = getMaxY();
+ int[][] occ = new int[occ0.length][maxY + 1];
+ Item[] v = new Item[maxY + 1];
+ for (int ix = 0; ix <= maxX; ix++) {
+ clean(occ);
+ fill(v, ix);
+ execute(ix, occ, v);
+ }
+ }
+
+ private void clean(int[][] occ) {
+ for (int i = 0; i < occ.length; i++) for (int j = 0; j < occ[0].length; j++) occ[i][j] = 0;
+ }
+
+ private void fill(Item[] v, int ix) {
+ for (int i = 0; i < v.length; i++) v[i] = null;
+ for (int i = 0; i < items.length; i++) {
+ if(items[i].inputs.length == 0 || items[i].isOwned) continue;
+ if(items[i].ix == ix) v[items[i].iy] = items[i];
+ }
+ }
+
+ private int[] occ0 = new int[10];
+
+ private void execute(int ix, int[][] occ, Item[] v) {
+ int delta = 0;
+ for (int iy = 0; iy < v.length; iy++) {
+ if(v[iy] == null) continue;
+ for (int i = 0; i < occ0.length; i++) occ0[i] = 0;
+ int[] is = v[iy].inputs;
+ delta = 0;
+ for (int k = 0; k < is.length; k++) {
+ int iy2 = items[is[k]].iy;
+ int miny = Math.min(iy, iy2);
+ int maxy = Math.max(iy, iy2);
+ if(maxy - miny > delta) delta = maxy - miny;
+ for (int m = 0; m < occ0.length; m++) for (int y = miny; y <= maxy; y++)
+ if(occ[m][y] > 0) occ0[m] += occ[m][y];
+ }
+ int tg = findTransitionLine(delta, occ0);
+ for (int k = 0; k < is.length; k++) {
+ int iy2 = items[is[k]].iy;
+ occ[tg][iy2]++;
+ }
+ apply(v[iy], tg);
+ }
+ }
+
+ private int getMaxX() {
+ int ix = 0;
+ for (int i = 0; i < items.length; i++) {
+ if(items[i].ix > ix) ix = items[i].ix;
+ }
+ return ix;
+ }
+
+ private int getMaxY() {
+ int iy = 0;
+ for (int i = 0; i < items.length; i++) {
+ if(items[i].iy > iy) iy = items[i].iy;
+ }
+ return iy;
+ }
+
+ private int findTransitionLine(int pref, int[] occ0) {
+ if(pref >= occ0.length) pref = occ0.length - 1;
+ int h = 1000;
+ int p = -1;
+ for (int i = 0; i < occ0.length; i++) {
+ int h1 = occ0[i] * 3 + Math.abs(i - pref);
+ if(h1 < h) {
+ h = h1;
+ p = i;
+ }
+ }
+ return p;
+ }
+
+ private void apply(Item item, int tg) {
+ ArrayList links = item.inputLinks;
+ for (int k = 0; k < links.size(); k++) {
+ ILinkInfo io = (ILinkInfo)links.get(k);
+ io.setLinkShape(new int[]{-1, 8 * (tg + 2)});
+ }
+ }
+
+}
16 years, 10 months
JBoss Tools SVN: r2256 - in trunk/jsf/plugins/org.jboss.tools.jsf.ui: resources/org/jboss/tools/jsf/ui and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2007-07-03 10:55:34 -0400 (Tue, 03 Jul 2007)
New Revision: 2256
Removed:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/images/xstudio/wizards/import_project.gif
trunk/jsf/plugins/org.jboss.tools.jsf.ui/images/xstudio/wizards/new_project.gif
trunk/jsf/plugins/org.jboss.tools.jsf.ui/resources/org/jboss/tools/jsf/ui/action/
Log:
http://jira.jboss.org/jira/browse/EXIN-239
Icons with Exadel Logo and butterfly were removed
Deleted: trunk/jsf/plugins/org.jboss.tools.jsf.ui/images/xstudio/wizards/import_project.gif
===================================================================
(Binary files differ)
Deleted: trunk/jsf/plugins/org.jboss.tools.jsf.ui/images/xstudio/wizards/new_project.gif
===================================================================
(Binary files differ)
16 years, 10 months
JBoss Tools SVN: r2255 - 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-03 09:32:12 -0400 (Tue, 03 Jul 2007)
New Revision: 2255
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponent.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/BijectedAttribute.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamAnnotatedFactory.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponent.java
Log:
EXIN-217 implementations are changed according to the last changes in interfaces
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponent.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponent.java 2007-07-03 13:18:36 UTC (rev 2254)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponent.java 2007-07-03 13:32:12 UTC (rev 2255)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.seam.core;
+import java.util.Collection;
import java.util.List;
import java.util.Set;
@@ -87,7 +88,7 @@
* @param propertyName
* @return
*/
- public Set<ISeamProperty> getProperties();
+ public Collection<ISeamProperty> getProperties();
/**
* Returns all properties from component.xml for that component.
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/BijectedAttribute.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/BijectedAttribute.java 2007-07-03 13:18:36 UTC (rev 2254)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/BijectedAttribute.java 2007-07-03 13:32:12 UTC (rev 2255)
@@ -10,7 +10,9 @@
******************************************************************************/
package org.jboss.tools.seam.internal.core;
+import org.eclipse.core.resources.IResource;
import org.eclipse.jdt.core.IMember;
+import org.eclipse.jdt.core.JavaModelException;
import org.jboss.tools.seam.core.BijectedAttributeType;
import org.jboss.tools.seam.core.IBijectedAttribute;
import org.jboss.tools.seam.core.ScopeType;
@@ -24,10 +26,6 @@
String name = null;
ScopeType scopeType = ScopeType.UNSPECIFIED;
- public IMember getJavaSource() {
- return javaSource;
- }
-
public void setMember(IMember javaSource) {
this.javaSource = javaSource;
}
@@ -52,4 +50,34 @@
this.scopeType = type;
}
+ public IMember getSourceMember() {
+ return javaSource;
+ }
+
+ public int getLength() {
+ if(javaSource == null) return 0;
+ try {
+ if(javaSource.getSourceRange() == null) return 0;
+ return javaSource.getSourceRange().getLength();
+ } catch (JavaModelException e) {
+ //ignore
+ return 0;
+ }
+ }
+
+ public IResource getResource() {
+ return javaSource == null ? null : javaSource.getTypeRoot().getResource();
+ }
+
+ public int getStartPosition() {
+ if(javaSource == null) return 0;
+ try {
+ if(javaSource.getSourceRange() == null) return 0;
+ return javaSource.getSourceRange().getOffset();
+ } catch (JavaModelException e) {
+ //ignore
+ return 0;
+ }
+ }
+
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamAnnotatedFactory.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamAnnotatedFactory.java 2007-07-03 13:18:36 UTC (rev 2254)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamAnnotatedFactory.java 2007-07-03 13:32:12 UTC (rev 2255)
@@ -10,7 +10,10 @@
******************************************************************************/
package org.jboss.tools.seam.internal.core;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.JavaModelException;
import org.jboss.tools.seam.core.ISeamAnnotatedFactory;
import org.jboss.tools.seam.core.ScopeType;
@@ -18,16 +21,16 @@
* @author Viacheslav Kabanovich
*/
public class SeamAnnotatedFactory implements ISeamAnnotatedFactory {
- IMethod method = null;
+ IMethod javaSource = null;
String name = null;
ScopeType scopeType = ScopeType.UNSPECIFIED;
public IMethod getSourceMethod() {
- return method;
+ return javaSource;
}
public void setMethod(IMethod method) {
- this.method = method;
+ this.javaSource = method;
}
public String getName() {
@@ -46,4 +49,34 @@
this.scopeType = type;
}
+ public IMember getSourceMember() {
+ return javaSource;
+ }
+
+ public int getLength() {
+ if(javaSource == null) return 0;
+ try {
+ if(javaSource.getSourceRange() == null) return 0;
+ return javaSource.getSourceRange().getLength();
+ } catch (JavaModelException e) {
+ //ignore
+ return 0;
+ }
+ }
+
+ public IResource getResource() {
+ return javaSource == null ? null : javaSource.getTypeRoot().getResource();
+ }
+
+ public int getStartPosition() {
+ if(javaSource == null) return 0;
+ try {
+ if(javaSource.getSourceRange() == null) return 0;
+ return javaSource.getSourceRange().getOffset();
+ } catch (JavaModelException e) {
+ //ignore
+ return 0;
+ }
+ }
+
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponent.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponent.java 2007-07-03 13:18:36 UTC (rev 2254)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponent.java 2007-07-03 13:32:12 UTC (rev 2255)
@@ -24,9 +24,13 @@
import org.jboss.tools.seam.core.IRole;
import org.jboss.tools.seam.core.ISeamAnnotatedFactory;
import org.jboss.tools.seam.core.ISeamComponent;
+import org.jboss.tools.seam.core.ISeamComponentDeclaration;
import org.jboss.tools.seam.core.ISeamComponentMethod;
+import org.jboss.tools.seam.core.ISeamJavaComponentDeclaration;
+import org.jboss.tools.seam.core.ISeamPropertiesDeclaration;
import org.jboss.tools.seam.core.ISeamProperty;
-import org.jboss.tools.seam.core.ISeamSource;
+import org.jboss.tools.seam.core.ISeamTextSourceReference;
+import org.jboss.tools.seam.core.ISeamXmlComponentDeclaration;
import org.jboss.tools.seam.core.ScopeType;
import org.jboss.tools.seam.core.SeamComponentMethodType;
@@ -41,7 +45,6 @@
protected Map<String,ISeamProperty> properties = new HashMap<String, ISeamProperty>();
protected IPath source;
- protected ISeamSource sourceDeclaration = null;
protected Set<IBijectedAttribute> bijectedAttributes = new HashSet<IBijectedAttribute>();
protected Set<ISeamAnnotatedFactory> annotatedFactories = new HashSet<ISeamAnnotatedFactory>();
@@ -128,13 +131,6 @@
}
/**
- * @see org.jboss.tools.seam.core.ISeamComponent#addSourceDeclaration(org.jboss.tools.seam.core.ISeamSource)
- */
- public void addSourceDeclaration(ISeamSource source) {
- sourceDeclaration = source;
- }
-
- /**
* @see org.jboss.tools.seam.core.ISeamComponent#getBijectedAttributes()
*/
public Set<IBijectedAttribute> getBijectedAttributes() {
@@ -214,16 +210,6 @@
}
/**
- * @see org.jboss.tools.seam.core.ISeamComponent#getSourceDeclarations()
- */
- public Set<ISeamSource> getSourceDeclarations() {
- Set<ISeamSource> sources = base == null ? null : base.getSourceDeclarations();
- if(sources == null) sources = new HashSet<ISeamSource>();
- sources.add(sourceDeclaration);
- return sources;
- }
-
- /**
* @see org.jboss.tools.seam.core.ISeamComponent#isEntity()
*/
public boolean isEntity() {
@@ -266,15 +252,6 @@
}
/**
- * @see org.jboss.tools.seam.core.ISeamComponent#removeSourceDeclaration(org.jboss.tools.seam.core.ISeamSource)
- */
- public void removeSourceDeclaration(ISeamSource source) {
- if(sourceDeclaration == source) {
- sourceDeclaration = null;
- }
- }
-
- /**
* @see org.jboss.tools.seam.core.ISeamComponent#setClassName(java.lang.String)
*/
public void setClassName(String className) {
@@ -353,4 +330,24 @@
properties.remove(property.getName());
}
+ public Set<ISeamComponentDeclaration> getAllDeclarations() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ISeamJavaComponentDeclaration getJavaDeclaration() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Set<ISeamPropertiesDeclaration> getPropertiesDeclarations() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Set<ISeamXmlComponentDeclaration> getXmlDeclarations() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
16 years, 10 months
JBoss Tools SVN: r2254 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2007-07-03 09:18:36 -0400 (Tue, 03 Jul 2007)
New Revision: 2254
Added:
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/ISeamJavaComponentDeclaration.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamJavaSourceReference.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamPropertiesDeclaration.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamTextSourceReference.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamXmlComponentDeclaration.java
Removed:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamJavaClassSource.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamSource.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamTextSource.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IBijectedAttribute.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IRole.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamAnnotatedFactory.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponent.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponentMethod.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProperty.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamXmlFactory.java
Log:
http://jira.jboss.com/jira/browse/EXIN-216 Refactored Seam tools model.
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IBijectedAttribute.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IBijectedAttribute.java 2007-07-03 12:43:32 UTC (rev 2253)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IBijectedAttribute.java 2007-07-03 13:18:36 UTC (rev 2254)
@@ -10,20 +10,13 @@
******************************************************************************/
package org.jboss.tools.seam.core;
-import org.eclipse.jdt.core.IMember;
-
/**
* @author Alexey Kazakov
*/
-public interface IBijectedAttribute extends ISeamSource, ISeamContextVariable {
+public interface IBijectedAttribute extends ISeamContextVariable, ISeamJavaSourceReference {
/**
* @return type
*/
public BijectedAttributeType getType();
-
- /**
- * @return java source element
- */
- public IMember getJavaSource();
}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IRole.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IRole.java 2007-07-03 12:43:32 UTC (rev 2253)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IRole.java 2007-07-03 13:18:36 UTC (rev 2254)
@@ -13,6 +13,6 @@
/**
* @author Alexey Kazakov
*/
-public interface IRole extends ISeamJavaClassSource, ISeamTextSource, ISeamContextVariable {
+public interface IRole extends ISeamJavaSourceReference, ISeamContextVariable {
}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamAnnotatedFactory.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamAnnotatedFactory.java 2007-07-03 12:43:32 UTC (rev 2253)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamAnnotatedFactory.java 2007-07-03 13:18:36 UTC (rev 2254)
@@ -10,15 +10,9 @@
******************************************************************************/
package org.jboss.tools.seam.core;
-import org.eclipse.jdt.core.IMethod;
-
/**
* @author Alexey Kazakov
*/
-public interface ISeamAnnotatedFactory extends ISeamFactory, ISeamSource {
+public interface ISeamAnnotatedFactory extends ISeamFactory, ISeamJavaSourceReference {
- /**
- * @return source IMethod
- */
- public IMethod getSourceMethod();
}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponent.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponent.java 2007-07-03 12:43:32 UTC (rev 2253)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponent.java 2007-07-03 13:18:36 UTC (rev 2254)
@@ -10,39 +10,34 @@
******************************************************************************/
package org.jboss.tools.seam.core;
-import java.util.Collection;
import java.util.List;
import java.util.Set;
+import org.jboss.tools.seam.core.IRole;
+import org.jboss.tools.seam.core.ISeamAnnotatedFactory;
+import org.jboss.tools.seam.core.ISeamComponentMethod;
+
public interface ISeamComponent extends ISeamContextVariable {
+ public ISeamJavaComponentDeclaration getJavaDeclaration();
+
+ public Set<ISeamXmlComponentDeclaration> getXmlDeclarations();
+
+ public Set<ISeamPropertiesDeclaration> getPropertiesDeclarations();
+
+ public Set<ISeamComponentDeclaration> getAllDeclarations();
+
/**
* @return qualified Class name of component
*/
public String getClassName();
/**
- * Sets qualified Class name of component
- * @param className
- */
- public void setClassName(String className);
-
- /**
* @return bijected attributes
*/
public Set<IBijectedAttribute> getBijectedAttributes();
/**
- * Adds bijected attribute
- */
- public void addBijectedAttribute(IBijectedAttribute attribute);
-
- /**
- * Removes bijected attribute
- */
- public void removeBijectedAttribute(IBijectedAttribute attribute);
-
- /**
* Returns bijected attributes by name
* @param name
* @return
@@ -57,91 +52,21 @@
public Set<IBijectedAttribute> getBijectedAttributesByType(BijectedAttributeType type);
/**
- * Returns all properties from component.xml for that component.
- * @param propertyName
- * @return
- */
- public List<ISeamProperty> getProperties(String propertyName);
-
- /**
- * Returns first property with propertyName from component.xml for that component.
- * @param propertyName
- * @return
- */
- public ISeamProperty getProperty(String propertyName);
-
- /**
- * Returns properties by name from component.xml.
- * @param propertyName
- * @return
- */
- public Collection<ISeamProperty> getProperties();
-
- /**
- * Adds property to component.
- * @param property
- */
- public void addProperty(ISeamProperty property);
-
- /**
- * Removes property from component.
- * @param property
- */
- public void removeProperty(ISeamProperty property);
-
- /**
- * @return sources
- */
- public Set<ISeamSource> getSourceDeclarations();
-
- /**
- * @param source
- */
- public void addSourceDeclaration(ISeamSource source);
-
- /**
- * Removes source
- */
- public void removeSourceDeclaration(ISeamSource source);
-
- /**
* @return true if component marked as Stateful
*/
public boolean isStateful();
/**
- * Set true if component marked as Stateful
- */
- public void setStateful(boolean stateful);
-
- /**
* @return true if component marked as Entity
*/
public boolean isEntity();
/**
- * Set true if component marked as Entity
- */
- public void setEntity(boolean entity);
-
- /**
* @return roles of component
*/
public Set<IRole> getRoles();
/**
- * Adds role to component
- * @param role
- */
- public void addRole(IRole role);
-
- /**
- * Removes role from component
- * @param role
- */
- public void removeRole(IRole role);
-
- /**
* @return methods of component
*/
public Set<ISeamComponentMethod> getMethods();
@@ -153,31 +78,21 @@
public Set<ISeamComponentMethod> getMethodsByType(SeamComponentMethodType type);
/**
- * Adds method to component
- * @param method
- */
- public void addMethod(ISeamComponentMethod method);
-
- /**
- * Removes method from component
- * @param method
- */
- public void removeMethod(ISeamComponentMethod method);
-
- /**
* @return Factories methods of component
*/
public Set<ISeamAnnotatedFactory> getFactories();
/**
- * Adds factory method
- * @param factory
+ * Returns properties by name from component.xml.
+ * @param propertyName
+ * @return
*/
- public void addFactory(ISeamAnnotatedFactory factory);
+ public Set<ISeamProperty> getProperties();
/**
- * Remove factory method
- * @param factory
+ * Returns all properties from component.xml for that component.
+ * @param propertyName
+ * @return
*/
- public void removeFactory(ISeamAnnotatedFactory factory);
+ public List<ISeamProperty> getProperties(String propertyName);
}
\ No newline at end of file
Added: 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 (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponentDeclaration.java 2007-07-03 13:18:36 UTC (rev 2254)
@@ -0,0 +1,20 @@
+ /*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.core;
+
+/**
+ * @author Alexey Kazakov
+ *
+ */
+public interface ISeamComponentDeclaration {
+
+ public String getName();
+}
\ No newline at end of file
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-03 12:43:32 UTC (rev 2253)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponentMethod.java 2007-07-03 13:18:36 UTC (rev 2254)
@@ -10,20 +10,13 @@
******************************************************************************/
package org.jboss.tools.seam.core;
-import org.eclipse.jdt.core.IMethod;
-
/**
* @author Alexey Kazakov
*/
-public interface ISeamComponentMethod extends ISeamSource {
+public interface ISeamComponentMethod extends ISeamJavaSourceReference {
/**
* @return method type
*/
public SeamComponentMethodType getType();
-
- /**
- * @return source IMethod
- */
- public IMethod getSourceMethod();
}
\ No newline at end of file
Deleted: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamJavaClassSource.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamJavaClassSource.java 2007-07-03 12:43:32 UTC (rev 2253)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamJavaClassSource.java 2007-07-03 13:18:36 UTC (rev 2254)
@@ -1,21 +0,0 @@
- /*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.seam.core;
-
-import org.eclipse.jdt.core.IType;
-
-/**
- * @author Alexey Kazakov
- */
-public interface ISeamJavaClassSource extends ISeamSource {
-
- public IType getSourceClass();
-}
\ No newline at end of file
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamJavaComponentDeclaration.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamJavaComponentDeclaration.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamJavaComponentDeclaration.java 2007-07-03 13:18:36 UTC (rev 2254)
@@ -0,0 +1,125 @@
+ /*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.core;
+
+import java.util.Set;
+
+import org.jboss.tools.seam.core.IRole;
+import org.jboss.tools.seam.core.ISeamAnnotatedFactory;
+import org.jboss.tools.seam.core.ISeamComponentMethod;
+
+/**
+ * @author Alexey Kazakov
+ *
+ */
+public interface ISeamJavaComponentDeclaration extends ISeamComponentDeclaration {
+
+ /**
+ * @return bijected attributes
+ */
+ public Set<IBijectedAttribute> getBijectedAttributes();
+
+ /**
+ * Adds bijected attribute
+ */
+ public void addBijectedAttribute(IBijectedAttribute attribute);
+
+ /**
+ * Removes bijected attribute
+ */
+ public void removeBijectedAttribute(IBijectedAttribute attribute);
+
+ /**
+ * Returns bijected attributes by name
+ * @param name
+ * @return
+ */
+ public Set<IBijectedAttribute> getBijectedAttributesByName(String name);
+
+ /**
+ * Returns bijected attributes by type
+ * @param type
+ * @return
+ */
+ public Set<IBijectedAttribute> getBijectedAttributesByType(BijectedAttributeType type);
+
+ /**
+ * @return true if component marked as Stateful
+ */
+ public boolean isStateful();
+
+ /**
+ * @return true if component marked as Entity
+ */
+ public boolean isEntity();
+
+ /**
+ * Set true if component marked as Entity
+ */
+ public void setEntity(boolean entity);
+
+ /**
+ * @return roles of component
+ */
+ public Set<IRole> getRoles();
+
+ /**
+ * Adds role to component
+ * @param role
+ */
+ public void addRole(IRole role);
+
+ /**
+ * Removes role from component
+ * @param role
+ */
+ public void removeRole(IRole role);
+
+ /**
+ * @return methods of component
+ */
+ public Set<ISeamComponentMethod> getMethods();
+
+ /**
+ * @param type
+ * @return return methods by type
+ */
+ public Set<ISeamComponentMethod> getMethodsByType(SeamComponentMethodType type);
+
+ /**
+ * Adds method to component
+ * @param method
+ */
+ public void addMethod(ISeamComponentMethod method);
+
+ /**
+ * Removes method from component
+ * @param method
+ */
+ public void removeMethod(ISeamComponentMethod method);
+
+ /**
+ * @return Factories methods of component
+ */
+ public Set<ISeamAnnotatedFactory> getFactories();
+
+ /**
+ * Adds factory method
+ * @param factory
+ */
+ public void addFactory(ISeamAnnotatedFactory factory);
+
+ /**
+ * Remove factory method
+ * @param factory
+ */
+ public void removeFactory(ISeamAnnotatedFactory factory);
+}
\ No newline at end of file
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamJavaSourceReference.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamJavaSourceReference.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamJavaSourceReference.java 2007-07-03 13:18:36 UTC (rev 2254)
@@ -0,0 +1,21 @@
+ /*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.core;
+
+import org.eclipse.jdt.core.IMember;
+
+/**
+ * @author Alexey Kazakov
+ */
+public interface ISeamJavaSourceReference extends ISeamTextSourceReference {
+
+ public IMember getSourceMember();
+}
\ No newline at end of file
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamPropertiesDeclaration.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamPropertiesDeclaration.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamPropertiesDeclaration.java 2007-07-03 13:18:36 UTC (rev 2254)
@@ -0,0 +1,54 @@
+ /*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.core;
+
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @author Alexey Kazakov
+ *
+ */
+public interface ISeamPropertiesDeclaration extends ISeamComponentDeclaration {
+
+ /**
+ * Returns all properties from component.xml for that component.
+ * @param propertyName
+ * @return
+ */
+ public List<ISeamProperty> getProperties(String propertyName);
+
+ /**
+ * Returns first property with propertyName from component.xml for that component.
+ * @param propertyName
+ * @return
+ */
+ public ISeamProperty getProperty(String propertyName);
+
+ /**
+ * Returns properties by name from component.xml.
+ * @param propertyName
+ * @return
+ */
+ public Set<ISeamProperty> getProperties();
+
+ /**
+ * Adds property to component.
+ * @param property
+ */
+ public void addProperty(ISeamProperty property);
+
+ /**
+ * Removes property from component.
+ * @param property
+ */
+ public void removeProperty(ISeamProperty property);
+}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProperty.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProperty.java 2007-07-03 12:43:32 UTC (rev 2253)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProperty.java 2007-07-03 13:18:36 UTC (rev 2254)
@@ -12,9 +12,8 @@
/**
* Property of Seam Component defined in Component.xml or Properties.xml
- * @param <T>
*/
-public interface ISeamProperty extends ISeamTextSource {
+public interface ISeamProperty extends ISeamTextSourceReference {
/**
* @return name of property
Deleted: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamSource.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamSource.java 2007-07-03 12:43:32 UTC (rev 2253)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamSource.java 2007-07-03 13:18:36 UTC (rev 2254)
@@ -1,19 +0,0 @@
- /*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.seam.core;
-
-/**
- * @author Alexey Kazakov
- * Represents source of ISeamModelObject
- */
-public interface ISeamSource {
-
-}
\ No newline at end of file
Deleted: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamTextSource.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamTextSource.java 2007-07-03 12:43:32 UTC (rev 2253)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamTextSource.java 2007-07-03 13:18:36 UTC (rev 2254)
@@ -1,23 +0,0 @@
- /*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.seam.core;
-
-import org.eclipse.core.resources.IResource;
-
-/**
- * @author Alexey Kazakov
- */
-public interface ISeamTextSource extends ISeamSource {
-
- public IResource getResource();
- public int getStartPosition();
- public int getLength();
-}
\ No newline at end of file
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamTextSourceReference.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamTextSourceReference.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamTextSourceReference.java 2007-07-03 13:18:36 UTC (rev 2254)
@@ -0,0 +1,23 @@
+ /*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.core;
+
+import org.eclipse.core.resources.IResource;
+
+/**
+ * @author Alexey Kazakov
+ */
+public interface ISeamTextSourceReference {
+
+ public IResource getResource();
+ public int getStartPosition();
+ public int getLength();
+}
\ No newline at end of file
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamXmlComponentDeclaration.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamXmlComponentDeclaration.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamXmlComponentDeclaration.java 2007-07-03 13:18:36 UTC (rev 2254)
@@ -0,0 +1,36 @@
+ /*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.core;
+
+/**
+ * @author Alexey Kazakov
+ *
+ */
+public interface ISeamXmlComponentDeclaration extends ISeamPropertiesDeclaration {
+
+ public ScopeType getScope();
+
+ public String getScopeAsString();
+
+ public String getClassName();
+
+ public String getJndiName();
+
+ public boolean isInstalled();
+
+ public boolean getInstalledAsString();
+
+ public String getPrecedence();
+
+ public boolean isAutoCreate();
+
+ public String getAutoCreateAsString();
+}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamXmlFactory.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamXmlFactory.java 2007-07-03 12:43:32 UTC (rev 2253)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamXmlFactory.java 2007-07-03 13:18:36 UTC (rev 2254)
@@ -13,7 +13,7 @@
/**
* @author Alexey Kazakov
*/
-public interface ISeamXmlFactory extends ISeamFactory, ISeamTextSource {
+public interface ISeamXmlFactory extends ISeamFactory, ISeamTextSourceReference {
/**
* @return value
16 years, 10 months
JBoss Tools SVN: r2253 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/model.
by jbosstools-commits@lists.jboss.org
Author: mdryakhlenkov
Date: 2007-07-03 08:43:32 -0400 (Tue, 03 Jul 2007)
New Revision: 2253
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/model/OrmDiagram.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/model/OrmShape.java
Log:
http://jira.jboss.org/jira/browse/EXIN-366
Merge changes in classes of diagram model from D.Azarov and me. Adding referenced object for <any/> element.
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/model/OrmDiagram.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/model/OrmDiagram.java 2007-07-03 11:26:22 UTC (rev 2252)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/model/OrmDiagram.java 2007-07-03 12:43:32 UTC (rev 2253)
@@ -185,8 +185,9 @@
Iterator iter = rc.getSubclassIterator();
while (iter.hasNext()) {
SingleTableSubclass singleTableSubclass = (SingleTableSubclass)iter.next();
- classShape = elements.get(singleTableSubclass.getEntityPersisterClass().getCanonicalName());
- if (classShape == null) classShape = createShape(singleTableSubclass);
+ OrmShape singleTableSubclassShape = elements.get(singleTableSubclass.getEntityPersisterClass().getCanonicalName());
+ if (singleTableSubclassShape == null) singleTableSubclassShape = createShape(singleTableSubclass);
+ new Connection(singleTableSubclassShape, shape);
}
// if (persistentClass.getPersistentClassMapping() != null) {
// Iterator iter =((IHibernateClassMapping)(persistentClass).getPersistentClassMapping()).getJoinIterator();
@@ -201,7 +202,6 @@
}
return classShape;
}
-
private OrmShape getOrCreateDatabaseTable(Table databaseTable){
OrmShape tableShape = null;
if(databaseTable != null) {
@@ -331,8 +331,13 @@
OrmShape childShape = getOrCreateDatabaseTable(map.getCollectionTable());
Shape keyShape = childShape.getChild(((DependantValue)((Shape)componentShape.getChildren().get(0)).getOrmElement()).getColumnIterator().next());
new Connection((Shape)componentShape.getChildren().get(0), keyShape);
- Shape elementShape = childShape.getChild(((SimpleValue)((Shape)componentShape.getChildren().get(1)).getOrmElement()).getColumnIterator().next());
- new Connection((Shape)componentShape.getChildren().get(1), elementShape);
+
+ Iterator iter = ((SimpleValue)((Shape)componentShape.getChildren().get(1)).getOrmElement()).getColumnIterator();
+ while (iter.hasNext()) {
+ Column col = (Column)iter.next();
+ Shape elementShape = childShape.getChild(col);
+ new Connection((Shape)componentShape.getChildren().get(1), elementShape);
+ }
}
setDirty(true);
firePropertyChange(REFRESH, null, null);
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/model/OrmShape.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/model/OrmShape.java 2007-07-03 11:26:22 UTC (rev 2252)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/model/OrmShape.java 2007-07-03 12:43:32 UTC (rev 2253)
@@ -91,7 +91,7 @@
Property identifierProperty = rootClass.getIdentifierProperty();
if (identifierProperty != null) {
- shapes.add(new Shape(identifierProperty));
+ getChildren().add(new Shape(identifierProperty));
}
KeyValue identifier = rootClass.getIdentifier();
@@ -99,7 +99,7 @@
Iterator iterator = ((Component)identifier).getPropertyIterator();
while (iterator.hasNext()) {
Property property = (Property) iterator.next();
- shapes.add(new Shape(property));
+ getChildren().add(new Shape(property));
}
}
@@ -141,7 +141,7 @@
} else {
bodyOrmShape = new Shape(property);
}
- shapes.add(bodyOrmShape);
+ getChildren().add(bodyOrmShape);
}
} else if (ormElement instanceof Table) {
Iterator iterator = ((Table)getOrmElement()).getColumnIterator();
16 years, 10 months