public void execute(ITocItem item, FLayer[] selectedItems) {
   FLayer lyr = getNodeLayer(item);
   if (!lyr.isAvailable()) return;
   ChangeName chn = new ChangeName(lyr.getName());
   PluginServices.getMDIManager().addWindow(chn);
   lyr.setName(chn.getName());
   Project project =
       ((ProjectExtension) PluginServices.getExtension(ProjectExtension.class)).getProject();
   project.setModified(true);
 }
  public boolean isEnabled(ProjectDocument item, ProjectDocument[] selectedItems) {
    String sourceString = PluginServices.getFromClipboard();
    if (sourceString == null) return false;

    ProjectExtension projectExtension =
        (ProjectExtension) PluginServices.getExtension(ProjectExtension.class);
    Project project = projectExtension.getProject();
    String docType = ((ProjectWindow) projectExtension.getProjectWindow()).getDocumentSelected();

    return project.isValidXMLForImport(sourceString, docType);
  }
  public void execute(ProjectDocument item, ProjectDocument[] selectedItems) {
    String sourceString = PluginServices.getFromClipboard();
    if (sourceString == null) return;

    ProjectExtension projectExtension =
        (ProjectExtension) PluginServices.getExtension(ProjectExtension.class);
    Project project = projectExtension.getProject();
    String docType = ((ProjectWindow) projectExtension.getProjectWindow()).getDocumentSelected();

    try {
      project.importFromXML(sourceString, docType);
    } catch (Exception e) {
      JOptionPane.showMessageDialog(
          (Component) PluginServices.getMainFrame(),
          "<html>"
              + PluginServices.getText(this, "No_ha_sido_posible_realizar_la_operacion")
              + "</html>", // Mensaje
          PluginServices.getText(this, "pegar"), // titulo
          JOptionPane.ERROR_MESSAGE);
    }
    project.setModified(true);
  }
  public void execute(ITocItem item, FLayer[] selectedItems) {
    // ITocItem tocItem = (ITocItem) getNodeUserObject();
    ChangeName changename = new ChangeName(null);
    PluginServices.getMDIManager().addWindow(changename);
    if (!changename.isAccepted()) return;
    String nombre = changename.getName();

    if (nombre != null) {

      getMapContext().beginAtomicEvent();
      FLayers parent = selectedItems[0].getParentLayer();
      //			FLayers newGroup = new FLayers(getMapContext(),parent);
      FLayers newGroup = getMapContext().getNewGroupLayer(parent);
      newGroup.setName(nombre);
      int pos = 0;
      for (int i = 0; i < parent.getLayersCount(); i++) {
        if (parent.getLayer(i).equals(selectedItems[0])) {
          pos = i;
          continue;
        }
      }
      for (int j = 0; j < selectedItems.length; j++) {
        FLayer layer = selectedItems[j];
        parent.removeLayer(layer);
        newGroup.addLayer(layer);
      }
      parent.addLayer(pos, newGroup);

      getMapContext().endAtomicEvent();
      // TRUCO PARA REFRESCAR.
      getMapContext().invalidate();
      Project project =
          ((ProjectExtension) PluginServices.getExtension(ProjectExtension.class)).getProject();
      project.setModified(true);
    }
  }