本文整理汇总了Java中com.intellij.ui.EditorTextField.getEditor方法的典型用法代码示例。如果您正苦于以下问题:Java EditorTextField.getEditor方法的具体用法?Java EditorTextField.getEditor怎么用?Java EditorTextField.getEditor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.ui.EditorTextField
的用法示例。
在下文中一共展示了EditorTextField.getEditor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: collapseIfPossible
import com.intellij.ui.EditorTextField; //导入方法依赖的package包/类
private static void collapseIfPossible(@NotNull EditorTextField editorTextField,
@NotNull ProjectSystemId systemId,
@NotNull Project project) {
Editor editor = editorTextField.getEditor();
if (editor != null) {
String rawText = editor.getDocument().getText();
if (StringUtil.isEmpty(rawText)) return;
if (EMPTY_PARENT.equals(rawText)) {
editorTextField.setEnabled(false);
return;
}
final Collection<ExternalProjectInfo> projectsData =
ProjectDataManager.getInstance().getExternalProjectsData(project, systemId);
for (ExternalProjectInfo projectInfo : projectsData) {
if (projectInfo.getExternalProjectStructure() != null && projectInfo.getExternalProjectPath().equals(rawText)) {
editorTextField.setEnabled(true);
ExternalProjectPathField.collapse(
editorTextField.getEditor(), projectInfo.getExternalProjectStructure().getData().getExternalName());
return;
}
}
}
}
示例2: completeVariable
import com.intellij.ui.EditorTextField; //导入方法依赖的package包/类
private static void completeVariable(EditorTextField editorTextField, PsiType type) {
Editor editor = editorTextField.getEditor();
String prefix = editorTextField.getText();
if (prefix == null) prefix = "";
Set<LookupElement> set = new LinkedHashSet<LookupElement>();
JavaCompletionUtil.completeVariableNameForRefactoring(editorTextField.getProject(), set, prefix, type, VariableKind.PARAMETER);
LookupElement[] lookupItems = set.toArray(new LookupElement[set.size()]);
editor.getCaretModel().moveToOffset(prefix.length());
editor.getSelectionModel().removeSelection();
LookupManager.getInstance(editorTextField.getProject()).showLookup(editor, lookupItems, prefix);
}