JBoss Tools SVN: r2292 - trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/reporting.
by jbosstools-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2007-07-04 18:22:58 -0400 (Wed, 04 Jul 2007)
New Revision: 2292
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/reporting/ReportProblemWizard.java
Log:
EXIN-240 - remove all the os specific handling and just use plain java.io.File
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/reporting/ReportProblemWizard.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/reporting/ReportProblemWizard.java 2007-07-04 21:25:45 UTC (rev 2291)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/reporting/ReportProblemWizard.java 2007-07-04 22:22:58 UTC (rev 2292)
@@ -93,10 +93,6 @@
static final char SEPARATOR = System.getProperty ("file.separator").charAt (0);
-
- /** folder log file name */
- private String folderLogFileName;
-
/** LOG_DATE_FORMAT */
final private SimpleDateFormat LOG_DATE_FORMAT = new SimpleDateFormat(
"dd_MMM_yyyy__HH_mm_ss_SSS");
@@ -157,7 +153,7 @@
{ ReportPreference.ATT_OTHER, "no" } });
public ReportProblemWizardView() {
- folderLogFileName = Platform.getLocation().toOSString() + SEPARATOR;
+ //folderLogFileName = Platform.getLocation().toOSString() + SEPARATOR;
}
public Control createControl(Composite parent) {
@@ -169,7 +165,7 @@
createProblemControl(composite);
createContactInfoControl(composite);
- fillData();
+ initializeData();
return composite;
}
@@ -177,8 +173,9 @@
/**
*
*/
- private void fillData() {
- logFileName.setText(getZipFilename());
+ private void initializeData() {
+ File defaultLocation = new File(Platform.getLocation().toFile(), getDefaultZipFilename());
+ logFileName.setText(defaultLocation.toString());
}
/**
@@ -318,7 +315,8 @@
// ByteArrayOutputStream byteBuffer = new ByteArrayOutputStream();
//
- String filename = folderLogFileName + logFileName.getText();
+ File filename = new File(logFileName.getText());
+
ZipOutputStream zout = new ZipOutputStream(new FileOutputStream(filename));
for (int i = 0; i < fileNames.length; i++) {
@@ -343,6 +341,7 @@
zout.closeEntry();
}
zout.close();
+ ModelUIPlugin.getDefault().logInfo("Wrote diagnostic info to " + filename);
//
// return byteBuffer.toString();
//
@@ -354,7 +353,7 @@
*
* @return filename for zip-file
*/
- private String getZipFilename() {
+ private String getDefaultZipFilename() {
String currentDate;
Date today = new Date();
@@ -515,28 +514,17 @@
fileDialog.setText("Save");
- String fileName = logFileName.getText();
+ File fileName = new File(logFileName.getText());
- if ( folderLogFileName.length() != 0 ) {
- fileDialog.setFilterPath(folderLogFileName);
- } else {
- String strFilterPath = logFileName.getText();
- int index = strFilterPath.lastIndexOf(SEPARATOR);
- if (index != -1) {
- strFilterPath = strFilterPath.substring(0, index + 1);
- }
- fileDialog.setFilterPath(strFilterPath);
- }
-
- fileDialog.setFileName(fileName);
+ fileDialog.setFilterPath(fileName.getParent());
+ fileDialog.setFileName(fileName.getName());
+
String[] filterExt = { "*.zip" };
fileDialog.setFilterExtensions(filterExt);
String selected = fileDialog.open();
if (selected != null) {
- System.out.println(selected);
- logFileName.setText(selected);
- folderLogFileName = "";
+ logFileName.setText(selected);
}
};
@@ -598,7 +586,7 @@
}
public Point getPreferredSize() {
- return new Point(400, 500);
+ return new Point(400, 500);
}
protected GridLayout getDefaultSupportLayout() {
16 years, 10 months
JBoss Tools SVN: r2291 - trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/reporting.
by jbosstools-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2007-07-04 17:25:45 -0400 (Wed, 04 Jul 2007)
New Revision: 2291
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/reporting/ReportProblemWizard.java
Log:
dateformats are not threadsafe - hence shouldn't be shared.
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/reporting/ReportProblemWizard.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/reporting/ReportProblemWizard.java 2007-07-04 15:47:03 UTC (rev 2290)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/reporting/ReportProblemWizard.java 2007-07-04 21:25:45 UTC (rev 2291)
@@ -98,7 +98,7 @@
private String folderLogFileName;
/** LOG_DATE_FORMAT */
- final static private SimpleDateFormat LOG_DATE_FORMAT = new SimpleDateFormat(
+ final private SimpleDateFormat LOG_DATE_FORMAT = new SimpleDateFormat(
"dd_MMM_yyyy__HH_mm_ss_SSS");
/** log file name */
16 years, 10 months
JBoss Tools SVN: r2290 - 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-04 11:47:03 -0400 (Wed, 04 Jul 2007)
New Revision: 2290
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/BijectedAttributeType.java
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/ISeamComponentDeclaration.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponentMethod.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamContextVariable.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamFactory.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/ISeamProperty.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
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 Added some comments
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/BijectedAttributeType.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/BijectedAttributeType.java 2007-07-04 15:16:10 UTC (rev 2289)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/BijectedAttributeType.java 2007-07-04 15:47:03 UTC (rev 2290)
@@ -11,8 +11,8 @@
package org.jboss.tools.seam.core;
/**
+ * Represents Type of Bijected Attribute.
* @author Alexey Kazakov
- *
*/
public enum BijectedAttributeType {
IN,
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-04 15:16:10 UTC (rev 2289)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IBijectedAttribute.java 2007-07-04 15:47:03 UTC (rev 2290)
@@ -11,12 +11,13 @@
package org.jboss.tools.seam.core;
/**
+ * Base interface of bijected attribute of seam component.
* @author Alexey Kazakov
*/
public interface IBijectedAttribute extends ISeamContextVariable, ISeamJavaSourceReference {
/**
- * @return type
+ * @return type of attribute
*/
public BijectedAttributeType getType();
}
\ 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-04 15:16:10 UTC (rev 2289)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IRole.java 2007-07-04 15:47:03 UTC (rev 2290)
@@ -11,6 +11,7 @@
package org.jboss.tools.seam.core;
/**
+ * Represents @Role of seam component.
* @author Alexey Kazakov
*/
public interface IRole extends ISeamJavaSourceReference, ISeamContextVariable {
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-04 15:16:10 UTC (rev 2289)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamAnnotatedFactory.java 2007-07-04 15:47:03 UTC (rev 2290)
@@ -11,6 +11,7 @@
package org.jboss.tools.seam.core;
/**
+ * Represents seam factory method which was declared by @Factory
* @author Alexey Kazakov
*/
public interface ISeamAnnotatedFactory extends ISeamFactory, ISeamJavaSourceReference {
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-04 15:16:10 UTC (rev 2289)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponent.java 2007-07-04 15:47:03 UTC (rev 2290)
@@ -14,14 +14,36 @@
import java.util.List;
import java.util.Set;
+/**
+ * Represents component in seam tools model.
+ * @author Alexey Kazakov
+ */
public interface ISeamComponent extends ISeamContextVariable {
+ /**
+ * Returns java declaration of component.
+ * This declaration represents java class of component.
+ * @return java declaration of component.
+ */
public ISeamJavaComponentDeclaration getJavaDeclaration();
+ /**
+ * Returns XML declarations of component.
+ * These declarations represent <component> elements of components.xml files.
+ * @return java declaration of component.
+ */
public Set<ISeamXmlComponentDeclaration> getXmlDeclarations();
+ /**
+ * Returns Properties declarations of component.
+ * These declarations represent properties from seam.properties file.
+ * @return
+ */
public Set<ISeamPropertiesDeclaration> getPropertiesDeclarations();
+ /**
+ * @return all declarations of component
+ */
public Set<ISeamComponentDeclaration> getAllDeclarations();
/**
@@ -30,7 +52,7 @@
public String getClassName();
/**
- * @return bijected attributes
+ * @return bijected attributes of component
*/
public Set<IBijectedAttribute> getBijectedAttributes();
@@ -75,14 +97,14 @@
public Set<ISeamComponentMethod> getMethodsByType(SeamComponentMethodType type);
/**
- * Returns properties by name from component.xml.
+ * Returns all properties from all components.xml declarations of component
* @param propertyName
* @return
*/
public Collection<ISeamProperty> getProperties();
/**
- * Returns all properties from component.xml for that component.
+ * Returns properties by name from all components.xml declarations of component
* @param propertyName
* @return
*/
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponentDeclaration.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponentDeclaration.java 2007-07-04 15:16:10 UTC (rev 2289)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponentDeclaration.java 2007-07-04 15:47:03 UTC (rev 2290)
@@ -11,10 +11,13 @@
package org.jboss.tools.seam.core;
/**
+ * Represents declaration of seam component.
* @author Alexey Kazakov
- *
*/
public interface ISeamComponentDeclaration extends ISeamTextSourceReference {
+ /**
+ * @return name of component.
+ */
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-04 15:16:10 UTC (rev 2289)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponentMethod.java 2007-07-04 15:47:03 UTC (rev 2290)
@@ -11,6 +11,8 @@
package org.jboss.tools.seam.core;
/**
+ * Represents method of seam component.
+ * This interface represents only methods with types enumerated in SeamComponentMethodType
* @author Alexey Kazakov
*/
public interface ISeamComponentMethod extends ISeamJavaSourceReference {
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamContextVariable.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamContextVariable.java 2007-07-04 15:16:10 UTC (rev 2289)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamContextVariable.java 2007-07-04 15:47:03 UTC (rev 2290)
@@ -11,12 +11,13 @@
package org.jboss.tools.seam.core;
/**
+ * Represents Seam Context Variable.
* @author Alexey Kazakov
*/
public interface ISeamContextVariable {
/**
- * @return name
+ * @return name of context variable
*/
public String getName();
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamFactory.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamFactory.java 2007-07-04 15:16:10 UTC (rev 2289)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamFactory.java 2007-07-04 15:47:03 UTC (rev 2290)
@@ -11,6 +11,7 @@
package org.jboss.tools.seam.core;
/**
+ * Base interface of seam factory
* @author Alexey Kazakov
*/
public interface ISeamFactory extends ISeamContextVariable {
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-04 15:16:10 UTC (rev 2289)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamJavaComponentDeclaration.java 2007-07-04 15:47:03 UTC (rev 2290)
@@ -13,29 +13,22 @@
import java.util.Set;
/**
+ * Represents java class of seam component.
* @author Alexey Kazakov
- *
*/
public interface ISeamJavaComponentDeclaration extends ISeamComponentDeclaration, ISeamJavaSourceReference {
-
- public String getClassName();
/**
- * @return bijected attributes
+ * @return qualified class name
*/
- public Set<IBijectedAttribute> getBijectedAttributes();
+ public String getClassName();
/**
- * Adds bijected attribute
+ * @return all bijected attributes which are defined in that java class.
*/
- public void addBijectedAttribute(IBijectedAttribute attribute);
+ public Set<IBijectedAttribute> getBijectedAttributes();
/**
- * Removes bijected attribute
- */
- public void removeBijectedAttribute(IBijectedAttribute attribute);
-
- /**
* Returns bijected attributes by name
* @param name
* @return
@@ -50,39 +43,50 @@
public Set<IBijectedAttribute> getBijectedAttributesByType(BijectedAttributeType type);
/**
- * @return true if component marked as Stateful
+ * Adds bijected attribute
*/
+ public void addBijectedAttribute(IBijectedAttribute attribute);
+
+ /**
+ * Removes bijected attribute
+ */
+ public void removeBijectedAttribute(IBijectedAttribute attribute);
+
+ /**
+ * @return true if class marked as Stateful
+ */
public boolean isStateful();
/**
- * @return true if component marked as Entity
+ * @return true if class marked as Entity
*/
public boolean isEntity();
/**
- * Set true if component marked as Entity
+ * Set true if class marked as Entity
*/
public void setEntity(boolean entity);
/**
- * @return roles of component
+ * @return roles of component which defined in this component class
*/
public Set<IRole> getRoles();
/**
- * Adds role to component
+ * Adds role
* @param role
*/
public void addRole(IRole role);
/**
- * Removes role from component
+ * Removes role
* @param role
*/
public void removeRole(IRole role);
/**
- * @return methods of component
+ * @return methods (see SeamComponentMethodType)
+ * which are defined in this component class.
*/
public Set<ISeamComponentMethod> getMethods();
Modified: 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 2007-07-04 15:16:10 UTC (rev 2289)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamJavaSourceReference.java 2007-07-04 15:47:03 UTC (rev 2290)
@@ -13,6 +13,7 @@
import org.eclipse.jdt.core.IMember;
/**
+ * An interface of seam tools model object that has associated source object in JDT model
* @author Alexey Kazakov
*/
public interface ISeamJavaSourceReference extends ISeamTextSourceReference {
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-04 15:16:10 UTC (rev 2289)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamPropertiesDeclaration.java 2007-07-04 15:47:03 UTC (rev 2290)
@@ -14,40 +14,43 @@
import java.util.List;
/**
+ * Represents set of properties of seam component
+ * which were declared in one source file.
* @author Alexey Kazakov
- *
*/
public interface ISeamPropertiesDeclaration extends ISeamComponentDeclaration {
/**
- * Returns all properties from component.xml for that component.
+ * Returns property of the component within this declaration.
+ * If the declaration has a few properties with this name,
+ * then the method will return first one.
* @param propertyName
* @return
*/
- public List<ISeamProperty> getProperties(String propertyName);
+ public ISeamProperty getProperty(String propertyName);
/**
- * Returns first property with propertyName from component.xml for that component.
+ * Returns all properties of the component by name within this declaration.
* @param propertyName
* @return
*/
- public ISeamProperty getProperty(String propertyName);
+ public List<ISeamProperty> getProperties(String propertyName);
/**
- * Returns properties by name from component.xml.
+ * Returns all properties of the component within this declaration.
* @param propertyName
* @return
*/
public Collection<ISeamProperty> getProperties();
/**
- * Adds property to component.
+ * Adds property.
* @param property
*/
public void addProperty(ISeamProperty property);
/**
- * Removes property from component.
+ * Removes property.
* @param property
*/
public void removeProperty(ISeamProperty property);
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-04 15:16:10 UTC (rev 2289)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProperty.java 2007-07-04 15:47:03 UTC (rev 2290)
@@ -11,22 +11,22 @@
package org.jboss.tools.seam.core;
/**
- * Property of Seam Component defined in Component.xml or Properties.xml
+ * A property of Seam Component defined in component.xml or seam.properties files
*/
public interface ISeamProperty extends ISeamTextSourceReference {
/**
- * @return name of property
+ * @return name of this property
*/
public String getName();
/**
- * @return value of property
+ * @return value of this property
*/
public Object getValue();
/**
- * Sets value of property
+ * Sets value of this property
* @param value
*/
public void setValue(Object value);
Modified: 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 2007-07-04 15:16:10 UTC (rev 2289)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamTextSourceReference.java 2007-07-04 15:47:03 UTC (rev 2290)
@@ -13,11 +13,23 @@
import org.eclipse.core.resources.IResource;
/**
+ * An interface of seam tools model object that has text source.
* @author Alexey Kazakov
*/
public interface ISeamTextSourceReference {
+ /**
+ * @return resource
+ */
public IResource getResource();
+
+ /**
+ * @return start position of element in text
+ */
public int getStartPosition();
+
+ /**
+ * @return number of characters of element in text
+ */
public int getLength();
}
\ No newline at end of file
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-04 15:16:10 UTC (rev 2289)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamXmlComponentDeclaration.java 2007-07-04 15:47:03 UTC (rev 2290)
@@ -11,33 +11,64 @@
package org.jboss.tools.seam.core;
/**
+ * Represents <component> element of components.xml file.
* @author Alexey Kazakov
- *
*/
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";
+ /*
+ * Names of <component> attributes.
+ */
+ public final static String NAME = "name";
+ public final static String CLASS = "class";
+ public final static String SCOPE = "scope";
+ public final static String PRECEDENCE = "precedence";
+ public final static String INSTALLED = "installed";
+ public final static String AUTO_CREATE = "auto-create";
+ public final static String JNDI_NAME = "jndi-name";
+
+ /**
+ * @return scope type
+ */
public ScopeType getScope();
+ /**
+ * @return string value of 'scope' attribute
+ */
public String getScopeAsString();
+ /**
+ * @return string value of 'class' attribute
+ */
public String getClassName();
+ /**
+ * @return string value of 'jndi-name' attribute
+ */
public String getJndiName();
+ /**
+ * @return true if attribute 'installed' is 'true'
+ */
public boolean isInstalled();
-
+
+ /**
+ * @return string value of 'installed' attribute
+ */
public boolean getInstalledAsString();
+ /**
+ * @return string value of 'precedence' attribute
+ */
public String getPrecedence();
+ /**
+ * @return true if attribute 'auto-create' is 'true'
+ */
public boolean isAutoCreate();
+ /**
+ * @return string value of 'auto-create' attribute
+ */
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-04 15:16:10 UTC (rev 2289)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamXmlFactory.java 2007-07-04 15:47:03 UTC (rev 2290)
@@ -11,12 +11,13 @@
package org.jboss.tools.seam.core;
/**
+ * Represents <factory> element in components.xml
* @author Alexey Kazakov
*/
public interface ISeamXmlFactory extends ISeamFactory, ISeamTextSourceReference {
/**
- * @return value
+ * @return string value of 'value' attribute
*/
public String getValue();
@@ -27,7 +28,7 @@
public void setValue(String value);
/**
- * @return method
+ * @return string value of 'method' attribute
*/
public String getMethod();
16 years, 10 months
JBoss Tools SVN: r2289 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/parts.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2007-07-04 11:16:10 -0400 (Wed, 04 Jul 2007)
New Revision: 2289
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/parts/DiagramEditPart.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/parts/DiagramEditPart.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/parts/DiagramEditPart.java 2007-07-04 15:11:46 UTC (rev 2288)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/veditor/editors/parts/DiagramEditPart.java 2007-07-04 15:16:10 UTC (rev 2289)
@@ -363,12 +363,15 @@
int[] shape = new int[4];
shape[0] = element.getLocation().x;
shape[1] = element.getLocation().y;
- //OrmShapeEditPart part = (OrmShapeEditPart)getViewer().getEditPartRegistry().get(element);
- //if(part != null)
- // shape[2] = part.getFigure().getSize().width;
- //else
+ OrmShapeEditPart part = (OrmShapeEditPart)getViewer().getEditPartRegistry().get(element);
+ if(part != null){
+ IFigure fig = part.getFigure();
+ shape[2] = fig.getPreferredSize().width;
+ shape[3] = fig.getPreferredSize().height;
+ }else{
shape[2] = 600;
- shape[3] = 100;
+ shape[3] = 100;
+ }
return shape;
}
16 years, 10 months
JBoss Tools SVN: r2288 - in trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam: core/event and 5 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-07-04 11:11:46 -0400 (Wed, 04 Jul 2007)
New Revision: 2288
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/event/
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/event/Change.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/event/IChangeVisitor.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/event/ISeamProjectChangeListener.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/event/SeamProjectChangeEvent.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlFactory.java
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/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/SeamComponentDeclaration.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamFactory.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/SeamProject.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/SeamProperty.java
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/scanner/LoadedDeclarations.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ASTVisitorImpl.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/AnnotatedASTNode.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/java/ResolvedAnnotation.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 Merge for incremental build added. Event model added.
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-04 14:51:35 UTC (rev 2287)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProject.java 2007-07-04 15:11:46 UTC (rev 2288)
@@ -13,6 +13,7 @@
import java.util.Set;
import org.eclipse.core.resources.IProjectNature;
+import org.jboss.tools.seam.core.event.ISeamProjectChangeListener;
public interface ISeamProject extends IProjectNature {
@@ -101,4 +102,17 @@
* @param factory
*/
public void removeFactory(ISeamFactory factory);
+
+ /**
+ * Adds listener to the project
+ * @param listener
+ */
+ public void addSeamProjectListener(ISeamProjectChangeListener listener);
+
+ /**
+ * Removes listener from the project
+ * @param listener
+ */
+ public void removeSeamProjectListener(ISeamProjectChangeListener listener);
+
}
\ No newline at end of file
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-04 14:51:35 UTC (rev 2287)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCoreBuilder.java 2007-07-04 15:11:46 UTC (rev 2288)
@@ -198,7 +198,8 @@
throws CoreException {
try {
getProject().accept(RESOURCE_VISITOR);
- } catch (CoreException e) {
+ } catch (CoreException e) {
+ e.printStackTrace();
}
}
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/event/Change.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/event/Change.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/event/Change.java 2007-07-04 15:11:46 UTC (rev 2288)
@@ -0,0 +1,118 @@
+ /*******************************************************************************
+ * 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.event;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * This object collects changes in target that should be fired to listeners.
+ *
+ * @author Viacheslav Kabanovich
+ */
+public class Change {
+ Object target;
+ String property;
+ Object oldValue;
+ Object newValue;
+ List<Change> children;
+
+ /**
+ *
+ * @param target
+ * @param property - name of property changed or null, if change is adding/removing a child.
+ * @param oldValue - old value; if null and property = null, then child (newValue) is added
+ * @param newValue - new value; if null and property = null, then child (oldValue) is removed
+ */
+ public Change(Object target, String property, Object oldValue, Object newValue) {
+ this.target = target;
+ this.property = property;
+ this.oldValue = oldValue;
+ this.newValue = newValue;
+ }
+
+ public Object getTarget() {
+ return target;
+ }
+
+ public String getProperty() {
+ return property;
+ }
+
+ public Object getOldValue() {
+ return oldValue;
+ }
+
+ public Object getNewValue() {
+ return newValue;
+ }
+
+ public void addChildren(List<Change> children) {
+ if(this.children == null) {
+ this.children = children;
+ } else if(children != null) {
+ this.children.addAll(children);
+ }
+ }
+
+ /**
+ * Returns true if this object defines no actual change in seam model.
+ * @return
+ */
+ public boolean isEmpty() {
+ return oldValue == null && newValue == null && !isChildrenAffected();
+ }
+
+ /**
+ * Returns true if this change includes sub-changes.
+ * @return
+ */
+ public boolean isChildrenAffected() {
+ return children != null && children.size() > 0;
+ }
+
+ /**
+ * Returns list of all changes
+ * @return
+ */
+ public List<Change> getChildren() {
+ return children;
+ }
+
+ /**
+ * Invokes visitor for this change, and if visit returns true, iterates over
+ * child changes.
+ * @param visitor
+ */
+ public void visit(IChangeVisitor visitor) {
+ if(!visitor.visit(this)) return;
+ if(children != null) {
+ for (Change c: children) {
+ c.visit(visitor);
+ }
+ }
+ }
+
+ /**
+ * Utility method to attach a single change to the list. If list is not provided,
+ * new list is created, otherwise the provided list is returned.
+ * @param changes
+ * @param change
+ * @return
+ */
+ public static List<Change> addChange(List<Change> changes, Change change) {
+ if(change == null || change.isEmpty()) return changes;
+ if(changes == null) changes = new ArrayList<Change>();
+ changes.add(change);
+ return changes;
+ }
+
+}
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/event/IChangeVisitor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/event/IChangeVisitor.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/event/IChangeVisitor.java 2007-07-04 15:11:46 UTC (rev 2288)
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.core.event;
+
+/**
+ * This interface allows to process SeamProjectChangeEvent, or specific Change by
+ * invoking method visit(IChangeVisitor) declared on them.
+ *
+ * @author Viacheslav Kabanovich
+ */
+public interface IChangeVisitor {
+
+ /**
+ * Processes a single change. If this method returns true,
+ * it shall be invoked with child changes
+ * @param change
+ * @return
+ */
+ public boolean visit(Change change);
+}
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/event/ISeamProjectChangeListener.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/event/ISeamProjectChangeListener.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/event/ISeamProjectChangeListener.java 2007-07-04 15:11:46 UTC (rev 2288)
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.core.event;
+
+/**
+ * Interface of an object listening to seam project modifications.
+ *
+ * @author Viacheslav Kabanovich
+ */
+public interface ISeamProjectChangeListener {
+
+ /**
+ * Called when seam project is changed.
+ * Event contains list of structured detailed changes.
+ * It can be conveniently processed using method
+ * event.visit(IChangeVisitor)
+ * @param event
+ */
+ public void projectChanged(SeamProjectChangeEvent event);
+
+}
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/event/SeamProjectChangeEvent.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/event/SeamProjectChangeEvent.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/event/SeamProjectChangeEvent.java 2007-07-04 15:11:46 UTC (rev 2288)
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.core.event;
+
+import java.util.ArrayList;
+import java.util.EventObject;
+import java.util.List;
+
+import org.jboss.tools.seam.core.ISeamComponent;
+import org.jboss.tools.seam.core.ISeamProject;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class SeamProjectChangeEvent extends EventObject {
+ private static final long serialVersionUID = 1L;
+ /**
+ * Modified seam project.
+ */
+ ISeamProject project;
+
+ /**
+ * List of structured changes.
+ */
+ List<Change> changes;
+
+ public SeamProjectChangeEvent(ISeamProject project, List<Change> changes) {
+ super(project);
+ this.changes = changes;
+ }
+
+ /**
+ * Returns modified seam project
+ * @return
+ */
+ public ISeamProject getProject() {
+ return project;
+ }
+
+ /**
+ * Returns all changes
+ * @return
+ */
+ public List<Change> getAllChanges() {
+ return changes;
+ }
+
+ /**
+ * Invokes visitor for each change, which result in iteration over
+ * tree of changes when
+ * @param visitor
+ */
+ public void visit(IChangeVisitor visitor) {
+ if(changes != null) for (Change c: changes) {
+ c.visit(visitor);
+ }
+ }
+
+ /**
+ * Utility method, returns all components that have been modified.
+ * The list does not include removed and added components.
+ * This method makes an example of using visitors to process
+ * seam project events.
+ *
+ * @return
+ */
+ public List<ISeamComponent> getAllModifiedComponents() {
+ final List<ISeamComponent> list = new ArrayList<ISeamComponent>();
+ visit(new IChangeVisitor() {
+ public boolean visit(Change change) {
+ Object t = change.getTarget();
+ if(t instanceof ISeamComponent) {
+ list.add((ISeamComponent)t);
+ } else if(t instanceof ISeamProject) {
+ return true;
+ }
+ return false;
+ }
+ });
+ return list;
+ }
+
+}
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-04 14:51:35 UTC (rev 2287)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponent.java 2007-07-04 15:11:46 UTC (rev 2288)
@@ -200,10 +200,22 @@
if(declaration instanceof ISeamJavaComponentDeclaration) {
javaDeclarations.add((ISeamJavaComponentDeclaration)declaration);
} else if(declaration instanceof ISeamXmlComponentDeclaration) {
- xmlDeclarations.add((ISeamXmlComponentDeclaration)xmlDeclarations);
+ xmlDeclarations.add((ISeamXmlComponentDeclaration)declaration);
} else if(declaration instanceof ISeamPropertiesDeclaration) {
propertyDeclarations.add((ISeamPropertiesDeclaration)declaration);
}
}
+
+ public void removeDeclaration(ISeamComponentDeclaration declaration) {
+ if(!allDeclarations.contains(declaration)) return;
+ allDeclarations.remove(declaration);
+ if(declaration instanceof ISeamJavaComponentDeclaration) {
+ javaDeclarations.remove(declaration);
+ } else if(declaration instanceof ISeamXmlComponentDeclaration) {
+ xmlDeclarations.remove(declaration);
+ } else if(declaration instanceof ISeamPropertiesDeclaration) {
+ propertyDeclarations.remove(declaration);
+ }
+ }
}
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-04 14:51:35 UTC (rev 2287)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentDeclaration.java 2007-07-04 15:11:46 UTC (rev 2288)
@@ -1,9 +1,26 @@
+ /*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.seam.internal.core;
+import java.util.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.event.Change;
+/**
+ * @author Viacheslav Kabanovich
+ */
public abstract class SeamComponentDeclaration implements ISeamComponentDeclaration {
/**
* Path of resource where this component is declared.
@@ -58,5 +75,29 @@
// TODO Auto-generated method stub
return 0;
}
-
+
+ /**
+ * Merges loaded data into currently used declaration.
+ * If changes were done returns a list of changes.
+ * @param d
+ * @return list of changes
+ */
+ public List<Change> merge(SeamComponentDeclaration d) {
+ List<Change> changes = null;
+ if(!source.equals(d.source)) {
+ source = d.source;
+ }
+ if(!stringsEqual(name, d.name)) {
+ changes = Change.addChange(changes, new Change(this, "name", name, d.name));
+ name = d.name;
+ }
+ if(id != d.id) id = d.id;
+
+ return changes;
+ }
+
+ boolean stringsEqual(String s1, String s2) {
+ return s1 == null ? s2 == null : s1.equals(s2);
+ }
+
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamFactory.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamFactory.java 2007-07-04 14:51:35 UTC (rev 2287)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamFactory.java 2007-07-04 15:11:46 UTC (rev 2288)
@@ -1,8 +1,12 @@
package org.jboss.tools.seam.internal.core;
+import java.util.List;
+
import org.eclipse.core.runtime.IPath;
import org.jboss.tools.seam.core.ISeamFactory;
+import org.jboss.tools.seam.core.ISeamXmlComponentDeclaration;
import org.jboss.tools.seam.core.ScopeType;
+import org.jboss.tools.seam.core.event.Change;
public class SeamFactory implements ISeamFactory {
/**
@@ -60,4 +64,33 @@
}
}
+ /**
+ * Merges loaded data into currently used declaration.
+ * If changes were done returns a list of changes.
+ * @param f
+ * @return list of changes
+ */
+ public List<Change> merge(SeamFactory f) {
+ List<Change> changes = null;
+
+ source = f.source;
+ id = f.id;
+
+ if(!stringsEqual(name, f.name)) {
+ changes = Change.addChange(changes, new Change(this, ISeamXmlComponentDeclaration.NAME, name, f.name));
+ name = f.name;
+ }
+ if(!stringsEqual(scope, f.scope)) {
+ changes = Change.addChange(changes, new Change(this, ISeamXmlComponentDeclaration.SCOPE, scope, f.scope));
+ scope = f.scope;
+ scopeType = f.scopeType;
+ }
+
+ return changes;
+ }
+
+ boolean stringsEqual(String s1, String s2) {
+ return s1 == null ? s2 == null : s1.equals(s2);
+ }
+
}
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-04 14:51:35 UTC (rev 2287)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java 2007-07-04 15:11:46 UTC (rev 2288)
@@ -1,9 +1,9 @@
package org.jboss.tools.seam.internal.core;
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
-import org.eclipse.core.resources.IResource;
import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.IType;
import org.jboss.tools.seam.core.BijectedAttributeType;
@@ -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.event.Change;
public class SeamJavaComponentDeclaration extends SeamComponentDeclaration
implements ISeamJavaComponentDeclaration {
@@ -139,4 +140,42 @@
return type;
}
+ /**
+ * Merges loaded data into currently used declaration.
+ * If changes were done returns a list of changes.
+ * @param d
+ * @return list of changes
+ */
+ public List<Change> merge(SeamComponentDeclaration d) {
+ List<Change> changes = super.merge(d);
+ SeamJavaComponentDeclaration jd = (SeamJavaComponentDeclaration)d;
+ if(!stringsEqual(className, jd.className)) {
+ changes = Change.addChange(changes, new Change(this, "class", className, jd.className));
+ className = jd.className;
+ }
+ if(scopeType != jd.scopeType) {
+ changes = Change.addChange(changes, new Change(this, "scope", scopeType, jd.scopeType));
+ scopeType = jd.scopeType;
+ }
+ if(type != jd.type) type = jd.type;
+ if(stateful != jd.stateful) {
+ changes = Change.addChange(changes, new Change(this, "stateful", stateful, jd.stateful));
+ stateful = jd.stateful;
+ }
+ if(entity != jd.entity) {
+ changes = Change.addChange(changes, new Change(this, "entity", entity, jd.entity));
+ entity = jd.entity;
+ }
+ Change children = new Change(this, null, null, null);
+
+ //TODO do real merge and add changes to children
+ this.bijectedAttributes = jd.bijectedAttributes;
+ this.componentMethods = jd.componentMethods;
+ this.roles = jd.roles;
+
+ changes = Change.addChange(changes, children);
+
+ return changes;
+ }
+
}
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-04 14:51:35 UTC (rev 2287)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2007-07-04 15:11:46 UTC (rev 2288)
@@ -10,9 +10,11 @@
******************************************************************************/
package org.jboss.tools.seam.internal.core;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -27,18 +29,22 @@
import org.jboss.tools.seam.core.ISeamContextVariable;
import org.jboss.tools.seam.core.ISeamXmlComponentDeclaration;
import org.jboss.tools.seam.core.ScopeType;
+import org.jboss.tools.seam.core.event.Change;
+import org.jboss.tools.seam.core.event.ISeamProjectChangeListener;
+import org.jboss.tools.seam.core.event.SeamProjectChangeEvent;
import org.jboss.tools.seam.internal.core.scanner.LoadedDeclarations;
/**
- * @author glory
+ * @author Viacheslav Kabanovich
*/
public class SeamProject implements ISeamProject {
IProject project;
Map<String, SeamComponent> allComponents = new HashMap<String, SeamComponent>();
protected Set<ISeamFactory> allFactories = new HashSet<ISeamFactory>();
Set<ISeamContextVariable> allVariables = new HashSet<ISeamContextVariable>();
+ Map<String, SeamJavaComponentDeclaration> javaDeclarations = new HashMap<String, SeamJavaComponentDeclaration>();
- Map<String, SeamJavaComponentDeclaration> javaDeclarations = new HashMap<String, SeamJavaComponentDeclaration>();
+ List<ISeamProjectChangeListener> listeners = new ArrayList<ISeamProjectChangeListener>();
public SeamProject() {}
@@ -87,8 +93,6 @@
* @param source
*/
public void registerComponents(LoadedDeclarations ds, IPath source) {
- //deprecated
- pathRemoved(source);
SeamComponentDeclaration[] components = ds.getComponents().toArray(new SeamComponentDeclaration[0]);
SeamFactory[] factories = ds.getFactories().toArray(new SeamFactory[0]);
@@ -98,32 +102,76 @@
return;
}
- Map<Object,ISeamComponentDeclaration> currentDeclarations = findComponentDeclarations(source);
+ Map<Object,ISeamComponentDeclaration> currentComponents = findComponentDeclarations(source);
for (int i = 0; i < components.length; i++) {
- components[i].setSourcePath(source);
- String name = components[i].getName();
+ SeamComponentDeclaration loaded = (SeamComponentDeclaration)components[i];
+ SeamComponentDeclaration current = (SeamComponentDeclaration)currentComponents.remove(loaded.getId());
+
+ loaded.setSourcePath(source);
+
+ String name = loaded.getName();
SeamComponent c = getComponent(name);
+
+ if(current != null) {
+ List<Change> changes = current.merge(loaded);
+ if(changes != null && changes.size() > 0) {
+ Change cc = new Change(c, null, null, null);
+ cc.addChildren(changes);
+ List<Change> cchanges = Change.addChange(null, cc);
+ fireChanges(cchanges);
+ //TODO if java, fire to others
+ }
+ continue;
+ }
+
if(c == null) {
c = newComponent(name);
allComponents.put(name, c);
+ allVariables.add(c);
}
c.addDeclaration(components[i]);
- if(components[i] instanceof ISeamJavaComponentDeclaration) {
+ List<Change> changes = Change.addChange(null, new Change(this, null, null, c));
+ fireChanges(changes);
+
+ if(loaded instanceof ISeamJavaComponentDeclaration) {
javaDeclarations.put(c.getClassName(), (SeamJavaComponentDeclaration)components[i]);
Set<ISeamComponent> cs = getComponentsByClass(c.getClassName());
for (ISeamComponent ci: cs) {
if(ci == c) continue;
SeamComponent cii = (SeamComponent)ci;
- cii.addDeclaration(components[i]);
+ cii.addDeclaration(loaded);
+ changes = Change.addChange(null, new Change(ci, null, null, loaded));
+ fireChanges(changes);
}
- } else if(components[i] instanceof ISeamXmlComponentDeclaration) {
+ } else if(loaded instanceof ISeamXmlComponentDeclaration) {
ISeamXmlComponentDeclaration xml = (ISeamXmlComponentDeclaration)components[i];
String className = xml.getClassName();
SeamJavaComponentDeclaration j = javaDeclarations.get(className);
- if(j != null) c.addDeclaration(j);
+ if(j != null) {
+ c.addDeclaration(j);
+ changes = Change.addChange(null, new Change(c, null, null, j));
+ fireChanges(changes);
+ }
}
}
+
+ componentDeclarationsRemoved(currentComponents);
+
+ Map<Object, ISeamFactory> currentFactories = findFactoryDeclarations(source);
+ for (int i = 0; i < factories.length; i++) {
+ SeamFactory loaded = factories[i];
+ SeamFactory current = (SeamFactory)currentFactories.remove(loaded.getId());
+ if(current != null) {
+ List<Change> changes = current.merge(loaded);
+ fireChanges(changes);
+ continue;
+
+ }
+ }
+
+ factoryDeclarationsRemoved(currentFactories);
+
}
/**
@@ -142,16 +190,38 @@
public void pathRemoved(IPath source) {
Iterator<SeamComponent> iterator = allComponents.values().iterator();
while(iterator.hasNext()) {
- 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();
+ List<Change> changes = null;
+ SeamComponent c = iterator.next();
+ SeamComponentDeclaration[] ds = c.getAllDeclarations().toArray(new SeamComponentDeclaration[0]);
+ for (int i = 0; i < ds.length; i++) {
+ if(ds[i].source.equals(source)) {
+ c.removeDeclaration(ds[i]);
+ if(ds[i] instanceof ISeamJavaComponentDeclaration) {
+ String className = ((ISeamJavaComponentDeclaration)ds[i]).getClassName();
+ javaDeclarations.remove(className);
+ }
+ changes = Change.addChange(changes, new Change(c, null, ds[i], null));
+ }
}
if(c.getAllDeclarations().size() == 0) {
iterator.remove();
+ allVariables.remove(c);
+ changes = null;
+ changes = Change.addChange(changes, new Change(this, null, c, null));
+
}
- }
+ fireChanges(changes);
+ }
+ Iterator<ISeamFactory> factories = allFactories.iterator();
+ while(factories.hasNext()) {
+ SeamFactory f = (SeamFactory)factories.next();
+ if(source.equals(f.getSourcePath())) {
+ List<Change> changes = Change.addChange(null, new Change(this, null, f, null));
+ factories.remove();
+ allVariables.remove(f);
+ fireChanges(changes);
+ }
+ }
}
public Map<Object,ISeamComponentDeclaration> findComponentDeclarations(IPath source) {
@@ -164,7 +234,55 @@
}
return map;
}
+
+ void componentDeclarationsRemoved(Map<Object,ISeamComponentDeclaration> removed) {
+ Iterator<SeamComponent> iterator = allComponents.values().iterator();
+ while(iterator.hasNext()) {
+ List<Change> changes = null;
+ SeamComponent c = iterator.next();
+ SeamComponentDeclaration[] ds = c.getAllDeclarations().toArray(new SeamComponentDeclaration[0]);
+ for (int i = 0; i < ds.length; i++) {
+ if(removed.containsKey(ds[i].getId())) {
+ if(ds[i] instanceof ISeamJavaComponentDeclaration) {
+ String className = ((ISeamJavaComponentDeclaration)ds[i]).getClassName();
+ javaDeclarations.remove(className);
+ }
+ c.removeDeclaration(ds[i]);
+ changes = Change.addChange(changes, new Change(c, null, ds[i], null));
+ }
+ }
+ if(c.getAllDeclarations().size() == 0) {
+ iterator.remove();
+ allVariables.remove(c);
+ changes = Change.addChange(null, new Change(this, null, c, null));
+ }
+ fireChanges(changes);
+ }
+ }
+ public Map<Object,ISeamFactory> findFactoryDeclarations(IPath source) {
+ Map<Object,ISeamFactory> map = new HashMap<Object, ISeamFactory>();
+ for (ISeamFactory c: allFactories) {
+ SeamFactory ci = (SeamFactory)c;
+ if(source.equals(ci.getSourcePath())) map.put(ci.getId(), ci);
+ }
+ return map;
+ }
+
+ void factoryDeclarationsRemoved(Map<Object,ISeamFactory> removed) {
+ Iterator<ISeamFactory> iterator = allFactories.iterator();
+ List<Change> changes = null;
+ while(iterator.hasNext()) {
+ SeamFactory c = (SeamFactory)iterator.next();
+ if(removed.containsKey(c.getId())) {
+ iterator.remove();
+ allVariables.remove(c);
+ changes = Change.addChange(changes, new Change(this, null, c, null));
+ }
+ }
+ fireChanges(changes);
+ }
+
//deprecated
public Set<ISeamComponent> getComponentsByName(String name) {
Set<ISeamComponent> result = new HashSet<ISeamComponent>();
@@ -280,6 +398,7 @@
public void removeFactory(ISeamFactory factory) {
allFactories.remove(factory);
+ allVariables.remove(factory);
}
SeamComponent getComponent(String name) {
@@ -291,5 +410,28 @@
c.setName(name);
return c;
}
+
+ void fireChanges(List<Change> changes) {
+ if(changes == null || changes.size() == 0) return;
+ SeamProjectChangeEvent event = new SeamProjectChangeEvent(this, changes);
+ ISeamProjectChangeListener[] ls = null;
+ synchronized(this) {
+ ls = listeners.toArray(new ISeamProjectChangeListener[0]);
+ }
+ if(ls != null) {
+ for (int i = 0; i < ls.length; i++) {
+ ls[i].projectChanged(event);
+ }
+ }
+ }
+ public synchronized void addSeamProjectListener(ISeamProjectChangeListener listener) {
+ if(listeners.contains(listener)) return;
+ listeners.add(listener);
+ }
+
+ public synchronized void removeSeamProjectListener(ISeamProjectChangeListener listener) {
+ listeners.remove(listener);
+ }
+
}
Modified: 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 2007-07-04 14:51:35 UTC (rev 2287)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPropertiesDeclaration.java 2007-07-04 15:11:46 UTC (rev 2288)
@@ -6,9 +6,9 @@
import java.util.List;
import java.util.Map;
-import org.eclipse.core.resources.IResource;
import org.jboss.tools.seam.core.ISeamPropertiesDeclaration;
import org.jboss.tools.seam.core.ISeamProperty;
+import org.jboss.tools.seam.core.event.Change;
public class SeamPropertiesDeclaration extends SeamComponentDeclaration
implements ISeamPropertiesDeclaration {
@@ -38,9 +38,50 @@
properties.remove(property.getName());
}
- public void addStringProperty(String name, String value) {
+ public SeamProperty addStringProperty(String name, String value) {
SeamProperty p = new SeamProperty(name, value);
addProperty(p);
+ return p;
}
+ /**
+ * Merges loaded data into currently used declaration.
+ * If changes were done returns a list of changes.
+ * @param d
+ * @return list of changes
+ */
+ public List<Change> merge(SeamComponentDeclaration d) {
+ List<Change> changes = super.merge(d);
+ SeamPropertiesDeclaration pd = (SeamPropertiesDeclaration)d;
+
+ Change children = new Change(this, null, null, null);
+
+ String[] names = properties.keySet().toArray(new String[0]);
+ for (int i = 0; i < names.length; i++) {
+ SeamProperty p1 = (SeamProperty)properties.get(names[i]);
+ SeamProperty p2 = (SeamProperty)pd.properties.get(names[i]);
+ if(p2 == null) {
+ changes = Change.addChange(changes, new Change(this, null, p1, null));
+ properties.remove(names[i]);
+ } else {
+ List<Change> cc = p1.merge(p2);
+ if(cc != null && cc.size() > 0) children.addChildren(cc);
+ }
+ }
+ names = pd.properties.keySet().toArray(new String[0]);
+ for (int i = 0; i < names.length; i++) {
+ SeamProperty p1 = (SeamProperty)properties.get(names[i]);
+ SeamProperty p2 = (SeamProperty)pd.properties.get(names[i]);
+ if(p1 == null) {
+ changes = Change.addChange(changes, new Change(this, null, null, p2));
+ properties.put(names[i], p2);
+ }
+ }
+ properties = pd.properties;
+
+ changes = Change.addChange(changes, children);
+
+ return changes;
+ }
+
}
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-04 14:51:35 UTC (rev 2287)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProperty.java 2007-07-04 15:11:46 UTC (rev 2288)
@@ -10,10 +10,16 @@
******************************************************************************/
package org.jboss.tools.seam.internal.core;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
import org.eclipse.core.resources.IResource;
import org.jboss.tools.seam.core.ISeamProperty;
+import org.jboss.tools.seam.core.event.Change;
public class SeamProperty implements ISeamProperty {
+ protected Object id;
protected String name;
protected Object value;
protected int startPosition = -1;
@@ -35,6 +41,14 @@
this.value = value;
}
+ public Object getId() {
+ return id;
+ }
+
+ public void setId(Object id) {
+ this.id = id;
+ }
+
public String getName() {
return name;
}
@@ -70,4 +84,59 @@
// TODO Auto-generated method stub
return null;
}
-}
\ No newline at end of file
+
+ public List<Change> merge(SeamProperty d) {
+ List<Change> changes = null;
+
+ id = d.id;
+ startPosition = d.startPosition;
+ length = d.length;
+
+ if(!stringsEqual(name, d.name)) {
+ changes = Change.addChange(changes, new Change(this, "name", name, d.name));
+ name = d.name;
+ }
+ if(!valuesEqual(value, d.value)) {
+ changes = Change.addChange(changes, new Change(this, "value", value, d.value));
+ value = d.value;
+ }
+
+ return changes;
+ }
+
+ boolean stringsEqual(String s1, String s2) {
+ return s1 == null ? s2 == null : s1.equals(s2);
+ }
+
+ boolean valuesEqual(Object v1, Object v2) {
+ if(v1 == null) return v2 == null;
+ if(v2 == null) return v1 == null;
+ if(v1 == v2) return true;
+ if(v1 instanceof List && v2 instanceof List) {
+ List<?> l1 = (List<?>)v1;
+ List<?> l2 = (List<?>)v2;
+ if(l1.size() != l2.size()) return false;
+ for (int i = 0; i < l1.size(); i++) {
+ if(!valuesEqual(l1.get(i), l2.get(i))) return false;
+ }
+ return true;
+ } else if(v1 instanceof Map && v2 instanceof Map) {
+ Map<?,?> m1 = (Map<?,?>)v1;
+ Map<?,?> m2 = (Map<?,?>)v2;
+ if(m1.size() != m2.size()) return false;
+ Iterator<?> it = m1.keySet().iterator();
+ while(it.hasNext()) {
+ Object key = it.next();
+ Object o1 = m1.get(key);
+ Object o2 = m2.get(key);
+ if(o2 == null) return false;
+ if(!valuesEqual(o1, o2)) return false;
+ }
+ return true;
+ }
+ if(v1.equals(v2)) return true;
+
+ return false;
+ }
+
+}
Modified: 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 2007-07-04 14:51:35 UTC (rev 2287)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlComponentDeclaration.java 2007-07-04 15:11:46 UTC (rev 2288)
@@ -1,7 +1,10 @@
package org.jboss.tools.seam.internal.core;
+import java.util.List;
+
import org.jboss.tools.seam.core.ISeamXmlComponentDeclaration;
import org.jboss.tools.seam.core.ScopeType;
+import org.jboss.tools.seam.core.event.Change;
public class SeamXmlComponentDeclaration extends SeamPropertiesDeclaration
implements ISeamXmlComponentDeclaration {
@@ -74,4 +77,42 @@
this.scope = scope;
}
+ /**
+ * Merges loaded data into currently used declaration.
+ * If changes were done returns a list of changes.
+ * @param d
+ * @return list of changes
+ */
+ public List<Change> merge(SeamComponentDeclaration d) {
+ List<Change> changes = super.merge(d);
+ SeamXmlComponentDeclaration xd = (SeamXmlComponentDeclaration)d;
+
+ if(!stringsEqual(className, xd.className)) {
+ changes = Change.addChange(changes, new Change(this, CLASS, className, xd.className));
+ className = xd.className;
+ }
+ if(!stringsEqual(autoCreate, xd.autoCreate)) {
+ changes = Change.addChange(changes, new Change(this, AUTO_CREATE, autoCreate, xd.autoCreate));
+ autoCreate = xd.autoCreate;
+ }
+ if(!stringsEqual(installed, xd.installed)) {
+ changes = Change.addChange(changes, new Change(this, INSTALLED, installed, xd.installed));
+ installed = xd.installed;
+ }
+ if(!stringsEqual(jndiName, xd.jndiName)) {
+ changes = Change.addChange(changes, new Change(this, JNDI_NAME, jndiName, xd.jndiName));
+ jndiName = xd.jndiName;
+ }
+ if(!stringsEqual(precedence, xd.precedence)) {
+ changes = Change.addChange(changes, new Change(this, PRECEDENCE, precedence, xd.precedence));
+ precedence = xd.precedence;
+ }
+ if(!stringsEqual(scope, xd.scope)) {
+ changes = Change.addChange(changes, new Change(this, SCOPE, scope, xd.scope));
+ scope = xd.scope;
+ }
+
+ return changes;
+ }
+
}
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlFactory.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlFactory.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlFactory.java 2007-07-04 15:11:46 UTC (rev 2288)
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.internal.core;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IResource;
+import org.jboss.tools.seam.core.ISeamXmlFactory;
+import org.jboss.tools.seam.core.event.Change;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class SeamXmlFactory extends SeamFactory implements ISeamXmlFactory {
+ String method = null;
+ String value = null;
+
+ public String getMethod() {
+ return method;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setMethod(String method) {
+ this.method = method;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public int getLength() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public IResource getResource() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public int getStartPosition() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public List<Change> merge(SeamFactory f) {
+ List<Change> changes = super.merge(f);
+ SeamXmlFactory xf = (SeamXmlFactory)f;
+
+ if(!stringsEqual(value, xf.value)) {
+ changes = Change.addChange(changes, new Change(this, "value", value, xf.value));
+ value = xf.value;
+ }
+ if(!stringsEqual(method, xf.method)) {
+ changes = Change.addChange(changes, new Change(this, "method", method, xf.method));
+ method = xf.method;
+ }
+
+ return changes;
+ }
+}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/LoadedDeclarations.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/LoadedDeclarations.java 2007-07-04 14:51:35 UTC (rev 2287)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/LoadedDeclarations.java 2007-07-04 15:11:46 UTC (rev 2288)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.seam.internal.core.scanner;
import java.util.ArrayList;
@@ -6,6 +16,11 @@
import org.jboss.tools.seam.internal.core.SeamComponentDeclaration;
import org.jboss.tools.seam.internal.core.SeamFactory;
+/**
+ * This object keeps all declarations loaded from one source.
+ *
+ * @author Viacheslav Kabanovich
+ */
public class LoadedDeclarations {
List<SeamComponentDeclaration> components = new ArrayList<SeamComponentDeclaration>();
List<SeamFactory> factories = new ArrayList<SeamFactory>();
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ASTVisitorImpl.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ASTVisitorImpl.java 2007-07-04 14:51:35 UTC (rev 2287)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ASTVisitorImpl.java 2007-07-04 15:11:46 UTC (rev 2288)
@@ -1,3 +1,13 @@
+ /*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.seam.internal.core.scanner.java;
import java.util.HashSet;
@@ -22,6 +32,11 @@
import org.eclipse.jdt.core.dom.TypeDeclaration;
import org.eclipse.jdt.core.dom.VariableDeclaration;
+/**
+ * This object collects changes in target that should be fired to listeners.
+ *
+ * @author Viacheslav Kabanovich
+ */
public class ASTVisitorImpl extends ASTVisitor {
static String SEAM_ANNOTATION_TYPE_PREFIX = "org.jboss.seam.annotations.";
static String NAME_ANNOTATION_TYPE = SEAM_ANNOTATION_TYPE_PREFIX + "Name";
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/AnnotatedASTNode.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/AnnotatedASTNode.java 2007-07-04 14:51:35 UTC (rev 2287)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/AnnotatedASTNode.java 2007-07-04 15:11:46 UTC (rev 2288)
@@ -1,3 +1,13 @@
+ /*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.seam.internal.core.scanner.java;
import org.eclipse.jdt.core.dom.ASTNode;
@@ -2,2 +12,7 @@
+/**
+ * This object binds ASTNode to annotations.
+ *
+ * @author Viacheslav Kabanovich
+ */
public class AnnotatedASTNode {
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-04 14:51:35 UTC (rev 2287)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/JavaScanner.java 2007-07-04 15:11:46 UTC (rev 2288)
@@ -10,7 +10,6 @@
******************************************************************************/
package org.jboss.tools.seam.internal.core.scanner.java;
-
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@@ -26,11 +25,15 @@
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.SeamComponentDeclaration;
import org.jboss.tools.seam.internal.core.SeamJavaComponentDeclaration;
import org.jboss.tools.seam.internal.core.scanner.IFileScanner;
import org.jboss.tools.seam.internal.core.scanner.LoadedDeclarations;
+/**
+ * This object collects changes in target that should be fired to listeners.
+ *
+ * @author Viacheslav Kabanovich
+ */
public class JavaScanner implements IFileScanner {
public JavaScanner() {}
@@ -72,7 +75,7 @@
public LoadedDeclarations parse(IFile f) throws Exception {
ICompilationUnit u = getCompilationUnit(f);
if(u == null) return null;
- ASTRequestorImpl requestor = new ASTRequestorImpl();
+ ASTRequestorImpl requestor = new ASTRequestorImpl(f.getFullPath());
ICompilationUnit[] us = new ICompilationUnit[]{u};
ASTParser.newParser(AST.JLS3).createASTs(us, new String[0], requestor, null);
return requestor.getDeclarations();
@@ -98,6 +101,11 @@
class ASTRequestorImpl extends ASTRequestor {
private ASTVisitorImpl visitor = new ASTVisitorImpl();
LoadedDeclarations ds = new LoadedDeclarations();
+ IPath sourcePath;
+
+ public ASTRequestorImpl(IPath sourcePath) {
+ this.sourcePath = sourcePath;
+ }
public LoadedDeclarations getDeclarations() {
return ds;
@@ -119,6 +127,10 @@
String n = visitor.type.getElementName();
n = getResolvedType(visitor.type, n);
SeamJavaComponentDeclaration component = new SeamJavaComponentDeclaration();
+
+ component.setId(visitor.type);
+ component.setSourcePath(sourcePath);
+
ds.getComponents().add(component);
component.setType(visitor.type);
component.setId(visitor.type);
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ResolvedAnnotation.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ResolvedAnnotation.java 2007-07-04 14:51:35 UTC (rev 2287)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ResolvedAnnotation.java 2007-07-04 15:11:46 UTC (rev 2288)
@@ -1,3 +1,13 @@
+ /*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.seam.internal.core.scanner.java;
import org.eclipse.jdt.core.dom.Annotation;
@@ -2,2 +12,7 @@
+/**
+ * This object keeps resolved type name for annotation.
+ *
+ * @author Viacheslav Kabanovich
+ */
public class ResolvedAnnotation {
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-04 14:51:35 UTC (rev 2287)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/LibraryScanner.java 2007-07-04 15:11:46 UTC (rev 2288)
@@ -22,6 +22,9 @@
import org.jboss.tools.seam.internal.core.scanner.LoadedDeclarations;
import org.jboss.tools.seam.internal.core.scanner.xml.XMLScanner;
+/**
+ * @author Viacheslav Kabanovich
+ */
public class LibraryScanner implements IFileScanner {
public boolean isRelevant(IFile f) {
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-04 14:51:35 UTC (rev 2287)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLScanner.java 2007-07-04 15:11:46 UTC (rev 2288)
@@ -28,6 +28,7 @@
import org.jboss.tools.seam.internal.core.SeamFactory;
import org.jboss.tools.seam.internal.core.SeamProperty;
import org.jboss.tools.seam.internal.core.SeamXmlComponentDeclaration;
+import org.jboss.tools.seam.internal.core.SeamXmlFactory;
import org.jboss.tools.seam.internal.core.scanner.IFileScanner;
import org.jboss.tools.seam.internal.core.scanner.LoadedDeclarations;
@@ -77,14 +78,13 @@
static Set<String> COMMON_ATTRIBUTES = new HashSet<String>();
static {
- //TODO
-// COMMON_ATTRIBUTES.add(ISeamComponent.NAME);
-// COMMON_ATTRIBUTES.add(ISeamComponent.CLASS);
-// COMMON_ATTRIBUTES.add(ISeamComponent.SCOPE);
-// COMMON_ATTRIBUTES.add(ISeamComponent.PRECEDENCE);
-// COMMON_ATTRIBUTES.add(ISeamComponent.INSTALLED);
-// COMMON_ATTRIBUTES.add(ISeamComponent.AUTO_CREATE);
-// COMMON_ATTRIBUTES.add(ISeamComponent.JNDI_NAME);
+ COMMON_ATTRIBUTES.add(ISeamXmlComponentDeclaration.NAME);
+ COMMON_ATTRIBUTES.add(ISeamXmlComponentDeclaration.CLASS);
+ COMMON_ATTRIBUTES.add(ISeamXmlComponentDeclaration.SCOPE);
+ COMMON_ATTRIBUTES.add(ISeamXmlComponentDeclaration.PRECEDENCE);
+ COMMON_ATTRIBUTES.add(ISeamXmlComponentDeclaration.INSTALLED);
+ COMMON_ATTRIBUTES.add(ISeamXmlComponentDeclaration.AUTO_CREATE);
+ COMMON_ATTRIBUTES.add(ISeamXmlComponentDeclaration.JNDI_NAME);
}
public LoadedDeclarations parse(XModelObject o, IPath source) {
@@ -95,7 +95,10 @@
XModelEntity componentEntity = os[i].getModelEntity();
if(componentEntity.getAttribute("class") != null) {
SeamXmlComponentDeclaration component = new SeamXmlComponentDeclaration();
- //TODO
+
+ component.setSourcePath(source);
+ component.setId(os[i]);
+
component.setName(os[i].getAttributeValue(ISeamXmlComponentDeclaration.NAME));
component.setClassName(os[i].getAttributeValue(ISeamXmlComponentDeclaration.CLASS));
component.setScope(os[i].getAttributeValue(ISeamXmlComponentDeclaration.SCOPE));
@@ -148,17 +151,15 @@
ds.getComponents().add(component);
} else if(os[i].getModelEntity().getName().startsWith("SeamFactory")) {
- //TODO replace with xml factory
- SeamFactory factory = new SeamFactory();
+ SeamXmlFactory factory = new SeamXmlFactory();
factory.setId(os[i]);
factory.setSourcePath(source);
factory.setName(os[i].getAttributeValue(ISeamXmlComponentDeclaration.NAME));
factory.setScopeAsString(os[i].getAttributeValue(ISeamXmlComponentDeclaration.SCOPE));
- String value = os[i].getAttributeValue("value");
- if(factory instanceof ISeamXmlFactory) {
- ((ISeamXmlFactory)factory).setValue(value);
- }
+ factory.setValue(os[i].getAttributeValue("value"));
+ factory.setMethod(os[i].getAttributeValue("method"));
ds.getFactories().add(factory);
+ //TODO assign positioning attributes to created ISeamProperty object
}
}
return ds;
16 years, 10 months
JBoss Tools SVN: r2287 - 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-04 10:51:35 -0400 (Wed, 04 Jul 2007)
New Revision: 2287
Modified:
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 Added some comments
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-04 14:17:45 UTC (rev 2286)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProject.java 2007-07-04 14:51:35 UTC (rev 2287)
@@ -25,7 +25,7 @@
public Set<ISeamComponent> getComponentsByName(String name);
/**
- * @param type of scope.
+ * @param scope type.
* @return Set of ISeamComponents by Scope Type.
*/
public Set<ISeamComponent> getComponentsByScope(ScopeType type);
@@ -37,7 +37,7 @@
public Set<ISeamComponent> getComponentsByClass(String className);
/**
- * @return Set of ISeamComponents
+ * @return Set of all ISeamComponents of project
*/
public Set<ISeamComponent> getComponents();
@@ -54,7 +54,7 @@
public void removeComponent(ISeamComponent component);
/**
- * @return all seam variables from all contexts.
+ * @return all seam context variables of project
*/
public Set<ISeamContextVariable> getVariables();
@@ -71,33 +71,33 @@
public Set<ISeamContextVariable> getVariablesByScope(ScopeType scope);
/**
- * @return Factories methods of component
+ * @return all factories methods of project
*/
public Set<ISeamFactory> getFactories();
/**
- * @return Factories methods of component
+ * @return Factories methods of project by name and scope
*/
public Set<ISeamFactory> getFactories(String name, ScopeType scope);
/**
- * @return Factories methods of component
+ * @return Factories methods of project by name
*/
public Set<ISeamFactory> getFactoriesByName(String name);
/**
- * @return Factories methods of component
+ * @return Factories methods of project by scope
*/
public Set<ISeamFactory> getFactoriesByScope(ScopeType scope);
/**
- * Adds factory method
+ * Adds factory method into project
* @param factory
*/
public void addFactory(ISeamFactory factory);
/**
- * Remove factory method
+ * Remove factory method from project
* @param factory
*/
public void removeFactory(ISeamFactory factory);
16 years, 10 months
JBoss Tools SVN: r2285 - in trunk/common/plugins/org.jboss.tools.common.text.xml: schema and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2007-07-04 10:14:20 -0400 (Wed, 04 Jul 2007)
New Revision: 2285
Added:
trunk/common/plugins/org.jboss.tools.common.text.xml/schema/contentAssistProcessor.exsd
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/contentassist/
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/contentassist/ContentAssistProcessorBuilder.java
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/contentassist/ContentAssistProcessorDefinition.java
Modified:
trunk/common/plugins/org.jboss.tools.common.text.xml/plugin.xml
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/RedHatStructuredTextViewerConfigurationXML.java
Log:
http://jira.jboss.org/jira/browse/EXIN-330
The schema added due to allow the xml-editor configuration to load and use custom content assist processors dependig on the partition type.
Modified: trunk/common/plugins/org.jboss.tools.common.text.xml/plugin.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.xml/plugin.xml 2007-07-04 14:10:54 UTC (rev 2284)
+++ trunk/common/plugins/org.jboss.tools.common.text.xml/plugin.xml 2007-07-04 14:14:20 UTC (rev 2285)
@@ -2,6 +2,8 @@
<?eclipse version="3.0"?>
<plugin>
+ <extension-point id="contentAssistProcessor" name="Content Assist Processor Extension Point Extension" schema="schema/contentAssistProcessor.exsd"/>
+
<!--
<extension-point id="foldingStructureProviders" name="%foldingStructureProvidersExtensionPoint" schema="schema/foldingStructureProviders.exsd"/>
Copied: trunk/common/plugins/org.jboss.tools.common.text.xml/schema/contentAssistProcessor.exsd (from rev 2278, trunk/common/plugins/org.jboss.tools.common.text.ext/schema/contentAssistProcessor.exsd)
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.xml/schema/contentAssistProcessor.exsd (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.text.xml/schema/contentAssistProcessor.exsd 2007-07-04 14:14:20 UTC (rev 2285)
@@ -0,0 +1,153 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.jboss.tools.common.text.xml">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.jboss.tools.common.text.xml" id="contentAssistProcessor" name="Content Assist Processor Extension Point Extension"/>
+ </appInfo>
+ <documentation>
+ Content Assist Processor
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <documentation>
+ Defines an extension point for the Content Assist Processor definitions.
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="contentAssistProcessor" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+ A unique ID for this extension point. It is recommended that the plugin ID be used to prefix any extensions.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+ A unique ID for this extension. It is recommended that the plugin ID be used to prefix any extensions.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ A brief name to show to the user.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="contentAssistProcessor">
+ <annotation>
+ <documentation>
+ Defines a Content Assist Processor item. Contains information on a class to be used to perform content assist depending on the content and partition types.
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="partitiontype" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ A unique ID for this Content Assist Processor.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ An implementor of org.eclipse.jface.text.contentassist.IContentAssistProcessor, it controls the content assist within text editor.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="partitiontype">
+ <annotation>
+ <documentation>
+ Defined the editor's partition type to be assotiated with the Content Assist Processor. The value is either one of the WTP structured model partition type ID or any other structured text partition ID
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ A unique ID for this partitiontype. The value is either one of the WTP structured model partition type ID or any other structured text partition ID.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ V3.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ <pre>
+ <extension-point id="contentAssistProcessor" name="Content Assist Processor Extension Point Extension"/>
+
+ <extension
+ point="org.jboss.tools.common.text.ext.contentAssistProcesor"
+ id="org.jboss.tools.common.text.ext.contentAssistProcessor"
+ name="org.jboss.tools.common.text.ext.contentAssistProcessor">
+
+ <contentAssistProcessor
+ class="org.jboss.tools.common.text.xml.contentassist.MyContentAssistProcessor"
+ id="org.jboss.tools.common.text.xml.contentassist.MyContentAssistProcessorID">
+ <partitiontype id="org.jboss.tools.common.text.xml.XML_DOCTYPE" />
+ </contentAssistProcessor>
+ </extension>
+</pre>
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ The baseline for API and extension point stability is RedHat Developer Studio
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ The supplied implementation of the contentAssistProcessor functionality requires the WTP components.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ RedHat
+ </documentation>
+ </annotation>
+
+</schema>
Modified: trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/RedHatStructuredTextViewerConfigurationXML.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/RedHatStructuredTextViewerConfigurationXML.java 2007-07-04 14:10:54 UTC (rev 2284)
+++ trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/RedHatStructuredTextViewerConfigurationXML.java 2007-07-04 14:14:20 UTC (rev 2285)
@@ -23,8 +23,9 @@
import org.eclipse.jface.text.source.SourceViewerConfiguration;
import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
import org.eclipse.wst.xml.ui.StructuredTextViewerConfigurationXML;
+import org.jboss.tools.common.text.xml.contentassist.ContentAssistProcessorBuilder;
+import org.jboss.tools.common.text.xml.contentassist.ContentAssistProcessorDefinition;
-
/**
* @author Igels
*/
@@ -41,17 +42,44 @@
}
protected IContentAssistProcessor[] getContentAssistProcessors(ISourceViewer sourceViewer, String partitionType) {
- //TODO if we have our own processors we need
- // create them here and decide if we need merge
- // them with initial and super processors.
+
+ // if we have our own processors we need
+ // to define them in plugin.xml file of their
+ // plugins using extention point
+ // "org.jboss.tools.common.text.xml.contentAssistProcessor"
+
+ ContentAssistProcessorDefinition[] defs = ContentAssistProcessorBuilder.getInstance().getContentAssistProcessorDefinitions(partitionType);
+
+ if(defs==null) return null;
+
+ List processors = new ArrayList();
+ for(int i=0; i<defs.length; i++) {
+ IContentAssistProcessor processor = defs[i].createContentAssistProcessor();
+ if(!processors.contains(processor)) {
+ processors.add(processor);
+ }
+ }
+
IContentAssistProcessor[] in = getInitialProcessors(sourceViewer, partitionType);
if(in != null && in.length > 0) {
+
//we do not need super processors - make initial processors responcible for that
- return in;
+ for(int i=0; i<in.length; i++) {
+ if(!processors.contains(in[i])) {
+ processors.add(in[i]);
+ }
+ }
+ } else {
+ IContentAssistProcessor[] ps = super.getContentAssistProcessors(sourceViewer, partitionType);
+ for(int i=0; ps != null && i<ps.length; i++) {
+ if(!processors.contains(ps[i])) {
+ processors.add(ps[i]);
+ }
+ }
}
- IContentAssistProcessor[] ps = super.getContentAssistProcessors(sourceViewer, partitionType);
- return ps;
+ return (IContentAssistProcessor[])processors.toArray(new IContentAssistProcessor[0]);
}
+
/*
* @see org.eclipse.jface.text.source.SourceViewerConfiguration#getHyperlinkDetectors(org.eclipse.jface.text.source.ISourceViewer)
* @since 3.1
Copied: trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/contentassist/ContentAssistProcessorBuilder.java (from rev 2278, trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/contentassist/ContentAssistProcessorBuilder.java)
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/contentassist/ContentAssistProcessorBuilder.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/contentassist/ContentAssistProcessorBuilder.java 2007-07-04 14:14:20 UTC (rev 2285)
@@ -0,0 +1,224 @@
+/*******************************************************************************
+ * 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.common.text.xml.contentassist;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.wst.sse.ui.internal.util.Sorter;
+import org.jboss.tools.common.text.xml.XmlEditorPlugin;
+
+public class ContentAssistProcessorBuilder extends org.eclipse.wst.sse.ui.internal.extension.RegistryReader {
+ // extension point ID
+ public static final String PL_CONTENTASSISTPROCESSOR = "contentAssistProcessor"; //$NON-NLS-1$
+
+ public static final String TAG_CONTENTASSISTPROCESSOR = "contentAssistProcessor"; //$NON-NLS-1$
+ public static final String TAG_PARTITION_TYPE = "partitiontype"; //$NON-NLS-1$
+
+ public static final String ATT_ID = "id"; //$NON-NLS-1$
+ public static final String ATT_CLASS = "class"; //$NON-NLS-1$
+
+ protected String targetContributionTag;
+
+ private static ContentAssistProcessorBuilder fInstance;
+
+ private List<ContentAssistProcessorDefinition> fContentAssistProcessorDefs = null;
+ private ContentAssistProcessorDefinition fCurrentDefinition = null;
+
+ /**
+ * returns singleton instance of ContentAssistProcessorBuilder
+ *
+ * @return ContentAssistProcessorBuilder
+ */
+ public synchronized static ContentAssistProcessorBuilder getInstance() {
+ if (fInstance == null) {
+ fInstance = new ContentAssistProcessorBuilder();
+ }
+ return fInstance;
+ }
+
+ /**
+ * Returns the name of the part ID attribute that is expected
+ * in the target extension.
+ *
+ * @param element
+ * @return String
+ */
+ protected String getId(IConfigurationElement element) {
+ String value = element.getAttribute(ATT_ID);
+ return value;
+ }
+
+ protected String getContentAssistProcessorClass(IConfigurationElement element) {
+ String value = element.getAttribute(ATT_CLASS);
+ return value;
+ }
+
+ /**
+ * Processes element which should be a configuration element specifying an
+ * open on object. Creates a new ContentAssistProcessor definitio object and adds it to the
+ * list of ContentAssistProcessor definition objects
+ *
+ * @param element ContentAssistProcessor configuration element
+ */
+ private void processContentAssistProcessorTag(IConfigurationElement element) {
+ String theId = getId(element);
+ String theClass = getContentAssistProcessorClass(element);
+
+ if (theId != null && theClass != null) {
+ // start building new HyperlinkDefinition
+ fCurrentDefinition = new ContentAssistProcessorDefinition(theId, theClass, element);
+
+ // create a new list of open on definitions if it hasn't been created yet
+ if (fContentAssistProcessorDefs == null) {
+ fContentAssistProcessorDefs = new ArrayList<ContentAssistProcessorDefinition>();
+ }
+ fContentAssistProcessorDefs.add(fCurrentDefinition);
+ }
+ else {
+ fCurrentDefinition = null;
+ }
+ }
+
+ /**
+ * Processes element which should be a configuration element specifying a partition
+ * type for the current contentAssistProcessor tag. Assumes that there is a valid
+ * current contentAssistProcessor tag.
+ *
+ * @param element partitiontype configuration element
+ */
+ private void processPartitionTypeTag(IConfigurationElement element) {
+ // add to current HyperlinkDefinition/contentType
+ String theId = getId(element);
+
+ if (theId != null) {
+ fCurrentDefinition.addPartitionType(theId);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.ibm.sse.editor.internal.extension.RegistryReader#readElement(org.eclipse.core.runtime.IConfigurationElement)
+ */
+ protected boolean readElement(IConfigurationElement element) {
+ String tag = element.getName();
+
+ if (tag.equals(targetContributionTag)) {
+ processContentAssistProcessorTag(element);
+
+ if (fCurrentDefinition != null) {
+ readElementChildren(element);
+ }
+ return true;
+ }
+ else if (tag.equals(TAG_PARTITION_TYPE)) {
+ processPartitionTypeTag(element);
+ return true;
+ }
+
+ return false;
+ }
+
+ private void initCache() {
+ if (fContentAssistProcessorDefs == null) {
+ readContributions(TAG_CONTENTASSISTPROCESSOR, PL_CONTENTASSISTPROCESSOR);
+ }
+ }
+
+ /**
+ * Returns all the ContentAssistProcessor definition objects
+ * @return
+ */
+ public ContentAssistProcessorDefinition[] getContentAssistProcessorDefinitions() {
+ initCache();
+ return (fContentAssistProcessorDefs == null ? new ContentAssistProcessorDefinition[0] :
+ (ContentAssistProcessorDefinition[])fContentAssistProcessorDefs.toArray(new ContentAssistProcessorDefinition[fContentAssistProcessorDefs.size()]));
+ }
+
+ /**
+ * Returns all the ContentAssistProcessor definition objects valid for partitionType
+ *
+ * @param partitionType
+ * @return if partitionType is null, null is returned
+ */
+ public ContentAssistProcessorDefinition[] getContentAssistProcessorDefinitions(String partitionType) {
+ if (partitionType == null) {
+ return null;
+ }
+
+ ContentAssistProcessorDefinition[] allDefs = getContentAssistProcessorDefinitions();
+ List defs = new ArrayList();
+ List lastDefs = new ArrayList();
+
+ for (int i = 0; i < allDefs.length; ++i) {
+ List partitions = (List) allDefs[i].getPartitionTypes();
+ if (partitions != null) {
+ if (partitions.isEmpty()) {
+ lastDefs.add(allDefs[i]);
+ }
+ else {
+ int j = 0;
+ boolean added = false;
+ while (j < partitions.size() && !added) {
+ if (partitionType.equals(partitions.get(j))) {
+ defs.add(allDefs[i]);
+ added = true;
+ }
+ else {
+ ++j;
+ }
+ }
+ }
+ }
+ }
+ defs.addAll(lastDefs);
+
+ return (ContentAssistProcessorDefinition[]) defs.toArray(new ContentAssistProcessorDefinition[defs.size()]);
+ }
+
+ /**
+ * @param tag
+ * @param extensionPoint
+ */
+ protected void readContributions(String tag, String extensionPoint) {
+ targetContributionTag = tag;
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ readRegistry(registry, XmlEditorPlugin.PLUGIN_ID, extensionPoint);
+ }
+
+ /**
+ * Override to improve sorting
+ */
+ protected IExtension[] orderExtensions(IExtension[] extensions) {
+ Object[] sorted = createSorter().sort(extensions);
+ IExtension[] sortedExtension = new IExtension[sorted.length];
+ System.arraycopy(sorted, 0, sortedExtension, 0, sorted.length);
+ return sortedExtension;
+ }
+
+ protected Sorter createSorter() {
+ return new Sorter() {
+ public boolean compare(Object extension1, Object extension2) {
+ String s1 = ((IExtension) extension1).getUniqueIdentifier().toUpperCase();
+ String s2 = ((IExtension) extension2).getUniqueIdentifier().toUpperCase();
+ return s2.compareTo(s1) > 0;
+ }
+ };
+ }
+
+ protected void logUnknownElement(IConfigurationElement element) {
+ //do nothing
+ }
+}
Copied: trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/contentassist/ContentAssistProcessorDefinition.java (from rev 2279, trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/contentassist/ContentAssistProcessorDefinition.java)
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/contentassist/ContentAssistProcessorDefinition.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/contentassist/ContentAssistProcessorDefinition.java 2007-07-04 14:14:20 UTC (rev 2285)
@@ -0,0 +1,139 @@
+/*******************************************************************************
+ * 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.common.text.xml.contentassist;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.jboss.tools.common.text.xml.XmlEditorPlugin;
+import org.osgi.framework.Bundle;
+
+public class ContentAssistProcessorDefinition {
+ private String fId = null;
+ private String fClassName = null;
+
+ // a list of partition types (String)
+ private List fPartitionTypes = null;
+
+ private IConfigurationElement fConfigurationElement = null;
+
+ /**
+ * @param id
+ * @param class1
+ * @param configurationElement
+ */
+ public ContentAssistProcessorDefinition(String id, String class1, IConfigurationElement configurationElement) {
+ super();
+ fId = id;
+ fClassName = class1;
+ fConfigurationElement = configurationElement;
+ fPartitionTypes = new ArrayList();
+ }
+
+ public void addPartitionType(String partitionType) {
+ if (!fPartitionTypes.contains(partitionType))
+ fPartitionTypes.add(partitionType);
+ }
+
+ /**
+ * @return Returns the fClass.
+ */
+ public String getClassName() {
+ return fClassName;
+ }
+
+ /**
+ * @return Returns the fConfigurationElement.
+ */
+ public IConfigurationElement getConfigurationElement() {
+ return fConfigurationElement;
+ }
+
+ /**
+ * @return Returns the fId.
+ */
+ public String getId() {
+ return fId;
+ }
+
+ /**
+ * @return IContentAssistProcessor for this definition
+ */
+ public IContentAssistProcessor createContentAssistProcessor() {
+ IContentAssistProcessor contentAssistProcessor = null;
+
+ if (getClassName() != null) {
+ contentAssistProcessor = (IContentAssistProcessor) createExtension(ContentAssistProcessorBuilder.ATT_CLASS);
+ }
+
+ return contentAssistProcessor;
+ }
+
+ /**
+ * Creates an extension. If the extension plugin has not
+ * been loaded a busy cursor will be activated during the duration of
+ * the load.
+ * @param propertyName
+ * @return Object
+ */
+ private Object createExtension(String propertyName) {
+ // If plugin has been loaded create extension.
+ // Otherwise, show busy cursor then create extension.
+ final IConfigurationElement element = getConfigurationElement();
+ final String name = propertyName;
+
+ final Object[] result = new Object[1];
+ Bundle bundle = Platform.getBundle(element.getDeclaringExtension().getNamespaceIdentifier());
+ if (bundle.getState() == org.osgi.framework.Bundle.ACTIVE) {
+ try {
+ return element.createExecutableExtension(name);
+ }
+ catch (CoreException e) {
+ handleCreateExecutableException(result, e);
+ }
+ }
+ else {
+ BusyIndicator.showWhile(null, new Runnable() {
+ public void run() {
+ try {
+ result[0] = element.createExecutableExtension(name);
+ }
+ catch (Exception e) {
+ handleCreateExecutableException(result, e);
+ }
+ }
+ });
+ }
+ return result[0];
+ }
+
+ /**
+ * @param result
+ * @param e
+ */
+ private void handleCreateExecutableException(Object[] result, Exception x) {
+ XmlEditorPlugin.getPluginLog().logError("Error in creating extension", x);
+ result[0] = null;
+ }
+
+ /**
+ * @return Returns the fPartitionTypes.
+ */
+ public List getPartitionTypes() {
+ return fPartitionTypes;
+ }
+}
16 years, 10 months
JBoss Tools SVN: r2284 - in trunk/common/plugins/org.jboss.tools.common.text.ext: META-INF and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2007-07-04 10:10:54 -0400 (Wed, 04 Jul 2007)
New Revision: 2284
Removed:
trunk/common/plugins/org.jboss.tools.common.text.ext/schema/contentAssistProcessor.exsd
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/contentassist/ContentAssistProcessorBuilder.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/contentassist/ContentAssistProcessorDefinition.java
Modified:
trunk/common/plugins/org.jboss.tools.common.text.ext/META-INF/MANIFEST.MF
trunk/common/plugins/org.jboss.tools.common.text.ext/plugin.xml
Log:
http://jira.jboss.org/jira/browse/EXIN-330
Rolled back
The schema and content assist processor definition builder are moved to org.jboss.tools.common.text.xml plugin
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/META-INF/MANIFEST.MF 2007-07-04 13:25:39 UTC (rev 2283)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/META-INF/MANIFEST.MF 2007-07-04 14:10:54 UTC (rev 2284)
@@ -2,7 +2,6 @@
Eclipse-LazyStart: true
Bundle-Activator: org.jboss.tools.common.text.ext.ExtensionsPlugin
Export-Package: org.jboss.tools.common.text.ext,
- org.jboss.tools.common.text.ext.contentassist,
org.jboss.tools.common.text.ext.hyperlink,
org.jboss.tools.common.text.ext.hyperlink.jsp,
org.jboss.tools.common.text.ext.hyperlink.xml,
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/plugin.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/plugin.xml 2007-07-04 13:25:39 UTC (rev 2283)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/plugin.xml 2007-07-04 14:10:54 UTC (rev 2284)
@@ -4,7 +4,6 @@
<extension-point id="hyperlink" name="Hyperlink Extension Point Extension" schema="schema/hyperlink.exsd"/>
<extension-point id="hyperlinkPartitioner" name="Hyperlink Partitioner Extension Point Extension" schema="schema/hyperlinkPartitioner.exsd"/>
- <extension-point id="contentAssistProcessor" name="Content Assist Processor Extension Point Extension" schema="schema/contentAssistProcessor.exsd"/>
<extension
point="org.jboss.tools.common.text.ext.hyperlinkPartitioner"
Deleted: trunk/common/plugins/org.jboss.tools.common.text.ext/schema/contentAssistProcessor.exsd
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/schema/contentAssistProcessor.exsd 2007-07-04 13:25:39 UTC (rev 2283)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/schema/contentAssistProcessor.exsd 2007-07-04 14:10:54 UTC (rev 2284)
@@ -1,153 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.jboss.tools.common.text.ext">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.jboss.tools.common.text.ext" id="contentAssistProcessor" name="Content Assist Processor Extension Point Extension"/>
- </appInfo>
- <documentation>
- Content Assist Processor
- </documentation>
- </annotation>
-
- <element name="extension">
- <annotation>
- <documentation>
- Defines an extension point for the Content Assist Processor definitions.
- </documentation>
- </annotation>
- <complexType>
- <sequence>
- <element ref="contentAssistProcessor" minOccurs="1" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
- A unique ID for this extension point. It is recommended that the plugin ID be used to prefix any extensions.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
- A unique ID for this extension. It is recommended that the plugin ID be used to prefix any extensions.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- A brief name to show to the user.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="contentAssistProcessor">
- <annotation>
- <documentation>
- Defines a Content Assist Processor item. Contains information on a class to be used to perform content assist depending on the content and partition types.
- </documentation>
- </annotation>
- <complexType>
- <sequence>
- <element ref="partitiontype" minOccurs="1" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- A unique ID for this Content Assist Processor.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- An implementor of org.eclipse.jface.text.contentassist.IContentAssistProcessor, it controls the content assist within text editor.
- </documentation>
- <appInfo>
- <meta.attribute kind="java"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="partitiontype">
- <annotation>
- <documentation>
- Defined the editor's partition type to be assotiated with the Content Assist Processor. The value is either one of the WTP structured model partition type ID or any other structured text partition ID
- </documentation>
- </annotation>
- <complexType>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- A unique ID for this partitiontype. The value is either one of the WTP structured model partition type ID or any other structured text partition ID.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- V3.0
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- <pre>
- <extension-point id="contentAssistProcessor" name="Content Assist Processor Extension Point Extension"/>
-
- <extension
- point="org.jboss.tools.common.text.ext.contentAssistProcesor"
- id="org.jboss.tools.common.text.ext.contentAssistProcessor"
- name="org.jboss.tools.common.text.ext.contentAssistProcessor">
-
- <contentAssistProcessor
- class="org.jboss.tools.common.text.xml.contentassist.MyContentAssistProcessor"
- id="org.jboss.tools.common.text.xml.contentassist.MyContentAssistProcessorID">
- <partitiontype id="org.jboss.tools.common.text.xml.XML_DOCTYPE" />
- </contentAssistProcessor>
- </extension>
-</pre>
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- The baseline for API and extension point stability is RedHat Developer Studio
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- The supplied implementation of the contentAssistProcessor functionality requires the WTP components.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- RedHat
- </documentation>
- </annotation>
-
-</schema>
Deleted: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/contentassist/ContentAssistProcessorBuilder.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/contentassist/ContentAssistProcessorBuilder.java 2007-07-04 13:25:39 UTC (rev 2283)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/contentassist/ContentAssistProcessorBuilder.java 2007-07-04 14:10:54 UTC (rev 2284)
@@ -1,200 +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.common.text.ext.contentassist;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.Platform;
-import org.jboss.tools.common.text.ext.ExtensionsPlugin;
-import org.jboss.tools.common.text.ext.util.xpl.RegistryReader;
-
-public class ContentAssistProcessorBuilder extends RegistryReader{
- // extension point ID
- public static final String PL_CONTENTASSISTPROCESSOR = "contentAssistProcessor"; //$NON-NLS-1$
-
- public static final String TAG_CONTENTASSISTPROCESSOR = "contentAssistProcessor"; //$NON-NLS-1$
- public static final String TAG_PARTITION_TYPE = "partitiontype"; //$NON-NLS-1$
-
- public static final String ATT_ID = "id"; //$NON-NLS-1$
- public static final String ATT_CLASS = "class"; //$NON-NLS-1$
-
- protected String targetContributionTag;
-
- private static ContentAssistProcessorBuilder fInstance;
-
- private List<ContentAssistProcessorDefinition> fContentAssistProcessorDefs = null;
- private ContentAssistProcessorDefinition fCurrentDefinition = null;
-
- /**
- * returns singleton instance of ContentAssistProcessorBuilder
- *
- * @return ContentAssistProcessorBuilder
- */
- public synchronized static ContentAssistProcessorBuilder getInstance() {
- if (fInstance == null) {
- fInstance = new ContentAssistProcessorBuilder();
- }
- return fInstance;
- }
-
- /**
- * Returns the name of the part ID attribute that is expected
- * in the target extension.
- *
- * @param element
- * @return String
- */
- protected String getId(IConfigurationElement element) {
- String value = element.getAttribute(ATT_ID);
- return value;
- }
-
- protected String getContentAssistProcessorClass(IConfigurationElement element) {
- String value = element.getAttribute(ATT_CLASS);
- return value;
- }
-
- /**
- * Processes element which should be a configuration element specifying an
- * open on object. Creates a new ContentAssistProcessor definitio object and adds it to the
- * list of ContentAssistProcessor definition objects
- *
- * @param element ContentAssistProcessor configuration element
- */
- private void processContentAssistProcessorTag(IConfigurationElement element) {
- String theId = getId(element);
- String theClass = getContentAssistProcessorClass(element);
-
- if (theId != null && theClass != null) {
- // start building new HyperlinkDefinition
- fCurrentDefinition = new ContentAssistProcessorDefinition(theId, theClass, element);
-
- // create a new list of open on definitions if it hasn't been created yet
- if (fContentAssistProcessorDefs == null) {
- fContentAssistProcessorDefs = new ArrayList<ContentAssistProcessorDefinition>();
- }
- fContentAssistProcessorDefs.add(fCurrentDefinition);
- }
- else {
- fCurrentDefinition = null;
- }
- }
-
- /**
- * Processes element which should be a configuration element specifying a partition
- * type for the current contentAssistProcessor tag. Assumes that there is a valid
- * current contentAssistProcessor tag.
- *
- * @param element partitiontype configuration element
- */
- private void processPartitionTypeTag(IConfigurationElement element) {
- // add to current HyperlinkDefinition/contentType
- String theId = getId(element);
-
- if (theId != null) {
- fCurrentDefinition.addPartitionType(theId);
- }
- }
-
- /* (non-Javadoc)
- * @see com.ibm.sse.editor.internal.extension.RegistryReader#readElement(org.eclipse.core.runtime.IConfigurationElement)
- */
- protected boolean readElement(IConfigurationElement element) {
- String tag = element.getName();
-
- if (tag.equals(targetContributionTag)) {
- processContentAssistProcessorTag(element);
-
- if (fCurrentDefinition != null) {
- readElementChildren(element);
- }
- return true;
- }
- else if (tag.equals(TAG_PARTITION_TYPE)) {
- processPartitionTypeTag(element);
- return true;
- }
-
- return false;
- }
-
- private void initCache() {
- if (fContentAssistProcessorDefs == null) {
- readContributions(TAG_CONTENTASSISTPROCESSOR, PL_CONTENTASSISTPROCESSOR);
- }
- }
-
- /**
- * Returns all the ContentAssistProcessor definition objects
- * @return
- */
- public ContentAssistProcessorDefinition[] getContentAssistProcessorDefinitions() {
- initCache();
- return (fContentAssistProcessorDefs == null ? new ContentAssistProcessorDefinition[0] :
- (ContentAssistProcessorDefinition[])fContentAssistProcessorDefs.toArray(new ContentAssistProcessorDefinition[fContentAssistProcessorDefs.size()]));
- }
-
- /**
- * Returns all the ContentAssistProcessor definition objects valid for partitionType
- *
- * @param partitionType
- * @return if partitionType is null, null is returned
- */
- public ContentAssistProcessorDefinition[] getContentAssistProcessorDefinitions(String partitionType) {
- if (partitionType == null) {
- return null;
- }
-
- ContentAssistProcessorDefinition[] allDefs = getContentAssistProcessorDefinitions();
- List defs = new ArrayList();
- List lastDefs = new ArrayList();
-
- for (int i = 0; i < allDefs.length; ++i) {
- List partitions = (List) allDefs[i].getPartitionTypes();
- if (partitions != null) {
- if (partitions.isEmpty()) {
- lastDefs.add(allDefs[i]);
- }
- else {
- int j = 0;
- boolean added = false;
- while (j < partitions.size() && !added) {
- if (partitionType.equals(partitions.get(j))) {
- defs.add(allDefs[i]);
- added = true;
- }
- else {
- ++j;
- }
- }
- }
- }
- }
- defs.addAll(lastDefs);
-
- return (ContentAssistProcessorDefinition[]) defs.toArray(new ContentAssistProcessorDefinition[defs.size()]);
- }
-
- /**
- * @param tag
- * @param extensionPoint
- */
- protected void readContributions(String tag, String extensionPoint) {
- targetContributionTag = tag;
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- readRegistry(registry, ExtensionsPlugin.PLUGIN_ID, extensionPoint);
- }
-
-}
Deleted: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/contentassist/ContentAssistProcessorDefinition.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/contentassist/ContentAssistProcessorDefinition.java 2007-07-04 13:25:39 UTC (rev 2283)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/contentassist/ContentAssistProcessorDefinition.java 2007-07-04 14:10:54 UTC (rev 2284)
@@ -1,139 +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.common.text.ext.contentassist;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.jboss.tools.common.text.ext.ExtensionsPlugin;
-import org.osgi.framework.Bundle;
-
-public class ContentAssistProcessorDefinition {
- private String fId = null;
- private String fClassName = null;
-
- // a list of partition types (String)
- private List fPartitionTypes = null;
-
- private IConfigurationElement fConfigurationElement = null;
-
- /**
- * @param id
- * @param class1
- * @param configurationElement
- */
- public ContentAssistProcessorDefinition(String id, String class1, IConfigurationElement configurationElement) {
- super();
- fId = id;
- fClassName = class1;
- fConfigurationElement = configurationElement;
- fPartitionTypes = new ArrayList();
- }
-
- public void addPartitionType(String partitionType) {
- if (!fPartitionTypes.contains(partitionType))
- fPartitionTypes.add(partitionType);
- }
-
- /**
- * @return Returns the fClass.
- */
- public String getClassName() {
- return fClassName;
- }
-
- /**
- * @return Returns the fConfigurationElement.
- */
- public IConfigurationElement getConfigurationElement() {
- return fConfigurationElement;
- }
-
- /**
- * @return Returns the fId.
- */
- public String getId() {
- return fId;
- }
-
- /**
- * @return IContentAssistProcessor for this definition
- */
- public IContentAssistProcessor createContentAssistProcessor() {
- IContentAssistProcessor contentAssistProcessor = null;
-
- if (getClassName() != null) {
- contentAssistProcessor = (IContentAssistProcessor) createExtension(ContentAssistProcessorBuilder.ATT_CLASS);
- }
-
- return contentAssistProcessor;
- }
-
- /**
- * Creates an extension. If the extension plugin has not
- * been loaded a busy cursor will be activated during the duration of
- * the load.
- * @param propertyName
- * @return Object
- */
- private Object createExtension(String propertyName) {
- // If plugin has been loaded create extension.
- // Otherwise, show busy cursor then create extension.
- final IConfigurationElement element = getConfigurationElement();
- final String name = propertyName;
-
- final Object[] result = new Object[1];
- Bundle bundle = Platform.getBundle(element.getDeclaringExtension().getNamespaceIdentifier());
- if (bundle.getState() == org.osgi.framework.Bundle.ACTIVE) {
- try {
- return element.createExecutableExtension(name);
- }
- catch (CoreException e) {
- handleCreateExecutableException(result, e);
- }
- }
- else {
- BusyIndicator.showWhile(null, new Runnable() {
- public void run() {
- try {
- result[0] = element.createExecutableExtension(name);
- }
- catch (Exception e) {
- handleCreateExecutableException(result, e);
- }
- }
- });
- }
- return result[0];
- }
-
- /**
- * @param result
- * @param e
- */
- private void handleCreateExecutableException(Object[] result, Exception x) {
- ExtensionsPlugin.getPluginLog().logError("Error in creating extension", x);
- result[0] = null;
- }
-
- /**
- * @return Returns the fPartitionTypes.
- */
- public List getPartitionTypes() {
- return fPartitionTypes;
- }
-}
16 years, 10 months
JBoss Tools SVN: r2283 - trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/reporting.
by jbosstools-commits@lists.jboss.org
Author: ayukhovich
Date: 2007-07-04 09:25:39 -0400 (Wed, 04 Jul 2007)
New Revision: 2283
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/reporting/ReportProblemWizard.java
Log:
fixing issue 240
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/reporting/ReportProblemWizard.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/reporting/ReportProblemWizard.java 2007-07-04 13:08:36 UTC (rev 2282)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/reporting/ReportProblemWizard.java 2007-07-04 13:25:39 UTC (rev 2283)
@@ -12,9 +12,9 @@
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
-import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
@@ -34,15 +34,26 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.DialogPage;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.FontMetrics;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Layout;
@@ -68,7 +79,6 @@
import org.jboss.tools.common.model.ui.wizards.query.AbstractQueryWizard;
import org.jboss.tools.common.model.ui.wizards.query.AbstractQueryWizardView;
import org.jboss.tools.common.reporting.ProblemReportingHelper;
-import org.jboss.tools.common.reporting.Submit;
import org.osgi.framework.Bundle;
public class ReportProblemWizard extends AbstractQueryWizard {
@@ -80,9 +90,49 @@
}
class ReportProblemWizardView extends AbstractQueryWizardView {
+
+ static final char SEPARATOR = System.getProperty ("file.separator").charAt (0);
- SimpleDateFormat dtf = new SimpleDateFormat("dd_MMM_yyyy__HH_mm_ss_SSS");
+
+ /** folder log file name */
+ private String folderLogFileName;
+
+ /** LOG_DATE_FORMAT */
+ final static private SimpleDateFormat LOG_DATE_FORMAT = new SimpleDateFormat(
+ "dd_MMM_yyyy__HH_mm_ss_SSS");
+ /** log file name */
+ private Text logFileName;
+
+ /** Browse button */
+ private Button browseButton;
+
+ class PixelConverter {
+
+ private FontMetrics fFontMetrics;
+
+ public PixelConverter(Control control) {
+ GC gc = new GC(control);
+ gc.setFont(control.getFont());
+ fFontMetrics = gc.getFontMetrics();
+ gc.dispose();
+ }
+
+ /**
+ * @see DialogPage#convertHorizontalDLUsToPixels
+ */
+ public int convertHorizontalDLUsToPixels(int dlus) {
+ return Dialog.convertHorizontalDLUsToPixels(fFontMetrics, dlus);
+ }
+
+ /**
+ * @see DialogPage#convertWidthInCharsToPixels
+ */
+ public int convertWidthInCharsToPixels(int chars) {
+ return Dialog.convertWidthInCharsToPixels(fFontMetrics, chars);
+ }
+ }
+
int stackTracesCount;
Text problemDescription;
XAttributeSupport sendSupport;
@@ -107,22 +157,33 @@
{ ReportPreference.ATT_OTHER, "no" } });
public ReportProblemWizardView() {
+ folderLogFileName = Platform.getLocation().toOSString() + SEPARATOR;
}
public Control createControl(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
Layout layout = new GridLayout();
composite.setLayout(layout);
+ createFilenameLogControl(composite);
createStackTracesControl(composite);
createProblemControl(composite);
createContactInfoControl(composite);
- updateBar();
+
+ fillData();
+
return composite;
}
/**
*
*/
+ private void fillData() {
+ logFileName.setText(getZipFilename());
+ }
+
+ /**
+ *
+ */
private byte[] getStackTracesFile() {
StringBuffer sb = new StringBuffer();
@@ -141,7 +202,7 @@
}
return sb.toString().getBytes();
- }
+ };
/**
*
@@ -246,17 +307,19 @@
}
/**
- * create a ZIP file containg folloving files:
+ * create a ZIP file contain following files:
*/
- private String createZipFile() throws IOException {
+ private void createZipFile() throws IOException {
byte tempBuffer[];
String[] fileNames = new String[] { "stacktrace.txt",
"usercomment.txt", "eclipse.properties" };
-
- ByteArrayOutputStream byteBuffer = new ByteArrayOutputStream();
-
- ZipOutputStream zout = new ZipOutputStream(byteBuffer);
+ //
+ // ByteArrayOutputStream byteBuffer = new ByteArrayOutputStream();
+ //
+
+ String filename = folderLogFileName + logFileName.getText();
+ ZipOutputStream zout = new ZipOutputStream(new FileOutputStream(filename));
for (int i = 0; i < fileNames.length; i++) {
switch (i) {
@@ -274,40 +337,32 @@
}
- ZipEntry e = new ZipEntry(fileNames[i].replace(File.separatorChar,
- '/'));
+ ZipEntry e = new ZipEntry(fileNames[i].replace(File.separatorChar, SEPARATOR));
zout.putNextEntry(e);
zout.write(tempBuffer, 0, tempBuffer.length);
zout.closeEntry();
}
zout.close();
-
- return byteBuffer.toString();
+ //
+ // return byteBuffer.toString();
+ //
}
- private String getLogFolderLocation() {
- Bundle b = Platform.getBundle("org.jboss.tools.common");
- String stateLocation = Platform.getStateLocation(b).toString().replace(
- '\\', '/');
- return stateLocation;
- }
+ /**
+ * Get a filename for zip-file
+ *
+ * @return filename for zip-file
+ */
private String getZipFilename() {
- Date today;
String currentDate;
+ Date today = new Date();
- today = new Date();
- currentDate = dtf.format(today);
-
- String sss = Platform.getLogFileLocation().toOSString();
-
- return getLogFolderLocation() + "rhds-log-" + currentDate.toString()
- + ".zip";
+ currentDate = LOG_DATE_FORMAT.format(today);
+ return "jbosstools-diagnostics-" + currentDate.toString() + ".zip";
}
private void createStackTracesControl(Composite parent) {
- String zipFileName = getZipFilename();
-
stackTracesCount = ProblemReportingHelper.buffer.getSize();
exceptionsObject.setAttributeValue("exceptions",
formatContent(ProblemReportingHelper.buffer.getContent()));
@@ -339,6 +394,155 @@
}
}
+ /**
+ * Creates a new label widget
+ *
+ * @param parent
+ * the parent composite to add this label widget to
+ * @param text
+ * the text for the label
+ * @param hspan
+ * the horizontal span to take up in the parent composite
+ * @return the new label
+ */
+ public static Label createLabel(Composite parent, String text, int hspan) {
+ Label l = new Label(parent, SWT.NONE);
+ l.setFont(parent.getFont());
+ l.setText(text);
+ GridData gd = new GridData();
+ gd.horizontalSpan = hspan;
+ l.setLayoutData(gd);
+ return l;
+ }
+
+ /**
+ * Creates a new text widget
+ *
+ * @param parent
+ * the parent composite to add this text widget to
+ * @param hspan
+ * the horizontal span to take up on the parent composite
+ * @return the new text widget
+ */
+ public static Text createSingleText(Composite parent, int hspan) {
+ Text t = new Text(parent, SWT.SINGLE | SWT.BORDER);
+ t.setFont(parent.getFont());
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = hspan;
+ t.setLayoutData(gd);
+ return t;
+ }
+
+ /**
+ * Returns a width hint for a button control.
+ */
+ public int getButtonWidthHint(Button button) {
+ button.setFont(JFaceResources.getDialogFont());
+ PixelConverter converter = new PixelConverter(button);
+ int widthHint = converter
+ .convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
+ return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT,
+ true).x);
+ }
+
+ /**
+ * Sets width and height hint for the button control. <b>Note:</b> This is
+ * a NOP if the button's layout data is not an instance of
+ * <code>GridData</code>.
+ *
+ * @param the
+ * button for which to set the dimension hint
+ */
+ public void setButtonDimensionHint(Button button) {
+ Object gd = button.getLayoutData();
+ if (gd instanceof GridData) {
+ ((GridData) gd).widthHint = getButtonWidthHint(button);
+ ((GridData) gd).horizontalAlignment = GridData.FILL;
+ }
+ }
+
+ /**
+ * Creates and returns a new push button with the given label and/or image.
+ *
+ * @param parent
+ * parent control
+ * @param label
+ * button label or <code>null</code>
+ * @param image
+ * image or <code>null</code>
+ *
+ * @return a new push button
+ */
+ public Button createPushButton(Composite parent, String label, Image image) {
+ Button button = new Button(parent, SWT.PUSH);
+ button.setFont(parent.getFont());
+ if (image != null) {
+ button.setImage(image);
+ }
+ if (label != null) {
+ button.setText(label);
+ }
+ GridData gd = new GridData();
+ button.setLayoutData(gd);
+ setButtonDimensionHint(button);
+ return button;
+ }
+
+ /**
+ *
+ * @param parent
+ * a parent Composite object
+ */
+ private void createFilenameLogControl(final Composite parent) {
+ Group g = new Group(parent, SWT.SHADOW_ETCHED_IN);
+ g.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
+
+ GridLayout layout = new GridLayout(3, false);
+ g.setLayout(layout);
+
+ createLabel(g, "Log file name", 1);
+ logFileName = createSingleText(g, 1);
+ browseButton = createPushButton(g, "&Browse...", null);
+
+ browseButton.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ FileDialog fileDialog = new FileDialog(parent.getShell(),
+ SWT.SAVE);
+ fileDialog.setText("Save");
+
+
+ String fileName = logFileName.getText();
+
+ if ( folderLogFileName.length() != 0 ) {
+ fileDialog.setFilterPath(folderLogFileName);
+ } else {
+ String strFilterPath = logFileName.getText();
+ int index = strFilterPath.lastIndexOf(SEPARATOR);
+ if (index != -1) {
+ strFilterPath = strFilterPath.substring(0, index + 1);
+ }
+ fileDialog.setFilterPath(strFilterPath);
+ }
+
+ fileDialog.setFileName(fileName);
+ String[] filterExt = { "*.zip" };
+ fileDialog.setFilterExtensions(filterExt);
+ String selected = fileDialog.open();
+
+ if (selected != null) {
+ System.out.println(selected);
+ logFileName.setText(selected);
+ folderLogFileName = "";
+ }
+ };
+
+ });
+ }
+
private void createProblemControl(Composite parent) {
Group g = new Group(parent, SWT.SHADOW_ETCHED_IN);
g.setText("Problem Description");
@@ -407,11 +611,11 @@
}
public String[] getCommands() {
- return new String[] { "Submit", CANCEL };
+ return new String[] { "Ok", CANCEL };
}
public void action(String command) {
- if (command.equals("Submit")) {
+ if (command.equals("Ok")) {
submitProblems();
super.action(OK);
} else {
@@ -439,13 +643,15 @@
.getEclipseLogContent();
text += "\n----------Eclipse Log----------\n" + eclipseLog + "\n";
}
+ /*
String email = ReportPreference.E_MAIL_OPTION.getValue();
String other = ReportPreference.OTHER_OPTION.getValue();
-
+ */
try {
- String reportText = createZipFile();
- Submit.getInstance().submit(reportText, addRedHatLog);
-// ProblemReportingHelper.buffer.report(text, email, other, addRedHatLog);
+ createZipFile();
+ // Submit.getInstance().submit(reportText, addRedHatLog);
+ // ProblemReportingHelper.buffer.report(text, email, other,
+ // addRedHatLog);
} catch (IOException e) {
ModelUIPlugin.getPluginLog().logError(e);
}
@@ -482,7 +688,7 @@
}
public void updateBar() {
- getCommandBar().setEnabled("Submit", !isMessageEmpty());
+ getCommandBar().setEnabled("Ok", !isMessageEmpty());
}
boolean isMessageEmpty() {
@@ -501,4 +707,5 @@
return true;
return false;
}
+
}
16 years, 10 months