01: /*--------------------------------------------------------------------------*
02: | Copyright (C) 2006 Christopher Kohlhaas, Bettina Lademann |
03: | |
04: | This program is free software; you can redistribute it and/or modify |
05: | it under the terms of the GNU General Public License as published by the |
06: | Free Software Foundation. A copy of the license has been included with |
07: | these distribution in the COPYING file, if not go to www.fsf.org |
08: | |
09: | As a special exception, you are granted the permissions to link this |
10: | program with every library, which license fulfills the Open Source |
11: | Definition as published by the Open Source Initiative (OSI). |
12: *--------------------------------------------------------------------------*/
13: package org.rapla.gui.internal.action;
14:
15: import java.awt.Component;
16: import java.awt.Point;
17:
18: import org.rapla.entities.Category;
19: import org.rapla.framework.RaplaContext;
20: import org.rapla.framework.RaplaException;
21: import org.rapla.gui.toolkit.DialogUI;
22:
23: public class CategoryAction extends RaplaObjectAction {
24: public CategoryAction(RaplaContext sm, Component parent, Point p)
25: throws RaplaException {
26: super (sm, parent, p);
27: }
28:
29: protected void delete() throws RaplaException {
30: if (object == null)
31: return;
32: Object[] objects = new Object[] { object };
33: DialogUI dlg = getInfoFactory().createDeleteDialog(objects,
34: parent);
35: dlg.start();
36: if (dlg.getSelectedIndex() != 0)
37: return;
38: Category category = (Category) object;
39: Category parentClone = (Category) getModification().edit(
40: category.getParent());
41: parentClone.removeCategory(parentClone.findCategory(category));
42: getModification().store(parentClone);
43: }
44:
45: }
|