use of edu.cmu.cs.hcii.cogtool.ui.Interaction in project cogtool by cogtool.
the class DesignCmd method addDevices.
public static boolean addDevices(Project project, Design design, Interaction interaction) {
Interaction.DesignRequestData requestData = requestAddDevices(project, design, interaction);
if (requestData == null) {
// canceled!
return false;
}
Set<DeviceType> existingDevices = design.addDeviceTypes(requestData.deviceTypes);
if (requestData.deviceTypes.equals(existingDevices)) {
// nothing to do
return true;
}
Iterator<DeviceType> addDevices = requestData.deviceTypes.iterator();
while (addDevices.hasNext()) {
DeviceType devType = addDevices.next();
addDevice(design, devType, existingDevices);
}
return true;
}
use of edu.cmu.cs.hcii.cogtool.ui.Interaction in project cogtool by cogtool.
the class Controller method assignActions.
/**
* Registers the set of <code>IListenerAction</code> instances
* that implement the semantic actions that are possible.
* <p>
* For this class, this consists of the actions that all windows support.
*
* @author mlh
*/
protected void assignActions() {
UI ui = getUI();
if (ui != null) {
ui.setAction(CogToolLID.About, ui.popAboutBox());
// Set "open" action
ui.setAction(CogToolLID.OpenProject, new AListenerAction() {
public boolean performAction(Object prms) {
// open expects null in that case.
if (!(prms instanceof DoublePoint)) {
prms = null;
}
// Ask the user to select a CogTool project to open
File[] openLocs = getUI().getStandardInteraction().selectFileSources();
return open((DoublePoint) prms, openLocs);
}
});
ui.setAction(CogToolLID.OpenProjectFile, new IListenerAction() {
public Class<?> getParameterClass() {
return String.class;
}
public boolean performAction(Object actionParms) {
File[] openLoc = { new File((String) actionParms) };
return open(null, openLoc);
}
});
// Set "new project" action
ui.setAction(CogToolLID.NewProject, createNewProjectAction());
// Set "quit/exit" action
ui.setAction(CogToolLID.ExitApplication, createExitAction());
ui.setAction(CogToolLID.ClearRecent, new AListenerAction() {
public boolean performAction(Object actionParms) {
CogToolPref.clearRecent();
Interaction interaction = getUI().getStandardInteraction();
interaction.setStatusMessage(L10N.get("AC.RecentClear", "Recent file data cleared."));
return true;
}
});
}
}
Aggregations