|
1 /* |
|
2 * Copyright (c) 2008-2010 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 * Rule for entry traces |
|
17 * |
|
18 */ |
|
19 package com.nokia.tracebuilder.engine.rules; |
|
20 |
|
21 import com.nokia.tracebuilder.engine.utils.TraceUtils; |
|
22 import com.nokia.tracebuilder.model.Trace; |
|
23 import com.nokia.tracebuilder.model.TraceObjectRule; |
|
24 import com.nokia.tracebuilder.rules.TraceParameterRestrictionRule; |
|
25 import com.nokia.tracebuilder.source.SourceContext; |
|
26 |
|
27 /** |
|
28 * Rule for entry traces |
|
29 * |
|
30 */ |
|
31 public class EntryTraceRule extends AutomaticTraceTextRule implements |
|
32 CopyExtensionRule, TraceParameterRestrictionRule { |
|
33 |
|
34 /* |
|
35 * (non-Javadoc) |
|
36 * |
|
37 * @see com.nokia.tracebuilder.rules.TraceParameterRestrictionRule#canAddParameters() |
|
38 */ |
|
39 public boolean canAddParameters() { |
|
40 return false; |
|
41 } |
|
42 |
|
43 /* |
|
44 * (non-Javadoc) |
|
45 * |
|
46 * @see com.nokia.tracebuilder.rules.TraceParameterRestrictionRule#canRemoveParameters() |
|
47 */ |
|
48 public boolean canRemoveParameters() { |
|
49 boolean retval; |
|
50 Trace trace = (Trace) getOwner(); |
|
51 // Parameters (instance identifier) can be removed only from OstTraceFunctionEntry1 trace |
|
52 if (trace != null && trace.getParameterCount() == 1) { |
|
53 retval = true; |
|
54 } else { |
|
55 retval = false; |
|
56 } |
|
57 return retval; |
|
58 } |
|
59 |
|
60 /* |
|
61 * (non-Javadoc) |
|
62 * |
|
63 * @see com.nokia.tracebuilder.engine.rules.CopyExtensionRule#createCopy() |
|
64 */ |
|
65 public TraceObjectRule createCopy() { |
|
66 return new ExitTraceRule(); |
|
67 } |
|
68 |
|
69 /* |
|
70 * (non-Javadoc) |
|
71 * |
|
72 * @see com.nokia.tracebuilder.engine.rules.AutomaticTraceTextRule# |
|
73 * formatTrace(com.nokia.tracebuilder.source.SourceContext) |
|
74 */ |
|
75 @Override |
|
76 public String formatTrace(SourceContext context) { |
|
77 return TraceUtils.formatTrace(RuleUtils.TEXT_FORMAT_BASE, context |
|
78 .getClassName(), context.getFunctionName()); |
|
79 } |
|
80 } |