use of com.intellij.ui.ReferenceEditorWithBrowseButton in project intellij-community by JetBrains.
the class PsiClassControl method createMainComponent.
protected PsiClassPanel createMainComponent(PsiClassPanel boundedComponent, final Project project) {
if (boundedComponent == null) {
boundedComponent = new PsiClassPanel();
}
ReferenceEditorWithBrowseButton editor = JavaReferenceEditorUtil.createReferenceEditorWithBrowseButton(null, "", project, true);
Document document = editor.getChildComponent().getDocument();
PsiCodeFragmentImpl fragment = (PsiCodeFragmentImpl) PsiDocumentManager.getInstance(project).getPsiFile(document);
assert fragment != null;
fragment.setIntentionActionsFilter(IntentionFilterOwner.IntentionActionsFilter.EVERYTHING_AVAILABLE);
fragment.putUserData(ModuleUtil.KEY_MODULE, getDomWrapper().getExistingDomElement().getModule());
return initReferenceEditorWithBrowseButton(boundedComponent, editor, this);
}
use of com.intellij.ui.ReferenceEditorWithBrowseButton in project intellij-community by JetBrains.
the class TextControl method createMainComponent.
@Override
protected TextPanel createMainComponent(TextPanel boundedComponent, final Project project) {
if (boundedComponent == null) {
boundedComponent = new TextPanel();
}
boundedComponent.removeAll();
final Function<String, Document> factory = s -> PsiDocumentManager.getInstance(project).getDocument(PsiFileFactory.getInstance(project).createFileFromText("a.txt", PlainTextLanguage.INSTANCE, "", true, false));
final TextPanel boundedComponent1 = boundedComponent;
final EditorTextField editorTextField = new EditorTextField(factory.fun(""), project, FileTypes.PLAIN_TEXT) {
@Override
protected EditorEx createEditor() {
final EditorEx editor = super.createEditor();
return boundedComponent1 instanceof MultiLineTextPanel ? makeBigEditor(editor, ((MultiLineTextPanel) boundedComponent1).getRowCount()) : editor;
}
@Override
protected boolean isOneLineMode() {
return false;
}
};
if (boundedComponent instanceof BigTextPanel) {
final ReferenceEditorWithBrowseButton editor = new ReferenceEditorWithBrowseButton(null, editorTextField, factory);
boundedComponent.add(editor);
editor.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
EditorTextField textArea = new EditorTextField(editorTextField.getDocument(), project, FileTypes.PLAIN_TEXT) {
@Override
protected EditorEx createEditor() {
final EditorEx editor = super.createEditor();
editor.setEmbeddedIntoDialogWrapper(true);
return makeBigEditor(editor, 5);
}
@Override
protected boolean isOneLineMode() {
return false;
}
};
DialogBuilder builder = new DialogBuilder(project);
builder.setDimensionServiceKey("TextControl");
builder.setCenterPanel(textArea);
builder.setPreferredFocusComponent(textArea);
builder.setTitle(UIBundle.message("big.text.control.window.title"));
builder.addCloseButton();
builder.show();
}
});
return boundedComponent;
}
boundedComponent.add(editorTextField);
return boundedComponent;
}
Aggregations