Skip to content

Commit

Permalink
IZPACK-1528: Add progress listener to UninstallerListener#beforeDelet…
Browse files Browse the repository at this point in the history
…e(List<File>)
  • Loading branch information
Michael Aichler committed Apr 3, 2017
1 parent e7833b8 commit 32ae288
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,11 @@ public void initialise()
* Invoked before files are deleted.
*
* @param files all files which should be deleted
* @param listener the progress listener
* @throws IzPackException for any error
*/
@Override
public void beforeDelete(List<File> files)
public void beforeDelete(List<File> files, ProgressListener listener)
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ public interface UninstallerListener extends InstallationListener
* Invoked before files are deleted.
*
* @param files all files which should be deleted
* @param listener the progress listener
* @throws IzPackException for any error
*/
void beforeDelete(List<File> files);
void beforeDelete(List<File> files, ProgressListener listener);

/**
* Invoked before a file is deleted.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,11 @@ public void initialise()
* Invoked before files are deleted.
*
* @param files all files which should be deleted
* @param listener the progress listener
* @throws IzPackException for any error
*/
@Override
public void beforeDelete(List<File> files) throws InstallerException
public void beforeDelete(List<File> files, ProgressListener listener) throws InstallerException
{
for (AntAction act : befDel)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,11 @@ public void initialise()
* Invoked before files are deleted.
*
* @param files all files which should be deleted
* @param listener the progress listener
* @throws IzPackException for any error
*/
@Override
public void beforeDelete(List<File> files)
public void beforeDelete(List<File> files, ProgressListener listener)
{
for (BSFAction action : actions)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.List;

import com.izforge.izpack.api.event.AbstractUninstallerListener;
import com.izforge.izpack.api.event.ProgressListener;
import com.izforge.izpack.api.exception.IzPackException;
import com.izforge.izpack.api.exception.NativeLibException;
import com.izforge.izpack.api.exception.ResourceNotFoundException;
Expand Down Expand Up @@ -111,10 +112,11 @@ public void initialise()
* Invoked before files are deleted.
*
* @param files all files which should be deleted
* @param listener the progress listener
* @throws IzPackException for any error
*/
@Override
public void beforeDelete(List<File> files)
public void beforeDelete(List<File> files, ProgressListener listener)
{
if (actions == null || actions.isEmpty())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public void checkListener(List<BSFAction> actions, String suffix) throws IOExcep
// hack to pass additional parameters to script. TODO

assertFileNotExists(installDir, "beforedeletion" + suffix);
listener.beforeDelete(files);
listener.beforeDelete(files, Mockito.mock(ProgressListener.class));
assertFileExists(installDir, "beforedeletion" + suffix);

assertFileNotExists(installDir, "beforedelete" + suffix);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static class State implements Serializable
public int initialiseCount;

/**
* Tracks the no. of invocations of {@link UninstallerListener#beforeDelete(List)}.
* Tracks the no. of invocations of {@link UninstallerListener#beforeDelete(List, ProgressListener)}.
*/
public int beforeListDeleteCount;

Expand Down Expand Up @@ -139,7 +139,7 @@ public boolean isFileListener()
* @throws IzPackException for any error
*/
@Override
public void beforeDelete(List<File> files)
public void beforeDelete(List<File> files, ProgressListener listener)
{
++state.beforeListDeleteCount;
log("beforeDelete: files=" + files.size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public void beforeDeletion(List<File> files, ProgressListener listener)
{
try
{
l.beforeDelete(files);
l.beforeDelete(files, listener);
}
catch (IzPackException exception)
{
Expand Down

0 comments on commit 32ae288

Please sign in to comment.