當前位置: 首頁>>代碼示例>>Java>>正文


Java EditorFactory.createDocument方法代碼示例

本文整理匯總了Java中com.intellij.openapi.editor.EditorFactory.createDocument方法的典型用法代碼示例。如果您正苦於以下問題:Java EditorFactory.createDocument方法的具體用法?Java EditorFactory.createDocument怎麽用?Java EditorFactory.createDocument使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.openapi.editor.EditorFactory的用法示例。


在下文中一共展示了EditorFactory.createDocument方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createUIComponents

import com.intellij.openapi.editor.EditorFactory; //導入方法依賴的package包/類
private void createUIComponents() {
    final EditorFactory editorFactory = EditorFactory.getInstance();
    previewDocument = editorFactory.createDocument(EMPTY_TEXT);
    previewEditor = editorFactory.createEditor(previewDocument, null, JavaFileType.INSTANCE, true);

    final EditorSettings settings = previewEditor.getSettings();
    settings.setWhitespacesShown(true);
    settings.setLineMarkerAreaShown(false);
    settings.setIndentGuidesShown(false);
    settings.setLineNumbersShown(false);
    settings.setFoldingOutlineShown(false);
    settings.setRightMarginShown(false);
    settings.setVirtualSpace(false);
    settings.setWheelFontChangeEnabled(false);
    settings.setUseSoftWraps(false);
    settings.setAdditionalColumnsCount(0);
    settings.setAdditionalLinesCount(1);

    previewPanel = (JPanel) previewEditor.getComponent();
    previewPanel.setName(PREVIEW_PANEL_NAME);
    previewPanel.setPreferredSize(new Dimension(PREFERRED_PREVIEW_WIDTH, PREFERRED_PREVIEW_HEIGHT));
}
 
開發者ID:t28hub,項目名稱:json2java4idea,代碼行數:23,代碼來源:SettingsPanel.java

示例2: createUIComponents

import com.intellij.openapi.editor.EditorFactory; //導入方法依賴的package包/類
private void createUIComponents() {
    final EditorFactory editorFactory = EditorFactory.getInstance();
    jsonDocument = editorFactory.createDocument(EMPTY_TEXT);
    jsonEditor = editorFactory.createEditor(jsonDocument, project, JsonFileType.INSTANCE, false);

    final EditorSettings settings = jsonEditor.getSettings();
    settings.setWhitespacesShown(true);
    settings.setLineMarkerAreaShown(false);
    settings.setIndentGuidesShown(false);
    settings.setLineNumbersShown(true);
    settings.setFoldingOutlineShown(false);
    settings.setRightMarginShown(false);
    settings.setVirtualSpace(false);
    settings.setWheelFontChangeEnabled(false);
    settings.setUseSoftWraps(false);
    settings.setAdditionalColumnsCount(0);
    settings.setAdditionalLinesCount(1);

    final EditorColorsScheme colorsScheme = jsonEditor.getColorsScheme();
    colorsScheme.setColor(EditorColors.CARET_ROW_COLOR, null);

    jsonEditor.getContentComponent().setFocusable(true);
    jsonPanel = (JPanel) jsonEditor.getComponent();
}
 
開發者ID:t28hub,項目名稱:json2java4idea,代碼行數:25,代碼來源:NewClassDialog.java

示例3: createEditor

import com.intellij.openapi.editor.EditorFactory; //導入方法依賴的package包/類
private Editor createEditor() {
    PsiFile myFile = null;
    EditorFactory editorFactory = EditorFactory.getInstance();
    Document doc = myFile == null
            ? editorFactory.createDocument("")
            : PsiDocumentManager.getInstance(mProject).getDocument(myFile);
    Editor editor = editorFactory.createEditor(doc, mProject);
    EditorSettings editorSettings = editor.getSettings();
    editorSettings.setVirtualSpace(false);
    editorSettings.setLineMarkerAreaShown(false);
    editorSettings.setIndentGuidesShown(false);
    editorSettings.setFoldingOutlineShown(true);
    editorSettings.setAdditionalColumnsCount(3);
    editorSettings.setAdditionalLinesCount(3);
    editorSettings.setLineNumbersShown(true);
    editorSettings.setCaretRowShown(true);

    editor.getDocument().addDocumentListener(new DocumentAdapter() {
        @Override
        public void documentChanged(DocumentEvent e) {
        }
    });
    ((EditorEx) editor).setHighlighter(createHighlighter(FileTypes.PLAIN_TEXT));
    return editor;
}
 
開發者ID:FingerArt,項目名稱:ApiDebugger,代碼行數:26,代碼來源:ResponseBodyWidget.java

示例4: createEditorPanel

import com.intellij.openapi.editor.EditorFactory; //導入方法依賴的package包/類
public static StacktraceEditorPanel createEditorPanel(Project project, @NotNull Disposable parentDisposable) {
  EditorFactory editorFactory = EditorFactory.getInstance();
  Document document = editorFactory.createDocument("");
  Editor editor = editorFactory.createEditor(document, project);
  EditorSettings settings = editor.getSettings();
  settings.setFoldingOutlineShown(false);
  settings.setLineMarkerAreaShown(false);
  settings.setIndentGuidesShown(false);
  settings.setLineNumbersShown(false);
  settings.setRightMarginShown(false);

  StacktraceEditorPanel editorPanel = new StacktraceEditorPanel(project, editor);
  editorPanel.setPreferredSize(JBUI.size(600, 400));
  Disposer.register(parentDisposable, editorPanel);
  return editorPanel;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:17,代碼來源:AnalyzeStacktraceUtil.java

示例5: addVmEditor

import com.intellij.openapi.editor.EditorFactory; //導入方法依賴的package包/類
private void addVmEditor(String template) {
    EditorFactory factory = EditorFactory.getInstance();
    Document velocityTemplate = factory.createDocument(template);
    editor = factory.createEditor(velocityTemplate, null, FileTypeManager.getInstance()
        .getFileTypeByExtension("vm"), false);
    GridConstraints constraints = new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST,
        GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW,
        GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(300, 300), null, 0, true);
    editorPane.add(editor.getComponent(), constraints);
}
 
開發者ID:zeng198821,項目名稱:CodeGenerate,代碼行數:11,代碼來源:TemplateEditPane.java

示例6: SimpleContent

import com.intellij.openapi.editor.EditorFactory; //導入方法依賴的package包/類
public SimpleContent(@NotNull String text, FileType type, EditorFactory f) {
  myOriginalBytes = text.getBytes();
  myOriginalText = myLineSeparators.correctText(text);
  myDocument = f.createDocument(myOriginalText);
  setReadOnly(true);
  myType = type;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:8,代碼來源:SimpleContent.java

示例7: createViewComponentEditor

import com.intellij.openapi.editor.EditorFactory; //導入方法依賴的package包/類
@Nullable
protected Editor createViewComponentEditor(Project project, @Nullable byte[] content, @Nullable FileType fileType) {
  EditorFactory editorFactory = EditorFactory.getInstance();
  if (editorFactory == null) return null;
  T value = getValue();
  Document document = value instanceof VirtualFile
                      ? FileDocumentManager.getInstance().getDocument((VirtualFile)value)
                      : editorFactory.createDocument(StringUtil.convertLineSeparators(new String(content)));

  if (document != null && fileType != null) {
    return editorFactory.createEditor(document, project, fileType, true);
  }
  return null;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:15,代碼來源:DiffElement.java

示例8: createEditor

import com.intellij.openapi.editor.EditorFactory; //導入方法依賴的package包/類
private Editor createEditor() {
  final EditorFactory editorFactory = EditorFactory.getInstance();
  final Document document = editorFactory.createDocument("");
  final Editor editor = editorFactory.createViewer(document, myProject);
  ((EditorEx)editor).setHighlighter(HighlighterFactory.createHighlighter(myProject, myFileName));
  return editor;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:8,代碼來源:CallerChooserBase.java

示例9: GenerateTemplateConfigurable

import com.intellij.openapi.editor.EditorFactory; //導入方法依賴的package包/類
public GenerateTemplateConfigurable(TemplateResource template, Map<String, PsiType> contextMap, Project project, boolean multipleFields) {
  this.template = template;
  final EditorFactory factory = EditorFactory.getInstance();
  Document doc = factory.createDocument(template.getTemplate());
  final FileType ftl = FileTypeManager.getInstance().findFileTypeByName("VTL");
  if (project != null && ftl != null) {
    final PsiFile file = PsiFileFactory.getInstance(project)
        .createFileFromText(template.getFileName(), ftl, template.getTemplate(), LocalTimeCounter.currentTime(), true);
    if (!template.isDefault()) {
      final HashMap<String, PsiType> map = new LinkedHashMap<String, PsiType>();
      map.put("java_version", PsiType.INT);
      map.put("class", TemplatesManager.createElementType(project, ClassElement.class));
      if (multipleFields) {
        map.put("fields", TemplatesManager.createFieldListElementType(project));
      } 
      else {
        map.put("field", TemplatesManager.createElementType(project, FieldElement.class));
      }
      map.put("helper", TemplatesManager.createElementType(project, GenerationHelper.class));
      map.put("settings", PsiType.NULL);
      map.putAll(contextMap);
      availableImplicits.addAll(map.keySet());
      file.getViewProvider().putUserData(TemplatesManager.TEMPLATE_IMPLICITS, map);
    }
    final Document document = PsiDocumentManager.getInstance(project).getDocument(file);
    if (document != null) {
      doc = document;
    }
  }
  myEditor = factory.createEditor(doc, project, ftl != null ? ftl : FileTypes.PLAIN_TEXT, template.isDefault());
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:32,代碼來源:GenerateTemplateConfigurable.java

示例10: createEditor

import com.intellij.openapi.editor.EditorFactory; //導入方法依賴的package包/類
@NotNull
private static Editor createEditor() {
	EditorFactory editorFactory = EditorFactory.getInstance();
	Document editorDocument = editorFactory.createDocument("");
	return editorFactory.createEditor(editorDocument, null, CptFileType.INSTANCE, true);
}
 
開發者ID:xylo,項目名稱:intellij-postfix-templates,代碼行數:7,代碼來源:CptPluginSettingsForm.java


注:本文中的com.intellij.openapi.editor.EditorFactory.createDocument方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。