src/main/java/de/blau/android/easyedit/ExtendSelectionActionModeCallback.java
/**
     * Add or remove objects from the selection
     * 
     * @param element object to add or remove
     */
Add or remove objects from the selection

@param element object to add or remove
Add or remove objects from the selection @param element object to add or remove
private void addOrRemoveElement(OsmElement element) {
        try {
            if (!selection.contains(element)) {
                selection.add(element);
                switch (element.getName()) {
                case Way.NAME:
                    logic.addSelectedWay((Way) element);
                    break;
                case Node.NAME:
                    logic.addSelectedNode((Node) element);
                    break;
                case Relation.NAME:
                    logic.addSelectedRelation((Relation) element);
                    break;
                default:
                    throw new OsmException(element.getName());
                }
            } else {
                selection.remove(element);
                switch (element.getName()) {
                case Way.NAME:
                    logic.removeSelectedWay((Way) element);
                    break;
                case Node.NAME:
                    logic.removeSelectedNode((Node) element);
                    break;
                case Relation.NAME:
                    logic.removeSelectedRelation((Relation) element);
                    break;
                default:
                    throw new OsmException(element.getName());
                }
            }
        } catch (OsmException osmex) {
            Log.e(DEBUG_TAG, "Unkown element type " + osmex.getMessage());
        }
        if (selection.isEmpty()) {
            manager.finish();
        } else {
            sortedWays = Util.sortWays(selection);
            manager.invalidate();
        }
        setSubTitle(mode);
        main.invalidateMap();
    }
private void addOrRemoveElement ( OsmElement element ) { try { if ( ! selection . contains ( element ) ) { selection . add ( element ) ; switch ( element . getName ( ) ) { case Way . NAME : logic . addSelectedWay ( ( Way ) element ) ; break ; case Node . NAME : logic . addSelectedNode ( ( Node ) element ) ; break ; case Relation . NAME : logic . addSelectedRelation ( ( Relation ) element ) ; break ; default : throw new OsmException ( element . getName ( ) ) ; } } else { selection . remove ( element ) ; switch ( element . getName ( ) ) { case Way . NAME : logic . removeSelectedWay ( ( Way ) element ) ; break ; case Node . NAME : logic . removeSelectedNode ( ( Node ) element ) ; break ; case Relation . NAME : logic . removeSelectedRelation ( ( Relation ) element ) ; break ; default : throw new OsmException ( element . getName ( ) ) ; } } } catch ( OsmException osmex ) { Log . e ( DEBUG_TAG , "Unkown element type " + osmex . getMessage ( ) ) ; } if ( selection . isEmpty ( ) ) { manager . finish ( ) ; } else { sortedWays = Util . sortWays ( selection ) ; manager . invalidate ( ) ; } setSubTitle ( mode ) ; main . invalidateMap ( ) ; }
Add or remove objects from the selection
Add or remove objects from the selection
// nothing selected more .... stop