commit 3271c92d309b7cd7086c5b5ebd58632906f1361b
Author: Katja Luther <k.luther@bgbm.org>
Date:   Thu May 11 09:05:15 2017 +0200

    fix #6570: add comparator to treemap to provide the correct order in rank drop down

diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/command/DynamicNewObjectMenu.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/command/DynamicNewObjectMenu.java
index ecc6c898c..2d49f3be1 100644
--- a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/command/DynamicNewObjectMenu.java
+++ b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/command/DynamicNewObjectMenu.java
@@ -41,7 +41,7 @@ public class DynamicNewObjectMenu extends CompoundContributionItem {
 			.getLogger(DynamicNewObjectMenu.class);
 
 	private final IHandlerService handlerService = (IHandlerService) BulkEditorUtil.getService(IHandlerService.class);
-	private Map<Object, String> classLabelPairs;
+	private Map<? extends Object, String> classLabelPairs;
 
 	/** {@inheritDoc} */
 	@Override
@@ -88,7 +88,7 @@ public class DynamicNewObjectMenu extends CompoundContributionItem {
 	 * Get class label pairs from Annotated Line Editor's entity creator.
 	 * @return
 	 */
-	private Map<Object, String> getClassLabelPairs() {
+	private Map<? extends Object, String> getClassLabelPairs() {
 		IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
 		if (editor != null){
 			IEditorInput input = editor.getEditorInput();
diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/entitycreator/NameCreator.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/entitycreator/NameCreator.java
index eaa6bafd9..6c6e9a746 100644
--- a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/entitycreator/NameCreator.java
+++ b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/entitycreator/NameCreator.java
@@ -9,7 +9,7 @@
 
 package eu.etaxonomy.taxeditor.bulkeditor.input.entitycreator;
 
-import java.util.Collections;
+import java.util.Comparator;
 import java.util.List;
 import java.util.Map;
 import java.util.TreeMap;
@@ -60,10 +60,12 @@ public class NameCreator implements IEntityCreator<TaxonNameBase> {
 	 * @return a {@link java.util.Map} object.
 	 */
 	 @Override
-    public Map<Object, String> getKeyLabelPairs() {
-		Map<Object, String> result = new TreeMap<Object, String>();
+    public Map<Rank, String> getKeyLabelPairs() {
+		Map<Rank, String> result = new TreeMap<Rank, String>(
+                (Comparator<Rank>) (o1, o2) -> o2.compareTo(o1)
+        );
 		List<Rank> ranks = CdmStore.getTermManager().getPreferredTerms(Rank.class);
-		Collections.reverse(ranks);
+		//Collections.reverse(ranks);
 		for (Rank rank : ranks) {
 			result.put(rank, rank.getLabel());
 		}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/sessions/SessionsViewPart.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/sessions/SessionsViewPart.java
deleted file mode 100644
index 368c3ff02..000000000
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/sessions/SessionsViewPart.java
+++ /dev/null
@@ -1,342 +0,0 @@
-/**
- * Copyright (C) 2015 EDIT
- * European Distributed Institute of Taxonomy
- * http://www.e-taxonomy.eu
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * See LICENSE.TXT at the top of this package for the full license terms.
- */
-package eu.etaxonomy.taxeditor.view.sessions;
-
-import java.text.DecimalFormat;
-import java.util.Collection;
-
-import javax.annotation.PostConstruct;
-import javax.inject.Inject;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.wb.swt.SWTResourceManager;
-
-import eu.etaxonomy.cdm.api.cache.CdmCacher;
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
-import eu.etaxonomy.taxeditor.remoting.cache.CdmRemoteCacheManager;
-import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
-import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager;
-import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManagerObserver;
-import eu.etaxonomy.taxeditor.session.NullSession;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-import net.sf.ehcache.Cache;
-import net.sf.ehcache.CacheManager;
-import net.sf.ehcache.statistics.LiveCacheStatistics;
-
-/**
- * @author cmathew
- * @date 16 Feb 2015
- *
- */
-public class SessionsViewPart implements ICdmEntitySessionManagerObserver {
-
-    public static final String ID = "eu.etaxonomy.taxeditor.view.sessions.SessionsViewPart"; //$NON-NLS-1$
-    public static final String OPEN_INSPECT_SESSIONS_DIALOG_ID =  "eu.etaxonomy.taxeditor.store.open.InspectSessionsDialog";
-    private Table tableSessions;
-
-    private final String[] titles = { "Owner", "In Memory", "On Disk"};
-
-    private final ICdmEntitySessionManager cdmEntitySessionManager;
-    private Text txtNoOfSessions;
-    private Text txtNoOfCaches;
-    private Text txtDefaultInMemory;
-    private Text txtCdmModelInMemory;
-    private Text txtCdmModelOnDisk;
-    private Text txtDefaultOnDisk;
-
-    @Inject
-    public SessionsViewPart() {
-        this.cdmEntitySessionManager = CdmStore.getCurrentSessionManager();
-        if(cdmEntitySessionManager != null) {
-            cdmEntitySessionManager.addSessionObserver(this);
-        }
-    }
-
-    /**
-     * Create contents of the view part.
-     * @param parent
-     */
-    @PostConstruct
-    public void createPartControl(Composite parent) {
-        Composite container = new Composite(parent, SWT.NONE);
-        container.setLayout(new GridLayout(5, false));
-        {
-            Label lblNoOfSessions = new Label(container, SWT.NONE);
-            lblNoOfSessions.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL));
-            lblNoOfSessions.setAlignment(SWT.RIGHT);
-            GridData gd_lblNoOfSessions = new GridData(SWT.RIGHT, SWT.FILL, false, false, 1, 1);
-            gd_lblNoOfSessions.widthHint = 115;
-            gd_lblNoOfSessions.minimumHeight = 30;
-            lblNoOfSessions.setLayoutData(gd_lblNoOfSessions);
-            lblNoOfSessions.setText("No. of Sessions : ");
-        }
-        {
-            txtNoOfSessions = new Text(container, SWT.BORDER);
-            txtNoOfSessions.setEditable(false);
-            txtNoOfSessions.setBackground(SWTResourceManager.getColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT));
-            GridData gd_txtNoOfSessions = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
-            gd_txtNoOfSessions.widthHint = 50;
-            txtNoOfSessions.setLayoutData(gd_txtNoOfSessions);
-        }
-        new Label(container, SWT.NONE);
-        new Label(container, SWT.NONE);
-        new Label(container, SWT.NONE);
-        {
-            Label lblNoOfCaches = new Label(container, SWT.CENTER);
-            lblNoOfCaches.setAlignment(SWT.RIGHT);
-            lblNoOfCaches.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL));
-            GridData gd_lblNoOfCaches = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1);
-            gd_lblNoOfCaches.widthHint = 150;
-            lblNoOfCaches.setLayoutData(gd_lblNoOfCaches);
-            lblNoOfCaches.setText("No. of entity caches : ");
-        }
-        {
-            txtNoOfCaches = new Text(container, SWT.BORDER);
-            txtNoOfCaches.setEditable(false);
-            GridData gd_txtNoOfCaches = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
-            gd_txtNoOfCaches.widthHint = 50;
-            txtNoOfCaches.setLayoutData(gd_txtNoOfCaches);
-        }
-        new Label(container, SWT.NONE);
-        new Label(container, SWT.NONE);
-        new Label(container, SWT.NONE);
-
-        {
-            Label lblDefaultCache = new Label(container, SWT.CENTER);
-            lblDefaultCache.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
-            lblDefaultCache.setText("Default Cache, ");
-            lblDefaultCache.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL));
-            lblDefaultCache.setAlignment(SWT.RIGHT);
-        }
-        {
-            Label lblDefaultInMemory = new Label(container, SWT.CENTER);
-            lblDefaultInMemory.setText("in Memory : ");
-            lblDefaultInMemory.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL));
-            lblDefaultInMemory.setAlignment(SWT.RIGHT);
-            lblDefaultInMemory.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
-        }
-        {
-            txtDefaultInMemory = new Text(container, SWT.BORDER);
-            txtDefaultInMemory.setEditable(false);
-            GridData gd_txtDefaultInMemory = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
-            gd_txtDefaultInMemory.widthHint = 130;
-            txtDefaultInMemory.setLayoutData(gd_txtDefaultInMemory);
-        }
-        {
-            Label lblDefaultOnDisk = new Label(container, SWT.CENTER);
-            lblDefaultOnDisk.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
-            lblDefaultOnDisk.setText("on Disk : ");
-            lblDefaultOnDisk.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL));
-            lblDefaultOnDisk.setAlignment(SWT.RIGHT);
-        }
-        {
-            txtDefaultOnDisk = new Text(container, SWT.BORDER);
-            txtDefaultOnDisk.setEditable(false);
-            txtDefaultOnDisk.setText("");
-            GridData gd_txtDefaultOnDisk = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
-            gd_txtDefaultOnDisk.widthHint = 130;
-            txtDefaultOnDisk.setLayoutData(gd_txtDefaultOnDisk);
-        }
-        {
-            Label lblCdmModelCache = new Label(container, SWT.CENTER);
-            lblCdmModelCache.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
-            lblCdmModelCache.setText("CDM Model Cache, ");
-            lblCdmModelCache.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL));
-            lblCdmModelCache.setAlignment(SWT.RIGHT);
-        }
-        {
-            Label lblCdmModelInMemory = new Label(container, SWT.CENTER);
-            lblCdmModelInMemory.setText("in Memory : ");
-            lblCdmModelInMemory.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL));
-            lblCdmModelInMemory.setAlignment(SWT.RIGHT);
-            GridData gd_lblCdmModelInMemory = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1);
-            gd_lblCdmModelInMemory.widthHint = 86;
-            lblCdmModelInMemory.setLayoutData(gd_lblCdmModelInMemory);
-        }
-        {
-            txtCdmModelInMemory = new Text(container, SWT.BORDER);
-            txtCdmModelInMemory.setEditable(false);
-            GridData gd_txtCdmModelInMemory = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
-            gd_txtCdmModelInMemory.widthHint = 130;
-            txtCdmModelInMemory.setLayoutData(gd_txtCdmModelInMemory);
-        }
-        {
-            Label lblCdmModelOnDisk = new Label(container, SWT.CENTER);
-            lblCdmModelOnDisk.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
-            lblCdmModelOnDisk.setText("on Disk : ");
-            lblCdmModelOnDisk.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL));
-            lblCdmModelOnDisk.setAlignment(SWT.RIGHT);
-        }
-        {
-            txtCdmModelOnDisk = new Text(container, SWT.BORDER);
-            txtCdmModelOnDisk.setEditable(false);
-            txtCdmModelOnDisk.setText("");
-            GridData gd_txtCdmModelOnDisk = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
-            gd_txtCdmModelOnDisk.widthHint = 130;
-            txtCdmModelOnDisk.setLayoutData(gd_txtCdmModelOnDisk);
-        }
-        {
-            Button btnRefresh = new Button(container, SWT.NONE);
-            btnRefresh.addSelectionListener(new SelectionAdapter() {
-                @Override
-                public void widgetSelected(SelectionEvent e) {
-                    changed();
-                }
-            });
-            GridData gd_btnRefresh = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1);
-            gd_btnRefresh.widthHint = 100;
-            btnRefresh.setLayoutData(gd_btnRefresh);
-            btnRefresh.setText("Refresh");
-        }
-        {
-            Button btnInspectActiveSession = new Button(container, SWT.NONE);
-            btnInspectActiveSession.addSelectionListener(new SelectionAdapter() {
-                @Override
-                public void widgetSelected(SelectionEvent e) {
-                    AbstractUtility.executeCommand(OPEN_INSPECT_SESSIONS_DIALOG_ID, this, null);
-                }
-            });
-            btnInspectActiveSession.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1));
-            btnInspectActiveSession.setText("Inspect Active Session");
-        }
-        new Label(container, SWT.NONE);
-        new Label(container, SWT.NONE);
-
-        {
-            tableSessions = new Table(container, SWT.BORDER | SWT.FULL_SELECTION);
-            GridData gd_tableSessions = new GridData(SWT.FILL, SWT.FILL, true, true, 5, 1);
-            gd_tableSessions.widthHint = 769;
-            tableSessions.setLayoutData(gd_tableSessions);
-            tableSessions.setHeaderVisible(true);
-            tableSessions.setLinesVisible(true);
-        }
-
-        createActions();
-    }
-
-    /**
-     * Create the actions.
-     */
-    private void createActions() {
-
-
-        for (String title : titles) {
-            TableColumn column = new TableColumn(tableSessions, SWT.NULL);
-            column.setWidth(200);
-            column.setText(title);
-        }
-        changed();
-
-    }
-
-
-    @Override
-    public void changed() {
-        if(tableSessions.isDisposed()) {
-            return;
-        }
-        tableSessions.removeAll();
-        if(cdmEntitySessionManager != null) {
-            Collection<ICdmEntitySession> sessions = cdmEntitySessionManager.getSessions();
-            txtNoOfSessions.setText(String.valueOf(sessions.size()));
-            for(ICdmEntitySession session : sessions) {
-                addSession(session);
-            }
-            ICdmEntitySession nullSession = cdmEntitySessionManager.getNullSession();
-            if(nullSession != null) {
-                addSession(nullSession);
-            }
-            for (int i=0; i<titles.length; i++) {
-                tableSessions.getColumn (i).pack ();
-            }
-        }
-
-        CdmRemoteCacheManager instance = CdmRemoteCacheManager.getInstance();
-        int cdmEnityCacheSize = CacheManager.create().getCacheNames().length;
-        txtNoOfCaches.setText(String.valueOf(cdmEnityCacheSize));
-
-        Cache defaultCache = CacheManager.create().getCache(CdmCacher.DEFAULT_CACHE_NAME);
-        txtDefaultInMemory.setText("");
-        txtDefaultOnDisk.setText("");
-        if(defaultCache != null) {
-            LiveCacheStatistics liveCacheStatistics = defaultCache.getLiveCacheStatistics();
-            txtDefaultInMemory.setText(getInMemoryStats(liveCacheStatistics));
-            txtDefaultOnDisk.setText(getOnDiskStats(liveCacheStatistics));
-        }
-
-        Cache cdmModelGetMethodsCache = instance.getCdmModelGetMethodsCache();
-        txtCdmModelInMemory.setText("");
-        txtCdmModelOnDisk.setText("");
-        if(cdmModelGetMethodsCache != null) {
-            LiveCacheStatistics liveCacheStatistics = cdmModelGetMethodsCache.getLiveCacheStatistics();
-            txtCdmModelInMemory.setText(getInMemoryStats(liveCacheStatistics));
-            txtCdmModelOnDisk.setText(getOnDiskStats(liveCacheStatistics));
-        }
-
-    }
-
-    private void addSession(ICdmEntitySession session) {
-
-        TableItem item = new TableItem(tableSessions, SWT.NULL);
-
-        String activePrefix = "";
-        if(session.isActive()) {
-            activePrefix = "*";
-        }
-        String sessionOwnerString = "";
-        if(session instanceof NullSession) {
-            sessionOwnerString = "Null Session";
-        } else {
-            if(session.getOwner() != null) {
-                sessionOwnerString = session.getOwner().toString();
-            }
-        }
-        item.setText(0, activePrefix + sessionOwnerString);
-        LiveCacheStatistics cacheStatistics = session.getCacheStatistics();
-        item.setText(1, getInMemoryStats(cacheStatistics));
-        item.setText(2, getOnDiskStats(cacheStatistics));
-    }
-
-    private String getInMemoryStats(LiveCacheStatistics statistics) {
-        if(statistics != null) {
-            long localHeapSize = statistics.getLocalHeapSize();
-
-            long localHeapSizeInBytes = statistics.getLocalHeapSizeInBytes();
-            String localHeapSizeInBytesStr =
-                    (new DecimalFormat("#.##")).format(localHeapSizeInBytes/1048576.0);
-            return String.valueOf(localHeapSize) + " objects / " + localHeapSizeInBytesStr + " Mb";
-        }
-        return "";
-    }
-
-    private String getOnDiskStats(LiveCacheStatistics statistics) {
-        if(statistics != null) {
-            long localDiskSize = statistics.getLocalDiskSize();
-
-            long localDiskSizeInBytes = statistics.getLocalDiskSizeInBytes();
-            String localDiskSizeInBytesStr =
-                    (new DecimalFormat("#.##")).format(localDiskSizeInBytes/1048576.0);
-            return String.valueOf(localDiskSize) + " objects / " + localDiskSizeInBytesStr + " Mb";
-        }
-        return "";
-    }
-
-
-}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/sessions/SessionsViewParts.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/sessions/SessionsViewParts.java
new file mode 100644
index 000000000..368c3ff02
--- /dev/null
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/sessions/SessionsViewParts.java
@@ -0,0 +1,342 @@
+/**
+ * Copyright (C) 2015 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
+package eu.etaxonomy.taxeditor.view.sessions;
+
+import java.text.DecimalFormat;
+import java.util.Collection;
+
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.wb.swt.SWTResourceManager;
+
+import eu.etaxonomy.cdm.api.cache.CdmCacher;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.remoting.cache.CdmRemoteCacheManager;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManagerObserver;
+import eu.etaxonomy.taxeditor.session.NullSession;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+import net.sf.ehcache.Cache;
+import net.sf.ehcache.CacheManager;
+import net.sf.ehcache.statistics.LiveCacheStatistics;
+
+/**
+ * @author cmathew
+ * @date 16 Feb 2015
+ *
+ */
+public class SessionsViewPart implements ICdmEntitySessionManagerObserver {
+
+    public static final String ID = "eu.etaxonomy.taxeditor.view.sessions.SessionsViewPart"; //$NON-NLS-1$
+    public static final String OPEN_INSPECT_SESSIONS_DIALOG_ID =  "eu.etaxonomy.taxeditor.store.open.InspectSessionsDialog";
+    private Table tableSessions;
+
+    private final String[] titles = { "Owner", "In Memory", "On Disk"};
+
+    private final ICdmEntitySessionManager cdmEntitySessionManager;
+    private Text txtNoOfSessions;
+    private Text txtNoOfCaches;
+    private Text txtDefaultInMemory;
+    private Text txtCdmModelInMemory;
+    private Text txtCdmModelOnDisk;
+    private Text txtDefaultOnDisk;
+
+    @Inject
+    public SessionsViewPart() {
+        this.cdmEntitySessionManager = CdmStore.getCurrentSessionManager();
+        if(cdmEntitySessionManager != null) {
+            cdmEntitySessionManager.addSessionObserver(this);
+        }
+    }
+
+    /**
+     * Create contents of the view part.
+     * @param parent
+     */
+    @PostConstruct
+    public void createPartControl(Composite parent) {
+        Composite container = new Composite(parent, SWT.NONE);
+        container.setLayout(new GridLayout(5, false));
+        {
+            Label lblNoOfSessions = new Label(container, SWT.NONE);
+            lblNoOfSessions.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL));
+            lblNoOfSessions.setAlignment(SWT.RIGHT);
+            GridData gd_lblNoOfSessions = new GridData(SWT.RIGHT, SWT.FILL, false, false, 1, 1);
+            gd_lblNoOfSessions.widthHint = 115;
+            gd_lblNoOfSessions.minimumHeight = 30;
+            lblNoOfSessions.setLayoutData(gd_lblNoOfSessions);
+            lblNoOfSessions.setText("No. of Sessions : ");
+        }
+        {
+            txtNoOfSessions = new Text(container, SWT.BORDER);
+            txtNoOfSessions.setEditable(false);
+            txtNoOfSessions.setBackground(SWTResourceManager.getColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT));
+            GridData gd_txtNoOfSessions = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
+            gd_txtNoOfSessions.widthHint = 50;
+            txtNoOfSessions.setLayoutData(gd_txtNoOfSessions);
+        }
+        new Label(container, SWT.NONE);
+        new Label(container, SWT.NONE);
+        new Label(container, SWT.NONE);
+        {
+            Label lblNoOfCaches = new Label(container, SWT.CENTER);
+            lblNoOfCaches.setAlignment(SWT.RIGHT);
+            lblNoOfCaches.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL));
+            GridData gd_lblNoOfCaches = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1);
+            gd_lblNoOfCaches.widthHint = 150;
+            lblNoOfCaches.setLayoutData(gd_lblNoOfCaches);
+            lblNoOfCaches.setText("No. of entity caches : ");
+        }
+        {
+            txtNoOfCaches = new Text(container, SWT.BORDER);
+            txtNoOfCaches.setEditable(false);
+            GridData gd_txtNoOfCaches = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
+            gd_txtNoOfCaches.widthHint = 50;
+            txtNoOfCaches.setLayoutData(gd_txtNoOfCaches);
+        }
+        new Label(container, SWT.NONE);
+        new Label(container, SWT.NONE);
+        new Label(container, SWT.NONE);
+
+        {
+            Label lblDefaultCache = new Label(container, SWT.CENTER);
+            lblDefaultCache.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
+            lblDefaultCache.setText("Default Cache, ");
+            lblDefaultCache.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL));
+            lblDefaultCache.setAlignment(SWT.RIGHT);
+        }
+        {
+            Label lblDefaultInMemory = new Label(container, SWT.CENTER);
+            lblDefaultInMemory.setText("in Memory : ");
+            lblDefaultInMemory.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL));
+            lblDefaultInMemory.setAlignment(SWT.RIGHT);
+            lblDefaultInMemory.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
+        }
+        {
+            txtDefaultInMemory = new Text(container, SWT.BORDER);
+            txtDefaultInMemory.setEditable(false);
+            GridData gd_txtDefaultInMemory = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
+            gd_txtDefaultInMemory.widthHint = 130;
+            txtDefaultInMemory.setLayoutData(gd_txtDefaultInMemory);
+        }
+        {
+            Label lblDefaultOnDisk = new Label(container, SWT.CENTER);
+            lblDefaultOnDisk.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
+            lblDefaultOnDisk.setText("on Disk : ");
+            lblDefaultOnDisk.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL));
+            lblDefaultOnDisk.setAlignment(SWT.RIGHT);
+        }
+        {
+            txtDefaultOnDisk = new Text(container, SWT.BORDER);
+            txtDefaultOnDisk.setEditable(false);
+            txtDefaultOnDisk.setText("");
+            GridData gd_txtDefaultOnDisk = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
+            gd_txtDefaultOnDisk.widthHint = 130;
+            txtDefaultOnDisk.setLayoutData(gd_txtDefaultOnDisk);
+        }
+        {
+            Label lblCdmModelCache = new Label(container, SWT.CENTER);
+            lblCdmModelCache.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
+            lblCdmModelCache.setText("CDM Model Cache, ");
+            lblCdmModelCache.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL));
+            lblCdmModelCache.setAlignment(SWT.RIGHT);
+        }
+        {
+            Label lblCdmModelInMemory = new Label(container, SWT.CENTER);
+            lblCdmModelInMemory.setText("in Memory : ");
+            lblCdmModelInMemory.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL));
+            lblCdmModelInMemory.setAlignment(SWT.RIGHT);
+            GridData gd_lblCdmModelInMemory = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1);
+            gd_lblCdmModelInMemory.widthHint = 86;
+            lblCdmModelInMemory.setLayoutData(gd_lblCdmModelInMemory);
+        }
+        {
+            txtCdmModelInMemory = new Text(container, SWT.BORDER);
+            txtCdmModelInMemory.setEditable(false);
+            GridData gd_txtCdmModelInMemory = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
+            gd_txtCdmModelInMemory.widthHint = 130;
+            txtCdmModelInMemory.setLayoutData(gd_txtCdmModelInMemory);
+        }
+        {
+            Label lblCdmModelOnDisk = new Label(container, SWT.CENTER);
+            lblCdmModelOnDisk.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
+            lblCdmModelOnDisk.setText("on Disk : ");
+            lblCdmModelOnDisk.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL));
+            lblCdmModelOnDisk.setAlignment(SWT.RIGHT);
+        }
+        {
+            txtCdmModelOnDisk = new Text(container, SWT.BORDER);
+            txtCdmModelOnDisk.setEditable(false);
+            txtCdmModelOnDisk.setText("");
+            GridData gd_txtCdmModelOnDisk = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
+            gd_txtCdmModelOnDisk.widthHint = 130;
+            txtCdmModelOnDisk.setLayoutData(gd_txtCdmModelOnDisk);
+        }
+        {
+            Button btnRefresh = new Button(container, SWT.NONE);
+            btnRefresh.addSelectionListener(new SelectionAdapter() {
+                @Override
+                public void widgetSelected(SelectionEvent e) {
+                    changed();
+                }
+            });
+            GridData gd_btnRefresh = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1);
+            gd_btnRefresh.widthHint = 100;
+            btnRefresh.setLayoutData(gd_btnRefresh);
+            btnRefresh.setText("Refresh");
+        }
+        {
+            Button btnInspectActiveSession = new Button(container, SWT.NONE);
+            btnInspectActiveSession.addSelectionListener(new SelectionAdapter() {
+                @Override
+                public void widgetSelected(SelectionEvent e) {
+                    AbstractUtility.executeCommand(OPEN_INSPECT_SESSIONS_DIALOG_ID, this, null);
+                }
+            });
+            btnInspectActiveSession.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1));
+            btnInspectActiveSession.setText("Inspect Active Session");
+        }
+        new Label(container, SWT.NONE);
+        new Label(container, SWT.NONE);
+
+        {
+            tableSessions = new Table(container, SWT.BORDER | SWT.FULL_SELECTION);
+            GridData gd_tableSessions = new GridData(SWT.FILL, SWT.FILL, true, true, 5, 1);
+            gd_tableSessions.widthHint = 769;
+            tableSessions.setLayoutData(gd_tableSessions);
+            tableSessions.setHeaderVisible(true);
+            tableSessions.setLinesVisible(true);
+        }
+
+        createActions();
+    }
+
+    /**
+     * Create the actions.
+     */
+    private void createActions() {
+
+
+        for (String title : titles) {
+            TableColumn column = new TableColumn(tableSessions, SWT.NULL);
+            column.setWidth(200);
+            column.setText(title);
+        }
+        changed();
+
+    }
+
+
+    @Override
+    public void changed() {
+        if(tableSessions.isDisposed()) {
+            return;
+        }
+        tableSessions.removeAll();
+        if(cdmEntitySessionManager != null) {
+            Collection<ICdmEntitySession> sessions = cdmEntitySessionManager.getSessions();
+            txtNoOfSessions.setText(String.valueOf(sessions.size()));
+            for(ICdmEntitySession session : sessions) {
+                addSession(session);
+            }
+            ICdmEntitySession nullSession = cdmEntitySessionManager.getNullSession();
+            if(nullSession != null) {
+                addSession(nullSession);
+            }
+            for (int i=0; i<titles.length; i++) {
+                tableSessions.getColumn (i).pack ();
+            }
+        }
+
+        CdmRemoteCacheManager instance = CdmRemoteCacheManager.getInstance();
+        int cdmEnityCacheSize = CacheManager.create().getCacheNames().length;
+        txtNoOfCaches.setText(String.valueOf(cdmEnityCacheSize));
+
+        Cache defaultCache = CacheManager.create().getCache(CdmCacher.DEFAULT_CACHE_NAME);
+        txtDefaultInMemory.setText("");
+        txtDefaultOnDisk.setText("");
+        if(defaultCache != null) {
+            LiveCacheStatistics liveCacheStatistics = defaultCache.getLiveCacheStatistics();
+            txtDefaultInMemory.setText(getInMemoryStats(liveCacheStatistics));
+            txtDefaultOnDisk.setText(getOnDiskStats(liveCacheStatistics));
+        }
+
+        Cache cdmModelGetMethodsCache = instance.getCdmModelGetMethodsCache();
+        txtCdmModelInMemory.setText("");
+        txtCdmModelOnDisk.setText("");
+        if(cdmModelGetMethodsCache != null) {
+            LiveCacheStatistics liveCacheStatistics = cdmModelGetMethodsCache.getLiveCacheStatistics();
+            txtCdmModelInMemory.setText(getInMemoryStats(liveCacheStatistics));
+            txtCdmModelOnDisk.setText(getOnDiskStats(liveCacheStatistics));
+        }
+
+    }
+
+    private void addSession(ICdmEntitySession session) {
+
+        TableItem item = new TableItem(tableSessions, SWT.NULL);
+
+        String activePrefix = "";
+        if(session.isActive()) {
+            activePrefix = "*";
+        }
+        String sessionOwnerString = "";
+        if(session instanceof NullSession) {
+            sessionOwnerString = "Null Session";
+        } else {
+            if(session.getOwner() != null) {
+                sessionOwnerString = session.getOwner().toString();
+            }
+        }
+        item.setText(0, activePrefix + sessionOwnerString);
+        LiveCacheStatistics cacheStatistics = session.getCacheStatistics();
+        item.setText(1, getInMemoryStats(cacheStatistics));
+        item.setText(2, getOnDiskStats(cacheStatistics));
+    }
+
+    private String getInMemoryStats(LiveCacheStatistics statistics) {
+        if(statistics != null) {
+            long localHeapSize = statistics.getLocalHeapSize();
+
+            long localHeapSizeInBytes = statistics.getLocalHeapSizeInBytes();
+            String localHeapSizeInBytesStr =
+                    (new DecimalFormat("#.##")).format(localHeapSizeInBytes/1048576.0);
+            return String.valueOf(localHeapSize) + " objects / " + localHeapSizeInBytesStr + " Mb";
+        }
+        return "";
+    }
+
+    private String getOnDiskStats(LiveCacheStatistics statistics) {
+        if(statistics != null) {
+            long localDiskSize = statistics.getLocalDiskSize();
+
+            long localDiskSizeInBytes = statistics.getLocalDiskSizeInBytes();
+            String localDiskSizeInBytesStr =
+                    (new DecimalFormat("#.##")).format(localDiskSizeInBytes/1048576.0);
+            return String.valueOf(localDiskSize) + " objects / " + localDiskSizeInBytesStr + " Mb";
+        }
+        return "";
+    }
+
+
+}
