src/main/java/de/blau/android/easyedit/ExtendSelectionActionModeCallback.java
/**
     * Delete action
     * 
     * @param deleteFromRelations if true the elements will be deleted without regards for their Relation membership
     */
Delete action

@param deleteFromRelations if true the elements will be deleted without regards for their Relation membership
Delete action @param deleteFromRelations if true the elements will be deleted without regards for their Relation membership
private void menuDelete(boolean deleteFromRelations) {
        Log.d(DEBUG_TAG, "menuDelete " + deleteFromRelations + " " + selection);
        for (OsmElement e : selection) {
            if (e instanceof Way && !logic.isInDownload((Way) e)) {
                new AlertDialog.Builder(main).setTitle(R.string.delete).setMessage(R.string.deleteways_nodesnotdownloaded_description)
                        .setPositiveButton(R.string.okay, null).show();
                return;
            }
        }
        if (!deleteFromRelations) {
            for (OsmElement e : selection) {
                if (e.hasParentRelations()) {
                    new AlertDialog.Builder(main).setTitle(R.string.delete).setMessage(R.string.delete_elements_from_relation_description)
                            .setPositiveButton(R.string.delete, (dialog, which) -> menuDelete(true)).show();
                    return;
                }
            }
        }
        List<Relation> origParents = new ArrayList<>();
        for (OsmElement e : selection) {
            List<Relation> temp = e.getParentRelations();
            if (temp != null) {
                origParents.addAll(temp);
            }
        }
        logic.performEraseMultipleObjects(main, selection);
        ElementSelectionActionModeCallback.checkEmptyRelations(main, origParents);
        manager.finish();
    }
private void menuDelete ( boolean deleteFromRelations ) { Log . d ( DEBUG_TAG , "menuDelete " + deleteFromRelations + " " + selection ) ; for ( OsmElement e : selection ) { if ( e instanceof Way && ! logic . isInDownload ( ( Way ) e ) ) { new AlertDialog . Builder ( main ) . setTitle ( R . string . delete ) . setMessage ( R . string . deleteways_nodesnotdownloaded_description ) . setPositiveButton ( R . string . okay , null ) . show ( ) ; return ; } } if ( ! deleteFromRelations ) { for ( OsmElement e : selection ) { if ( e . hasParentRelations ( ) ) { new AlertDialog . Builder ( main ) . setTitle ( R . string . delete ) . setMessage ( R . string . delete_elements_from_relation_description ) . setPositiveButton ( R . string . delete , ( dialog , which ) -> menuDelete ( true ) ) . show ( ) ; return ; } } } List < Relation > origParents = new ArrayList < > ( ) ; for ( OsmElement e : selection ) { List < Relation > temp = e . getParentRelations ( ) ; if ( temp != null ) { origParents . addAll ( temp ) ; } } logic . performEraseMultipleObjects ( main , selection ) ; ElementSelectionActionModeCallback . checkEmptyRelations ( main , origParents ) ; manager . finish ( ) ; }
Delete action
Delete action
// check ways are actually downloaded this will abort so should be before the relation check // check for relation membership // check for new empty relations