missing class, under development
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@6781 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
@ -0,0 +1,38 @@
|
||||
package net.sourceforge.pmd.eclipse.util;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import net.sourceforge.pmd.eclipse.plugin.PMDPlugin;
|
||||
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Brian Remedios
|
||||
*/
|
||||
public class ResourceManager {
|
||||
|
||||
|
||||
private Map<String, Image> imagesByCode;
|
||||
|
||||
private static ResourceManager instance = new ResourceManager();
|
||||
|
||||
private ResourceManager() {}
|
||||
|
||||
public static Image imageFor(String codePath) {
|
||||
|
||||
if (instance.imagesByCode.containsKey(codePath)) {
|
||||
return instance.imagesByCode.get(codePath);
|
||||
}
|
||||
Image image= PMDPlugin.getImageDescriptor(codePath).createImage();
|
||||
instance.imagesByCode.put(codePath, image);
|
||||
return image;
|
||||
}
|
||||
|
||||
public static void dispose() {
|
||||
|
||||
for (Image image : instance.imagesByCode.values()) {
|
||||
image.dispose();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user