- /**
- * Helper class for the contents of a folder in a tracing project
- *
- * @author Bernd Hufmann
- */
- public static class ProfileContentProvider implements ITreeContentProvider {
- @Override
- public Object[] getChildren(Object o) {
-
- if (o instanceof File[]) {
- return (File[]) o;
- }
- File store = (File) o;
- if (store.isDirectory()) {
- return store.listFiles();
- }
- return new Object[0];
- }
-
- @Override
- public Object getParent(Object element) {
- return ((File) element).getParent();
- }
-
- @Override
- public void dispose() {
- }
-
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- @Override
- public Object[] getElements(Object inputElement) {
- return getChildren(inputElement);
- }
-
- @Override
- public boolean hasChildren(Object element) {
- return ((File) element).isDirectory();
- }
- }
-
- static class ProfileLabelProvider extends LabelProvider {
- @Override
- public String getText(Object element) {
- return ((File) element).getName();
- }
-
- @Override
- public Image getImage(Object element) {
- if (((File) element).isDirectory()) {
- return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER);
- }
- return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FILE);
- }
- }