Author: akazakov
Date: 2007-07-05 13:11:58 -0400 (Thu, 05 Jul 2007)
New Revision: 2329
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamComponentPrecedenceType.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/internal/core/SeamComponentDeclaration.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java
Log:
http://jira.jboss.com/jira/browse/EXIN-216 Added 'precidence' into Java Component
Declaration
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-05
15:10:20 UTC (rev 2328)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamJavaComponentDeclaration.java 2007-07-05
17:11:58 UTC (rev 2329)
@@ -18,6 +18,8 @@
*/
public interface ISeamJavaComponentDeclaration extends ISeamComponentDeclaration,
ISeamJavaSourceReference {
+ public static final SeamComponentPrecedenceType DEFAULT_PRECEDENCE =
SeamComponentPrecedenceType.APPLICATION;
+
/**
* @return qualified class name
*/
@@ -107,4 +109,15 @@
* @param method
*/
public void removeMethod(ISeamComponentMethod method);
+
+ /**
+ * @return precedence of component.
+ */
+ public SeamComponentPrecedenceType getPrecedence();
+
+ /**
+ * Sets precedence of component.
+ * @param precedence
+ */
+ public void setPrecedence(SeamComponentPrecedenceType precedence);
}
\ No newline at end of file
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamComponentPrecedenceType.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamComponentPrecedenceType.java
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamComponentPrecedenceType.java 2007-07-05
17:11:58 UTC (rev 2329)
@@ -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;
+
+/**
+ * List of component precedence types
+ * @author Alexey Kazakov
+ */
+public enum SeamComponentPrecedenceType {
+ BUILT_IN,
+ FRAMEWORK,
+ APPLICATION,
+ DEPLOYMENT,
+ MOCK
+}
\ No newline at end of file
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentDeclaration.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentDeclaration.java 2007-07-05
15:10:20 UTC (rev 2328)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentDeclaration.java 2007-07-05
17:11:58 UTC (rev 2329)
@@ -10,18 +10,21 @@
******************************************************************************/
package org.jboss.tools.seam.internal.core;
-import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.jboss.tools.seam.core.ISeamComponentDeclaration;
+import org.jboss.tools.seam.core.ISeamTextSourceReference;
import org.jboss.tools.seam.core.event.Change;
/**
* @author Viacheslav Kabanovich
*/
public abstract class SeamComponentDeclaration implements ISeamComponentDeclaration {
+
+ public static final String PATH_OF_NAME = "name";
+
/**
* Path of resource where this component is declared.
*/
@@ -99,5 +102,28 @@
boolean stringsEqual(String s1, String s2) {
return s1 == null ? s2 == null : s1.equals(s2);
}
-
-}
+
+ /**
+ * @param path
+ * @return source reference for some member of declaration.
+ * e.g. if you need source reference for @Name you have to
+ * invore getLocationFor("name");
+ */
+ public ISeamTextSourceReference getLocationFor(String path) {
+ // TODO
+ ISeamTextSourceReference reference = new ISeamTextSourceReference() {
+ public int getLength() {
+ return 0;
+ }
+
+ public IResource getResource() {
+ return SeamComponentDeclaration.this.getResource();
+ }
+
+ public int getStartPosition() {
+ return 0;
+ }
+ };
+ return reference;
+ }
+}
\ No newline at end of file
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java 2007-07-05
15:10:20 UTC (rev 2328)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java 2007-07-05
17:11:58 UTC (rev 2329)
@@ -13,6 +13,7 @@
import org.jboss.tools.seam.core.ISeamJavaComponentDeclaration;
import org.jboss.tools.seam.core.ScopeType;
import org.jboss.tools.seam.core.SeamComponentMethodType;
+import org.jboss.tools.seam.core.SeamComponentPrecedenceType;
import org.jboss.tools.seam.core.event.Change;
public class SeamJavaComponentDeclaration extends SeamComponentDeclaration
@@ -22,6 +23,7 @@
protected ScopeType scopeType = ScopeType.UNSPECIFIED;
protected boolean stateful = false;
protected boolean entity = false;
+ protected SeamComponentPrecedenceType precedence;
protected IType type;
@@ -157,6 +159,11 @@
changes = Change.addChange(changes, new Change(this, "scope", scopeType,
jd.scopeType));
scopeType = jd.scopeType;
}
+ if(precedence != jd.precedence) {
+ changes = Change.addChange(changes, new Change(this, "precedence",
precedence, jd.precedence));
+ precedence = jd.precedence;
+ }
+
if(type != jd.type) type = jd.type;
if(stateful != jd.stateful) {
changes = Change.addChange(changes, new Change(this, "stateful", stateful,
jd.stateful));
@@ -178,4 +185,17 @@
return changes;
}
-}
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.core.ISeamJavaComponentDeclaration#getPrecedence()
+ */
+ public SeamComponentPrecedenceType getPrecedence() {
+ return precedence;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.jboss.tools.seam.core.ISeamJavaComponentDeclaration#setPrecedence(org.jboss.tools.seam.core.SeamComponentPrecedenceType)
+ */
+ public void setPrecedence(SeamComponentPrecedenceType precedence) {
+ this.precedence = precedence;
+ }
+}
\ No newline at end of file