author | terytkon |
Thu, 11 Mar 2010 18:39:02 +0200 | |
changeset 0 | 30eb2d538f02 |
permissions | -rw-r--r-- |
0
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
1 |
/* |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
3 |
* All rights reserved. |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
5 |
* under the terms of "Eclipse Public License v1.0" |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
8 |
* |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
9 |
* Initial Contributors: |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
11 |
* |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
12 |
* Contributors: |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
13 |
* |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
14 |
* Description: |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
15 |
* |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
16 |
*/ |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
17 |
package constraints; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
18 |
|
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
19 |
import helpers.MarkerManager; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
20 |
import org.eclipse.core.runtime.IStatus; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
21 |
import org.eclipse.emf.ecore.EObject; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
22 |
import org.eclipse.emf.validation.AbstractModelConstraint; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
23 |
import org.eclipse.emf.validation.IValidationContext; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
24 |
|
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
25 |
|
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
26 |
import cenrep.Access; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
27 |
import cenrep.IAccessable; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
28 |
import cenrep.RVG; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
29 |
|
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
30 |
public class RFSwCapaConstraint extends AbstractModelConstraint { |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
31 |
|
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
32 |
private static final String URL_POSTFIX = "#.7B.25element_ref.25.7D_has_RFS_defined.2C_but_write_capability_is_missing"; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
33 |
|
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
34 |
public RFSwCapaConstraint() { |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
35 |
} |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
36 |
|
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
37 |
// w Capa should be define if RFS = true |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
38 |
public IStatus validate(IValidationContext ctx) { |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
39 |
EObject obj = ctx.getTarget(); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
40 |
if(IAccessable.class.isInstance(obj)&&RVG.class.isInstance(obj)){ |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
41 |
if(((RVG)obj).isRfs()){ |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
42 |
IAccessable acc = (IAccessable)obj; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
43 |
Access wAccess = acc.getWriteAccess(); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
44 |
if(wAccess==null || |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
45 |
(wAccess.getCapabilities()==null && wAccess.getSid()== null) || |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
46 |
(wAccess.getCapabilities()!=null && wAccess.getCapabilities().trim().isEmpty() && |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
47 |
wAccess.getSid()!= null && wAccess.getSid().trim().isEmpty())) |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
48 |
return MarkerManager.getInstance().addProblem(ctx, ElementRefParser.getName(obj),ElementRefParser.getName(obj), |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
49 |
URL_POSTFIX); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
50 |
} |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
51 |
} |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
52 |
return ctx.createSuccessStatus(); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
53 |
} |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
54 |
|
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
55 |
} |