Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
marigostra committed Sep 22, 2022
1 parent 72bf8e5 commit d311140
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
38 changes: 21 additions & 17 deletions src/main/java/org/luwrain/app/notepad/Conversations.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@
import org.luwrain.core.*;
import org.luwrain.popups.*;

import static org.luwrain.popups.Popups.*;

final class Conversations
{
static final String charsets = "UTF-8:KOI8-R:windows-1251:IBM866:ISO-8859-5";
static final String
charsets = "UTF-8:KOI8-R:windows-1251:IBM866:ISO-8859-5";

enum UnsavedChangesRes {CONTINUE_SAVE, CONTINUE_UNSAVED, CANCEL};

private final Luwrain luwrain;
Expand All @@ -44,34 +48,34 @@ enum UnsavedChangesRes {CONTINUE_SAVE, CONTINUE_UNSAVED, CANCEL};
//currentFile may be null
File save(File currentFile)
{
return Popups.path(luwrain,
strings.savePopupName(), strings.savePopupPrefix(),
currentFile, //It's OK, if this value is null
(fileToCheck, announce)->{
if (fileToCheck.exists() && fileToCheck.isDirectory())
{
if (announce)
luwrain.message(strings.enteredPathMayNotBeDir(fileToCheck.getAbsolutePath()), Luwrain.MessageType.ERROR);
return false;
}
return true;
});
return path(luwrain,
strings.savePopupName(), strings.savePopupPrefix(),
currentFile, //It's OK, if this value is null
(fileToCheck, announce)->{
if (fileToCheck.exists() && fileToCheck.isDirectory())
{
if (announce)
luwrain.message(strings.enteredPathMayNotBeDir(fileToCheck.getAbsolutePath()), Luwrain.MessageType.ERROR);
return false;
}
return true;
});
}

File open()
{
return Popups.existingFile(luwrain, strings.openPopupName());
}
return existingFile(luwrain, strings.openPopupName());
}

File narratingDestDir()
{
return Popups.existingDir(luwrain, strings.narratingDestDirPopupPrefix());
return existingDir(luwrain, strings.narratingDestDirPopupPrefix());
}

String charset()
{
final String[] names = charsets.split(":", -1);
final Object res = Popups.fixedList(luwrain, strings.charsetPopupPrefix(), names);
final Object res = fixedList(luwrain, strings.charsetPopupPrefix(), names);
if (res == null)
return null;
return res.toString();
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/luwrain/app/notepad/MainLayout.java
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ private boolean onIdle()

private boolean onDirectoryQuery(CurrentDirQuery query)
{
NullCheck.notNull(query, "query");
if (app.file == null)
return false;
final File f = app.file.getParentFile();
Expand Down

0 comments on commit d311140

Please sign in to comment.