本文整理汇总了Java中com.maddyhome.idea.copyright.actions.UpdateCopyrightProcessor类的典型用法代码示例。如果您正苦于以下问题:Java UpdateCopyrightProcessor类的具体用法?Java UpdateCopyrightProcessor怎么用?Java UpdateCopyrightProcessor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UpdateCopyrightProcessor类属于com.maddyhome.idea.copyright.actions包,在下文中一共展示了UpdateCopyrightProcessor类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: CopyrightManager
import com.maddyhome.idea.copyright.actions.UpdateCopyrightProcessor; //导入依赖的package包/类
public CopyrightManager(@NotNull Project project,
@NotNull final EditorFactory editorFactory,
@NotNull final Application application,
@NotNull final FileDocumentManager fileDocumentManager,
@NotNull final FileTypeUtil fileTypeUtil,
@NotNull final ProjectRootManager projectRootManager,
@NotNull final PsiManager psiManager,
@NotNull StartupManager startupManager) {
super(project);
if (!myProject.isDefault()) {
final NewFileTracker newFileTracker = NewFileTracker.getInstance();
Disposer.register(myProject, new Disposable() {
@Override
public void dispose() {
newFileTracker.clear();
}
});
startupManager.runWhenProjectIsInitialized(new Runnable() {
@Override
public void run() {
DocumentListener listener = new DocumentAdapter() {
@Override
public void documentChanged(DocumentEvent e) {
final Document document = e.getDocument();
final VirtualFile virtualFile = fileDocumentManager.getFile(document);
if (virtualFile == null) return;
final Module module = projectRootManager.getFileIndex().getModuleForFile(virtualFile);
if (module == null) return;
if (!newFileTracker.poll(virtualFile)) return;
if (!fileTypeUtil.isSupportedFile(virtualFile)) return;
if (psiManager.findFile(virtualFile) == null) return;
application.invokeLater(new Runnable() {
@Override
public void run() {
if (!virtualFile.isValid()) return;
final PsiFile file = psiManager.findFile(virtualFile);
if (file != null && file.isWritable()) {
final CopyrightProfile opts = getCopyrightOptions(file);
if (opts != null) {
new UpdateCopyrightProcessor(myProject, module, file).run();
}
}
}
}, ModalityState.NON_MODAL, myProject.getDisposed());
}
};
editorFactory.getEventMulticaster().addDocumentListener(listener, myProject);
}
});
}
}
示例2: CopyrightManager
import com.maddyhome.idea.copyright.actions.UpdateCopyrightProcessor; //导入依赖的package包/类
public CopyrightManager(@NotNull Project project,
@NotNull final EditorFactory editorFactory,
@NotNull final Application application,
@NotNull final FileDocumentManager fileDocumentManager,
@NotNull final FileTypeUtil fileTypeUtil,
@NotNull final ProjectRootManager projectRootManager,
@NotNull final PsiManager psiManager,
@NotNull StartupManager startupManager) {
super(project);
if (!myProject.isDefault()) {
final NewFileTracker newFileTracker = NewFileTracker.getInstance();
Disposer.register(myProject, newFileTracker);
startupManager.runWhenProjectIsInitialized(new Runnable() {
@Override
public void run() {
DocumentListener listener = new DocumentAdapter() {
@Override
public void documentChanged(DocumentEvent e) {
final Document document = e.getDocument();
final VirtualFile virtualFile = fileDocumentManager.getFile(document);
if (virtualFile == null) return;
if (!newFileTracker.poll(virtualFile)) return;
if (!fileTypeUtil.isSupportedFile(virtualFile)) return;
final Module module = projectRootManager.getFileIndex().getModuleForFile(virtualFile);
if (module == null) return;
final PsiFile file = psiManager.findFile(virtualFile);
if (file == null) return;
application.invokeLater(new Runnable() {
@Override
public void run() {
if (myProject.isDisposed()) return;
if (file.isValid() && file.isWritable()) {
final CopyrightProfile opts = getCopyrightOptions(file);
if (opts != null) {
new UpdateCopyrightProcessor(myProject, module, file).run();
}
}
}
}, ModalityState.NON_MODAL, myProject.getDisposed());
}
};
editorFactory.getEventMulticaster().addDocumentListener(listener, myProject);
}
});
}
}
示例3: CopyrightManager
import com.maddyhome.idea.copyright.actions.UpdateCopyrightProcessor; //导入依赖的package包/类
public CopyrightManager(@Nonnull Project project,
@Nonnull final EditorFactory editorFactory,
@Nonnull final Application application,
@Nonnull final FileDocumentManager fileDocumentManager,
@Nonnull final ProjectRootManager projectRootManager,
@Nonnull final PsiManager psiManager,
@Nonnull StartupManager startupManager) {
super(project);
if (!myProject.isDefault()) {
final NewFileTracker newFileTracker = NewFileTracker.getInstance();
Disposer.register(myProject, newFileTracker::clear);
startupManager.runWhenProjectIsInitialized(new Runnable() {
@Override
public void run() {
DocumentListener listener = new DocumentAdapter() {
@Override
public void documentChanged(DocumentEvent e) {
final Document document = e.getDocument();
final VirtualFile virtualFile = fileDocumentManager.getFile(document);
if (virtualFile == null) return;
if (!newFileTracker.poll(virtualFile)) return;
if (!CopyrightUpdaters.hasExtension(virtualFile)) return;
final Module module = projectRootManager.getFileIndex().getModuleForFile(virtualFile);
if (module == null) return;
final PsiFile file = psiManager.findFile(virtualFile);
if (file == null) return;
application.invokeLater(new Runnable() {
@Override
public void run() {
if (myProject.isDisposed()) return;
if (file.isValid() && file.isWritable()) {
final CopyrightProfile opts = getCopyrightOptions(file);
if (opts != null) {
new UpdateCopyrightProcessor(myProject, module, file).run();
}
}
}
}, ModalityState.NON_MODAL, myProject.getDisposed());
}
};
editorFactory.getEventMulticaster().addDocumentListener(listener, myProject);
}
});
}
}