[jbosstools-commits] JBoss Tools SVN: r7092 - trunk/jst/plugins/org.jboss.tools.jst.web.tiles/src/org/jboss/tools/jst/web/tiles/model/helpers.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Mon Mar 24 12:21:30 EDT 2008
Author: scabanovich
Date: 2008-03-24 12:21:30 -0400 (Mon, 24 Mar 2008)
New Revision: 7092
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.tiles/src/org/jboss/tools/jst/web/tiles/model/helpers/ITilesDefinitionSetContributor.java
trunk/jst/plugins/org.jboss.tools.jst.web.tiles/src/org/jboss/tools/jst/web/tiles/model/helpers/TilesDefinitionSet.java
Log:
JBIDE-893
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.tiles/src/org/jboss/tools/jst/web/tiles/model/helpers/ITilesDefinitionSetContributor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.tiles/src/org/jboss/tools/jst/web/tiles/model/helpers/ITilesDefinitionSetContributor.java 2008-03-24 16:21:22 UTC (rev 7091)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.tiles/src/org/jboss/tools/jst/web/tiles/model/helpers/ITilesDefinitionSetContributor.java 2008-03-24 16:21:30 UTC (rev 7092)
@@ -13,9 +13,10 @@
import java.util.*;
import org.jboss.tools.common.model.XModel;
+import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.event.XModelTreeEvent;
public interface ITilesDefinitionSetContributor {
- Set getTileFiles(XModel model);
+ Set<XModelObject> getTileFiles(XModel model);
boolean isRelevant(XModelTreeEvent event);
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.tiles/src/org/jboss/tools/jst/web/tiles/model/helpers/TilesDefinitionSet.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.tiles/src/org/jboss/tools/jst/web/tiles/model/helpers/TilesDefinitionSet.java 2008-03-24 16:21:22 UTC (rev 7091)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.tiles/src/org/jboss/tools/jst/web/tiles/model/helpers/TilesDefinitionSet.java 2008-03-24 16:21:30 UTC (rev 7092)
@@ -30,17 +30,13 @@
static void loadContributors() {
ArrayList<ITilesDefinitionSetContributor> list = new ArrayList<ITilesDefinitionSetContributor>();
for (int i = 0; i < CONTRIBUTORS.length; i++) {
- try {
- Object watcher = ModelFeatureFactory.getInstance().createFeatureInstance(CONTRIBUTORS[i]);
- if(watcher instanceof ITilesDefinitionSetContributor)
- list.add((ITilesDefinitionSetContributor)watcher);
- else
- if(ModelPlugin.isDebugEnabled()) {
- ModelPlugin.getPluginLog().logInfo("Class is not implemented IWatcherContributor interface!");
- }
- } catch (Exception e) {
- ModelPlugin.getPluginLog().logError(e);
- }
+ Object watcher = ModelFeatureFactory.getInstance().createFeatureInstance(CONTRIBUTORS[i]);
+ if(watcher instanceof ITilesDefinitionSetContributor)
+ list.add((ITilesDefinitionSetContributor)watcher);
+ else
+ if(ModelPlugin.isDebugEnabled()) {
+ ModelPlugin.getPluginLog().logInfo("Class is not implemented IWatcherContributor interface!");
+ }
}
contributors = list.toArray(new ITilesDefinitionSetContributor[0]);
}
@@ -57,8 +53,8 @@
}
XModel model;
- Set tiles = new HashSet();
- Map definitions = new HashMap();
+ Set<XModelObject> tiles = new HashSet<XModelObject>();
+ Map<String,XModelObject> definitions = new HashMap<String,XModelObject>();
Set<ITilesDefinitionSetListener> listeners = new HashSet<ITilesDefinitionSetListener>();
void setModel(XModel model) {
@@ -66,7 +62,7 @@
update();
}
- public Map getDefinitions() {
+ public Map<String,XModelObject> getDefinitions() {
return definitions;
}
@@ -95,7 +91,7 @@
}
public void update() {
- Set s = new HashSet();
+ Set<XModelObject> s = new HashSet<XModelObject>();
for (int i = 0; i < contributors.length; i++) {
s.addAll(contributors[i].getTileFiles(model));
}
@@ -104,25 +100,25 @@
}
void updateDefinitions() {
- Map d = new HashMap();
- Iterator it = tiles.iterator();
+ Map<String,XModelObject> d = new HashMap<String,XModelObject>();
+ Iterator<XModelObject> it = tiles.iterator();
while(it.hasNext()) {
XModelObject o = (XModelObject)it.next();
XModelObject[] cs = o.getChildren(TilesConstants.ENT_DEFINITION);
for (int i = 0; i < cs.length; i++) d.put(cs[i].getAttributeValue("name"), cs[i]);
}
- Map old = definitions;
+ Map<String,XModelObject> old = definitions;
definitions = d;
- Set removed = new HashSet();
- Set added = new HashSet();
- it = old.keySet().iterator();
+ Set<XModelObject> removed = new HashSet<XModelObject>();
+ Set<XModelObject> added = new HashSet<XModelObject>();
+ Iterator<String> it2 = old.keySet().iterator();
while(it.hasNext()) {
- String key = it.next().toString();
+ String key = it2.next();
if(!d.containsKey(key)) removed.add(old.get(key));
}
- it = d.keySet().iterator();
- while(it.hasNext()) {
- String key = it.next().toString();
+ Iterator<String> kit = d.keySet().iterator();
+ while(kit.hasNext()) {
+ String key = kit.next();
if(!old.containsKey(key)) added.add(d.get(key));
}
if(!removed.isEmpty() || !added.isEmpty()) {
More information about the jbosstools-commits
mailing list