本文整理匯總了Java中org.eclipse.jface.text.contentassist.IContextInformation類的典型用法代碼示例。如果您正苦於以下問題:Java IContextInformation類的具體用法?Java IContextInformation怎麽用?Java IContextInformation使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
IContextInformation類屬於org.eclipse.jface.text.contentassist包,在下文中一共展示了IContextInformation類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: computeCompletionProposals
import org.eclipse.jface.text.contentassist.IContextInformation; //導入依賴的package包/類
public List<ICompletionProposal> computeCompletionProposals(ContentAssistInvocationContext context, IProgressMonitor monitor) {
List<ICompletionProposal> propList = new ArrayList<ICompletionProposal>();
List<ICompletionProposal> newpropList = new ArrayList<ICompletionProposal>();
List<IContextInformation> propList2 = new ArrayList<IContextInformation>();
ICompletionProposal first;
DataManager datamanger = new DataManager(context,monitor);
Activator.applyoperationlist.add(new ApplyOperation(ConsoleOperationListener2.ope.getStart(), ConsoleOperationListener2.ope.getAuthor(), ConsoleOperationListener2.ope.getFilePath(), propList));
List<String> list = new ArrayList();
CompletionProposal proposal;
propList = datamanger.JavaDefaultProposal();
propList2 = datamanger.ContextInformation();
ApplyOperation ao = new ApplyOperation(ConsoleOperationListener2.ope.getStart(), ConsoleOperationListener2.ope.getAuthor(), ConsoleOperationListener2.ope.getFilePath(), propList);
System.out.println(ao.toString());
return newpropList;
}
示例2: HydrographCompletionProposal
import org.eclipse.jface.text.contentassist.IContextInformation; //導入依賴的package包/類
public HydrographCompletionProposal(String replacementString, int replacementOffset, int replacementLength, int cursorPosition,
Image image, String displayString, IContextInformation contextInformation, String additionalProposalInfo) {
Assert.isNotNull(replacementString);
Assert.isTrue(replacementOffset >= 0);
Assert.isTrue(replacementLength >= 0);
Assert.isTrue(cursorPosition >= 0);
fReplacementString = replacementString;
fReplacementOffset = replacementOffset;
fReplacementLength = replacementLength;
fCursorPosition = cursorPosition;
fImage = image;
fDisplayString = displayString;
fContextInformation = contextInformation;
fAdditionalProposalInfo = additionalProposalInfo;
}
示例3: addProposal
import org.eclipse.jface.text.contentassist.IContextInformation; //導入依賴的package包/類
private void addProposal(ContentAssistRequest contentAssistRequest, String name, INgBindingType bindingType,
String displayString, Image image, String additionalProposalInfo) {
String alternateMatch = bindingType.formatAttr(name);
StringBuilder replacementString = new StringBuilder(alternateMatch);
if (!hasValue) {
replacementString.append("=\"\"");
}
StringBuilder replacementStringCursor = new StringBuilder(alternateMatch);
replacementStringCursor.append("=\"\"");
int replacementOffset = contentAssistRequest.getReplacementBeginPosition();
int replacementLength = contentAssistRequest.getReplacementLength();
int cursorPosition = getCursorPositionForProposedText(replacementStringCursor.toString());
IContextInformation contextInformation = null;
int relevance = XMLRelevanceConstants.R_XML_ATTRIBUTE_NAME;
ICompletionProposal proposal = new HTMLAngularCompletionProposal(replacementString.toString(),
replacementOffset, replacementLength, cursorPosition, image, displayString, alternateMatch,
contextInformation, additionalProposalInfo, relevance);
contentAssistRequest.addProposal(proposal);
}
示例4: computeContextInformation
import org.eclipse.jface.text.contentassist.IContextInformation; //導入依賴的package包/類
public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset)
{
// Retrieve selected range
Point selectedRange = viewer.getSelectedRange();
if (selectedRange.y > 0)
{
// Text is selected. Create a context information array.
ContextInformation[] 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];
}
示例5: ConfigurableCompletionProposal
import org.eclipse.jface.text.contentassist.IContextInformation; //導入依賴的package包/類
/**
* Creates a new completion proposal. All fields are initialized based on the provided information.
*
* @param replacementString the actual string to be inserted into the document
* @param replacementOffset the offset of the text to be replaced
* @param replacementLength the length of the text to be replaced
* @param cursorPosition the position of the cursor following the insert relative to replacementOffset
* @param image the image to display for this proposal
* @param displayString the string to be displayed for the proposal
* @param contextInformation the context information associated with this proposal
* @param additionalProposalInfo the additional information associated with this proposal
*/
public ConfigurableCompletionProposal(String replacementString, int replacementOffset, int replacementLength, int cursorPosition, Image image, StyledString displayString, IContextInformation contextInformation, String additionalProposalInfo) {
Assert.isNotNull(replacementString);
Assert.isTrue(replacementOffset >= 0);
Assert.isTrue(replacementLength >= 0);
Assert.isTrue(cursorPosition >= 0);
this.replacementString= replacementString;
this.replacementOffset= replacementOffset;
this.replacementLength= replacementLength;
this.cursorPosition= cursorPosition;
this.selectionStart = replacementOffset + cursorPosition;
this.image= image;
this.displayString= displayString==null ? new StyledString(this.replacementString) : displayString;
this.contextInformation= contextInformation;
this.additionalProposalInfo= additionalProposalInfo;
}
示例6: createContextFrame
import org.eclipse.jface.text.contentassist.IContextInformation; //導入依賴的package包/類
/**
* Creates a context frame for the given offset.
*
* @param information
* the context information
* @param offset
* the offset
* @return the created context frame
* @since 3.0
*/
private ContextFrame createContextFrame(IContextInformation information, int offset)
{
IContextInformationValidator validator = fContentAssistSubjectControlAdapter.getContextInformationValidator(
fContentAssistant, offset);
if (validator != null)
{
int beginOffset = (information instanceof IContextInformationExtension) ? ((IContextInformationExtension) information)
.getContextInformationPosition() : offset;
if (beginOffset == -1)
{
beginOffset = offset;
}
int visibleOffset = fContentAssistSubjectControlAdapter.getWidgetSelectionRange().x
- (offset - beginOffset);
IContextInformationPresenter presenter = fContentAssistSubjectControlAdapter
.getContextInformationPresenter(fContentAssistant, offset);
return new ContextFrame(information, beginOffset, offset, visibleOffset, validator, presenter);
}
return null;
}
示例7: computeContextInformation
import org.eclipse.jface.text.contentassist.IContextInformation; //導入依賴的package包/類
/**
* Returns an array of context information objects computed based on the specified document position. The position
* is used to determine the appropriate code assist processor to invoke.
*
* @param viewer
* the viewer for which to compute the context information
* @param offset
* a document offset
* @return an array of context information objects
* @see IContentAssistProcessor#computeContextInformation(ITextViewer, int)
*/
IContextInformation[] computeContextInformation(ITextViewer viewer, int offset)
{
fLastErrorMessage = null;
IContextInformation[] result = null;
IContentAssistProcessor p = getProcessor(viewer, offset);
if (p != null)
{
result = p.computeContextInformation(viewer, offset);
fLastErrorMessage = p.getErrorMessage();
}
return result;
}
示例8: createProposal
import org.eclipse.jface.text.contentassist.IContextInformation; //導入依賴的package包/類
/**
* createProsal
*
* @param displayName
* @param name
* @param image
* @param description
* @param userAgents
* @param fileLocation
* @param offset
* @param length
* @return
*/
protected CommonCompletionProposal createProposal(String displayName, String name, Image image, String description,
Image[] userAgents, String fileLocation, int offset, int length)
{
IContextInformation contextInfo = null;
// TEMP:
int replaceLength = 0;
if (this._replaceRange != null)
{
offset = this._replaceRange.getStartingOffset();
replaceLength = this._replaceRange.getLength();
}
// build proposal
CommonCompletionProposal proposal = new CommonCompletionProposal(name, offset, replaceLength, length, image,
displayName, contextInfo, description);
proposal.setFileLocation(fileLocation);
proposal.setUserAgentImages(userAgents);
proposal.setTriggerCharacters(getProposalTriggerCharacters());
return proposal;
}
示例9: createProposal
import org.eclipse.jface.text.contentassist.IContextInformation; //導入依賴的package包/類
/**
* createProposal
*
* @param displayName
* @param name
* @param image
* @param description
* @param userAgents
* @param fileLocation
* @param offset
* @return
*/
protected CommonCompletionProposal createProposal(String displayName, String name, Image image, String description,
String[] userAgentIds, String fileLocation, int offset)
{
int length = name.length();
IContextInformation contextInfo = null;
int replaceLength = 0;
if (this._replaceRange != null)
{
offset = this._replaceRange.getStartingOffset();
replaceLength = this._replaceRange.getLength();
}
// build proposal
Image[] userAgents = UserAgentManager.getInstance().getUserAgentImages(getProject(), userAgentIds);
CommonCompletionProposal proposal = new CommonCompletionProposal(name, offset, replaceLength, length, image,
displayName, contextInfo, description);
proposal.setFileLocation(fileLocation);
proposal.setUserAgentImages(userAgents);
proposal.setTriggerCharacters(getProposalTriggerCharacters());
return proposal;
}
示例10: createProposal
import org.eclipse.jface.text.contentassist.IContextInformation; //導入依賴的package包/類
/**
* createProposal
*
* @param displayName
* @param name
* @param image
* @param description
* @param userAgents
* @param fileLocation
* @param offset
* @param length
* @return
*/
protected CommonCompletionProposal createProposal(String displayName, String name, Image image, String description,
String[] userAgentIds, String fileLocation, int offset, int length)
{
IContextInformation contextInfo = null;
// TEMP:
int replaceLength = 0;
if (this._replaceRange != null)
{
offset = this._replaceRange.getStartingOffset();
replaceLength = this._replaceRange.getLength();
}
Image[] userAgents = UserAgentManager.getInstance().getUserAgentImages(getProject(), userAgentIds);
// build proposal
CommonCompletionProposal proposal = new CommonCompletionProposal(name, offset, replaceLength, length, image,
displayName, contextInfo, description);
proposal.setFileLocation(fileLocation);
proposal.setUserAgentImages(userAgents);
return proposal;
}
示例11: addContextInformations
import org.eclipse.jface.text.contentassist.IContextInformation; //導入依賴的package包/類
private List<IContextInformation> addContextInformations(JavaContentAssistInvocationContext context, int offset) {
List<ICompletionProposal> proposals= internalComputeCompletionProposals(offset, context);
List<IContextInformation> result= new ArrayList<IContextInformation>(proposals.size());
List<IContextInformation> anonymousResult= new ArrayList<IContextInformation>(proposals.size());
for (Iterator<ICompletionProposal> it= proposals.iterator(); it.hasNext();) {
ICompletionProposal proposal= it.next();
IContextInformation contextInformation= proposal.getContextInformation();
if (contextInformation != null) {
ContextInformationWrapper wrapper= new ContextInformationWrapper(contextInformation);
wrapper.setContextInformationPosition(offset);
if (proposal instanceof AnonymousTypeCompletionProposal)
anonymousResult.add(wrapper);
else
result.add(wrapper);
}
}
if (result.size() == 0)
return anonymousResult;
return result;
}
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion-Juno38,代碼行數:24,代碼來源:JavaCompletionProposalComputer.java
示例12: computeContextInformation
import org.eclipse.jface.text.contentassist.IContextInformation; //導入依賴的package包/類
public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) {
clearState();
IProgressMonitor monitor= createProgressMonitor();
monitor.beginTask(JavaTextMessages.ContentAssistProcessor_computing_contexts, fCategories.size() + 1);
monitor.subTask(JavaTextMessages.ContentAssistProcessor_collecting_contexts);
List<IContextInformation> proposals= collectContextInformation(viewer, offset, monitor);
monitor.subTask(JavaTextMessages.ContentAssistProcessor_sorting_contexts);
List<IContextInformation> filtered= filterAndSortContextInformation(proposals, monitor);
fNumberOfComputedResults= filtered.size();
IContextInformation[] result= filtered.toArray(new IContextInformation[filtered.size()]);
monitor.done();
return result;
}
示例13: Proposal
import org.eclipse.jface.text.contentassist.IContextInformation; //導入依賴的package包/類
/**
* Creates a new completion proposal. All fields are initialized based on the provided information.
*
* @param replacementString the actual string to be inserted into the document
* @param replacementOffset the offset of the text to be replaced
* @param replacementLength the length of the text to be replaced
* @param cursorPosition the position of the cursor following the insert relative to replacementOffset
* @param image the image to display for this proposal
* @param displayString the string to be displayed for the proposal
* @param contextInformation the context information associated with this proposal
* @param additionalProposalInfo the additional information associated with this proposal
*/
public Proposal(String replacementString, int replacementOffset, int replacementLength, int cursorPosition, Image image, String displayString, IContextInformation contextInformation, String additionalProposalInfo) {
Assert.isNotNull(replacementString);
Assert.isTrue(replacementOffset >= 0);
Assert.isTrue(replacementLength >= 0);
Assert.isTrue(cursorPosition >= 0);
fReplacementString= replacementString;
fReplacementOffset= replacementOffset;
fReplacementLength= replacementLength;
fCursorPosition= cursorPosition;
fImage= image;
fDisplayString= displayString;
fContextInformation= contextInformation;
fAdditionalProposalInfo= additionalProposalInfo;
}
示例14: N4JSCompletionProposal
import org.eclipse.jface.text.contentassist.IContextInformation; //導入依賴的package包/類
/**
* Creates a new proposal.
*/
public N4JSCompletionProposal(String replacementString, int replacementOffset, int replacementLength,
int cursorPosition, Image image, StyledString displayString, IContextInformation contextInformation,
String additionalProposalInfo) {
super(replacementString, replacementOffset, replacementLength, cursorPosition, image, displayString,
contextInformation, additionalProposalInfo);
}
示例15: computeContextInformation
import org.eclipse.jface.text.contentassist.IContextInformation; //導入依賴的package包/類
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];
}