Index: TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/commands/CleanEditors.java
===================================================================
--- TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/commands/CleanEditors.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/commands/CleanEditors.java	(revision 3711)
@@ -0,0 +1,20 @@
+package org.txm.rcp.commands;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+public class CleanEditors extends AbstractHandler {
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) {
+		if (MessageDialog.openConfirm(HandlerUtil.getActiveShell(event), "Reset the window", "This will will close all editors all non saved changes will be lost. Continue?" )) {
+			CleanPerspective.reset(event, false, true);
+		}
+		return null;
+	}
+}
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/commands/CleanEditors.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/commands/CleanPerspective.java
===================================================================
--- TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/commands/CleanPerspective.java	(revision 3710)
+++ TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/commands/CleanPerspective.java	(revision 3711)
@@ -2,54 +2,70 @@
 
 import org.eclipse.core.commands.AbstractHandler;
 import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.workbench.modeling.EModelService;
+import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.ui.IEditorReference;
-import org.eclipse.ui.IViewReference;
+import org.eclipse.ui.IPerspectiveDescriptor;
 import org.eclipse.ui.IWorkbenchPage;
 import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.handlers.HandlerUtil;
-import org.eclipse.ui.handlers.IHandlerService;
-import org.txm.core.messages.TXMCoreMessages;
-import org.txm.rcp.messages.TXMUIMessages;
-import org.txm.utils.logger.Log;
+import org.eclipse.ui.internal.Workbench;
+import org.eclipse.ui.internal.registry.PerspectiveDescriptor;
+import org.eclipse.ui.internal.registry.PerspectiveRegistry;
 
 public class CleanPerspective extends AbstractHandler {
+
 	/* (non-Javadoc)
 	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
 	 */
 	@Override
 	public Object execute(ExecutionEvent event) {
+		if (MessageDialog.openConfirm(HandlerUtil.getActiveShell(event), "Reset perspective", "This will will restore the views and close the additional views of the current perspective. Continue?" )) {
+			reset(event, true, false);
+		}
+		return null;
+	}
+
+	public static void reset(ExecutionEvent event, boolean perspective, boolean parts) {
 		//System.out.println("clean perspective");
-		IWorkbenchPart part = HandlerUtil.getActivePart(event);
-		//System.out.println("part: "+part.getTitle());
-		IWorkbenchPage page = part.getSite().getPage();
-		//System.out.println("page: "+page.getLabel());
-		if (page.isEditorAreaVisible()) {
-			//System.out.println(" page is visible");
+
+		IWorkbenchPage page;
+		if (event == null) {
+			IWorkbenchPart part = HandlerUtil.getActivePart(event);
+			page = part.getSite().getPage();
+		} else {
+			page = Workbench.getInstance().getActiveWorkbenchWindow().getActivePage();
+		}
+
+		if (page == null) return;
+
+		if (parts) {
 			IEditorReference[] editors = page.getEditorReferences();
-			IViewReference[] views = page.getViewReferences();
-			if (editors.length == 0 && views.length == 0) {
-				//System.out.println("  no editor");
-				page.setEditorAreaVisible(false);
-			} else {
-				//System.out.println("  editors: "+editors.length);
+			for (IEditorReference er : editors) {
+				page.closeEditor(er.getEditor(false), false);
 			}
-		} else {
-			//System.out.println(" page is not visible");
 		}
 		
-		IHandlerService handlerService = (IHandlerService) PlatformUI.getWorkbench().getService(IHandlerService.class);
-		if (handlerService != null) {
-			try {
-				handlerService.executeCommand("org.eclipse.ui.window.resetPerspective", null); //$NON-NLS-1$
-			} catch (Exception e) {
-				System.out.println(TXMCoreMessages.bind(TXMUIMessages.errorWhileCallingOrgeclipseuiwindowresetPerspectiveColon, e));
-				Log.printStackTrace(e);
+		if (perspective) {
+			IPerspectiveDescriptor descriptor = page.getPerspective();
+			if (descriptor != null) {
+				boolean offerRevertToBase = false;
+				if (descriptor instanceof PerspectiveDescriptor) {
+					PerspectiveDescriptor desc = (PerspectiveDescriptor) descriptor;
+					offerRevertToBase = desc.isPredefined() && desc.hasCustomDefinition();
+				}
+
+				if (offerRevertToBase) {
+
+					PerspectiveRegistry reg = (PerspectiveRegistry) PlatformUI.getWorkbench().getPerspectiveRegistry();
+					reg.revertPerspective(descriptor);
+				}
+				page.resetPerspective();
 			}
-		} else {
-			System.out.println(TXMUIMessages.errorWhileCleaningPerspectiveColonNoHandlerServiceFound);
 		}
-		
-		return null;
+		return;
 	}
 }
\ No newline at end of file
Index: TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/editors/SWTResourceManager.java
===================================================================
--- TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/editors/SWTResourceManager.java	(revision 3710)
+++ TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/editors/SWTResourceManager.java	(revision 3711)
@@ -434,7 +434,7 @@
 		Integer key = Integer.valueOf(id);
 		Cursor cursor = m_idToCursorMap.get(key);
 		if (cursor == null) {
-			cursor = new Cursor(Display.getDefault(), id);
+			cursor = Display.getDefault().getSystemCursor(SWT.CURSOR_SIZENS);
 			m_idToCursorMap.put(key, cursor);
 		}
 		return cursor;
Index: TXM/trunk/bundles/org.txm.rcp/plugin.xml
===================================================================
--- TXM/trunk/bundles/org.txm.rcp/plugin.xml	(revision 3710)
+++ TXM/trunk/bundles/org.txm.rcp/plugin.xml	(revision 3711)
@@ -1292,6 +1292,10 @@
                   style="push">
             </command>
             <command
+                  commandId="org.txm.rcp.commands.CleanEditors"
+                  style="push">
+            </command>
+            <command
                   commandId="org.eclipse.ui.window.newWindow"
                   label="%command.label.157">
             </command>
@@ -2818,6 +2822,11 @@
             id="org.txm.rcp.commands.RecoverCorporaFromInstalls"
             name="Recover corpora">
       </command>
+      <command
+            defaultHandler="org.txm.rcp.commands.CleanEditors"
+            id="org.txm.rcp.commands.CleanEditors"
+            name="Close all editors">
+      </command>
    </extension>
    <extension
          id="commands"
