Skip to content

Commit

Permalink
Changed the group undos
Browse files Browse the repository at this point in the history
  • Loading branch information
oscargus committed Aug 6, 2016
1 parent 130d2e0 commit 0d718e4
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 58 deletions.
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ gradlew eol=lf
# ensure that line endings of *.java and *.properties are normalized
*.properties text
*.java text

Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@

import java.util.List;

import javax.swing.undo.AbstractUndoableEdit;

import net.sf.jabref.gui.undo.AbstractUndoableJabRefEdit;
import net.sf.jabref.logic.groups.GroupTreeNode;
import net.sf.jabref.logic.l10n.Localization;

class UndoableAddOrRemoveGroup extends AbstractUndoableEdit {
class UndoableAddOrRemoveGroup extends AbstractUndoableJabRefEdit {

/** The root of the global groups tree */
private final GroupTreeNodeViewModel m_groupsRootHandle;
Expand Down Expand Up @@ -78,12 +77,9 @@ public UndoableAddOrRemoveGroup(GroupTreeNodeViewModel groupsRoot,
m_pathToNode = editedNode.getNode().getIndexedPathFromRoot();
}

@Override
public String getUndoPresentationName() {
return Localization.lang("Undo") + ": " + getName();
}

private String getName() {
@Override
public String getPresentationName() {
switch (m_editType) {
case ADD_NODE:
return Localization.lang("add group");
Expand All @@ -97,10 +93,6 @@ private String getName() {
return "? (" + Localization.lang("unknown edit") + ")";
}

@Override
public String getRedoPresentationName() {
return Localization.lang("Redo") + ": " + getName();
}

@Override
public void undo() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,26 @@
import java.util.Optional;
import java.util.Set;

import javax.swing.undo.AbstractUndoableEdit;

import net.sf.jabref.gui.undo.AbstractUndoableJabRefEdit;
import net.sf.jabref.logic.groups.GroupTreeNode;
import net.sf.jabref.logic.l10n.Localization;
import net.sf.jabref.model.entry.BibEntry;

/**
* @author jzieren
*/
public class UndoableChangeAssignment extends AbstractUndoableEdit {
public class UndoableChangeAssignment extends AbstractUndoableJabRefEdit {

private final List<BibEntry> previousAssignments;
private final List<BibEntry> newAssignments;
/**
* The path to the edited node
*/
private List<Integer> pathToNode;
private final List<Integer> pathToNode;
/**
* The root of the global groups tree
*/
private GroupTreeNode root;
private final GroupTreeNode root;

/**
* @param node The node whose assignments were edited.
Expand All @@ -53,14 +52,10 @@ public UndoableChangeAssignment(GroupTreeNodeViewModel node, Set<BibEntry> previ
this.pathToNode = node.getNode().getIndexedPathFromRoot();
}

@Override
public String getUndoPresentationName() {
return Localization.lang("Undo") + ": " + Localization.lang("change assignment of entries");
}

@Override
public String getRedoPresentationName() {
return Localization.lang("Redo") + ": " + Localization.lang("change assignment of entries");
public String getPresentationName() {
return Localization.lang("change assignment of entries");
}

@Override
Expand Down
16 changes: 4 additions & 12 deletions src/main/java/net/sf/jabref/gui/groups/UndoableModifyGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@

import java.util.List;

import javax.swing.undo.AbstractUndoableEdit;

import net.sf.jabref.gui.undo.AbstractUndoableJabRefEdit;
import net.sf.jabref.logic.groups.AbstractGroup;
import net.sf.jabref.logic.groups.GroupTreeNode;
import net.sf.jabref.logic.l10n.Localization;

class UndoableModifyGroup extends AbstractUndoableEdit {
class UndoableModifyGroup extends AbstractUndoableJabRefEdit {

private final GroupSelector groupSelector;
private final AbstractGroup m_oldGroupBackup;
Expand All @@ -49,15 +48,8 @@ public UndoableModifyGroup(GroupSelector gs, GroupTreeNodeViewModel groupsRoot,
}

@Override
public String getUndoPresentationName() {
return Localization.lang("Undo") + ": "
+ Localization.lang("modify group");
}

@Override
public String getRedoPresentationName() {
return Localization.lang("Redo") + ": "
+ Localization.lang("modify group");
public String getPresentationName() {
return Localization.lang("modify group");
}

@Override
Expand Down
16 changes: 4 additions & 12 deletions src/main/java/net/sf/jabref/gui/groups/UndoableModifySubtree.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@
import java.util.List;
import java.util.Vector;

import javax.swing.undo.AbstractUndoableEdit;

import net.sf.jabref.gui.undo.AbstractUndoableJabRefEdit;
import net.sf.jabref.logic.groups.GroupTreeNode;
import net.sf.jabref.logic.l10n.Localization;

public class UndoableModifySubtree extends AbstractUndoableEdit {
public class UndoableModifySubtree extends AbstractUndoableJabRefEdit {

/** A backup of the groups before the modification */
private final GroupTreeNode m_groupRoot;
Expand All @@ -50,14 +48,8 @@ public UndoableModifySubtree(GroupTreeNodeViewModel groupRoot,
}

@Override
public String getUndoPresentationName() {
return Localization.lang("Undo") + ": " + m_name;

}

@Override
public String getRedoPresentationName() {
return Localization.lang("Redo") + ": " + m_name;
public String getPresentationName() {
return m_name;
}

@Override
Expand Down
14 changes: 4 additions & 10 deletions src/main/java/net/sf/jabref/gui/groups/UndoableMoveGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
import java.util.List;
import java.util.Objects;

import javax.swing.undo.AbstractUndoableEdit;

import net.sf.jabref.gui.undo.AbstractUndoableJabRefEdit;
import net.sf.jabref.logic.groups.GroupTreeNode;
import net.sf.jabref.logic.groups.MoveGroupChange;
import net.sf.jabref.logic.l10n.Localization;
Expand All @@ -28,7 +27,7 @@
* @author jzieren
*
*/
class UndoableMoveGroup extends AbstractUndoableEdit {
class UndoableMoveGroup extends AbstractUndoableJabRefEdit {

private final GroupTreeNodeViewModel root;
private final List<Integer> pathToNewParent;
Expand All @@ -47,13 +46,8 @@ public UndoableMoveGroup(GroupTreeNodeViewModel root, MoveGroupChange moveChange
}

@Override
public String getUndoPresentationName() {
return Localization.lang("Undo") + ": " + Localization.lang("move group");
}

@Override
public String getRedoPresentationName() {
return Localization.lang("Redo") + ": " + Localization.lang("move group");
public String getPresentationName() {
return Localization.lang("move group");
}

@Override
Expand Down

0 comments on commit 0d718e4

Please sign in to comment.