本文整理汇总了Java中com.intellij.pom.tree.TreeAspectEvent类的典型用法代码示例。如果您正苦于以下问题:Java TreeAspectEvent类的具体用法?Java TreeAspectEvent怎么用?Java TreeAspectEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TreeAspectEvent类属于com.intellij.pom.tree包,在下文中一共展示了TreeAspectEvent类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: reparseFile
import com.intellij.pom.tree.TreeAspectEvent; //导入依赖的package包/类
private void reparseFile(final PsiFile file, FileElement treeElement, CharSequence newText) {
PsiToDocumentSynchronizer synchronizer =((PsiDocumentManagerBase)PsiDocumentManager.getInstance(myProject)).getSynchronizer();
TextRange changedPsiRange = DocumentCommitProcessor.getChangedPsiRange(file, treeElement, newText);
if (changedPsiRange == null) return;
final DiffLog log = BlockSupport.getInstance(myProject).reparseRange(file, changedPsiRange, newText, new EmptyProgressIndicator(),
treeElement.getText());
synchronizer.setIgnorePsiEvents(true);
try {
CodeStyleManager.getInstance(file.getProject()).performActionWithFormatterDisabled(new Runnable() {
@Override
public void run() {
runTransaction(new PomTransactionBase(file, getModelAspect(TreeAspect.class)) {
@Nullable
@Override
public PomModelEvent runInner() throws IncorrectOperationException {
return new TreeAspectEvent(PomModelImpl.this, log.performActualPsiChange(file));
}
});
}
});
}
finally {
synchronizer.setIgnorePsiEvents(false);
}
}
示例2: reparseFile
import com.intellij.pom.tree.TreeAspectEvent; //导入依赖的package包/类
@Nullable
private Runnable reparseFile(@Nonnull final PsiFile file, @Nonnull FileElement treeElement, @Nonnull CharSequence newText) {
TextRange changedPsiRange = ChangedPsiRangeUtil.getChangedPsiRange(file, treeElement, newText);
if (changedPsiRange == null) return null;
Runnable reparseLeaf = tryReparseOneLeaf(treeElement, newText, changedPsiRange);
if (reparseLeaf != null) return reparseLeaf;
final DiffLog log = BlockSupport.getInstance(myProject).reparseRange(file, treeElement, changedPsiRange, newText, new EmptyProgressIndicator(),
treeElement.getText());
return () -> runTransaction(new PomTransactionBase(file, getModelAspect(TreeAspect.class)) {
@Override
public PomModelEvent runInner() throws IncorrectOperationException {
return new TreeAspectEvent(PomModelImpl.this, log.performActualPsiChange(file));
}
});
}
示例3: doActualPsiChange
import com.intellij.pom.tree.TreeAspectEvent; //导入依赖的package包/类
public void doActualPsiChange(@Nonnull PsiFile file) {
CodeStyleManager.getInstance(file.getProject()).performActionWithFormatterDisabled((Runnable)() -> {
FileViewProvider viewProvider = file.getViewProvider();
synchronized (((AbstractFileViewProvider)viewProvider).getFilePsiLock()) {
viewProvider.beforeContentsSynchronized();
final Document document = viewProvider.getDocument();
PsiDocumentManagerBase documentManager = (PsiDocumentManagerBase)PsiDocumentManager.getInstance(file.getProject());
PsiToDocumentSynchronizer.DocumentChangeTransaction transaction = documentManager.getSynchronizer().getTransaction(document);
if (transaction == null) {
final PomModel model = PomManager.getModel(file.getProject());
model.runTransaction(new PomTransactionBase(file, model.getModelAspect(TreeAspect.class)) {
@Override
public PomModelEvent runInner() {
return new TreeAspectEvent(model, performActualPsiChange(file));
}
});
}
else {
performActualPsiChange(file);
}
}
});
}
示例4: doActualPsiChange
import com.intellij.pom.tree.TreeAspectEvent; //导入依赖的package包/类
public static void doActualPsiChange(@NotNull final PsiFile file, @NotNull final DiffLog diffLog) {
CodeStyleManager.getInstance(file.getProject()).performActionWithFormatterDisabled(new Runnable() {
@Override
public void run() {
synchronized (PsiLock.LOCK) {
file.getViewProvider().beforeContentsSynchronized();
final Document document = file.getViewProvider().getDocument();
PsiDocumentManagerBase documentManager = (PsiDocumentManagerBase)PsiDocumentManager.getInstance(file.getProject());
PsiToDocumentSynchronizer.DocumentChangeTransaction transaction = documentManager.getSynchronizer().getTransaction(document);
final PsiFileImpl fileImpl = (PsiFileImpl)file;
if (transaction == null) {
final PomModel model = PomManager.getModel(fileImpl.getProject());
model.runTransaction(new PomTransactionBase(fileImpl, model.getModelAspect(TreeAspect.class)) {
@Override
public PomModelEvent runInner() {
return new TreeAspectEvent(model, diffLog.performActualPsiChange(file));
}
});
}
else {
diffLog.performActualPsiChange(file);
}
}
}
});
}
示例5: reparseFile
import com.intellij.pom.tree.TreeAspectEvent; //导入依赖的package包/类
private void reparseFile(final PsiFile file, String newText, String oldText) {
if (oldText.equals(newText)) return;
PsiToDocumentSynchronizer synchronizer =((PsiDocumentManagerBase)PsiDocumentManager.getInstance(myProject)).getSynchronizer();
int changeStart = StringUtil.commonPrefixLength(oldText, newText);
int changeEnd = oldText.length() - StringUtil.commonSuffixLength(oldText, newText);
TextRange changedPsiRange = DocumentCommitProcessor.getChangedPsiRange(file, changeStart, changeEnd, newText.length());
final DiffLog log = BlockSupport.getInstance(myProject).reparseRange(file, changedPsiRange, newText, new EmptyProgressIndicator());
synchronizer.setIgnorePsiEvents(true);
try {
CodeStyleManager.getInstance(file.getProject()).performActionWithFormatterDisabled(new Runnable() {
@Override
public void run() {
runTransaction(new PomTransactionBase(file, getModelAspect(TreeAspect.class)) {
@Nullable
@Override
public PomModelEvent runInner() throws IncorrectOperationException {
return new TreeAspectEvent(PomModelImpl.this, log.performActualPsiChange(file));
}
});
}
});
}
finally {
synchronizer.setIgnorePsiEvents(false);
}
}
示例6: doActualPsiChange
import com.intellij.pom.tree.TreeAspectEvent; //导入依赖的package包/类
public static void doActualPsiChange(@NotNull final PsiFile file, @NotNull final DiffLog diffLog) {
file.getViewProvider().beforeContentsSynchronized();
try {
final Document document = file.getViewProvider().getDocument();
PsiDocumentManagerBase documentManager = (PsiDocumentManagerBase)PsiDocumentManager.getInstance(file.getProject());
PsiToDocumentSynchronizer.DocumentChangeTransaction transaction = documentManager.getSynchronizer().getTransaction(document);
final PsiFileImpl fileImpl = (PsiFileImpl)file;
if (transaction == null) {
final PomModel model = PomManager.getModel(fileImpl.getProject());
model.runTransaction(new PomTransactionBase(fileImpl, model.getModelAspect(TreeAspect.class)) {
@Override
public PomModelEvent runInner() {
return new TreeAspectEvent(model, diffLog.performActualPsiChange(file));
}
});
}
else {
diffLog.performActualPsiChange(file);
}
}
catch (IncorrectOperationException e) {
LOG.error(e);
}
}