]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/Validator.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.g2d / src / org / simantics / g2d / element / handler / Validator.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.g2d.element.handler;
13
14 import java.util.Collection;
15
16 import org.simantics.g2d.canvas.ICanvasContext;
17 import org.simantics.g2d.element.IElement;
18
19 /**
20  * This interface is implemented by all element contributions that
21  * have fields to be validated. 
22  * 
23  * @author Toni Kalajainen
24  */
25 public interface Validator extends ElementHandler {
26         
27         public interface Suggestion {
28                 String  getMessage(IElement e, ICanvasContext ctx);
29                 /**
30                  * 
31                  * @param e
32                  * @param ctx
33                  * @return
34                  */
35                 boolean fix(IElement e, ICanvasContext ctx);
36         }
37         
38         public interface Issue {
39                 String  getMessage(IElement e, ICanvasContext ctx);
40                 /**
41                  * 
42                  * @param e
43                  * @param ctx
44                  * @param suggestionList instances are should be static, shareable 
45                  */
46                 void    addSuggestions(IElement e, ICanvasContext ctx, Collection<Suggestion> suggestionList);
47         }
48                 
49         void validate(IElement e, ICanvasContext ctx, Collection<Issue> lst);   
50
51 }