public void execute(String actionCommand) { IProjectView model = vista.getModel(); MapContext mapa = model.getMapContext(); logger.debug("Comand : " + actionCommand); if (actionCommand.equals("INVERT_SELECTION")) { FLayer[] actives = mapa.getLayers().getActives(); for (int i = 0; i < actives.length; i++) { FLayer lyr = actives[i]; if (lyr.isAvailable() && lyr instanceof SingleLayer) { SingleLayer lyrSingle = (SingleLayer) lyr; DataStore ds = lyrSingle.getDataStore(); if (ds instanceof FeatureStore) { try { ((FeatureStore) ds).getFeatureSelection().reverse(); ((ProjectDocument) vista.getModel()).setModified(true); } catch (DataException e) { e.printStackTrace(); NotificationManager.addError(e); } } else { // TODO Not supported yet } } } ((ProjectDocument) vista.getModel()).setModified(true); } }
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() { IProjectView model = vista.getModel(); MapContext mapa = model.getMapContext(); for (int i = 0; i < mapa.getLayers().getActives().length; i++) { FLayer lyr = mapa.getLayers().getActives()[i]; if (lyr.isAvailable() && lyr instanceof FLyrVect) { // && !lyr.isEditing()) { return true; } } return false; }