Search in sources :

Example 1 with JSEditorTextField

use of com.intellij.lang.javascript.refactoring.ui.JSEditorTextField in project intellij-plugins by JetBrains.

the class FlexCompletionInTextFieldBase method doTestForEditorTextField.

protected void doTestForEditorTextField(JSExpressionCodeFragment fragment, String suffix, String ext, final String file) throws Exception {
    JSTestUtils.initJSIndexes(getProject());
    JSEditorTextField editorTextField = null;
    try {
        myFile = fragment;
        Document document = PsiDocumentManager.getInstance(myProject).getDocument(fragment);
        editorTextField = new JSEditorTextField(myProject, document);
        final String text = StringUtil.convertLineSeparators(VfsUtilCore.loadText(getVirtualFile(file)));
        EditorInfo editorInfo = new EditorInfo(text);
        // initialize editor
        editorTextField.addNotify();
        myEditor = editorTextField.getEditor();
        myEditorsToRelease.add(myEditor);
        editorTextField.setText(editorInfo.getNewFileText());
        editorInfo.applyToEditor(myEditor);
        complete();
    } finally {
        // dispose editor
        if (editorTextField != null)
            editorTextField.removeNotify();
    }
}
Also used : EditorInfo(com.intellij.codeInsight.EditorInfo) Document(com.intellij.openapi.editor.Document) JSEditorTextField(com.intellij.lang.javascript.refactoring.ui.JSEditorTextField)

Example 2 with JSEditorTextField

use of com.intellij.lang.javascript.refactoring.ui.JSEditorTextField in project intellij-plugins by JetBrains.

the class ActionScriptHighlightingInTextFieldTest method doTestForEditorTextField.

private void doTestForEditorTextField(JSExpressionCodeFragment fragment) throws Exception {
    myFile = fragment;
    Document document = PsiDocumentManager.getInstance(myProject).getDocument(fragment);
    final JSEditorTextField editorTextField = new JSEditorTextField(myProject, document);
    // initialize editor
    editorTextField.addNotify();
    myEditor = editorTextField.getEditor();
    try {
        checkHighlighting(new ExpectedHighlightingData(editorTextField.getDocument(), true, true, true, myFile));
    } finally {
        editorTextField.removeNotify();
        UIUtil.dispatchAllInvocationEvents();
    }
}
Also used : ExpectedHighlightingData(com.intellij.testFramework.ExpectedHighlightingData) Document(com.intellij.openapi.editor.Document) JSEditorTextField(com.intellij.lang.javascript.refactoring.ui.JSEditorTextField)

Example 3 with JSEditorTextField

use of com.intellij.lang.javascript.refactoring.ui.JSEditorTextField in project intellij-plugins by JetBrains.

the class JSCreateFieldDialog method createUIComponents.

private void createUIComponents() {
    Module module = ModuleUtilCore.findModuleForPsiElement(myTargetClass);
    GlobalSearchScope scope = getTypeFieldScope(module, myTargetClass.getProject());
    myTypeField = createTypeField(myTargetClass.getProject(), scope);
    PsiCodeFragment initializerCodeFragment = createInitializerCodeFragment(myTargetClass);
    Document document = PsiDocumentManager.getInstance(myTargetClass.getProject()).getDocument(initializerCodeFragment);
    myInitializerField = new JSEditorTextField(myTargetClass.getProject(), document);
}
Also used : GlobalSearchScope(com.intellij.psi.search.GlobalSearchScope) PsiCodeFragment(com.intellij.psi.PsiCodeFragment) Module(com.intellij.openapi.module.Module) Document(com.intellij.openapi.editor.Document) JSEditorTextField(com.intellij.lang.javascript.refactoring.ui.JSEditorTextField)

Aggregations

JSEditorTextField (com.intellij.lang.javascript.refactoring.ui.JSEditorTextField)3 Document (com.intellij.openapi.editor.Document)3 EditorInfo (com.intellij.codeInsight.EditorInfo)1 Module (com.intellij.openapi.module.Module)1 PsiCodeFragment (com.intellij.psi.PsiCodeFragment)1 GlobalSearchScope (com.intellij.psi.search.GlobalSearchScope)1 ExpectedHighlightingData (com.intellij.testFramework.ExpectedHighlightingData)1