org.eclipse.jface.text.contentassist.ContextInformation Java Examples
The following examples show how to use
org.eclipse.jface.text.contentassist.ContextInformation.
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: HContentAssistProcessor.java From http4e with Apache License 2.0 | 5 votes |
public IContextInformation[] computeContextInformation( ITextViewer viewer, int documentOffset){ // viewer.getSelectedRange(); // if (selectedRange.y > 0) Text is selected. Create a context information array. // ContextInformation[] contextInfos = new // ContextInformation[STYLELABELS.length]; // // Create one context information item for each style // for (int i = 0; i < STYLELABELS.length; i++) // contextInfos[i] = new ContextInformation("<" + STYLETAGS[i] + ">", // STYLELABELS[i] + " Style"); // return contextInfos; // } return new ContextInformation[0]; }
Example #2
Source File: TexStyleCompletionManager.java From texlipse with Eclipse Public License 1.0 | 5 votes |
/** * Returns the style context. * * @return Array of style contexts */ public IContextInformation[] getStyleContext() { ContextInformation[] contextInfos = new ContextInformation[STYLELABELS.length]; // Create one context information item for each style for (int i = 0; i < STYLELABELS.length; i++) { contextInfos[i] = new ContextInformation(null, STYLELABELS[i]+" Style"); } return contextInfos; }
Example #3
Source File: TexCompletionProcessor.java From texlipse with Eclipse Public License 1.0 | 5 votes |
public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) { // FIXME -- for testing // Retrieve selected range Point selectedRange = viewer.getSelectedRange(); if (selectedRange.y > 0) { if (styleManager == null) { styleManager = TexStyleCompletionManager.getInstance(); } return styleManager.getStyleContext(); } return new ContextInformation[0]; }
Example #4
Source File: ToolboxCompletionProcessor.java From tlaplus with MIT License | 5 votes |
public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) { // Retrieve selected range final Point selectedRange = viewer.getSelectedRange(); if (selectedRange.y > 0) { // Text is selected. Create a context information array. final IContextInformation[] contextInfos = new ContextInformation[ITLAReserveredWords.ALL_WORDS_ARRAY.length]; // Create one context information item for each style for (int i = 0; i < ITLAReserveredWords.ALL_WORDS_ARRAY.length; i++) { contextInfos[i] = new ContextInformation(null, ITLAReserveredWords.ALL_WORDS_ARRAY[i] + " Style"); } return contextInfos; } return new ContextInformation[0]; }
Example #5
Source File: TLACompletionProcessor.java From tlaplus with MIT License | 5 votes |
public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) { // Retrieve selected range final Point selectedRange = viewer.getSelectedRange(); if (selectedRange.y > 0) { // Text is selected. Create a context information array. final IContextInformation[] contextInfos = new ContextInformation[ITLAReserveredWords.ALL_WORDS_ARRAY.length]; // Create one context information item for each style for (int i = 0; i < ITLAReserveredWords.ALL_WORDS_ARRAY.length; i++) { contextInfos[i] = new ContextInformation(null, ITLAReserveredWords.ALL_WORDS_ARRAY[i] + " Style"); } return contextInfos; } return new ContextInformation[0]; }
Example #6
Source File: TypeScriptCompletionProposal.java From typescript.java with MIT License | 5 votes |
private IContextInformation createContextInformation() { try { String information = null; List<CompletionEntryDetails> entryDetails = super.getEntryDetails(); if (entryDetails == null || entryDetails.size() < 1) { return null; } if (isFunction()) { information = TypeScriptHelper.extractFunctionParameters(entryDetails.get(0).getDisplayParts()); } return information != null ? new ContextInformation("", information) : null; } catch (TypeScriptException e) { } return null; }
Example #7
Source File: JsonQuickAssistProcessor.java From KaiZen-OpenAPI-Editor with Eclipse Public License 1.0 | 5 votes |
@Override public IContextInformation getContextInformation() { if (markerResolution instanceof IMarkerResolution2) { IMarkerResolution2 mr2 = (IMarkerResolution2) markerResolution; String displayString = mr2.getDescription() == null ? mr2.getLabel() : mr2.getDescription(); return new ContextInformation(mr2.getImage(), mr2.getLabel(), displayString); } return null; }
Example #8
Source File: TexStyleCompletionManager.java From texlipse with Eclipse Public License 1.0 | 4 votes |
/** * Returns the style completion proposals * * @param selectedText The selected text * @param selectedRange The selected range * @return An array of completion proposals */ public ICompletionProposal[] getStyleCompletions(String selectedText, Point selectedRange) { /* ICompletionProposal[] result = new ICompletionProposal[keyValue.size()]; int i=0; for (Iterator iter = keyValue.keySet().iterator(); iter.hasNext();) { String key = (String) iter.next(); String value = (String) keyValue.get(key); String replacement = "{" + key + " " + selectedText + "}"; int cursor = key.length() + 2; IContextInformation contextInfo = new ContextInformation(null, value+" Style"); result[i] = new CompletionProposal(replacement, selectedRange.x, selectedRange.y, cursor, null, value, contextInfo, replacement); i++; } */ ICompletionProposal[] result = new ICompletionProposal[STYLELABELS.length]; // Loop through all styles for (int i = 0; i < STYLETAGS.length; i++) { String tag = STYLETAGS[i]; // Compute replacement text String replacement = tag + selectedText + "}"; // Derive cursor position int cursor = tag.length() + selectedText.length() + 1; // Compute a suitable context information IContextInformation contextInfo = new ContextInformation(null, STYLELABELS[i]+" Style"); // Construct proposal result[i] = new CompletionProposal(replacement, selectedRange.x, selectedRange.y, cursor, null, STYLELABELS[i], contextInfo, replacement); } return result; }