E4/EAS/Resource Management

From Eclipsepedia

< E4‎ | EAS
Jump to: navigation, search

Components should be able to have resource allocation and deallocation performed for them transparently and the allocated resources should be shared amongst other components where possible to keep memory footprint low.

Eclipse 3.x API

JFace exposes a resource manager that can assist with the management of SWT resources such as Colors, Fonts, and Images.

Allocation

LocalResourceManager resourceManager = new LocalResourceManager();
Image image = resourceManager.createImage(imageDescriptor);
button.setImage(image);

Deallocation

resourceManager.dispose();