use of org.eclipse.ui.texteditor.ContentAssistAction in project liferay-ide by liferay.
the class Editor method createActions.
protected void createActions() {
super.createActions();
// Add content assist propsal action
ContentAssistAction action = new ContentAssistAction(Plugin.getDefault().getResourceBundle(), "FreemarkerEditor.ContentAssist", // $NON-NLS-1$
this);
action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
// $NON-NLS-1$
setAction("FreemarkerEditor.ContentAssist", action);
action.setEnabled(true);
}
use of org.eclipse.ui.texteditor.ContentAssistAction in project mylyn.docs by eclipse.
the class MarkupEditor method createActions.
@Override
protected void createActions() {
super.createActions();
IAction action;
// action = new ShowCheatSheetAction(this);
// setAction(action.getId(),action);
// $NON-NLS-1$
action = new ContentAssistAction(new NlsResourceBundle(Messages.class), "ContentAssistProposal_", this);
action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
// $NON-NLS-1$
setAction("ContentAssistProposal", action);
// $NON-NLS-1$
markAsStateDependentAction("ContentAssistProposal", true);
}
use of org.eclipse.ui.texteditor.ContentAssistAction in project eclipse.platform.text by eclipse.
the class CompletionTest method testCompletion.
@Test
public void testCompletion() throws Exception {
final Set<Shell> beforeShells = Arrays.stream(editor.getSite().getShell().getDisplay().getShells()).filter(Shell::isVisible).collect(Collectors.toSet());
editor.selectAndReveal(3, 0);
ContentAssistAction action = (ContentAssistAction) editor.getAction(ITextEditorActionConstants.CONTENT_ASSIST);
action.update();
action.run();
waitAndDispatch(100);
this.completionShell = findNewShell(beforeShells);
final Table completionProposalList = findCompletionSelectionControl(completionShell);
checkCompletionContent(completionProposalList);
// TODO find a way to actually trigger completion and verify result against Editor content
// Assert.assertEquals("Completion didn't complete", "bars are good for a beer.", ((StyledText)editor.getAdapter(Control.class)).getText());
}
use of org.eclipse.ui.texteditor.ContentAssistAction in project eclipse.platform.text by eclipse.
the class CompletionTest method testCompletionFreeze_bug521484.
@Test
public void testCompletionFreeze_bug521484() throws Exception {
final Set<Shell> beforeShells = Arrays.stream(editor.getSite().getShell().getDisplay().getShells()).filter(Shell::isVisible).collect(Collectors.toSet());
editor.selectAndReveal(3, 0);
ContentAssistAction action = (ContentAssistAction) editor.getAction(ITextEditorActionConstants.CONTENT_ASSIST);
action.update();
action.run();
waitAndDispatch(100);
this.completionShell = findNewShell(beforeShells);
final Table completionProposalList = findCompletionSelectionControl(this.completionShell);
// should be instantaneous, but happens to go asynchronous on CI so let's allow a wait
new DisplayHelper() {
@Override
protected boolean condition() {
return completionProposalList.getItemCount() == 2;
}
}.waitForCondition(completionShell.getDisplay(), 200);
assertEquals(2, completionProposalList.getItemCount());
final TableItem computingItem = completionProposalList.getItem(0);
// $NON-NLS-1$ //$NON-NLS-2$
assertTrue("Missing computing info entry", computingItem.getText().contains("Computing"));
// Some processors are long running, moving cursor can cause freeze (bug 521484)
// asynchronous
long timestamp = System.currentTimeMillis();
emulatePressLeftArrowKey();
// give time to process events
DisplayHelper.sleep(editor.getSite().getShell().getDisplay(), 200);
long processingDuration = System.currentTimeMillis() - timestamp;
assertTrue("UI Thread frozen for " + processingDuration + "ms", processingDuration < LongRunningBarContentAssistProcessor.DELAY);
}
use of org.eclipse.ui.texteditor.ContentAssistAction in project erlide_eclipse by erlang.
the class AbstractErlangEditor method createCommonActions.
protected void createCommonActions() {
openAction = new OpenAction(this);
openAction.setActionDefinitionId(IErlangEditorActionDefinitionIds.OPEN_EDITOR);
setAction(IErlangEditorActionDefinitionIds.OPEN, openAction);
final ResourceBundle keyBundle = ErlangEditorMessages.getBundleForConstructedKeys();
if (getProject() != null) {
sendToConsole = new SendToConsoleAction(getSite(), keyBundle, "SendToConsole.", this, false, getProject().getWorkspaceProject());
sendToConsole.setActionDefinitionId(IErlangEditorActionDefinitionIds.SEND_TO_CONSOLE);
setAction("SendToConsole", sendToConsole);
markAsStateDependentAction("sendToConsole", true);
markAsSelectionDependentAction("sendToConsole", true);
sendToConsoleWithResult = new SendToConsoleAction(getSite(), keyBundle, "SendToConsoleWithResult.", this, true, getProject().getWorkspaceProject());
sendToConsoleWithResult.setActionDefinitionId(IErlangEditorActionDefinitionIds.SEND_TO_CONSOLE_WITH_RESULT);
setAction("SendToConsoleWithResult", sendToConsoleWithResult);
markAsStateDependentAction("sendToConsoleWithResult", true);
markAsSelectionDependentAction("sendToConsoleWithResult", true);
}
final Action contentAssistAction = new ContentAssistAction(keyBundle, "ContentAssistProposal.", this);
contentAssistAction.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
setAction("ContentAssistProposal", contentAssistAction);
markAsStateDependentAction("ContentAssistProposal", true);
}
Aggregations