git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268239 13f79535-47bb-0310-9956-ffa450edef68master
@@ -70,7 +70,8 @@ public class AboutCmd extends AbstractCommand { | |||||
* Standard constructor. | * Standard constructor. | ||||
* | * | ||||
*/ | */ | ||||
public AboutCmd() { | |||||
public AboutCmd(AppContext context) { | |||||
super(context); | |||||
} | } | ||||
/** | /** | ||||
@@ -69,15 +69,7 @@ public abstract class AbstractCommand implements Command { | |||||
* Default ctor. | * Default ctor. | ||||
* | * | ||||
*/ | */ | ||||
protected AbstractCommand() { | |||||
} | |||||
/** | |||||
* Set the application context. | |||||
* | |||||
* @param context Application context. | |||||
*/ | |||||
public void setContext(AppContext context) { | |||||
protected AbstractCommand(AppContext context) { | |||||
_context = context; | _context = context; | ||||
} | } | ||||
@@ -68,7 +68,8 @@ public class BuildCmd extends AbstractCommand { | |||||
* Standard ctor. | * Standard ctor. | ||||
* | * | ||||
*/ | */ | ||||
public BuildCmd() { | |||||
public BuildCmd(AppContext context) { | |||||
super(context); | |||||
} | } | ||||
/** | /** | ||||
@@ -67,7 +67,8 @@ public class ChangeLookAndFeelCmd extends AbstractCommand { | |||||
* Standard ctor. | * Standard ctor. | ||||
* | * | ||||
*/ | */ | ||||
public ChangeLookAndFeelCmd() { | |||||
public ChangeLookAndFeelCmd(AppContext context) { | |||||
super(context); | |||||
} | } | ||||
/** | /** | ||||
@@ -68,7 +68,8 @@ public class CloseCmd extends AbstractCommand { | |||||
* Standard constructor. | * Standard constructor. | ||||
* | * | ||||
*/ | */ | ||||
public CloseCmd() { | |||||
public CloseCmd(AppContext context) { | |||||
super(context); | |||||
} | } | ||||
/** | /** | ||||
@@ -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 | * Details TBD | ||||
* | * | ||||
* @version $Revision$ | * @version $Revision$ | ||||
* @author Simeon Fitch | * @author Simeon Fitch | ||||
*/ | */ | ||||
public interface Command extends Runnable { | public interface Command extends Runnable { | ||||
/** | |||||
* Set the application context. | |||||
* | |||||
* @param context Application context. | |||||
*/ | |||||
public void setContext(AppContext context); | |||||
/** | /** | ||||
* Run the command. From interface Runnable. | * Run the command. From interface Runnable. | ||||
* | * | ||||
*/ | */ | ||||
public void run(); | |||||
void run(); | |||||
} | } |
@@ -72,19 +72,23 @@ public class DisplayErrorCmd extends AbstractCommand { | |||||
private Throwable _ex = null; | private Throwable _ex = null; | ||||
/** | /** | ||||
* Default ctor. | |||||
* Standard ctor. | |||||
* | * | ||||
* @param context Application context. | |||||
*/ | */ | ||||
public DisplayErrorCmd() { | |||||
public DisplayErrorCmd(AppContext context) { | |||||
super(context); | |||||
} | } | ||||
/** | /** | ||||
* Standard constuctor. | * Standard constuctor. | ||||
* | * | ||||
* @param context Application context. | |||||
* @param message Error message. | * @param message Error message. | ||||
* @param ex Throwable assocated with error. | * @param ex Throwable assocated with error. | ||||
*/ | */ | ||||
public DisplayErrorCmd(String message, Throwable ex) { | |||||
public DisplayErrorCmd(AppContext context, String message, Throwable ex) { | |||||
this(context); | |||||
setMessage(message); | setMessage(message); | ||||
setThrowable(_ex); | setThrowable(_ex); | ||||
} | } | ||||
@@ -95,8 +99,8 @@ public class DisplayErrorCmd extends AbstractCommand { | |||||
* @param context Application context. | * @param context Application context. | ||||
* @param message Error message. | * @param message Error message. | ||||
*/ | */ | ||||
public DisplayErrorCmd(String message) { | |||||
this(message, null); | |||||
public DisplayErrorCmd(AppContext context, String message) { | |||||
this(context, message, null); | |||||
} | } | ||||
/** | /** | ||||
@@ -69,9 +69,10 @@ public class EmacsNotifyCmd extends AbstractCommand { | |||||
/** | /** | ||||
* Standard ctor. | * Standard ctor. | ||||
* | * | ||||
* @param state True if notifying on, false for notifying off. | |||||
* @param context Application context. | |||||
*/ | */ | ||||
public EmacsNotifyCmd() { | |||||
public EmacsNotifyCmd(AppContext context) { | |||||
super(context); | |||||
} | } | ||||
/** | /** | ||||
@@ -69,8 +69,10 @@ public class ExitCmd extends AbstractCommand { | |||||
/** | /** | ||||
* Standard constructor. | * Standard constructor. | ||||
* | * | ||||
* @param context Application context. | |||||
*/ | */ | ||||
public ExitCmd() { | |||||
public ExitCmd(AppContext context) { | |||||
super(context); | |||||
} | } | ||||
/** | /** | ||||
@@ -71,8 +71,10 @@ public class LoadFileCmd extends AbstractCommand { | |||||
/** | /** | ||||
* Standard ctor. | * Standard ctor. | ||||
* | * | ||||
* @param context Application context. | |||||
*/ | */ | ||||
public LoadFileCmd() { | |||||
public LoadFileCmd(AppContext context) { | |||||
super(context); | |||||
} | } | ||||
/** | /** | ||||
@@ -52,6 +52,7 @@ | |||||
* <http://www.apache.org/>. | * <http://www.apache.org/>. | ||||
*/ | */ | ||||
package org.apache.tools.ant.gui.command; | package org.apache.tools.ant.gui.command; | ||||
import org.apache.tools.ant.gui.AppContext; | |||||
/** | /** | ||||
* NoOp command. | * NoOp command. | ||||
@@ -61,6 +62,15 @@ package org.apache.tools.ant.gui.command; | |||||
*/ | */ | ||||
public class NoOpCmd extends AbstractCommand { | public class NoOpCmd extends AbstractCommand { | ||||
/** | /** | ||||
* Standard ctor. | |||||
* | |||||
* @param context Application context. | |||||
*/ | |||||
public NoOpCmd(AppContext context) { | |||||
super(context); | |||||
} | |||||
/** | |||||
* Successfully do nothing. | * Successfully do nothing. | ||||
* | * | ||||
*/ | */ | ||||
@@ -71,8 +71,10 @@ public class OpenCmd extends AbstractCommand { | |||||
/** | /** | ||||
* Standard ctor. | * Standard ctor. | ||||
* | * | ||||
* @param context Application context. | |||||
*/ | */ | ||||
public OpenCmd() { | |||||
public OpenCmd(AppContext context) { | |||||
super(context); | |||||
} | } | ||||
/** | /** | ||||
@@ -77,8 +77,10 @@ public class SaveAsCmd extends AbstractCommand { | |||||
/** | /** | ||||
* Standard ctor. | * Standard ctor. | ||||
* | * | ||||
* @param context Application context. | |||||
*/ | */ | ||||
public SaveAsCmd() { | |||||
public SaveAsCmd(AppContext context) { | |||||
super(context); | |||||
} | } | ||||
/** | /** | ||||
@@ -62,16 +62,13 @@ import org.apache.tools.ant.gui.AppContext; | |||||
*/ | */ | ||||
public class SaveCmd extends SaveAsCmd { | public class SaveCmd extends SaveAsCmd { | ||||
public SaveCmd() { | |||||
} | |||||
/** | /** | ||||
* Set the application context. | |||||
* Standard ctor. | |||||
* | * | ||||
* @param context Application context. | * @param context Application context. | ||||
*/ | */ | ||||
public void setContext(AppContext context) { | |||||
super.setContext(context); | |||||
public SaveCmd(AppContext context) { | |||||
super(context); | |||||
setFile(context.getProject().getFile()); | setFile(context.getProject().getFile()); | ||||
} | } | ||||
} | } |
@@ -106,15 +106,6 @@ public class AntBuildEvent extends AntEvent { | |||||
return _type; | 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. | * Create a string representation of this. | ||||
* | * | ||||
@@ -53,6 +53,7 @@ | |||||
*/ | */ | ||||
package org.apache.tools.ant.gui.event; | package org.apache.tools.ant.gui.event; | ||||
import org.apache.tools.ant.gui.command.Command; | import org.apache.tools.ant.gui.command.Command; | ||||
import org.apache.tools.ant.gui.command.NoOpCmd; | |||||
import org.apache.tools.ant.gui.AppContext; | import org.apache.tools.ant.gui.AppContext; | ||||
import java.util.EventObject; | 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()); | |||||
} | |||||
} | } |
@@ -54,8 +54,6 @@ | |||||
package org.apache.tools.ant.gui.event; | package org.apache.tools.ant.gui.event; | ||||
import org.apache.tools.ant.BuildEvent; | import org.apache.tools.ant.BuildEvent; | ||||
import org.apache.tools.ant.gui.AppContext; | 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; | 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(); | |||||
} | |||||
} | } |
@@ -54,8 +54,6 @@ | |||||
package org.apache.tools.ant.gui.event; | package org.apache.tools.ant.gui.event; | ||||
import org.apache.tools.ant.BuildEvent; | import org.apache.tools.ant.BuildEvent; | ||||
import org.apache.tools.ant.gui.AppContext; | 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; | 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(); | |||||
} | |||||
} | } |
@@ -69,5 +69,5 @@ public interface BusFilter { | |||||
* @param event Event to test. | * @param event Event to test. | ||||
* @return True if event should be given to BusMember, false otherwise. | * @return True if event should be given to BusMember, false otherwise. | ||||
*/ | */ | ||||
public boolean accept(EventObject event); | |||||
boolean accept(EventObject event); | |||||
} | } |
@@ -68,7 +68,7 @@ public interface BusMember { | |||||
* | * | ||||
* @return Filter to use. | * @return Filter to use. | ||||
*/ | */ | ||||
public BusFilter getBusFilter(); | |||||
BusFilter getBusFilter(); | |||||
/** | /** | ||||
* Called when an event is to be posed to the member. | * 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 | * @return true if event should be propogated, false if | ||||
* it should be cancelled. | * it should be cancelled. | ||||
*/ | */ | ||||
public boolean eventPosted(EventObject event); | |||||
boolean eventPosted(EventObject event); | |||||
} | } |
@@ -53,8 +53,6 @@ | |||||
*/ | */ | ||||
package org.apache.tools.ant.gui.event; | package org.apache.tools.ant.gui.event; | ||||
import org.apache.tools.ant.gui.acs.ACSElement; | 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; | import org.apache.tools.ant.gui.AppContext; | ||||
/** | /** | ||||
@@ -89,12 +87,4 @@ public class ElementSelectionEvent extends AntEvent { | |||||
return _selected; | 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(); | |||||
} | |||||
} | } |
@@ -109,8 +109,7 @@ public class ErrorEvent extends AntEvent { | |||||
* @return Command representing an appropriate response to this event. | * @return Command representing an appropriate response to this event. | ||||
*/ | */ | ||||
public Command createDefaultCmd() { | public Command createDefaultCmd() { | ||||
Command retval = new DisplayErrorCmd(_message, _ex); | |||||
retval.setContext(getContext()); | |||||
Command retval = new DisplayErrorCmd(getContext(), _message, _ex); | |||||
return retval; | return retval; | ||||
} | } | ||||
@@ -52,8 +52,6 @@ | |||||
* <http://www.apache.org/>. | * <http://www.apache.org/>. | ||||
*/ | */ | ||||
package org.apache.tools.ant.gui.event; | 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 org.apache.tools.ant.gui.AppContext; | ||||
/** | /** | ||||
@@ -72,13 +70,4 @@ public class NewProjectEvent extends AntEvent { | |||||
public NewProjectEvent(AppContext context) { | public NewProjectEvent(AppContext context) { | ||||
super(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(); | |||||
} | |||||
} | } |
@@ -85,9 +85,8 @@ public class OpenRequestEvent extends AntEvent { | |||||
* @return Load command. | * @return Load command. | ||||
*/ | */ | ||||
public Command createDefaultCmd() { | public Command createDefaultCmd() { | ||||
LoadFileCmd load = new LoadFileCmd(); | |||||
LoadFileCmd load = new LoadFileCmd(getContext()); | |||||
load.setFile(_file); | load.setFile(_file); | ||||
load.setContext(getContext()); | |||||
return load; | return load; | ||||
} | } | ||||
} | } | ||||
@@ -53,8 +53,6 @@ | |||||
*/ | */ | ||||
package org.apache.tools.ant.gui.event; | package org.apache.tools.ant.gui.event; | ||||
import org.apache.tools.ant.gui.AppContext; | 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 { | public class ProjectClosedEvent extends AntEvent { | ||||
/** | /** | ||||
* Standard ctor. | * Standard ctor. | ||||
* | * | ||||
@@ -74,13 +71,4 @@ public class ProjectClosedEvent extends AntEvent { | |||||
public ProjectClosedEvent(AppContext context) { | public ProjectClosedEvent(AppContext context) { | ||||
super(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(); | |||||
} | |||||
} | } |