Java Code Examples for org.eclipse.jface.text.source.SourceViewerConfiguration#getConfiguredDocumentPartitioning()
The following examples show how to use
org.eclipse.jface.text.source.SourceViewerConfiguration#getConfiguredDocumentPartitioning() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ToggleSLCommentAction.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
public void configure(ISourceViewer sourceViewer, SourceViewerConfiguration configuration) { fPrefixesMap= null; String[] types= configuration.getConfiguredContentTypes(sourceViewer); Map<String, String[]> prefixesMap= new HashMap<String, String[]>(types.length); for (int i= 0; i < types.length; i++) { String type= types[i]; String[] prefixes= configuration.getDefaultPrefixes(sourceViewer, type); if (prefixes != null && prefixes.length > 0) { int emptyPrefixes= 0; for (int j= 0; j < prefixes.length; j++) if (prefixes[j].length() == 0) emptyPrefixes++; if (emptyPrefixes > 0) { String[] nonemptyPrefixes= new String[prefixes.length - emptyPrefixes]; for (int j= 0, k= 0; j < prefixes.length; j++) { String prefix= prefixes[j]; if (prefix.length() != 0) { nonemptyPrefixes[k]= prefix; k++; } } prefixes= nonemptyPrefixes; } prefixesMap.put(type, prefixes); } } fDocumentPartitioning= configuration.getConfiguredDocumentPartitioning(sourceViewer); fPrefixesMap= prefixesMap; }
Example 2
Source File: ToggleCommentAction.java From tlaplus with MIT License | 5 votes |
/** * Configures the action * @param sourceViewer * @param configuration */ public void configure(ISourceViewer sourceViewer, SourceViewerConfiguration configuration) { fPrefixesMap = null; String[] types = configuration.getConfiguredContentTypes(sourceViewer); Map prefixesMap = new HashMap(types.length); for (int i = 0; i < types.length; i++) { String type = types[i]; String[] prefixes = configuration.getDefaultPrefixes(sourceViewer, type); if (prefixes != null && prefixes.length > 0) { int emptyPrefixes = 0; for (int j = 0; j < prefixes.length; j++) if (prefixes[j].length() == 0) emptyPrefixes++; if (emptyPrefixes > 0) { String[] nonemptyPrefixes = new String[prefixes.length - emptyPrefixes]; for (int j = 0, k = 0; j < prefixes.length; j++) { String prefix = prefixes[j]; if (prefix.length() != 0) { nonemptyPrefixes[k] = prefix; k++; } } prefixes = nonemptyPrefixes; } prefixesMap.put(type, prefixes); } } fDocumentPartitioning = configuration.getConfiguredDocumentPartitioning(sourceViewer); fPrefixesMap = prefixesMap; }
Example 3
Source File: ToggleCommentAction.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public void configure(ISourceViewer sourceViewer, SourceViewerConfiguration configuration) { fPrefixesMap= null; String[] types= configuration.getConfiguredContentTypes(sourceViewer); Map<String, String[]> prefixesMap= new HashMap<String, String[]>(types.length); for (int i= 0; i < types.length; i++) { String type= types[i]; String[] prefixes= configuration.getDefaultPrefixes(sourceViewer, type); if (prefixes != null && prefixes.length > 0) { int emptyPrefixes= 0; for (int j= 0; j < prefixes.length; j++) if (prefixes[j].length() == 0) emptyPrefixes++; if (emptyPrefixes > 0) { String[] nonemptyPrefixes= new String[prefixes.length - emptyPrefixes]; for (int j= 0, k= 0; j < prefixes.length; j++) { String prefix= prefixes[j]; if (prefix.length() != 0) { nonemptyPrefixes[k]= prefix; k++; } } prefixes= nonemptyPrefixes; } prefixesMap.put(type, prefixes); } } fDocumentPartitioning= configuration.getConfiguredDocumentPartitioning(sourceViewer); fPrefixesMap= prefixesMap; }
Example 4
Source File: ToggleCommentAction.java From goclipse with Eclipse Public License 1.0 | 5 votes |
public void configure(ISourceViewer sourceViewer, SourceViewerConfiguration configuration) { fPrefixesMap= null; String[] types= configuration.getConfiguredContentTypes(sourceViewer); Map<String, String[]> prefixesMap= new HashMap<String, String[]>(types.length); for (int i= 0; i < types.length; i++) { String type= types[i]; String[] prefixes= configuration.getDefaultPrefixes(sourceViewer, type); if (prefixes != null && prefixes.length > 0) { int emptyPrefixes= 0; for (int j= 0; j < prefixes.length; j++) if (prefixes[j].length() == 0) emptyPrefixes++; if (emptyPrefixes > 0) { String[] nonemptyPrefixes= new String[prefixes.length - emptyPrefixes]; for (int j= 0, k= 0; j < prefixes.length; j++) { String prefix= prefixes[j]; if (prefix.length() != 0) { nonemptyPrefixes[k]= prefix; k++; } } prefixes= nonemptyPrefixes; } prefixesMap.put(type, prefixes); } } fDocumentPartitioning= configuration.getConfiguredDocumentPartitioning(sourceViewer); fPrefixesMap= prefixesMap; }