|
Lines 106-112
Link Here
|
| 106 |
} |
106 |
} |
| 107 |
} |
107 |
} |
| 108 |
} |
108 |
} |
| 109 |
|
109 |
|
| 110 |
/** |
110 |
/** |
| 111 |
* A private delegate class to move INodeSelectionListener and |
111 |
* A private delegate class to move INodeSelectionListener and |
| 112 |
* IDoubleClickListener off of the viewer's APIs |
112 |
* IDoubleClickListener off of the viewer's APIs |
|
Lines 118-124
Link Here
|
| 118 |
|
118 |
|
| 119 |
public void nodeSelectionChanged(NodeSelectionChangedEvent event) { |
119 |
public void nodeSelectionChanged(NodeSelectionChangedEvent event) { |
| 120 |
handleNodeSelectionChanged(event); |
120 |
handleNodeSelectionChanged(event); |
| 121 |
} |
121 |
} |
| 122 |
} |
122 |
} |
| 123 |
|
123 |
|
| 124 |
/** Text operation codes */ |
124 |
/** Text operation codes */ |
|
Lines 140-148
Link Here
|
| 140 |
protected IContentAssistant fCorrectionAssistant; |
140 |
protected IContentAssistant fCorrectionAssistant; |
| 141 |
protected boolean fCorrectionAssistantInstalled; |
141 |
protected boolean fCorrectionAssistantInstalled; |
| 142 |
private IDocumentAdapter fDocAdapter; |
142 |
private IDocumentAdapter fDocAdapter; |
| 143 |
|
143 |
|
| 144 |
private InternalSelectionListener fSelectionListener = null; |
144 |
private InternalSelectionListener fSelectionListener = null; |
| 145 |
|
145 |
|
| 146 |
/** |
146 |
/** |
| 147 |
* TODO Temporary workaround for BUG44665 |
147 |
* TODO Temporary workaround for BUG44665 |
| 148 |
*/ |
148 |
*/ |
|
Lines 159-164
Link Here
|
| 159 |
private TextVerifyListener fVerifyListener = new TextVerifyListener(); |
159 |
private TextVerifyListener fVerifyListener = new TextVerifyListener(); |
| 160 |
|
160 |
|
| 161 |
private ViewerSelectionManager fViewerSelectionManager; |
161 |
private ViewerSelectionManager fViewerSelectionManager; |
|
|
162 |
private SourceViewerConfiguration fConfiguration; |
| 162 |
|
163 |
|
| 163 |
/** |
164 |
/** |
| 164 |
* @see org.eclipse.jface.text.source.SourceViewer#SourceViewer(Composite, |
165 |
* @see org.eclipse.jface.text.source.SourceViewer#SourceViewer(Composite, |
|
Lines 216-224
Link Here
|
| 216 |
} |
217 |
} |
| 217 |
|
218 |
|
| 218 |
/** |
219 |
/** |
| 219 |
* Should be identical to superclass version. Also, we get the tab width |
220 |
* Should be identical to superclass version. Plus, we get our own special |
| 220 |
* from the preference manager. Plus, we get our own special Highlighter. |
221 |
* Highlighter. Plus we uninstall before installing. |
| 221 |
* Plus we uninstall before installing. |
|
|
| 222 |
*/ |
222 |
*/ |
| 223 |
public void configure(SourceViewerConfiguration configuration) { |
223 |
public void configure(SourceViewerConfiguration configuration) { |
| 224 |
|
224 |
|
|
Lines 348-365
Link Here
|
| 348 |
String[] prefixes = configuration.getIndentPrefixes(this, t); |
348 |
String[] prefixes = configuration.getIndentPrefixes(this, t); |
| 349 |
if (prefixes != null && prefixes.length > 0) |
349 |
if (prefixes != null && prefixes.length > 0) |
| 350 |
setIndentPrefixes(prefixes, t); |
350 |
setIndentPrefixes(prefixes, t); |
| 351 |
// removed 'defaultPrefix' for Eclipse V2 replaced with |
351 |
|
| 352 |
// defaultPrefixes |
|
|
| 353 |
/* |
| 354 |
* String prefix = configuration.getDefaultPrefix(this, t); if |
| 355 |
* (prefix != null && prefix.length() > 0) |
| 356 |
* setDefaultPrefix(prefix, t); |
| 357 |
*/ |
| 358 |
prefixes = configuration.getDefaultPrefixes(this, t); |
352 |
prefixes = configuration.getDefaultPrefixes(this, t); |
| 359 |
if (prefixes != null && prefixes.length > 0) |
353 |
if (prefixes != null && prefixes.length > 0) |
| 360 |
setDefaultPrefixes(prefixes, t); |
354 |
setDefaultPrefixes(prefixes, t); |
| 361 |
} |
355 |
} |
| 362 |
activatePlugins(); |
356 |
activatePlugins(); |
|
|
357 |
|
| 358 |
fConfiguration = configuration; |
| 363 |
} |
359 |
} |
| 364 |
|
360 |
|
| 365 |
/** |
361 |
/** |
|
Lines 518-523
Link Here
|
| 518 |
break; |
514 |
break; |
| 519 |
case SHIFT_RIGHT : |
515 |
case SHIFT_RIGHT : |
| 520 |
beginRecording(TEXT_SHIFT_RIGHT, TEXT_SHIFT_RIGHT, cursorPosition, selectionLength); |
516 |
beginRecording(TEXT_SHIFT_RIGHT, TEXT_SHIFT_RIGHT, cursorPosition, selectionLength); |
|
|
517 |
updateIndentationPrefixes(); |
| 521 |
super.doOperation(SHIFT_RIGHT); |
518 |
super.doOperation(SHIFT_RIGHT); |
| 522 |
selection = getTextWidget().getSelection(); |
519 |
selection = getTextWidget().getSelection(); |
| 523 |
cursorPosition = selection.x; |
520 |
cursorPosition = selection.x; |
|
Lines 526-531
Link Here
|
| 526 |
break; |
523 |
break; |
| 527 |
case SHIFT_LEFT : |
524 |
case SHIFT_LEFT : |
| 528 |
beginRecording(TEXT_SHIFT_LEFT, TEXT_SHIFT_LEFT, cursorPosition, selectionLength); |
525 |
beginRecording(TEXT_SHIFT_LEFT, TEXT_SHIFT_LEFT, cursorPosition, selectionLength); |
|
|
526 |
updateIndentationPrefixes(); |
| 529 |
super.doOperation(SHIFT_LEFT); |
527 |
super.doOperation(SHIFT_LEFT); |
| 530 |
selection = getTextWidget().getSelection(); |
528 |
selection = getTextWidget().getSelection(); |
| 531 |
cursorPosition = selection.x; |
529 |
cursorPosition = selection.x; |
|
Lines 560-566
Link Here
|
| 560 |
try { |
558 |
try { |
| 561 |
// begin recording |
559 |
// begin recording |
| 562 |
beginRecording(FORMAT_ACTIVE_ELEMENTS_TEXT, FORMAT_ACTIVE_ELEMENTS_TEXT, cursorPosition, selectionLength); |
560 |
beginRecording(FORMAT_ACTIVE_ELEMENTS_TEXT, FORMAT_ACTIVE_ELEMENTS_TEXT, cursorPosition, selectionLength); |
| 563 |
|
561 |
|
| 564 |
// format |
562 |
// format |
| 565 |
Point s = getSelectedRange(); |
563 |
Point s = getSelectedRange(); |
| 566 |
IRegion region = new Region(s.x, s.y); |
564 |
IRegion region = new Region(s.x, s.y); |
|
Lines 1066-1103
Link Here
|
| 1066 |
* Uninstalls anything that was installed by configure |
1064 |
* Uninstalls anything that was installed by configure |
| 1067 |
*/ |
1065 |
*/ |
| 1068 |
public void unconfigure() { |
1066 |
public void unconfigure() { |
| 1069 |
|
|
|
| 1070 |
Logger.trace("Source Editor", "StructuredTextViewer::unconfigure entry"); //$NON-NLS-1$ //$NON-NLS-2$ |
1067 |
Logger.trace("Source Editor", "StructuredTextViewer::unconfigure entry"); //$NON-NLS-1$ //$NON-NLS-2$ |
| 1071 |
if (fHighlighter != null) { |
1068 |
if (fHighlighter != null) { |
| 1072 |
fHighlighter.uninstall(); |
1069 |
fHighlighter.uninstall(); |
| 1073 |
} |
1070 |
} |
| 1074 |
|
1071 |
|
| 1075 |
// presentationreconciler, reconciler, contentassist, infopresenter |
|
|
| 1076 |
// are all unconfigured in superclass so think about removing from |
| 1077 |
// here |
| 1078 |
if (fPresentationReconciler != null) { |
| 1079 |
fPresentationReconciler.uninstall(); |
| 1080 |
fPresentationReconciler = null; |
| 1081 |
} |
| 1082 |
if (fReconciler != null) { |
| 1083 |
fReconciler.uninstall(); |
| 1084 |
fReconciler = null; |
| 1085 |
} |
| 1086 |
if (fContentAssistant != null) { |
| 1087 |
fContentAssistant.uninstall(); |
| 1088 |
fContentAssistantInstalled = false; |
| 1089 |
} |
| 1090 |
if (fInformationPresenter != null) |
| 1091 |
fInformationPresenter.uninstall(); |
| 1092 |
|
| 1093 |
setHyperlinkDetectors(null, SWT.NONE); |
| 1094 |
|
| 1095 |
// doesn't seem to be handled elsewhere, so we'll be sure error |
1072 |
// doesn't seem to be handled elsewhere, so we'll be sure error |
| 1096 |
// messages's are cleared. |
1073 |
// messages's are cleared. |
| 1097 |
setErrorMessage(null); |
1074 |
setErrorMessage(null); |
| 1098 |
|
1075 |
|
| 1099 |
// unconfigure recently added to super class?! |
|
|
| 1100 |
super.unconfigure(); |
1076 |
super.unconfigure(); |
|
|
1077 |
fConfiguration = null; |
| 1101 |
Logger.trace("Source Editor", "StructuredTextViewer::unconfigure exit"); //$NON-NLS-1$ //$NON-NLS-2$ |
1078 |
Logger.trace("Source Editor", "StructuredTextViewer::unconfigure exit"); //$NON-NLS-1$ //$NON-NLS-2$ |
| 1102 |
} |
1079 |
} |
| 1103 |
|
1080 |
|
|
Lines 1116-1119
Link Here
|
| 1116 |
if (event.getRequester() != null && event.getRequester().equals(this) && event.getDocument().equals(getDocument())) |
1093 |
if (event.getRequester() != null && event.getRequester().equals(this) && event.getDocument().equals(getDocument())) |
| 1117 |
setSelectedRange(event.getOffset(), event.getLength()); |
1094 |
setSelectedRange(event.getOffset(), event.getLength()); |
| 1118 |
} |
1095 |
} |
|
|
1096 |
|
| 1097 |
/** |
| 1098 |
* Make sure indentation is correct before using. |
| 1099 |
*/ |
| 1100 |
private void updateIndentationPrefixes() { |
| 1101 |
SourceViewerConfiguration configuration = fConfiguration; |
| 1102 |
if (fConfiguration != null) { |
| 1103 |
String[] types = configuration.getConfiguredContentTypes(this); |
| 1104 |
for (int i = 0; i < types.length; i++) { |
| 1105 |
String[] prefixes = configuration.getIndentPrefixes(this, types[i]); |
| 1106 |
if (prefixes != null && prefixes.length > 0) |
| 1107 |
setIndentPrefixes(prefixes, types[i]); |
| 1108 |
} |
| 1109 |
} |
| 1110 |
} |
| 1119 |
} |
1111 |
} |