blob: 723bc62035437281de62c6570ffc08e04772d45c [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2007 IBM 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
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
* Bundesinstitut für Risikobewertung
*******************************************************************************/
package org.eclipse.stem.ui.views.graphmap;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.stem.jobs.simulation.SimulationManager;
import org.eclipse.stem.ui.views.IContextMenuUpdatesListener;
import org.eclipse.stem.ui.views.graphmap.GraphMapViewer;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.part.ViewPart;
/**
* This class is a {@link ViewPart} that renders Lat/Long data for active
* Simulations.
*/
public class GraphMapView extends ViewPart implements
IContextMenuUpdatesListener {
/**
* The viewer that displays the geographic state of the simulations.
*/
private GraphMapViewer geographicViewer;
/**
* Default Constructor
*/
public GraphMapView() {
super();
}
@Override
public void createPartControl(Composite parent) {
geographicViewer = new GraphMapViewer(parent);
// Set this instance to be a listener for context menu updates
geographicViewer.addContextMenuUpdateListener(this);
geographicViewer.setInput(SimulationManager.getManager());
getSite().setSelectionProvider(geographicViewer);
}
@Override
public void setFocus() {
// Nothing
}
@Override
public void dispose() {
getSite().setSelectionProvider(null);
geographicViewer.removeContextMenuUpdateListener(this);
geographicViewer.setInput(null);
}
@Override
public void onContextMenuUpdate(MenuManager menuManager,
ISelectionProvider selectionProvider) {
getSite().registerContextMenu(
"org.eclipse.stem.ui.views.geographic.map.context",
menuManager, selectionProvider);
}
}