// Enable "paste" after "cut":
cutItem.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent event) {
RegionManager regions = (RegionManager) get("regions");
CurveIterator selection = (CurveIterator) get("selection");
regions.unShareShapes(selection);
put("clipboard", selection);
updatePasteEnabled();
}
}
);
// Enable "paste" after "copy":
copyItem.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent event) {
final Object selection = get("selection");
put("clipboard", selection);
updatePasteEnabled();
}
}
);
// And "paste" does the deed:
pasteItem.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent event) {
CurveIterator selection = (CurveIterator) get("clipboard");
RegionManager regions = (RegionManager) get("regions");
regions.shareShapes(selection, true);
}
}
);
pasteRefItem.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent event) {
CurveIterator selection = (CurveIterator) get("clipboard");
RegionManager regions = (RegionManager) get("regions");
regions.shareShapes(selection, false);
}
}
);
if (Platform.getType() != Platform.MacOSX) {
// On the Mac, the "Preferences" item lies under the app menu.