no message
This commit is contained in:
27
src/_VisualDVM/Passes/All/ImportFiles.java
Normal file
27
src/_VisualDVM/Passes/All/ImportFiles.java
Normal file
@@ -0,0 +1,27 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Passes.Pass;
|
||||
import Common.Visual.Windows.Dialog.VFileChooser;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.Global;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.Vector;
|
||||
public class ImportFiles extends Pass<Vector<File>> {
|
||||
VFileChooser fileChooser =
|
||||
new VFileChooser("Выберите файлы для добавления");
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
target = new Vector<>();
|
||||
if (args.length > 0)
|
||||
Arrays.stream(args).map(arg -> (File) arg).filter(File::isFile).forEach(file -> target.add(file));
|
||||
else
|
||||
target = fileChooser.ShowMultiDialog();
|
||||
return !target.isEmpty();
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
for (File file : target)
|
||||
Global.mainModule.getPass(PassCode.AddFile).Do(file);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user