Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Coulon2016-01-14 14:11:45 +0000
committerJeff Johnston2016-01-15 20:30:53 +0000
commit72f13dec87d463cec3a105623905026153c1b5d2 (patch)
treee7458eb03b9345e9437d071b1eab9f78d9a64dd1
parent99a0a88d11de8485f75b287698443e2efad69845 (diff)
downloadorg.eclipse.linuxtools-72f13dec87d463cec3a105623905026153c1b5d2.tar.gz
org.eclipse.linuxtools-72f13dec87d463cec3a105623905026153c1b5d2.tar.xz
org.eclipse.linuxtools-72f13dec87d463cec3a105623905026153c1b5d2.zip
Bug 479755 -SWTException below DockerContainersView$10.run
Although exception message is HIDDEN, it seems to be due to the viewer's table being disposed (see Widget#checkWidget()) Change-Id: I865120b39d5e46e95c0b469ed0341666d212239a Signed-off-by: Xavier Coulon <xcoulon@redhat.com> Reviewed-on: https://git.eclipse.org/r/64366 Tested-by: Hudson CI Reviewed-by: Jeff Johnston <jjohnstn@redhat.com> (cherry picked from commit e5fb339217c6a6b9247d606420d274295eee739b) Reviewed-on: https://git.eclipse.org/r/64488
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/DockerContainersView.java29
1 files changed, 19 insertions, 10 deletions
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/DockerContainersView.java b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/DockerContainersView.java
index b3f1efa390..da5ede59fd 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/DockerContainersView.java
+++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/DockerContainersView.java
@@ -152,7 +152,7 @@ public class DockerContainersView extends ViewPart implements
}
private void createTableViewer(final Composite container) {
- search = new Text(container, SWT.SEARCH | SWT.ICON_SEARCH);
+ this.search = new Text(container, SWT.SEARCH | SWT.ICON_SEARCH);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(search);
search.addModifyListener(onSearch());
Composite tableArea = new Composite(container, SWT.NONE);
@@ -163,7 +163,7 @@ public class DockerContainersView extends ViewPart implements
tableArea.setLayout(tableLayout);
this.viewer = new TableViewer(tableArea, SWT.FULL_SELECTION | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
this.viewer.setContentProvider(new DockerContainersContentProvider());
- final Table table = viewer.getTable();
+ final Table table = this.viewer.getTable();
GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).applyTo(table);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(table);
table.setLinesVisible(true);
@@ -275,7 +275,7 @@ public class DockerContainersView extends ViewPart implements
// Set column a second time so we reverse the order and default to most
// currently created containers first
comparator.setColumn(creationDateColumn.getColumn());
- viewer.setComparator(comparator);
+ this.viewer.setComparator(comparator);
// apply search filter
this.viewer.addFilter(getContainersFilter());
IDockerConnection[] connections = DockerConnectionManager.getInstance()
@@ -285,7 +285,7 @@ public class DockerContainersView extends ViewPart implements
connection.addContainerListener(this);
}
// get the current selection in the tableviewer
- getSite().setSelectionProvider(viewer);
+ getSite().setSelectionProvider(this.viewer);
}
private TableViewerColumn createColumn(final String title) {
@@ -322,7 +322,9 @@ public class DockerContainersView extends ViewPart implements
@Override
public void modifyText(final ModifyEvent e) {
- DockerContainersView.this.viewer.refresh();
+ if (DockerContainersView.this.viewer != null) {
+ DockerContainersView.this.viewer.refresh();
+ }
}
};
}
@@ -371,8 +373,12 @@ public class DockerContainersView extends ViewPart implements
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
- DockerContainersView.this.viewer.refresh();
- refreshViewTitle();
+ if (DockerContainersView.this.viewer != null
+ && !DockerContainersView.this.viewer.getTable()
+ .isDisposed()) {
+ DockerContainersView.this.viewer.refresh();
+ refreshViewTitle();
+ }
}
});
}
@@ -387,10 +393,10 @@ public class DockerContainersView extends ViewPart implements
public void setConnection(IDockerConnection conn) {
this.connection = conn;
- if (conn != null) {
- viewer.setInput(conn);
+ if (conn != null && this.viewer != null) {
+ this.viewer.setInput(conn);
refreshViewTitle();
- } else {
+ } else if (this.viewer != null) {
viewer.setInput(new IDockerContainer[0]);
form.setText(DVMessages.getString(DaemonMissing));
}
@@ -418,6 +424,9 @@ public class DockerContainersView extends ViewPart implements
* @param enabled the argument to enable/disable the filter.
*/
public void showAllContainers(boolean enabled) {
+ if (DockerContainersView.this.viewer == null) {
+ return;
+ }
if(!enabled) {
this.viewer.addFilter(hideStoppedContainersViewerFilter);

Back to the top