summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVladimir Prus2012-11-14 07:29:01 (EST)
committer Marc Khouzam2012-11-15 06:26:02 (EST)
commit9194376ff4c21bcbd7062150e2bfc97c6844ebd6 (patch)
tree976d3db297eb353fdb8dd1558d95490be9ac2c13
parent5c57467a36bc331dd410f9f4457043e139bd7d2c (diff)
downloadorg.eclipse.cdt-9194376ff4c21bcbd7062150e2bfc97c6844ebd6.zip
org.eclipse.cdt-9194376ff4c21bcbd7062150e2bfc97c6844ebd6.tar.gz
org.eclipse.cdt-9194376ff4c21bcbd7062150e2bfc97c6844ebd6.tar.bz2
Bug 360314: Improve diagnostics of invalid selections in OS Resources view.refs/changes/85/8685/3
Change-Id: I1a43dbf5bd58cbaaf05a21f9b3936fa7303faa37 Reviewed-on: https://git.eclipse.org/r/8685 Reviewed-by: Marc Khouzam <marc.khouzam@ericsson.com> IP-Clean: Marc Khouzam <marc.khouzam@ericsson.com> Tested-by: Marc Khouzam <marc.khouzam@ericsson.com>
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/Messages.java1
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/Messages.properties3
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/OSResourcesView.java55
3 files changed, 44 insertions, 15 deletions
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/Messages.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/Messages.java
index ae708ab..1654ca6 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/Messages.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/Messages.java
@@ -29,6 +29,7 @@ public class Messages extends NLS {
public static String OSView_12;
public static String OSView_13;
public static String OSView_14;
+ public static String OSView_15;
static {
// initialize resource bundle
NLS.initializeMessages(Messages.class.getName(), Messages.class);
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/Messages.properties b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/Messages.properties
index 79bea30..184a619 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/Messages.properties
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/Messages.properties
@@ -9,7 +9,7 @@
# Vladimir Prus (Mentor Graphics) - initial API and implementation
###############################################################################
OSView_3=Refresh
-OSView_4=Invalid debug session selected.
+OSView_4=Invalid debug object selected. Please select a process, thread or frame inside DSF GDB debug session.
OSView_5=Please select resource class.
OSView_6=Fetching data...
OSView_7=No data has been fetched yet. <a href="{0}">Fetch now</a>.
@@ -20,3 +20,4 @@ OSView_11=Determining available OS resource classes...
OSView_12=No data has been fetched yet. Target is busy.
OSView_13=Waiting for the debug session to initialize.
OSView_14=Objects from different debug sessions are selected.
+OSView_15=No debug session is selected.
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/OSResourcesView.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/OSResourcesView.java
index 5e5f2a7..8306f3d 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/OSResourcesView.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/osview/OSResourcesView.java
@@ -82,6 +82,8 @@ public class OSResourcesView extends ViewPart implements DsfSession.SessionEnded
// Indicates that we've selected objects from different debug sessions.
boolean fMultiple = false;
+ // Indicates that we have selected object with a wrong type
+ boolean fWrongType = false;
// UI objects
@@ -225,14 +227,20 @@ public class OSResourcesView extends ViewPart implements DsfSession.SessionEnded
ICommandControlDMContext context = null;
fMultiple = false;
+ fWrongType = false;
if (s instanceof IStructuredSelection) {
IStructuredSelection ss = (IStructuredSelection) s;
if (ss.size() > 0) {
@SuppressWarnings("rawtypes")
Iterator i = ss.iterator();
context = getCommandControlContext(i.next());
+ if (context == null)
+ fWrongType = true;
+
while (i.hasNext()) {
- ICommandControlDMContext nextContext = getCommandControlContext(i.next());
+ ICommandControlDMContext nextContext = getCommandControlContext(i.next());
+ if (nextContext == null)
+ fWrongType = true;
if (nextContext == null && context != null
|| nextContext != null && context == null
|| nextContext != null && context != null && !nextContext.equals(context))
@@ -300,18 +308,13 @@ public class OSResourcesView extends ViewPart implements DsfSession.SessionEnded
public void update() {
// Note that fSessionData always calls the listener in
// UI thread, so we can directly call 'update' here.
- OSResourcesView.this.update();
+ OSResourcesView.this.updateSessionDataContents();
}
}, fViewer.getControl());
}
}
-
- if (newSessionData != fSessionData)
- {
- fSessionData = newSessionData;
- update();
- }
+ update(newSessionData);
}
@Override
@@ -323,22 +326,46 @@ public class OSResourcesView extends ViewPart implements DsfSession.SessionEnded
}
}
- private void update() {
-
+ // Update UI to showing new session data. If this session data is already
+ // shown, does nothing.
+ private void update(SessionOSData newSessionData)
+ {
if (fViewer == null || fViewer.getControl() == null)
return;
if (fViewer.getControl().isDisposed())
return;
-
- if (fSessionData == null)
- {
- hideTable(fMultiple ? Messages.OSView_14 : Messages.OSView_4);
+
+ if (newSessionData == null)
+ {
+ fSessionData = null;
+ if (fMultiple)
+ hideTable(Messages.OSView_14);
+ else if (fWrongType)
+ hideTable(Messages.OSView_4);
+ else
+ hideTable(Messages.OSView_15);
fResourceClassEditor.setEnabled(false);
fRefreshAction.setEnabled(false);
return;
}
+ if (newSessionData != fSessionData) {
+ fSessionData = newSessionData;
+ updateSessionDataContents();
+ }
+ }
+
+ // Update the UI according to actual content of fSessionData,
+ // which must be not null.
+ private void updateSessionDataContents() {
+
+ if (fViewer == null || fViewer.getControl() == null)
+ return;
+
+ if (fViewer.getControl().isDisposed())
+ return;
+
boolean enable = fSessionData.canFetchData();
fRefreshAction.setEnabled(enable);
fResourceClass = fResourceClassEditor.updateClasses(fSessionData.getResourceClasses());