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.ReadOnlyWorkState;
15: import com.tc.object.appevent.AbstractLockEvent;
16: import com.tc.object.appevent.ReadOnlyObjectEvent;
17: import com.tc.object.appevent.ReadOnlyObjectEventContext;
18:
19: import java.util.ArrayList;
20: import java.util.Arrays;
21:
22: public class ReadOnlyObjectDialog extends AbstractLockDialog {
23:
24: public ReadOnlyObjectDialog(Shell parentShell,
25: ReadOnlyObjectEvent event) {
26: super (parentShell,
27: "Attempt to modify shared data in a read lock", event);
28: }
29:
30: protected AbstractWorkState createWorkState(
31: AbstractLockEvent lockEvent) {
32: return new ReadOnlyWorkState((ReadOnlyObjectEvent) lockEvent);
33: }
34:
35: private ReadOnlyWorkState getReadOnlyWorkState() {
36: return (ReadOnlyWorkState) getWorkState();
37: }
38:
39: private ReadOnlyObjectEvent getReadOnlyObjectEvent() {
40: return (ReadOnlyObjectEvent) getApplicationEvent();
41: }
42:
43: private ReadOnlyObjectEventContext getReadOnlyObjectEventContext() {
44: return getReadOnlyObjectEvent().getReadOnlyObjectEventContext();
45: }
46:
47: protected String getIssueName() {
48: return "Read-locked shared object modification";
49: }
50:
51: protected String getDialogSettingsSectionName() {
52: return TcPlugin.PLUGIN_ID + ".READONLY_OBJECT_DIALOG_SECTION"; //$NON-NLS-1$
53: }
54:
55: protected Control createCustomArea(Composite parent) {
56: Control customArea = super .createCustomArea(parent);
57:
58: return customArea;
59: }
60:
61: protected AbstractResolutionAction[] createActions(
62: AbstractWorkState workState) {
63: AbstractResolutionAction[] actions = super
64: .createActions(workState);
65: ArrayList list = new ArrayList(Arrays.asList(actions));
66:
67: list.add(new AddLockAction());
68:
69: return (AbstractResolutionAction[]) list
70: .toArray(new AbstractResolutionAction[0]);
71: }
72: }
|