Browse Source

More rework on the command abstraction code.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268239 13f79535-47bb-0310-9956-ffa450edef68
master
metasim 24 years ago
parent
commit
aa078695e8
25 changed files with 61 additions and 114 deletions
  1. +2
    -1
      src/antidote/org/apache/tools/ant/gui/command/AboutCmd.java
  2. +1
    -9
      src/antidote/org/apache/tools/ant/gui/command/AbstractCommand.java
  3. +2
    -1
      src/antidote/org/apache/tools/ant/gui/command/BuildCmd.java
  4. +2
    -1
      src/antidote/org/apache/tools/ant/gui/command/ChangeLookAndFeelCmd.java
  5. +2
    -1
      src/antidote/org/apache/tools/ant/gui/command/CloseCmd.java
  6. +2
    -9
      src/antidote/org/apache/tools/ant/gui/command/Command.java
  7. +9
    -5
      src/antidote/org/apache/tools/ant/gui/command/DisplayErrorCmd.java
  8. +3
    -2
      src/antidote/org/apache/tools/ant/gui/command/EmacsNotifyCmd.java
  9. +3
    -1
      src/antidote/org/apache/tools/ant/gui/command/ExitCmd.java
  10. +3
    -1
      src/antidote/org/apache/tools/ant/gui/command/LoadFileCmd.java
  11. +10
    -0
      src/antidote/org/apache/tools/ant/gui/command/NoOpCmd.java
  12. +3
    -1
      src/antidote/org/apache/tools/ant/gui/command/OpenCmd.java
  13. +3
    -1
      src/antidote/org/apache/tools/ant/gui/command/SaveAsCmd.java
  14. +3
    -6
      src/antidote/org/apache/tools/ant/gui/command/SaveCmd.java
  15. +0
    -9
      src/antidote/org/apache/tools/ant/gui/event/AntBuildEvent.java
  16. +8
    -6
      src/antidote/org/apache/tools/ant/gui/event/AntEvent.java
  17. +0
    -10
      src/antidote/org/apache/tools/ant/gui/event/BuildFinishedEvent.java
  18. +0
    -10
      src/antidote/org/apache/tools/ant/gui/event/BuildStartedEvent.java
  19. +1
    -1
      src/antidote/org/apache/tools/ant/gui/event/BusFilter.java
  20. +2
    -2
      src/antidote/org/apache/tools/ant/gui/event/BusMember.java
  21. +0
    -10
      src/antidote/org/apache/tools/ant/gui/event/ElementSelectionEvent.java
  22. +1
    -2
      src/antidote/org/apache/tools/ant/gui/event/ErrorEvent.java
  23. +0
    -11
      src/antidote/org/apache/tools/ant/gui/event/NewProjectEvent.java
  24. +1
    -2
      src/antidote/org/apache/tools/ant/gui/event/OpenRequestEvent.java
  25. +0
    -12
      src/antidote/org/apache/tools/ant/gui/event/ProjectClosedEvent.java

+ 2
- 1
src/antidote/org/apache/tools/ant/gui/command/AboutCmd.java View File

@@ -70,7 +70,8 @@ public class AboutCmd extends AbstractCommand {
* Standard constructor.
*
*/
public AboutCmd() {
public AboutCmd(AppContext context) {
super(context);
}

/**


+ 1
- 9
src/antidote/org/apache/tools/ant/gui/command/AbstractCommand.java View File

@@ -69,15 +69,7 @@ public abstract class AbstractCommand implements Command {
* Default ctor.
*
*/
protected AbstractCommand() {
}

/**
* Set the application context.
*
* @param context Application context.
*/
public void setContext(AppContext context) {
protected AbstractCommand(AppContext context) {
_context = context;
}



+ 2
- 1
src/antidote/org/apache/tools/ant/gui/command/BuildCmd.java View File

@@ -68,7 +68,8 @@ public class BuildCmd extends AbstractCommand {
* Standard ctor.
*
*/
public BuildCmd() {
public BuildCmd(AppContext context) {
super(context);
}

/**


+ 2
- 1
src/antidote/org/apache/tools/ant/gui/command/ChangeLookAndFeelCmd.java View File

@@ -67,7 +67,8 @@ public class ChangeLookAndFeelCmd extends AbstractCommand {
* Standard ctor.
*
*/
public ChangeLookAndFeelCmd() {
public ChangeLookAndFeelCmd(AppContext context) {
super(context);
}

/**


+ 2
- 1
src/antidote/org/apache/tools/ant/gui/command/CloseCmd.java View File

@@ -68,7 +68,8 @@ public class CloseCmd extends AbstractCommand {
* Standard constructor.
*
*/
public CloseCmd() {
public CloseCmd(AppContext context) {
super(context);
}

/**


+ 2
- 9
src/antidote/org/apache/tools/ant/gui/command/Command.java View File

@@ -57,23 +57,16 @@ import org.apache.tools.ant.gui.AppContext;


/**
* Interface for commands. Implementation needs to have a default ctor.
* Interface for commands.
* Details TBD
*
* @version $Revision$
* @author Simeon Fitch
*/
public interface Command extends Runnable {
/**
* Set the application context.
*
* @param context Application context.
*/
public void setContext(AppContext context);

/**
* Run the command. From interface Runnable.
*
*/
public void run();
void run();
}

+ 9
- 5
src/antidote/org/apache/tools/ant/gui/command/DisplayErrorCmd.java View File

@@ -72,19 +72,23 @@ public class DisplayErrorCmd extends AbstractCommand {
private Throwable _ex = null;

/**
* Default ctor.
* Standard ctor.
*
* @param context Application context.
*/
public DisplayErrorCmd() {
public DisplayErrorCmd(AppContext context) {
super(context);
}

/**
* Standard constuctor.
*
* @param context Application context.
* @param message Error message.
* @param ex Throwable assocated with error.
*/
public DisplayErrorCmd(String message, Throwable ex) {
public DisplayErrorCmd(AppContext context, String message, Throwable ex) {
this(context);
setMessage(message);
setThrowable(_ex);
}
@@ -95,8 +99,8 @@ public class DisplayErrorCmd extends AbstractCommand {
* @param context Application context.
* @param message Error message.
*/
public DisplayErrorCmd(String message) {
this(message, null);
public DisplayErrorCmd(AppContext context, String message) {
this(context, message, null);
}

/**


+ 3
- 2
src/antidote/org/apache/tools/ant/gui/command/EmacsNotifyCmd.java View File

@@ -69,9 +69,10 @@ public class EmacsNotifyCmd extends AbstractCommand {
/**
* Standard ctor.
*
* @param state True if notifying on, false for notifying off.
* @param context Application context.
*/
public EmacsNotifyCmd() {
public EmacsNotifyCmd(AppContext context) {
super(context);
}

/**


+ 3
- 1
src/antidote/org/apache/tools/ant/gui/command/ExitCmd.java View File

@@ -69,8 +69,10 @@ public class ExitCmd extends AbstractCommand {
/**
* Standard constructor.
*
* @param context Application context.
*/
public ExitCmd() {
public ExitCmd(AppContext context) {
super(context);
}

/**


+ 3
- 1
src/antidote/org/apache/tools/ant/gui/command/LoadFileCmd.java View File

@@ -71,8 +71,10 @@ public class LoadFileCmd extends AbstractCommand {
/**
* Standard ctor.
*
* @param context Application context.
*/
public LoadFileCmd() {
public LoadFileCmd(AppContext context) {
super(context);
}

/**


+ 10
- 0
src/antidote/org/apache/tools/ant/gui/command/NoOpCmd.java View File

@@ -52,6 +52,7 @@
* <http://www.apache.org/>.
*/
package org.apache.tools.ant.gui.command;
import org.apache.tools.ant.gui.AppContext;

/**
* NoOp command.
@@ -61,6 +62,15 @@ package org.apache.tools.ant.gui.command;
*/
public class NoOpCmd extends AbstractCommand {
/**
* Standard ctor.
*
* @param context Application context.
*/
public NoOpCmd(AppContext context) {
super(context);
}

/**
* Successfully do nothing.
*
*/


+ 3
- 1
src/antidote/org/apache/tools/ant/gui/command/OpenCmd.java View File

@@ -71,8 +71,10 @@ public class OpenCmd extends AbstractCommand {
/**
* Standard ctor.
*
* @param context Application context.
*/
public OpenCmd() {
public OpenCmd(AppContext context) {
super(context);
}

/**


+ 3
- 1
src/antidote/org/apache/tools/ant/gui/command/SaveAsCmd.java View File

@@ -77,8 +77,10 @@ public class SaveAsCmd extends AbstractCommand {
/**
* Standard ctor.
*
* @param context Application context.
*/
public SaveAsCmd() {
public SaveAsCmd(AppContext context) {
super(context);
}

/**


+ 3
- 6
src/antidote/org/apache/tools/ant/gui/command/SaveCmd.java View File

@@ -62,16 +62,13 @@ import org.apache.tools.ant.gui.AppContext;
*/
public class SaveCmd extends SaveAsCmd {

public SaveCmd() {
}

/**
* Set the application context.
* Standard ctor.
*
* @param context Application context.
*/
public void setContext(AppContext context) {
super.setContext(context);
public SaveCmd(AppContext context) {
super(context);
setFile(context.getProject().getFile());
}
}

+ 0
- 9
src/antidote/org/apache/tools/ant/gui/event/AntBuildEvent.java View File

@@ -106,15 +106,6 @@ public class AntBuildEvent extends AntEvent {
return _type;
}

/**
* Create the appropriate default response command to this event.
*
* @return Command representing an appropriate response to this event.
*/
public Command createDefaultCmd() {
return new NoOpCmd();
}
/**
* Create a string representation of this.
*


+ 8
- 6
src/antidote/org/apache/tools/ant/gui/event/AntEvent.java View File

@@ -53,6 +53,7 @@
*/
package org.apache.tools.ant.gui.event;
import org.apache.tools.ant.gui.command.Command;
import org.apache.tools.ant.gui.command.NoOpCmd;
import org.apache.tools.ant.gui.AppContext;
import java.util.EventObject;

@@ -87,11 +88,12 @@ public abstract class AntEvent extends EventObject {


/**
* Create the appropriate default response command to this event.
* Override to create the appropriate default response
* command to this event.
*
* @return Command representing an appropriate response to this event.
*/
public abstract Command createDefaultCmd();
* @return Command representing an appropriate response to this event.
*/
public Command createDefaultCmd() {
return new NoOpCmd(getContext());
}
}

+ 0
- 10
src/antidote/org/apache/tools/ant/gui/event/BuildFinishedEvent.java View File

@@ -54,8 +54,6 @@
package org.apache.tools.ant.gui.event;
import org.apache.tools.ant.BuildEvent;
import org.apache.tools.ant.gui.AppContext;
import org.apache.tools.ant.gui.command.NoOpCmd;
import org.apache.tools.ant.gui.command.Command;


/**
@@ -90,12 +88,4 @@ public class BuildFinishedEvent extends AntEvent {
return _orig;
}

/**
* Create the appropriate response command to this event.
*
* @return Command representing an appropriate response to this event.
*/
public Command createDefaultCmd() {
return new NoOpCmd();
}
}

+ 0
- 10
src/antidote/org/apache/tools/ant/gui/event/BuildStartedEvent.java View File

@@ -54,8 +54,6 @@
package org.apache.tools.ant.gui.event;
import org.apache.tools.ant.BuildEvent;
import org.apache.tools.ant.gui.AppContext;
import org.apache.tools.ant.gui.command.NoOpCmd;
import org.apache.tools.ant.gui.command.Command;


/**
@@ -90,12 +88,4 @@ public class BuildStartedEvent extends AntEvent {
return _orig;
}

/**
* Create the appropriate response command to this event.
*
* @return Command representing an appropriate response to this event.
*/
public Command createDefaultCmd() {
return new NoOpCmd();
}
}

+ 1
- 1
src/antidote/org/apache/tools/ant/gui/event/BusFilter.java View File

@@ -69,5 +69,5 @@ public interface BusFilter {
* @param event Event to test.
* @return True if event should be given to BusMember, false otherwise.
*/
public boolean accept(EventObject event);
boolean accept(EventObject event);
}

+ 2
- 2
src/antidote/org/apache/tools/ant/gui/event/BusMember.java View File

@@ -68,7 +68,7 @@ public interface BusMember {
*
* @return Filter to use.
*/
public BusFilter getBusFilter();
BusFilter getBusFilter();

/**
* Called when an event is to be posed to the member.
@@ -77,6 +77,6 @@ public interface BusMember {
* @return true if event should be propogated, false if
* it should be cancelled.
*/
public boolean eventPosted(EventObject event);
boolean eventPosted(EventObject event);

}

+ 0
- 10
src/antidote/org/apache/tools/ant/gui/event/ElementSelectionEvent.java View File

@@ -53,8 +53,6 @@
*/
package org.apache.tools.ant.gui.event;
import org.apache.tools.ant.gui.acs.ACSElement;
import org.apache.tools.ant.gui.command.Command;
import org.apache.tools.ant.gui.command.NoOpCmd;
import org.apache.tools.ant.gui.AppContext;

/**
@@ -89,12 +87,4 @@ public class ElementSelectionEvent extends AntEvent {
return _selected;
}

/**
* Create the appropriate default response command to this event.
*
* @return Command representing an appropriate response to this event.
*/
public Command createDefaultCmd() {
return new NoOpCmd();
}
}

+ 1
- 2
src/antidote/org/apache/tools/ant/gui/event/ErrorEvent.java View File

@@ -109,8 +109,7 @@ public class ErrorEvent extends AntEvent {
* @return Command representing an appropriate response to this event.
*/
public Command createDefaultCmd() {
Command retval = new DisplayErrorCmd(_message, _ex);
retval.setContext(getContext());
Command retval = new DisplayErrorCmd(getContext(), _message, _ex);
return retval;
}



+ 0
- 11
src/antidote/org/apache/tools/ant/gui/event/NewProjectEvent.java View File

@@ -52,8 +52,6 @@
* <http://www.apache.org/>.
*/
package org.apache.tools.ant.gui.event;
import org.apache.tools.ant.gui.command.Command;
import org.apache.tools.ant.gui.command.NoOpCmd;
import org.apache.tools.ant.gui.AppContext;

/**
@@ -72,13 +70,4 @@ public class NewProjectEvent extends AntEvent {
public NewProjectEvent(AppContext context) {
super(context);
}

/**
* Create the appropriate default response command to this event.
*
* @return Command representing an appropriate response to this event.
*/
public Command createDefaultCmd() {
return new NoOpCmd();
}
}

+ 1
- 2
src/antidote/org/apache/tools/ant/gui/event/OpenRequestEvent.java View File

@@ -85,9 +85,8 @@ public class OpenRequestEvent extends AntEvent {
* @return Load command.
*/
public Command createDefaultCmd() {
LoadFileCmd load = new LoadFileCmd();
LoadFileCmd load = new LoadFileCmd(getContext());
load.setFile(_file);
load.setContext(getContext());
return load;
}
}


+ 0
- 12
src/antidote/org/apache/tools/ant/gui/event/ProjectClosedEvent.java View File

@@ -53,8 +53,6 @@
*/
package org.apache.tools.ant.gui.event;
import org.apache.tools.ant.gui.AppContext;
import org.apache.tools.ant.gui.command.NoOpCmd;
import org.apache.tools.ant.gui.command.Command;


/**
@@ -65,7 +63,6 @@ import org.apache.tools.ant.gui.command.Command;
*/
public class ProjectClosedEvent extends AntEvent {


/**
* Standard ctor.
*
@@ -74,13 +71,4 @@ public class ProjectClosedEvent extends AntEvent {
public ProjectClosedEvent(AppContext context) {
super(context);
}

/**
* Create the appropriate response command to this event.
*
* @return Command representing an appropriate response to this event.
*/
public Command createDefaultCmd() {
return new NoOpCmd();
}
}

Loading…
Cancel
Save