Lines 41-57
Link Here
|
41 |
*/ |
41 |
*/ |
42 |
package org.netbeans.modules.openide.awt; |
42 |
package org.netbeans.modules.openide.awt; |
43 |
|
43 |
|
|
|
44 |
import java.io.IOException; |
45 |
import org.netbeans.api.actions.Savable; |
44 |
import org.netbeans.spi.actions.AbstractSavable; |
46 |
import org.netbeans.spi.actions.AbstractSavable; |
|
|
47 |
import org.openide.LifecycleManager; |
48 |
import org.openide.util.Exceptions; |
45 |
import org.openide.util.Lookup; |
49 |
import org.openide.util.Lookup; |
46 |
import org.openide.util.RequestProcessor; |
50 |
import org.openide.util.RequestProcessor; |
47 |
import org.openide.util.lookup.AbstractLookup; |
51 |
import org.openide.util.lookup.AbstractLookup; |
48 |
import org.openide.util.lookup.InstanceContent; |
52 |
import org.openide.util.lookup.InstanceContent; |
|
|
53 |
import org.openide.util.lookup.ServiceProvider; |
49 |
|
54 |
|
50 |
/** |
55 |
@ServiceProvider(service=LifecycleManager.class) |
51 |
* |
56 |
public final class SavableRegistry extends LifecycleManager { |
52 |
* @author Jaroslav Tulach <jtulach@netbeans.org> |
|
|
53 |
*/ |
54 |
public final class SavableRegistry { |
55 |
private static final RequestProcessor RP = new RequestProcessor("Savable Registry"); |
57 |
private static final RequestProcessor RP = new RequestProcessor("Savable Registry"); |
56 |
private static final InstanceContent IC = new InstanceContent(RP); |
58 |
private static final InstanceContent IC = new InstanceContent(RP); |
57 |
private static final Lookup LOOKUP = new AbstractLookup(IC); |
59 |
private static final Lookup LOOKUP = new AbstractLookup(IC); |
Lines 67-70
Link Here
|
67 |
public static void unregister(AbstractSavable as) { |
69 |
public static void unregister(AbstractSavable as) { |
68 |
IC.remove(as); |
70 |
IC.remove(as); |
69 |
} |
71 |
} |
|
|
72 |
|
73 |
@Override |
74 |
public void saveAll() { |
75 |
for (Savable sa : getRegistry().lookupAll(Savable.class)) { |
76 |
try { |
77 |
sa.save(); |
78 |
} catch (IOException ex) { |
79 |
Exceptions.printStackTrace(ex); |
80 |
} |
81 |
} |
82 |
} |
83 |
|
84 |
@Override |
85 |
public void exit() { |
86 |
} |
70 |
} |
87 |
} |