• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DocumentAdapter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: createNorthPanel

import com.intellij.openapi.editor.event.DocumentAdapter; //导入依赖的package包/类
protected JComponent createNorthPanel() {
  JPanel panel = new JPanel(new BorderLayout());

  JPanel _panel;
  Box box = Box.createVerticalBox();

  _panel = new JPanel(new BorderLayout());
  JTextField sourceClassField = new JTextField();
  sourceClassField.setText(mySourceClassName);
  sourceClassField.setEditable(false);
  _panel.add(new JLabel(RefactoringBundle.message("move.members.move.members.from.label")), BorderLayout.NORTH);
  _panel.add(sourceClassField, BorderLayout.CENTER);
  box.add(_panel);

  box.add(Box.createVerticalStrut(10));

  _panel = new JPanel(new BorderLayout());
  JLabel label = new JLabel(RefactoringBundle.message("move.members.to.fully.qualified.name.label"));
  label.setLabelFor(myTfTargetClassName);
  _panel.add(label, BorderLayout.NORTH);
  _panel.add(myTfTargetClassName, BorderLayout.CENTER);
  _panel.add(myIntroduceEnumConstants, BorderLayout.SOUTH);
  box.add(_panel);

  myTfTargetClassName.getChildComponent().getDocument().addDocumentListener(new DocumentAdapter() {
    public void documentChanged(DocumentEvent e) {
      myMemberInfoModel.updateTargetClass();
      validateButtons();
    }
  });

  panel.add(box, BorderLayout.CENTER);
  panel.add(Box.createVerticalStrut(10), BorderLayout.SOUTH);

  validateButtons();
  return panel;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:38,代码来源:MoveMembersDialog.java


示例17: createUIComponents

import com.intellij.openapi.editor.event.DocumentAdapter; //导入依赖的package包/类
private void createUIComponents() {
  myMainPanel = new JPanel();

  myWithBrowseButtonReference = createPackageChooser();
  myClassPackageChooser = createPackageChooser();

  GlobalSearchScope scope = JavaProjectRootsUtil.getScopeWithoutGeneratedSources(ProjectScope.getProjectScope(myProject), myProject);
  myInnerClassChooser = new ClassNameReferenceEditor(myProject, null, scope);
  myInnerClassChooser.addDocumentListener(new DocumentAdapter() {
    public void documentChanged(DocumentEvent e) {
      validateButtons();
    }
  });

  // override CardLayout sizing behavior
  myCardPanel = new JPanel() {
    public Dimension getMinimumSize() {
      return myHavePackages ? myMovePackagePanel.getMinimumSize() : myMoveClassPanel.getMinimumSize();
    }

    public Dimension getPreferredSize() {
      return myHavePackages ? myMovePackagePanel.getPreferredSize() : myMoveClassPanel.getPreferredSize();
    }
  };

  myDestinationFolderCB = new DestinationFolderComboBox() {
    @Override
    public String getTargetPackage() {
      return MoveClassesOrPackagesDialog.this.getTargetPackage();
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:MoveClassesOrPackagesDialog.java


示例18: createPackageChooser

import com.intellij.openapi.editor.event.DocumentAdapter; //导入依赖的package包/类
private ReferenceEditorComboWithBrowseButton createPackageChooser() {
  final ReferenceEditorComboWithBrowseButton packageChooser =
    new PackageNameReferenceEditorCombo("", myProject, RECENTS_KEY, RefactoringBundle.message("choose.destination.package"));
  final Document document = packageChooser.getChildComponent().getDocument();
  document.addDocumentListener(new DocumentAdapter() {
    public void documentChanged(DocumentEvent e) {
      validateButtons();
    }
  });
  
  return packageChooser;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:MoveClassesOrPackagesDialog.java


示例19: EncodingManagerImpl

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


示例20: FileStatusManagerImpl

import com.intellij.openapi.editor.event.DocumentAdapter; //导入依赖的package包/类
public FileStatusManagerImpl(Project project, StartupManager startupManager, EditorColorsManager colorsManager,
                             @SuppressWarnings("UnusedParameters") DirectoryIndex makeSureIndexIsInitializedFirst) {
  myProject = project;

  colorsManager.addEditorColorsListener(new EditorColorsListener() {
    @Override
    public void globalSchemeChange(EditorColorsScheme scheme) {
      fileStatusesChanged();
    }
  }, myProject);

  startupManager.registerPreStartupActivity(new Runnable() {
    @Override
    public void run() {
      DocumentAdapter documentListener = new DocumentAdapter() {
        @Override
        public void documentChanged(DocumentEvent event) {
          VirtualFile file = FileDocumentManager.getInstance().getFile(event.getDocument());
          if (file != null) {
            refreshFileStatusFromDocument(file, event.getDocument());
          }
        }
      };

      final EditorFactory factory = EditorFactory.getInstance();
      if (factory != null) {
        factory.getEventMulticaster().addDocumentListener(documentListener, myProject);
      }
    }
  });
  startupManager.registerPostStartupActivity(new DumbAwareRunnable() {
    @Override
    public void run() {
      fileStatusesChanged();
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:38,代码来源:FileStatusManagerImpl.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ServerSetupTest类代码示例发布时间:2022-05-21
下一篇:
Java ExpressionEvaluator类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap