author | tasneems@symbian.org |
Wed, 27 Jan 2010 15:05:37 -0800 | |
changeset 50 | 0560e98b9bf6 |
child 196 | dac81ca327ce |
permissions | -rw-r--r-- |
50
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
1 |
/** |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
2 |
* Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies). |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
3 |
* All rights reserved. |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
5 |
* under the terms of the License "Eclipse Public License v1.0" |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
8 |
* |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
9 |
* Initial Contributors: |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
10 |
* Symbian Foundation - initial contribution. |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
11 |
* Contributors: |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
12 |
* Description: |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
13 |
* Overview: |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
14 |
* Details: |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
15 |
* Platforms/Drives/Compatibility: |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
16 |
* Assumptions/Requirement/Pre-requisites: |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
17 |
* Failures and causes: |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
18 |
*/ |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
19 |
|
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
20 |
package org.symbian.tools.wrttools.core.marker; |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
21 |
|
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
22 |
import org.eclipse.core.resources.IMarker; |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
23 |
import org.eclipse.core.resources.IProject; |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
24 |
import org.eclipse.core.resources.IResource; |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
25 |
import org.eclipse.core.resources.IWorkspace; |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
26 |
import org.eclipse.core.runtime.CoreException; |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
27 |
import org.eclipse.core.runtime.IStatus; |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
28 |
|
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
29 |
import org.symbian.tools.wrttools.Activator; |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
30 |
|
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
31 |
|
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
32 |
/** |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
33 |
* A class to handle markers. |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
34 |
*/ |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
35 |
public class WRTMarker { |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
36 |
|
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
37 |
/** |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
38 |
* WRTValidator problem marker type. This can be used to recognize those markers |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
39 |
* in the workspace that flag problems detected by the CodeScanner plugin. |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
40 |
*/ |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
41 |
public static final String WRT_PROBLEM_MARKER = Activator.PLUGIN_ID + ".com.nokia.wrt.core.validator.marker"; //$NON-NLS-1$ |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
42 |
|
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
43 |
// public static final String WRT_PROBLEM_MARKER = Activator.PLUGIN_ID + ".WRTMarker"; //$NON-NLS-1$ |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
44 |
|
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
45 |
/** |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
46 |
* WRTValidator extension to the marker problem markers which may hold a hint on |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
47 |
* the variable name that caused the error. Used by the ui to highlight the variable |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
48 |
* itself if it can be found. |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
49 |
*/ |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
50 |
public static final String WRT_MARKER_VARIABLE = "problem.variable"; //$NON-NLS-1$ |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
51 |
|
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
52 |
public static final String WRT_MARKER_FILE_NAME = "problem.file.name"; //$NON-NLS-1$ |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
53 |
|
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
54 |
public static final String WRT_MARKER_FILE_FULL_PATH = "problem.file.full.path"; //$NON-NLS-1$ |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
55 |
|
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
56 |
/** |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
57 |
* WRTValidator extension to the marker problem markers which may hold |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
58 |
* the path to the workspace external location of the file containing the problem |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
59 |
*/ |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
60 |
public static final String WRT_MARKER_EXTERNAL_LOCATION = "problem.externalLocation"; //$NON-NLS-1$ |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
61 |
|
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
62 |
/** |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
63 |
* WRTValidator extension to the marker problem markers which may hold |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
64 |
* the name of the WRTValidator rule applicable to the problem |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
65 |
*/ |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
66 |
public static final String WRT_MARKER_RULE_NAME = "problem.ruleName"; //$NON-NLS-1$ |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
67 |
|
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
68 |
/** |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
69 |
* Remove all validate markers from a project. |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
70 |
* @param currProject - Project containing WRTValidator markers. |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
71 |
*/ |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
72 |
public static void removeAllMarkers(IProject currProject) { |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
73 |
try { |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
74 |
IWorkspace workspace = currProject.getWorkspace(); |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
75 |
|
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
76 |
// remove all WRTValidator markers |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
77 |
IMarker[] markers = currProject.findMarkers(WRTMarker.WRT_PROBLEM_MARKER, true, IResource.DEPTH_INFINITE); |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
78 |
if ((markers != null) && (markers.length > 0)) { |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
79 |
workspace.deleteMarkers(markers); |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
80 |
} |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
81 |
} catch (CoreException e){ |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
82 |
Activator.log(IStatus.ERROR, "Marker Exception ", e); |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
83 |
} |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
84 |
} |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
85 |
|
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
86 |
} |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
87 |
|
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
diff
changeset
|
88 |