Lines 11-22
Link Here
|
11 |
* Anton Leherbauer (Wind River Systems) |
11 |
* Anton Leherbauer (Wind River Systems) |
12 |
* Sergey Prigogin (Google) |
12 |
* Sergey Prigogin (Google) |
13 |
* Markus Schorn (Wind River Systems) |
13 |
* Markus Schorn (Wind River Systems) |
|
|
14 |
* Andrew Ferguson (Symbian) |
14 |
*******************************************************************************/ |
15 |
*******************************************************************************/ |
15 |
package org.eclipse.cdt.internal.ui.text; |
16 |
package org.eclipse.cdt.internal.ui.text; |
16 |
|
17 |
|
17 |
import java.util.Arrays; |
18 |
import java.util.Arrays; |
18 |
|
19 |
|
19 |
import org.eclipse.core.resources.IFile; |
20 |
import org.eclipse.core.resources.IFile; |
|
|
21 |
import org.eclipse.core.resources.IProject; |
22 |
import org.eclipse.core.resources.IResource; |
20 |
import org.eclipse.core.runtime.CoreException; |
23 |
import org.eclipse.core.runtime.CoreException; |
21 |
import org.eclipse.core.runtime.IPath; |
24 |
import org.eclipse.core.runtime.IPath; |
22 |
import org.eclipse.core.runtime.NullProgressMonitor; |
25 |
import org.eclipse.core.runtime.NullProgressMonitor; |
Lines 77-82
Link Here
|
77 |
import org.eclipse.cdt.ui.CUIPlugin; |
80 |
import org.eclipse.cdt.ui.CUIPlugin; |
78 |
import org.eclipse.cdt.ui.ILanguageUI; |
81 |
import org.eclipse.cdt.ui.ILanguageUI; |
79 |
import org.eclipse.cdt.ui.text.ICPartitions; |
82 |
import org.eclipse.cdt.ui.text.ICPartitions; |
|
|
83 |
import org.eclipse.cdt.ui.text.ICTokenScanner; |
84 |
import org.eclipse.cdt.ui.text.ITokenStore; |
85 |
import org.eclipse.cdt.ui.text.ITokenStoreFactory; |
86 |
import org.eclipse.cdt.ui.text.doctools.DefaultMultilineCommentAutoEditStrategy; |
87 |
import org.eclipse.cdt.ui.text.doctools.IDocCommentOwner; |
88 |
import org.eclipse.cdt.ui.text.doctools.IDocCommentViewerConfiguration; |
80 |
|
89 |
|
81 |
import org.eclipse.cdt.internal.corext.util.CodeFormatterUtil; |
90 |
import org.eclipse.cdt.internal.corext.util.CodeFormatterUtil; |
82 |
|
91 |
|
Lines 90-95
Link Here
|
90 |
import org.eclipse.cdt.internal.ui.text.contentassist.CContentAssistProcessor; |
99 |
import org.eclipse.cdt.internal.ui.text.contentassist.CContentAssistProcessor; |
91 |
import org.eclipse.cdt.internal.ui.text.contentassist.ContentAssistPreference; |
100 |
import org.eclipse.cdt.internal.ui.text.contentassist.ContentAssistPreference; |
92 |
import org.eclipse.cdt.internal.ui.text.correction.CCorrectionAssistant; |
101 |
import org.eclipse.cdt.internal.ui.text.correction.CCorrectionAssistant; |
|
|
102 |
import org.eclipse.cdt.internal.ui.text.doctools.DocCommentOwnerManager; |
93 |
import org.eclipse.cdt.internal.ui.typehierarchy.THInformationControl; |
103 |
import org.eclipse.cdt.internal.ui.typehierarchy.THInformationControl; |
94 |
import org.eclipse.cdt.internal.ui.typehierarchy.THInformationProvider; |
104 |
import org.eclipse.cdt.internal.ui.typehierarchy.THInformationProvider; |
95 |
|
105 |
|
Lines 111-121
Link Here
|
111 |
/** |
121 |
/** |
112 |
* The C multi-line comment scanner. |
122 |
* The C multi-line comment scanner. |
113 |
*/ |
123 |
*/ |
114 |
private AbstractCScanner fMultilineCommentScanner; |
124 |
private ICTokenScanner fMultilineDocCommentScanner; |
115 |
/** |
125 |
/** |
116 |
* The C single-line comment scanner. |
126 |
* The C single-line comment scanner. |
117 |
*/ |
127 |
*/ |
118 |
private AbstractCScanner fSinglelineCommentScanner; |
128 |
private ICTokenScanner fSinglelineDocCommentScanner; |
119 |
/** |
129 |
/** |
120 |
* The C string scanner. |
130 |
* The C string scanner. |
121 |
*/ |
131 |
*/ |
Lines 147-170
Link Here
|
147 |
} |
157 |
} |
148 |
|
158 |
|
149 |
/** |
159 |
/** |
150 |
* Returns the C multi-line comment scanner for this configuration. |
|
|
151 |
* |
152 |
* @return the C multi-line comment scanner |
153 |
*/ |
154 |
protected RuleBasedScanner getMultilineCommentScanner() { |
155 |
return fMultilineCommentScanner; |
156 |
} |
157 |
|
158 |
/** |
159 |
* Returns the C single-line comment scanner for this configuration. |
160 |
* |
161 |
* @return the C single-line comment scanner |
162 |
*/ |
163 |
protected RuleBasedScanner getSinglelineCommentScanner() { |
164 |
return fSinglelineCommentScanner; |
165 |
} |
166 |
|
167 |
/** |
168 |
* Returns the C string scanner for this configuration. |
160 |
* Returns the C string scanner for this configuration. |
169 |
* |
161 |
* |
170 |
* @return the C string scanner |
162 |
* @return the C string scanner |
Lines 184-193
Link Here
|
184 |
} |
176 |
} |
185 |
AbstractCScanner scanner= null; |
177 |
AbstractCScanner scanner= null; |
186 |
if (language instanceof ICLanguageKeywords) { |
178 |
if (language instanceof ICLanguageKeywords) { |
187 |
scanner= new CPreprocessorScanner(getColorManager(), fPreferenceStore, (ICLanguageKeywords)language); |
179 |
scanner= new CPreprocessorScanner(getTokenStoreFactory(), (ICLanguageKeywords)language); |
188 |
} |
180 |
} |
189 |
if (scanner == null) { |
181 |
if (scanner == null) { |
190 |
scanner= new CPreprocessorScanner(getColorManager(), fPreferenceStore, GPPLanguage.getDefault()); |
182 |
scanner= new CPreprocessorScanner(getTokenStoreFactory(), GPPLanguage.getDefault()); |
191 |
} |
183 |
} |
192 |
fPreprocessorScanner= scanner; |
184 |
fPreprocessorScanner= scanner; |
193 |
return fPreprocessorScanner; |
185 |
return fPreprocessorScanner; |
Lines 250-263
Link Here
|
250 |
presenter.setSizeConstraints(50, 20, true, false); |
242 |
presenter.setSizeConstraints(50, 20, true, false); |
251 |
return presenter; |
243 |
return presenter; |
252 |
} |
244 |
} |
253 |
|
245 |
|
254 |
/** |
246 |
/** |
255 |
* Initializes the scanners. |
247 |
* Initializes the scanners. |
256 |
*/ |
248 |
*/ |
257 |
private void initializeScanners() { |
249 |
private void initializeScanners() { |
258 |
fMultilineCommentScanner= new CCommentScanner(getColorManager(), fPreferenceStore, ICColorConstants.C_MULTI_LINE_COMMENT); |
250 |
fStringScanner= new SingleTokenCScanner(getTokenStoreFactory(), ICColorConstants.C_STRING); |
259 |
fSinglelineCommentScanner= new CCommentScanner(getColorManager(), fPreferenceStore, ICColorConstants.C_SINGLE_LINE_COMMENT); |
|
|
260 |
fStringScanner= new SingleTokenCScanner(getColorManager(), fPreferenceStore, ICColorConstants.C_STRING); |
261 |
} |
251 |
} |
262 |
|
252 |
|
263 |
/** |
253 |
/** |
Lines 274-290
Link Here
|
274 |
|
264 |
|
275 |
reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE); |
265 |
reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE); |
276 |
reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE); |
266 |
reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE); |
277 |
|
|
|
278 |
//TextAttribute attr = new TextAttribute(manager.getColor(ICColorConstants.C_DEFAULT)); |
279 |
|
267 |
|
280 |
dr= new DefaultDamagerRepairer(getSinglelineCommentScanner()); |
268 |
dr= new DefaultDamagerRepairer(new CCommentScanner(getTokenStoreFactory(), ICColorConstants.C_SINGLE_LINE_COMMENT)); |
281 |
reconciler.setDamager(dr, ICPartitions.C_SINGLE_LINE_COMMENT); |
269 |
reconciler.setDamager(dr, ICPartitions.C_SINGLE_LINE_COMMENT); |
282 |
reconciler.setRepairer(dr, ICPartitions.C_SINGLE_LINE_COMMENT); |
270 |
reconciler.setRepairer(dr, ICPartitions.C_SINGLE_LINE_COMMENT); |
283 |
|
271 |
|
284 |
dr= new DefaultDamagerRepairer(getMultilineCommentScanner()); |
272 |
dr= new DefaultDamagerRepairer(new CCommentScanner(getTokenStoreFactory(), ICColorConstants.C_MULTI_LINE_COMMENT)); |
285 |
reconciler.setDamager(dr, ICPartitions.C_MULTI_LINE_COMMENT); |
273 |
reconciler.setDamager(dr, ICPartitions.C_MULTI_LINE_COMMENT); |
286 |
reconciler.setRepairer(dr, ICPartitions.C_MULTI_LINE_COMMENT); |
274 |
reconciler.setRepairer(dr, ICPartitions.C_MULTI_LINE_COMMENT); |
287 |
|
275 |
|
|
|
276 |
ICTokenScanner docCommentSingleScanner= getSinglelineDocCommentScanner(getProject()); |
277 |
if(docCommentSingleScanner!=null) { |
278 |
dr= new DefaultDamagerRepairer(docCommentSingleScanner); |
279 |
reconciler.setDamager(dr, ICPartitions.C_SINGLE_LINE_DOC_COMMENT); |
280 |
reconciler.setRepairer(dr, ICPartitions.C_SINGLE_LINE_DOC_COMMENT); |
281 |
} |
282 |
|
283 |
ICTokenScanner docCommentMultiScanner= getMultilineDocCommentScanner(getProject()); |
284 |
if(docCommentMultiScanner!=null) { |
285 |
dr= new DefaultDamagerRepairer(docCommentMultiScanner); |
286 |
reconciler.setDamager(dr, ICPartitions.C_MULTI_LINE_DOC_COMMENT); |
287 |
reconciler.setRepairer(dr, ICPartitions.C_MULTI_LINE_DOC_COMMENT); |
288 |
} |
289 |
|
288 |
dr= new DefaultDamagerRepairer(getStringScanner()); |
290 |
dr= new DefaultDamagerRepairer(getStringScanner()); |
289 |
reconciler.setDamager(dr, ICPartitions.C_STRING); |
291 |
reconciler.setDamager(dr, ICPartitions.C_STRING); |
290 |
reconciler.setRepairer(dr, ICPartitions.C_STRING); |
292 |
reconciler.setRepairer(dr, ICPartitions.C_STRING); |
Lines 299-306
Link Here
|
299 |
|
301 |
|
300 |
return reconciler; |
302 |
return reconciler; |
301 |
} |
303 |
} |
|
|
304 |
|
305 |
/** |
306 |
* Returns the C multi-line comment scanner for this configuration. |
307 |
* |
308 |
* @return the C multi-line comment scanner |
309 |
*/ |
310 |
protected ICTokenScanner getMultilineDocCommentScanner(IResource resource) { |
311 |
if (fMultilineDocCommentScanner == null) { |
312 |
IDocCommentViewerConfiguration owner= DocCommentOwnerManager.getInstance().getCommentOwner(resource).getMultilineConfiguration(); |
313 |
fMultilineDocCommentScanner= owner.createCommentScanner(getTokenStoreFactory()); |
314 |
} |
315 |
return fMultilineDocCommentScanner; |
316 |
} |
302 |
|
317 |
|
303 |
/** |
318 |
/** |
|
|
319 |
* Returns the C single-line comment scanner for this configuration. |
320 |
* |
321 |
* @return the C single-line comment scanner |
322 |
*/ |
323 |
protected ICTokenScanner getSinglelineDocCommentScanner(IResource resource) { |
324 |
if (fSinglelineDocCommentScanner == null) { |
325 |
IDocCommentViewerConfiguration owner= DocCommentOwnerManager.getInstance().getCommentOwner(resource).getSinglelineConfiguration(); |
326 |
fSinglelineDocCommentScanner= owner.createCommentScanner(getTokenStoreFactory()); |
327 |
} |
328 |
return fSinglelineDocCommentScanner; |
329 |
} |
330 |
|
331 |
/** |
304 |
* @return the code scanner for the given language |
332 |
* @return the code scanner for the given language |
305 |
*/ |
333 |
*/ |
306 |
protected RuleBasedScanner getCodeScanner(ILanguage language) { |
334 |
protected RuleBasedScanner getCodeScanner(ILanguage language) { |
Lines 310-323
Link Here
|
310 |
RuleBasedScanner scanner= null; |
338 |
RuleBasedScanner scanner= null; |
311 |
if (language instanceof ICLanguageKeywords) { |
339 |
if (language instanceof ICLanguageKeywords) { |
312 |
ICLanguageKeywords cLang= (ICLanguageKeywords)language; |
340 |
ICLanguageKeywords cLang= (ICLanguageKeywords)language; |
313 |
scanner = new CCodeScanner(getColorManager(), fPreferenceStore, cLang); |
341 |
scanner = new CCodeScanner(getTokenStoreFactory(), cLang); |
314 |
} else if (language != null) { |
342 |
} else if (language != null) { |
315 |
ILanguageUI languageUI = (ILanguageUI)language.getAdapter(ILanguageUI.class); |
343 |
ILanguageUI languageUI = (ILanguageUI)language.getAdapter(ILanguageUI.class); |
316 |
if (languageUI != null) |
344 |
if (languageUI != null) |
317 |
scanner = languageUI.getCodeScanner(); |
345 |
scanner = languageUI.getCodeScanner(); |
318 |
} |
346 |
} |
319 |
if (scanner == null) { |
347 |
if (scanner == null) { |
320 |
scanner = new CCodeScanner(getColorManager(), fPreferenceStore, GPPLanguage.getDefault()); |
348 |
scanner = new CCodeScanner(getTokenStoreFactory(), GPPLanguage.getDefault()); |
321 |
} |
349 |
} |
322 |
if (scanner instanceof AbstractCScanner) { |
350 |
if (scanner instanceof AbstractCScanner) { |
323 |
fCodeScanner= (AbstractCScanner)scanner; |
351 |
fCodeScanner= (AbstractCScanner)scanner; |
Lines 347-352
Link Here
|
347 |
processor = new CContentAssistProcessor(getEditor(), sourceViewer, assistant, ICPartitions.C_SINGLE_LINE_COMMENT); |
375 |
processor = new CContentAssistProcessor(getEditor(), sourceViewer, assistant, ICPartitions.C_SINGLE_LINE_COMMENT); |
348 |
assistant.setContentAssistProcessor(processor, ICPartitions.C_SINGLE_LINE_COMMENT); |
376 |
assistant.setContentAssistProcessor(processor, ICPartitions.C_SINGLE_LINE_COMMENT); |
349 |
|
377 |
|
|
|
378 |
processor = new CContentAssistProcessor(getEditor(), sourceViewer, assistant, ICPartitions.C_MULTI_LINE_DOC_COMMENT); |
379 |
assistant.setContentAssistProcessor(processor, ICPartitions.C_MULTI_LINE_DOC_COMMENT); |
380 |
|
381 |
processor = new CContentAssistProcessor(getEditor(), sourceViewer, assistant, ICPartitions.C_SINGLE_LINE_DOC_COMMENT); |
382 |
assistant.setContentAssistProcessor(processor, ICPartitions.C_SINGLE_LINE_DOC_COMMENT); |
383 |
|
350 |
processor = new CContentAssistProcessor(getEditor(), sourceViewer, assistant, ICPartitions.C_STRING); |
384 |
processor = new CContentAssistProcessor(getEditor(), sourceViewer, assistant, ICPartitions.C_STRING); |
351 |
assistant.setContentAssistProcessor(processor, ICPartitions.C_STRING); |
385 |
assistant.setContentAssistProcessor(processor, ICPartitions.C_STRING); |
352 |
|
386 |
|
Lines 410-435
Link Here
|
410 |
*/ |
444 |
*/ |
411 |
public IAutoEditStrategy[] getAutoEditStrategies(ISourceViewer sourceViewer, String contentType) { |
445 |
public IAutoEditStrategy[] getAutoEditStrategies(ISourceViewer sourceViewer, String contentType) { |
412 |
String partitioning= getConfiguredDocumentPartitioning(sourceViewer); |
446 |
String partitioning= getConfiguredDocumentPartitioning(sourceViewer); |
|
|
447 |
|
448 |
IDocCommentOwner owner= DocCommentOwnerManager.getInstance().getCommentOwner(getProject()); |
449 |
IAutoEditStrategy single= owner.getSinglelineConfiguration().createAutoEditStrategy(); |
450 |
IAutoEditStrategy multi= owner.getMultilineConfiguration().createAutoEditStrategy(); |
451 |
|
452 |
IAutoEditStrategy[] NONE= new IAutoEditStrategy[0]; |
453 |
|
413 |
if (ICPartitions.C_MULTI_LINE_COMMENT.equals(contentType)) |
454 |
if (ICPartitions.C_MULTI_LINE_COMMENT.equals(contentType)) |
414 |
return new IAutoEditStrategy[] { new CCommentAutoIndentStrategy() }; |
455 |
return new IAutoEditStrategy[] { new DefaultMultilineCommentAutoEditStrategy() }; |
|
|
456 |
if (ICPartitions.C_SINGLE_LINE_DOC_COMMENT.equals(contentType)) |
457 |
return single!=null ? new IAutoEditStrategy[] {single} : NONE; |
458 |
else if (ICPartitions.C_MULTI_LINE_DOC_COMMENT.equals(contentType)) |
459 |
return multi!=null? new IAutoEditStrategy[] {multi} : NONE; |
415 |
else if (ICPartitions.C_STRING.equals(contentType)) |
460 |
else if (ICPartitions.C_STRING.equals(contentType)) |
416 |
return new IAutoEditStrategy[] { /*new SmartSemicolonAutoEditStrategy(partitioning),*/ new CStringAutoIndentStrategy(partitioning, getProject()) }; |
461 |
return new IAutoEditStrategy[] { /*new SmartSemicolonAutoEditStrategy(partitioning),*/ new CStringAutoIndentStrategy(partitioning, getCProject()) }; |
417 |
else |
462 |
else |
418 |
return new IAutoEditStrategy[] { new CAutoIndentStrategy(partitioning, getProject()) }; |
463 |
return new IAutoEditStrategy[] { new CAutoIndentStrategy(partitioning, getCProject()) }; |
419 |
} |
464 |
} |
420 |
|
465 |
|
421 |
/** |
466 |
/** |
422 |
* @see SourceViewerConfiguration#getDoubleClickStrategy(ISourceViewer, String) |
467 |
* @see SourceViewerConfiguration#getDoubleClickStrategy(ISourceViewer, String) |
423 |
*/ |
468 |
*/ |
424 |
public ITextDoubleClickStrategy getDoubleClickStrategy(ISourceViewer sourceViewer, String contentType) { |
469 |
public ITextDoubleClickStrategy getDoubleClickStrategy(ISourceViewer sourceViewer, String contentType) { |
425 |
if (ICPartitions.C_MULTI_LINE_COMMENT.equals(contentType) || |
470 |
if (ICPartitions.C_MULTI_LINE_COMMENT.equals(contentType) || |
426 |
ICPartitions.C_SINGLE_LINE_COMMENT.equals(contentType)) |
471 |
ICPartitions.C_SINGLE_LINE_COMMENT.equals(contentType)) { |
427 |
return new DefaultTextDoubleClickStrategy(); |
472 |
return new DefaultTextDoubleClickStrategy(); |
428 |
else if (ICPartitions.C_STRING.equals(contentType) || |
473 |
} else if (ICPartitions.C_SINGLE_LINE_DOC_COMMENT.equals(contentType)) { |
429 |
ICPartitions.C_CHARACTER.equals(contentType)) |
474 |
IDocCommentOwner owner= DocCommentOwnerManager.getInstance().getCommentOwner(getProject()); |
|
|
475 |
ITextDoubleClickStrategy single= owner.getSinglelineConfiguration().createDoubleClickStrategy(); |
476 |
return single != null ? single : new DefaultTextDoubleClickStrategy(); |
477 |
} else if(ICPartitions.C_MULTI_LINE_DOC_COMMENT.equals(contentType)) { |
478 |
IDocCommentOwner owner= DocCommentOwnerManager.getInstance().getCommentOwner(getProject()); |
479 |
ITextDoubleClickStrategy multi= owner.getMultilineConfiguration().createDoubleClickStrategy(); |
480 |
return multi!=null ? multi : new DefaultTextDoubleClickStrategy(); |
481 |
} else if (ICPartitions.C_STRING.equals(contentType) || |
482 |
ICPartitions.C_CHARACTER.equals(contentType)) { |
430 |
return new CStringDoubleClickSelector(getConfiguredDocumentPartitioning(sourceViewer)); |
483 |
return new CStringDoubleClickSelector(getConfiguredDocumentPartitioning(sourceViewer)); |
431 |
else if (ICPartitions.C_PREPROCESSOR.equals(contentType)) |
484 |
} else if (ICPartitions.C_PREPROCESSOR.equals(contentType)) { |
432 |
return new CStringDoubleClickSelector(getConfiguredDocumentPartitioning(sourceViewer), new CDoubleClickSelector()); |
485 |
return new CStringDoubleClickSelector(getConfiguredDocumentPartitioning(sourceViewer), new CDoubleClickSelector()); |
|
|
486 |
} |
433 |
return new CDoubleClickSelector(); |
487 |
return new CDoubleClickSelector(); |
434 |
} |
488 |
} |
435 |
|
489 |
|
Lines 444-450
Link Here
|
444 |
* @see SourceViewerConfiguration#getIndentPrefixes(ISourceViewer, String) |
498 |
* @see SourceViewerConfiguration#getIndentPrefixes(ISourceViewer, String) |
445 |
*/ |
499 |
*/ |
446 |
public String[] getIndentPrefixes(ISourceViewer sourceViewer, String contentType) { |
500 |
public String[] getIndentPrefixes(ISourceViewer sourceViewer, String contentType) { |
447 |
ICProject project= getProject(); |
501 |
ICProject project= getCProject(); |
448 |
final int tabWidth= CodeFormatterUtil.getTabWidth(project); |
502 |
final int tabWidth= CodeFormatterUtil.getTabWidth(project); |
449 |
final int indentWidth= CodeFormatterUtil.getIndentWidth(project); |
503 |
final int indentWidth= CodeFormatterUtil.getIndentWidth(project); |
450 |
boolean allowTabs= tabWidth <= indentWidth; |
504 |
boolean allowTabs= tabWidth <= indentWidth; |
Lines 504-510
Link Here
|
504 |
return new String(spaceChars); |
558 |
return new String(spaceChars); |
505 |
} |
559 |
} |
506 |
|
560 |
|
507 |
private ICProject getProject() { |
561 |
/** |
|
|
562 |
* Returns the ICProject associated with this CSourceViewerConfiguration, or null if |
563 |
* no ICProject could be determined |
564 |
* @return |
565 |
*/ |
566 |
private ICProject getCProject() { |
508 |
ITextEditor editor= getEditor(); |
567 |
ITextEditor editor= getEditor(); |
509 |
if (editor == null) |
568 |
if (editor == null) |
510 |
return null; |
569 |
return null; |
Lines 527-533
Link Here
|
527 |
* @see SourceViewerConfiguration#getTabWidth(ISourceViewer) |
586 |
* @see SourceViewerConfiguration#getTabWidth(ISourceViewer) |
528 |
*/ |
587 |
*/ |
529 |
public int getTabWidth(ISourceViewer sourceViewer) { |
588 |
public int getTabWidth(ISourceViewer sourceViewer) { |
530 |
return CodeFormatterUtil.getTabWidth(getProject()); |
589 |
return CodeFormatterUtil.getTabWidth(getCProject()); |
531 |
} |
590 |
} |
532 |
|
591 |
|
533 |
/** |
592 |
/** |
Lines 603-609
Link Here
|
603 |
ICPartitions.C_SINGLE_LINE_COMMENT, |
662 |
ICPartitions.C_SINGLE_LINE_COMMENT, |
604 |
ICPartitions.C_STRING, |
663 |
ICPartitions.C_STRING, |
605 |
ICPartitions.C_CHARACTER, |
664 |
ICPartitions.C_CHARACTER, |
606 |
ICPartitions.C_PREPROCESSOR}; |
665 |
ICPartitions.C_PREPROCESSOR, |
|
|
666 |
ICPartitions.C_SINGLE_LINE_DOC_COMMENT, |
667 |
ICPartitions.C_MULTI_LINE_DOC_COMMENT |
668 |
}; |
607 |
} |
669 |
} |
608 |
|
670 |
|
609 |
/** |
671 |
/** |
Lines 620-627
Link Here
|
620 |
} |
682 |
} |
621 |
|
683 |
|
622 |
public boolean affectsBehavior(PropertyChangeEvent event) { |
684 |
public boolean affectsBehavior(PropertyChangeEvent event) { |
623 |
if (fMultilineCommentScanner.affectsBehavior(event) |
685 |
if ((fMultilineDocCommentScanner != null && fMultilineDocCommentScanner.affectsBehavior(event)) |
624 |
|| fSinglelineCommentScanner.affectsBehavior(event) |
686 |
|| (fSinglelineDocCommentScanner != null && fSinglelineDocCommentScanner.affectsBehavior(event)) |
625 |
|| fStringScanner.affectsBehavior(event)) { |
687 |
|| fStringScanner.affectsBehavior(event)) { |
626 |
return true; |
688 |
return true; |
627 |
} |
689 |
} |
Lines 714-723
Link Here
|
714 |
public void handlePropertyChangeEvent(PropertyChangeEvent event) { |
776 |
public void handlePropertyChangeEvent(PropertyChangeEvent event) { |
715 |
if (fCodeScanner != null && fCodeScanner.affectsBehavior(event)) |
777 |
if (fCodeScanner != null && fCodeScanner.affectsBehavior(event)) |
716 |
fCodeScanner.adaptToPreferenceChange(event); |
778 |
fCodeScanner.adaptToPreferenceChange(event); |
717 |
if (fMultilineCommentScanner.affectsBehavior(event)) |
779 |
if (fMultilineDocCommentScanner!=null && fMultilineDocCommentScanner.affectsBehavior(event)) |
718 |
fMultilineCommentScanner.adaptToPreferenceChange(event); |
780 |
fMultilineDocCommentScanner.adaptToPreferenceChange(event); |
719 |
if (fSinglelineCommentScanner.affectsBehavior(event)) |
781 |
if (fSinglelineDocCommentScanner!=null && fSinglelineDocCommentScanner.affectsBehavior(event)) |
720 |
fSinglelineCommentScanner.adaptToPreferenceChange(event); |
782 |
fSinglelineDocCommentScanner.adaptToPreferenceChange(event); |
721 |
if (fStringScanner.affectsBehavior(event)) |
783 |
if (fStringScanner.affectsBehavior(event)) |
722 |
fStringScanner.adaptToPreferenceChange(event); |
784 |
fStringScanner.adaptToPreferenceChange(event); |
723 |
if (fPreprocessorScanner != null && fPreprocessorScanner.affectsBehavior(event)) |
785 |
if (fPreprocessorScanner != null && fPreprocessorScanner.affectsBehavior(event)) |
Lines 833-841
Link Here
|
833 |
*/ |
895 |
*/ |
834 |
public void resetScanners() { |
896 |
public void resetScanners() { |
835 |
fCodeScanner= null; |
897 |
fCodeScanner= null; |
|
|
898 |
fMultilineDocCommentScanner= null; |
899 |
fSinglelineDocCommentScanner= null; |
836 |
fPreprocessorScanner= null; |
900 |
fPreprocessorScanner= null; |
837 |
} |
901 |
} |
838 |
|
902 |
|
839 |
/** |
903 |
/** |
840 |
* Creates macro exploration presenter. |
904 |
* Creates macro exploration presenter. |
841 |
* @param sourceViewer |
905 |
* @param sourceViewer |
Lines 873-878
Link Here
|
873 |
}; |
937 |
}; |
874 |
return conrolCreator; |
938 |
return conrolCreator; |
875 |
} |
939 |
} |
|
|
940 |
|
941 |
private IProject getProject() { |
942 |
ICProject cproject= getCProject(); |
943 |
if(cproject!=null) { |
944 |
return cproject.getProject(); |
945 |
} |
946 |
return null; |
947 |
} |
876 |
|
948 |
|
877 |
|
949 |
private ITokenStoreFactory getTokenStoreFactory() { |
878 |
} |
950 |
return new ITokenStoreFactory() { |
|
|
951 |
public ITokenStore createTokenStore(String[] propertyColorNames) { |
952 |
return new TokenStore(getColorManager(), fPreferenceStore, propertyColorNames); |
953 |
} |
954 |
}; |
955 |
} |
956 |
} |