Author: rob.stryker(a)jboss.com
Date: 2007-09-20 19:41:49 -0400 (Thu, 20 Sep 2007)
New Revision: 3741
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/ArchivesBuildListener.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/ArchivesModelModuleContributor.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/PackageModuleFactory.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/SingleDeployableFactory.java
Log:
removing compiler warnings (generics)
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/ArchivesBuildListener.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/ArchivesBuildListener.java 2007-09-20
23:26:55 UTC (rev 3740)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/ArchivesBuildListener.java 2007-09-20
23:41:49 UTC (rev 3741)
@@ -116,7 +116,7 @@
public static DeployableServerBehavior[] getServers(String servers) {
if( servers == null || "".equals(servers))
return null;
- ArrayList list = new ArrayList();
+ ArrayList<DeployableServerBehavior> list = new
ArrayList<DeployableServerBehavior>();
String[] byId = servers.split(",");
for( int i = 0; i < byId.length; i++ ) {
IServer server = ServerCore.findServer(byId[i]);
@@ -127,7 +127,7 @@
}
}
}
- return (DeployableServerBehavior[]) list.toArray(new
DeployableServerBehavior[list.size()]);
+ return list.toArray(new DeployableServerBehavior[list.size()]);
}
/*
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/ArchivesModelModuleContributor.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/ArchivesModelModuleContributor.java 2007-09-20
23:26:55 UTC (rev 3740)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/ArchivesModelModuleContributor.java 2007-09-20
23:41:49 UTC (rev 3741)
@@ -26,10 +26,10 @@
}
private PackageModuleFactory factory;
- protected ArrayList modules = null;
- protected HashMap projectToModules = new HashMap(5); //IPath to IModule
- protected HashMap moduleDelegates = new HashMap(5);
- protected HashMap packageToModule = new HashMap(5);
+ protected ArrayList<IModule> modules = null;
+ protected HashMap<IPath, ArrayList<IModule>> projectToModules = new
HashMap<IPath, ArrayList<IModule>>(5); //IPath to IModule
+ protected HashMap<IModule, Object> moduleDelegates = new HashMap<IModule,
Object>(5);
+ protected HashMap<IArchive, IModule> packageToModule = new HashMap<IArchive,
IModule>(5);
private ArchivesModelModuleContributor(PackageModuleFactory factory) {
this.factory = factory;
@@ -37,7 +37,7 @@
public IModule[] getModules() {
if( modules == null ) {
- modules = new ArrayList();
+ modules = new ArrayList<IModule>();
IProject[] projects2 = ResourcesPlugin.getWorkspace().getRoot().getProjects();
int size = projects2.length;
for (int i = 0; i < size; i++) {
@@ -46,7 +46,7 @@
}
}
}
- return (IModule[]) modules.toArray(new IModule[modules.size()]);
+ return modules.toArray(new IModule[modules.size()]);
}
protected void createModules(IProject project) {
@@ -54,8 +54,9 @@
if( packs != null && packs.length > 0 ) {
IModule module;
IArchive[] packages = ArchivesModelCore.getProjectPackages(project.getLocation(), new
NullProgressMonitor(), true);
- boolean requiresSave = ensureArchivesHaveIDs(project, packages);
- ArrayList mods = new ArrayList();
+ /*boolean requiresSave = */
+ ensureArchivesHaveIDs(project, packages);
+ ArrayList<IModule> mods = new ArrayList<IModule>();
for( int i = 0; i < packages.length; i++ ) {
module = factory.createModule2(packages[i], project);
modules.add(module);
@@ -78,11 +79,11 @@
public void refreshProject(IPath projectLoc) {
// remove old mods
- ArrayList mods = (ArrayList)projectToModules.get(projectLoc);
+ ArrayList<IModule> mods = projectToModules.get(projectLoc);
IModule mod;
IArchive arc;
if (mods != null) {
- for( Iterator i = mods.iterator(); i.hasNext();) {
+ for( Iterator<IModule> i = mods.iterator(); i.hasNext();) {
mod = (IModule)i.next();
if( moduleDelegates.get(mod) != null ) {
arc = ((PackagedModuleDelegate)moduleDelegates.get(mod)).getPackage();
@@ -92,7 +93,6 @@
}
}
createModules(findProject(projectLoc));
- factory.clearModuleCache();
}
protected IProject findProject(IPath projectLoc) {
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/PackageModuleFactory.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/PackageModuleFactory.java 2007-09-20
23:26:55 UTC (rev 3740)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/PackageModuleFactory.java 2007-09-20
23:41:49 UTC (rev 3741)
@@ -171,11 +171,11 @@
public IModule[] getModules() {
- ArrayList list = new ArrayList();
+ ArrayList<IModule> list = new ArrayList<IModule>();
for( int i = 0; i < moduleContributors.length; i++ ) {
list.addAll(Arrays.asList(moduleContributors[i].getModules()));
}
- return (IModule[]) list.toArray(new IModule[list.size()]);
+ return list.toArray(new IModule[list.size()]);
}
public ModuleDelegate getModuleDelegate(IModule module) {
@@ -202,15 +202,15 @@
public static class DelegateInitVisitor implements IArchiveNodeVisitor {
private IArchive pack;
- private HashMap members; // node -> imoduleresource
- private HashMap pathToNode; // path -> node
+ private HashMap<IArchiveNode, ArchiveContainerResource> members; // node ->
imoduleresource
+ private HashMap<IPath, IArchiveNode> pathToNode; // path -> node
public DelegateInitVisitor(IArchive pack) {
this.pack = pack;
reset();
}
public void reset() {
- members = new HashMap();
- pathToNode = new HashMap();
+ members = new HashMap<IArchiveNode, ArchiveContainerResource>();
+ pathToNode = new HashMap<IPath, IArchiveNode>();
}
public boolean visit(IArchiveNode node) {
int type = node.getNodeType();
@@ -222,13 +222,13 @@
String name = type == IArchiveNode.TYPE_ARCHIVE ? ((IArchive)node).getName() :
((IArchiveFolder)node).getName();
// if we're any other archive or a folder, create us and add to parent
IArchiveNode parent = node.getParent();
- ArchiveContainerResource parentAsResource =
(ArchiveContainerResource)members.get(parent);
+ ArchiveContainerResource parentAsResource = members.get(parent);
IPath rel = node.getRootArchiveRelativePath();
members.put(node, new ArchiveContainerResource(name, node, rel));
pathToNode.put(rel, node);
- parentAsResource.addChild((IModuleResource)members.get(node));
+ parentAsResource.addChild(members.get(node));
} else if( type == IArchiveNode.TYPE_ARCHIVE_FILESET ) {
- ArchiveContainerResource parentAsResource =
(ArchiveContainerResource)members.get(node.getParent());
+ ArchiveContainerResource parentAsResource = members.get(node.getParent());
parentAsResource.addFilesetAsChild((IArchiveFileSet)node);
}
@@ -236,11 +236,11 @@
}
public IModuleResource getRootResource() {
- return (IModuleResource)members.get(pack);
+ return members.get(pack);
}
public IModuleResource getResourceForNode(IArchiveNode node) {
- return (IModuleResource)members.get(node);
+ return members.get(node);
}
}
@@ -249,7 +249,7 @@
protected IPath moduleRelativePath;
protected IArchiveNode node;
protected String name;
- private HashMap members;
+ private HashMap<IPath, IModuleResource> members;
// represents source folder on disk. only used if node is fileset
private IPath folderGlobalPath = null;
@@ -257,7 +257,7 @@
this.name = name;
this.node = node;
this.moduleRelativePath = moduleRelativePath;
- members = new HashMap();
+ members = new HashMap<IPath, IModuleResource>();
if( node instanceof IArchiveFileSet) {
IPath tmp =
moduleRelativePath.removeFirstSegments(node.getParent().getRootArchiveRelativePath().segmentCount());
folderGlobalPath = ((IArchiveFileSet)node).getGlobalSourcePath().append(tmp);
@@ -284,7 +284,7 @@
members.remove(moduleRelativePath);
}
public IModuleResource getChild(IPath path) {
- return (IModuleResource)members.get(path);
+ return members.get(path);
}
public void addFilesetAsChild(IArchiveFileSet fs) {
@@ -331,8 +331,8 @@
}
public IModuleResource[] members() {
- Collection c = members.values();
- return (IModuleResource[]) c.toArray(new IModuleResource[c.size()]);
+ Collection<IModuleResource> c = members.values();
+ return c.toArray(new IModuleResource[c.size()]);
}
public IPath getModuleRelativePath() {
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/SingleDeployableFactory.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/SingleDeployableFactory.java 2007-09-20
23:26:55 UTC (rev 3740)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/SingleDeployableFactory.java 2007-09-20
23:41:49 UTC (rev 3741)
@@ -76,11 +76,11 @@
- private HashMap moduleIdToModule;
- private HashMap moduleToDelegate;
+ private HashMap<IPath, IModule> moduleIdToModule;
+ private HashMap<IModule, SingleDeployableModuleDelegate> moduleToDelegate;
public SingleDeployableFactory() {
- moduleIdToModule = new HashMap();
- moduleToDelegate = new HashMap();
+ moduleIdToModule = new HashMap<IPath, IModule>();
+ moduleToDelegate = new HashMap<IModule, SingleDeployableModuleDelegate>();
String files =
JBossServerCorePlugin.getDefault().getPluginPreferences().getString(PREFERENCE_KEY);
if( files.equals("")) return;
String[] files2 = files.split(DELIM);
@@ -90,13 +90,13 @@
}
public IModule getModule(IPath path) {
- return (IModule)moduleIdToModule.get(path);
+ return moduleIdToModule.get(path);
}
public void saveDeployableList() {
- Iterator i = moduleIdToModule.keySet().iterator();
+ Iterator<IPath> i = moduleIdToModule.keySet().iterator();
String val = "";
while(i.hasNext()) {
- val += ((IPath)i.next()).toString() + DELIM;
+ val += i.next().toString() + DELIM;
}
JBossServerCorePlugin.getDefault().getPluginPreferences().setValue(PREFERENCE_KEY,
val);
JBossServerCorePlugin.getDefault().savePluginPreferences();
@@ -115,18 +115,18 @@
}
protected void removeModule(IPath path) {
- IModule mod = (IModule)moduleIdToModule.get(path);
+ IModule mod = moduleIdToModule.get(path);
moduleIdToModule.remove(path);
moduleToDelegate.remove(mod);
}
public IModule[] getModules() {
- Collection c = moduleIdToModule.values();
- return (IModule[]) c.toArray(new IModule[c.size()]);
+ Collection<IModule> c = moduleIdToModule.values();
+ return c.toArray(new IModule[c.size()]);
}
public ModuleDelegate getModuleDelegate(IModule module) {
- return (ModuleDelegate)moduleToDelegate.get(module);
+ return moduleToDelegate.get(module);
}
public class SingleDeployableModuleDelegate extends ModuleDelegate {