JBoss Tools SVN: r6603 - in trunk/common/plugins/org.jboss.tools.common.model.ui: META-INF and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-02-27 11:39:00 -0500 (Wed, 27 Feb 2008)
New Revision: 6603
Added:
trunk/common/plugins/org.jboss.tools.common.model.ui/schema/labelDecorator.exsd
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/AttributeDecoratorPart.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/DecoratorManager.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/DecoratorPart.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/NameDecoratorPart.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/XModelObjectDecorator.java
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/META-INF/MANIFEST.MF
trunk/common/plugins/org.jboss.tools.common.model.ui/plugin.xml
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/DefaultXModelObjectLabelProvider.java
Log:
JBIDE-1433 Extention point for decorating label in Web Projects view and tree selectors added
with example extension for TLD file.
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/META-INF/MANIFEST.MF 2008-02-27 12:57:41 UTC (rev 6602)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/META-INF/MANIFEST.MF 2008-02-27 16:39:00 UTC (rev 6603)
@@ -41,6 +41,7 @@
org.jboss.tools.common.model.ui.image,
org.jboss.tools.common.model.ui.messages,
org.jboss.tools.common.model.ui.navigator,
+ org.jboss.tools.common.model.ui.navigator.decorator,
org.jboss.tools.common.model.ui.objecteditor,
org.jboss.tools.common.model.ui.outline,
org.jboss.tools.common.model.ui.preferences,
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/plugin.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/plugin.xml 2008-02-27 12:57:41 UTC (rev 6602)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/plugin.xml 2008-02-27 16:39:00 UTC (rev 6603)
@@ -8,6 +8,7 @@
<extension-point id="paletteConstraints" name="Palette Constraints" schema="schema/paletteConstraints.exsd"/>
<extension-point id="metaTemplates" name="Meta Templates" schema="schema/metaTemplates.exsd"/>
<extension-point id="InsertTagWizard" name="InsertTagWizard" schema="schema/InsertTagWizard.exsd"/>
+ <extension-point id="labelDecorator" name="Model Object Label Decorator" schema="schema/labelDecorator.exsd"/>
<extension point="org.eclipse.ui.elementFactories">
<factory class="org.jboss.tools.common.core.resources.XModelObjectEditorInputFactory" id="org.jboss.tools.common.core.resources.XModelObjectEditorInputFactory">
Added: trunk/common/plugins/org.jboss.tools.common.model.ui/schema/labelDecorator.exsd
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/schema/labelDecorator.exsd (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/schema/labelDecorator.exsd 2008-02-27 16:39:00 UTC (rev 6603)
@@ -0,0 +1,130 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.jboss.tools.common.model.ui">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.jboss.tools.common.model.ui" id="labelDecorator" name="Model Object Label Decorator"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="labelDecorator" minOccurs="0" maxOccurs="unbounded"/>
+ </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="labelDecorator">
+ <complexType>
+ <attribute name="partition" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="entities" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="variables" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="defaultValue" 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>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+</schema>
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/DefaultXModelObjectLabelProvider.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/DefaultXModelObjectLabelProvider.java 2008-02-27 12:57:41 UTC (rev 6602)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/DefaultXModelObjectLabelProvider.java 2008-02-27 16:39:00 UTC (rev 6603)
@@ -15,6 +15,8 @@
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.filesystems.XFileObject;
+import org.jboss.tools.common.model.ui.navigator.decorator.DecoratorManager;
+import org.jboss.tools.common.model.ui.navigator.decorator.XModelObjectDecorator;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
public class DefaultXModelObjectLabelProvider extends LabelProvider {
@@ -28,7 +30,12 @@
if (element != null) {
if (element instanceof XModelObject) {
XModelObject modelObject = (XModelObject)element;
- result = modelObject.getPresentationString();
+ XModelObjectDecorator d = DecoratorManager.getInstance().getDecoratorByEntity(modelObject.getModelEntity().getName());
+ if(d != null) {
+ result = d.getLabel(modelObject);
+ } else {
+ result = modelObject.getPresentationString();
+ }
if(modelObject.getFileType() == XFileObject.FILE && modelObject.isModified()) result += "*";
} else {
result = element.toString();
Added: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/AttributeDecoratorPart.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/AttributeDecoratorPart.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/AttributeDecoratorPart.java 2008-02-27 16:39:00 UTC (rev 6603)
@@ -0,0 +1,16 @@
+package org.jboss.tools.common.model.ui.navigator.decorator;
+
+import org.jboss.tools.common.model.XModelObject;
+
+public class AttributeDecoratorPart extends DecoratorPart {
+
+ public AttributeDecoratorPart(String value) {
+ super(value);
+ }
+
+ public String getLabelPart(XModelObject object) {
+ String v = object.getAttributeValue(value);
+ return v == null ? "{" + value + "}" : v;
+ }
+
+}
Added: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/DecoratorManager.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/DecoratorManager.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/DecoratorManager.java 2008-02-27 16:39:00 UTC (rev 6603)
@@ -0,0 +1,122 @@
+package org.jboss.tools.common.model.ui.navigator.decorator;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.preference.IPersistentPreferenceStore;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.jboss.tools.common.model.ui.ModelUIPlugin;
+
+public class DecoratorManager {
+ private static String EXTENSION_POINT_ID = ModelUIPlugin.PLUGIN_ID + ".labelDecorator";
+
+ private static Object LOCK = new Object();
+ private static DecoratorManager INSTANCE;
+
+ private Map<String, XModelObjectDecorator> mapByName = new HashMap<String, XModelObjectDecorator>();
+ private Map<String, XModelObjectDecorator> mapByEntity = new HashMap<String, XModelObjectDecorator>();
+ private Map<String, Set<XModelObjectDecorator>> mapByPartition = new HashMap<String, Set<XModelObjectDecorator>>();
+
+ private DecoratorManager() {
+ load();
+ }
+
+ public static DecoratorManager getInstance() {
+ if(INSTANCE == null) {
+ synchronized(LOCK) {
+ if(INSTANCE == null) {
+ DecoratorManager d = new DecoratorManager();
+ INSTANCE = d;
+ }
+ }
+ }
+ return INSTANCE;
+ }
+
+ public XModelObjectDecorator getDecoratorByEntity(String entity) {
+ return mapByEntity.get(entity);
+ }
+
+ public Set<XModelObjectDecorator> getDecoratorsByPartition(String partition) {
+ return mapByPartition.get(partition);
+ }
+
+ private void load() {
+ IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(EXTENSION_POINT_ID);
+ if(point == null) return;
+ IExtension[] es = point.getExtensions();
+ if(es != null) for (int i = 0; i < es.length; i++) {
+ IConfigurationElement[] elements = es[i].getConfigurationElements();
+ for (int j = 0; j < elements.length; j++) {
+ XModelObjectDecorator d = new XModelObjectDecorator();
+ d.load(elements[j]);
+ String name = d.getName();
+ String partition = d.getPartition();
+ Set<String> entities = d.getEntities();
+ mapByName.put(name, d);
+ Set<XModelObjectDecorator> set = mapByPartition.get(partition);
+ if(set == null) {
+ set = new HashSet<XModelObjectDecorator>();
+ mapByPartition.put(partition, set);
+ }
+ set.add(d);
+ for (String entity: entities) {
+ mapByEntity.put(entity, d);
+ }
+ }
+ }
+ loadFromPreferences();
+ }
+
+ public void loadFromPreferences() {
+ IPreferenceStore p = getPreferences();
+ for (String name: mapByName.keySet()) {
+ XModelObjectDecorator d = mapByName.get(name);
+ String key = ModelUIPlugin.PLUGIN_ID + ".labelDecorator." + name;
+ String value = p.getString(key);
+ if(value != null && value.length() > 0) {
+ d.setValue(value);
+ }
+ }
+ }
+
+ public void applyToPreferences() {
+ IPreferenceStore p = getPreferences();
+ for (String name: mapByName.keySet()) {
+ XModelObjectDecorator d = mapByName.get(name);
+ String key = ModelUIPlugin.PLUGIN_ID + ".labelDecorator." + name;
+ String value = d.getValue();
+ if(value != null && !value.equals(d.getDefaultValue()) && !value.equals("{name}")) {
+ p.setValue(key, value);
+ } else {
+ p.setValue(key, "");
+ }
+ }
+ if(p instanceof IPersistentPreferenceStore) {
+ try {
+ ((IPersistentPreferenceStore) p).save();
+ } catch (IOException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ }
+ }
+ }
+
+ public void setDefaults() {
+ for (String name: mapByName.keySet()) {
+ XModelObjectDecorator d = mapByName.get(name);
+ d.setValue(d.getDefaultValue());
+ }
+ }
+
+ public static IPreferenceStore getPreferences() {
+ return ModelUIPlugin.getDefault().getPreferenceStore();
+ }
+
+}
Added: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/DecoratorPart.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/DecoratorPart.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/DecoratorPart.java 2008-02-27 16:39:00 UTC (rev 6603)
@@ -0,0 +1,16 @@
+package org.jboss.tools.common.model.ui.navigator.decorator;
+
+import org.jboss.tools.common.model.XModelObject;
+
+public class DecoratorPart {
+ String value;
+
+ public DecoratorPart(String value) {
+ this.value = value;
+ }
+
+ public String getLabelPart(XModelObject object) {
+ return value == null ? "" : value;
+ }
+
+}
Added: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/NameDecoratorPart.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/NameDecoratorPart.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/NameDecoratorPart.java 2008-02-27 16:39:00 UTC (rev 6603)
@@ -0,0 +1,15 @@
+package org.jboss.tools.common.model.ui.navigator.decorator;
+
+import org.jboss.tools.common.model.XModelObject;
+
+public class NameDecoratorPart extends DecoratorPart {
+
+ public NameDecoratorPart() {
+ super("name");
+ }
+
+ public String getLabelPart(XModelObject object) {
+ return "" + object.getPresentationString();
+ }
+
+}
Added: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/XModelObjectDecorator.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/XModelObjectDecorator.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/XModelObjectDecorator.java 2008-02-27 16:39:00 UTC (rev 6603)
@@ -0,0 +1,127 @@
+package org.jboss.tools.common.model.ui.navigator.decorator;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.jboss.tools.common.model.XModelObject;
+
+public class XModelObjectDecorator {
+ static String ATTR_NAME = "name";
+ static String ATTR_PARTITION= "partition";
+ static String ATTR_ENTITIES = "entities";
+ static String ATTR_VARIABLES = "variables";
+ static String ATTR_DEFAULT = "defaultValue";
+
+
+ String name;
+ String partition;
+ Set<String> entities = new HashSet<String>();
+ String[] variables = new String[0];
+ String defaultValue;
+ String value;
+
+ List<DecoratorPart> parts = null;
+
+ public XModelObjectDecorator() {}
+
+ public String getName() {
+ return name;
+ }
+
+ public String getPartition() {
+ return partition;
+ }
+
+ public Set<String> getEntities() {
+ return entities;
+ }
+
+ public String[] getVariables() {
+ return variables;
+ }
+
+ public String getDefaultValue() {
+ return defaultValue;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ if(value != null && value.equals(this.value)) {
+ return;
+ }
+ this.value = value;
+ if(value == null || value.length() == 0) {
+ value = "{name}";
+ }
+ parts = null;
+ }
+
+ void load(IConfigurationElement element) {
+ name = element.getAttribute(ATTR_NAME);
+ partition = element.getAttribute(ATTR_PARTITION);
+ defaultValue = element.getAttribute(ATTR_DEFAULT);
+ setValue(defaultValue);
+ value = defaultValue;
+ String s = element.getAttribute(ATTR_ENTITIES);
+ if(s != null) {
+ String[] es = s.split(",");
+ for (int i = 0; i < es.length; i++) entities.add(es[i]);
+ }
+ s = element.getAttribute(ATTR_VARIABLES);
+ List<String> vs = new ArrayList<String>();
+ vs.add("name");
+ if(s != null) {
+ String[] es = s.split(",");
+ for (int i = 0; i < es.length; i++) vs.add(es[i]);
+ }
+ variables = vs.toArray(new String[0]);
+ }
+
+ List<DecoratorPart> compile() {
+ if(this.parts != null) return this.parts;
+ List<DecoratorPart> parts = new ArrayList<DecoratorPart>();
+ String v = value;
+ if(value == null || value.length() == 0) v = defaultValue;
+ if(v == null) v = "";
+ if(v.indexOf("{name}") < 0) {
+ if(v.length() > 0) v += " ";
+ v += "{name}";
+ }
+ StringTokenizer s = new StringTokenizer(v, "{}", true);
+ boolean inVariable = false;
+ while(s.hasMoreTokens()) {
+ String t = s.nextToken();
+ if(t.equals("{")) {
+ inVariable = true;
+ } else if(t.equals("}")) {
+ inVariable = false;
+ } else if(inVariable) {
+ if(t.equals("name")) {
+ parts.add(new NameDecoratorPart());
+ } else {
+ parts.add(new AttributeDecoratorPart(t));
+ }
+ } else {
+ parts.add(new DecoratorPart(t));
+ }
+ }
+ return this.parts = parts;
+ }
+
+ public String getLabel(XModelObject object) {
+ List<DecoratorPart> parts = compile();
+ StringBuffer sb = new StringBuffer();
+ for (DecoratorPart d: parts) {
+ sb.append(d.getLabelPart(object));
+ }
+ return sb.toString();
+ }
+
+}
16 years, 10 months
JBoss Tools SVN: r6602 - trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template.
by jbosstools-commits@lists.jboss.org
Author: sdzmitrovich
Date: 2008-02-27 07:57:41 -0500 (Wed, 27 Feb 2008)
New Revision: 6602
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/EditableTemplateAdapter.java
Log:
was added new attributes editing mechanism
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/EditableTemplateAdapter.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/EditableTemplateAdapter.java 2008-02-27 12:13:39 UTC (rev 6601)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/EditableTemplateAdapter.java 2008-02-27 12:57:41 UTC (rev 6602)
@@ -208,8 +208,7 @@
}
/**
- * Default handling of a pressing the "page up" event -
- * always return false.
+ * Default handling of a pressing the "page up" event - always return false.
*
* Override this method for a handling of a pressing the "page up" event
*
@@ -310,7 +309,7 @@
}
/**
- * Default handling of a pressing the "backspace" event
+ * Default handling of a pressing the "backspace" event
*
* Override this method to handle the "backspace" event
*
@@ -657,8 +656,8 @@
for (VpeNodeMapping mapping : attributesMapping) {
- if ((offset > getStartOffsetNode(mapping.getSourceNode()))
- && (offset < getEndOffsetNode(mapping.getSourceNode())))
+ if ((offset > (getStartOffsetNode(mapping.getSourceNode()) + 1))
+ && (offset < (getEndOffsetNode(mapping.getSourceNode()) - 1)))
return mapping.getSourceNode();
}
}
16 years, 10 months
JBoss Tools SVN: r6601 - trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-02-27 07:13:39 -0500 (Wed, 27 Feb 2008)
New Revision: 6601
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/DefaultWizardDataValidator.java
Log:
Small fix for validating multi-paged creation wizard data, -
name uniqueness check by default is to be restricted with the first page.
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/DefaultWizardDataValidator.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/DefaultWizardDataValidator.java 2008-02-27 12:10:38 UTC (rev 6600)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/DefaultWizardDataValidator.java 2008-02-27 12:13:39 UTC (rev 6601)
@@ -39,7 +39,7 @@
XEntityData[] ds = support.getEntityData();
if(ds.length <= step) return;
if(support.action != null) {
- if("true".equals(support.action.getProperty("validator.add"))) {
+ if("true".equals(support.action.getProperty("validator.add")) && step == 0) {
String entity = support.action.getProperty("entity");
if(entity == null) entity = ds[step].getModelEntity().getName();
if(!checkChild(support.getTarget(), entity, data)) return;
16 years, 10 months
JBoss Tools SVN: r6600 - trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/handlers.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-02-27 07:10:38 -0500 (Wed, 27 Feb 2008)
New Revision: 6600
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/handlers/CreateJSPFileSupport.java
Log:
JBIDE-1780 Redundant line removed
Modified: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/handlers/CreateJSPFileSupport.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/handlers/CreateJSPFileSupport.java 2008-02-27 12:06:40 UTC (rev 6599)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/handlers/CreateJSPFileSupport.java 2008-02-27 12:10:38 UTC (rev 6600)
@@ -191,7 +191,6 @@
protected String modifyBody(String body) throws IOException {
if(getEntityData().length < 2 || taglibs == null) return body;
- if(taglibs == null) return body;
if(getStepId() == 0) initSelectedTaglibs();
String ts = getAttributeValue(1, "taglibs");
String[] selected = toArray(ts);
16 years, 10 months
JBoss Tools SVN: r6599 - trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/operation.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-02-27 07:06:40 -0500 (Wed, 27 Feb 2008)
New Revision: 6599
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/operation/WebNatureOperation.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/operation/WebProjectAdoptOperation.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/operation/WebProjectCreationOperation.java
Log:
JBIDE-1714
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/operation/WebNatureOperation.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/operation/WebNatureOperation.java 2008-02-27 12:06:29 UTC (rev 6598)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/operation/WebNatureOperation.java 2008-02-27 12:06:40 UTC (rev 6599)
@@ -22,7 +22,6 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -30,7 +29,6 @@
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
@@ -44,18 +42,13 @@
import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties.FacetDataModelMap;
import org.eclipse.wst.common.componentcore.internal.operation.FacetProjectCreationOperation;
-import org.eclipse.wst.common.componentcore.internal.util.ComponentUtilities;
import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.frameworks.internal.operations.IProjectCreationPropertiesNew;
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.eclipse.wst.common.project.facet.core.runtime.RuntimeManager;
-import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.ServerCore;
-import org.eclipse.wst.server.core.ServerUtil;
import org.osgi.framework.Bundle;
import org.jboss.tools.common.meta.action.SpecialWizard;
@@ -224,18 +217,24 @@
createLockFile();
monitor.worked(1);
// create Red Hat Web Nature
- createWebNature();
+ preCreateWebNature();
+// createWebNature();
monitor.worked(4);
// create Java Nature
- createJavaNature(); // create java nature now migrate into create WTP nature @see createWTPNature()
+ JavaCore.create(getProject());
+// createJavaNature(); // create java nature now migrate into create WTP nature @see createWTPNature()
monitor.worked(3);
// update version of FileSystem object
- updateVersion();
+// updateVersion();
monitor.worked(1);
// refresh project resource
getProject().refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
monitor.worked(3);
// update model
+ createWebNature();
+ updateJavaNature(); // create java nature now migrate into create WTP nature @see createWTPNature()
+ updateVersion();
+
model.update();
monitor.worked(2);
model.save();
@@ -245,6 +244,8 @@
// register application
registerServer2(monitor);
///registerServer(monitor);
+
+ postCreateWebNature();
} catch (CoreException e) {
WebModelPlugin.getPluginLog().logError(e);
} finally {
@@ -254,11 +255,6 @@
}
- protected boolean isMultipleModulesProject() {
- // Commented for migration to new WTP
- return false; //FlexibleJavaProjectPreferenceUtil.getMultipleModulesPerProjectProp();
- }
-
protected String[] dotFilesList = {
".classpath", ".project", IModelNature.PROJECT_FILE, ".runtime", ".wtpmodules", ".settings"
};
@@ -316,7 +312,9 @@
}
protected abstract String getNatureID();
+ protected abstract void preCreateWebNature() throws CoreException;
protected abstract void createWebNature() throws CoreException;
+ protected abstract void postCreateWebNature();
/*
*
@@ -349,8 +347,8 @@
/*
*
*/
- private void createJavaNature() throws CoreException {
- JavaCore.create(getProject());
+ private void updateJavaNature() throws CoreException {
+// JavaCore.create(getProject());
EclipseResourceUtil.addNatureToProject(getProject(), JavaCore.NATURE_ID);
try {
SpecialWizard w = SpecialWizardFactory.createSpecialWizard("org.jboss.tools.common.model.project.ClassPathUpdateWizard");
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/operation/WebProjectAdoptOperation.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/operation/WebProjectAdoptOperation.java 2008-02-27 12:06:29 UTC (rev 6598)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/operation/WebProjectAdoptOperation.java 2008-02-27 12:06:40 UTC (rev 6599)
@@ -67,9 +67,14 @@
return false;
}
- protected void createWebNature() throws CoreException {
+ protected void preCreateWebNature() throws CoreException {
setWorkspaceHome(getProperty(WebNatureOperation.WEB_INF_LOCATION_ID));
copyLibraries();
+ }
+
+ protected void createWebNature() throws CoreException {
+// setWorkspaceHome(getProperty(WebNatureOperation.WEB_INF_LOCATION_ID));
+// copyLibraries();
EclipseResourceUtil.addNatureToProject(getProject(), getNatureID());
IModelNature nature = (IModelNature)getProject().getNature(getNatureID());
model = nature.getModel(); // model is XModel
@@ -83,6 +88,10 @@
}
}
+ protected void postCreateWebNature() {
+
+ }
+
protected void copyLibraries() {}
protected String getDefaultServletVersion() {
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/operation/WebProjectCreationOperation.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/operation/WebProjectCreationOperation.java 2008-02-27 12:06:29 UTC (rev 6598)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/operation/WebProjectCreationOperation.java 2008-02-27 12:06:40 UTC (rev 6599)
@@ -65,7 +65,7 @@
protected abstract IWebProjectTemplate createTemplate();
protected abstract void copyTemplate() throws Exception;
- protected void createWebNature() throws CoreException {
+ protected void preCreateWebNature() throws CoreException {
Properties properties = this.getWizardPropertiesAsIs();
properties.setProperty(NewWebProjectContext.ATTR_LOCATION, getProject().getLocation().toString());
try {
@@ -78,6 +78,21 @@
throw new CoreException(new Status(IStatus.ERROR, ModelUIPlugin.PLUGIN_ID, 1, message, e));
}
copyProjectFile(properties);
+ }
+
+ protected void createWebNature() throws CoreException {
+ Properties properties = this.getWizardPropertiesAsIs();
+ properties.setProperty(NewWebProjectContext.ATTR_LOCATION, getProject().getLocation().toString());
+// try {
+// createTemplateModel();
+// copyTemplate();
+// } catch (Exception e) {
+// WebUiPlugin.getPluginLog().logError(e);
+// String message = e.getMessage();
+// if(message == null || message.length() == 0) message = e.getClass().getName();
+// throw new CoreException(new Status(IStatus.ERROR, ModelUIPlugin.PLUGIN_ID, 1, message, e));
+// }
+// copyProjectFile(properties);
EclipseResourceUtil.addNatureToProject(getProject(), getNatureID());
IModelNature strutsProject = (IModelNature)getProject().getNature(getNatureID());
model = strutsProject.getModel();
@@ -95,6 +110,12 @@
}
}
+ protected void postCreateWebNature() {
+
+ }
+
+ protected File projectFile = null;
+
protected void copyProjectFile(Properties p) {
String templateFolder = template.getProjectTemplatesLocation(
getProperty(TEMPLATE_VERSION_ID)) + "/" +
@@ -103,33 +124,12 @@
String tf = p.getProperty(NewWebProjectContext.ATTR_LOCATION) + "/" + IModelNature.PROJECT_FILE;
if(sf.exists()) {
FileUtil.copyFile(sf, new File(tf), true);
+ projectFile = new File(tf);
} else {
throw new RuntimeException("Project template must have model configuration file");
}
-///for wtp Dynamic Project
- adjustProjectFile(new File(tf));
}
- private void adjustProjectFile(File f) {
- if(!isMultipleModulesProject()) return;
-
- String text = FileUtil.readFile(f);
- if(text == null || text.length() == 0) return;
- String match = "\"./WebContent/WEB-INF\"";
- int i = text.indexOf(match);
- if(i >= 0) {
- text = text.substring(0, i) + "\"./" + getProject().getName() + "/WebContent/WEB-INF\"" + text.substring(i + match.length());
- }
-
- match = XModelConstants.WORKSPACE_REF + "/classes";
- i = text.indexOf(match);
- if(i >= 0) {
- String replace = XModelConstants.WORKSPACE_REF + "/../../../.deployables/" + getProject().getName() + "/WEB-INF/classes";
- text = text.substring(0, i) + replace + text.substring(i + match.length());
- }
-
- FileUtil.writeFile(f, text);
- }
-
+
protected void createTemplateModel() throws Exception {
if(templateModel != null) return;
String templateLocation = getTemplateLocation();
16 years, 10 months
JBoss Tools SVN: r6598 - trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/operation.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-02-27 07:06:29 -0500 (Wed, 27 Feb 2008)
New Revision: 6598
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/operation/JSFProjectAdoptOperation.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/operation/JSFProjectCreationOperation.java
Log:
JBIDE-1714
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/operation/JSFProjectAdoptOperation.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/operation/JSFProjectAdoptOperation.java 2008-02-27 12:06:22 UTC (rev 6597)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/operation/JSFProjectAdoptOperation.java 2008-02-27 12:06:29 UTC (rev 6598)
@@ -12,8 +12,12 @@
import java.io.File;
+import org.jboss.tools.common.model.XModelConstants;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.project.IModelNature;
import org.jboss.tools.common.util.FileUtil;
import org.jboss.tools.jsf.JSFPreference;
+import org.jboss.tools.jsf.project.JSFAutoLoad;
import org.jboss.tools.jsf.project.JSFNature;
import org.jboss.tools.jsf.web.JSFTemplate;
import org.jboss.tools.jsf.web.helpers.context.AdoptJSFProjectFinisher;
@@ -49,6 +53,21 @@
}
}
+ protected void postCreateWebNature() {
+ File f = getEclipseFile();
+ if(f != null) {
+ f.delete();
+ }
+ model.getProperties().put(XModelConstants.AUTOLOAD, new JSFAutoLoad());
+ }
+
+ private File getEclipseFile() {
+ String fn = getProject().getLocation().toString() + "/" + IModelNature.PROJECT_FILE;
+ File f = new File(fn);
+ if(f.exists()) return f;
+ return null;
+ }
+
protected String getNatureID() {
return JSFNature.NATURE_ID;
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/operation/JSFProjectCreationOperation.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/operation/JSFProjectCreationOperation.java 2008-02-27 12:06:22 UTC (rev 6597)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/operation/JSFProjectCreationOperation.java 2008-02-27 12:06:29 UTC (rev 6598)
@@ -21,10 +21,12 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.jboss.tools.common.model.XModelConstants;
import org.jboss.tools.common.model.filesystems.FileSystemsHelper;
import org.jboss.tools.common.model.filesystems.impl.FileSystemImpl;
import org.jboss.tools.common.model.project.IModelNature;
import org.jboss.tools.common.util.FileUtil;
+import org.jboss.tools.jsf.project.JSFAutoLoad;
import org.jboss.tools.jsf.project.JSFNature;
import org.jboss.tools.jsf.web.JSFTemplate;
import org.jboss.tools.jst.web.WebUtils;
@@ -63,9 +65,7 @@
protected void copyTemplate() throws Exception {
String location = getProject().getLocation().toString();
String location2 = location;
- if(isMultipleModulesProject()) {
- location2 += "/" + getProject().getName();
- }
+
String templateLocation = getTemplateLocation();
String version = getProperty(TEMPLATE_VERSION_ID);
@@ -117,4 +117,13 @@
if(f.exists()) return f;
return null;
}
+
+ protected void postCreateWebNature() {
+ if(projectFile != null) {
+ if(projectFile.isFile()) projectFile.delete();
+ projectFile = null;
+ }
+ model.getProperties().put(XModelConstants.AUTOLOAD, new JSFAutoLoad());
+ }
+
}
16 years, 10 months
JBoss Tools SVN: r6597 - trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-02-27 07:06:22 -0500 (Wed, 27 Feb 2008)
New Revision: 6597
Added:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/JSFAutoLoad.java
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/JSFNature.java
Log:
JBIDE-1714
Added: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/JSFAutoLoad.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/JSFAutoLoad.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/JSFAutoLoad.java 2008-02-27 12:06:22 UTC (rev 6597)
@@ -0,0 +1,51 @@
+package org.jboss.tools.jsf.project;
+
+import java.util.Properties;
+
+import org.eclipse.core.resources.IProject;
+import org.jboss.tools.common.model.XModel;
+import org.jboss.tools.common.model.XModelConstants;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.filesystems.FileSystemsHelper;
+import org.jboss.tools.common.model.filesystems.impl.FileSystemImpl;
+import org.jboss.tools.common.model.project.IAutoLoad;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+
+public class JSFAutoLoad implements IAutoLoad {
+
+ public void load(XModel model) {
+ Properties properties = null;
+ XModelObject fs = FileSystemsHelper.getFileSystems(model);
+ IProject project = EclipseResourceUtil.getProject(fs);
+ if(project == null) return;
+
+ fs.setAttributeValue("application name", project.getName());
+
+ String fsLoc = null;
+ FileSystemImpl s = null;
+ properties = new Properties();
+
+ fsLoc = project.getLocation().toString();
+ properties.setProperty("location", fsLoc);
+ properties.setProperty("name", project.getName());
+ s = (FileSystemImpl)model.createModelObject("FileSystemFolder", properties);
+ fs.addChild(s);
+
+ XModelObject webinf = model.createModelObject("FileSystemFolder", null); //$NON-NLS-1$
+ webinf.setAttributeValue("name", "WEB-INF"); //$NON-NLS-1$ //$NON-NLS-2$
+ webinf.setAttributeValue("location", XModelConstants.WORKSPACE_REF); //$NON-NLS-1$
+ fs.addChild(webinf);
+
+ XModelObject webroot = model.createModelObject("FileSystemFolder", null); //$NON-NLS-1$
+ webroot.setAttributeValue("name", "WEB-ROOT"); //$NON-NLS-1$ //$NON-NLS-2$
+ webroot.setAttributeValue("location", XModelConstants.WORKSPACE_REF + "/.."); //$NON-NLS-1$ //$NON-NLS-2$
+ fs.addChild(webroot);
+
+ XModelObject lib = model.createModelObject("FileSystemFolder", null); //$NON-NLS-1$
+ lib.setAttributeValue("name", "lib"); //$NON-NLS-1$ //$NON-NLS-2$
+ lib.setAttributeValue("location", XModelConstants.WORKSPACE_REF + "/lib"); //$NON-NLS-1$ //$NON-NLS-2$
+ fs.addChild(lib);
+
+ }
+
+}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/JSFNature.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/JSFNature.java 2008-02-27 12:06:14 UTC (rev 6596)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/JSFNature.java 2008-02-27 12:06:22 UTC (rev 6597)
@@ -13,6 +13,7 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
+import org.jboss.tools.common.model.project.IAutoLoad;
import org.jboss.tools.common.model.project.ModelNature;
import org.jboss.tools.jsf.JSFModelPlugin;
@@ -34,6 +35,10 @@
return false;
}
}
+
+ protected IAutoLoad createAutoLoad() {
+ return new JSFAutoLoad();
+ }
public void configure() throws CoreException {
super.configure();
16 years, 10 months
JBoss Tools SVN: r6596 - trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/operation.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-02-27 07:06:14 -0500 (Wed, 27 Feb 2008)
New Revision: 6596
Modified:
trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/operation/StrutsProjectCreationOperation.java
Log:
JBIDE-1714
Modified: trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/operation/StrutsProjectCreationOperation.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/operation/StrutsProjectCreationOperation.java 2008-02-27 12:03:20 UTC (rev 6595)
+++ trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/operation/StrutsProjectCreationOperation.java 2008-02-27 12:06:14 UTC (rev 6596)
@@ -70,9 +70,7 @@
protected void copyTemplate() throws Exception {
String location = getProject().getLocation().toString();
String location2 = location;
- if(isMultipleModulesProject()) {
- location2 += "/" + getProject().getName();
- }
+
String templateLocation = getTemplateLocation();
String version = getProperty(WebNatureOperation.TEMPLATE_VERSION_ID);
16 years, 10 months
JBoss Tools SVN: r6595 - in trunk/common/plugins/org.jboss.tools.common.model: src/org/jboss/tools/common/model and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-02-27 07:03:20 -0500 (Wed, 27 Feb 2008)
New Revision: 6595
Added:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/IAutoLoad.java
Modified:
trunk/common/plugins/org.jboss.tools.common.model/META-INF/MANIFEST.MF
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/XModelConstants.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsLoader.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ModelNature.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ProjectHome.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseResourceUtil.java
Log:
JBIDE-1714
Modified: trunk/common/plugins/org.jboss.tools.common.model/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/META-INF/MANIFEST.MF 2008-02-27 11:39:26 UTC (rev 6594)
+++ trunk/common/plugins/org.jboss.tools.common.model/META-INF/MANIFEST.MF 2008-02-27 12:03:20 UTC (rev 6595)
@@ -80,6 +80,7 @@
org.eclipse.ltk.core.refactoring,
org.eclipse.ltk.ui.refactoring,
org.eclipse.wst.common.uriresolver,
+ org.eclipse.wst.common.modulecore,
org.eclipse.core.resources;visibility:=reexport,
org.eclipse.core.runtime;visibility:=reexport
Bundle-Version: 2.0.0
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/XModelConstants.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/XModelConstants.java 2008-02-27 11:39:26 UTC (rev 6594)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/XModelConstants.java 2008-02-27 12:03:20 UTC (rev 6595)
@@ -25,6 +25,8 @@
public static String XMODEL_ENTITY_ATTR = "model-entity";
public static String XMODEL_ENTITY_ATTR_OLD = "ENTITY";
+
+ public static String AUTOLOAD = "autoload";
private XModelConstants() {}
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsLoader.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsLoader.java 2008-02-27 11:39:26 UTC (rev 6594)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsLoader.java 2008-02-27 12:03:20 UTC (rev 6595)
@@ -22,6 +22,7 @@
import org.jboss.tools.common.model.loaders.*;
import org.jboss.tools.common.model.loaders.impl.*;
import org.jboss.tools.common.model.plugin.ModelPlugin;
+import org.jboss.tools.common.model.project.IAutoLoad;
import org.jboss.tools.common.model.project.IModelNature;
import org.jboss.tools.common.model.util.*;
import org.jboss.tools.common.model.project.WatcherLoader;
@@ -39,6 +40,11 @@
public boolean save(XModelObject object) {
if(!fsutil.isModified(object)) return true;
+
+ if(object.getModel().getProperties().get(XModelConstants.AUTOLOAD) != null) {
+ return true;
+ }
+
String s = getEclipseFileName(object, false);
boolean b = (s == null) ? super.save(object.copy(1)) :
saveEclipse(object.copy(1));
@@ -71,6 +77,20 @@
public void load(XModelObject object) {
if(EclipseResourceUtil.isProjectFragment(object.getModel())) return;
+
+ IAutoLoad auto = (IAutoLoad)object.getModel().getProperties().get(XModelConstants.AUTOLOAD);
+ if(auto != null) {
+ auto.load(object.getModel());
+ updateLibs(object);
+ _updateSrcs(object);
+ try {
+ ((FileSystemsImpl)object).updateOverlapped();
+ } catch (Exception e) {
+ ModelPlugin.getPluginLog().logError(e);
+ }
+ return;
+ }
+
String f = getEclipseFileName(object, true);
if(f == null) super.load(object);
else util().load(new File(f), object);
@@ -219,11 +239,16 @@
}
return lib;
}
-
+
public void updateSrcs(XModelObject object) {
- if(WatcherLoader.isLocked(object.getModel())) {
+ IAutoLoad auto = (IAutoLoad)object.getModel().getProperties().get(XModelConstants.AUTOLOAD);
+ if(auto == null && WatcherLoader.isLocked(object.getModel())) {
return;
}
+ _updateSrcs(object);
+ }
+
+ private void _updateSrcs(XModelObject object) {
IProject p = EclipseResourceUtil.getProject(object);
if(p == null || !p.isAccessible()) return;
String[] srcs = EclipseResourceUtil.getJavaProjectSrcLocations(p);
Added: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/IAutoLoad.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/IAutoLoad.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/IAutoLoad.java 2008-02-27 12:03:20 UTC (rev 6595)
@@ -0,0 +1,9 @@
+package org.jboss.tools.common.model.project;
+
+import org.jboss.tools.common.model.XModel;
+
+public interface IAutoLoad {
+
+ public void load(XModel model);
+
+}
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ModelNature.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ModelNature.java 2008-02-27 11:39:26 UTC (rev 6594)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ModelNature.java 2008-02-27 12:03:20 UTC (rev 6595)
@@ -96,8 +96,21 @@
}
Properties p = new Properties();
p.putAll(System.getProperties());
- p.setProperty(XModelConstants.WORKSPACE, getWorkspaceHome());
- p.setProperty(XModelConstants.WORKSPACE_OLD, getWorkspaceHome());
+
+ String home = getWorkspaceHome();
+ if(home != null && home.length() > 0) {
+ p.setProperty(XModelConstants.WORKSPACE, home);
+ p.setProperty(XModelConstants.WORKSPACE_OLD, home);
+ } else {
+ IAutoLoad auto = createAutoLoad();
+ boolean result = auto != null && ProjectHome.getLocation(project, p);
+ if(result) {
+ p.put(XModelConstants.AUTOLOAD, auto);
+ } else {
+ p.setProperty(XModelConstants.WORKSPACE, "");
+ p.setProperty(XModelConstants.WORKSPACE_OLD, "");
+ }
+ }
p.setProperty(ECLIPSE_PROJECT, project.getLocation().toString());
p.setProperty(ECLIPSE_PROJECT_OLD, project.getLocation().toString());
p.put("project", project);
@@ -116,6 +129,10 @@
updateListener();
}
+ protected IAutoLoad createAutoLoad() {
+ return null;
+ }
+
protected void addToBuildSpec(String builderID) throws CoreException {
IProjectDescription description = getProject().getDescription();
ICommand command = null;
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ProjectHome.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ProjectHome.java 2008-02-27 11:39:26 UTC (rev 6594)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ProjectHome.java 2008-02-27 12:03:20 UTC (rev 6595)
@@ -11,8 +11,18 @@
package org.jboss.tools.common.model.project;
import java.io.File;
+import java.util.Properties;
+
+import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
+import org.jboss.tools.common.model.XModelConstants;
import org.jboss.tools.common.model.plugin.ModelPlugin;
import org.jboss.tools.common.model.util.*;
import org.w3c.dom.Element;
@@ -63,4 +73,31 @@
return q;
}
+ ////
+
+ public static boolean getLocation(IProject project, Properties p) {
+ IPath webInfPath = null;
+
+ if(ComponentCore.createComponent(project)!=null) {
+ webInfPath = getWebInfPath(project);
+ }
+
+ if(webInfPath == null) return false;
+
+ IFolder webInfFolder = ResourcesPlugin.getWorkspace().getRoot().getFolder(webInfPath);
+
+ p.setProperty(XModelConstants.WORKSPACE, webInfFolder.getLocation().toString());
+ p.setProperty(XModelConstants.WORKSPACE_OLD, webInfFolder.getLocation().toString());
+
+ return true;
+ }
+
+ //Taken from J2EEUtils and modified
+ public static IPath getWebInfPath(IProject project) {
+ IVirtualComponent component = ComponentCore.createComponent(project);
+ IVirtualFolder webInfDir = component.getRootFolder().getFolder(new Path("/WEB-INF"));
+ IPath modulePath = webInfDir.getWorkspaceRelativePath();
+ return (!webInfDir.exists()) ? null : modulePath;
+ }
+
}
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseResourceUtil.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseResourceUtil.java 2008-02-27 11:39:26 UTC (rev 6594)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseResourceUtil.java 2008-02-27 12:03:20 UTC (rev 6595)
@@ -28,6 +28,7 @@
import org.jboss.tools.common.meta.action.XActionInvoker;
import org.jboss.tools.common.model.*;
+import org.jboss.tools.common.model.filesystems.FileSystemsHelper;
import org.jboss.tools.common.model.filesystems.XFileObject;
import org.jboss.tools.common.model.filesystems.impl.*;
import org.jboss.tools.common.model.icons.impl.*;
@@ -95,7 +96,7 @@
if(resource == null) return null;
IPath path = resource.getLocation();
if (model != null) {
- FileSystemsImpl fso = (FileSystemsImpl)model.getByPath("FileSystems");
+ FileSystemsImpl fso = (FileSystemsImpl)FileSystemsHelper.getFileSystems(model);
if(fso == null) return null;
fso.updateOverlapped();
XModelObject[] fs = fso.getChildren("FileSystemFolder");
@@ -124,7 +125,7 @@
}
public static XModelObject findFileSystem(IResource resource, XModel model) {
- XModelObject fss = model.getByPath("FileSystems");
+ XModelObject fss = FileSystemsHelper.getFileSystems(model);
if(fss == null) return null;
XModelObject[] fs = fss.getChildren();
XModelObject result = null;
@@ -146,7 +147,7 @@
}
public static XModelObject addFileSystem(IResource resource, XModel model) {
- XModelObject fss = model.getByPath("FileSystems");
+ XModelObject fss = FileSystemsHelper.getFileSystems(model);
if(fss == null) return null;
while(resource != null && resource != resource.getProject() && resource.getParent() != null && resource.getParent() != resource.getProject()) {
resource = resource.getParent();
@@ -276,7 +277,7 @@
XModel model = models.get(project);
if(model != null) {
- validateJarSystem(model.getByPath("FileSystems"), resource);
+ validateJarSystem(FileSystemsHelper.getFileSystems(model), resource);
return getObjectByResource(model, resource);
}
@@ -294,7 +295,7 @@
model = XModelFactory.getModel(properties);
models.put(project, model);
- XModelObject fs = model.getByPath("FileSystems");
+ XModelObject fs = FileSystemsHelper.getFileSystems(model);
if(fs == null) {
ModelPlugin.getPluginLog().logInfo("Cannot create file systems for project " + project);
return null;
@@ -392,7 +393,7 @@
properties.setProperty(XModelConstants.WORKSPACE, f.getParent());
properties.put("isProjectFragment", "true");
XModel model = XModelFactory.getModel(properties);
- XModelObject fs = model.getByPath("FileSystems");
+ XModelObject fs = FileSystemsHelper.getFileSystems(model);
if(fs == null) {
ModelPlugin.getPluginLog().logInfo("Cannot create file systems for model at " + location);
return null;
16 years, 10 months
JBoss Tools SVN: r6594 - trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test.
by jbosstools-commits@lists.jboss.org
Author: sdzmitrovich
Date: 2008-02-27 06:39:26 -0500 (Wed, 27 Feb 2008)
New Revision: 6594
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesAllTests.java
Log:
replace junit for 1548 from jsf test to richfaces test
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesAllTests.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesAllTests.java 2008-02-27 11:38:19 UTC (rev 6593)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesAllTests.java 2008-02-27 11:39:26 UTC (rev 6594)
@@ -15,8 +15,10 @@
import junit.framework.Test;
import junit.framework.TestSuite;
+
import org.jboss.tools.jsf.vpe.richfaces.test.jbide.JBIDE1579Test;
import org.jboss.tools.jsf.vpe.richfaces.test.jbide.JBIDE1613Test;
+import org.jboss.tools.jsf.vpe.richfaces.test.jbide.Jbide1548Test;
import org.jboss.tools.jsf.vpe.richfaces.test.jbide.Jbide1580Test;
import org.jboss.tools.jsf.vpe.richfaces.test.jbide.Jbide1614Test;
import org.jboss.tools.jsf.vpe.richfaces.test.jbide.Jbide1639Test;
@@ -44,6 +46,7 @@
suite.addTestSuite(Jbide1614Test.class);
suite.addTestSuite(Jbide1639Test.class);
suite.addTestSuite(Jbide1682Test.class);
+ suite.addTestSuite(Jbide1548Test.class);
// $JUnit-END$
16 years, 10 months