Method: removePosition(Position)

1: /*
2: * #%~
3: * org.overture.ide.ui
4: * %%
5: * Copyright (C) 2008 - 2014 Overture
6: * %%
7: * This program is free software: you can redistribute it and/or modify
8: * it under the terms of the GNU General Public License as
9: * published by the Free Software Foundation, either version 3 of the
10: * License, or (at your option) any later version.
11: *
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: * GNU General Public License for more details.
16: *
17: * You should have received a copy of the GNU General Public
18: * License along with this program. If not, see
19: * <http://www.gnu.org/licenses/gpl-3.0.html>.
20: * #~%
21: */
22: package org.overture.ide.ui.editor.core;
23:
24: import java.util.Map;
25:
26: import org.eclipse.jface.text.BadLocationException;
27: import org.eclipse.jface.text.BadPositionCategoryException;
28: import org.eclipse.jface.text.Document;
29: import org.eclipse.jface.text.IDocument;
30: import org.eclipse.jface.text.Position;
31: import org.overture.ide.core.resources.IVdmProject;
32: import org.overture.ide.core.resources.IVdmSourceUnit;
33:
34: /**
35: * All the methods in this file has been synchronized due to a bug with Eclipse.<br>
36: * IDE edit of keywords causes exception #284
37: */
38: public class VdmDocument extends Document implements IDocument
39: {
40:         private IVdmSourceUnit source;
41:
42:         public IVdmProject getProject()
43:         {
44:                 if (source != null)
45:                 {
46:                         return source.getProject();
47:                 }
48:                 return null;
49:         }
50:
51:         public IVdmSourceUnit getSourceUnit()
52:         {
53:                 return this.source;
54:         }
55:
56:         public void setSourceUnit(IVdmSourceUnit source)
57:         {
58:                 this.source = source;
59:         }
60:
61:         @SuppressWarnings("rawtypes")
62:         @Override
63:         protected synchronized Map getDocumentManagedPositions()
64:         {
65:                 return super.getDocumentManagedPositions();
66:         }
67:
68:         @Override
69:         public synchronized void addPosition(String category, Position position)
70:                         throws BadLocationException, BadPositionCategoryException
71:         {
72:                 super.addPosition(category, position);
73:         }
74:
75:         public synchronized void addPositionCategory(String category)
76:         {
77:                 super.addPositionCategory(category);
78:         }
79:
80:         @Override
81:         public synchronized boolean containsPosition(String category, int offset,
82:                         int length)
83:         {
84:                 return super.containsPosition(category, offset, length);
85:         }
86:
87:         @Override
88:         public synchronized boolean containsPositionCategory(String category)
89:         {
90:                 return super.containsPositionCategory(category);
91:         }
92:
93:         @Override
94:         public synchronized int computeIndexInCategory(String category, int offset)
95:                         throws BadLocationException, BadPositionCategoryException
96:         {
97:                 return super.computeIndexInCategory(category, offset);
98:         }
99:
100:         @Override
101:         public synchronized Position[] getPositions(String category)
102:                         throws BadPositionCategoryException
103:         {
104:                 return super.getPositions(category);
105:         }
106:
107:         @Override
108:         public synchronized String[] getPositionCategories()
109:         {
110:                 return super.getPositionCategories();
111:         }
112:
113:         @Override
114:         public synchronized void removePosition(Position position)
115:         {
116:                 super.removePosition(position);
117:         }
118:
119:         @Override
120:         public synchronized void removePosition(String category, Position position)
121:                         throws BadPositionCategoryException
122:         {
123:                 super.removePosition(category, position);
124:         }
125:
126:         @Override
127:         public synchronized void removePositionCategory(String category)
128:                         throws BadPositionCategoryException
129:         {
130:                 super.removePositionCategory(category);
131:         }
132:
133:         @Override
134:         protected synchronized void completeInitialization()
135:         {
136:                 super.completeInitialization();
137:         }
138:
139:         public synchronized void addPosition(Position position)
140:                         throws BadLocationException
141:         {
142:                 super.addPosition(position);
143:         }
144:
145:         public synchronized Position[] getPositions(String category, int offset,
146:                         int length, boolean canStartBefore, boolean canEndAfter)
147:                         throws BadPositionCategoryException
148:         {
149:                 return super.getPositions(category, offset, length, canStartBefore, canEndAfter);
150:         }
151:
152: }