diff -ruN uppsrc/ide/ide.h uppsrc/ide/ide.h
--- uppsrc/ide/ide.h	2011-10-28 00:29:05 +0600
+++ uppsrc/ide/ide.h	2011-11-05 12:50:38 +0600
@@ -461,6 +461,7 @@
 	virtual   void   FileSelected();
 	virtual   void   Serialize(Stream& s);
 	virtual   void   FileRename(const String& nm);
+	virtual   bool   FileRemove();
 	virtual   void   DragAndDrop(Point p, PasteClip& d);
 
 	virtual   void      PutConsole(const char *s);
diff -ruN uppsrc/ide/idefile.cpp uppsrc/ide/idefile.cpp
--- uppsrc/ide/idefile.cpp	2011-11-05 07:36:29 +0600
+++ uppsrc/ide/idefile.cpp	2011-11-05 13:00:55 +0600
@@ -396,6 +396,24 @@
 	tabs.RenameFile(editfile, nm);
 }
 
+bool Ide::FileRemove()
+{
+	int q = tabs.GetCursor();
+	if(q >= 0) {
+		tabs.CloseForce(q, false);
+		if(filelist.GetCount())
+			return true;
+		if(tabs.GetCount())
+			TabFile();
+		else {
+			tabs.Refresh();
+			FlushFile();
+		}
+		return false;
+	}
+	return true;
+}
+
 void Ide::EditFile0(const String& path, byte charset, bool astext, const String& headername) {
 	editor.CheckEdited(false);
 	editor.CloseAssist();
diff -ruN uppsrc/ide/UppDlg.h uppsrc/ide/UppDlg.h
--- uppsrc/ide/UppDlg.h	2011-10-28 00:29:05 +0600
+++ uppsrc/ide/UppDlg.h	2011-11-05 13:19:58 +0600
@@ -173,6 +173,7 @@
 	virtual void   SyncWorkspace()                    {}
 	virtual void   FileSelected()                     {}
 	virtual void   FileRename(const String& nm)       {}
+	virtual bool   FileRemove()                       { return true; }
 	virtual void   SyncSvnDir(const String& working)  {}
 
 	void   ScanWorkspace();
@@ -205,8 +206,8 @@
 	bool           IsSeparator(int i) const;
 
 	void LoadActualPackage();
-	void SaveLoadPackage();
-	void SaveLoadPackageNS();
+	void SaveLoadPackage(bool sel = true);
+	void SaveLoadPackageNS(bool sel = true);
 	void TouchFile(const String& path);
 
 	void MoveFile(int d);
diff -ruN uppsrc/ide/UppWspc.cpp uppsrc/ide/UppWspc.cpp
--- uppsrc/ide/UppWspc.cpp	2011-10-28 00:29:05 +0600
+++ uppsrc/ide/UppWspc.cpp	2011-11-05 13:19:50 +0600
@@ -197,7 +197,7 @@
 	}
 }
 
-void WorkspaceWork::SaveLoadPackageNS()
+void WorkspaceWork::SaveLoadPackageNS(bool sel)
 {
 	SavePackage();
 	String p = actualpackage;
@@ -209,13 +209,15 @@
 	ScanWorkspace();
 	package.SetSbPos(psc);
 	package.FindSetCursor(p);
-	filelist.SetSbPos(fsc);
-	filelist.FindSetCursor(f);
+	if (sel) {
+		filelist.SetSbPos(fsc);
+		filelist.FindSetCursor(f);
+	}
 }
 
-void WorkspaceWork::SaveLoadPackage()
+void WorkspaceWork::SaveLoadPackage(bool sel)
 {
-	SaveLoadPackageNS();
+	SaveLoadPackageNS(sel);
 	SyncWorkspace();
 }
 
@@ -589,11 +591,14 @@
 		actual.file.Remove(fx);
 	}
 	if(separator || IsAux())
-		SaveLoadPackageNS();
+		SaveLoadPackageNS(false);
 	else
-		SaveLoadPackage();
-	filelist.SetSbPos(s);
-	filelist.SetCursor(i);
+		SaveLoadPackage(false);
+
+	if (separator || FileRemove()) {
+		filelist.SetSbPos(s);
+		filelist.SetCursor(i);
+	}
 }
 
 void WorkspaceWork::DelFile()
diff -ruN uppsrc/TabBar/TabBar.cpp uppsrc/TabBar/TabBar.cpp
--- uppsrc/TabBar/TabBar.cpp	2011-10-28 00:29:03 +0600
+++ uppsrc/TabBar/TabBar.cpp	2011-11-05 11:55:43 +0600
@@ -393,7 +393,7 @@
 void TabBar::ContextMenu(Bar& bar)
 {
 	if (highlight >= 0 && crosses) {
-		bar.Add(tabs.GetCount() > mintabcount, t_("Close"), THISBACK1(Close, highlight));
+		bar.Add(tabs.GetCount() > mintabcount, t_("Close"), THISBACK2(Close, highlight, true));
 		bar.Separator();
 	}
 	int cnt = groups.GetCount();
@@ -2298,11 +2298,8 @@
 	Repos();
 }
 
-void TabBar::Close(int n)
+void TabBar::CloseForce(int n, bool action)
 {
-	if(tabs.GetCount() <= mintabcount)
-		return;
-
 	if(n == active)
 	{
 		int c = FindId(tabs[n].id);
@@ -2317,7 +2314,7 @@
 	Repos();
 	
 	if(n == active)
-		SetCursor(-1);
+		SetCursor0(-1, action);
 	else {
 		if (n < active)
 			active--;
@@ -2332,6 +2329,14 @@
 	}
 }
 
+void TabBar::Close(int n, bool action)
+{
+	if(tabs.GetCount() <= mintabcount)
+		return;
+
+	CloseForce(n, action);
+}
+
 void TabBar::CloseKey(const Value &key)
 {
 	int tabix = FindKey(key);
diff -ruN uppsrc/TabBar/TabBar.h uppsrc/TabBar/TabBar.h
--- uppsrc/TabBar/TabBar.h	2011-10-28 00:29:03 +0600
+++ uppsrc/TabBar/TabBar.h	2011-11-05 11:53:42 +0600
@@ -394,7 +394,8 @@
 	TabBar& AddKey(const Value& key, const Value& value, Image icon = Null, String group = Null, bool make_active = false);
 	TabBar& InsertKey(int ix, const Value& key, const Value& value, Image icon = Null, String group = Null, bool make_active = false);
 	
-	void 	Close(int n);
+	void 	CloseForce(int n, bool action = true);
+	void 	Close(int n, bool action = true);
 	void 	CloseKey(const Value& key);
 	void 	Clear();
 
