Index: src/Actions/Makefile.am
===================================================================
--- src/Actions/Makefile.am	(revision e0e156d85fdcaa23fb674516eae0bcd9145a6870)
+++ src/Actions/Makefile.am	(revision e2009b3268f38b1451745713d4dccf21d2fee1b5)
@@ -17,4 +17,5 @@
   ${MOLECULEACTIONSOURCE} \
   ${PARSERACTIONSOURCE} \
+  ${SELECTIONACTIONSOURCE} \
   ${TESSELATIONACTIONSOURCE} \
   ${WORLDACTIONSOURCE} \
@@ -28,4 +29,5 @@
   ${MOLECULEACTIONHEADER} \
   ${PARSERACTIONHEADER} \
+  ${SELECTIONACTIONHEADER} \
   ${TESSELATIONACTIONHEADER} \
   ${WORLDACTIONHEADER} \
@@ -107,4 +109,15 @@
   ParserAction/SaveXyzAction.hpp
 
+SELECTIONACTIONSOURCE = \
+	SelectionAction/AtomByIdAction.cpp \
+	SelectionAction/MoleculeByIdAction.cpp \
+	SelectionAction/NotAtomByIdAction.cpp \
+	SelectionAction/NotMoleculeByIdAction.cpp
+SELECTIONACTIONHEADER = \
+	SelectionAction/AtomByIdAction.hpp \
+	SelectionAction/MoleculeByIdAction.hpp \
+	SelectionAction/NotAtomByIdAction.hpp \
+	SelectionAction/NotMoleculeByIdAction.hpp
+
 TESSELATIONACTIONSOURCE = \
   TesselationAction/ConvexEnvelopeAction.cpp \
Index: src/Actions/SelectionAction/AtomByIdAction.cpp
===================================================================
--- src/Actions/SelectionAction/AtomByIdAction.cpp	(revision e2009b3268f38b1451745713d4dccf21d2fee1b5)
+++ src/Actions/SelectionAction/AtomByIdAction.cpp	(revision e2009b3268f38b1451745713d4dccf21d2fee1b5)
@@ -0,0 +1,93 @@
+/*
+ * SelectionAtomByIdAction.cpp
+ *
+ *  Created on: May 12, 2010
+ *      Author: heber
+ */
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Actions/SelectionAction/AtomByIdAction.hpp"
+#include "atom.hpp"
+#include "log.hpp"
+#include "verbose.hpp"
+#include "World.hpp"
+
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+#include "UIElements/UIFactory.hpp"
+#include "UIElements/Dialog.hpp"
+#include "Actions/MapOfActions.hpp"
+
+
+// memento to remember the state when undoing
+
+class SelectionAtomByIdState : public ActionState {
+public:
+  SelectionAtomByIdState(atom* _walker) :
+    walker(_walker)
+  {}
+  atom* walker;
+};
+
+const char SelectionAtomByIdAction::NAME[] = "select-atom-by-id";
+
+SelectionAtomByIdAction::SelectionAtomByIdAction() :
+  Action(NAME)
+{}
+
+SelectionAtomByIdAction::~SelectionAtomByIdAction()
+{}
+
+Action::state_ptr SelectionAtomByIdAction::performCall() {
+  Dialog *dialog = UIFactory::getInstance().makeDialog();
+  atom *Walker = NULL;
+
+  dialog->queryAtom(NAME, &Walker, MapOfActions::getInstance().getDescription(NAME));
+
+  if(dialog->display()) {
+    delete dialog;
+    if (!World::getInstance().isSelected(Walker)) {
+      World::getInstance().selectAtom(Walker);
+      return Action::state_ptr(new SelectionAtomByIdState(Walker));
+    } else {
+      return Action::success;
+    }
+  } else {
+    delete dialog;
+    return Action::failure;
+  }
+}
+
+Action::state_ptr SelectionAtomByIdAction::performUndo(Action::state_ptr _state) {
+  SelectionAtomByIdState *state = assert_cast<SelectionAtomByIdState*>(_state.get());
+
+  if (state->walker != NULL)
+    World::getInstance().unselectAtom(state->walker);
+
+  return Action::state_ptr(new SelectionAtomByIdState(state->walker));
+}
+
+Action::state_ptr SelectionAtomByIdAction::performRedo(Action::state_ptr _state){
+  SelectionAtomByIdState *state = assert_cast<SelectionAtomByIdState*>(_state.get());
+
+  if (state->walker != NULL)
+    World::getInstance().selectAtom(state->walker);
+
+  return Action::state_ptr(new SelectionAtomByIdState(state->walker));
+}
+
+bool SelectionAtomByIdAction::canUndo() {
+  return true;
+}
+
+bool SelectionAtomByIdAction::shouldUndo() {
+  return true;
+}
+
+const string SelectionAtomByIdAction::getName() {
+  return NAME;
+}
Index: src/Actions/SelectionAction/AtomByIdAction.hpp
===================================================================
--- src/Actions/SelectionAction/AtomByIdAction.hpp	(revision e2009b3268f38b1451745713d4dccf21d2fee1b5)
+++ src/Actions/SelectionAction/AtomByIdAction.hpp	(revision e2009b3268f38b1451745713d4dccf21d2fee1b5)
@@ -0,0 +1,30 @@
+/*
+ * SelectionAtomByIdAction.hpp
+ *
+ *  Created on: May 12, 2010
+ *      Author: heber
+ */
+
+#ifndef ATOMBYIDACTION_HPP_
+#define ATOMBYIDACTION_HPP_
+
+#include "Actions/Action.hpp"
+
+class SelectionAtomByIdAction : public Action {
+public:
+  SelectionAtomByIdAction();
+  virtual ~SelectionAtomByIdAction();
+
+  bool canUndo();
+  bool shouldUndo();
+
+  virtual const std::string getName();
+private:
+  virtual Action::state_ptr performCall();
+  virtual Action::state_ptr performUndo(Action::state_ptr);
+  virtual Action::state_ptr performRedo(Action::state_ptr);
+
+  static const char NAME[];
+};
+
+#endif /* ATOMBYIDACTION_HPP_ */
Index: src/Actions/SelectionAction/MoleculeByIdAction.cpp
===================================================================
--- src/Actions/SelectionAction/MoleculeByIdAction.cpp	(revision e2009b3268f38b1451745713d4dccf21d2fee1b5)
+++ src/Actions/SelectionAction/MoleculeByIdAction.cpp	(revision e2009b3268f38b1451745713d4dccf21d2fee1b5)
@@ -0,0 +1,93 @@
+/*
+ * SelectionMoleculeByIdAction.cpp
+ *
+ *  Created on: May 12, 2010
+ *      Author: heber
+ */
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Actions/SelectionAction/MoleculeByIdAction.hpp"
+#include "atom.hpp"
+#include "log.hpp"
+#include "verbose.hpp"
+#include "World.hpp"
+
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+#include "UIElements/UIFactory.hpp"
+#include "UIElements/Dialog.hpp"
+#include "Actions/MapOfActions.hpp"
+
+
+// memento to remember the state when undoing
+
+class SelectionMoleculeByIdState : public ActionState {
+public:
+  SelectionMoleculeByIdState(molecule* _mol) :
+    mol(_mol)
+  {}
+  molecule* mol;
+};
+
+const char SelectionMoleculeByIdAction::NAME[] = "select-molecule-by-id";
+
+SelectionMoleculeByIdAction::SelectionMoleculeByIdAction() :
+  Action(NAME)
+{}
+
+SelectionMoleculeByIdAction::~SelectionMoleculeByIdAction()
+{}
+
+Action::state_ptr SelectionMoleculeByIdAction::performCall() {
+  Dialog *dialog = UIFactory::getInstance().makeDialog();
+  molecule *mol = NULL;
+
+  dialog->queryMolecule(NAME, &mol, MapOfActions::getInstance().getDescription(NAME));
+
+  if(dialog->display()) {
+    delete dialog;
+    if (!World::getInstance().isSelected(mol)) {
+      World::getInstance().selectMolecule(mol);
+      return Action::state_ptr(new SelectionMoleculeByIdState(mol));
+    } else {
+      return Action::success;
+    }
+  } else {
+    delete dialog;
+    return Action::failure;
+  }
+}
+
+Action::state_ptr SelectionMoleculeByIdAction::performUndo(Action::state_ptr _state) {
+  SelectionMoleculeByIdState *state = assert_cast<SelectionMoleculeByIdState*>(_state.get());
+
+  if (state->mol != NULL)
+    World::getInstance().unselectMolecule(state->mol);
+
+  return Action::state_ptr(new SelectionMoleculeByIdState(state->mol));
+}
+
+Action::state_ptr SelectionMoleculeByIdAction::performRedo(Action::state_ptr _state){
+  SelectionMoleculeByIdState *state = assert_cast<SelectionMoleculeByIdState*>(_state.get());
+
+  if (state->mol != NULL)
+    World::getInstance().selectMolecule(state->mol);
+
+  return Action::state_ptr(new SelectionMoleculeByIdState(state->mol));
+}
+
+bool SelectionMoleculeByIdAction::canUndo() {
+  return true;
+}
+
+bool SelectionMoleculeByIdAction::shouldUndo() {
+  return true;
+}
+
+const string SelectionMoleculeByIdAction::getName() {
+  return NAME;
+}
Index: src/Actions/SelectionAction/MoleculeByIdAction.hpp
===================================================================
--- src/Actions/SelectionAction/MoleculeByIdAction.hpp	(revision e2009b3268f38b1451745713d4dccf21d2fee1b5)
+++ src/Actions/SelectionAction/MoleculeByIdAction.hpp	(revision e2009b3268f38b1451745713d4dccf21d2fee1b5)
@@ -0,0 +1,30 @@
+/*
+ * SelectionMoleculeByIdAction.hpp
+ *
+ *  Created on: May 12, 2010
+ *      Author: heber
+ */
+
+#ifndef MOLECULEBYIDACTION_HPP_
+#define MOLECULEBYIDACTION_HPP_
+
+#include "Actions/Action.hpp"
+
+class SelectionMoleculeByIdAction : public Action {
+public:
+  SelectionMoleculeByIdAction();
+  virtual ~SelectionMoleculeByIdAction();
+
+  bool canUndo();
+  bool shouldUndo();
+
+  virtual const std::string getName();
+private:
+  virtual Action::state_ptr performCall();
+  virtual Action::state_ptr performUndo(Action::state_ptr);
+  virtual Action::state_ptr performRedo(Action::state_ptr);
+
+  static const char NAME[];
+};
+
+#endif /* MOLECULEBYIDACTION_HPP_ */
Index: src/Actions/SelectionAction/NotAtomByIdAction.cpp
===================================================================
--- src/Actions/SelectionAction/NotAtomByIdAction.cpp	(revision e2009b3268f38b1451745713d4dccf21d2fee1b5)
+++ src/Actions/SelectionAction/NotAtomByIdAction.cpp	(revision e2009b3268f38b1451745713d4dccf21d2fee1b5)
@@ -0,0 +1,93 @@
+/*
+ * SelectionNotAtomByIdAction.cpp
+ *
+ *  Created on: May 12, 2010
+ *      Author: heber
+ */
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Actions/SelectionAction/NotAtomByIdAction.hpp"
+#include "atom.hpp"
+#include "log.hpp"
+#include "verbose.hpp"
+#include "World.hpp"
+
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+#include "UIElements/UIFactory.hpp"
+#include "UIElements/Dialog.hpp"
+#include "Actions/MapOfActions.hpp"
+
+
+// memento to remember the state when undoing
+
+class SelectionNotAtomByIdState : public ActionState {
+public:
+  SelectionNotAtomByIdState(atom* _walker) :
+    walker(_walker)
+  {}
+  atom* walker;
+};
+
+const char SelectionNotAtomByIdAction::NAME[] = "unselect-atom-by-id";
+
+SelectionNotAtomByIdAction::SelectionNotAtomByIdAction() :
+  Action(NAME)
+{}
+
+SelectionNotAtomByIdAction::~SelectionNotAtomByIdAction()
+{}
+
+Action::state_ptr SelectionNotAtomByIdAction::performCall() {
+  Dialog *dialog = UIFactory::getInstance().makeDialog();
+  atom *Walker = NULL;
+
+  dialog->queryAtom(NAME, &Walker, MapOfActions::getInstance().getDescription(NAME));
+
+  if(dialog->display()) {
+    delete dialog;
+    if (World::getInstance().isSelected(Walker)) {
+      World::getInstance().unselectAtom(Walker);
+      return Action::state_ptr(new SelectionNotAtomByIdState(Walker));
+    } else {
+      return Action::success;
+    }
+  } else {
+    delete dialog;
+    return Action::failure;
+  }
+}
+
+Action::state_ptr SelectionNotAtomByIdAction::performUndo(Action::state_ptr _state) {
+  SelectionNotAtomByIdState *state = assert_cast<SelectionNotAtomByIdState*>(_state.get());
+
+  if (state->walker != NULL)
+    World::getInstance().selectAtom(state->walker);
+
+  return Action::state_ptr(new SelectionNotAtomByIdState(state->walker));
+}
+
+Action::state_ptr SelectionNotAtomByIdAction::performRedo(Action::state_ptr _state){
+  SelectionNotAtomByIdState *state = assert_cast<SelectionNotAtomByIdState*>(_state.get());
+
+  if (state->walker != NULL)
+    World::getInstance().unselectAtom(state->walker);
+
+  return Action::state_ptr(new SelectionNotAtomByIdState(state->walker));
+}
+
+bool SelectionNotAtomByIdAction::canUndo() {
+  return true;
+}
+
+bool SelectionNotAtomByIdAction::shouldUndo() {
+  return true;
+}
+
+const string SelectionNotAtomByIdAction::getName() {
+  return NAME;
+}
Index: src/Actions/SelectionAction/NotAtomByIdAction.hpp
===================================================================
--- src/Actions/SelectionAction/NotAtomByIdAction.hpp	(revision e2009b3268f38b1451745713d4dccf21d2fee1b5)
+++ src/Actions/SelectionAction/NotAtomByIdAction.hpp	(revision e2009b3268f38b1451745713d4dccf21d2fee1b5)
@@ -0,0 +1,30 @@
+/*
+ * SelectionNotAtomByIdAction.hpp
+ *
+ *  Created on: May 12, 2010
+ *      Author: heber
+ */
+
+#ifndef NOTATOMBYIDACTION_HPP_
+#define NOTATOMBYIDACTION_HPP_
+
+#include "Actions/Action.hpp"
+
+class SelectionNotAtomByIdAction : public Action {
+public:
+  SelectionNotAtomByIdAction();
+  virtual ~SelectionNotAtomByIdAction();
+
+  bool canUndo();
+  bool shouldUndo();
+
+  virtual const std::string getName();
+private:
+  virtual Action::state_ptr performCall();
+  virtual Action::state_ptr performUndo(Action::state_ptr);
+  virtual Action::state_ptr performRedo(Action::state_ptr);
+
+  static const char NAME[];
+};
+
+#endif /* NOTATOMBYIDACTION_HPP_ */
Index: src/Actions/SelectionAction/NotMoleculeByIdAction.cpp
===================================================================
--- src/Actions/SelectionAction/NotMoleculeByIdAction.cpp	(revision e2009b3268f38b1451745713d4dccf21d2fee1b5)
+++ src/Actions/SelectionAction/NotMoleculeByIdAction.cpp	(revision e2009b3268f38b1451745713d4dccf21d2fee1b5)
@@ -0,0 +1,93 @@
+/*
+ * SelectionNotMoleculeByIdAction.cpp
+ *
+ *  Created on: May 12, 2010
+ *      Author: heber
+ */
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Actions/SelectionAction/NotMoleculeByIdAction.hpp"
+#include "atom.hpp"
+#include "log.hpp"
+#include "verbose.hpp"
+#include "World.hpp"
+
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+#include "UIElements/UIFactory.hpp"
+#include "UIElements/Dialog.hpp"
+#include "Actions/MapOfActions.hpp"
+
+
+// memento to remember the state when undoing
+
+class SelectionNotMoleculeByIdState : public ActionState {
+public:
+  SelectionNotMoleculeByIdState(molecule* _mol) :
+    mol(_mol)
+  {}
+  molecule* mol;
+};
+
+const char SelectionNotMoleculeByIdAction::NAME[] = "select-molecule-by-id";
+
+SelectionNotMoleculeByIdAction::SelectionNotMoleculeByIdAction() :
+  Action(NAME)
+{}
+
+SelectionNotMoleculeByIdAction::~SelectionNotMoleculeByIdAction()
+{}
+
+Action::state_ptr SelectionNotMoleculeByIdAction::performCall() {
+  Dialog *dialog = UIFactory::getInstance().makeDialog();
+  molecule *mol = NULL;
+
+  dialog->queryMolecule(NAME, &mol, MapOfActions::getInstance().getDescription(NAME));
+
+  if(dialog->display()) {
+    delete dialog;
+    if (World::getInstance().isSelected(mol)) {
+      World::getInstance().unselectMolecule(mol);
+      return Action::state_ptr(new SelectionNotMoleculeByIdState(mol));
+    } else {
+      return Action::success;
+    }
+  } else {
+    delete dialog;
+    return Action::failure;
+  }
+}
+
+Action::state_ptr SelectionNotMoleculeByIdAction::performUndo(Action::state_ptr _state) {
+  SelectionNotMoleculeByIdState *state = assert_cast<SelectionNotMoleculeByIdState*>(_state.get());
+
+  if (state->mol != NULL)
+    World::getInstance().selectMolecule(state->mol);
+
+  return Action::state_ptr(new SelectionNotMoleculeByIdState(state->mol));
+}
+
+Action::state_ptr SelectionNotMoleculeByIdAction::performRedo(Action::state_ptr _state){
+  SelectionNotMoleculeByIdState *state = assert_cast<SelectionNotMoleculeByIdState*>(_state.get());
+
+  if (state->mol != NULL)
+    World::getInstance().unselectMolecule(state->mol);
+
+  return Action::state_ptr(new SelectionNotMoleculeByIdState(state->mol));
+}
+
+bool SelectionNotMoleculeByIdAction::canUndo() {
+  return true;
+}
+
+bool SelectionNotMoleculeByIdAction::shouldUndo() {
+  return true;
+}
+
+const string SelectionNotMoleculeByIdAction::getName() {
+  return NAME;
+}
Index: src/Actions/SelectionAction/NotMoleculeByIdAction.hpp
===================================================================
--- src/Actions/SelectionAction/NotMoleculeByIdAction.hpp	(revision e2009b3268f38b1451745713d4dccf21d2fee1b5)
+++ src/Actions/SelectionAction/NotMoleculeByIdAction.hpp	(revision e2009b3268f38b1451745713d4dccf21d2fee1b5)
@@ -0,0 +1,30 @@
+/*
+ * SelectionNotMoleculeByIdAction.hpp
+ *
+ *  Created on: May 12, 2010
+ *      Author: heber
+ */
+
+#ifndef NOTMOLECULEBYIDACTION_HPP_
+#define NOTMOLECULEBYIDACTION_HPP_
+
+#include "Actions/Action.hpp"
+
+class SelectionNotMoleculeByIdAction : public Action {
+public:
+  SelectionNotMoleculeByIdAction();
+  virtual ~SelectionNotMoleculeByIdAction();
+
+  bool canUndo();
+  bool shouldUndo();
+
+  virtual const std::string getName();
+private:
+  virtual Action::state_ptr performCall();
+  virtual Action::state_ptr performUndo(Action::state_ptr);
+  virtual Action::state_ptr performRedo(Action::state_ptr);
+
+  static const char NAME[];
+};
+
+#endif /* NOTMOLECULEBYIDACTION_HPP_ */
