Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Plugin.name
Bundle-SymbolicName: org.eclipse.ui.genericeditor.tests;singleton:=true
Bundle-Version: 1.3.500.qualifier
Bundle-Version: 1.3.600.qualifier
Bundle-Vendor: %Plugin.providerName
Bundle-Localization: plugin
Export-Package: org.eclipse.ui.genericeditor.tests,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,15 @@ public BarContentAssistProcessor(String completeString) {

@Override
public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) {
for (int offsetInProposal = Math.min(this.completeString.length(), viewer.getDocument().getLength()); offsetInProposal > 0; offsetInProposal--) {
final IDocument doc= viewer.getDocument();
if (doc == null) {
return new ICompletionProposal[0];
}
for (int offsetInProposal = Math.min(this.completeString.length(), doc.getLength()); offsetInProposal > 0; offsetInProposal--) {
String maybeMatchingString = this.completeString.substring(0, offsetInProposal);
try {
int lastIndex = offset - offsetInProposal + this.completeString.length();
if (offset >= offsetInProposal && viewer.getDocument().get(offset - offsetInProposal, maybeMatchingString.length()).equals(maybeMatchingString)) {
if (offset >= offsetInProposal && doc.get(offset - offsetInProposal, maybeMatchingString.length()).equals(maybeMatchingString)) {
CompletionProposal proposal = new CompletionProposal(this.completeString.substring(offsetInProposal), offset, 0, lastIndex);
return new ICompletionProposal[] { proposal };
}
Expand Down Expand Up @@ -98,13 +102,13 @@ public IContextInformationValidator getContextInformationValidator() {
return new IContextInformationValidator() {
private ITextViewer viewer;
private int offset;

@Override
public void install(IContextInformation info, ITextViewer infoViewer, int documentOffset) {
this.viewer= infoViewer;
this.offset= documentOffset;
}

@Override
public boolean isContextInformationValid(int offsetToTest) {
try {
Expand All @@ -123,5 +127,4 @@ public boolean isContextInformationValid(int offsetToTest) {
public String getErrorMessage() {
return null;
}

}
Loading