add source option for CC insert

This commit is contained in:
Manindra Moharana
2014-08-16 16:52:47 +05:30
parent 46e47ed994
commit 92d0555a37
2 changed files with 12 additions and 3 deletions

View File

@@ -86,6 +86,8 @@ public class CompletionPanel {
private JScrollPane scrollPane;
protected DebugEditor editor;
public static final int MOUSE_COMPLETION = 10, KEYBOARD_COMPLETION = 20;
/**
* Triggers the completion popup
@@ -254,7 +256,7 @@ public class CompletionPanel {
@Override
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2) {
insertSelection();
insertSelection(MOUSE_COMPLETION);
hide();
}
}
@@ -296,7 +298,7 @@ public class CompletionPanel {
*
* @return
*/
public boolean insertSelection() {
public boolean insertSelection(int completionSource) {
if (completionList.getSelectedValue() != null) {
try {
// If user types 'abc.', subword becomes '.' and null is returned
@@ -324,6 +326,13 @@ public class CompletionPanel {
}
}
if (completionSource == MOUSE_COMPLETION) {
if (completionString.endsWith("(")) {
completionString = completionString.substring(0, completionString
.length() - 2);
}
}
logE(subWord + " <= subword, Inserting suggestion=> "
+ selectedSuggestion + " Current sub: " + currentSubword);
if (currentSubword.length() > 0) {