Skip to content

Commit

Permalink
Fixing DestPathPopup
Browse files Browse the repository at this point in the history
  • Loading branch information
marigostra committed Dec 15, 2021
1 parent 428e953 commit 72c509c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
2 changes: 2 additions & 0 deletions src/main/java/org/luwrain/app/commander/FileActions.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,10 @@ boolean localCopy(PanelArea copyFromArea, PanelArea copyToArea)
if (dest == null)
return true;
final String name = copyOperationName(filesToCopy, dest);
/*
final Copy copy = new Copy(app.opListener, name, filesToCopy, dest);
app.runOperation(copy);
*/
return true;
}

Expand Down
34 changes: 21 additions & 13 deletions src/main/java/org/luwrain/app/commander/popups/DestPathPopup.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public DestPathPopup(Luwrain luwrain, Strings strings, Type type,
Path srcDir, Path[] files, Path destDir)
{
super(luwrain,
name(strings), prefix(), acceptance(),
name(strings, type), prefix(strings, type, files), acceptance(),
destDir.toFile(), srcDir.toFile(),
EnumSet.noneOf(FilePopup.Flags.class), Popups.DEFAULT_POPUP_FLAGS);
NullCheck.notNull(strings, "strings");
Expand All @@ -51,24 +51,32 @@ static private FileAcceptance acceptance()
};
}

static private String name(Strings strings)
static private String name(Strings strings, Type type)
{
NullCheck.notNull(strings, "strings");
NullCheck.notNull(type, "type");
switch(type)
{
case COPY:
return strings.copyPopupName();
case MOVE:
return strings.movePopupName();
}
return null;
}

static private String prefix()
static private String prefix(Strings strings, Type type, Path[] files)
{
NullCheck.notNull(strings, "strings");
NullCheck.notNull(type, "type");
NullCheck.notNullItems(files, "files");
switch(type)
{
case COPY:
return strings.copyPopupPrefix(files.length > 1?"":files[0].getFileName().toString()).replaceAll(" ", " ");
case MOVE:
return strings.movePopupPrefix(files.length > 1?"":files[0].getFileName().toString()).replaceAll(" ", " ");
}
return "";
}

private String copyPopupPrefix(File[] toCopy)
{
return strings.copyPopupPrefix(toCopy.length > 1?luwrain.i18n().getNumberStr(toCopy.length, "items"):toCopy[0].getName());
}

private String movePopupPrefix(File[] toMove)
{
return strings.movePopupPrefix(toMove.length > 1?luwrain.i18n().getNumberStr(toMove.length, "items"):toMove[0].getName());
}
}

0 comments on commit 72c509c

Please sign in to comment.