Пример

public class ClassA {

private TextLayout textLayout;

public void makeTextLayout( Device device ) {

textLayout = new TextLayout( device );

if ( !textLayout.isDisposed() ) {
//do something...
}
}
}



Решение
Для того чтобы избежать утечки ресурсов, убедитесь, что dispose() инициализирован в каждом org.eclipse.swt.graphics.TextLayout.



public class ClassA {

private TextLayout textLayout;

public void makeTextLayout( Device device ) {

textLayout = new TextLayout( device );

if ( !textLayout.isDisposed() ) {
//do something...
}
textLayout.dispose();
}
}