public MapEditorPlugIn() {
    WorkbenchContext wbContext = Services.getService(WorkbenchContext.class);
    mapEditor = new RootPanePanel();
    mapControl = new MapControl();
    // Map editor tool bar
    mapToolBar = new WorkbenchToolBar(wbContext, Names.MAP_TOOLBAR_NAME);

    WorkbenchToolBar scaleToolBar = new WorkbenchToolBar(wbContext, Names.MAP_TOOLBAR_SCALE);
    mapToolBar.add(scaleToolBar);
    mapToolBar.add(Box.createHorizontalGlue());

    WorkbenchToolBar projectionToolBar =
        new WorkbenchToolBar(wbContext, Names.MAP_TOOLBAR_PROJECTION);
    mapToolBar.add(projectionToolBar);
  }
  public void setElement(EditableElement element) {
    MapContext mapContext = (MapContext) element.getObject();
    try {
      mapControl.setMapContext(mapContext);
      mapControl.setElement(element);
      mapControl.setDefaultTool(getIndependentToolInstance(defaultTool, defaultMouseCursor));
      mapControl.initMapControl();
      mapEditor.setContentPane(mapControl);
      mapToolBar.setPreferredSize(new Dimension(mapControl.getWidth(), 30));
      mapToolBar.setFloatable(false);
      mapEditor.add(mapToolBar, BorderLayout.PAGE_END);

    } catch (TransitionException e) {
      Services.getErrorManager().error(I18N.getString("orbisgis.core.tool.not_valid"), e);
    } catch (InstantiationException e) {
      Services.getErrorManager().error(I18N.getString("orbisgis.core.tool.not_valid"), e);
    } catch (IllegalAccessException e) {
      Services.getErrorManager().error(I18N.getString("orbisgis.core.tool.not_valid"), e);
    }

    this.mapElement = element;
  }
 public WorkbenchToolBar getToolBarById(String id) {
   return mapToolBar.getToolbars().get(id);
 }
 public WorkbenchToolBar getProjectionToolBar() {
   return mapToolBar.getToolbars().get(Names.MAP_TOOLBAR_PROJECTION);
 }
 public WorkbenchToolBar getScaleToolBar() {
   return mapToolBar.getToolbars().get(Names.MAP_TOOLBAR_SCALE);
 }