本文整理汇总了Java中com.intellij.openapi.fileTypes.FileTypes.PLAIN_TEXT属性的典型用法代码示例。如果您正苦于以下问题:Java FileTypes.PLAIN_TEXT属性的具体用法?Java FileTypes.PLAIN_TEXT怎么用?Java FileTypes.PLAIN_TEXT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.intellij.openapi.fileTypes.FileTypes
的用法示例。
在下文中一共展示了FileTypes.PLAIN_TEXT属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fromTemplate
/**
* @param templateFile Name of the generated file
* @param destinationPath Relative path to the target file system entry
* @param extensionDefinition Extension definition containing all relevant metadata
* @param context Template Context variables
* @param project Project in context
*/
public static PsiElement fromTemplate(@NotNull String templateFile, @NotNull String destinationPath, @NotNull String destinationFileName, @NotNull TYPO3ExtensionDefinition extensionDefinition, @NotNull Map<String, String> context, Project project) {
String template = readTemplateToString(templateFile, context);
VirtualFile targetDirectory = getOrCreateDestinationPath(extensionDefinition.getRootDirectory(), destinationPath);
LanguageFileType fileType = FileTypes.PLAIN_TEXT;
if (templateFile.endsWith(".php")) {
fileType = PhpFileType.INSTANCE;
}
PsiFile fileFromText = PsiFileFactory.getInstance(project).createFileFromText(destinationFileName, fileType, template);
CodeStyleManager.getInstance(project).reformat(fileFromText);
return PsiDirectoryFactory
.getInstance(project)
.createDirectory(targetDirectory)
.add(fileFromText);
}
示例2: createUIComponents
private void createUIComponents() {
testTargetTextField = new EditorTextField("", getProject(), FileTypes.PLAIN_TEXT);
namespaceComboBox = new PhpNamespaceComboBox(getProject(), "", getDisposable());
directoryComboBox = new PhpPsrDirectoryComboBox(getProject()) {
@Override
public void init(@NotNull VirtualFile baseDir, @NotNull String namespace) {
super.init(baseDir, namespace);
ProjectFileIndex index = ProjectRootManager.getInstance(TesterNewTestCaseDialog.this.getProject()).getFileIndex();
this.setDirectoriesFilter(index::isInTestSourceContent);
this.updateDirectories(TesterNewTestCaseDialog.this.getNamespace());
}
};
classToTestLabel = new JBLabel(TesterBundle.message("dialog.newTestCase.label.classToTest"));
testClassLabel = new JBLabel(TesterBundle.message("dialog.newTestCase.label.testClass"));
namespaceLabel = new JBLabel(TesterBundle.message("dialog.newTestCase.label.namespace"));
fileNameLabel = new JBLabel(TesterBundle.message("dialog.newTestCase.label.fileName"));
directoryLabel = new JBLabel(TesterBundle.message("dialog.newTestCase.label.directory"));
testTargetCompletionHint = new JBLabel(UIUtil.ComponentStyle.MINI);
namespaceCompletionHint = new JBLabel(UIUtil.ComponentStyle.MINI);
directoryCompletionHint = new JBLabel(UIUtil.ComponentStyle.MINI);
}
示例3: checkHardcodedCharsetFileType
@NotNull
static Pair<Charset, String> checkHardcodedCharsetFileType(@NotNull VirtualFile virtualFile) {
FileType fileType = virtualFile.getFileType();
if (fileType.isBinary()) return Pair.create(null, "binary file");
// in lesser IDEs all special file types are plain text so check for that first
if (fileType == FileTypes.PLAIN_TEXT) return Pair.create(null, null);
if (fileType == StdFileTypes.GUI_DESIGNER_FORM) return Pair.create(CharsetToolkit.UTF8_CHARSET, "IDEA GUI Designer form");
if (fileType == StdFileTypes.IDEA_MODULE) return Pair.create(CharsetToolkit.UTF8_CHARSET, "IDEA module file");
if (fileType == StdFileTypes.IDEA_PROJECT) return Pair.create(CharsetToolkit.UTF8_CHARSET, "IDEA project file");
if (fileType == StdFileTypes.IDEA_WORKSPACE) return Pair.create(CharsetToolkit.UTF8_CHARSET, "IDEA workspace file");
if (fileType == StdFileTypes.PROPERTIES) return Pair.create(virtualFile.getCharset(), ".properties file");
if (fileType == StdFileTypes.XML || fileType == StdFileTypes.JSPX) {
return Pair.create(virtualFile.getCharset(), "XML file");
}
return Pair.create(null, null);
}
示例4: createNewNameComponent
protected void createNewNameComponent() {
String[] suggestedNames = getSuggestedNames();
myOldName = UsageViewUtil.getShortName(myPsiElement);
myNameSuggestionsField = new NameSuggestionsField(suggestedNames, myProject, FileTypes.PLAIN_TEXT, myEditor) {
@Override
protected boolean shouldSelectAll() {
return myEditor == null || myEditor.getSettings().isPreselectRename();
}
};
if (myPsiElement instanceof PsiFile && myEditor == null) {
myNameSuggestionsField.selectNameWithoutExtension();
}
myNameChangedListener = new NameSuggestionsField.DataChanged() {
@Override
public void dataChanged() {
processNewNameChanged();
}
};
myNameSuggestionsField.addDataChangedListener(myNameChangedListener);
}
示例5: ReplacementPreviewDialog
public ReplacementPreviewDialog(final Project project, UsageInfo info, String replacementString) {
super(project,true);
setTitle(SSRBundle.message("structural.replace.preview.dialog.title"));
setOKButtonText(SSRBundle.message("replace.preview.oktext"));
this.project = project;
final PsiElement element = info.getElement();
final VirtualFile virtualFile = PsiUtilCore.getVirtualFile(element);
myFileType = virtualFile != null ? virtualFile.getFileType() : FileTypes.PLAIN_TEXT;
init();
Segment range = info.getSegment();
hilight(virtualFile, range.getStartOffset(), range.getEndOffset());
UIUtil.setContent(replacement, replacementString,0,-1,project);
final StructuralSearchProfile profile = StructuralSearchUtil.getProfileByPsiElement(element);
if (profile != null) {
UIUtil.updateHighlighter(replacement, profile);
}
}
示例6: createNewNameComponent
private void createNewNameComponent() {
myNameSuggestionsField = new NameSuggestionsField(new String[] { myTag.getName() }, myProject, FileTypes.PLAIN_TEXT, myEditor);
myNameChangedListener = new NameSuggestionsField.DataChanged() {
@Override
public void dataChanged() {
validateButtons();
}
};
myNameSuggestionsField.addDataChangedListener(myNameChangedListener);
myNameSuggestionsField.getComponent().registerKeyboardAction(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
completeVariable(myNameSuggestionsField.getEditor());
}
}, KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, InputEvent.CTRL_MASK), JComponent.WHEN_IN_FOCUSED_WINDOW);
}
示例7: copyOldIndentOptions
private void copyOldIndentOptions(@NonNls final String extension, final IndentOptions options) {
final FileType fileType = FileTypeManager.getInstance().getFileTypeByExtension(extension);
if (fileType != FileTypes.UNKNOWN && fileType != FileTypes.PLAIN_TEXT && !myAdditionalIndentOptions.containsKey(fileType) &&
!fileType.getDefaultExtension().isEmpty()) {
registerAdditionalIndentOptions(fileType, options);
//
// Upgrade to version 11
//
if (fileType instanceof LanguageFileType) {
Language lang = ((LanguageFileType)fileType).getLanguage();
CommonCodeStyleSettings langSettings = myCommonSettingsManager.getCommonSettings(lang);
if (langSettings != this && langSettings.getIndentOptions() != null) {
langSettings.importOldIndentOptions(this);
}
}
}
}
示例8: RevealingSpaceComboboxEditor
public RevealingSpaceComboboxEditor(final Project project, ComboBox comboBox) {
super(project, FileTypes.PLAIN_TEXT, comboBox);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
Editor editor = getEditor();
if (editor != null) {
editor.getSettings().setWhitespacesShown(true);
}
}
});
}
示例9: TextViewer
public TextViewer(@NotNull Document document, @NotNull Project project, boolean embeddedIntoDialogWrapper, boolean useSoftWraps) {
super(document, project, FileTypes.PLAIN_TEXT, true, false);
myEmbeddedIntoDialogWrapper = embeddedIntoDialogWrapper;
myUseSoftWraps = useSoftWraps;
setFontInheritedFromLAF(false);
}
示例10: BaseInjectionPanel
public BaseInjectionPanel(BaseInjection injection, Project project) {
super(injection, project);
$$$setupUI$$$(); // see IDEA-9987
myHelper = injection.getCompiler();
final FileType groovy = FileTypeManager.getInstance().getFileTypeByExtension("groovy");
final FileType realFileType = groovy == UnknownFileType.INSTANCE ? FileTypes.PLAIN_TEXT : groovy;
final PsiFile psiFile = PsiFileFactory.getInstance(project).createFileFromText("injection." + realFileType.getDefaultExtension(), realFileType, "", 0, true);
final Document document = PsiDocumentManager.getInstance(project).getDocument(psiFile);
psiFile.putUserData(BaseInjection.INJECTION_KEY, injection);
myTextArea = new EditorTextField(document, project, realFileType) {
@Override
protected EditorEx createEditor() {
final EditorEx ex = super.createEditor();
ex.setVerticalScrollbarVisible(true);
ex.setHorizontalScrollbarVisible(true);
return ex;
}
@Override
protected boolean isOneLineMode() {
return false;
}
};
myCenterPanel.add(myTextArea, BorderLayout.CENTER);
myTextArea.setFontInheritedFromLAF(false);
//myTextArea.setFont(EditorColorsManager.getInstance().getGlobalScheme().getFont(EditorFontType.PLAIN));
init(injection.copy());
}
示例11: childrenChanged
protected void childrenChanged(PsiElement parent, final boolean stopProcessingForThisModificationCount) {
if (parent instanceof PsiDirectory && isFlattenPackages()){
getUpdater().addSubtreeToUpdate(getRootNode());
return;
}
long newModificationCount = myModificationTracker.getOutOfCodeBlockModificationCount();
if (newModificationCount == myOutOfCodeBlockModificationCount) return;
if (stopProcessingForThisModificationCount) {
myOutOfCodeBlockModificationCount = newModificationCount;
}
while (true) {
if (parent == null) break;
if (parent instanceof PsiFile) {
VirtualFile virtualFile = ((PsiFile)parent).getVirtualFile();
if (virtualFile != null && virtualFile.getFileType() != FileTypes.PLAIN_TEXT) {
// adding a class within a file causes a new node to appear in project view => entire dir should be updated
parent = ((PsiFile)parent).getContainingDirectory();
if (parent == null) break;
}
}
if (getUpdater().addSubtreeToUpdateByElement(parent)) {
break;
}
if (parent instanceof PsiFile || parent instanceof PsiDirectory) break;
parent = parent.getParent();
}
}
示例12: createNewNameComponent
private void createNewNameComponent() {
myNameSuggestionsField = new NameSuggestionsField(new String[] { myTag.getName() }, myProject, FileTypes.PLAIN_TEXT, myEditor);
myNameChangedListener = new NameSuggestionsField.DataChanged() {
public void dataChanged() {
validateButtons();
}
};
myNameSuggestionsField.addDataChangedListener(myNameChangedListener);
myNameSuggestionsField.getComponent().registerKeyboardAction(new ActionListener() {
public void actionPerformed(ActionEvent e) {
completeVariable(myNameSuggestionsField.getEditor());
}
}, KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, InputEvent.CTRL_MASK), JComponent.WHEN_IN_FOCUSED_WINDOW);
}
示例13: getFileType
@SuppressWarnings("ConstantConditions")
@NotNull
@Override
protected FileType getFileType() {
Language language = getDefaultLanguage();
return language != null ? language.getAssociatedFileType() : FileTypes.PLAIN_TEXT;
}
示例14: getFileType
@Override
@NotNull
protected FileType getFileType() {
FileTypeIndentOptionsProvider provider = getSelectedIndentProvider();
if (provider == null) return FileTypes.PLAIN_TEXT;
return provider.getFileType();
}
示例15: getContentType
public FileType getContentType() {
return myData == null ? FileTypes.PLAIN_TEXT : getContentType(myData);
}