Skip to content

Commit

Permalink
Fixed bug 409832: [content assist] typing comma (,) within a string j…
Browse files Browse the repository at this point in the history
…umps to the next argument
  • Loading branch information
mkeller authored and Dani Megert committed May 8, 2014
1 parent 4401f80 commit 7656c3b
Showing 1 changed file with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2013 IBM Corporation and others.
* Copyright (c) 2000, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
Expand All @@ -25,8 +25,10 @@
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IPositionUpdater;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITypedRegion;
import org.eclipse.jface.text.Position;
import org.eclipse.jface.text.Region;
import org.eclipse.jface.text.TextUtilities;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jface.text.link.ILinkedModeListener;
import org.eclipse.jface.text.link.InclusivePositionUpdater;
Expand All @@ -49,6 +51,7 @@

import org.eclipse.jdt.internal.corext.template.java.SignatureUtil;

import org.eclipse.jdt.ui.text.IJavaPartitions;
import org.eclipse.jdt.ui.text.java.JavaContentAssistInvocationContext;

import org.eclipse.jdt.internal.ui.JavaPlugin;
Expand Down Expand Up @@ -162,9 +165,17 @@ public ExitFlags doExit(LinkedModeModel model2, VerifyEvent event, int offset2,
for (int i= 0; i < fPositions.length - 1; i++) { // not for the last one
Position position= fPositions[i];
if (position.offset <= offset2 && offset2 + length <= position.offset + position.length) {
event.character= '\t';
event.keyCode= SWT.TAB;
return null;
try {
ITypedRegion partition= TextUtilities.getPartition(document, IJavaPartitions.JAVA_PARTITIONING, offset2 + length, false);
if (IDocument.DEFAULT_CONTENT_TYPE.equals(partition.getType())
|| offset2 + length == partition.getOffset() + partition.getLength()) {
event.character= '\t';
event.keyCode= SWT.TAB;
return null;
}
} catch (BadLocationException e) {
// continue; not serious enough to log
}
}
}
} else if (event.character == ')' && exitChar != ')') {
Expand Down

0 comments on commit 7656c3b

Please sign in to comment.