JBoss Tools SVN: r19301 - in trunk/jsf: tests/org.jboss.tools.jsf.vpe.seam.test/resources/SeamTest/WebContent/pages/components and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: yzhishko
Date: 2009-12-16 09:24:53 -0500 (Wed, 16 Dec 2009)
New Revision: 19301
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.seam/src/org/jboss/tools/jsf/vpe/seam/template/SeamFormattedTextTemplate.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.seam.test/resources/SeamTest/WebContent/pages/components/formattedText.xhtml.xml
Log:
https://jira.jboss.org/jira/browse/JBIDE-4117 fixed
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.seam/src/org/jboss/tools/jsf/vpe/seam/template/SeamFormattedTextTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.seam/src/org/jboss/tools/jsf/vpe/seam/template/SeamFormattedTextTemplate.java 2009-12-16 13:54:03 UTC (rev 19300)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.seam/src/org/jboss/tools/jsf/vpe/seam/template/SeamFormattedTextTemplate.java 2009-12-16 14:24:53 UTC (rev 19301)
@@ -19,6 +19,7 @@
import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
import org.jboss.tools.vpe.editor.util.HTML;
+import org.jboss.tools.vpe.editor.util.VisualDomUtil;
import org.mozilla.interfaces.nsIComponentManager;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMNode;
@@ -106,7 +107,7 @@
if (null != patronItem) {
list = patronItem.getChildNodes();
// mainItem = visualDocument.createElement("DIV");
- patronItem = visualDocument.createElement(HTML.TAG_SPAN);
+ patronItem = VisualDomUtil.createBorderlessContainer(visualDocument);
createCopyChildren(visualDocument, patronItem, list);
}
VpeCreationData creationData = new VpeCreationData(patronItem);
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.seam.test/resources/SeamTest/WebContent/pages/components/formattedText.xhtml.xml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.seam.test/resources/SeamTest/WebContent/pages/components/formattedText.xhtml.xml 2009-12-16 13:54:03 UTC (rev 19300)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.seam.test/resources/SeamTest/WebContent/pages/components/formattedText.xhtml.xml 2009-12-16 14:24:53 UTC (rev 19301)
@@ -1,6 +1,6 @@
<tests>
<test id="id1">
- <SPAN>
+ <SPAN CLASS="vpe-text">
<OL>
<LI>
{blog.text}
@@ -11,7 +11,7 @@
</SPAN>
</test>
<test id="id2">
- <SPAN>
+ <SPAN CLASS="vpe-text">
<SPAN CLASS="vpe-text">
It's easy to make *emphasis*, |monospace|,~deleted text~, super^scripts^ or _underlines_.
</SPAN>
@@ -19,7 +19,7 @@
</test>
<test id="id3">
- <SPAN>
+ <SPAN CLASS="vpe-text">
<P>
It's easy to make
<B>
15 years, 1 month
JBoss Tools SVN: r19300 - in trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors: parts and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2009-12-16 08:54:03 -0500 (Wed, 16 Dec 2009)
New Revision: 19300
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/BaseElement.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/Connection.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmShape.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/Shape.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/DiagramEditPart.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5341 - fixed
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/BaseElement.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/BaseElement.java 2009-12-16 12:47:44 UTC (rev 19299)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/BaseElement.java 2009-12-16 13:54:03 UTC (rev 19300)
@@ -388,4 +388,11 @@
it.next().saveInProperties(properties);
}
}
+
+ protected Object toEmptyStr(Object obj) {
+ if (obj == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return obj;
+ }
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/Connection.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/Connection.java 2009-12-16 12:47:44 UTC (rev 19299)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/Connection.java 2009-12-16 13:54:03 UTC (rev 19300)
@@ -10,7 +10,12 @@
******************************************************************************/
package org.jboss.tools.hibernate.ui.diagram.editors.model;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.TextPropertyDescriptor;
import org.hibernate.mapping.Column;
+import org.hibernate.mapping.ManyToOne;
+import org.hibernate.mapping.OneToMany;
+import org.hibernate.mapping.OneToOne;
import org.hibernate.mapping.Property;
import org.hibernate.mapping.RootClass;
import org.hibernate.mapping.Table;
@@ -23,6 +28,66 @@
*/
public class Connection extends BaseElement {
+ private static IPropertyDescriptor[] descriptors_connection_class_mapping;
+ private static IPropertyDescriptor[] descriptors_connection_property_mapping;
+ private static IPropertyDescriptor[] descriptors_connection_association;
+ private static IPropertyDescriptor[] descriptors_connection_foreign_key_constraint;
+
+ private static final String PROPERTY_SOURCE = "source"; //$NON-NLS-1$
+ private static final String PROPERTY_TARGET = "targer"; //$NON-NLS-1$
+ private static final String PROPERTY_TYPE = "type"; //$NON-NLS-1$
+ private static final String PROPERTY_CLASS_NAME = "className"; //$NON-NLS-1$
+ private static final String PROPERTY_TABLE_NAME = "tableName"; //$NON-NLS-1$
+ private static final String PROPERTY_CLASS_FIELD = "classField"; //$NON-NLS-1$
+ private static final String PROPERTY_TABLE_FIELD = "tableField"; //$NON-NLS-1$
+ private static final String PROPERTY_CLASS_FIELD_TYPE = "classFieldType"; //$NON-NLS-1$
+ private static final String PROPERTY_TABLE_FIELD_TYPE = "tableFieldType"; //$NON-NLS-1$
+ private static final String PROPERTY_ASSOCIATION_TYPE = "associationType"; //$NON-NLS-1$
+ private static final String PROPERTY_SOURCE_CLASS_FIELD = "sourceClassField"; //$NON-NLS-1$
+ private static final String PROPERTY_SOURCE_CLASS_FIELD_TYPE = "sourceClassFieldType"; //$NON-NLS-1$
+ private static final String PROPERTY_SOURCE_TABLE_FIELD = "sourceTableField"; //$NON-NLS-1$
+ private static final String PROPERTY_TARGET_TABLE_FIELD = "targetTableField"; //$NON-NLS-1$
+ private static final String PROPERTY_SOURCE_TABLE_FIELD_TYPE = "sourceTableFieldType"; //$NON-NLS-1$
+ private static final String PROPERTY_TARGET_TABLE_FIELD_TYPE = "targetTableFieldType"; //$NON-NLS-1$
+
+ static {
+ descriptors_connection_class_mapping = new IPropertyDescriptor[] {
+ new TextPropertyDescriptor(PROPERTY_SOURCE, PROPERTY_SOURCE),
+ new TextPropertyDescriptor(PROPERTY_TARGET, PROPERTY_TARGET),
+ new TextPropertyDescriptor(PROPERTY_TYPE, PROPERTY_TYPE),
+ new TextPropertyDescriptor(PROPERTY_CLASS_NAME, PROPERTY_CLASS_NAME),
+ new TextPropertyDescriptor(PROPERTY_TABLE_NAME, PROPERTY_TABLE_NAME),
+ };
+ descriptors_connection_property_mapping = new IPropertyDescriptor[] {
+ new TextPropertyDescriptor(PROPERTY_SOURCE, PROPERTY_SOURCE),
+ new TextPropertyDescriptor(PROPERTY_TARGET, PROPERTY_TARGET),
+ new TextPropertyDescriptor(PROPERTY_TYPE, PROPERTY_TYPE),
+ new TextPropertyDescriptor(PROPERTY_CLASS_NAME, PROPERTY_CLASS_NAME),
+ new TextPropertyDescriptor(PROPERTY_TABLE_NAME, PROPERTY_TABLE_NAME),
+ new TextPropertyDescriptor(PROPERTY_CLASS_FIELD, PROPERTY_CLASS_FIELD),
+ new TextPropertyDescriptor(PROPERTY_TABLE_FIELD, PROPERTY_TABLE_FIELD),
+ new TextPropertyDescriptor(PROPERTY_CLASS_FIELD_TYPE, PROPERTY_CLASS_FIELD_TYPE),
+ new TextPropertyDescriptor(PROPERTY_TABLE_FIELD_TYPE, PROPERTY_TABLE_FIELD_TYPE),
+ };
+ descriptors_connection_association = new IPropertyDescriptor[] {
+ new TextPropertyDescriptor(PROPERTY_SOURCE, PROPERTY_SOURCE),
+ new TextPropertyDescriptor(PROPERTY_TARGET, PROPERTY_TARGET),
+ new TextPropertyDescriptor(PROPERTY_TYPE, PROPERTY_TYPE),
+ new TextPropertyDescriptor(PROPERTY_ASSOCIATION_TYPE, PROPERTY_ASSOCIATION_TYPE),
+ new TextPropertyDescriptor(PROPERTY_SOURCE_CLASS_FIELD, PROPERTY_SOURCE_CLASS_FIELD),
+ new TextPropertyDescriptor(PROPERTY_SOURCE_CLASS_FIELD_TYPE, PROPERTY_SOURCE_CLASS_FIELD_TYPE),
+ };
+ descriptors_connection_foreign_key_constraint = new IPropertyDescriptor[] {
+ new TextPropertyDescriptor(PROPERTY_SOURCE, PROPERTY_SOURCE),
+ new TextPropertyDescriptor(PROPERTY_TARGET, PROPERTY_TARGET),
+ new TextPropertyDescriptor(PROPERTY_TYPE, PROPERTY_TYPE),
+ new TextPropertyDescriptor(PROPERTY_SOURCE_TABLE_FIELD, PROPERTY_SOURCE_TABLE_FIELD),
+ new TextPropertyDescriptor(PROPERTY_TARGET_TABLE_FIELD, PROPERTY_TARGET_TABLE_FIELD),
+ new TextPropertyDescriptor(PROPERTY_SOURCE_TABLE_FIELD_TYPE, PROPERTY_SOURCE_TABLE_FIELD_TYPE),
+ new TextPropertyDescriptor(PROPERTY_TARGET_TABLE_FIELD_TYPE, PROPERTY_TARGET_TABLE_FIELD_TYPE),
+ };
+ }
+
protected Shape source;
protected Shape target;
@@ -145,4 +210,133 @@
public String getKey() {
return null;
}
+
+ @Override
+ public IPropertyDescriptor[] getPropertyDescriptors() {
+ ConnectionType connectType = getConnectionType();
+ if (connectType == ConnectionType.ClassMapping) {
+ return descriptors_connection_class_mapping;
+ } else if (connectType == ConnectionType.PropertyMapping) {
+ return descriptors_connection_property_mapping;
+ } else if (connectType == ConnectionType.Association) {
+ return descriptors_connection_association;
+ } else if (connectType == ConnectionType.ForeignKeyConstraint) {
+ return descriptors_connection_foreign_key_constraint;
+ }
+ return super.getPropertyDescriptors();
+ }
+
+ @Override
+ public Object getPropertyValue(Object propertyId) {
+ Object res = null;
+ ConnectionType connectType = getConnectionType();
+ if (PROPERTY_SOURCE.equals(propertyId)) {
+ res = source;
+ } else if (PROPERTY_TARGET.equals(propertyId)) {
+ res = target;
+ } else if (PROPERTY_TYPE.equals(propertyId)) {
+ if (connectType == ConnectionType.ClassMapping) {
+ res = "ClassMapping"; //$NON-NLS-1$
+ } else if (connectType == ConnectionType.PropertyMapping) {
+ res = "PropertyMapping"; //$NON-NLS-1$
+ } else if (connectType == ConnectionType.Association) {
+ res = "Association"; //$NON-NLS-1$
+ } else if (connectType == ConnectionType.ForeignKeyConstraint) {
+ res = "ForeignKeyConstraint"; //$NON-NLS-1$
+ }
+ } else if (PROPERTY_CLASS_NAME.equals(propertyId)) {
+ if (connectType == ConnectionType.ClassMapping) {
+ if (source.getOrmElement() instanceof RootClass) {
+ res = ((RootClass)(source.getOrmElement())).getClassName();
+ } else if (target.getOrmElement() instanceof RootClass) {
+ res = ((RootClass)(target.getOrmElement())).getClassName();
+ }
+ } else if (connectType == ConnectionType.PropertyMapping) {
+ if (((Shape)source.getParent()).getOrmElement() instanceof RootClass) {
+ res = ((RootClass)(((Shape)source.getParent()).getOrmElement())).getClassName();
+ } else if (((Shape)target.getParent()).getOrmElement() instanceof RootClass) {
+ res = ((RootClass)(((Shape)target.getParent()).getOrmElement())).getClassName();
+ }
+ }
+ } else if (PROPERTY_TABLE_NAME.equals(propertyId)) {
+ if (connectType == ConnectionType.ClassMapping) {
+ if (source.getOrmElement() instanceof Table) {
+ res = ((Table)(source.getOrmElement())).getName();
+ } else if (target.getOrmElement() instanceof Table) {
+ res = ((Table)(target.getOrmElement())).getName();
+ }
+ } else if (connectType == ConnectionType.PropertyMapping) {
+ if (((Shape)source.getParent()).getOrmElement() instanceof Table) {
+ res = ((Table)(((Shape)source.getParent()).getOrmElement())).getName();
+ } else if (((Shape)target.getParent()).getOrmElement() instanceof Table) {
+ res = ((Table)(((Shape)target.getParent()).getOrmElement())).getName();
+ }
+ }
+ } else if (PROPERTY_CLASS_FIELD.equals(propertyId)) {
+ if (source.getOrmElement() instanceof Property) {
+ res = ((Property)(source.getOrmElement())).getName();
+ } else if (target.getOrmElement() instanceof Property) {
+ res = ((Property)(target.getOrmElement())).getName();
+ }
+ } else if (PROPERTY_TABLE_FIELD.equals(propertyId)) {
+ if (source.getOrmElement() instanceof Column) {
+ res = ((Column)(source.getOrmElement())).getName();
+ } else if (target.getOrmElement() instanceof Column) {
+ res = ((Column)(target.getOrmElement())).getName();
+ }
+ } else if (PROPERTY_CLASS_FIELD_TYPE.equals(propertyId)) {
+ if (source.getOrmElement() instanceof Property) {
+ res = ((Property)(source.getOrmElement())).getType();
+ } else if (target.getOrmElement() instanceof Property) {
+ res = ((Property)(target.getOrmElement())).getType();
+ }
+ } else if (PROPERTY_TABLE_FIELD_TYPE.equals(propertyId)) {
+ if (source.getOrmElement() instanceof Column) {
+ res = ((Column)(source.getOrmElement())).getSqlType();
+ } else if (target.getOrmElement() instanceof Column) {
+ res = ((Column)(target.getOrmElement())).getSqlType();
+ }
+ } else if (PROPERTY_ASSOCIATION_TYPE.equals(propertyId)) {
+ if (source.getOrmElement() instanceof Property) {
+ res = ((Property)(source.getOrmElement())).getValue();
+ } else if (target.getOrmElement() instanceof Property) {
+ res = ((Property)(target.getOrmElement())).getValue();
+ }
+ if (res instanceof OneToOne) {
+ res = "OneToOne"; //$NON-NLS-1$
+ } else if (res instanceof OneToMany) {
+ res = "OneToMany"; //$NON-NLS-1$
+ } else if (res instanceof ManyToOne) {
+ res = "ManyToOne"; //$NON-NLS-1$
+ }
+ } else if (PROPERTY_SOURCE_CLASS_FIELD.equals(propertyId)) {
+ if (source.getOrmElement() instanceof Property) {
+ res = ((Property)(source.getOrmElement())).getName();
+ }
+ } else if (PROPERTY_SOURCE_CLASS_FIELD_TYPE.equals(propertyId)) {
+ if (source.getOrmElement() instanceof Property) {
+ res = ((Property)(source.getOrmElement())).getType();
+ }
+ } else if (PROPERTY_SOURCE_TABLE_FIELD.equals(propertyId)) {
+ if (source.getOrmElement() instanceof Column) {
+ res = ((Column)(source.getOrmElement())).getName();
+ }
+ } else if (PROPERTY_TARGET_TABLE_FIELD.equals(propertyId)) {
+ if (target.getOrmElement() instanceof Column) {
+ res = ((Column)(target.getOrmElement())).getName();
+ }
+ } else if (PROPERTY_SOURCE_TABLE_FIELD_TYPE.equals(propertyId)) {
+ if (source.getOrmElement() instanceof Column) {
+ res = ((Column)(source.getOrmElement())).getSqlType();
+ }
+ } else if (PROPERTY_TARGET_TABLE_FIELD_TYPE.equals(propertyId)) {
+ if (target.getOrmElement() instanceof Column) {
+ res = ((Column)(target.getOrmElement())).getSqlType();
+ }
+ }
+ if (res == null) {
+ res = super.getPropertyValue(propertyId);
+ }
+ return toEmptyStr(res);
+ }
}
\ No newline at end of file
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java 2009-12-16 12:47:44 UTC (rev 19299)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java 2009-12-16 13:54:03 UTC (rev 19300)
@@ -44,6 +44,8 @@
import org.eclipse.ui.IMemento;
import org.eclipse.ui.WorkbenchException;
import org.eclipse.ui.XMLMemento;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.TextPropertyDescriptor;
import org.hibernate.HibernateException;
import org.hibernate.cfg.Configuration;
import org.hibernate.console.ConsoleConfiguration;
@@ -52,6 +54,7 @@
import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.eclipse.console.utils.ProjectUtils;
import org.hibernate.mapping.RootClass;
+import org.hibernate.mapping.Table;
import org.jboss.tools.hibernate.ui.diagram.DiagramViewerMessages;
import org.jboss.tools.hibernate.ui.diagram.UiPlugin;
import org.jboss.tools.hibernate.ui.diagram.editors.model.Connection.ConnectionType;
@@ -94,6 +97,8 @@
protected boolean snapToGeometry = false;
protected boolean gridEnabled = false;
protected double zoom = 1.0;
+ protected int width = 0;
+ protected int height = 0;
protected float fontHeight = 8.5f;
protected boolean deepIntoSort = false;
protected boolean flagManhattanConnectionRouter = true;
@@ -102,7 +107,31 @@
// this is workaround to load diagram state in the case if Console Config loaded later
// so we can correctly refresh diagram state
private IMemento memento = null;
+
+ private static final String PROPERTY_NAME = "name"; //$NON-NLS-1$
+ private static final String PROPERTY_WIDTH = "width"; //$NON-NLS-1$
+ private static final String PROPERTY_HEIGHT = "height"; //$NON-NLS-1$
+ private static final String PROPERTY_ZOOM = "zoom"; //$NON-NLS-1$
+ private static final String PROPERTY_ITEMS = "items"; //$NON-NLS-1$
+ private static final String PROPERTY_ENTITIES = "entities"; //$NON-NLS-1$
+ private static final String PROPERTY_TABLES = "tables"; //$NON-NLS-1$
+ private static final String PROPERTY_INVISIBLE = "invisible"; //$NON-NLS-1$
+
+ private static IPropertyDescriptor[] descriptors_diagram;
+ static {
+ descriptors_diagram = new IPropertyDescriptor[] {
+ new TextPropertyDescriptor(PROPERTY_NAME, PROPERTY_NAME),
+ new TextPropertyDescriptor(PROPERTY_WIDTH, PROPERTY_WIDTH),
+ new TextPropertyDescriptor(PROPERTY_HEIGHT, PROPERTY_HEIGHT),
+ new TextPropertyDescriptor(PROPERTY_ZOOM, PROPERTY_ZOOM),
+ new TextPropertyDescriptor(PROPERTY_ITEMS, PROPERTY_ITEMS),
+ new TextPropertyDescriptor(PROPERTY_ENTITIES, PROPERTY_ENTITIES),
+ new TextPropertyDescriptor(PROPERTY_TABLES, PROPERTY_TABLES),
+ new TextPropertyDescriptor(PROPERTY_INVISIBLE, PROPERTY_INVISIBLE),
+ };
+ }
+
public class RootClassComparator implements Comparator<RootClass> {
public int compare(RootClass o1, RootClass o2) {
return getItemName(o1).compareTo(getItemName(o2));
@@ -976,4 +1005,66 @@
public void setupFanConnectionRouter() {
flagManhattanConnectionRouter = false;
}
+
+ public void updateWidthAndHeight(int width, int height) {
+ this.width = width;
+ this.height = height;
+ }
+
+ @Override
+ public IPropertyDescriptor[] getPropertyDescriptors() {
+ return descriptors_diagram;
+ }
+
+ @Override
+ public Object getPropertyValue(Object propertyId) {
+ Object res = null;
+ if (PROPERTY_NAME.equals(propertyId)) {
+ res = getDiagramName();
+ } else if (PROPERTY_WIDTH.equals(propertyId)) {
+ res = width;
+ } else if (PROPERTY_HEIGHT.equals(propertyId)) {
+ res = height;
+ } else if (PROPERTY_ZOOM.equals(propertyId)) {
+ res = zoom;
+ } else if (PROPERTY_ITEMS.equals(propertyId)) {
+ res = elements.size();
+ } else if (PROPERTY_ENTITIES.equals(propertyId)) {
+ int nEntities = 0;
+ Iterator<OrmShape> it = elements.values().iterator();
+ while (it.hasNext()) {
+ final OrmShape shape = it.next();
+ Object ormElement = shape.getOrmElement();
+ if (ormElement instanceof RootClass) {
+ nEntities++;
+ }
+ }
+ res = nEntities;
+ } else if (PROPERTY_TABLES.equals(propertyId)) {
+ int nTables = 0;
+ Iterator<OrmShape> it = elements.values().iterator();
+ while (it.hasNext()) {
+ final OrmShape shape = it.next();
+ Object ormElement = shape.getOrmElement();
+ if (ormElement instanceof Table) {
+ nTables++;
+ }
+ }
+ res = nTables;
+ } else if (PROPERTY_INVISIBLE.equals(propertyId)) {
+ int nInvisible = 0;
+ Iterator<OrmShape> it = elements.values().iterator();
+ while (it.hasNext()) {
+ final OrmShape shape = it.next();
+ if (!shape.isVisible()) {
+ nInvisible++;
+ }
+ }
+ res = nInvisible;
+ }
+ if (res == null) {
+ res = super.getPropertyValue(propertyId);
+ }
+ return toEmptyStr(res);
+ }
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmShape.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmShape.java 2009-12-16 12:47:44 UTC (rev 19299)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmShape.java 2009-12-16 13:54:03 UTC (rev 19300)
@@ -15,6 +15,8 @@
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.ui.IMemento;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.TextPropertyDescriptor;
import org.hibernate.mapping.Collection;
import org.hibernate.mapping.Column;
import org.hibernate.mapping.Component;
@@ -32,7 +34,7 @@
* @author some modifications from Vitali
*/
public class OrmShape extends ExpandableShape {
-
+
public static final String LOCATION_PROP = "location"; //$NON-NLS-1$
/**
* up-left point element location on diagram
@@ -43,7 +45,108 @@
* additional way to change shape location on diagram
*/
private DiagramGuide verticalGuide, horizontalGuide;
+
+ private static IPropertyDescriptor[] descriptors_entity;
+ private static IPropertyDescriptor[] descriptors_table;
+
+ private static final String ENTITY_isAbstract = "isAbstract"; //$NON-NLS-1$
+ private static final String ENTITY_isCustomDeleteCallable = "isCustomDeleteCallable"; //$NON-NLS-1$
+ private static final String ENTITY_isCustomInsertCallable = "isCustomInsertCallable"; //$NON-NLS-1$
+ private static final String ENTITY_isCustomUpdateCallable = "isCustomUpdateCallable"; //$NON-NLS-1$
+ private static final String ENTITY_isDiscriminatorInsertable = "isDiscriminatorInsertable"; //$NON-NLS-1$
+ private static final String ENTITY_isDiscriminatorValueNotNull = "isDiscriminatorValueNotNull"; //$NON-NLS-1$
+ private static final String ENTITY_isDiscriminatorValueNull = "isDiscriminatorValueNull"; //$NON-NLS-1$
+ private static final String ENTITY_isExplicitPolymorphism = "isExplicitPolymorphism"; //$NON-NLS-1$
+ private static final String ENTITY_isForceDiscriminator = "isForceDiscriminator"; //$NON-NLS-1$
+ private static final String ENTITY_isInherited = "isInherited"; //$NON-NLS-1$
+ private static final String ENTITY_isJoinedSubclass = "isJoinedSubclass"; //$NON-NLS-1$
+ private static final String ENTITY_isLazy = "isLazy"; //$NON-NLS-1$
+ private static final String ENTITY_isLazyPropertiesCacheable = "isLazyPropertiesCacheable"; //$NON-NLS-1$
+ private static final String ENTITY_isMutable = "isMutable"; //$NON-NLS-1$
+ private static final String ENTITY_isPolymorphic = "isPolymorphic"; //$NON-NLS-1$
+ private static final String ENTITY_isVersioned = "isVersioned"; //$NON-NLS-1$
+ private static final String ENTITY_batchSize = "batchSize"; //$NON-NLS-1$
+ private static final String ENTITY_cacheConcurrencyStrategy = "cacheConcurrencyStrategy"; //$NON-NLS-1$
+ private static final String ENTITY_className = "className"; //$NON-NLS-1$
+ private static final String ENTITY_customSQLDelete = "customSQLDelete"; //$NON-NLS-1$
+ private static final String ENTITY_customSQLInsert = "customSQLInsert"; //$NON-NLS-1$
+ private static final String ENTITY_customSQLUpdate = "customSQLUpdate"; //$NON-NLS-1$
+ private static final String ENTITY_discriminatorValue = "discriminatorValue"; //$NON-NLS-1$
+ private static final String ENTITY_entityName = "entityName"; //$NON-NLS-1$
+ private static final String ENTITY_loaderName = "loaderName"; //$NON-NLS-1$
+ private static final String ENTITY_nodeName = "nodeName"; //$NON-NLS-1$
+ private static final String ENTITY_optimisticLockMode = "optimisticLockMode"; //$NON-NLS-1$
+ private static final String ENTITY_table = "table"; //$NON-NLS-1$
+ private static final String ENTITY_temporaryIdTableDDL = "temporaryIdTableDDL"; //$NON-NLS-1$
+ private static final String ENTITY_temporaryIdTableName = "temporaryIdTableName"; //$NON-NLS-1$
+ private static final String ENTITY_where = "where"; //$NON-NLS-1$
+ private static final String ENTITY_cacheRegionName = "cacheRegionName"; //$NON-NLS-1$
+
+ private static final String TABLE_catalog = "catalog"; //$NON-NLS-1$
+ private static final String TABLE_comment = "comment"; //$NON-NLS-1$
+ private static final String TABLE_name = "name"; //$NON-NLS-1$
+ private static final String TABLE_primaryKey = "primaryKey"; //$NON-NLS-1$
+ private static final String TABLE_rowId = "rowId"; //$NON-NLS-1$
+ private static final String TABLE_schema = "schema"; //$NON-NLS-1$
+ private static final String TABLE_subselect = "subselect"; //$NON-NLS-1$
+ private static final String TABLE_hasDenormalizedTables = "hasDenormalizedTables"; //$NON-NLS-1$
+ private static final String TABLE_isAbstract = "isAbstract"; //$NON-NLS-1$
+ private static final String TABLE_isAbstractUnionTable = "isAbstractUnionTable"; //$NON-NLS-1$
+ private static final String TABLE_isPhysicalTable = "isPhysicalTable"; //$NON-NLS-1$
+ static {
+
+ descriptors_entity = new IPropertyDescriptor[] {
+ new TextPropertyDescriptor(ENTITY_isAbstract, ENTITY_isAbstract),
+ new TextPropertyDescriptor(ENTITY_isCustomDeleteCallable, ENTITY_isCustomDeleteCallable),
+ new TextPropertyDescriptor(ENTITY_isCustomInsertCallable, ENTITY_isCustomInsertCallable),
+ new TextPropertyDescriptor(ENTITY_isCustomUpdateCallable, ENTITY_isCustomUpdateCallable),
+ new TextPropertyDescriptor(ENTITY_isDiscriminatorInsertable, ENTITY_isDiscriminatorInsertable),
+ new TextPropertyDescriptor(ENTITY_isDiscriminatorValueNotNull, ENTITY_isDiscriminatorValueNotNull),
+ new TextPropertyDescriptor(ENTITY_isDiscriminatorValueNull, ENTITY_isDiscriminatorValueNull),
+ new TextPropertyDescriptor(ENTITY_isExplicitPolymorphism, ENTITY_isExplicitPolymorphism),
+ new TextPropertyDescriptor(ENTITY_isForceDiscriminator, ENTITY_isForceDiscriminator),
+ new TextPropertyDescriptor(ENTITY_isInherited, ENTITY_isInherited),
+ new TextPropertyDescriptor(ENTITY_isJoinedSubclass, ENTITY_isJoinedSubclass),
+ new TextPropertyDescriptor(ENTITY_isLazy, ENTITY_isLazy),
+ new TextPropertyDescriptor(ENTITY_isLazyPropertiesCacheable, ENTITY_isLazyPropertiesCacheable),
+ new TextPropertyDescriptor(ENTITY_isMutable, ENTITY_isMutable),
+ new TextPropertyDescriptor(ENTITY_isPolymorphic, ENTITY_isPolymorphic),
+ new TextPropertyDescriptor(ENTITY_isVersioned, ENTITY_isVersioned),
+ new TextPropertyDescriptor(ENTITY_batchSize, ENTITY_batchSize),
+ new TextPropertyDescriptor(ENTITY_cacheConcurrencyStrategy, ENTITY_cacheConcurrencyStrategy),
+ new TextPropertyDescriptor(ENTITY_className, ENTITY_className),
+ new TextPropertyDescriptor(ENTITY_customSQLDelete, ENTITY_customSQLDelete),
+ new TextPropertyDescriptor(ENTITY_customSQLInsert, ENTITY_customSQLInsert),
+ new TextPropertyDescriptor(ENTITY_customSQLUpdate, ENTITY_customSQLUpdate),
+ new TextPropertyDescriptor(ENTITY_discriminatorValue, ENTITY_discriminatorValue),
+ new TextPropertyDescriptor(ENTITY_entityName, ENTITY_entityName),
+ new TextPropertyDescriptor(ENTITY_loaderName, ENTITY_loaderName),
+ new TextPropertyDescriptor(ENTITY_nodeName, ENTITY_nodeName),
+ new TextPropertyDescriptor(ENTITY_optimisticLockMode, ENTITY_optimisticLockMode),
+ new TextPropertyDescriptor(ENTITY_table, ENTITY_table),
+ new TextPropertyDescriptor(ENTITY_temporaryIdTableDDL, ENTITY_temporaryIdTableDDL),
+ new TextPropertyDescriptor(ENTITY_temporaryIdTableName, ENTITY_temporaryIdTableName),
+ new TextPropertyDescriptor(ENTITY_where, ENTITY_where),
+ new TextPropertyDescriptor(ENTITY_cacheRegionName, ENTITY_cacheRegionName),
+ };
+
+ descriptors_table = new IPropertyDescriptor[] {
+ new TextPropertyDescriptor(TABLE_catalog, TABLE_catalog),
+ new TextPropertyDescriptor(TABLE_comment, TABLE_comment),
+ new TextPropertyDescriptor(TABLE_name, TABLE_name),
+ new TextPropertyDescriptor(TABLE_primaryKey, TABLE_primaryKey),
+ new TextPropertyDescriptor(TABLE_rowId, TABLE_rowId),
+ new TextPropertyDescriptor(TABLE_schema, TABLE_schema),
+ new TextPropertyDescriptor(TABLE_subselect, TABLE_subselect),
+ new TextPropertyDescriptor(TABLE_hasDenormalizedTables, TABLE_hasDenormalizedTables),
+ new TextPropertyDescriptor(TABLE_isAbstract, TABLE_isAbstract),
+ new TextPropertyDescriptor(TABLE_isAbstractUnionTable, TABLE_isAbstractUnionTable),
+ new TextPropertyDescriptor(TABLE_isPhysicalTable, TABLE_isPhysicalTable),
+ };
+
+ } // static
+
public OrmShape(Object ioe) {
super(ioe);
initModel();
@@ -330,4 +433,137 @@
setPosition(properties);
super.saveInProperties(properties);
}
+
+ @Override
+ public IPropertyDescriptor[] getPropertyDescriptors() {
+ IPropertyDescriptor[] res = super.getPropertyDescriptors();
+ if (res.length > 0) {
+ return res;
+ }
+ Object ormElement = getOrmElement();
+ if (ormElement instanceof RootClass) {
+ //RootClass rootClass = (RootClass)ormElement;
+ res = descriptors_entity;
+ } else if (ormElement instanceof Subclass) {
+ //RootClass rootClass = ((Subclass)ormElement).getRootClass();
+ } else if (ormElement instanceof Table) {
+ //Iterator iterator = ((Table)getOrmElement()).getColumnIterator();
+ //while (iterator.hasNext()) {
+ // Column column = (Column)iterator.next();
+ // Shape bodyOrmShape = new Shape(column);
+ // addChild(bodyOrmShape);
+ //}
+ res = descriptors_table;
+ }
+ return res;
+ }
+
+ @Override
+ public Object getPropertyValue(Object propertyId) {
+ Object res = null;
+ RootClass rootClass = null;
+ Table table = null;
+ Object ormElement = getOrmElement();
+ if (ormElement instanceof RootClass) {
+ rootClass = (RootClass)ormElement;
+ } else if (ormElement instanceof Subclass) {
+ //rootClass = ((Subclass)ormElement).getRootClass();
+ } else if (ormElement instanceof Table) {
+ table = (Table)getOrmElement();
+ }
+ if (rootClass != null) {
+ if (ENTITY_isAbstract.equals(propertyId)) {
+ res = rootClass.isAbstract();
+ } else if (ENTITY_isCustomDeleteCallable.equals(propertyId)) {
+ res = rootClass.isCustomDeleteCallable();
+ } else if (ENTITY_isCustomInsertCallable.equals(propertyId)) {
+ res = rootClass.isCustomInsertCallable();
+ } else if (ENTITY_isCustomUpdateCallable.equals(propertyId)) {
+ res = rootClass.isCustomUpdateCallable();
+ } else if (ENTITY_isDiscriminatorInsertable.equals(propertyId)) {
+ res = rootClass.isDiscriminatorInsertable();
+ } else if (ENTITY_isDiscriminatorValueNotNull.equals(propertyId)) {
+ res = rootClass.isDiscriminatorValueNotNull();
+ } else if (ENTITY_isDiscriminatorValueNull.equals(propertyId)) {
+ res = rootClass.isDiscriminatorValueNull();
+ } else if (ENTITY_isExplicitPolymorphism.equals(propertyId)) {
+ res = rootClass.isExplicitPolymorphism();
+ } else if (ENTITY_isForceDiscriminator.equals(propertyId)) {
+ res = rootClass.isForceDiscriminator();
+ } else if (ENTITY_isInherited.equals(propertyId)) {
+ res = rootClass.isInherited();
+ } else if (ENTITY_isJoinedSubclass.equals(propertyId)) {
+ res = rootClass.isJoinedSubclass();
+ } else if (ENTITY_isLazy.equals(propertyId)) {
+ res = rootClass.isLazy();
+ } else if (ENTITY_isLazyPropertiesCacheable.equals(propertyId)) {
+ res = rootClass.isLazyPropertiesCacheable();
+ } else if (ENTITY_isMutable.equals(propertyId)) {
+ res = rootClass.isMutable();
+ } else if (ENTITY_isPolymorphic.equals(propertyId)) {
+ res = rootClass.isPolymorphic();
+ } else if (ENTITY_isVersioned.equals(propertyId)) {
+ res = rootClass.isVersioned();
+ } else if (ENTITY_batchSize.equals(propertyId)) {
+ res = rootClass.getBatchSize();
+ } else if (ENTITY_cacheConcurrencyStrategy.equals(propertyId)) {
+ res = rootClass.getCacheConcurrencyStrategy();
+ } else if (ENTITY_className.equals(propertyId)) {
+ res = rootClass.getClassName();
+ } else if (ENTITY_customSQLDelete.equals(propertyId)) {
+ res = rootClass.getCustomSQLDelete();
+ } else if (ENTITY_customSQLInsert.equals(propertyId)) {
+ res = rootClass.getCustomSQLInsert();
+ } else if (ENTITY_customSQLUpdate.equals(propertyId)) {
+ res = rootClass.getCustomSQLUpdate();
+ } else if (ENTITY_discriminatorValue.equals(propertyId)) {
+ res = rootClass.getDiscriminatorValue();
+ } else if (ENTITY_entityName.equals(propertyId)) {
+ res = rootClass.getEntityName();
+ } else if (ENTITY_loaderName.equals(propertyId)) {
+ res = rootClass.getLoaderName();
+ } else if (ENTITY_nodeName.equals(propertyId)) {
+ res = rootClass.getNodeName();
+ } else if (ENTITY_optimisticLockMode.equals(propertyId)) {
+ res = rootClass.getOptimisticLockMode();
+ } else if (ENTITY_table.equals(propertyId)) {
+ res = rootClass.getTable();
+ } else if (ENTITY_temporaryIdTableDDL.equals(propertyId)) {
+ res = rootClass.getTemporaryIdTableDDL();
+ } else if (ENTITY_temporaryIdTableName.equals(propertyId)) {
+ res = rootClass.getTemporaryIdTableName();
+ } else if (ENTITY_where.equals(propertyId)) {
+ res = rootClass.getWhere();
+ }
+ }
+ if (table != null) {
+ if (TABLE_catalog.equals(propertyId)) {
+ res = table.getCatalog();
+ } else if (TABLE_comment.equals(propertyId)) {
+ res = table.getComment();
+ } else if (TABLE_name.equals(propertyId)) {
+ res = table.getName();
+ } else if (TABLE_primaryKey.equals(propertyId)) {
+ res = table.getPrimaryKey();
+ } else if (TABLE_rowId.equals(propertyId)) {
+ res = table.getRowId();
+ } else if (TABLE_schema.equals(propertyId)) {
+ res = table.getSchema();
+ } else if (TABLE_subselect.equals(propertyId)) {
+ res = table.getSubselect();
+ } else if (TABLE_hasDenormalizedTables.equals(propertyId)) {
+ res = table.hasDenormalizedTables();
+ } else if (TABLE_isAbstract.equals(propertyId)) {
+ res = table.isAbstract();
+ } else if (TABLE_isAbstractUnionTable.equals(propertyId)) {
+ res = table.isAbstractUnionTable();
+ } else if (TABLE_isPhysicalTable.equals(propertyId)) {
+ res = table.isPhysicalTable();
+ }
+ }
+ if (res == null) {
+ res = super.getPropertyValue(propertyId);
+ }
+ return toEmptyStr(res);
+ }
}
\ No newline at end of file
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/Shape.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/Shape.java 2009-12-16 12:47:44 UTC (rev 19299)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/Shape.java 2009-12-16 13:54:03 UTC (rev 19300)
@@ -77,28 +77,27 @@
static {
descriptors_property = new IPropertyDescriptor[] {
- new TextPropertyDescriptor(PROPERTY_NAME, PROPERTY_NAME),
- new TextPropertyDescriptor(PROPERTY_TYPE, PROPERTY_TYPE),
- new TextPropertyDescriptor(PROPERTY_VALUE, PROPERTY_VALUE),
- new TextPropertyDescriptor(PROPERTY_CLASS, PROPERTY_CLASS),
- new TextPropertyDescriptor(PROPERTY_SELECT, PROPERTY_SELECT),
- new TextPropertyDescriptor(PROPERTY_INSERT, PROPERTY_INSERT),
- new TextPropertyDescriptor(PROPERTY_UPDATE, PROPERTY_UPDATE),
- new TextPropertyDescriptor(PROPERTY_CASCADE, PROPERTY_CASCADE),
- new TextPropertyDescriptor(PROPERTY_LAZY, PROPERTY_LAZY),
- new TextPropertyDescriptor(PROPERTY_OPTIONAL, PROPERTY_OPTIONAL),
- new TextPropertyDescriptor(PROPERTY_NATURAL_IDENTIFIER, PROPERTY_NATURAL_IDENTIFIER),
- new TextPropertyDescriptor(PROPERTY_NODE_NAME, PROPERTY_NODE_NAME),
- new TextPropertyDescriptor(PROPERTY_OPTIMISTIC_LOCKED, PROPERTY_OPTIMISTIC_LOCKED),
+ new TextPropertyDescriptor(PROPERTY_NAME, PROPERTY_NAME),
+ new TextPropertyDescriptor(PROPERTY_TYPE, PROPERTY_TYPE),
+ new TextPropertyDescriptor(PROPERTY_VALUE, PROPERTY_VALUE),
+ new TextPropertyDescriptor(PROPERTY_CLASS, PROPERTY_CLASS),
+ new TextPropertyDescriptor(PROPERTY_SELECT, PROPERTY_SELECT),
+ new TextPropertyDescriptor(PROPERTY_INSERT, PROPERTY_INSERT),
+ new TextPropertyDescriptor(PROPERTY_UPDATE, PROPERTY_UPDATE),
+ new TextPropertyDescriptor(PROPERTY_CASCADE, PROPERTY_CASCADE),
+ new TextPropertyDescriptor(PROPERTY_LAZY, PROPERTY_LAZY),
+ new TextPropertyDescriptor(PROPERTY_OPTIONAL, PROPERTY_OPTIONAL),
+ new TextPropertyDescriptor(PROPERTY_NATURAL_IDENTIFIER, PROPERTY_NATURAL_IDENTIFIER),
+ new TextPropertyDescriptor(PROPERTY_NODE_NAME, PROPERTY_NODE_NAME),
+ new TextPropertyDescriptor(PROPERTY_OPTIMISTIC_LOCKED, PROPERTY_OPTIMISTIC_LOCKED),
};
-
descriptors_column = new IPropertyDescriptor[] {
- new TextPropertyDescriptor(PROPERTY_NAME, PROPERTY_NAME),
- new TextPropertyDescriptor(PROPERTY_TYPE, PROPERTY_TYPE),
- new TextPropertyDescriptor(PROPERTY_VALUE, PROPERTY_VALUE),
- new TextPropertyDescriptor(PROPERTY_NULLABLE, PROPERTY_NULLABLE),
- new TextPropertyDescriptor(PROPERTY_UNIQUE, PROPERTY_UNIQUE),
+ new TextPropertyDescriptor(PROPERTY_NAME, PROPERTY_NAME),
+ new TextPropertyDescriptor(PROPERTY_TYPE, PROPERTY_TYPE),
+ new TextPropertyDescriptor(PROPERTY_VALUE, PROPERTY_VALUE),
+ new TextPropertyDescriptor(PROPERTY_NULLABLE, PROPERTY_NULLABLE),
+ new TextPropertyDescriptor(PROPERTY_UNIQUE, PROPERTY_UNIQUE),
};
} // static
@@ -254,11 +253,11 @@
* @see #getPropertyValue(Object)
* @see #setPropertyValue(Object, Object)
*/
+ @Override
public IPropertyDescriptor[] getPropertyDescriptors() {
if (getOrmElement() instanceof Property) {
return descriptors_property;
- }
- else if (getOrmElement() instanceof Column) {
+ } else if (getOrmElement() instanceof Column) {
return descriptors_column;
}
return super.getPropertyDescriptors();
@@ -271,6 +270,7 @@
* @see #descriptors
* @see #getPropertyDescriptors()
*/
+ @Override
public Object getPropertyValue(Object propertyId) {
Object res = null;
Column col = null;
@@ -281,21 +281,45 @@
if (getOrmElement() instanceof Property) {
prop = (Property)getOrmElement();
}
- if (PROPERTY_NAME.equals(propertyId)) {
- if (prop != null) {
+ if (prop != null) {
+ if (PROPERTY_NAME.equals(propertyId)) {
res = prop.getName();
- } else if (col != null) {
- res = col.getName();
- }
- } else if (PROPERTY_TYPE.equals(propertyId)) {
- if (prop != null) {
+ } else if (PROPERTY_TYPE.equals(propertyId)) {
Value value = prop.getValue();
if (value instanceof Component) {
res = prop.getValue().toString();
} else {
res = prop.getType().getReturnedClass().getName();
}
- } else if (col != null) {
+ } else if (PROPERTY_VALUE.equals(propertyId)) {
+ res = prop.getValue().toString();
+ } else if (PROPERTY_CLASS.equals(propertyId)) {
+ if (prop.getPersistentClass() != null) {
+ res = prop.getPersistentClass().getClassName();
+ }
+ } else if (PROPERTY_SELECT.equals(propertyId)) {
+ res = Boolean.valueOf(prop.isSelectable()).toString();
+ } else if (PROPERTY_INSERT.equals(propertyId)) {
+ res = Boolean.valueOf(prop.isInsertable()).toString();
+ } else if (PROPERTY_UPDATE.equals(propertyId)) {
+ res = Boolean.valueOf(prop.isUpdateable()).toString();
+ } else if (PROPERTY_CASCADE.equals(propertyId)) {
+ res = prop.getCascade();
+ } else if (PROPERTY_LAZY.equals(propertyId)) {
+ res = Boolean.valueOf(prop.isLazy()).toString();
+ } else if (PROPERTY_OPTIONAL.equals(propertyId)) {
+ res = Boolean.valueOf(prop.isOptional()).toString();
+ } else if (PROPERTY_NATURAL_IDENTIFIER.equals(propertyId)) {
+ res = Boolean.valueOf(prop.isNaturalIdentifier()).toString();
+ } else if (PROPERTY_NODE_NAME.equals(propertyId)) {
+ res = prop.getNodeName();
+ } else if (PROPERTY_OPTIMISTIC_LOCKED.equals(propertyId)) {
+ res = Boolean.valueOf(prop.isOptimisticLocked()).toString();
+ }
+ } else if (col != null) {
+ if (PROPERTY_NAME.equals(propertyId)) {
+ res = col.getName();
+ } else if (PROPERTY_TYPE.equals(propertyId)) {
String sqlType = col.getSqlType();
if (sqlType == null) {
getOrmDiagram().getLabelProvider().updateColumnSqlType(col);
@@ -310,61 +334,11 @@
&& HibernateUtils.isForeignKey(col) ? " FK" : ""); //$NON-NLS-1$ //$NON-NLS-2$
}
res = name.toString();
- }
- } else if (PROPERTY_VALUE.equals(propertyId)) {
- if (prop != null) {
- res = prop.getValue().toString();
- } else if (getOrmElement() instanceof Column) {
+ } else if (PROPERTY_VALUE.equals(propertyId)) {
res = col.getValue().toString();
- }
- } else if (PROPERTY_CLASS.equals(propertyId)) {
- if (prop != null) {
- if (prop.getPersistentClass() != null) {
- res = prop.getPersistentClass().getClassName();
- }
- }
- } else if (PROPERTY_SELECT.equals(propertyId)) {
- if (prop != null) {
- res = Boolean.valueOf(prop.isSelectable()).toString();
- }
- } else if (PROPERTY_INSERT.equals(propertyId)) {
- if (prop != null) {
- res = Boolean.valueOf(prop.isInsertable()).toString();
- }
- } else if (PROPERTY_UPDATE.equals(propertyId)) {
- if (prop != null) {
- res = Boolean.valueOf(prop.isUpdateable()).toString();
- }
- } else if (PROPERTY_CASCADE.equals(propertyId)) {
- if (prop != null) {
- res = prop.getCascade();
- }
- } else if (PROPERTY_LAZY.equals(propertyId)) {
- if (prop != null) {
- res = Boolean.valueOf(prop.isLazy()).toString();
- }
- } else if (PROPERTY_OPTIONAL.equals(propertyId)) {
- if (prop != null) {
- res = Boolean.valueOf(prop.isOptional()).toString();
- }
- } else if (PROPERTY_NATURAL_IDENTIFIER.equals(propertyId)) {
- if (prop != null) {
- res = Boolean.valueOf(prop.isNaturalIdentifier()).toString();
- }
- } else if (PROPERTY_NODE_NAME.equals(propertyId)) {
- if (prop != null) {
- res = prop.getNodeName();
- }
- } else if (PROPERTY_OPTIMISTIC_LOCKED.equals(propertyId)) {
- if (prop != null) {
- res = Boolean.valueOf(prop.isOptimisticLocked()).toString();
- }
- } else if (PROPERTY_NULLABLE.equals(propertyId)) {
- if (col != null) {
+ } else if (PROPERTY_NULLABLE.equals(propertyId)) {
res = Boolean.valueOf(col.isNullable()).toString();
- }
- } else if (PROPERTY_UNIQUE.equals(propertyId)) {
- if (col != null) {
+ } else if (PROPERTY_UNIQUE.equals(propertyId)) {
res = Boolean.valueOf(col.isUnique()).toString();
}
}
@@ -373,12 +347,4 @@
}
return toEmptyStr(res);
}
-
- protected Object toEmptyStr(Object obj) {
- if (obj == null) {
- return ""; //$NON-NLS-1$
- }
- return obj;
- }
-
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/DiagramEditPart.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/DiagramEditPart.java 2009-12-16 12:47:44 UTC (rev 19299)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/DiagramEditPart.java 2009-12-16 13:54:03 UTC (rev 19300)
@@ -104,6 +104,16 @@
refresh();
}
+ @Override
+ public void refresh() {
+ IFigure layer = getLayer(LayerConstants.PRIMARY_LAYER);
+ getOrmDiagram().updateWidthAndHeight(layer.getBounds().width, layer.getBounds().height);
+ double zoom = ((DiagramViewer) ((DefaultEditDomain) getViewer().getEditDomain())
+ .getEditorPart()).getZoom();
+ getOrmDiagram().setZoom(zoom);
+ super.refresh();
+ }
+
/**
* Returns a <code>List</code> containing the children model objects.
* @return the List of children
15 years, 1 month
JBoss Tools SVN: r19299 - in trunk/jsf: plugins/org.jboss.tools.jsf.ui and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2009-12-16 07:47:44 -0500 (Wed, 16 Dec 2009)
New Revision: 19299
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.xml
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/RenameMethodParticipant.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/el/refactoring/RefactorSearcher.java
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/refactoring/ELReferencesRenameTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5289
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/el/refactoring/RefactorSearcher.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/el/refactoring/RefactorSearcher.java 2009-12-16 10:27:56 UTC (rev 19298)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/el/refactoring/RefactorSearcher.java 2009-12-16 12:47:44 UTC (rev 19299)
@@ -198,8 +198,9 @@
if(javaElement != null){
for(ELReference reference : references){
+ int offset = reference.getStartPosition();
for(ELExpression operand : reference.getEl()){
- int offset = operand.getStartPosition();
+
for (ELResolver resolver : resolvers) {
if (!(resolver instanceof ELCompletionEngine))
continue;
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.xml 2009-12-16 10:27:56 UTC (rev 19298)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.xml 2009-12-16 12:47:44 UTC (rev 19299)
@@ -437,7 +437,6 @@
<with variable="element">
<or>
<instanceof value="org.eclipse.jdt.core.IMethod"/>
- <instanceof value="org.eclipse.jdt.core.IType"/>
</or>
</with>
</enablement>
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/RenameMethodParticipant.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/RenameMethodParticipant.java 2009-12-16 10:27:56 UTC (rev 19298)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/RenameMethodParticipant.java 2009-12-16 12:47:44 UTC (rev 19299)
@@ -22,7 +22,6 @@
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IType;
import org.eclipse.ltk.core.refactoring.Change;
import org.eclipse.ltk.core.refactoring.CompositeChange;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
@@ -100,20 +99,6 @@
searcher = new SeamRenameMethodSearcher((IFile)method.getResource(), oldName);
added = false;
return true;
- }else if(element instanceof IType){
- IType type = (IType)element;
- status = new RefactoringStatus();
-
- rootChange = new CompositeChange(JsfUIMessages.RENAME_METHOD_PARTICIPANT_UPDATE_METHOD_REFERENCES);
-
- this.element = type;
-
- oldName = type.getElementName();
-
- newName = RefactorSearcher.getPropertyName(type, getArguments().getNewName());
- searcher = new SeamRenameMethodSearcher((IFile)type.getResource(), oldName);
- added = false;
- return true;
}
return false;
}
@@ -134,20 +119,6 @@
searcher = new SeamRenameMethodSearcher((IFile)method.getResource(), oldName);
added = false;
return true;
- }else if(element instanceof IType){
- IType type = (IType)element;
- status = new RefactoringStatus();
-
- rootChange = new CompositeChange(JsfUIMessages.RENAME_METHOD_PARTICIPANT_UPDATE_METHOD_REFERENCES);
-
- this.element = type;
-
- oldName = type.getElementName();
-
- this.newName = newName;
- searcher = new SeamRenameMethodSearcher((IFile)type.getResource(), oldName);
- added = false;
- return true;
}
return false;
}
Modified: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/refactoring/ELReferencesRenameTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/refactoring/ELReferencesRenameTest.java 2009-12-16 10:27:56 UTC (rev 19298)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/refactoring/ELReferencesRenameTest.java 2009-12-16 12:47:44 UTC (rev 19299)
@@ -45,25 +45,6 @@
renameELReferences(method, "alias", list);
}
-
- public void testRenameClass() throws CoreException {
- ArrayList<TestChangeStructure> list = new ArrayList<TestChangeStructure>();
-
-
- TestChangeStructure structure = new TestChangeStructure(jsfProject, "/WebContent/pages/hello.jsp");
- TestTextChange change = new TestTextChange(348, 4, "user");
- structure.addTextChange(change);
- list.add(structure);
-
- structure = new TestChangeStructure(jsfProject, "/WebContent/pages/inputUserName.jsp");
- change = new TestTextChange(494, 4, "user");
- structure.addTextChange(change);
- list.add(structure);
-
- IType type = getJavaType(jsfProject, "demo.User");
-
- renameELReferences(type, "person", list);
- }
private void renameELReferences(IJavaElement element, String newName, List<TestChangeStructure> changeList) throws CoreException{
JobUtils.waitForIdle();
15 years, 1 month
JBoss Tools SVN: r19298 - trunk/hibernatetools/plugins/org.hibernate.eclipse.console/META-INF.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2009-12-16 05:27:56 -0500 (Wed, 16 Dec 2009)
New Revision: 19298
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/META-INF/MANIFEST.MF
Log:
https://jira.jboss.org/jira/browse/JBIDE-5481
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/META-INF/MANIFEST.MF
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/META-INF/MANIFEST.MF 2009-12-16 09:01:59 UTC (rev 19297)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/META-INF/MANIFEST.MF 2009-12-16 10:27:56 UTC (rev 19298)
@@ -56,7 +56,7 @@
org.eclipse.help,
org.eclipse.ui.console,
org.eclipse.gef,
- org.eclipse.debug.core,
+ org.eclipse.debug.core;bundle-version="3.4.0",
org.eclipse.debug.ui,
org.eclipse.ui.forms,
org.eclipse.wst.common.project.facet.core,
15 years, 1 month
JBoss Tools SVN: r19297 - in trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools: ui and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2009-12-16 04:01:59 -0500 (Wed, 16 Dec 2009)
New Revision: 19297
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/SharedImages.java
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/ui/FilesetReferenceWizardFragment.java
Log:
JBIDE-5480
Modified: trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/SharedImages.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/SharedImages.java 2009-12-16 05:59:22 UTC (rev 19296)
+++ trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/SharedImages.java 2009-12-16 09:01:59 UTC (rev 19297)
@@ -5,8 +5,6 @@
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.Image;
-import org.jboss.ide.eclipse.as.ui.JBossServerUIPlugin;
-import org.jboss.ide.eclipse.as.ui.JBossServerUISharedImages;
import org.osgi.framework.Bundle;
public class SharedImages {
@@ -19,7 +17,7 @@
instance = this;
images = new Hashtable<String, Object>();
descriptors = new Hashtable<String, Object>();
- Bundle pluginBundle = JBossServerUIPlugin.getDefault().getBundle();
+ Bundle pluginBundle = IntegrationPlugin.getDefault().getBundle();
descriptors.put(FILESET_IMAGE, createImageDescriptor(pluginBundle, "/icons/multiple_files.gif")); //$NON-NLS-1$
Iterator<String> iter = descriptors.keySet().iterator();
Modified: trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/ui/FilesetReferenceWizardFragment.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/ui/FilesetReferenceWizardFragment.java 2009-12-16 05:59:22 UTC (rev 19296)
+++ trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/ui/FilesetReferenceWizardFragment.java 2009-12-16 09:01:59 UTC (rev 19297)
@@ -25,9 +25,10 @@
import org.eclipse.wst.server.ui.wizard.IWizardHandle;
import org.eclipse.wst.server.ui.wizard.WizardFragment;
import org.jboss.ide.eclipse.archives.webtools.filesets.vcf.WorkspaceFilesetVirtualComponent;
+import org.jboss.ide.eclipse.as.wtp.ui.propertypage.IReferenceEditor;
import org.jboss.ide.eclipse.as.wtp.ui.propertypage.NewReferenceWizard;
-public class FilesetReferenceWizardFragment extends WizardFragment {
+public class FilesetReferenceWizardFragment extends WizardFragment implements IReferenceEditor {
public boolean hasComposite() {
return true;
}
@@ -41,7 +42,7 @@
private String includes, excludes, folder;
public Composite createComposite(Composite parent, IWizardHandle handle) {
hasEntered = true;
- handle.setTitle("Add a fileset"); //$NON-NLS-1$
+ handle.setTitle("Add a fileset reference"); //$NON-NLS-1$
handle.setDescription("This will let you select a root folder and some matching patterns"); //$NON-NLS-1$
Composite child = new Composite(parent, SWT.NONE);
@@ -67,6 +68,11 @@
incText.addModifyListener(listener);
excText.addModifyListener(listener);
textModified();
+ if( original != null ) {
+ rootText.setText(original.getRootFolderPath());
+ incText.setText(original.getIncludes());
+ excText.setText(original.getExcludes());
+ }
return child;
}
@@ -143,4 +149,11 @@
return vc;
}
+ private WorkspaceFilesetVirtualComponent original;
+ public boolean canEdit(IVirtualComponent vc) {
+ if( vc instanceof WorkspaceFilesetVirtualComponent)
+ original = (WorkspaceFilesetVirtualComponent)vc;
+ return original != null;
+ }
+
}
15 years, 1 month
JBoss Tools SVN: r19296 - in trunk/bpel/plugins: org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wizards and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: Grid.Qian
Date: 2009-12-16 00:59:22 -0500 (Wed, 16 Dec 2009)
New Revision: 19296
Modified:
trunk/bpel/plugins/org.eclipse.bpel.apache.ode.deploy.ui/src/org/eclipse/bpel/apache/ode/deploy/ui/wizards/ODEDeployWizardPage.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wizards/NewFileWizard.java
Log:
JBIDE-5452: Create New BPEL Process does not put it in the bpelContent folder
Modified: trunk/bpel/plugins/org.eclipse.bpel.apache.ode.deploy.ui/src/org/eclipse/bpel/apache/ode/deploy/ui/wizards/ODEDeployWizardPage.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.apache.ode.deploy.ui/src/org/eclipse/bpel/apache/ode/deploy/ui/wizards/ODEDeployWizardPage.java 2009-12-16 05:51:07 UTC (rev 19295)
+++ trunk/bpel/plugins/org.eclipse.bpel.apache.ode.deploy.ui/src/org/eclipse/bpel/apache/ode/deploy/ui/wizards/ODEDeployWizardPage.java 2009-12-16 05:59:22 UTC (rev 19296)
@@ -4,6 +4,7 @@
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceDescription;
import org.eclipse.core.resources.IWorkspaceRoot;
@@ -108,30 +109,14 @@
Object obj = ssel.getFirstElement();
if (obj instanceof IResource) {
- IContainer container;
- if (obj instanceof IContainer)
- container = (IContainer) obj;
- else
- container = ((IResource) obj).getParent();
- containerText.setText(container.getFullPath().toString());
- } else if (obj instanceof IJavaElement) {
-
- IPath path = ((IJavaElement) obj).getPath();
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- if (!(obj instanceof IJavaProject)) {
- IFolder containerFolder = root.getFolder(path);
- while (!containerFolder.exists()) {
- obj = ((IJavaElement) obj).getParent();
- if (obj instanceof IJavaElement) {
- path = ((IJavaElement) obj).getPath();
- containerFolder = root.getFolder(path);
- }
-
- }
- }
- if (path != null) {
- containerText.setText(path.toOSString());
- }
+ IProject project;
+ project = ((IResource) obj).getProject();
+ IContainer bpelContent = project.getFolder("bpelContent");
+ if (bpelContent != null) {
+ containerText.setText(bpelContent.getFullPath().toString());
+ } else {
+ containerText.setText(project.getFullPath().toString());
+ }
}
}
}
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wizards/NewFileWizard.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wizards/NewFileWizard.java 2009-12-16 05:51:07 UTC (rev 19295)
+++ trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wizards/NewFileWizard.java 2009-12-16 05:59:22 UTC (rev 19296)
@@ -18,6 +18,7 @@
import org.eclipse.bpel.ui.BPELUIPlugin;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
@@ -82,7 +83,7 @@
public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
fWorkbench = workbench;
- mContainer = getClosestContainer( currentSelection.getFirstElement() );
+ mContainer = getBPELContainer( currentSelection.getFirstElement() );
}
@@ -191,24 +192,32 @@
/**
- * Return the closest container in which we can generate
+ * Return the BPEL files container in which we can generate
* process from the template.
*
- * @return the closest IContainer
+ * @return the BPEL files IContainer
*/
- IContainer getClosestContainer ( Object obj ) {
+ IContainer getBPELContainer ( Object obj ) {
if (obj == null) {
return null;
}
+ IProject project = null;
if (obj instanceof IFile) {
IFile file = (IFile) obj;
- return file.getParent();
+ project = file.getProject();
}
if (obj instanceof IContainer) {
- return (IContainer) obj;
+ IContainer container = (IContainer)obj;
+ project = container.getProject();
}
+ if (project != null) {
+ IContainer bpelContent = project.getFolder("bpelContent");
+ if (bpelContent != null) {
+ return bpelContent;
+ }
+ }
return null;
}
15 years, 1 month
JBoss Tools SVN: r19295 - in trunk/as/plugins: org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2009-12-16 00:51:07 -0500 (Wed, 16 Dec 2009)
New Revision: 19295
Added:
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/SharedImages.java
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/vcf/FilesetVCLabelProvider.java
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/schema/virtualComponentLabelProvider.exsd
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/IVirtualComponentLabelProvider.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/plugin.xml
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/IntegrationPlugin.java
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/plugin.xml
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/ComponentDependencyContentProvider.java
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/DependencyPageExtensionManager.java
Log:
Allows arbitrary component types to control their UI in module assembly page
Modified: trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/plugin.xml 2009-12-16 01:13:32 UTC (rev 19294)
+++ trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/plugin.xml 2009-12-16 05:51:07 UTC (rev 19295)
@@ -184,9 +184,16 @@
point="org.jboss.ide.eclipse.as.wtp.ui.referenceWizardFragment">
<referenceFragment
class="org.jboss.ide.eclipse.archives.webtools.ui.FilesetReferenceWizardFragment"
- icon="icons/multiple_files.gif"
+ icon="$nl$/icons/multiple_files.gif"
id="org.jboss.ide.eclipse.archives.webtools.FilesetReferenceWizardFragment"
name="Fileset">
</referenceFragment>
</extension>
+ <extension
+ point="org.jboss.ide.eclipse.as.wtp.ui.virtualComponentLabelProvider">
+ <provider
+ class="org.jboss.ide.eclipse.archives.webtools.filesets.vcf.FilesetVCLabelProvider"
+ weight="5">
+ </provider>
+ </extension>
</plugin>
Modified: trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/IntegrationPlugin.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/IntegrationPlugin.java 2009-12-16 01:13:32 UTC (rev 19294)
+++ trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/IntegrationPlugin.java 2009-12-16 05:51:07 UTC (rev 19295)
@@ -49,8 +49,9 @@
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
+ SharedImages.instance().cleanup();
+ UnitedServerListenerManager.getDefault().removeListener(NewServerFilesetHandler.getDefault());
plugin = null;
- UnitedServerListenerManager.getDefault().removeListener(NewServerFilesetHandler.getDefault());
super.stop(context);
}
Added: trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/SharedImages.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/SharedImages.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/SharedImages.java 2009-12-16 05:51:07 UTC (rev 19295)
@@ -0,0 +1,74 @@
+package org.jboss.ide.eclipse.archives.webtools;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+import org.jboss.ide.eclipse.as.ui.JBossServerUIPlugin;
+import org.jboss.ide.eclipse.as.ui.JBossServerUISharedImages;
+import org.osgi.framework.Bundle;
+
+public class SharedImages {
+ private static SharedImages instance;
+ public static final String FILESET_IMAGE = "multiple_files"; //$NON-NLS-1$
+
+ private Hashtable<String, Object> images, descriptors;
+
+ private SharedImages () {
+ instance = this;
+ images = new Hashtable<String, Object>();
+ descriptors = new Hashtable<String, Object>();
+ Bundle pluginBundle = JBossServerUIPlugin.getDefault().getBundle();
+
+ descriptors.put(FILESET_IMAGE, createImageDescriptor(pluginBundle, "/icons/multiple_files.gif")); //$NON-NLS-1$
+ Iterator<String> iter = descriptors.keySet().iterator();
+ while (iter.hasNext()) {
+ String key = iter.next();
+ ImageDescriptor descriptor = descriptor(key);
+ images.put(key, descriptor.createImage());
+ }
+ }
+
+ private ImageDescriptor createImageDescriptor (Bundle pluginBundle, String relativePath) {
+ return ImageDescriptor.createFromURL(pluginBundle.getEntry(relativePath));
+ }
+
+ public static SharedImages instance() {
+ if (instance == null)
+ instance = new SharedImages();
+ return instance;
+ }
+
+ public static Image getImage(String key) {
+ return instance().image(key);
+ }
+
+ public static ImageDescriptor getImageDescriptor(String key) {
+ return instance().descriptor(key);
+ }
+
+ public Image image(String key) {
+ return (Image) images.get(key);
+ }
+
+ public ImageDescriptor descriptor(String key) {
+ return (ImageDescriptor) descriptors.get(key);
+ }
+
+ public void cleanup() {
+ Iterator<String> iter = images.keySet().iterator();
+ while (iter.hasNext()) {
+ Image image = (Image) images.get(iter.next());
+ image.dispose();
+ }
+ images = null;
+ instance = null;
+ }
+
+ protected void finalize() throws Throwable {
+ cleanup();
+ super.finalize();
+ }
+
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/vcf/FilesetVCLabelProvider.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/vcf/FilesetVCLabelProvider.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/vcf/FilesetVCLabelProvider.java 2009-12-16 05:51:07 UTC (rev 19295)
@@ -0,0 +1,31 @@
+package org.jboss.ide.eclipse.archives.webtools.filesets.vcf;
+
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.jboss.ide.eclipse.archives.webtools.SharedImages;
+import org.jboss.ide.eclipse.as.wtp.ui.propertypage.IVirtualComponentLabelProvider;
+
+public class FilesetVCLabelProvider implements IVirtualComponentLabelProvider {
+
+ public FilesetVCLabelProvider() {
+ }
+
+ public boolean canHandle(IVirtualComponent component) {
+ return component instanceof WorkspaceFilesetVirtualComponent;
+ }
+
+ public Image getSourceImage(IVirtualComponent component) {
+ return SharedImages.getImage(SharedImages.FILESET_IMAGE);
+ }
+
+ public String getSourceText(IVirtualComponent component) {
+ WorkspaceFilesetVirtualComponent fileset = (WorkspaceFilesetVirtualComponent)component;
+ String base = fileset.getRootFolderPath();
+ if( fileset.getIncludes() != null && !fileset.getIncludes().equals("")) //$NON-NLS-1$
+ base += " [" + fileset.getIncludes() + "]"; //$NON-NLS-1$ //$NON-NLS-2$
+ if( fileset.getExcludes() != null && !fileset.getExcludes().equals("")) //$NON-NLS-1$
+ base += " [" + fileset.getExcludes() + "]"; //$NON-NLS-1$ //$NON-NLS-2$
+ return base;
+ }
+
+}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/plugin.xml 2009-12-16 01:13:32 UTC (rev 19294)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/plugin.xml 2009-12-16 05:51:07 UTC (rev 19295)
@@ -3,6 +3,7 @@
<plugin>
<extension-point id="moduleDependencyPropertyPage" name="moduleDependencyPropertyPage" schema="schema/moduleDependencyPropertyPage.exsd"/>
<extension-point id="referenceWizardFragment" name="referenceWizardFragment" schema="schema/referenceWizardFragment.exsd"/>
+ <extension-point id="virtualComponentLabelProvider" name="virtualComponentLabelProvider" schema="schema/virtualComponentLabelProvider.exsd"/>
<extension point="org.eclipse.ui.propertyPages">
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/schema/virtualComponentLabelProvider.exsd
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/schema/virtualComponentLabelProvider.exsd (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/schema/virtualComponentLabelProvider.exsd 2009-12-16 05:51:07 UTC (rev 19295)
@@ -0,0 +1,109 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.jboss.ide.eclipse.as.wtp.ui" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.jboss.ide.eclipse.as.wtp.ui" id="VirtualComponentLabelProvider" name="VirtualComponentLabelProvider"/>
+ </appinfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <element ref="provider"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="provider">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.jboss.ide.eclipse.as.wtp.ui.propertypage.IVirtualComponentLabelProvider"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="weight" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/ComponentDependencyContentProvider.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/ComponentDependencyContentProvider.java 2009-12-16 01:13:32 UTC (rev 19294)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/ComponentDependencyContentProvider.java 2009-12-16 05:51:07 UTC (rev 19295)
@@ -49,10 +49,11 @@
private DecoratingLabelProvider decProvider = new DecoratingLabelProvider(
new WorkbenchLabelProvider(), PlatformUI.getWorkbench().
getDecoratorManager().getLabelDecorator());
-
+ private IVirtualComponentLabelProvider[] delegates;
public ComponentDependencyContentProvider(AddModuleDependenciesPropertiesPage addModuleDependenciesPropertiesPage) {
super();
decProvider.addListener(addModuleDependenciesPropertiesPage);
+ delegates = DependencyPageExtensionManager.loadDelegates();
}
public void setRuntimePaths(HashMap<IVirtualComponent, String> paths) {
@@ -81,10 +82,7 @@
if (columnIndex == 0)
return WTPOveridePlugin.getInstance().getImage("jar_obj");
else
- if(((IVirtualComponent)element).isBinary())
- return WTPOveridePlugin.getInstance().getImage("jar_obj");
- else return decProvider.getImage(((IVirtualComponent)element).getProject());
- //return ModuleCoreUIPlugin.getInstance().getImage("prj_obj");
+ return handleSourceImage((IVirtualComponent)element);
}
if (element instanceof IProject){
return decProvider.getImage(element);
@@ -122,16 +120,37 @@
return null;
}
- private String handleSourceText(IVirtualComponent comp) {
- if( comp.isBinary() && comp instanceof VirtualArchiveComponent) {
- IPath p = ((VirtualArchiveComponent)comp).getWorkspaceRelativePath();
+
+
+ private String handleSourceText(IVirtualComponent component) {
+ if( delegates != null ) {
+ for( int i = 0; i < delegates.length; i++ )
+ if( delegates[i].canHandle(component))
+ return delegates[i].getSourceText(component);
+ }
+
+ // default impl
+ if( component.isBinary() && component instanceof VirtualArchiveComponent) {
+ IPath p = ((VirtualArchiveComponent)component).getWorkspaceRelativePath();
if( p == null )
- p = new Path(((VirtualArchiveComponent)comp).getUnderlyingDiskFile().getAbsolutePath());
+ p = new Path(((VirtualArchiveComponent)component).getUnderlyingDiskFile().getAbsolutePath());
return p.toString();
}
- return comp.getProject().getName();
+ return component.getProject().getName();
}
+ private Image handleSourceImage(IVirtualComponent component) {
+ if( delegates != null ) {
+ for( int i = 0; i < delegates.length; i++ )
+ if( delegates[i].canHandle(component))
+ return delegates[i].getSourceImage(component);
+ }
+
+ // default impl
+ if(component.isBinary())
+ return WTPOveridePlugin.getInstance().getImage("jar_obj");
+ else return decProvider.getImage(component.getProject());
+ }
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/DependencyPageExtensionManager.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/DependencyPageExtensionManager.java 2009-12-16 01:13:32 UTC (rev 19294)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/DependencyPageExtensionManager.java 2009-12-16 05:51:07 UTC (rev 19295)
@@ -1,8 +1,12 @@
package org.jboss.ide.eclipse.as.wtp.ui.propertypage;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.List;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
@@ -118,4 +122,38 @@
}
}
}
+
+
+ public static IVirtualComponentLabelProvider[] loadDelegates() {
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IConfigurationElement[] cf = registry.getConfigurationElementsFor(
+ WTPOveridePlugin.PLUGIN_ID, "virtualComponentLabelProvider"); //$NON-NLS-1$
+ List<IConfigurationElement> list = Arrays.asList(cf);
+ Comparator c = new Comparator<IConfigurationElement>() {
+ public int compare(IConfigurationElement o1,
+ IConfigurationElement o2) {
+ String o1String, o2String;
+ int o1int, o2int;
+ o1String=o1.getAttribute("weight");
+ o2String=o2.getAttribute("weight");
+ o1int = Integer.parseInt(o1String);
+ o2int = Integer.parseInt(o1String);
+ return o1int-o2int;
+ }
+ };
+ Collections.sort(list, c);
+ ArrayList<IVirtualComponentLabelProvider> retList = new ArrayList<IVirtualComponentLabelProvider>();
+ Iterator<IConfigurationElement> i = list.iterator();
+ while(i.hasNext()) {
+ try {
+ retList.add((IVirtualComponentLabelProvider)i.next().createExecutableExtension("class"));
+ } catch( CoreException ce) {
+ // log
+ }
+ }
+ return (IVirtualComponentLabelProvider[]) retList
+ .toArray(new IVirtualComponentLabelProvider[retList.size()]);
+ }
+
+
}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/IVirtualComponentLabelProvider.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/IVirtualComponentLabelProvider.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/IVirtualComponentLabelProvider.java 2009-12-16 05:51:07 UTC (rev 19295)
@@ -0,0 +1,10 @@
+package org.jboss.ide.eclipse.as.wtp.ui.propertypage;
+
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+
+public interface IVirtualComponentLabelProvider {
+ public boolean canHandle(IVirtualComponent component);
+ public String getSourceText(IVirtualComponent component);
+ public Image getSourceImage(IVirtualComponent component);
+}
15 years, 1 month
JBoss Tools SVN: r19294 - branches/jbosstools-3.1.0.RC1/jbpm/releng/org.jboss.tools.jbpm4.releng.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2009-12-15 20:13:32 -0500 (Tue, 15 Dec 2009)
New Revision: 19294
Modified:
branches/jbosstools-3.1.0.RC1/jbpm/releng/org.jboss.tools.jbpm4.releng/build.properties
Log:
switch to Milestone builds
Modified: branches/jbosstools-3.1.0.RC1/jbpm/releng/org.jboss.tools.jbpm4.releng/build.properties
===================================================================
--- branches/jbosstools-3.1.0.RC1/jbpm/releng/org.jboss.tools.jbpm4.releng/build.properties 2009-12-16 01:05:43 UTC (rev 19293)
+++ branches/jbosstools-3.1.0.RC1/jbpm/releng/org.jboss.tools.jbpm4.releng/build.properties 2009-12-16 01:13:32 UTC (rev 19294)
@@ -27,7 +27,7 @@
#http://repository.jboss.org/eclipse/galileo/eclipse-SDK-3.5.1-linux-gtk.tar.gz
repositoryURLs=\
-http://hudson.qa.jboss.com/hudson/view/DevStudio/job/jbosstools-cbi-jbpm3/lastSuccessfulBuild/artifact/build/M-SNAPSHOT/jbpm3-Update-M-SNAPSHOT.zip
+http://hudson.qa.jboss.com/hudson/view/DevStudio/job/jbosstools-cbi-jbpm3-branch/lastSuccessfulBuild/artifact/build/M-SNAPSHOT/jbpm3-Update-M-SNAPSHOT.zip
featureIDsToInstall=org.jboss.tools.jbpm.common.feature,org.jboss.tools.jbpm.common.source.feature
flattenDependencies=true
15 years, 1 month
JBoss Tools SVN: r19293 - branches/jbosstools-3.1.0.RC1/jbpm/releng/org.jboss.tools.jbpm4.releng.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2009-12-15 20:05:43 -0500 (Tue, 15 Dec 2009)
New Revision: 19293
Modified:
branches/jbosstools-3.1.0.RC1/jbpm/releng/org.jboss.tools.jbpm4.releng/build.properties
Log:
switch to Milestone builds
Modified: branches/jbosstools-3.1.0.RC1/jbpm/releng/org.jboss.tools.jbpm4.releng/build.properties
===================================================================
--- branches/jbosstools-3.1.0.RC1/jbpm/releng/org.jboss.tools.jbpm4.releng/build.properties 2009-12-16 00:38:44 UTC (rev 19292)
+++ branches/jbosstools-3.1.0.RC1/jbpm/releng/org.jboss.tools.jbpm4.releng/build.properties 2009-12-16 01:05:43 UTC (rev 19293)
@@ -27,7 +27,7 @@
#http://repository.jboss.org/eclipse/galileo/eclipse-SDK-3.5.1-linux-gtk.tar.gz
repositoryURLs=\
-http://hudson.qa.jboss.com/hudson/view/DevStudio/job/jbosstools-cbi-jbpm3/lastSuccessfulBuild/artifact/build/N-SNAPSHOT/jbpm3-Update-N-SNAPSHOT.zip
+http://hudson.qa.jboss.com/hudson/view/DevStudio/job/jbosstools-cbi-jbpm3/lastSuccessfulBuild/artifact/build/M-SNAPSHOT/jbpm3-Update-M-SNAPSHOT.zip
featureIDsToInstall=org.jboss.tools.jbpm.common.feature,org.jboss.tools.jbpm.common.source.feature
flattenDependencies=true
15 years, 1 month
JBoss Tools SVN: r19292 - in trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui: src/org/jboss/ide/eclipse/as/wtp/ui and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2009-12-15 19:38:44 -0500 (Tue, 15 Dec 2009)
New Revision: 19292
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/icons/folder.gif
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/Messages.java
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/WTPOveridePlugin.java
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/messages.properties
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/AddModuleDependenciesPropertiesPage.java
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/ComponentDependencyContentProvider.java
Log:
Merging in some WTP changes to the page
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/icons/folder.gif
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/icons/folder.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/Messages.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/Messages.java 2009-12-15 23:23:19 UTC (rev 19291)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/Messages.java 2009-12-16 00:38:44 UTC (rev 19292)
@@ -4,6 +4,7 @@
public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.jboss.ide.eclipse.as.wtp.ui.messages"; //$NON-NLS-1$
+ public static String ModuleDependencyDescription;
public static String AddModuleDependenciesPropertiesPage_AddProjectButton;
public static String AddModuleDependenciesPropertiesPage_DeployPathColumn;
public static String AddModuleDependenciesPropertiesPage_RemoveSelectedButton;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/WTPOveridePlugin.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/WTPOveridePlugin.java 2009-12-15 23:23:19 UTC (rev 19291)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/WTPOveridePlugin.java 2009-12-16 00:38:44 UTC (rev 19292)
@@ -1,10 +1,19 @@
package org.jboss.ide.eclipse.as.wtp.ui;
+import java.net.MalformedURLException;
+import java.net.URL;
+
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
/**
@@ -14,10 +23,19 @@
// The plug-in ID
public static final String PLUGIN_ID = "org.jboss.ide.eclipse.as.wtp.ui"; //$NON-NLS-1$
-
+ public static final String[] ICON_DIRS = new String[]{"icons/full/obj16", //$NON-NLS-1$
+ "icons/full/cview16", //$NON-NLS-1$
+ "icons/full/ctool16", //$NON-NLS-1$
+ "icons/full/clcl16", //$NON-NLS-1$
+ "icons/full/ovr16", //$NON-NLS-1$
+ "icons/full/extra", //$NON-NLS-1$
+ "icons/full/wizban", //$NON-NLS-1$
+ "icons", //$NON-NLS-1$
+ ""}; //$NON-NLS-1$
+
// The shared instance
private static WTPOveridePlugin plugin;
-
+
/**
* The constructor
*/
@@ -43,11 +61,58 @@
}
/**
+ * Get a .gif from the image registry.
+ */
+ public Image getImage(String key) {
+ ImageRegistry imageRegistry = getImageRegistry();
+ Image image = imageRegistry.get(key);
+ if (image == null || image.isDisposed()) {
+ ImageDescriptor descriptor = getImageDescriptor(key);
+ if (descriptor != null) {
+ image = descriptor.createImage();
+ imageRegistry.put(key, image);
+ }
+ }
+ return image;
+ }
+
+ /**
+ * This gets a .gif from the icons folder.
+ */
+ public ImageDescriptor getImageDescriptor(String key) {
+ ImageDescriptor imageDescriptor = null;
+ URL gifImageURL = getImageURL(key,getBundle());
+ if (gifImageURL != null)
+ imageDescriptor = ImageDescriptor.createFromURL(gifImageURL);
+ return imageDescriptor;
+ }
+
+ /**
+ * This gets a .gif from the icons folder.
+ */
+ public URL getImageURL(String key, Bundle bundle) {
+ String gif = "/" + key + ".gif"; //$NON-NLS-1$ //$NON-NLS-2$
+ IPath path = null;
+ for (int i = 0; i < ICON_DIRS.length; i++) {
+ path = new Path(ICON_DIRS[i]).append(gif);
+ if (Platform.find(bundle,path) == null)
+ continue;
+ try {
+ return new URL( bundle.getEntry("/"), path.toString()); //$NON-NLS-1$
+ } catch (MalformedURLException exception) {
+ logError(exception);
+ continue;
+ }
+ }
+ return null;
+ }
+
+ /**
* Returns the shared instance
*
* @return the shared instance
*/
- public static WTPOveridePlugin getDefault() {
+ public static WTPOveridePlugin getInstance() {
return plugin;
}
@@ -57,7 +122,7 @@
public static void log(String message, Exception e) {
IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, message, e);
- getDefault().getLog().log(status);
+ getInstance().getLog().log(status);
}
public static IStatus createStatus(int severity, int aCode,
String aMessage, Throwable exception) {
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/messages.properties
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/messages.properties 2009-12-15 23:23:19 UTC (rev 19291)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/messages.properties 2009-12-16 00:38:44 UTC (rev 19292)
@@ -1,3 +1,4 @@
+ModuleDependencyDescription=Adjust the project's module assembly structure
AddModuleDependenciesPropertiesPage_AddProjectButton=Add Project...
AddModuleDependenciesPropertiesPage_DeployPathColumn=Deploy Path
AddModuleDependenciesPropertiesPage_RemoveSelectedButton=Remove selected...
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/AddModuleDependenciesPropertiesPage.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/AddModuleDependenciesPropertiesPage.java 2009-12-15 23:23:19 UTC (rev 19291)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/AddModuleDependenciesPropertiesPage.java 2009-12-16 00:38:44 UTC (rev 19292)
@@ -35,9 +35,11 @@
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ColumnWeightData;
import org.eclipse.jface.viewers.ICellModifier;
+import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.LabelProviderChangedEvent;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.TableLayout;
import org.eclipse.jface.viewers.TableViewer;
@@ -85,7 +87,7 @@
import org.jboss.ide.eclipse.as.wtp.ui.WTPOveridePlugin;
public class AddModuleDependenciesPropertiesPage implements Listener,
- IModuleDependenciesControl {
+ IModuleDependenciesControl, ILabelProviderListener {
private static final String DEPLOY_PATH_PROPERTY = new Integer(0).toString();
private static final String SOURCE_PROPERTY = new Integer(1).toString();
@@ -142,7 +144,7 @@
composite.setLayout(layout);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
ModuleAssemblyRootPage.createDescriptionComposite(composite,
- "TODO Change this: Create and change packaging structure for this project ");
+ Messages.ModuleDependencyDescription);
createListGroup(composite);
refresh();
Dialog.applyDialogFont(parent);
@@ -244,7 +246,7 @@
* Subclasses should over-ride this and extend the class
*/
protected ComponentDependencyContentProvider createProvider() {
- return new ComponentDependencyContentProvider();
+ return new ComponentDependencyContentProvider(this);
}
/*
@@ -970,4 +972,10 @@
return uriMapName;
}
+
+ public void labelProviderChanged(LabelProviderChangedEvent event) {
+ if(!availableComponentsViewer.getTable().isDisposed())
+ availableComponentsViewer.refresh(true);
+ }
+
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/ComponentDependencyContentProvider.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/ComponentDependencyContentProvider.java 2009-12-15 23:23:19 UTC (rev 19291)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/ComponentDependencyContentProvider.java 2009-12-16 00:38:44 UTC (rev 19292)
@@ -18,14 +18,17 @@
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.viewers.DecoratingLabelProvider;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.wst.common.componentcore.internal.ComponentResource;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
import org.eclipse.wst.common.componentcore.internal.resources.VirtualArchiveComponent;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.jboss.ide.eclipse.as.wtp.ui.WTPOveridePlugin;
import org.jboss.ide.eclipse.as.wtp.ui.propertypage.AddModuleDependenciesPropertiesPage.ComponentResourceProxy;
@@ -43,8 +46,13 @@
private HashMap<IVirtualComponent, String> runtimePaths;
private ArrayList<ComponentResourceProxy> resourceMappings;
- public ComponentDependencyContentProvider() {
+ private DecoratingLabelProvider decProvider = new DecoratingLabelProvider(
+ new WorkbenchLabelProvider(), PlatformUI.getWorkbench().
+ getDecoratorManager().getLabelDecorator());
+
+ public ComponentDependencyContentProvider(AddModuleDependenciesPropertiesPage addModuleDependenciesPropertiesPage) {
super();
+ decProvider.addListener(addModuleDependenciesPropertiesPage);
}
public void setRuntimePaths(HashMap<IVirtualComponent, String> paths) {
@@ -66,6 +74,21 @@
}
public Image getColumnImage(Object element, int columnIndex) {
+ if( element instanceof ComponentResourceProxy) {
+ return WTPOveridePlugin.getInstance().getImage("folder");
+ }
+ if (element instanceof IVirtualComponent) {
+ if (columnIndex == 0)
+ return WTPOveridePlugin.getInstance().getImage("jar_obj");
+ else
+ if(((IVirtualComponent)element).isBinary())
+ return WTPOveridePlugin.getInstance().getImage("jar_obj");
+ else return decProvider.getImage(((IVirtualComponent)element).getProject());
+ //return ModuleCoreUIPlugin.getInstance().getImage("prj_obj");
+ }
+ if (element instanceof IProject){
+ return decProvider.getImage(element);
+ }
return null;
}
@@ -84,13 +107,7 @@
}
return runtimePaths.get(element);
} else if (columnIndex == 1) {
- if( comp.isBinary() && comp instanceof VirtualArchiveComponent) {
- IPath p = ((VirtualArchiveComponent)comp).getWorkspaceRelativePath();
- if( p == null )
- p = new Path(((VirtualArchiveComponent)comp).getUnderlyingDiskFile().getAbsolutePath());
- return p.toString();
- }
- return comp.getName();
+ return handleSourceText(comp);
}
} else if (element instanceof IProject){
if (columnIndex == 0) {
@@ -105,6 +122,17 @@
return null;
}
+ private String handleSourceText(IVirtualComponent comp) {
+ if( comp.isBinary() && comp instanceof VirtualArchiveComponent) {
+ IPath p = ((VirtualArchiveComponent)comp).getWorkspaceRelativePath();
+ if( p == null )
+ p = new Path(((VirtualArchiveComponent)comp).getUnderlyingDiskFile().getAbsolutePath());
+ return p.toString();
+ }
+ return comp.getProject().getName();
+ }
+
+
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
}
15 years, 1 month