当前位置: 首页>>代码示例>>Java>>正文


Java DocumentAdapter类代码示例

本文整理汇总了Java中com.intellij.openapi.editor.event.DocumentAdapter的典型用法代码示例。如果您正苦于以下问题:Java DocumentAdapter类的具体用法?Java DocumentAdapter怎么用?Java DocumentAdapter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DocumentAdapter类属于com.intellij.openapi.editor.event包,在下文中一共展示了DocumentAdapter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: GCMStructureViewModel

import com.intellij.openapi.editor.event.DocumentAdapter; //导入依赖的package包/类
public GCMStructureViewModel(@NotNull PsiFile psiFile, @NotNull final GCMStructureViewRootElement root, Editor editor) {
    super(psiFile, root);
    withSorters(typeSorter, Sorter.ALPHA_SORTER);
    editor.getDocument().addDocumentListener(new DocumentAdapter() {
        @Override
        public void documentChanged(DocumentEvent event) {
            synchronized (needRefresh) {
                needRefresh = true;
            }
        }
    });
    executor.scheduleAtFixedRate(new Runnable() {
        @Override
        public void run() {
            GCMStructureViewModel.this.refreshView();
        }
    }, 15, 5, TimeUnit.SECONDS);

}
 
开发者ID:datathings,项目名称:greycat-idea-plugin,代码行数:20,代码来源:GCMStructureViewModel.java

示例2: createEditor

import com.intellij.openapi.editor.event.DocumentAdapter; //导入依赖的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

示例3: setupPathComponent

import com.intellij.openapi.editor.event.DocumentAdapter; //导入依赖的package包/类
private void setupPathComponent(final JPanel northPanel) {
  northPanel.add(new TextFieldAction() {
    @Override
    public void linkSelected(LinkLabel aSource, Object aLinkData) {
      toggleShowPathComponent(northPanel, this);
    }
  }, BorderLayout.EAST);
  myPathEditor = new EditorTextField(JavaReferenceEditorUtil.createDocument("", myProject, false), myProject, StdFileTypes.JAVA);
  myPathEditor.addDocumentListener(new DocumentAdapter() {
    @Override
    public void documentChanged(DocumentEvent e) {
      myAlarm.cancelAllRequests();
      myAlarm.addRequest(new Runnable() {
        @Override
        public void run() {
          updateTreeFromPath();
        }
      }, 300);
    }
  });
  myPathEditor.setBorder(BorderFactory.createEmptyBorder(0, 0, 2, 0));
  northPanel.add(myPathEditor, BorderLayout.SOUTH);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:PackageChooserDialog.java

示例4: testDocSynchronizerPrefersLineBoundaryChanges

import com.intellij.openapi.editor.event.DocumentAdapter; //导入依赖的package包/类
public void testDocSynchronizerPrefersLineBoundaryChanges() throws Exception {
  String text = "import java.awt.List;\n" +
                  "[import java.util.ArrayList;\n]" +
                  "import java.util.HashMap;\n" +
                  "import java.util.Map;";
  RangeMarker marker = createMarker(text);
  synchronizer.startTransaction(getProject(), document, psiFile);

  String newText = StringUtil.replaceSubstring(document.getText(), TextRange.create(marker), "");
  synchronizer.replaceString(document, 0, document.getTextLength(), newText);

  final List<DocumentEvent> events = new ArrayList<DocumentEvent>();
  document.addDocumentListener(new DocumentAdapter() {
    @Override
    public void documentChanged(DocumentEvent e) {
      events.add(e);
    }
  });
  synchronizer.commitTransaction(document);

  assertEquals(newText, document.getText());
  DocumentEvent event = assertOneElement(events);
  assertEquals("DocumentEventImpl[myOffset=22, myOldLength=28, myNewLength=0, myOldString='import java.util.ArrayList;\n', myNewString=''].", event.toString());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:RangeMarkerTest.java

示例5: SearchSupport

import com.intellij.openapi.editor.event.DocumentAdapter; //导入依赖的package包/类
public SearchSupport(EditorTextField textField) {

    myTextField = textField;
    myTextField.getDocument().addDocumentListener(new DocumentAdapter() {
      @Override
      public void documentChanged(DocumentEvent event) {
        onTextChanged();
      }
    });

    //noinspection SSBasedInspection
    SwingUtilities.invokeLater(new Runnable() {
      @Override
      public void run() {
        myTextField.addKeyListener(new KeyAdapter() {
          public void keyPressed(final KeyEvent e) {
              processListSelection(e);
          }
        });
      }
    });
    
    myList.setVisibleRowCount(10);
    myListModel = new SortedListModel<T>(null);
    myList.setModel(myListModel);
  }
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:SearchSupport.java

示例6: createEditorInPanel

import com.intellij.openapi.editor.event.DocumentAdapter; //导入依赖的package包/类
private Editor createEditorInPanel(String string) {
    EditorFactory editorFactory = EditorFactory.getInstance();
    Editor editor = editorFactory.createEditor(editorFactory.createDocument(string));

    EditorSettings editorSettings = editor.getSettings();
    editorSettings.setVirtualSpace(false);
    editorSettings.setLineMarkerAreaShown(false);
    editorSettings.setIndentGuidesShown(false);
    editorSettings.setLineNumbersShown(false);
    editorSettings.setFoldingOutlineShown(false);
    editorSettings.setAdditionalColumnsCount(3);
    editorSettings.setAdditionalLinesCount(3);

    editor.getDocument().addDocumentListener(new DocumentAdapter() {
        @Override
        public void documentChanged(DocumentEvent e) {
            onTextChanged();
        }
    });

    ((EditorEx) editor).setHighlighter(getEditorHighlighter());

    addEditorToPanel(editor);

    return editor;
}
 
开发者ID:cooliean,项目名称:android-codegenerator-plugin-intellij,代码行数:27,代码来源:TemplateConfigurable.java

示例7: LazyRangeMarkerFactory

import com.intellij.openapi.editor.event.DocumentAdapter; //导入依赖的package包/类
public LazyRangeMarkerFactory(@NotNull Project project, @NotNull final FileDocumentManager fileDocumentManager) {
  super(project);
  EditorFactory.getInstance().getEventMulticaster().addDocumentListener(new DocumentAdapter() {
    @Override
    public void beforeDocumentChange(DocumentEvent e) {
      VirtualFile docFile = fileDocumentManager.getFile(e.getDocument());
      if (docFile == null) return;
      WeakList<LazyMarker> lazyMarkers = myMarkers.get(docFile);
      if (lazyMarkers == null) return;

      List<LazyMarker> markers = lazyMarkers.toStrongList();
      List<LazyMarker> markersToRemove = new ArrayList<LazyMarker>();
      for (final LazyMarker marker : markers) {
        if (Comparing.equal(marker.getFile(), docFile)) {
          marker.getOrCreateDelegate();
          markersToRemove.add(marker);
        }
      }
      lazyMarkers.removeAll(markersToRemove);
    }
  }, project);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:LazyRangeMarkerFactory.java

示例8: testDocSynchronizerPrefersLineBoundaryChanges

import com.intellij.openapi.editor.event.DocumentAdapter; //导入依赖的package包/类
public void testDocSynchronizerPrefersLineBoundaryChanges() throws Exception {
  RangeMarker marker = createMarker("import java.awt.List;\n" +
                                    "[import java.util.ArrayList;\n]" +
                                    "import java.util.HashMap;\n" +
                                    "import java.util.Map;");
  PsiToDocumentSynchronizer synchronizer = ((PsiDocumentManagerImpl)PsiDocumentManager.getInstance(getProject())).getSynchronizer();
  Document document = marker.getDocument();
  synchronizer.startTransaction(getProject(), document, null);

  String newText = StringUtil.replaceSubstring(document.getText(), TextRange.create(marker), "");
  synchronizer.replaceString(document, 0, document.getTextLength(), newText);

  final List<DocumentEvent> events = new ArrayList<DocumentEvent>();
  document.addDocumentListener(new DocumentAdapter() {
    @Override
    public void documentChanged(DocumentEvent e) {
      events.add(e);
    }
  });
  synchronizer.doCommitTransaction(document);

  assertEquals(newText, document.getText());
  DocumentEvent event = assertOneElement(events);
  assertEquals("DocumentEventImpl[myOffset=22, myOldLength=28, myNewLength=0, myOldString='import java.util.ArrayList;\n', myNewString=''].", event.toString());
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:26,代码来源:RangeMarkerTest.java

示例9: init

import com.intellij.openapi.editor.event.DocumentAdapter; //导入依赖的package包/类
private void init() {
    this.field = new EditorTextField("", project, com.jetbrains.php.lang.PhpFileType.INSTANCE);

    PhpCompletionUtil.installClassCompletion(this.field, null, getDisposable());

    this.field.getDocument().addDocumentListener(new DocumentAdapter() {
        @Override
        public void documentChanged(DocumentEvent e) {
            String text = field.getText();
            if (StringUtil.isEmpty(text) || StringUtil.endsWith(text, "\\")) {
                return;
            }

            addUpdateRequest(250, () -> consumer.consume(field.getText()));
        }
    });

    GridBagConstraints gbConstraints = new GridBagConstraints();
    gbConstraints.fill = 1;
    gbConstraints.weightx = 1.0D;
    gbConstraints.gridx = 1;
    gbConstraints.gridy = 1;

    panel.add(field, gbConstraints);
}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:26,代码来源:ClassCompletionPanelWrapper.java

示例10: createManualInputPreviewEditor

import com.intellij.openapi.editor.event.DocumentAdapter; //导入依赖的package包/类
public void createManualInputPreviewEditor(final PreviewState previewState) {
	final EditorFactory factory = EditorFactory.getInstance();
	Document doc = factory.createDocument(previewState.manualInputText);
	doc.addDocumentListener(
		new DocumentAdapter() {
			@Override
			public void documentChanged(DocumentEvent e) {
				previewState.manualInputText = e.getDocument().getCharsSequence();
			}
		}
	                       );

	Editor editor = createPreviewEditor(previewState.grammarFile, doc);
	setEditorComponent(editor.getComponent()); // do before setting state
	previewState.setInputEditor(editor);
}
 
开发者ID:antlr,项目名称:intellij-plugin-v4,代码行数:17,代码来源:InputPanel.java

示例11: testDocSynchronizerPrefersLineBoundaryChanges

import com.intellij.openapi.editor.event.DocumentAdapter; //导入依赖的package包/类
public void testDocSynchronizerPrefersLineBoundaryChanges() throws Exception {
  String text = "import java.awt.List;\n" +
                "[import java.util.ArrayList;\n]" +
                "import java.util.HashMap;\n" +
                "import java.util.Map;";
  RangeMarker marker = createMarker(text);
  synchronizer.startTransaction(getProject(), document, psiFile);

  String newText = StringUtil.replaceSubstring(document.getText(), TextRange.create(marker), "");
  synchronizer.replaceString(document, 0, document.getTextLength(), newText);

  final List<DocumentEvent> events = new ArrayList<DocumentEvent>();
  document.addDocumentListener(new DocumentAdapter() {
    @Override
    public void documentChanged(DocumentEvent e) {
      events.add(e);
    }
  });
  synchronizer.commitTransaction(document);

  assertEquals(newText, document.getText());
  DocumentEvent event = assertOneElement(events);
  assertEquals("DocumentEventImpl[myOffset=22, myOldLength=28, myNewLength=0, myOldString='import java.util.ArrayList;\n', myNewString=''].", event.toString());
}
 
开发者ID:consulo,项目名称:consulo,代码行数:25,代码来源:RangeMarkerTest.java

示例12: EncodingManagerImpl

import com.intellij.openapi.editor.event.DocumentAdapter; //导入依赖的package包/类
public EncodingManagerImpl(@Nonnull EditorFactory editorFactory) {
  editorFactory.getEventMulticaster().addDocumentListener(new DocumentAdapter() {
    @Override
    public void documentChanged(DocumentEvent e) {
      Document document = e.getDocument();
      if (isEditorOpenedFor(document)) {
        queueUpdateEncodingFromContent(document);
      }
    }
  }, this);
  editorFactory.addEditorFactoryListener(new EditorFactoryAdapter() {
    @Override
    public void editorCreated(@Nonnull EditorFactoryEvent event) {
      queueUpdateEncodingFromContent(event.getEditor().getDocument());
    }
  }, this);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:EncodingManagerImpl.java

示例13: createUIComponents

import com.intellij.openapi.editor.event.DocumentAdapter; //导入依赖的package包/类
private void createUIComponents() {
  List<Language> languages = getBaseLanguagesWithProviders();

  Language selected = myInitiallySelectedLanguage;
  if (selected == null) {
    selected = languages.get(0);
  }

  String text = getLanguageBlackList(selected);
  myEditorTextField = createEditor(text, myNewPreselectedItem);
  myEditorTextField.addDocumentListener(new DocumentAdapter() {
    @Override
    public void documentChanged(DocumentEvent e) {
      updateOkEnabled();
    }
  });

  myDoNotShowIfParameterNameContainedInMethodName = new JBCheckBox();
  myShowWhenMultipleParamsWithSameType = new JBCheckBox();

  ParameterNameHintsSettings settings = ParameterNameHintsSettings.getInstance();
  myDoNotShowIfParameterNameContainedInMethodName.setSelected(settings.isDoNotShowIfMethodNameContainsParameterName());
  myShowWhenMultipleParamsWithSameType.setSelected(settings.isShowForParamsWithSameType());

  initLanguageCombo(languages, selected);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:27,代码来源:ParameterNameHintsConfigurable.java

示例14: ActionTracker

import com.intellij.openapi.editor.event.DocumentAdapter; //导入依赖的package包/类
ActionTracker(Editor editor, Disposable parentDisposable) {
  myEditor = editor;
  myProject = editor.getProject();
  ActionManager.getInstance().addAnActionListener(new AnActionListener.Adapter() {
    @Override
    public void beforeActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event) {
      myActionsHappened = true;
    }
  }, parentDisposable);
  myEditor.getDocument().addDocumentListener(new DocumentAdapter() {
    @Override
    public void documentChanged(DocumentEvent e) {
      if (!myIgnoreDocumentChanges) {
        myActionsHappened = true;
      }
    }
  }, parentDisposable);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:19,代码来源:ActionTracker.java

示例15: createDocumentListener

import com.intellij.openapi.editor.event.DocumentAdapter; //导入依赖的package包/类
@NotNull
private static DocumentAdapter createDocumentListener(final ItemInfo itemInfo, final JBDebuggerFormTable table) {
    return new DocumentAdapter() {
        @Override
        public void documentChanged(DocumentEvent documentEvent) {
            if (table.getRowCount() == table.getEditingRow() + 1) {
                itemInfo.enabled = true;
                itemInfo.checked = true;
                table.getListTableModel().addRow(new ItemInfo());
            }
        }
    };
}
 
开发者ID:FingerArt,项目名称:ApiDebugger,代码行数:14,代码来源:JBDebuggerFormTable.java


注:本文中的com.intellij.openapi.editor.event.DocumentAdapter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。