use of edu.cmu.cs.hcii.cogtool.ui.DesignEditorUI in project cogtool by cogtool.
the class DesignEditorController method createDuplicateFrameAction.
protected IListenerAction createDuplicateFrameAction() {
return new IListenerAction() {
public Class<?> getParameterClass() {
return DesignEditorUI.DuplicateParameters.class;
}
public boolean performAction(Object prms) {
// From DesignEditorUI
DesignEditorUI.DuplicateParameters parameters = (DesignEditorUI.DuplicateParameters) prms;
Frame[] framesToDuplicate = parameters.selection.getSelectedFrames();
if ((framesToDuplicate != null) && (framesToDuplicate.length > 0)) {
FrameSubsetDuplicator duplicator = new FrameSubsetDuplicator(framesToDuplicate);
Frame[] duplicatedFrames = new Frame[framesToDuplicate.length];
for (int i = 0; i < framesToDuplicate.length; i++) {
Frame duplicatedFrame = duplicator.getOrDuplicate(framesToDuplicate[i]);
duplicatedFrames[i] = duplicatedFrame;
duplicatedFrame.moveFrameOrigin(parameters.dx, parameters.dy);
}
design.addFrames(duplicatedFrames);
undoMgr.addEdit(createDuplicateFramesEdit(duplicatedFrames));
return true;
}
interaction.protestNoSelection();
return false;
}
};
}
Aggregations