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
6 changes: 0 additions & 6 deletions client/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,6 @@ def clientJar = tasks.register('clientJar', Jar) {
include '*.properties'
into 'com/mirth/connect/client/ui/components/rsta'
}
from('src/main/resources/com/mirth/connect/client/ui/components/tag') {
include '*.html'
include '*.css'
include '*.js'
into 'com/mirth/connect/client/ui/components/tag'
}
}

// extension name -> package directory under the classes tree
Expand Down
Original file line number Diff line number Diff line change
@@ -1,71 +1,42 @@
/*
* Copyright (c) Mirth Corporation. All rights reserved.
*
*
* http://www.mirthcorp.com
*
*
* The software in this package is published under the terms of the MPL license a copy of which has
* been included with this distribution in the LICENSE.txt file.
*/

package com.mirth.connect.client.ui.components.tag;

import javax.swing.text.Document;
import java.util.function.Consumer;

import org.fife.ui.autocomplete.AutoCompletion;
import org.fife.ui.autocomplete.Completion;
import org.fife.ui.autocomplete.CompletionProvider;

public class AutoCompletionDelegate extends AutoCompletion {
private AutoCompletionPopupWindow autoCompleteWindow;
private Consumer<TagCompletion> onAccept;

public AutoCompletionDelegate(CompletionProvider provider, AutoCompletionPopupWindow autoCompleteWindow) {
public AutoCompletionDelegate(CompletionProvider provider, Consumer<TagCompletion> onAccept) {
super(provider);
this.autoCompleteWindow = autoCompleteWindow;
this.onAccept = onAccept;
setHideOnNoText(false);
}

public void updateUI() {
popupWindow.revalidate();
}

public void moveUp() {
popupWindow.selectPreviousItem();
}

public void moveDown() {
popupWindow.selectNextItem();
}

public void insertSelectedCompletion() {
popupWindow.insertSelectedCompletion();
}

@Override
public boolean hidePopupWindow() {
return super.hidePopupWindow();
}

/**
* The selected completion becomes a tag rather than editor text, so the default insertion (and
* the caret arithmetic that goes with it) is deliberately skipped. This covers both accept
* paths, since the final insertCompletion(Completion) delegates here.
*/
@Override
public void setPopupVisible(boolean visible) {
super.setPopupVisible(visible);
}

@Override
protected String getReplacementText(Completion c, Document doc, int start, int len) {
TagCompletion tagCompletion = (TagCompletion) c;
autoCompleteWindow.setTag(tagCompletion.getReplacementText(), tagCompletion.getType());
return c.getReplacementText();
}

public String getSelectedValue() {
String completionText = "";
Completion completion = popupWindow.getSelection();

if (completion != null) {
completionText = completion.getInputText();
insertCompletion(completion);
}

return completionText;
protected void insertCompletion(Completion completion, boolean typedParamListStartChar) {
hidePopupWindow();
onAccept.accept((TagCompletion) completion);
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,4 @@ public AutoCompletionProvider() {
public String getAlreadyEnteredText(JTextComponent component) {
return component.getText();
}

public void updateUI() {
updateUI();
}
}
Loading
Loading