|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 * Callback for add parameter property dialog |
|
17 * |
|
18 */ |
|
19 package com.nokia.tracebuilder.engine.propertydialog; |
|
20 |
|
21 import com.nokia.tracebuilder.engine.TraceBuilderGlobals; |
|
22 import com.nokia.tracebuilder.engine.TraceObjectPropertyDialog; |
|
23 import com.nokia.tracebuilder.model.Trace; |
|
24 import com.nokia.tracebuilder.model.TraceBuilderException; |
|
25 import com.nokia.tracebuilder.model.TraceModel; |
|
26 import com.nokia.tracebuilder.model.TraceModelExtension; |
|
27 import com.nokia.tracebuilder.model.TraceParameter; |
|
28 |
|
29 /** |
|
30 * Callback for add parameter property dialog |
|
31 * |
|
32 */ |
|
33 final class CreateParameterCallback extends PropertyDialogCallback { |
|
34 |
|
35 /** |
|
36 * Trace parameter is returned after creation |
|
37 */ |
|
38 private TraceParameter parameter; |
|
39 |
|
40 /** |
|
41 * Owning trace |
|
42 */ |
|
43 private Trace trace; |
|
44 |
|
45 /** |
|
46 * Constructor |
|
47 * |
|
48 * @param model |
|
49 * the trace model |
|
50 * @param trace |
|
51 * the trace where parameter is added |
|
52 */ |
|
53 CreateParameterCallback(TraceModel model, Trace trace) { |
|
54 super(model); |
|
55 this.trace = trace; |
|
56 } |
|
57 |
|
58 /* |
|
59 * (non-Javadoc) |
|
60 * |
|
61 * @see com.nokia.tracebuilder.engine.PropertyDialogManagerCallback# |
|
62 * okSelected(com.nokia.tracebuilder.engine.TraceObjectPropertyDialog) |
|
63 */ |
|
64 public void okSelected(TraceObjectPropertyDialog dialog) |
|
65 throws TraceBuilderException { |
|
66 int id = dialog.getID(); |
|
67 String name = dialog.getName(); |
|
68 String type = dialog.getValue(); |
|
69 model.getVerifier().checkTraceParameterProperties(trace, null, id, |
|
70 name, type); |
|
71 TraceModelExtension[] extensions = createExtensions(trace, dialog); |
|
72 parameter = model.getFactory().createTraceParameter(trace, id, name, |
|
73 type, extensions); |
|
74 TraceBuilderGlobals.getTraceBuilder().traceObjectSelected(parameter, |
|
75 true, false); |
|
76 } |
|
77 |
|
78 /** |
|
79 * Gets the parameter that was created |
|
80 * |
|
81 * @return the new parameter |
|
82 */ |
|
83 TraceParameter getParameter() { |
|
84 return parameter; |
|
85 } |
|
86 |
|
87 } |