@Override public void setUp() throws Exception { super.setUp(); myWorkingDirectory = TestFileStructure.createDirectory(getProject(), getSourceRoot(), TEMP_DIR_NAME); myRealChangeListManager = ChangeListManager.getInstance(getProject()); myMockChangeListManager = new MockChangeListManager(); registerChangeListManager(myMockChangeListManager); myRealCodeStyleManger = CodeStyleManager.getInstance(getProject()); myMockCodeStyleManager = new MockCodeStyleManager(); registerCodeStyleManager(myMockCodeStyleManager); myRealVcsContextFactory = ServiceManager.getService(VcsContextFactory.class); registerVcsContextFactory(new MockVcsContextFactory(getSourceRoot().getFileSystem())); myMockPlainTextFormattingModelBuilder = new MockPlainTextFormattingModelBuilder(); LanguageFormatting.INSTANCE.addExplicitExtension(PlainTextLanguage.INSTANCE, myMockPlainTextFormattingModelBuilder); }
private static Language calcBaseLanguage(@NotNull VirtualFile file, @NotNull Project project, @NotNull final FileType fileType) { if (file instanceof LightVirtualFile) { final Language language = ((LightVirtualFile)file).getLanguage(); if (language != null) { return language; } } if (fileType.isBinary()) return Language.ANY; if (isTooLargeForIntelligence(file)) return PlainTextLanguage.INSTANCE; if (fileType instanceof LanguageFileType) { return LanguageSubstitutors.INSTANCE.substituteLanguage(((LanguageFileType)fileType).getLanguage(), file, project); } return PlainTextLanguage.INSTANCE; }
/** * Switches console to "process-mode" (see class doc for details) * * @param processHandler process to attach to */ private void switchToProcessMode(@NotNull final ProcessHandler processHandler) { myProcessHandler = processHandler; ApplicationManager.getApplication().invokeAndWait(new Runnable() { @Override public void run() { configureLeftBorder(false, getConsoleEditor()); // "bottom" part of console do not need padding now because it is used for user inputA notifyStateChangeListeners(); resetConsumer(new ProcessModeConsumer(processHandler)); // In process mode we do not need prompt and highlighting setLanguage(PlainTextLanguage.INSTANCE); setPrompt(""); } }, ModalityState.NON_MODAL); }
private void createUIComponents() { final EditorTextField editorTextField = new LanguageTextField(PlainTextLanguage.INSTANCE, myProject, "") { @Override protected EditorEx createEditor() { final EditorEx editor = super.createEditor(); final PsiFile file = PsiDocumentManager.getInstance(myProject).getPsiFile(editor.getDocument()); if (file != null) { DaemonCodeAnalyzer.getInstance(myProject).setHighlightingEnabled(file, false); } editor.putUserData(ACTIVITY_CLASS_TEXT_FIELD_KEY, ApplicationRunParameters.this); return editor; } }; myActivityField = new ComponentWithBrowseButton<EditorTextField>(editorTextField, null); }
private void createUIComponents(Project project) { final EditorTextField editorTextField = new LanguageTextField(PlainTextLanguage.INSTANCE, project, "") { @Override protected EditorEx createEditor() { final EditorEx editor = super.createEditor(); final PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument()); if (file != null) { DaemonCodeAnalyzer.getInstance(project).setHighlightingEnabled(file, false); } editor.putUserData( ACTIVITY_CLASS_TEXT_FIELD_KEY, BlazeAndroidBinaryRunConfigurationStateEditor.this); return editor; } }; activityField = new ComponentWithBrowseButton<EditorTextField>(editorTextField, null); }
private static void enableLanguageSupport(Project project) { OCLanguage.LANGUAGE_SUPPORT_DISABLED.set(project, false); UIUtil.invokeLaterIfNeeded( () -> ApplicationManager.getApplication() .runWriteAction( () -> { if (project.isDisposed()) { return; } Language langToReset = PlainTextLanguage.INSTANCE; FileManager fileManager = ((PsiManagerEx) PsiManager.getInstance(project)).getFileManager(); for (PsiFile file : fileManager.getAllCachedFiles()) { if (file.getLanguage() == langToReset) { VirtualFile vf = OCInclusionContextUtil.getVirtualFile(file); if (vf != null) { fileManager.setViewProvider(vf, null); } } } })); }
@Override @NotNull @RequiredReadAction public Collection<Language> getSupportedLanguages(@NotNull Project project, @Nullable XSourcePosition sourcePosition) { if(sourcePosition == null) { return Collections.<Language>singletonList(PlainTextLanguage.INSTANCE); } DotNetDebuggerProvider dotNetDebuggerProvider = DotNetDebuggerProviders.findByVirtualFile(project, sourcePosition.getFile()); if(dotNetDebuggerProvider == null) { return Collections.<Language>singletonList(PlainTextLanguage.INSTANCE); } return Collections.singletonList(dotNetDebuggerProvider.getEditorLanguage()); }
/** * Creates a text editor appropriate for creating commit messages. * * @param project project this commit message editor is intended for * @param forceSpellCheckOn if false, {@link com.intellij.openapi.vcs.VcsConfiguration#CHECK_COMMIT_MESSAGE_SPELLING} will control * whether or not the editor has spell check enabled * @return a commit message editor */ public static EditorTextField createCommitTextEditor(final Project project, boolean forceSpellCheckOn) { Set<EditorCustomization> features = new HashSet<EditorCustomization>(); final SpellCheckerCustomization spellChecker = SpellCheckerCustomization.getInstance(); VcsConfiguration configuration = VcsConfiguration.getInstance(project); if (configuration != null) { boolean enableSpellChecking = forceSpellCheckOn || configuration.CHECK_COMMIT_MESSAGE_SPELLING; if(spellChecker.isEnabled()) { features.add(spellChecker.getCustomization(enableSpellChecking)); } features.add(new RightMarginEditorCustomization(configuration.USE_COMMIT_MESSAGE_MARGIN, configuration.COMMIT_MESSAGE_MARGIN_SIZE)); features.add(WrapWhenTypingReachesRightMarginCustomization.getInstance(configuration.WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN)); } else { if(spellChecker.isEnabled()) { features.add(spellChecker.getCustomization(true)); } features.add(new RightMarginEditorCustomization(false, -1)); } features.add(SoftWrapsEditorCustomization.ENABLED); features.add(AdditionalPageAtBottomEditorCustomization.DISABLED); EditorTextFieldProvider service = ServiceManager.getService(project, EditorTextFieldProvider.class); return service.getEditorField(PlainTextLanguage.INSTANCE, project, features); }
private static EditorTextField createEditorField(final Project project, final int defaultLines) { final EditorTextFieldProvider service = ServiceManager.getService(project, EditorTextFieldProvider.class); final EditorTextField editorField; final Set<EditorCustomization> editorFeatures = ContainerUtil.newHashSet(); final SpellCheckerCustomization spellChecker = SpellCheckerCustomization.getInstance(); if(spellChecker.isEnabled()) { editorFeatures.add(spellChecker.getCustomization(true)); } if (defaultLines == 1) { editorFeatures.add(HorizontalScrollBarEditorCustomization.DISABLED); editorFeatures.add(OneLineEditorCustomization.ENABLED); } else { editorFeatures.add(SoftWrapsEditorCustomization.ENABLED); } editorField = service.getEditorField(PlainTextLanguage.INSTANCE, project, editorFeatures); final int height = editorField.getFontMetrics(editorField.getFont()).getHeight(); editorField.getComponent().setMinimumSize(new Dimension(100, (int)(height * 1.3))); return editorField; }
public JetFileViewProvider(PsiManager manager, VirtualFile file, boolean physical) { super(manager, file, physical); Language dataLang = TemplateDataLanguageMappings.getInstance(manager.getProject()).getMapping(file); if (dataLang == null) dataLang = StdFileTypes.HTML.getLanguage(); if (dataLang instanceof TemplateLanguage) { myTemplateDataLanguage = PlainTextLanguage.INSTANCE; } else { myTemplateDataLanguage = LanguageSubstitutors.INSTANCE.substituteLanguage(dataLang, file, manager.getProject()); } }
@Override public void tearDown() throws Exception { registerChangeListManager(myRealChangeListManager); registerCodeStyleManager(myRealCodeStyleManger); registerVcsContextFactory(myRealVcsContextFactory); LanguageFormatting.INSTANCE.removeExplicitExtension(PlainTextLanguage.INSTANCE, myMockPlainTextFormattingModelBuilder); TestFileStructure.delete(myWorkingDirectory.getVirtualFile()); super.tearDown(); }
@Override public void setUp() throws Exception { super.setUp(); myWorkingDirectory = TestFileStructure.createDirectory(getProject(), getSourceRoot(), TEMP_DIR_NAME); myRealCodeStyleManger = CodeStyleManager.getInstance(getProject()); myMockCodeStyleManager = new MockCodeStyleManager(); registerCodeStyleManager(myMockCodeStyleManager); myMockPlainTextFormattingModelBuilder = new MockPlainTextFormattingModelBuilder(); LanguageFormatting.INSTANCE.addExplicitExtension(PlainTextLanguage.INSTANCE, myMockPlainTextFormattingModelBuilder); }
@Override public void tearDown() throws Exception { if (myRealCodeStyleManger != null) registerCodeStyleManager(myRealCodeStyleManger); if (myMockPlainTextFormattingModelBuilder != null) { LanguageFormatting.INSTANCE.removeExplicitExtension(PlainTextLanguage.INSTANCE, myMockPlainTextFormattingModelBuilder); } if (myWorkingDirectory != null) TestFileStructure.delete(myWorkingDirectory.getVirtualFile()); super.tearDown(); }
private static FileType getFileType(@NotNull PsiFile file, @NotNull Editor editor) { FileType fileType = file.getFileType(); Language language = PsiUtilBase.getLanguageInEditor(editor, file.getProject()); if (language != null && language != PlainTextLanguage.INSTANCE) { LanguageFileType associatedFileType = language.getAssociatedFileType(); if (associatedFileType != null) fileType = associatedFileType; } return fileType; }
public TextFieldWithAutoCompletion(final Project project, @NotNull final TextFieldWithAutoCompletionListProvider<T> provider, final boolean showAutocompletionIsAvailableHint, @Nullable final String text) { super(project == null ? null : PlainTextLanguage.INSTANCE, project, text == null ? "" : text); myShowAutocompletionIsAvailableHint = showAutocompletionIsAvailableHint; myProvider = provider; TextFieldWithAutoCompletionContributor.installCompletion(getDocument(), project, provider, true); }
@NotNull public EditorTextField createEditor(Project project, final boolean shouldHaveBorder, @Nullable final Consumer<Editor> editorConstructionCallback) { return new EditorTextField(createDocument(project, ""), project, PlainTextLanguage.INSTANCE.getAssociatedFileType()) { @Override protected boolean shouldHaveBorder() { return shouldHaveBorder; } @Override protected void updateBorder(@NotNull EditorEx editor) { if (shouldHaveBorder) { super.updateBorder(editor); } else { editor.setBorder(null); } } @Override protected EditorEx createEditor() { EditorEx result = super.createEditor(); if (editorConstructionCallback != null) { editorConstructionCallback.consume(result); } return result; } }; }
@NotNull private static Language findLanguage() { Language language = Language.findLanguageByID("yaml"); if (language == null) { language = PlainTextLanguage.INSTANCE; } return language; }
private static FileType getFileType(PsiFile file, Editor editor) { FileType fileType = file.getFileType(); Language language = PsiUtilBase.getLanguageInEditor(editor, file.getProject()); if (language != null && language != PlainTextLanguage.INSTANCE) { LanguageFileType associatedFileType = language.getAssociatedFileType(); if (associatedFileType != null) fileType = associatedFileType; } return fileType; }
public TextFieldWithAutoCompletion(final Project project, @Nullable final TextFieldWithAutoCompletionListProvider<T> provider, final boolean showAutocompletionIsAvailableHint, @Nullable final String text) { super(PlainTextLanguage.INSTANCE, project, text == null ? "" : text); myShowAutocompletionIsAvailableHint = showAutocompletionIsAvailableHint; if (provider != null) { TextFieldWithAutoCompletionContributor.installCompletion(getDocument(), project, provider, true); } }
private void applyCodeStyleSettings(final List<OutPair> outPairs, final CodeStyleSettings codeStyleSettings, final VirtualFile file) { // Apply indent options final String indentSize = Utils.configValueForKey(outPairs, indentSizeKey); final String tabWidth = Utils.configValueForKey(outPairs, tabWidthKey); final String indentStyle = Utils.configValueForKey(outPairs, indentStyleKey); final FileType fileType = file.getFileType(); final Language language = fileType instanceof LanguageFileType ? ((LanguageFileType)fileType).getLanguage() : PlainTextLanguage.INSTANCE; final CommonCodeStyleSettings commonSettings = codeStyleSettings.getCommonSettings(language); final CommonCodeStyleSettings.IndentOptions indentOptions = commonSettings.getIndentOptions(); applyIndentOptions(indentOptions, indentSize, tabWidth, indentStyle, file.getCanonicalPath()); }
public CommentForm(@NotNull Project project, boolean isGeneral, boolean isReply, @Nullable FilePath filePath) { super(new BorderLayout()); myProject = project; myGeneral = isGeneral; myReply = isReply; myFilePath = filePath; final EditorTextFieldProvider service = ServiceManager.getService(project, EditorTextFieldProvider.class); final Set<EditorCustomization> editorFeatures = ContainerUtil.newHashSet(); editorFeatures.add(SoftWrapsEditorCustomization.ENABLED); editorFeatures.add(SpellCheckingEditorCustomization.ENABLED); myReviewTextField = service.getEditorField(PlainTextLanguage.INSTANCE, project, editorFeatures); final JScrollPane pane = ScrollPaneFactory.createScrollPane(myReviewTextField); pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); add(pane); myReviewTextField.setPreferredSize(new Dimension(ourBalloonWidth, ourBalloonHeight)); myReviewTextField.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW). put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.CTRL_DOWN_MASK), "postComment"); myReviewTextField.getActionMap().put("postComment", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { myOK = true; if (myBalloon != null) { myBalloon.dispose(); } } }); }
private static Language calcBaseLanguage(@Nonnull VirtualFile file, @Nonnull Project project, @Nonnull final FileType fileType) { if (fileType.isBinary()) return Language.ANY; if (isTooLargeForIntelligence(file)) return PlainTextLanguage.INSTANCE; Language language = LanguageUtil.getLanguageForPsi(project, file); return language != null ? language : PlainTextLanguage.INSTANCE; }
private static FileType getFileType(@Nonnull PsiFile file, @Nonnull Editor editor) { FileType fileType = file.getFileType(); Language language = PsiUtilBase.getLanguageInEditor(editor, file.getProject()); if (language != null && language != PlainTextLanguage.INSTANCE) { LanguageFileType associatedFileType = language.getAssociatedFileType(); if (associatedFileType != null) fileType = associatedFileType; } return fileType; }
public TextFieldWithAutoCompletion(final Project project, @Nonnull final TextFieldWithAutoCompletionListProvider<T> provider, final boolean showAutocompletionIsAvailableHint, @Nullable final String text) { super(PlainTextLanguage.INSTANCE, project, text == null ? "" : text); myShowAutocompletionIsAvailableHint = showAutocompletionIsAvailableHint; myProvider = provider; TextFieldWithAutoCompletionContributor.installCompletion(getDocument(), project, provider, true); }
@Nonnull public EditorTextField createEditor(Project project, final boolean shouldHaveBorder, @Nullable final Consumer<Editor> editorConstructionCallback) { return new EditorTextField(createDocument(project, ""), project, PlainTextLanguage.INSTANCE.getAssociatedFileType()) { @Override protected boolean shouldHaveBorder() { return shouldHaveBorder; } @Override protected void updateBorder(@Nonnull EditorEx editor) { if (shouldHaveBorder) { super.updateBorder(editor); } else { editor.setBorder(null); } } @Override protected EditorEx createEditor() { EditorEx result = super.createEditor(); if (editorConstructionCallback != null) { editorConstructionCallback.consume(result); } return result; } }; }
public TextFieldWithCompletion(@Nullable Project project, @Nonnull TextCompletionProvider provider, @Nonnull String value, boolean oneLineMode, boolean autoPopup, boolean forceAutoPopup, boolean showHint) { super(PlainTextLanguage.INSTANCE, project, value, new TextCompletionUtil.DocumentWithCompletionCreator(provider, autoPopup), oneLineMode); myForceAutoPopup = forceAutoPopup; myShowHint = showHint; }
public DustFileViewProvider(PsiManager manager, VirtualFile file, boolean physical) { super(manager, file, physical); // get the main language of the file Language dataLang = TemplateDataLanguageMappings.getInstance(manager.getProject()).getMapping(file); if (dataLang == null) dataLang = StdFileTypes.HTML.getLanguage(); // some magic? if (dataLang instanceof TemplateLanguage) { myTemplateDataLanguage = PlainTextLanguage.INSTANCE; } else { myTemplateDataLanguage = LanguageSubstitutors.INSTANCE.substituteLanguage(dataLang, file, manager.getProject()); } }
private CsvLanguage() { super(PlainTextLanguage.INSTANCE, "csv"); }
private void createEditorField() { PsiFile psiFile = PsiFileFactory.getInstance(project).createFileFromText("Script", PlainTextLanguage.INSTANCE, code); etfCode = new EditorTextField(PsiDocumentManager.getInstance(project).getDocument(psiFile), project, PlainTextFileType.INSTANCE); etfCode.setOneLineMode(false); }
public JavaCoreApplicationEnvironment(@NotNull Disposable parentDisposable) { super(parentDisposable); registerFileType(JavaClassFileType.INSTANCE, "class"); registerFileType(JavaFileType.INSTANCE, "java"); registerFileType(ArchiveFileType.INSTANCE, "jar;zip"); registerFileType(PlainTextFileType.INSTANCE, "txt;sh;bat;cmd;policy;log;cgi;MF;jad;jam;htaccess"); addExplicitExtension(LanguageASTFactory.INSTANCE, PlainTextLanguage.INSTANCE, new PlainTextASTFactory()); addExplicitExtension(LanguageParserDefinitions.INSTANCE, PlainTextLanguage.INSTANCE, new PlainTextParserDefinition()); addExplicitExtension(FileTypeFileViewProviders.INSTANCE, JavaClassFileType.INSTANCE, new ClassFileViewProviderFactory()); addExplicitExtension(BinaryFileStubBuilders.INSTANCE, JavaClassFileType.INSTANCE, new ClassFileStubBuilder()); addExplicitExtension(LanguageASTFactory.INSTANCE, JavaLanguage.INSTANCE, new CoreJavaASTFactory()); addExplicitExtension(LanguageParserDefinitions.INSTANCE, JavaLanguage.INSTANCE, new JavaParserDefinition()); addExplicitExtension(LanguageConstantExpressionEvaluator.INSTANCE, JavaLanguage.INSTANCE, new PsiExpressionEvaluator()); addExtension(ContainerProvider.EP_NAME, new JavaContainerProvider()); myApplication.registerService(PsiPackageImplementationHelper.class, new CorePsiPackageImplementationHelper()); myApplication.registerService(EmptySubstitutor.class, new EmptySubstitutorImpl()); myApplication.registerService(JavaDirectoryService.class, createJavaDirectoryService()); myApplication.registerService(JavaVersionService.class, new JavaVersionService()); addExplicitExtension(ItemPresentationProviders.INSTANCE, PsiPackage.class, new PackagePresentationProvider()); addExplicitExtension(ItemPresentationProviders.INSTANCE, PsiClass.class, new ClassPresentationProvider()); addExplicitExtension(ItemPresentationProviders.INSTANCE, PsiMethod.class, new MethodPresentationProvider()); addExplicitExtension(ItemPresentationProviders.INSTANCE, PsiField.class, new FieldPresentationProvider()); addExplicitExtension(ItemPresentationProviders.INSTANCE, PsiLocalVariable.class, new VariablePresentationProvider()); addExplicitExtension(ItemPresentationProviders.INSTANCE, PsiParameter.class, new VariablePresentationProvider()); registerApplicationService(JavaCodeFoldingSettings.class, new JavaCodeFoldingSettingsBase()); addExplicitExtension(LanguageFolding.INSTANCE, JavaLanguage.INSTANCE, new JavaFoldingBuilderBase() { @Override protected boolean shouldShowExplicitLambdaType(PsiAnonymousClass anonymousClass, PsiNewExpression expression) { return false; } @Override protected boolean isBelowRightMargin(Project project, int lineLength) { return false; } }); registerApplicationExtensionPoint(SuperMethodsSearch.EP_NAME, QueryExecutor.class); addExtension(SuperMethodsSearch.EP_NAME, new MethodSuperSearcher()); }
public PsiPlainTextFileImpl(FileViewProvider viewProvider) { super(PlainTextTokenTypes.PLAIN_TEXT_FILE, PlainTextTokenTypes.PLAIN_TEXT_FILE, viewProvider); myFileType = viewProvider.getBaseLanguage() != PlainTextLanguage.INSTANCE ? PlainTextFileType.INSTANCE : viewProvider.getFileType(); }
public void doProcessLine(final String line) { if (myInputBuffer == null) { myInputBuffer = new StringBuilder(); } if (!StringUtil.isEmptyOrSpaces(line)) { myInputBuffer.append(line); if (!line.endsWith("\n")) { myInputBuffer.append("\n"); } } if (StringUtil.isEmptyOrSpaces(line) && StringUtil.isEmptyOrSpaces(myInputBuffer.toString())) { myInputBuffer.append(""); } // multiline strings handling if (myInMultilineStringState != null) { if (PyConsoleUtil.isDoubleQuoteMultilineStarts(line) || PyConsoleUtil.isSingleQuoteMultilineStarts(line)) { myInMultilineStringState = null; // restore language myConsoleView.setLanguage(PythonLanguage.getInstance()); myConsoleView.setPrompt(PyConsoleUtil.ORDINARY_PROMPT); } else { if (line.equals("\n")) { myInputBuffer.append("\n"); } return; } } else { if (PyConsoleUtil.isDoubleQuoteMultilineStarts(line)) { myInMultilineStringState = PyConsoleUtil.DOUBLE_QUOTE_MULTILINE; } else if (PyConsoleUtil.isSingleQuoteMultilineStarts(line)) { myInMultilineStringState = PyConsoleUtil.SINGLE_QUOTE_MULTILINE; } if (myInMultilineStringState != null) { // change language myConsoleView.setLanguage(PlainTextLanguage.INSTANCE); myConsoleView.setPrompt(PyConsoleUtil.INDENT_PROMPT); return; } } // Process line continuation if (line.endsWith("\\")) { myConsoleView.setPrompt(PyConsoleUtil.INDENT_PROMPT); return; } if (!StringUtil.isEmptyOrSpaces(line)) { int indent = IndentHelperImpl.getIndent(getProject(), PythonFileType.INSTANCE, line, false); boolean flag = false; if (PyConsoleIndentUtil.shouldIndent(line)) { indent += getPythonIndent(); flag = true; } if ((myCurrentIndentSize > 0 && indent > 0) || flag) { setCurrentIndentSize(indent); indentEditor(myConsoleView.getConsoleEditor(), indent); more(); myConsoleCommunication.notifyCommandExecuted(true); return; } } sendLineToConsole(new ConsoleCommunication.ConsoleCodeFragment(myInputBuffer.toString(), true)); }
private void setEmbeddedLexer() { Lexer newLexer = null; if (hasSeenStyle()) { if (styleLexer == null) { if (ourStyleFileType == null) { styleLexer = null; } else { SyntaxHighlighter highlighter = SyntaxHighlighterFactory.getSyntaxHighlighter(ourStyleFileType, null, null); LOG.assertTrue(highlighter != null, ourStyleFileType); styleLexer = highlighter.getHighlightingLexer(); } } newLexer = styleLexer; } else if (hasSeenScript()) { Lexer scriptLexer = scriptLexers.get(scriptType); if (scriptLexer == null) { if (hasSeenTag()) { HtmlScriptContentProvider provider = findScriptContentProvider(scriptType); if (provider != null) { scriptLexer = provider.getHighlightingLexer(); } else { scriptLexer = SyntaxHighlighterFactory.getSyntaxHighlighter(PlainTextLanguage.INSTANCE, null, null).getHighlightingLexer(); } } else if (hasSeenAttribute()) { SyntaxHighlighter syntaxHighlighter = ourInlineScriptFileType != null ? SyntaxHighlighterFactory.getSyntaxHighlighter(ourInlineScriptFileType, null, null) : null; scriptLexer = syntaxHighlighter != null ? syntaxHighlighter.getHighlightingLexer() : null; } scriptLexers.put(scriptType, scriptLexer); } newLexer = scriptLexer; } else { newLexer = createELLexer(newLexer); } if (newLexer != null) { embeddedLexer = newLexer; } }
public PsiPlainTextFileImpl(FileViewProvider viewProvider) { super(PlainTextTokenTypes.PLAIN_TEXT_FILE, PlainTextTokenTypes.PLAIN_TEXT_FILE, viewProvider); myFileType = viewProvider.getBaseLanguage() != PlainTextLanguage.INSTANCE ? PlainTextFileType.INSTANCE : viewProvider.getVirtualFile().getFileType(); }
private void createUIComponents() { myPackage = new LabeledComponent<EditorTextFieldWithBrowseButton>(); myPackage.setComponent(new EditorTextFieldWithBrowseButton(myProject, false)); myClass = new LabeledComponent<EditorTextFieldWithBrowseButton>(); final TestClassBrowser classBrowser = new TestClassBrowser(myProject); myClass.setComponent(new EditorTextFieldWithBrowseButton(myProject, true, new JavaCodeFragment.VisibilityChecker() { @Override public Visibility isDeclarationVisible(PsiElement declaration, PsiElement place) { try { if (declaration instanceof PsiClass && classBrowser.getFilter().isAccepted(((PsiClass)declaration))) { return Visibility.VISIBLE; } } catch (ClassBrowser.NoFilterException e) { return Visibility.NOT_VISIBLE; } return Visibility.NOT_VISIBLE; } })); myMethod = new LabeledComponent<EditorTextFieldWithBrowseButton>(); final EditorTextFieldWithBrowseButton textFieldWithBrowseButton = new EditorTextFieldWithBrowseButton(myProject, true, JavaCodeFragment.VisibilityChecker.EVERYTHING_VISIBLE, PlainTextLanguage.INSTANCE.getAssociatedFileType()); new TextFieldCompletionProvider() { @Override protected void addCompletionVariants(@NotNull String text, int offset, @NotNull String prefix, @NotNull CompletionResultSet result) { final String className = getClassName(); if (className.trim().length() == 0) { return; } final PsiClass testClass = getModuleSelector().findClass(className); if (testClass == null) return; final JUnitUtil.TestMethodFilter filter = new JUnitUtil.TestMethodFilter(testClass); for (PsiMethod psiMethod : testClass.getAllMethods()) { if (filter.value(psiMethod)) { result.addElement(LookupElementBuilder.create(psiMethod.getName())); } } } }.apply(textFieldWithBrowseButton.getChildComponent()); myMethod.setComponent(textFieldWithBrowseButton); }
public DummyHolder(@Nonnull PsiManager manager, CharTable table, boolean validity) { this(manager, null, null, table, Boolean.valueOf(validity), PlainTextLanguage.INSTANCE); }
public DummyHolder(@Nonnull PsiManager manager, @Nullable TreeElement contentElement, PsiElement context, @Nullable CharTable table) { this(manager, contentElement, context, table, null, language(context, PlainTextLanguage.INSTANCE)); }
ScratchFileType() { super(PlainTextLanguage.INSTANCE); }