/**
  * Ajusta el tamaño de la ventana al envelope pasado como parámetro
  *
  * @param ctx
  * @param newWrapperEnvelope
  * @param viewport
  */
 public static void resizeViewToEnvelope(
     PlugInContext ctx, Envelope newWrapperEnvelope, IViewport viewport) {
   // ajustamos las proporciones de la ventana a las de la feature
   JInternalFrame activeInternalFrame = ctx.getActiveInternalFrame();
   Dimension dimView = ((Dimension) ctx.getLayerViewPanel()).getSize();
   Double widthView = dimView.getWidth();
   Double heightView = dimView.getHeight();
   int widthDiff = (int) (activeInternalFrame.getWidth() - widthView);
   int heightDiff = (int) (activeInternalFrame.getHeight() - heightView);
   Integer newWidth =
       (int)
           ((newWrapperEnvelope.getWidth() / viewport.getEnvelopeInModelCoordinates().getWidth())
               * widthView);
   Integer newHeight =
       (int)
           ((newWrapperEnvelope.getHeight() / viewport.getEnvelopeInModelCoordinates().getHeight())
               * heightView);
   Dimension newDimensionView = new Dimension(newWidth + widthDiff, newHeight + heightDiff);
   activeInternalFrame.setSize(newDimensionView);
   // zoom al envelope actual
   try {
     viewport.zoom(newWrapperEnvelope);
   } catch (NoninvertibleTransformException e) {
     log.warn("No se ha podido alcanzar el zoom " + newWrapperEnvelope);
   }
 }
  public boolean execute(PlugInContext context) throws Exception {
    reportNothingToUndoYet(context);

    // limpiamos lo que haya podido quedar de ejecuciones anteriores
    emptyBlackboard();

    WizardDialog d =
        new WizardDialog(
            GeopistaUtil.getFrame(context.getWorkbenchGuiComponent()),
            Constants.APLICACION.getI18nString("ExtractDialogGestionar"),
            context.getErrorHandler());
    d.init(
        new WizardPanel[] {
          new MobileModifyPanel01("MobileModifyPanel01", null, context),
        });

    d.setSize(520, 650);
    d.setLocation(10, 20);
    d.setVisible(true);

    if (!d.wasFinishPressed()) {
      LayerManager layerManager = context.getLayerManager();
      if (layerManager != null) {
        Layer graticuleLayer = layerManager.getLayer(GraticuleCreatorEngine.getGraticuleName());
        // si existe una cuadrícula la borramos
        if (graticuleLayer != null) {
          layerManager.remove(graticuleLayer);
        }
      }
      return false;
    }

    return true;
  }
  public boolean execute(PlugInContext context) throws Exception {
    if (context.getLayerViewPanel() == null) {
      return false;
    }
    try {
      if (app.getBlackboard().get("temporalincidents") != null)
        app.getBlackboard().put("temporalincidents", new ArrayList<IdEdgeNetworkBean>());

      // JOptionPane.showMessageDialog(app.getMainFrame(),I18N.get("temporalIncidents","routeengine.temporalincidents.remove.removed"));
    } catch (Exception e) {
      context
          .getLayerViewPanel()
          .getContext()
          .warnUser(I18N.get("temporalIncidents", "routeengine.temporalincidents.remove.error"));
      return false;
    }
    JOptionPane.showMessageDialog(
        context.getWorkbenchFrame(),
        I18N.get("temporalIncidents", "routeengine.temporalincidents.remove.removed"));
    context
        .getLayerViewPanel()
        .getContext()
        .setStatusMessage(
            I18N.get("temporalIncidents", "routeengine.temporalincidents.remove.removed"));
    return true;
  }
  /** Inicialización del plugin para cargarlo desde el fichero workbench.properties */
  public void initialize(PlugInContext context) throws Exception {
    // para internacionalización
    Locale currentLocale = I18N.getLocaleAsObject();
    ResourceBundle bundle =
        ResourceBundle.getBundle(
            "com.geopista.ui.plugin.mobile.language.PluginMobileExtracti18n", currentLocale);
    I18N.plugInsResourceBundle.put(PluginMobileExtracti18n, bundle);

    FeatureInstaller featureInstaller = new FeatureInstaller(context.getWorkbenchContext());

    EnableCheckFactory checkFactory = context.getCheckFactory();
    featureInstaller.addMainMenuItem(
        this,
        new String[] {"Tools", MobilePluginI18NResource.GEOPISTAConfiguration_proyectMovil},
        I18N.get(PluginMobileExtracti18n, MobilePluginI18NResource.MobileModifyPlugin_text),
        false,
        null,
        new MultiEnableCheck()
            .add(checkFactory.createWindowWithLayerNamePanelMustBeActiveCheck())
            .add(checkFactory.createAdminUserCheck()));

    ((WorkbenchGuiComponent) context.getWorkbenchContext().getIWorkbench().getGuiComponent())
        .getToolBar("Movilidad")
        .addPlugIn(
            this.getIcon(),
            this,
            createEnableCheck(context.getWorkbenchContext()),
            context.getWorkbenchContext());
  }
 public void initialize(PlugInContext context) throws Exception {
   saveDatasetDialog =
       new DriverDialog(
           GeopistaFunctionUtils.getFrame(context.getWorkbenchGuiComponent()),
           "Save Dataset",
           true);
   saveDatasetDialog.initialize(context.getDriverManager().getOutputDrivers());
   GUIUtil.centreOnWindow(saveDatasetDialog);
 }
Beispiel #6
0
 public boolean execute(PlugInContext context) throws Exception {
   ((LayerManagerProxy)
           context.getWorkbenchContext().getWorkbench().getFrame().getActiveInternalFrame())
       .getLayerManager()
       .getUndoableEditReceiver()
       .getUndoManager()
       .undo();
   // Exclude the plug-in's activity from the undo history [Jon Aquino]
   reportNothingToUndoYet(context);
   context.getWorkbenchFrame().getToolBar().updateEnabledState();
   return true;
 }
  public boolean execute(final PlugInContext context) throws Exception {
    reportNothingToUndoYet(context);

    Collection features;
    Transferable transferable =
        GUIUtil.getContents(Toolkit.getDefaultToolkit().getSystemClipboard());

    if (transferable.isDataFlavorSupported(
        CollectionOfFeaturesTransferable.COLLECTION_OF_FEATURES_FLAVOR)) {
      features =
          (Collection)
              GUIUtil.getContents(Toolkit.getDefaultToolkit().getSystemClipboard())
                  .getTransferData(CollectionOfFeaturesTransferable.COLLECTION_OF_FEATURES_FLAVOR);
    } else {
      // Allow the user to paste features using WKT. [Jon Aquino]
      features =
          reader
              .read(
                  new StringReader((String) transferable.getTransferData(DataFlavor.stringFlavor)))
              .getFeatures();
    }

    final SelectionManager selectionManager = context.getLayerViewPanel().getSelectionManager();
    final Layer layer = context.getSelectedLayer(0);
    final Collection featureCopies =
        conform(features, layer.getFeatureCollectionWrapper().getFeatureSchema());
    Feature feature = ((Feature) featureCopies.iterator().next());
    Coordinate firstPoint = feature.getGeometry().getCoordinate();
    Coordinate cursorPt =
        context
            .getLayerViewPanel()
            .getViewport()
            .toModelCoordinate(context.getLayerViewPanel().getLastMouseLocation());
    Coordinate displacement = CoordUtil.subtract(cursorPt, firstPoint);
    moveAll(featureCopies, displacement);

    execute(
        new UndoableCommand(getName()) {
          public void execute() {
            layer.getFeatureCollectionWrapper().addAll(featureCopies);
            selectionManager.clear();
            selectionManager.getFeatureSelection().selectItems(layer, featureCopies);
          }

          public void unexecute() {
            layer.getFeatureCollectionWrapper().removeAll(featureCopies);
          }
        },
        context);

    return true;
  }
  public void initialize(PlugInContext context) throws Exception {

    context
        .getWorkbenchContext()
        .getIWorkbench()
        .getGuiComponent()
        .getToolBar()
        .addPlugIn(
            this.getIcon(),
            this,
            this.createEnableCheck(context.getWorkbenchContext()),
            context.getWorkbenchContext());
  }
 public boolean execute(PlugInContext context) throws Exception {
   Collection<Layer> layersWithoutDataSource = layersWithoutDataSource(context.getTask());
   if (layersWithoutDataSource.size() == 0) {
     context.getWorkbenchFrame().warnUser(WARN_USER);
     return false;
   } else {
     int ret = fileChooser.showSaveDialog(context.getWorkbenchFrame());
     if (ret == JFileChooser.APPROVE_OPTION) {
       return execute(context, layersWithoutDataSource, fileChooser.getSelectedFile());
     }
   }
   return false;
 }
 public void addButton(final PlugInContext context) {
   if (!circleButtonAdded) {
     final ToolboxDialog toolbox =
         ((EditingPlugIn) context.getWorkbenchContext().getBlackboard().get(EditingPlugIn.KEY))
             .getToolbox(context.getWorkbenchContext());
     QuasimodeTool quasimodeTool =
         new QuasimodeTool(DrawConstrainedCircleTool.create(toolbox.getContext()));
     quasimodeTool.add(new QuasimodeTool.ModifierKeySpec(true, false, false), null);
     quasimodeTool.add(new QuasimodeTool.ModifierKeySpec(true, true, false), null);
     toolbox.add(quasimodeTool, null);
     toolbox.finishAddingComponents();
     toolbox.validate();
     circleButtonAdded = true;
   }
 }
 public boolean execute(PlugInContext context) throws Exception {
   try {
     CursorTool circleTool =
         DrawConstrainedCircleTool.create((LayerNamePanelProxy) context.getActiveInternalFrame());
     context.getLayerViewPanel().setCurrentCursorTool(circleTool);
     return true;
   } catch (Exception e) {
     context.getWorkbenchFrame().warnUser(errorSeeOutputWindow);
     context.getWorkbenchFrame().getOutputFrame().createNewDocument();
     context
         .getWorkbenchFrame()
         .getOutputFrame()
         .addText("DrawConstrainedCircleTool Exception:" + e.toString());
     return false;
   }
 }
  public void initialize(final PlugInContext context) throws Exception {
    // add a listener so that when the toolbox dialog opens the constrained tools will be added
    // we can't just add the tools directly at this point since the toolbox isn't ready yet

    context
        .getWorkbenchContext()
        .getWorkbench()
        .getFrame()
        .addComponentListener(
            new ComponentAdapter() {
              public void componentShown(ComponentEvent e) {
                final ToolboxDialog toolBox =
                    ((EditingPlugIn)
                            context.getWorkbenchContext().getBlackboard().get(EditingPlugIn.KEY))
                        .getToolbox(context.getWorkbenchContext());
                toolBox.addComponentListener(
                    new ComponentAdapter() {

                      public void componentShown(ComponentEvent e) {
                        addButton(context);
                      }

                      public void componentHidden(ComponentEvent e) {}
                    });
              }
            });
  }
 protected void reportNothingToUndoYet() {
   context
       .getLayerViewPanel()
       .getLayerManager()
       .getUndoableEditReceiver()
       .reportNothingToUndoYet();
 }
  public void initialize(final PlugInContext context) throws Exception {

    GeopistaEditingPlugIn geopistaEditingPlugIn =
        (GeopistaEditingPlugIn)
            (context.getWorkbenchContext().getBlackboard().get(EditingPlugIn.KEY));
    geopistaEditingPlugIn.addAditionalPlugIn(this);
  }
  private void onZoomToRouteButtonDo() {
    if (this.pluginContext != null) {

      //			GeometryFactory geoFactory = new GeometryFactory();
      ArrayList<Geometry> geoArrayList = new ArrayList<Geometry>();
      if (this.infoRoutesStretchBeansCollection != null
          && !this.infoRoutesStretchBeansCollection.isEmpty()) {
        Iterator<InfoRouteStretchBean> it = this.infoRoutesStretchBeansCollection.iterator();
        while (it.hasNext()) {
          InfoRouteStretchBean actualStretchBean = it.next();
          if (actualStretchBean != null
              && actualStretchBean.getGeometries() != null
              && !actualStretchBean.getGeometries().isEmpty()) {
            geoArrayList.addAll(actualStretchBean.getGeometries());
          }
        }
      }
      //			GeometryCollection geoCollection = new GeometryCollection(geoArrayList.toArray(new
      // Geometry[geoArrayList.size()]), geoFactory);

      try {
        zoomToSelectedItemsPlugIn.zoom(geoArrayList, pluginContext.getLayerViewPanel());
      } catch (NoninvertibleTransformException e) {
        e.printStackTrace();
        ErrorDialog.show(
            null,
            "Error resaltar la ruta",
            I18N.get(
                "routedescription", "routeengine.route.description.error.route.not.zoom.message"),
            StringUtil.stackTrace(e));
      }
    }
  }
  public void initialize(PlugInContext context) throws Exception {
    WorkbenchContext workbenchContext = context.getWorkbenchContext();

    EnableCheck enableCheck = createEnableCheck(workbenchContext);
    FeatureInstaller installer = new FeatureInstaller(workbenchContext);
    installer.addMainMenuItem(
        this,
        new String[] {MenuNames.FILE},
        new JMenuItem(getName(), IconLoader.icon("disk_multiple_16.png")),
        createEnableCheck(context.getWorkbenchContext()),
        9);

    fileChooser = new JFCWithEnterAction();
    fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    fileChooser.setDialogTitle(FILECHOOSER);
  }
 public boolean isInputValid() {
   LayerManager layerManager = context.getLayerManager();
   Layer graticuleLayer = layerManager.getLayer(GraticuleCreatorEngine.getGraticuleName());
   if (graticuleLayer == null) {
     return false;
   }
   return true;
 }
  public void initialize(PlugInContext context) throws Exception {

    FeatureInstaller featureInstaller = new FeatureInstaller(context.getWorkbenchContext());

    featureInstaller.addPopupMenuItem(
        context.getWorkbenchContext().getIWorkbench().getGuiComponent().getCategoryPopupMenu(),
        this,
        GeopistaFunctionUtils.i18n_getname(this.getName()),
        false,
        null,
        null);

    featureInstaller.addLayerViewMenuItem(
        this,
        GeopistaFunctionUtils.i18n_getname("Layer"),
        GeopistaFunctionUtils.i18n_getname(this.getName()));
  }
  @Override
  public boolean execute(PlugInContext context) throws Exception {
    Blackboard bb = get(context.getWorkbenchContext());
    WorkbenchFrame wbframe = context.getWorkbenchFrame();

    String fileName = (String) bb.get("ArcMapStylePlugin.filename");

    File am2sld = findArcMap2SLD(wbframe, bb);
    if (am2sld == null) {
      return false;
    }

    ProcessBuilder pb = new ProcessBuilder(am2sld.toString());
    pb.start().waitFor(); // unfortunately, the code seems to always be
    // zero

    showMessageDialog(
        wbframe,
        get(
            "org.openjump.core.ui.plugin.style.ImportArcMapStylePlugIn.Must-Select-Location-Of-SLD"),
        get("org.openjump.core.ui.plugin.style.ImportSLDPlugIn.Question"),
        INFORMATION_MESSAGE);

    JFileChooser chooser = new JFileChooser();

    if (fileName != null) {
      chooser.setCurrentDirectory(new File(fileName).getParentFile());
    }

    int res = chooser.showOpenDialog(context.getWorkbenchFrame());
    if (res == APPROVE_OPTION) {
      File f = chooser.getSelectedFile();
      if (!f.exists()) {
        return false;
      }
      bb.put("ArcMapStylePlugin.filename", f.getAbsoluteFile().toString());

      DocumentBuilderFactory dbf = newInstance();
      dbf.setNamespaceAware(true);
      Document doc = dbf.newDocumentBuilder().parse(f);

      importSLD(doc, context);
    }

    return false;
  }
  public boolean execute(PlugInContext context) throws Exception {
    reportNothingToUndoYet(context);
    layer = (Layer) context.getSelectedLayer(0);
    saveDatasetDialog.setLayer(layer);
    saveDatasetDialog.setVisible(true);

    return saveDatasetDialog.wasOKPressed();
  }
  public void initialize(PlugInContext context) throws Exception {

    context
        .getFeatureInstaller()
        .addMainMenuItem(this, new String[] {"OpenGestorFip"}, getName(), false, null, null);

    context
        .getWorkbenchContext()
        .getIWorkbench()
        .getGuiComponent()
        .getToolBar("OpenGestorFip")
        .addPlugIn(
            getIcon(),
            this,
            createEnableCheck(context.getWorkbenchContext()),
            context.getWorkbenchContext());

    JPopupMenu popupMenu = context.getWorkbenchGuiComponent().getLayerViewPopupMenu();

    FeatureInstaller featureInstaller = new FeatureInstaller(context.getWorkbenchContext());
    featureInstaller.addPopupMenuItem(
        popupMenu,
        this,
        AppContext.getApplicationContext().getI18nString(this.getName()),
        false,
        null,
        createEnableCheck(context.getWorkbenchContext()));
  }
 public void run(TaskMonitor monitor, PlugInContext context) throws Exception {
   // -- get the LM because when the Histogram will be shown, the app. focus
   //   will change and context.addLayer will not work (null pointer exc.)
   // [mmichaud 2012-04-09] to completely resolve this problem, I added the
   // new JInternalFrame is added after the addLayer method has been called
   this.currentLM = context.getLayerManager();
   monitor.allowCancellationRequests();
   if (this.selAttribute == null) {
     context.getWorkbenchFrame().warnUser(I18N.get(sNoAttributeChoosen));
     return;
   }
   javax.swing.JInternalFrame internalFrame = context.getWorkbenchFrame().getActiveInternalFrame();
   FeatureDataset result = classifyAndCreatePlot(monitor, context);
   context.getWorkbenchFrame().activateFrame(internalFrame);
   if (result == null) {
     context.getWorkbenchFrame().warnUser(I18N.get(sNotEnoughValuesWarning));
   } else if (result.size() > 0) {
     String name = this.selAttribute + "_" + this.selClassifier;
     this.currentLM.addLayer(StandardCategoryNames.WORKING, name, result);
     JInternalFrame frame = new JInternalFrame(this.sHistogram);
     frame.setLayout(new BorderLayout());
     frame.add(plot, BorderLayout.CENTER);
     frame.setClosable(true);
     frame.setResizable(true);
     frame.setMaximizable(true);
     frame.setSize(450, 450);
     context.getWorkbenchFrame().addInternalFrame(frame);
     plot = null;
   } else {
     context.getWorkbenchFrame().warnUser(sWarning);
   }
 }
  @Override
  public void initialize(PlugInContext context) throws Exception {
    super.initialize(context);

    GeopistaNetworkEditingPlugIn geopistaNetworkEditingPlugIn =
        (GeopistaNetworkEditingPlugIn)
            (context.getWorkbenchContext().getBlackboard().get(GeopistaNetworkEditingPlugIn.KEY));
    geopistaNetworkEditingPlugIn.addAditionalPlugIn(this);
  }
  @Override
  public void initialize(PlugInContext context) throws Exception {
    EnableCheckFactory enableCheckFactory = new EnableCheckFactory(context.getWorkbenchContext());

    EnableCheck enableCheck =
        new MultiEnableCheck()
            .add(enableCheckFactory.createWindowWithLayerManagerMustBeActiveCheck())
            .add(
                enableCheckFactory.createExactlyNLayerablesMustBeSelectedCheck(1, Layerable.class));

    context
        .getFeatureInstaller()
        .addMainMenuItem(
            this,
            new String[] {LAYER},
            get("org.openjump.core.ui.plugin.style.ImportArcMapStylePlugIn.name"),
            false,
            null,
            enableCheck);
  }
  private void setDialogValues(MultiInputDialog dialog, PlugInContext context) {

    dialog.setSideBarDescription(sideBarText);

    dialog.addLayerComboBox(CLAYER, context.getCandidateLayer(0), context.getLayerManager());

    List listNumAttributes =
        FeatureSchemaTools.getFieldsFromLayerWithoutGeometryAndString(context.getCandidateLayer(0));
    Object valAttribute = listNumAttributes.size() > 0 ? listNumAttributes.iterator().next() : null;
    final JComboBox jcb_attribute =
        dialog.addComboBox(this.ATTRIBUTE, valAttribute, listNumAttributes, this.ATTRIBUTE);
    if (listNumAttributes.size() == 0) jcb_attribute.setEnabled(false);

    List listClassifiers = Classifier1D.getAvailableClassificationMethods();
    Object valClassifier =
        listNumAttributes.size() > 0 ? listNumAttributes.iterator().next() : null;
    final JComboBox jcb_classifier =
        dialog.addComboBox(this.CLASSIFIER, valClassifier, listClassifiers, this.CLASSIFIER);

    dialog.addIntegerField(T2, this.ranges, 6, T2);

    dialog.addCheckBox(this.OPTIMIZEWITHKMEANS, false);

    dialog.addCheckBox(this.PROCESSNULLASZERO, false);

    dialog
        .getComboBox(CLAYER)
        .addActionListener(
            new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                List list = getFieldsFromLayerWithoutGeometryAndString();
                if (list.size() == 0) {
                  jcb_attribute.setModel(new DefaultComboBoxModel(new String[0]));
                  jcb_attribute.setEnabled(false);
                } else {
                  jcb_attribute.setModel(new DefaultComboBoxModel(list.toArray(new String[0])));
                  jcb_attribute.setEnabled(true);
                }
              }
            });
  }
  public boolean execute(PlugInContext context) throws Exception {
    Collection selectedCategories = context.getLayerNamePanel().getSelectedCategories();

    String actualName = aplicacion.getI18nString("GeopistaAddNewLayerPlugIn.New");

    GeopistaLayer layer =
        new GeopistaLayer(
            actualName,
            context.getLayerManager().generateLayerFillColor(),
            createBlankFeatureCollection(),
            context.getLayerManager());
    // Como es una capa creada localmente asignamos el flag isLocal a true
    layer.setLocal(true);

    // com.geopista.io.datasource.GeopistaStandarReaderWriteFileDataSource.GeoGML
    // h = new
    // com.geopista.io.datasource.GeopistaStandarReaderWriteFileDataSource.GeoGML();
    // layer.setDataSourceQuery(new DataSourceQuery());

    context
        .getLayerManager()
        .addLayer(
            selectedCategories.isEmpty()
                ? StandardCategoryNames.WORKING
                : selectedCategories.iterator().next().toString(),
            layer);

    ((EditingPlugIn) context.getWorkbenchContext().getBlackboard().get(EditingPlugIn.KEY))
        .getToolbox(context.getWorkbenchContext())
        .setVisible(true);

    return true;
  }
  public void initialize(PlugInContext context) throws Exception {

    String pluginCategory = aplicacion.getString(toolBarCategory);
    ((WorkbenchGuiComponent) context.getWorkbenchContext().getIWorkbench().getGuiComponent())
        .getToolBar(pluginCategory)
        .addPlugIn(
            getIcon(),
            this,
            createEnableCheck(context.getWorkbenchContext()),
            context.getWorkbenchContext());

    JPopupMenu popupMenu = context.getWorkbenchGuiComponent().getLayerViewPopupMenu();

    // JPopupMenu layerNamePopupMenu = context.getWorkbenchContext().getIWorkbench()
    // .getGuiComponent()
    // .getLayerNamePopupMenu();

    FeatureInstaller featureInstaller = new FeatureInstaller(context.getWorkbenchContext());

    featureInstaller.addPopupMenuItem(
        popupMenu,
        this,
        aplicacion.getI18nString(getName()),
        false,
        GUIUtil.toSmallIcon(ICON),
        createEnableCheck(context.getWorkbenchContext()));
    // null);

  }
  private void onInfoRouteListMosueOver(Point point) {
    Object value = null;
    try {
      int pos = infoRouteJList.locationToIndex(point);
      value = ((DefaultListModel) infoRouteJList.getModel()).get(pos);

      if (value != null && value instanceof InfoRouteStretchBean) {
        InfoRouteStretchBean actualStretchBean = (InfoRouteStretchBean) value;
        ArrayList<Geometry> geoArrayList = new ArrayList<Geometry>();
        if (actualStretchBean != null
            && actualStretchBean.getGeometries() != null
            && !actualStretchBean.getGeometries().isEmpty()) {
          geoArrayList.addAll(actualStretchBean.getGeometries());
        }

        if (value instanceof TurnRouteStreetchBean) {
          GeometryFactory geoFactory = new GeometryFactory();
          if (((TurnRouteStreetchBean) value).getTurnNode() != null) {
            geoArrayList.add(
                geoFactory.createPoint(
                    ((XYNode) ((TurnRouteStreetchBean) value).getTurnNode()).getCoordinate()));
          }
        }

        GeometryFactory geoFactory = new GeometryFactory();
        GeometryCollection geoCollection =
            new GeometryCollection(
                geoArrayList.toArray(new Geometry[geoArrayList.size()]), geoFactory);

        pluginContext.getLayerViewPanel().flash(geoCollection);

        try {
          //					Component comp = getInfoListPanel().getComponentAt(point);
          //					 if (comp != null){
          //						comp.setBackground(Color.LIGHT_GRAY);
          //						 comp.setForeground(Color.RED);
          //					 }
        } catch (Exception e) {
          e.printStackTrace();
        }
      }

    } catch (Exception ex) {
      ex.printStackTrace();
      ErrorDialog.show(
          null,
          "Error resaltar un tramo de la ruta.",
          I18N.get(
              "routedescription", "routeengine.route.description.error.route.not.zoom.message"),
          StringUtil.stackTrace(ex));
    }
  }
  public boolean execute(PlugInContext context, Collection<Layer> collection, File dir)
      throws Exception {
    MultiInputDialog dialog =
        new MultiInputDialog(context.getWorkbenchFrame(), LAYERS_WITHOUT_DATASOURCE, true);

    String tooltip =
        "<html>"
            + java.util.Arrays.toString(collection.toArray(new Object[0])).replaceAll(",", "<br>")
            + "</html>";

    dialog
        .addSubTitle(
            I18N.getMessage(
                "org.openjump.core.ui.plugin.file.SaveLayersWithoutDataSourcePlugIn.layers-without-datasource",
                new Object[] {new Integer(collection.size())}))
        .setToolTipText(tooltip);
    dialog
        .addLabel(
            I18N.get(
                "org.openjump.core.ui.plugin.file.SaveLayersWithoutDataSourcePlugIn.hover-the-label-to-see-the-list"))
        .setToolTipText(tooltip);
    dialog.addRadioButton(DONOTSAVE, "ACTION", true, "");
    dialog.addRadioButton(SAVEASJML, "ACTION", false, "");
    dialog.addRadioButton(SAVEASSHP, "ACTION", false, "");

    GUIUtil.centreOnWindow(dialog);
    dialog.setVisible(true);
    if (dialog.wasOKPressed()) {
      if (dialog.getBoolean(DONOTSAVE)) {
        return false;
      } else {
        // File dir = FileUtil.removeExtensionIfAny(task);
        dir.mkdir();
        for (Layer layer : collection) {
          String ext = null;
          DataSource dataSource = null;
          if (dialog.getBoolean(SAVEASJML)) {
            ext = "jml";
            dataSource =
                new com.vividsolutions.jump.io.datasource.StandardReaderWriterFileDataSource.JML();
          } else if (dialog.getBoolean(SAVEASSHP)) {
            ext = "shp";
            dataSource =
                new com.vividsolutions.jump.io.datasource.StandardReaderWriterFileDataSource
                    .Shapefile();
          }
          saveLayer(layer, dir, dataSource, ext);
        }
        return true;
      }
    } else return false;
  }
  public void initialize(PlugInContext context) throws Exception {

    FeatureInstaller featureInstaller = new FeatureInstaller(context.getWorkbenchContext());

    featureInstaller.addMainMenuItem(
        this,
        new String[] {MenuNames.EDIT, "CoordSys"},
        AppContext.getApplicationContext().getI18nString(this.getName()),
        false,
        null,
        this.createEnableCheck(context.getWorkbenchContext()));

    JPopupMenu layerNamePopupMenu =
        context.getWorkbenchContext().getIWorkbench().getGuiComponent().getLayerNamePopupMenu();
    featureInstaller.addPopupMenuItem(
        layerNamePopupMenu,
        this,
        AppContext.getApplicationContext().getI18nString(this.getName()) + "...",
        false,
        null,
        this.createEnableCheck(context.getWorkbenchContext()));
  }