Révision 3776
TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/handlers/files/DeleteFile.java (revision 3776) | ||
---|---|---|
41 | 41 |
import org.eclipse.swt.widgets.MessageBox; |
42 | 42 |
import org.eclipse.swt.widgets.Shell; |
43 | 43 |
import org.eclipse.ui.handlers.HandlerUtil; |
44 |
import org.txm.Toolbox; |
|
44 | 45 |
import org.txm.rcp.messages.TXMUIMessages; |
45 | 46 |
import org.txm.rcp.views.fileexplorer.Explorer; |
46 | 47 |
import org.txm.rcp.views.fileexplorer.MacroExplorer; |
... | ... | |
92 | 93 |
*/ |
93 | 94 |
public static void delete(List<?> files, boolean definitive) { |
94 | 95 |
|
96 |
String rootPath = Toolbox.getTxmHomePath(); |
|
97 |
|
|
95 | 98 |
Shell shell = new Shell(); |
96 | 99 |
MessageBox dialog = new MessageBox(shell, SWT.YES | SWT.NO); |
97 | 100 |
dialog.setMessage(TXMUIMessages.bind(TXMUIMessages.areYouSureYouWantToDeleteP0Colon, files)); |
... | ... | |
102 | 105 |
for (Object o : files) { |
103 | 106 |
if (o instanceof File) { |
104 | 107 |
File file = (File) o; |
108 |
|
|
109 |
if (!file.getAbsolutePath().startsWith(rootPath)) { |
|
110 |
System.out.println("TXM won't delete files out of TXM working directory: "+file); |
|
111 |
continue; |
|
112 |
} |
|
113 |
|
|
105 | 114 |
if (file.exists()) { |
106 | 115 |
if (file.isFile()) { |
107 | 116 |
if (definitive) { |
Formats disponibles : Unified diff