public void initialize(PlugInContext context) throws Exception {
    menuTree = new MenuTree();
    Services.registerService(
        MapContextManager.class,
        "Gives access to the current MapContext",
        new DefaultMapContextManager());
    Services.registerService(ViewPlugIn.class, "Gives access to the current MapContext", this);

    Automaton defaultTool = (Automaton) Services.getService(Automaton.class);
    this.defaultTool = defaultTool;
    this.defaultMouseCursor = OrbisGISIcon.ZOOMIN;
    editors = new String[0];
    setPlugInContext(context);
    if (context
            .getWorkbenchContext()
            .getWorkbench()
            .getFrame()
            .getViewDecorator(Names.EDITOR_MAP_ID)
        == null)
      context
          .getWorkbenchContext()
          .getWorkbench()
          .getFrame()
          .getViews()
          .add(new ViewDecorator(this, Names.EDITOR_MAP_ID, getIcon("map.png"), editors));
  }
 public void initialize(PlugInContext context) throws Exception {
   WorkbenchContext wbContext = context.getWorkbenchContext();
   WorkbenchFrame frame = wbContext.getWorkbench().getFrame().getTableEditor();
   wbContext.getWorkbench().getFrame().getEditionTableToolBar().addPlugIn(this, btn, context);
   context
       .getFeatureInstaller()
       .addPopupMenuItem(
           frame,
           this,
           new String[] {Names.POPUP_TABLE_UP_PATH1},
           Names.POPUP_TABLE_UP_GROUP,
           false,
           OrbisGISIcon.REVERT,
           wbContext);
 }
 @Override
 public void initialize(PlugInContext context) throws Exception {
   WorkbenchContext wbContext = context.getWorkbenchContext();
   WorkbenchFrame frame = wbContext.getWorkbench().getFrame().getGeocatalog();
   context
       .getFeatureInstaller()
       .addPopupMenuItem(
           frame,
           this,
           new String[] {Names.POPUP_TOC_SAVE_PATH1},
           Names.POPUP_TOC_INACTIVE_GROUP,
           false,
           OrbisGISIcon.SAVE,
           wbContext);
 }
  @Override
  public boolean execute(PlugInContext context) throws Exception {
    String[] res = getPlugInContext().getSelectedSources();
    final Catalog geocatalog =
        context.getWorkbenchContext().getWorkbench().getFrame().getGeocatalog();
    for (int i = 0; i < res.length; i++) {
      final String name = res[i];
      final EditableSource s = geocatalog.getEditingSource(name);
      if (s.isModified()) {
        try {
          s.getDataSource().commit();
        } catch (DriverException e) {
          ErrorMessages.error(ErrorMessages.CannotSaveSource, e);
        } catch (NonEditableDataSourceException e) {
          ErrorMessages.error(ErrorMessages.CannotSaveSource, e);
        }
      }
      JOptionPane.showMessageDialog(
          geocatalog, I18N.getString("orbisgis.org.orbisgis.core.geocatalog.sourceSaved"));
    }
    // DO NOT REMOVE
    // this call is needed to work around a strange Swing painting problem
    // when using for the first time our custom SourceListRender
    // to display a change in the font of a listed source
    geocatalog.repaint();

    return true;
  }
예제 #5
0
 public void initialize(PlugInContext context) throws Exception {
   WorkbenchContext wbcontext = context.getWorkbenchContext();
   wbcontext.getWorkbench().getFrame().getEditionMapToolBar().addPlugIn(this, btn, context);
 }
 public boolean execute(PlugInContext context) throws Exception {
   IEditor editor = context.getActiveEditor();
   TableEditorPlugIn te = (TableEditorPlugIn) editor;
   te.revertSelection();
   return true;
 }
예제 #7
0
 @Override
 public void update(Observable o, Object arg) {
   PlugInContext.checkTool(this);
 }