use of com.intellij.codeInsight.lookup.Lookup in project intellij-community by JetBrains.
the class XmlSmartEnterTest method select.
private void select(final char c) {
if (!LookupEvent.isSpecialCompletionChar(c)) {
type(c);
return;
}
final LookupManagerImpl manager = (LookupManagerImpl) LookupManager.getInstance(getProject());
final Lookup lookup = manager.getActiveLookup();
if (lookup != null) {
manager.forceSelection(c, lookup.getCurrentItem());
}
}
use of com.intellij.codeInsight.lookup.Lookup in project intellij-community by JetBrains.
the class BaseCodeInsightAction method update.
@Override
public void update(AnActionEvent event) {
Presentation presentation = event.getPresentation();
DataContext dataContext = event.getDataContext();
Project project = CommonDataKeys.PROJECT.getData(dataContext);
if (project == null) {
presentation.setEnabled(false);
return;
}
final Lookup activeLookup = LookupManager.getInstance(project).getActiveLookup();
if (activeLookup != null) {
presentation.setEnabled(isValidForLookup());
} else {
super.update(event);
}
}
use of com.intellij.codeInsight.lookup.Lookup in project intellij-community by JetBrains.
the class ConsoleExecuteAction method update.
@Override
public final void update(@NotNull AnActionEvent e) {
EditorEx editor = myConsoleView.getConsoleEditor();
boolean enabled = !editor.isRendererMode() && isEnabled() && (myExecuteActionHandler.isEmptyCommandExecutionAllowed() || !StringUtil.isEmptyOrSpaces(editor.getDocument().getCharsSequence()));
if (enabled) {
Lookup lookup = LookupManager.getActiveLookup(editor);
// we should check getCurrentItem() also - fast typing could produce outdated lookup, such lookup reports isCompletion() true
enabled = lookup == null || !lookup.isCompletion() || lookup.getCurrentItem() == null || (lookup instanceof LookupImpl && ((LookupImpl) lookup).getFocusDegree() == LookupImpl.FocusDegree.UNFOCUSED);
}
e.getPresentation().setEnabled(enabled);
}
use of com.intellij.codeInsight.lookup.Lookup in project intellij-community by JetBrains.
the class SmartType17CompletionTest method doTest.
private void doTest() {
configureByFile("/" + getTestName(false) + ".java");
if (myItems != null && myItems.length == 1) {
final Lookup lookup = getLookup();
if (lookup != null) {
selectItem(lookup.getCurrentItem(), Lookup.NORMAL_SELECT_CHAR);
}
}
checkResultByFile("/" + getTestName(false) + "-out.java");
}
use of com.intellij.codeInsight.lookup.Lookup in project intellij-community by JetBrains.
the class SmartType18CompletionTest method doTest.
private void doTest(boolean insertSelectedItem) {
configureByFile("/" + getTestName(false) + ".java");
if (insertSelectedItem) {
assertNotNull(myItems);
assertTrue(myItems.length > 0);
final Lookup lookup = getLookup();
if (lookup != null) {
selectItem(lookup.getCurrentItem(), Lookup.NORMAL_SELECT_CHAR);
}
}
checkResultByFile("/" + getTestName(false) + "-out.java");
}
Aggregations