mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-05 06:33:23 +02:00
Generics.
This commit is contained in:
parent
f76e087cfa
commit
3f93fe42c4
3 changed files with 71 additions and 89 deletions
|
@ -19,13 +19,11 @@ import org.eclipse.swt.graphics.RGB;
|
|||
import org.eclipse.swt.widgets.Display;
|
||||
|
||||
/**
|
||||
*
|
||||
* Color manager for C/C++ Debug UI.
|
||||
*
|
||||
* @since Jul 23, 2002
|
||||
*/
|
||||
public class ColorManager {
|
||||
|
||||
private static ColorManager gfColorManager;
|
||||
|
||||
private ColorManager() {
|
||||
|
@ -38,24 +36,20 @@ public class ColorManager {
|
|||
return gfColorManager;
|
||||
}
|
||||
|
||||
protected Map fColorTable = new HashMap( 10 );
|
||||
protected Map<RGB, Color> fColorTable = new HashMap<RGB, Color>(10);
|
||||
|
||||
public Color getColor(RGB rgb) {
|
||||
Color color = (Color)getColorTable().get(rgb);
|
||||
Color color = fColorTable.get(rgb);
|
||||
if (color == null) {
|
||||
color = new Color(Display.getCurrent(), rgb);
|
||||
getColorTable().put( rgb, color );
|
||||
fColorTable.put(rgb, color);
|
||||
}
|
||||
return color;
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
Iterator e = getColorTable().values().iterator();
|
||||
Iterator<Color> e = fColorTable.values().iterator();
|
||||
while (e.hasNext())
|
||||
((Color)e.next()).dispose();
|
||||
}
|
||||
|
||||
private Map getColorTable() {
|
||||
return this.fColorTable;
|
||||
e.next().dispose();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,19 +37,15 @@ import org.eclipse.ui.PlatformUI;
|
|||
* visible in editors only if there is a running debug session.
|
||||
*/
|
||||
public class EvaluationContextManager implements IWindowListener, IPageListener, ISelectionListener, IPartListener2 {
|
||||
|
||||
private final static String DEBUGGER_ACTIVE = CDebugUIPlugin.getUniqueIdentifier() + ".debuggerActive"; //$NON-NLS-1$
|
||||
|
||||
protected static EvaluationContextManager fgManager;
|
||||
|
||||
private Map fContextsByPage = null;
|
||||
private Map<IWorkbenchPage, ICDebugTarget> fContextsByPage = null;
|
||||
|
||||
protected EvaluationContextManager() {
|
||||
}
|
||||
|
||||
public static void startup() {
|
||||
Runnable r = new Runnable() {
|
||||
|
||||
public void run() {
|
||||
if (fgManager == null) {
|
||||
fgManager = new EvaluationContextManager();
|
||||
|
@ -205,7 +201,7 @@ public class EvaluationContextManager implements IWindowListener, IPageListener,
|
|||
*/
|
||||
private void setContext(IWorkbenchPage page, ICDebugTarget target) {
|
||||
if (fContextsByPage == null) {
|
||||
fContextsByPage = new HashMap();
|
||||
fContextsByPage = new HashMap<IWorkbenchPage, ICDebugTarget>();
|
||||
}
|
||||
fContextsByPage.put(page, target);
|
||||
System.setProperty(DEBUGGER_ACTIVE, Boolean.TRUE.toString());
|
||||
|
|
|
@ -8,11 +8,9 @@
|
|||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.debug.internal.ui;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
|
@ -23,8 +21,7 @@ import org.eclipse.swt.graphics.Image;
|
|||
* @since May 30, 2003
|
||||
*/
|
||||
public class OverlayImageCache {
|
||||
|
||||
private Map fCache = new HashMap();
|
||||
private Map<OverlayImageDescriptor, Image> fCache = new HashMap<OverlayImageDescriptor, Image>();
|
||||
|
||||
/**
|
||||
* Returns and caches an image corresponding to the specified image
|
||||
|
@ -35,10 +32,10 @@ public class OverlayImageCache {
|
|||
* @return the image
|
||||
*/
|
||||
public Image getImageFor(OverlayImageDescriptor imageDescriptor) {
|
||||
Image image = (Image)getCache().get( imageDescriptor );
|
||||
Image image = fCache.get(imageDescriptor);
|
||||
if (image == null) {
|
||||
image = imageDescriptor.createImage();
|
||||
getCache().put( imageDescriptor, image );
|
||||
fCache.put(imageDescriptor, image);
|
||||
}
|
||||
return image;
|
||||
}
|
||||
|
@ -47,14 +44,9 @@ public class OverlayImageCache {
|
|||
* Disposes of all images in the cache.
|
||||
*/
|
||||
public void disposeAll() {
|
||||
for ( Iterator it = getCache().values().iterator(); it.hasNext(); ) {
|
||||
Image image = (Image)it.next();
|
||||
for (Image image : fCache.values()) {
|
||||
image.dispose();
|
||||
}
|
||||
getCache().clear();
|
||||
}
|
||||
|
||||
private Map getCache() {
|
||||
return this.fCache;
|
||||
fCache.clear();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue