01: /*
02: * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright
03: * notice. All rights reserved.
04: */
05: package org.terracotta.dso.dialogs;
06:
07: import org.eclipse.swt.widgets.Composite;
08: import org.eclipse.swt.widgets.Control;
09: import org.eclipse.swt.widgets.Shell;
10: import org.terracotta.dso.TcPlugin;
11:
12: import com.tc.admin.common.AbstractResolutionAction;
13: import com.tc.admin.common.AbstractWorkState;
14: import com.tc.admin.common.UnlockedSharedWorkState;
15: import com.tc.object.appevent.AbstractLockEvent;
16: import com.tc.object.appevent.UnlockedSharedObjectEvent;
17: import com.tc.object.appevent.UnlockedSharedObjectEventContext;
18:
19: import java.util.ArrayList;
20: import java.util.Arrays;
21:
22: public class UnlockedSharedObjectDialog extends AbstractLockDialog {
23:
24: public UnlockedSharedObjectDialog(Shell parentShell,
25: UnlockedSharedObjectEvent event) {
26: super (parentShell,
27: "Attempt to modify shared data outside a lock", event);
28: }
29:
30: protected AbstractWorkState createWorkState(
31: AbstractLockEvent lockEvent) {
32: return new UnlockedSharedWorkState(
33: (UnlockedSharedObjectEvent) lockEvent);
34: }
35:
36: private UnlockedSharedWorkState getUnlockedSharedObjectWorkState() {
37: return (UnlockedSharedWorkState) getWorkState();
38: }
39:
40: private UnlockedSharedObjectEvent getUnlockedSharedObjectEvent() {
41: return (UnlockedSharedObjectEvent) getApplicationEvent();
42: }
43:
44: private UnlockedSharedObjectEventContext getUnlockedSharedObjectEventContext() {
45: return getUnlockedSharedObjectEvent()
46: .getUnlockedSharedObjectEventContext();
47: }
48:
49: protected String getIssueName() {
50: return "Unlocked shared object access";
51: }
52:
53: protected String getDialogSettingsSectionName() {
54: return TcPlugin.PLUGIN_ID
55: + ".UNLOCKED_SHARED_OBJECT_DIALOG_SECTION"; //$NON-NLS-1$
56: }
57:
58: protected Control createCustomArea(Composite parent) {
59: Control customArea = super .createCustomArea(parent);
60:
61: return customArea;
62: }
63:
64: protected AbstractResolutionAction[] createActions(
65: AbstractWorkState workState) {
66: AbstractResolutionAction[] actions = super
67: .createActions(workState);
68: ArrayList list = new ArrayList(Arrays.asList(actions));
69:
70: list.add(new AddLockAction());
71:
72: return (AbstractResolutionAction[]) list
73: .toArray(new AbstractResolutionAction[0]);
74: }
75: }
|