mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 06:02:11 +02:00
Bug 453227 - [visualizer] VisualizerView: view menu not refreshed when
opened Change-Id: I43290b4e4632eb9bfc963510ac2fc3960e653fd6 Reviewed-on: https://git.eclipse.org/r/37072 Reviewed-by: Marc Khouzam <marc.khouzam@ericsson.com> Tested-by: Hudson CI Reviewed-by: Marc Dumais <marc.dumais@ericsson.com> Tested-by: Marc Dumais <marc.dumais@ericsson.com>
This commit is contained in:
parent
5aa786349f
commit
6dfebae4d3
3 changed files with 61 additions and 10 deletions
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
|||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %plugin.name
|
||||
Bundle-SymbolicName: org.eclipse.cdt.visualizer.ui;singleton:=true
|
||||
Bundle-Version: 1.1.0.qualifier
|
||||
Bundle-Version: 1.2.0.qualifier
|
||||
Bundle-Activator: org.eclipse.cdt.visualizer.ui.plugin.CDTVisualizerUIPlugin
|
||||
Bundle-Vendor: %provider.name
|
||||
Require-Bundle: org.eclipse.ui,
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<artifactId>org.eclipse.cdt.visualizer.ui</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
</project>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2012 Tilera Corporation and others.
|
||||
* Copyright (c) 2012, 2014 Tilera Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -8,6 +8,7 @@
|
|||
* Contributors:
|
||||
* William R. Swanson (Tilera Corporation)
|
||||
* Marc Dumais (Ericsson) - bug 436095
|
||||
* Marc Dumais (Ericsson) - bug 453227
|
||||
*******************************************************************************/
|
||||
|
||||
// Package declaration
|
||||
|
@ -135,6 +136,7 @@ public class VisualizerView
|
|||
m_viewer.addVisualizerViewerListener(this);
|
||||
m_viewer.addSelectionChangedListener(this);
|
||||
updateUI();
|
||||
populateMenu();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -164,6 +166,9 @@ public class VisualizerView
|
|||
// set up context menu support
|
||||
initializeContextMenu();
|
||||
|
||||
// setup the view menu
|
||||
initializeMenu();
|
||||
|
||||
// set up selection handling
|
||||
initializeSelectionHandling();
|
||||
|
||||
|
@ -355,23 +360,69 @@ public class VisualizerView
|
|||
toolBarManager.add(m_openNewViewAction);
|
||||
toolBarManager.update(true);
|
||||
|
||||
// Allow presentation to set the toolbar's menu content, if any
|
||||
IMenuManager menuManager = actionBars.getMenuManager();
|
||||
menuManager.removeAll();
|
||||
m_viewer.populateMenu(menuManager);
|
||||
menuManager.update(true);
|
||||
|
||||
// Note: when context menu is invoked,
|
||||
// the poplateContextMenu() method is called by the view,
|
||||
// the populateContextMenu() method is called by the view,
|
||||
// which in turn delegates to the current visualizer
|
||||
// to populate the context menu.
|
||||
|
||||
// Note2: when view menu is invoked,
|
||||
// the populateMenu() method is called by the view,
|
||||
// which in turn delegates to the current visualizer
|
||||
// to populate the view menu.
|
||||
|
||||
// Propagate the changes
|
||||
actionBars.updateActionBars();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// --- view menu support ---
|
||||
|
||||
/** Utility method that returns the menu manager for the view menu
|
||||
* @since 1.2*/
|
||||
protected IMenuManager getViewMenuManager() {
|
||||
IActionBars actionBars = getViewSite().getActionBars();
|
||||
return actionBars.getMenuManager();
|
||||
}
|
||||
|
||||
/** Initialize the view menu
|
||||
* @since 1.2*/
|
||||
protected void initializeMenu() {
|
||||
IMenuManager menuManager = getViewMenuManager();
|
||||
menuManager.addMenuListener(new IMenuListener2() {
|
||||
public void menuAboutToShow(IMenuManager m) {
|
||||
viewMenuShow(m);
|
||||
}
|
||||
public void menuAboutToHide(IMenuManager m) {
|
||||
viewMenuHide(m);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** Invoked when the viewer is set to do an initial populating of the view
|
||||
* menu. Without this, the view menu would not appear.
|
||||
* @since 1.2*/
|
||||
protected void populateMenu() {
|
||||
IMenuManager menuManager = getViewMenuManager();
|
||||
viewMenuShow(menuManager);
|
||||
}
|
||||
|
||||
/** Invoked when view menu is about to be shown.
|
||||
* @since 1.2*/
|
||||
protected void viewMenuShow(IMenuManager m)
|
||||
{
|
||||
m.removeAll();
|
||||
m_viewer.populateMenu(m);
|
||||
m.update();
|
||||
}
|
||||
|
||||
/** Invoked when view menu is about to be hidden.
|
||||
* @since 1.2*/
|
||||
protected void viewMenuHide(IMenuManager m)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// --- context menu support ---
|
||||
|
||||
/** Sets up context menu support. */
|
||||
|
|
Loading…
Add table
Reference in a new issue