Search in sources :

Example 1 with ContentAssistAction

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);
}
Also used : ContentAssistAction(org.eclipse.ui.texteditor.ContentAssistAction)

Example 2 with ContentAssistAction

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);
}
Also used : NlsResourceBundle(org.eclipse.mylyn.internal.wikitext.ui.util.NlsResourceBundle) IAction(org.eclipse.jface.action.IAction) ContentAssistAction(org.eclipse.ui.texteditor.ContentAssistAction)

Example 3 with ContentAssistAction

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());
}
Also used : Shell(org.eclipse.swt.widgets.Shell) Table(org.eclipse.swt.widgets.Table) ContentAssistAction(org.eclipse.ui.texteditor.ContentAssistAction) Test(org.junit.Test)

Example 4 with ContentAssistAction

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);
}
Also used : Shell(org.eclipse.swt.widgets.Shell) Table(org.eclipse.swt.widgets.Table) TableItem(org.eclipse.swt.widgets.TableItem) ContentAssistAction(org.eclipse.ui.texteditor.ContentAssistAction) DisplayHelper(org.eclipse.jface.text.tests.util.DisplayHelper) Test(org.junit.Test)

Example 5 with ContentAssistAction

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);
}
Also used : OpenAction(org.erlide.ui.actions.OpenAction) Action(org.eclipse.jface.action.Action) SendToConsoleAction(org.erlide.ui.editors.erl.actions.SendToConsoleAction) ContentAssistAction(org.eclipse.ui.texteditor.ContentAssistAction) OpenAction(org.erlide.ui.actions.OpenAction) ContentAssistAction(org.eclipse.ui.texteditor.ContentAssistAction) ResourceBundle(java.util.ResourceBundle) SendToConsoleAction(org.erlide.ui.editors.erl.actions.SendToConsoleAction)

Aggregations

ContentAssistAction (org.eclipse.ui.texteditor.ContentAssistAction)6 ResourceBundle (java.util.ResourceBundle)2 Action (org.eclipse.jface.action.Action)2 IAction (org.eclipse.jface.action.IAction)2 Shell (org.eclipse.swt.widgets.Shell)2 Table (org.eclipse.swt.widgets.Table)2 Test (org.junit.Test)2 IHandler (org.eclipse.core.commands.IHandler)1 DisplayHelper (org.eclipse.jface.text.tests.util.DisplayHelper)1 NlsResourceBundle (org.eclipse.mylyn.internal.wikitext.ui.util.NlsResourceBundle)1 TableItem (org.eclipse.swt.widgets.TableItem)1 IHandlerService (org.eclipse.ui.handlers.IHandlerService)1 IWorkbenchHelpSystem (org.eclipse.ui.help.IWorkbenchHelpSystem)1 TextOperationAction (org.eclipse.ui.texteditor.TextOperationAction)1 BreakpointRulerAction (org.eclipse.wst.sse.ui.internal.debug.BreakpointRulerAction)1 EditBreakpointAction (org.eclipse.wst.sse.ui.internal.debug.EditBreakpointAction)1 ManageBreakpointAction (org.eclipse.wst.sse.ui.internal.debug.ManageBreakpointAction)1 ToggleBreakpointAction (org.eclipse.wst.sse.ui.internal.debug.ToggleBreakpointAction)1 AddBlockCommentHandler (org.eclipse.wst.sse.ui.internal.handlers.AddBlockCommentHandler)1 RemoveBlockCommentHandler (org.eclipse.wst.sse.ui.internal.handlers.RemoveBlockCommentHandler)1