
com.readytalk.swt.util.ResourceQuery Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of swt-bling Show documentation
Show all versions of swt-bling Show documentation
Blinged-out, modern widgets for SWT
package com.readytalk.swt.util;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.swt.graphics.DeviceData;
import org.eclipse.swt.widgets.Display;
/**
* ResourceQuery returns mmp of key value pairs of the count results
* contained in the DeviceData array passed into display. DeviceData
* will hold references to resources; so this should probably not be used
* in production.
*/
public class ResourceQuery {
public static Map getAllocatedResourceCounts(final Display display) {
HashMap results = new HashMap();
DeviceData data = display.getDeviceData();
for (Object object : data.objects) {
String name = object.getClass().getCanonicalName();
Integer count = results.get(name);
if (count == null) {
count = 0;
}
int c = count.intValue();
c++;
results.put(name, c);
}
return results;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy