Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Baron2011-12-20 01:34:30 -0500
committerElliott Baron2011-12-20 01:34:30 -0500
commitf4d49d248170bf5c5ba8b954aac61903e1ca4168 (patch)
tree7e2102cca5722e001e277daf9931418dab52bb02 /valgrind
parentc0bc29832e91814ee5413b704bef9dd666d0221c (diff)
downloadorg.eclipse.linuxtools-f4d49d248170bf5c5ba8b954aac61903e1ca4168.tar.gz
org.eclipse.linuxtools-f4d49d248170bf5c5ba8b954aac61903e1ca4168.tar.xz
org.eclipse.linuxtools-f4d49d248170bf5c5ba8b954aac61903e1ca4168.zip
Bug #366831 Fix toolbar creation problems when Valgrind view does not have focus.
Diffstat (limited to 'valgrind')
-rw-r--r--valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/internal/valgrind/ui/ValgrindUIPlugin.java2
-rw-r--r--valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/internal/valgrind/ui/ValgrindViewPart.java15
2 files changed, 17 insertions, 0 deletions
diff --git a/valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/internal/valgrind/ui/ValgrindUIPlugin.java b/valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/internal/valgrind/ui/ValgrindUIPlugin.java
index d3d9ce9015..8663fd9197 100644
--- a/valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/internal/valgrind/ui/ValgrindUIPlugin.java
+++ b/valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/internal/valgrind/ui/ValgrindUIPlugin.java
@@ -91,6 +91,8 @@ public class ValgrindUIPlugin extends AbstractUIPlugin {
try {
activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
activePage.showView(ValgrindUIConstants.VIEW_ID, null, IWorkbenchPage.VIEW_CREATE);
+ // Bug #366831 Need to show the view otherwise the toolbar is disposed.
+ activePage.showView(ValgrindUIConstants.VIEW_ID);
// create the view's tool specific controls and populate content description
view.createDynamicContent(contentDescription, toolID);
diff --git a/valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/internal/valgrind/ui/ValgrindViewPart.java b/valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/internal/valgrind/ui/ValgrindViewPart.java
index 8451685f85..b9c1d61a3f 100644
--- a/valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/internal/valgrind/ui/ValgrindViewPart.java
+++ b/valgrind/org.eclipse.linuxtools.valgrind.ui/src/org/eclipse/linuxtools/internal/valgrind/ui/ValgrindViewPart.java
@@ -11,11 +11,14 @@
package org.eclipse.linuxtools.internal.valgrind.ui;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.linuxtools.internal.valgrind.core.ValgrindInfo;
import org.eclipse.linuxtools.valgrind.core.IValgrindMessage;
import org.eclipse.linuxtools.valgrind.ui.IValgrindToolView;
@@ -24,6 +27,7 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.ui.part.PageBook;
import org.eclipse.ui.part.ViewPart;
@@ -75,6 +79,11 @@ public class ValgrindViewPart extends ViewPart {
// remove tool specific toolbar controls
IToolBarManager toolbar = getViewSite().getActionBars().getToolBarManager();
+ ToolBar tb = ((ToolBarManager) toolbar).getControl();
+ if (tb == null || tb.isDisposed()) {
+ throw new CoreException(new Status(IStatus.ERROR, ValgrindUIPlugin.PLUGIN_ID, "Toolbar is disposed"));
+ }
+
if (dynamicActions != null) {
for (ActionContributionItem item : dynamicActions) {
toolbar.remove(item);
@@ -128,6 +137,8 @@ public class ValgrindViewPart extends ViewPart {
menu.update(true);
toolbar.update(true);
+ // Update to notify the workbench items have been changed
+ getViewSite().getActionBars().updateActionBars();
dynamicViewHolder.layout(true);
return dynamicView;
@@ -173,6 +184,10 @@ public class ValgrindViewPart extends ViewPart {
if (dynamicView != null) {
dynamicView.dispose();
}
+
+ // Unset this view in the UI plugin
+ ValgrindUIPlugin.getDefault().setView(null);
+
super.dispose();
}

Back to the top