Skip to content

Commit

Permalink
Adding the directory query processing
Browse files Browse the repository at this point in the history
  • Loading branch information
marigostra committed May 13, 2020
1 parent 2c6b8b1 commit c36b698
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/main/java/org/luwrain/app/notepad/MainLayout.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import org.luwrain.core.*;
import org.luwrain.core.events.*;
import org.luwrain.core.queries.*;
import org.luwrain.controls.*;
import org.luwrain.script.*;
import org.luwrain.template.*;
Expand Down Expand Up @@ -68,6 +69,8 @@ final class MainLayout extends LayoutBase
@Override public boolean onAreaQuery(AreaQuery query)
{
NullCheck.notNull(query, "query");
if (query.getQueryCode() == AreaQuery.CURRENT_DIR && query instanceof CurrentDirQuery)
return onDirectoryQuery((CurrentDirQuery)query);
if (app.onAreaQuery(this, query))
return true;
return super.onAreaQuery(query);
Expand All @@ -85,6 +88,18 @@ final class MainLayout extends LayoutBase
};
}

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

private boolean actOpen()
{
if (!app.everythingSaved())
Expand Down

0 comments on commit c36b698

Please sign in to comment.