Skip to content

Commit

Permalink
Enabling the copy operation
Browse files Browse the repository at this point in the history
  • Loading branch information
marigostra committed Apr 17, 2021
1 parent 8251fd3 commit 3fccd45
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 22 deletions.
7 changes: 7 additions & 0 deletions src/main/java/org/luwrain/app/commander/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ enum Side {LEFT, RIGHT};
return true;
}

void runOperation(Operation op)
{
NullCheck.notNull(op, "op");
this.operations.add(0, op);
getLuwrain().executeBkg(new FutureTask(op, null));
}

boolean allOperationsFinished()
{
for(Operation op:operations)
Expand Down
17 changes: 5 additions & 12 deletions src/main/java/org/luwrain/app/commander/FileActions.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ final class FileActions extends OperationsNames
FileActions(App app)
{
super(app);
}
}

boolean size(PanelArea panelArea)
{
Expand All @@ -58,7 +58,7 @@ private long getSize(FileObject fileObj) throws org.apache.commons.vfs2.FileSyst
{
NullCheck.notNull(fileObj, "fileObj");
if (fileObj.getType().hasChildren())
return getSize(fileObj.getChildren());
return getSize(fileObj.getChildren());
if (fileObj.isFile() && !fileObj.isSymbolicLink())
return fileObj.getContent().getSize();
return 0;
Expand Down Expand Up @@ -91,11 +91,9 @@ boolean localCopy(PanelArea copyFromArea, PanelArea copyToArea)
final Path dest = app.getConv().copy(copyFromDir, filesToCopy, copyToDir);
if (dest == null)
return true;
/*
final String name = copyOperationName(filesToCopy, dest);
final Copy copy = new Copy(app.createOperationListener(), name, null, null);
app.operations.add(0, copy);
*/
final Copy copy = new Copy(app.createOperationListener(), name, filesToCopy, dest);
app.runOperation(copy);
return true;
}

Expand Down Expand Up @@ -144,7 +142,7 @@ boolean localMkdir(PanelArea panelArea)
return true;
}

boolean localDelete(PanelArea area, OperationListener listener)
boolean localDelete(PanelArea area, OperationListener listener)
{
NullCheck.notNull(area, "area");
NullCheck.notNull(listener, "listener");
Expand All @@ -160,11 +158,6 @@ boolean localDelete(PanelArea area, OperationListener listener)
return true;
}






boolean zipCompress(PanelArea panelArea)
{
NullCheck.notNull(panelArea, "panelArea");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ class OperationsAppearance implements ListArea.Appearance
final Operation op = (Operation)item;
if (op.isFinished())
{
app.getLuwrain().speak(app.getOperationResultDescr(op) + " " + op.getOperationName());
app.getLuwrain().speak(app.getOperationResultDescr(op) + " " + op.name);
return;
}
final int percents = op.getPercent();
if (percents > 0)
luwrain.speak("" + luwrain.i18n().getNumberStr(percents, "percents") + " " + op.getOperationName()); else
luwrain.speak(op.getOperationName());
luwrain.speak("" + luwrain.i18n().getNumberStr(percents, "percents") + " " + op.name); else
luwrain.speak(op.name);


}
Expand All @@ -66,8 +66,8 @@ class OperationsAppearance implements ListArea.Appearance
return app.getOperationResultDescr(op);
final int percent = op.getPercent();
if (percent == 0)
return op.getOperationName() + "...";
return percent + "%: "+ op.getOperationName();
return op.name + "...";
return percent + "%: "+ op.name;
}

@Override public int getObservableLeftBound(Object item)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,6 @@ public synchronized void interrupt()
interrupted = true;
}

public String getOperationName()
{
return name;
}

public boolean isFinished()
{
return finished;
Expand Down

0 comments on commit 3fccd45

Please sign in to comment.