Project

General

Profile

« Previous | Next » 

Revision b2f59380

Added by Lutz Suhrbier over 12 years ago

PolytomousKeyListLabelProvider, Position and EditorAnnotation: fixed Single-Source problems

View differences:

.gitattributes
511 511
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/operation/MoveMediaInListOperation.java -text
512 512
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/operation/RemoveImageFromDescriptionElementOperation.java -text
513 513
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/singlesource/editor/TaxeditorEditorStartup.java -text
514
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/singlesource/editor/key/polytomous/IPolytomousKeyListLabelProvider.java -text
514 515
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/singlesource/editor/key/polytomous/PolytomousKeyListLabelProviderFacade.java -text
515 516
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/singlesource/editor/name/container/EditorAnnotationFacade.java -text
516 517
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/singlesource/editor/name/container/IEditorAnnotation.java -text
eu.etaxonomy.taxeditor.editor.rap/src/eu/etaxonomy/taxeditor/singlesource/editor/key/polytomous/PolytomousKeyListLabelProviderFacadeImpl.java
27 27
 * @created Apr 18, 2011
28 28
 * @version 1.0
29 29
 */
30
public class PolytomousKeyListLabelProviderFacadeImpl extends CellLabelProvider {
30
public class PolytomousKeyListLabelProviderFacadeImpl extends CellLabelProvider implements IPolytomousKeyListLabelProvider {
31 31

  
32 32
	private static final Logger logger = Logger.getLogger(PolytomousKeyListLabelProviderFacadeImpl.class);
33 33

  
......
37 37
	// TODO make this configurable via preferences
38 38
	private static final String INCREMENTOR_CHARACTER = "'";
39 39

  
40
	public PolytomousKeyListLabelProviderFacadeImpl() {
41
		super();
42
	}
43

  
44
	public Object getInstanceInternal()
45
	{
46
		PolytomousKeyListLabelProviderFacadeImpl INST = new PolytomousKeyListLabelProviderFacadeImpl(); 
47
		return INST;
48
	}
49
	
40 50
	/*
41 51
	 * (non-Javadoc)
42 52
	 * 
eu.etaxonomy.taxeditor.editor.rap/src/eu/etaxonomy/taxeditor/singlesource/editor/name/container/EditorAnnotationFacadeImpl.java
7 7
import org.eclipse.swt.graphics.Rectangle;
8 8
import org.eclipse.swt.widgets.Canvas;
9 9

  
10
import eu.etaxonomy.cdm.strategy.parser.ParserProblem;
11

  
10 12
/**
11 13
 * <p>EditorAnnotation class.</p>
12 14
 *
......
16 18
public class EditorAnnotationFacadeImpl implements IEditorAnnotation {
17 19
	private static final Logger logger = Logger.getLogger(EditorAnnotationFacadeImpl.class);
18 20

  
21
	public EditorAnnotationFacadeImpl(){
22
	}
19 23

  
20
	/**
21
     * <p>Constructor for EditorAnnotation.</p>
22
     *
23
     * @param type a {@link java.lang.String} object.
24
     * @param line a int.
25
     * @param text a {@link java.lang.String} object.
26
	 * @throws OperationNotSupportedException 
27
     */
28
    public EditorAnnotationFacadeImpl(EditorAnnotationFacade.EditorAnnotationType type, Integer line, String text) throws OperationNotSupportedException {
24
    public Object getInstanceInternal(EditorAnnotationFacade.EditorAnnotationType type, Integer line, String text) throws OperationNotSupportedException {
25
    	throw new OperationNotSupportedException("EditorAnnotation not supported.");
26
    }
27

  
28
    public Object getInstanceInternal(ParserProblem problem) throws OperationNotSupportedException {
29
    	throw new OperationNotSupportedException("EditorAnnotation not supported.");
30
    }
31
    public Object getInstanceInternal(Object marker) throws OperationNotSupportedException {
32
    	throw new OperationNotSupportedException("EditorAnnotation not supported.");
33
    }
34
    public Object getInstanceInternal(Integer line, String text) throws OperationNotSupportedException {
29 35
    	throw new OperationNotSupportedException("EditorAnnotation not supported.");
30 36
    }
31
    
32 37
    /**
33 38
     * <p>Getter for the field <code>marker</code>.</p>
34 39
     *
eu.etaxonomy.taxeditor.editor.rap/src/eu/etaxonomy/taxeditor/singlesource/org/eclipse/jface/text/PositionFacadeImpl.java
5 5

  
6 6
import javax.naming.OperationNotSupportedException;
7 7

  
8
import org.apache.log4j.Logger;
9

  
8 10
/**
9 11
 * @author lusu
10 12
 *
11 13
 */
12 14
public class PositionFacadeImpl implements IPosition {
15
	private static final Logger logger = Logger.getLogger(PositionFacadeImpl.class);
16
	
13 17
	public PositionFacadeImpl() throws OperationNotSupportedException {
14 18
		throw new OperationNotSupportedException("Position not supported.");
15 19
	}
......
21 25
	public PositionFacadeImpl(Integer offset, Integer length) throws OperationNotSupportedException {
22 26
		throw new OperationNotSupportedException("Position not supported.");
23 27
	}
28

  
29
	public Object getInstanceInternal() throws OperationNotSupportedException
30
	{
31
		PositionFacadeImpl INST = new PositionFacadeImpl(); 
32
		return INST;
33
	}
34

  
35
	public Object getInstanceInternal(Integer offset) throws OperationNotSupportedException
36
	{
37
		PositionFacadeImpl INST = new PositionFacadeImpl(offset); 
38
		return INST;
39
	}
40

  
41
	public Object getInstanceInternal(Integer offset, Integer length) throws OperationNotSupportedException
42
	{
43
		PositionFacadeImpl INST = new PositionFacadeImpl(offset, length); 
44
		return INST;
45
	}
24 46
}
eu.etaxonomy.taxeditor.editor.rcp/src/eu/etaxonomy/taxeditor/singlesource/editor/key/polytomous/PolytomousKeyListLabelProviderFacadeImpl.java
11 11
package eu.etaxonomy.taxeditor.singlesource.editor.key.polytomous;
12 12

  
13 13
import org.apache.log4j.Logger;
14
import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider;
14
import org.eclipse.jface.viewers.StyledCellLabelProvider;
15 15
import org.eclipse.jface.viewers.StyledString;
16 16
import org.eclipse.jface.viewers.StyledString.Styler;
17 17
import org.eclipse.jface.viewers.ViewerCell;
......
31 31
 * @created Apr 18, 2011
32 32
 * @version 1.0
33 33
 */
34
public class PolytomousKeyListLabelProviderFacadeImpl extends PolytomousKeyListLabelProviderFacade implements IStyledLabelProvider {
34
public class PolytomousKeyListLabelProviderFacadeImpl extends StyledCellLabelProvider implements IPolytomousKeyListLabelProvider {
35 35

  
36 36
	private static final Logger logger = Logger.getLogger(PolytomousKeyListLabelProviderFacadeImpl.class);
37 37

  
38
	protected Object getInstanceInternal()
38
	public Object getInstanceInternal()
39 39
	{
40 40
		PolytomousKeyListLabelProviderFacadeImpl INST = new PolytomousKeyListLabelProviderFacadeImpl(); 
41 41
		return INST;
......
51 51
	private static final String INCREMENTOR_CHARACTER = "'";
52 52

  
53 53
	public PolytomousKeyListLabelProviderFacadeImpl() {
54
		
54
		super();
55 55
	}
56 56
	
57 57
	/*
......
79 79
				cell.setStyleRanges(styleRanges);
80 80
			}
81 81
		}
82

  
83
		super.update(cell);
82
//	RAPSS: Abstract CellLabelProvider class hat kein update()
83
//		super.update(cell);
84 84
	}
85 85

  
86 86
	private String getTextForColumnIndex(PolytomousKeyNode node, int columnIndex) {
eu.etaxonomy.taxeditor.editor.rcp/src/eu/etaxonomy/taxeditor/singlesource/editor/name/container/EditorAnnotationFacadeImpl.java
1 1
package eu.etaxonomy.taxeditor.singlesource.editor.name.container;
2 2

  
3
import javax.naming.OperationNotSupportedException;
4

  
3 5
import org.apache.log4j.Logger;
4 6
import org.eclipse.core.resources.IMarker;
5 7
import org.eclipse.jface.text.Position;
......
27 29
    private String text;
28 30
    private int line;
29 31
    private Position position;
30

  
31 32
    
32
    public EditorAnnotationFacadeImpl(ParserProblem problem){
33
    	this(EditorAnnotationFacade.EditorAnnotationType.getTypeByProblem(problem), 0, problem.getMessage());
33
	public EditorAnnotationFacadeImpl(){
34
	}
35
    
36
    public EditorAnnotationFacadeImpl(EditorAnnotationFacade.EditorAnnotationType type, Integer line, String text) {
37
    	super(type.name(), false, text);
38
        this.marker = null;
39
        this.line = line;
40
        this.text = text;
34 41
    }
35 42
    
43
    public EditorAnnotationFacadeImpl(Integer line, String text) {
44
    	this(EditorAnnotationType.ERROR, line, text);
45
    }
36 46
    
37
    /**
38
     * <p>Constructor for EditorAnnotation.</p>
39
     *
40
     * @param marker a org.eclipse.core.resources.IMarker object.
41
     */
47
    public EditorAnnotationFacadeImpl(ParserProblem problem){
48
    	this(EditorAnnotationFacade.EditorAnnotationType.getTypeByProblem(problem), 0, problem.getMessage());
49
    }
50

  
42 51
    public EditorAnnotationFacadeImpl(IMarker marker) {
43 52
        this.marker = marker;
44 53
    }
54
    
55
	public Object getInstanceInternal(EditorAnnotationFacade.EditorAnnotationType type, Integer line, String text) throws OperationNotSupportedException
56
	{
57
		return new EditorAnnotationFacadeImpl(type, line, text);
58
	}
45 59

  
46
    /**
47
     * <p>Constructor for EditorAnnotation.</p>
48
     *
49
     * @param line a int.
50
     * @param text a {@link java.lang.String} object.
51
     */
52
    public EditorAnnotationFacadeImpl(Integer line, String text) {
53
    	this(EditorAnnotationType.ERROR, line, text);
60
    public Object getInstanceInternal(Integer line, String text) {
61
    	return new EditorAnnotationFacadeImpl(line, text);
54 62
    }
55 63

  
56
    /**
57
     * <p>Constructor for EditorAnnotation.</p>
58
     *
59
     * @param type a {@link java.lang.String} object.
60
     * @param line a int.
61
     * @param text a {@link java.lang.String} object.
62
     */
63
    public EditorAnnotationFacadeImpl(EditorAnnotationFacade.EditorAnnotationType type, Integer line, String text) {
64
    	super(type.name(), false, text);
65
        this.marker = null;
66
        this.line = line;
67
        this.text = text;
68
    }
64
    public Object getInstanceInternal(ParserProblem problem) throws OperationNotSupportedException
65
	{
66
		return new EditorAnnotationFacadeImpl(EditorAnnotationType.getTypeByProblem(problem), 0, problem.getMessage());
67
	}
69 68
    
69
	public Object getInstanceInternal(Object marker) throws OperationNotSupportedException
70
	{
71
		return new EditorAnnotationFacadeImpl((IMarker)marker);
72
	}
73

  
70 74
    /**
71 75
     * <p>Getter for the field <code>marker</code>.</p>
72 76
     *
eu.etaxonomy.taxeditor.editor.rcp/src/eu/etaxonomy/taxeditor/singlesource/editor/name/container/NameViewerFacadeImpl.java
249 249
	@Override
250 250
	public void addAnnotation(IEditorAnnotation annotation, IPosition position) throws OperationNotSupportedException {
251 251
		if(position == null){
252
			position = new PositionFacade(0, 0);
252
			position = PositionFacade.getInstance(0, 0);
253 253
		}
254
		if (position instanceof Position){
254
		if (position instanceof IPosition){
255 255
			this.getAnnotationModel().addAnnotation((Annotation)annotation, (Position)position);
256 256
		}else{
257 257
			throw new OperationNotSupportedException("type of argument 'position' must be org.eclipse.jface.text.Position.");
eu.etaxonomy.taxeditor.editor.rcp/src/eu/etaxonomy/taxeditor/singlesource/org/eclipse/jface/text/PositionFacadeImpl.java
5 5

  
6 6
import javax.naming.OperationNotSupportedException;
7 7

  
8
import org.apache.log4j.Logger;
8 9
import org.eclipse.jface.text.Position;
9 10

  
11
import eu.etaxonomy.taxeditor.singlesource.editor.key.polytomous.PolytomousKeyListLabelProviderFacadeImpl;
12

  
10 13
/**
11 14
 * @author lusu
12 15
 *
13 16
 */
14 17
public class PositionFacadeImpl extends Position implements IPosition {
15 18

  
19
	private static final Logger logger = Logger.getLogger(PositionFacadeImpl.class);
20

  
21
	public Object getInstanceInternal() throws OperationNotSupportedException
22
	{
23
		PositionFacadeImpl INST = new PositionFacadeImpl(); 
24
		return INST;
25
	}
26

  
27
	public Object getInstanceInternal(Integer offset) throws OperationNotSupportedException
28
	{
29
		PositionFacadeImpl INST = new PositionFacadeImpl(offset); 
30
		return INST;
31
	}
32

  
33
	public Object getInstanceInternal(Integer offset, Integer length) throws OperationNotSupportedException
34
	{
35
		PositionFacadeImpl INST = new PositionFacadeImpl(offset, length); 
36
		return INST;
37
	}
38

  
16 39
	public PositionFacadeImpl() throws OperationNotSupportedException {
17 40
		super();
18 41
	}
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyListEditor.java
229 229
		createColumns(viewer);
230 230
		viewer.getControl().addMouseListener(new LinkListener());
231 231
		viewer.setContentProvider(new PolytomousKeyListContentProvider());
232
		viewer.setLabelProvider(new PolytomousKeyListLabelProviderFacade());
232
		viewer.setLabelProvider(PolytomousKeyListLabelProviderFacade.getInstance());
233 233

  
234 234
		createMenu();
235 235

  
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/AbstractGroupedContainer.java
318 318
		
319 319
		if(!isNameParsable()){
320 320
			getNameViewer().addAnnotation(
321
					new EditorAnnotationFacade(EditorAnnotationType.WARNING, 0, "This name may only be edited in the details view."));
321
					EditorAnnotationFacade.getInstance(EditorAnnotationType.WARNING, 0, "This name may only be edited in the details view."));
322 322
		}
323 323
		
324 324
		if(isNameUsedMultipleTimes()){
325
			getNameViewer().addAnnotation(new EditorAnnotationFacade(EditorAnnotationType.WARNING, 0, "This taxons name is used multiple times."));
325
			getNameViewer().addAnnotation(EditorAnnotationFacade.getInstance(EditorAnnotationType.WARNING, 0, "This taxons name is used multiple times."));
326 326
		}
327 327
		
328 328
		
......
338 338
		List<ParserProblem> parsingProblems = getName().getParsingProblems();
339 339
		
340 340
		for (ParserProblem problem : parsingProblems) {
341
			getNameViewer().addAnnotation(new EditorAnnotationFacade(problem), getParsingProblemPosition());
341
			getNameViewer().addAnnotation(EditorAnnotationFacade.getInstance(problem), getParsingProblemPosition());
342 342
		}	
343 343
	}
344 344
	
......
358 358
				length = text.length() - start;
359 359
			}
360 360
			
361
			return new PositionFacade(start, length);
361
			return PositionFacade.getInstance(start, length);
362 362
		}
363 363
		return null;
364 364
	}
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/ConceptContainer.java
133 133
	public void showAnnotations() throws OperationNotSupportedException {
134 134
		if(getData().getSec() == null){
135 135
			getNameViewer().addAnnotation(
136
					new EditorAnnotationFacade(0, "This taxon requires a sec. reference."));
136
					EditorAnnotationFacade.getInstance(0, "This taxon requires a sec. reference."));
137 137
		}
138 138
		super.showAnnotations();
139 139
	}
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/MisapplicationContainer.java
96 96
	public void showAnnotations() throws OperationNotSupportedException {
97 97
		if(getData().getSec() == null){
98 98
			getNameViewer().addAnnotation(
99
					new EditorAnnotationFacade(0, "This misapplication requires a sec. reference."));
99
					EditorAnnotationFacade.getInstance(0, "This misapplication requires a sec. reference."));
100 100
		}
101 101
		super.showAnnotations();
102 102
	}
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/singlesource/editor/key/polytomous/IPolytomousKeyListLabelProvider.java
1
package eu.etaxonomy.taxeditor.singlesource.editor.key.polytomous;
2

  
3
import org.eclipse.jface.viewers.IBaseLabelProvider;
4
import org.eclipse.jface.viewers.ViewerCell;
5

  
6
public interface IPolytomousKeyListLabelProvider extends IBaseLabelProvider {
7
	/*
8
	 * (non-Javadoc)
9
	 * 
10
	 * @see
11
	 * org.eclipse.jface.viewers.StyledCellLabelProvider#update(org.eclipse.
12
	 * jface.viewers.ViewerCell)
13
	 */
14
	public abstract void update(ViewerCell cell);
15
	
16
	public abstract Object getInstanceInternal();	
17
}
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/singlesource/editor/key/polytomous/PolytomousKeyListLabelProviderFacade.java
12 12

  
13 13
import org.apache.log4j.Logger;
14 14
import org.eclipse.jface.viewers.CellLabelProvider;
15
import org.eclipse.jface.viewers.ILabelProviderListener;
16
import org.eclipse.jface.viewers.ViewerCell;
17 15

  
18 16
import eu.etaxonomy.taxeditor.singlesource.ImplementationLoader;
19
import eu.etaxonomy.taxeditor.singlesource.editor.view.concept.ConceptLabelProviderFacade;
20 17

  
21 18
/**
22 19
 * @author n.hoffmann
......
26 23
public abstract class PolytomousKeyListLabelProviderFacade extends CellLabelProvider {
27 24
	private static final Logger logger = Logger.getLogger(PolytomousKeyListLabelProviderFacade.class);
28 25
	
29
	private final static PolytomousKeyListLabelProviderFacade IMPL;
26
	private final static IPolytomousKeyListLabelProvider IMPL;
30 27
	static {
31
		IMPL = (PolytomousKeyListLabelProviderFacade)ImplementationLoader.newInstance(PolytomousKeyListLabelProviderFacade.class) ;
28
		IMPL = (IPolytomousKeyListLabelProvider)ImplementationLoader.newInstance(PolytomousKeyListLabelProviderFacade.class) ;
32 29
	}
33 30
	
34
	public static PolytomousKeyListLabelProviderFacade getInstance () {
35
		return (PolytomousKeyListLabelProviderFacade)IMPL.getInstanceInternal();
31
	PolytomousKeyListLabelProviderFacade() {
32
		super();
33
	}
34
	
35
	public static IPolytomousKeyListLabelProvider getInstance () {
36
		return (IPolytomousKeyListLabelProvider)IMPL.getInstanceInternal();
36 37
	}
37 38

  
38
	protected abstract Object getInstanceInternal();
39
	public abstract Object getInstanceInternal();
39 40
	/* (non-Javadoc)
40 41
	 * @see eu.etaxonomy.taxeditor.singlesource.editor.key.polytomous.IPolytomousKeyListLabelProvider#update(org.eclipse.jface.viewers.ViewerCell)
41 42
	 */
42
	@Override
43
	public void update(ViewerCell cell) {
44
		IMPL.update(cell);
45
	}
46

  
47
	@Override
48
	public void addListener(ILabelProviderListener listener) {
49
		IMPL.addListener(listener);
50
	}
51

  
52
	@Override
53
	public void dispose() {
54
		IMPL.dispose();
55
	}
56

  
57
	@Override
58
	public boolean isLabelProperty(Object element, String property) {
59
		return IMPL.isLabelProperty(element, property);
60
	}
61

  
62
	@Override
63
	public void removeListener(ILabelProviderListener listener) {
64
		IMPL.removeListener(listener);
65
	}
66 43
}
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/singlesource/editor/name/container/EditorAnnotationFacade.java
12 12
import eu.etaxonomy.cdm.strategy.parser.ParserProblem;
13 13
import eu.etaxonomy.taxeditor.model.ImageResources;
14 14
import eu.etaxonomy.taxeditor.singlesource.ImplementationLoader;
15
import eu.etaxonomy.taxeditor.singlesource.editor.key.polytomous.IPolytomousKeyListLabelProvider;
16
import eu.etaxonomy.taxeditor.singlesource.editor.key.polytomous.PolytomousKeyListLabelProviderFacade;
15 17

  
16 18
/**
17 19
 * <p>EditorAnnotation class.</p>
......
19 21
 * @author n.hoffmann
20 22
 * @version $Id: $
21 23
 */
22
public class EditorAnnotationFacade implements IEditorAnnotation {
24
public abstract class EditorAnnotationFacade {
23 25
	private static final Logger logger = Logger
24 26
			.getLogger(EditorAnnotationFacade.class);
25 27
	
26
	protected IEditorAnnotation IMPL;
27

  
28
	private Object marker;
28
	private final static IEditorAnnotation IMPL;
29
	static {
30
		IMPL = (IEditorAnnotation)ImplementationLoader.newInstance(EditorAnnotationFacade.class) ;
31
	}
29 32
	
30
	/**
31
	 * <p>Constructor for NameViewer.</p>
32
	 *
33
	 * @param parent a {@link org.eclipse.swt.widgets.Composite} object.
34
	 */
35
	public EditorAnnotationFacade(EditorAnnotationFacade.EditorAnnotationType type, Integer line, String text) throws OperationNotSupportedException {
36

  
37
		IMPL = (IEditorAnnotation)ImplementationLoader.newInstance(EditorAnnotationFacade.class, type, line, text);
33
	protected EditorAnnotationFacade() {
34
		super();
38 35
	}
39 36
	
37
	public static IEditorAnnotation getInstance (EditorAnnotationFacade.EditorAnnotationType type, Integer line, String text) throws OperationNotSupportedException {
38
		return (IEditorAnnotation)IMPL.getInstanceInternal(type, line, text);
39
	}
40

  
41
	public abstract Object getInstanceInternal(EditorAnnotationFacade.EditorAnnotationType type, Integer line, String text) throws OperationNotSupportedException;
42

  
43
    public static IEditorAnnotation getInstance(int line, String text) throws OperationNotSupportedException {
44
		return (IEditorAnnotation)IMPL.getInstanceInternal(line, text);
45
    }
46

  
47
    public abstract Object getInstanceInternal(Integer line, String text) throws OperationNotSupportedException;
48

  
49
    public static IEditorAnnotation getInstance(ParserProblem problem) throws OperationNotSupportedException {
50
		return (IEditorAnnotation)IMPL.getInstanceInternal(problem);
51
    }
52

  
53
    public abstract Object getInstanceInternal(ParserProblem problem) throws OperationNotSupportedException;
54
    
55
    public static IEditorAnnotation getInstance(Object marker) throws OperationNotSupportedException {
56
		return (IEditorAnnotation)IMPL.getInstanceInternal(marker);
57
    }
58

  
59
    public abstract Object getInstanceInternal(Object marker) throws OperationNotSupportedException;
60

  
61

  
62

  
63
	
64
	
40 65
    public enum EditorAnnotationType{
41 66
    	WARNING(ImageResources.WARNING_ANNOTATION_ICON, 244, 200, 45),
42 67
    	ERROR(ImageResources.ERROR_ANNOTATION_ICON, 255, 0, 0);
......
64 89
		}
65 90
    	
66 91
    }
67
    
68
//    // error identifiers, images and colors
69
//    /** Constant <code>ERROR_TYPE="editor.error.type"</code> */
70
//    public static String ERROR_TYPE = "editor.error.type";
71
//    /** Constant <code>ERROR_IMAGE</code> */
72
//    public static Image ERROR_IMAGE = ImageResources.getImage(ImageResources.ERROR_ANNOTATION_ICON);
73
//    /** Constant <code>ERROR_RGB</code> */
74
//    public static final RGB ERROR_RGB = new RGB(255, 0, 0);    
75
//    
76
//    /** Constant <code>WARNING_TYPE="editor.warning.type"</code> */
77
//    public static String WARNING_TYPE = "editor.warning.type";
78
//    /** Constant <code>WARNING_IMAGE</code> */
79
//    public static Image WARNING_IMAGE = ImageResources.getImage(ImageResources.WARNING_ANNOTATION_ICON);
80
//    /** Constant <code>WARNING_RGB</code> */
81
//    public static final RGB WARNING_RGB = new RGB(244, 200, 45); 
82
    
83
    
84
    public EditorAnnotationFacade(ParserProblem problem) throws OperationNotSupportedException {
85
    	this(EditorAnnotationType.getTypeByProblem(problem), 0, problem.getMessage());
86
    }
87
    
88
    
89
    /**
90
     * <p>Constructor for EditorAnnotation.</p>
91
     *
92
     * @param marker a org.eclipse.core.resources.IMarker object.
93
     * @throws OperationNotSupportedException 
94
     */
95
    public EditorAnnotationFacade(Object marker) throws OperationNotSupportedException {
96
    	IMPL.setMarker(marker);
97
    }
98

  
99
    /**
100
     * <p>Constructor for EditorAnnotation.</p>
101
     *
102
     * @param line a int.
103
     * @param text a {@link java.lang.String} object.
104
     * @throws OperationNotSupportedException 
105
     */
106
    public EditorAnnotationFacade(int line, String text) throws OperationNotSupportedException {
107
    	this(EditorAnnotationType.ERROR, line, text);
108
    }
109

  
110
    /**
111
     * <p>Getter for the field <code>marker</code>.</p>
112
     *
113
     * @return a org.eclipse.core.resources.IMarker object.
114
     * @throws OperationNotSupportedException 
115
     */
116
    public Object getMarker() throws OperationNotSupportedException {
117
        return IMPL.getMarker();
118
    }
119

  
120
    public void setMarker(Object marker) throws OperationNotSupportedException {
121
        IMPL.setMarker(marker);
122
    }
123

  
124
    /**
125
     * <p>Getter for the field <code>line</code>.</p>
126
     *
127
     * @return a int.
128
     * @throws OperationNotSupportedException 
129
     */
130
    public int getLine() throws OperationNotSupportedException {
131
        return IMPL.getLine();
132
    }
133

  
134
    /**
135
     * <p>Getter for the field <code>text</code>.</p>
136
     *
137
     * @return a {@link java.lang.String} object.
138
     * @throws OperationNotSupportedException 
139
     */
140
    @Override
141
	public String getText() throws OperationNotSupportedException {
142
    	return IMPL.getText();
143
    }
144

  
145
    /* (non-Javadoc)
146
	 * @see eu.etaxonomy.taxeditor.singlesource.editor.name.container.IEditorAnnotation#getLayer()
147
	 */
148
    @Override
149
	public int getLayer() throws OperationNotSupportedException {
150
        return IMPL.getLayer();
151
    }
152

  
153

  
154
    /**
155
     * <p>Getter for the field <code>position</code>.</p>
156
     *
157
     * @return a {@link org.eclipse.jface.text.Position} object.
158
     * @throws OperationNotSupportedException 
159
     */
160
    public Object getPosition() throws OperationNotSupportedException {
161
        return IMPL.getPosition();
162
    }
163

  
164
    /**
165
     * <p>Setter for the field <code>position</code>.</p>
166
     *
167
     * @param position a {@link org.eclipse.jface.text.Position} object.
168
     * @throws OperationNotSupportedException 
169
     */
170
    public void setPosition(Object position) throws OperationNotSupportedException {
171
        IMPL.setPosition(position);
172
    }
173

  
174
	
175
	/* (non-Javadoc)
176
	 * @see eu.etaxonomy.taxeditor.singlesource.editor.name.container.IEditorAnnotation#paint(org.eclipse.swt.graphics.GC, org.eclipse.swt.widgets.Canvas, org.eclipse.swt.graphics.Rectangle)
177
	 */
178
	@Override
179
	public void paint(GC gc, Canvas canvas, Rectangle bounds) throws OperationNotSupportedException {
180
		IMPL.paint(gc, canvas, bounds);
181
	}
182 92
}
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/singlesource/editor/name/container/IEditorAnnotation.java
6 6
import org.eclipse.swt.graphics.Rectangle;
7 7
import org.eclipse.swt.widgets.Canvas;
8 8

  
9
import eu.etaxonomy.cdm.strategy.parser.ParserProblem;
10

  
9 11
public interface IEditorAnnotation {
12
	
13
	public Object getInstanceInternal(EditorAnnotationFacade.EditorAnnotationType type, Integer line, String text) throws OperationNotSupportedException;
14

  
15
    public Object getInstanceInternal(ParserProblem problem) throws OperationNotSupportedException;
16
    
17
    public Object getInstanceInternal(Object marker) throws OperationNotSupportedException;
18

  
19
    public Object getInstanceInternal(Integer line, String text) throws OperationNotSupportedException;
20
	
10 21

  
11 22
    public Object getMarker() throws OperationNotSupportedException;
12 23

  
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/singlesource/org/eclipse/jface/text/IPosition.java
1 1
package eu.etaxonomy.taxeditor.singlesource.org.eclipse.jface.text;
2 2

  
3
import javax.naming.OperationNotSupportedException;
4

  
3 5
public interface IPosition {
6
	public abstract Object getInstanceInternal() throws OperationNotSupportedException;
7

  
8
	public abstract Object getInstanceInternal(Integer offset) throws OperationNotSupportedException;
9

  
10
	public abstract Object getInstanceInternal(Integer offset, Integer length) throws OperationNotSupportedException;
4 11

  
5 12
}
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/singlesource/org/eclipse/jface/text/PositionFacade.java
5 5

  
6 6
import javax.naming.OperationNotSupportedException;
7 7

  
8
import org.apache.log4j.Logger;
9

  
8 10
import eu.etaxonomy.taxeditor.singlesource.ImplementationLoader;
11
import eu.etaxonomy.taxeditor.singlesource.editor.key.polytomous.IPolytomousKeyListLabelProvider;
12
import eu.etaxonomy.taxeditor.singlesource.editor.key.polytomous.PolytomousKeyListLabelProviderFacade;
9 13

  
10 14
/**
11 15
 * @author lusu
12 16
 *
13 17
 */
14
public class PositionFacade implements IPosition {
15
	protected IPosition IMPL;
18
public abstract class PositionFacade implements IPosition {
19
	private static final Logger logger = Logger.getLogger(PositionFacade.class);
20
	
21
	private final static IPosition IMPL;
22
	static {
23
		IMPL = (IPosition)ImplementationLoader.newInstance(PositionFacade.class) ;
24
	}
16 25
	
17
	/**
18
	 * <p>Constructor for NameViewer.</p>
19
	 *
20
	 * @param parent a {@link org.eclipse.swt.widgets.Composite} object.
21
	 */
22
	public PositionFacade() throws OperationNotSupportedException {
23
		IMPL = (IPosition)ImplementationLoader.newInstance(PositionFacade.class);
26
	protected PositionFacade() {
24 27
	}
28
	
29
	public static IPosition getInstance () throws OperationNotSupportedException {
30
		return (IPosition)IMPL.getInstanceInternal();
31
	}
32

  
33
	public abstract Object getInstanceInternal();
25 34

  
26
	public PositionFacade(Integer offset) throws OperationNotSupportedException {
27
		IMPL = (IPosition)ImplementationLoader.newInstance(PositionFacade.class, offset);
35
	public static IPosition getInstance (Integer offset) throws OperationNotSupportedException {
36
		return (IPosition)IMPL.getInstanceInternal(offset);
28 37
	}
29 38

  
30
	public PositionFacade(Integer offset, Integer length) throws OperationNotSupportedException {
31
		IMPL = (IPosition)ImplementationLoader.newInstance(PositionFacade.class, offset, length);
39
	public abstract Object getInstanceInternal(Integer offset);
40

  
41
	public static IPosition getInstance (Integer offset, Integer length) throws OperationNotSupportedException {
42
		return (IPosition)IMPL.getInstanceInternal(offset, length);
32 43
	}
33 44

  
45
	public abstract Object getInstanceInternal(Integer offset, Integer length);
34 46
}

Also available in: Unified diff