Renamed project folders to match the respective project name
[Mograsim.git] / net.mograsim.rcp / src / net / mograsim / rcp / handlers / SaveHandler.java
diff --git a/net.mograsim.rcp/src/net/mograsim/rcp/handlers/SaveHandler.java b/net.mograsim.rcp/src/net/mograsim/rcp/handlers/SaveHandler.java
new file mode 100644 (file)
index 0000000..e662d6b
--- /dev/null
@@ -0,0 +1,25 @@
+package net.mograsim.rcp.handlers;
+
+import org.eclipse.e4.core.di.annotations.CanExecute;
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+
+public class SaveHandler
+{
+
+       @CanExecute
+       public boolean canExecute(EPartService partService)
+       {
+               if (partService != null)
+               {
+                       return !partService.getDirtyParts().isEmpty();
+               }
+               return false;
+       }
+
+       @Execute
+       public void execute(EPartService partService)
+       {
+               partService.saveAll(false);
+       }
+}
\ No newline at end of file