本文整理汇总了Java中com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl类的典型用法代码示例。如果您正苦于以下问题:Java FileDocumentManagerImpl类的具体用法?Java FileDocumentManagerImpl怎么用?Java FileDocumentManagerImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FileDocumentManagerImpl类属于com.intellij.openapi.fileEditor.impl包,在下文中一共展示了FileDocumentManagerImpl类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setUp
import com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
myReloadFromDisk = Boolean.TRUE;
FileDocumentManagerImpl impl = (FileDocumentManagerImpl)FileDocumentManager.getInstance();
impl.setAskReloadFromDisk(getTestRootDisposable(), new PairProcessor<VirtualFile, Document>() {
@Override
public boolean process(VirtualFile file, Document document) {
if (myReloadFromDisk == null) {
fail();
return false;
}
return myReloadFromDisk.booleanValue();
}
});
myDocumentManager = impl;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:FileDocumentManagerImplTest.java
示例2: cacheEverything
import com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl; //导入依赖的package包/类
private static boolean cacheEverything(@NotNull Place place,
@NotNull DocumentWindowImpl documentWindow,
@NotNull InjectedFileViewProvider viewProvider,
@NotNull PsiFile psiFile,
@NotNull SmartPsiElementPointer<PsiLanguageInjectionHost> pointer) {
FileDocumentManagerImpl.registerDocument(documentWindow, viewProvider.getVirtualFile());
DebugUtil.startPsiModification("MultiHostRegistrar cacheEverything");
try {
viewProvider.forceCachedPsi(psiFile);
}
finally {
DebugUtil.finishPsiModification();
}
psiFile.putUserData(FileContextUtil.INJECTED_IN_ELEMENT, pointer);
PsiDocumentManagerBase.cachePsi(documentWindow, psiFile);
keepTreeFromChameleoningBack(psiFile);
return viewProvider.setShreds(place, psiFile.getProject());
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:MultiHostRegistrarImpl.java
示例3: fileWithNoDocumentChanged
import com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl; //导入依赖的package包/类
@Override
public void fileWithNoDocumentChanged(@NotNull final VirtualFile file) {
final PsiFile psiFile = myFileManager.getCachedPsiFileInner(file);
if (psiFile != null) {
ApplicationManager.getApplication().runWriteAction(
new ExternalChangeAction() {
@Override
public void run() {
if (FileDocumentManagerImpl.recomputeFileTypeIfNecessary(file)) {
myFileManager.forceReload(file);
} else {
myFileManager.reloadFromDisk(psiFile, true); // important to ignore document which might appear already!
}
}
}
);
} else {
handleVfsChangeWithoutPsi(file);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:PsiVFSListener.java
示例4: documentChanged
import com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl; //导入依赖的package包/类
@Override
public void documentChanged(DocumentEvent event) {
super.documentChanged(event);
// optimisation: avoid documents piling up during batch processing
if (FileDocumentManagerImpl.areTooManyDocumentsInTheQueue(myUncommittedDocuments)) {
if (myUnitTestMode) {
myStopTrackingDocuments = true;
try {
LOG.error("Too many uncommitted documents for " + myProject + ":\n" + StringUtil.join(myUncommittedDocuments, "\n") +
"\n\n Project creation trace: " + myProject.getUserData(ProjectImpl.CREATION_TRACE));
}
finally {
//noinspection TestOnlyProblems
clearUncommittedDocuments();
}
}
// must not commit during document save
if (PomModelImpl.isAllowPsiModification()) {
commitAllDocuments();
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:PsiDocumentManagerImpl.java
示例5: cacheEverything
import com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl; //导入依赖的package包/类
private static boolean cacheEverything(@NotNull Place place,
@NotNull DocumentWindowImpl documentWindow,
@NotNull InjectedFileViewProvider viewProvider,
@NotNull PsiFile psiFile,
@NotNull SmartPsiElementPointer<PsiLanguageInjectionHost> pointer) {
FileDocumentManagerImpl.registerDocument(documentWindow, viewProvider.getVirtualFile());
viewProvider.forceCachedPsi(psiFile);
psiFile.putUserData(FileContextUtil.INJECTED_IN_ELEMENT, pointer);
PsiDocumentManagerImpl.cachePsi(documentWindow, psiFile);
keepTreeFromChameleoningBack(psiFile);
return viewProvider.setShreds(place, psiFile.getProject());
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:MultiHostRegistrarImpl.java
示例6: documentChanged
import com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl; //导入依赖的package包/类
@Override
public void documentChanged(DocumentEvent event) {
super.documentChanged(event);
// avoid documents piling up during batch processing
if (FileDocumentManagerImpl.areTooManyDocumentsInTheQueue(myUncommittedDocuments)) {
if (ApplicationManager.getApplication().isUnitTestMode()) {
try {
LOG.error("Too many uncommitted documents for " + myProject + ":\n" + myUncommittedDocuments);
}
finally {
clearUncommittedDocuments();
}
}
commitAllDocuments();
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:PsiDocumentManagerImpl.java
示例7: setUp
import com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
myReloadFromDisk = Boolean.TRUE;
FileDocumentManagerImpl impl = (FileDocumentManagerImpl)FileDocumentManager.getInstance();
impl.setAskReloadFromDisk(getTestRootDisposable(), new MemoryDiskConflictResolver() {
@Override
public boolean askReloadFromDisk(VirtualFile file, Document document) {
if (myReloadFromDisk == null) {
fail();
return false;
}
return myReloadFromDisk.booleanValue();
}
});
myDocumentManager = impl;
}
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:FileDocumentManagerImplTest.java
示例8: fileWithNoDocumentChanged
import com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl; //导入依赖的package包/类
@Override
public void fileWithNoDocumentChanged(@Nonnull final VirtualFile file) {
final PsiFile psiFile = myFileManager.getCachedPsiFileInner(file);
if (psiFile != null) {
ApplicationManager.getApplication().runWriteAction((ExternalChangeAction)() -> {
if (FileDocumentManagerImpl.recomputeFileTypeIfNecessary(file)) {
myFileManager.forceReload(file);
}
else {
myFileManager.reloadPsiAfterTextChange(psiFile, file);
}
});
}
else {
handleVfsChangeWithoutPsi(file);
}
}
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:PsiVFSListener.java
示例9: run
import com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl; //导入依赖的package包/类
@Override
public void run() {
try {
((FileDocumentManagerImpl)FileDocumentManager.getInstance()).saveAllDocuments(false);
}
finally {
mySemaphore.up();
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:BuildManager.java
示例10: createDocument
import com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl; //导入依赖的package包/类
@NotNull
private static DocumentEx createDocument(@NotNull LightVirtualFile virtualFile) {
CharSequence content = virtualFile.getContent();
DocumentImpl document = new DocumentImpl(content, StringUtil.indexOf(content, '\r') >= 0, false);
FileDocumentManagerImpl.registerDocument(document, virtualFile);
return document;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:MultiHostRegistrarImpl.java
示例11: createEditor
import com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl; //导入依赖的package包/类
private static EditorEx createEditor(String tooltip) {
Project project = getProject();
LightVirtualFile virtualFile =
new LightVirtualFile("mockProjectViewFile", ProjectViewLanguage.INSTANCE, "");
final Document document =
((EditorFactoryImpl) EditorFactory.getInstance()).createDocument(true);
((DocumentImpl) document).setAcceptSlashR(true);
FileDocumentManagerImpl.registerDocument(document, virtualFile);
FileManager fileManager = ((PsiManagerEx) PsiManager.getInstance(project)).getFileManager();
fileManager.setViewProvider(virtualFile, fileManager.createFileViewProvider(virtualFile, true));
if (project.isDefault()) {
// Undo-redo doesn't work with the default project.
// Explicitly turn it off to avoid error dialogs.
UndoUtil.disableUndoFor(document);
}
EditorEx editor =
(EditorEx)
EditorFactory.getInstance()
.createEditor(document, project, ProjectViewFileType.INSTANCE, false);
final EditorSettings settings = editor.getSettings();
settings.setLineNumbersShown(false);
settings.setLineMarkerAreaShown(false);
settings.setFoldingOutlineShown(false);
settings.setRightMarginShown(false);
settings.setAdditionalPageAtBottom(false);
editor.getComponent().setMinimumSize(getEditorSize());
editor.getComponent().setPreferredSize(getEditorSize());
editor.getComponent().setToolTipText(tooltip);
editor.getComponent().setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, null);
editor.getComponent().setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, null);
return editor;
}
开发者ID:bazelbuild,项目名称:intellij,代码行数:36,代码来源:ProjectViewUi.java
示例12: testDocumentGced
import com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl; //导入依赖的package包/类
public void testDocumentGced() throws Exception {
VirtualFile vFile = createFile();
PsiDocumentManagerImpl documentManager = getPsiDocumentManager();
long id = System.identityHashCode(documentManager.getDocument(getPsiManager().findFile(vFile)));
documentManager.commitAllDocuments();
UIUtil.dispatchAllInvocationEvents();
UIUtil.dispatchAllInvocationEvents();
assertEmpty(documentManager.getUncommittedDocuments());
LeakHunter.checkLeak(documentManager, DocumentImpl.class);
LeakHunter.checkLeak(documentManager, PsiFileImpl.class, new Processor<PsiFileImpl>() {
@Override
public boolean process(PsiFileImpl psiFile) {
return psiFile.getViewProvider().getVirtualFile().getFileSystem() instanceof LocalFileSystem;
}
});
//Class.forName("com.intellij.util.ProfilingUtil").getDeclaredMethod("forceCaptureMemorySnapshot").invoke(null);
Reference<Document> reference = vFile.getUserData(FileDocumentManagerImpl.DOCUMENT_KEY);
assertNotNull(reference);
for (int i=0;i<1000;i++) {
UIUtil.dispatchAllInvocationEvents();
if (reference.get() == null) break;
System.gc();
}
assertNull(documentManager.getCachedDocument(getPsiManager().findFile(vFile)));
Document newDoc = documentManager.getDocument(getPsiManager().findFile(vFile));
assertTrue(id != System.identityHashCode(newDoc));
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:32,代码来源:PsiDocumentManagerImplTest.java
示例13: documentChanged
import com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl; //导入依赖的package包/类
@Override
public void documentChanged(DocumentEvent event) {
super.documentChanged(event);
// optimisation: avoid documents piling up during batch processing
if (isUncommited(event.getDocument()) && FileDocumentManagerImpl.areTooManyDocumentsInTheQueue(myUncommittedDocuments)) {
if (myUnitTestMode) {
myStopTrackingDocuments = true;
try {
LOG.error("Too many uncommitted documents for " + myProject + "(" +myUncommittedDocuments.size()+")"+
":\n" + StringUtil.join(myUncommittedDocuments, "\n") +
"\n\n Project creation trace: " + myProject.getUserData(ProjectImpl.CREATION_TRACE));
}
finally {
//noinspection TestOnlyProblems
clearUncommittedDocuments();
}
}
// must not commit during document save
if (PomModelImpl.isAllowPsiModification()
// it can happen that document(forUseInNonAWTThread=true) outside write action caused this
&& ApplicationManager.getApplication().isWriteAccessAllowed()) {
// commit one document to avoid OOME
for (Document document : myUncommittedDocuments) {
if (document != event.getDocument()) {
doCommitWithoutReparse(document);
break;
}
}
}
}
}
开发者ID:consulo,项目名称:consulo,代码行数:32,代码来源:PsiDocumentManagerImpl.java
示例14: associatePsi
import com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl; //导入依赖的package包/类
@Override
public void associatePsi(@Nonnull Document document, @Nullable PsiFile file) {
if (file != null) {
VirtualFile vFile = file.getViewProvider().getVirtualFile();
Document cachedDocument = FileDocumentManager.getInstance().getCachedDocument(vFile);
if (cachedDocument != null && cachedDocument != document) {
throw new IllegalStateException("Can't replace existing document");
}
FileDocumentManagerImpl.registerDocument(document, vFile);
}
}
开发者ID:consulo,项目名称:consulo,代码行数:13,代码来源:PsiDocumentManagerImpl.java
示例15: doSetup
import com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl; //导入依赖的package包/类
public static void doSetup(@NotNull LightProjectDescriptor descriptor,
@NotNull LocalInspectionTool[] localInspectionTools,
@NotNull Disposable parentDisposable) throws Exception {
assertNull("Previous test " + ourTestCase + " hasn't called tearDown(). Probably overridden without super call.", ourTestCase);
IdeaLogger.ourErrorsOccurred = null;
ApplicationManager.getApplication().assertIsDispatchThread();
boolean reusedProject = true;
if (ourProject == null || ourProjectDescriptor == null || !ourProjectDescriptor.equals(descriptor)) {
initProject(descriptor);
reusedProject = false;
}
ProjectManagerEx projectManagerEx = ProjectManagerEx.getInstanceEx();
projectManagerEx.openTestProject(ourProject);
if (reusedProject) {
DumbService.getInstance(ourProject).queueTask(new UnindexedFilesUpdater(ourProject, false));
}
MessageBusConnection connection = ourProject.getMessageBus().connect(parentDisposable);
connection.subscribe(ProjectTopics.MODULES, new ModuleAdapter() {
@Override
public void moduleAdded(@NotNull Project project, @NotNull Module module) {
fail("Adding modules is not permitted in LightIdeaTestCase.");
}
});
clearUncommittedDocuments(getProject());
CodeInsightTestFixtureImpl.configureInspections(localInspectionTools, getProject(),
Collections.<String>emptyList(), parentDisposable);
assertFalse(getPsiManager().isDisposed());
Boolean passed = null;
try {
passed = StartupManagerEx.getInstanceEx(getProject()).startupActivityPassed();
}
catch (Exception ignored) {
}
assertTrue("open: " + getProject().isOpen() +
"; disposed:" + getProject().isDisposed() +
"; startup passed:" + passed +
"; all open projects: " + Arrays.asList(ProjectManager.getInstance().getOpenProjects()), getProject().isInitialized());
CodeStyleSettingsManager.getInstance(getProject()).setTemporarySettings(new CodeStyleSettings());
final FileDocumentManager manager = FileDocumentManager.getInstance();
if (manager instanceof FileDocumentManagerImpl) {
Document[] unsavedDocuments = manager.getUnsavedDocuments();
manager.saveAllDocuments();
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
((FileDocumentManagerImpl)manager).dropAllUnsavedDocuments();
}
});
assertEmpty("There are unsaved documents", Arrays.asList(unsavedDocuments));
}
UIUtil.dispatchAllInvocationEvents(); // startup activities
((FileTypeManagerImpl)FileTypeManager.getInstance()).drainReDetectQueue();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:64,代码来源:LightPlatformTestCase.java
示例16: SaveAndSyncHandlerImpl
import com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl; //导入依赖的package包/类
public SaveAndSyncHandlerImpl(@NotNull GeneralSettings generalSettings,
@NotNull ProgressManager progressManager,
@NotNull FrameStateManager frameStateManager,
@NotNull final FileDocumentManager fileDocumentManager) {
mySettings = generalSettings;
myProgressManager = progressManager;
myIdleListener = new Runnable() {
@Override
public void run() {
if (mySettings.isAutoSaveIfInactive() && canSyncOrSave()) {
((FileDocumentManagerImpl)fileDocumentManager).saveAllDocuments(false);
}
}
};
IdeEventQueue.getInstance().addIdleListener(myIdleListener, mySettings.getInactiveTimeout() * 1000);
myGeneralSettingsListener = new PropertyChangeListener() {
@Override
public void propertyChange(@NotNull PropertyChangeEvent e) {
if (GeneralSettings.PROP_INACTIVE_TIMEOUT.equals(e.getPropertyName())) {
IdeEventQueue eventQueue = IdeEventQueue.getInstance();
eventQueue.removeIdleListener(myIdleListener);
Integer timeout = (Integer)e.getNewValue();
eventQueue.addIdleListener(myIdleListener, timeout.intValue() * 1000);
}
}
};
mySettings.addPropertyChangeListener(myGeneralSettingsListener);
frameStateManager.addListener(new FrameStateListener() {
@Override
public void onFrameDeactivated() {
LOG.debug("save(): enter");
if (canSyncOrSave()) {
saveProjectsAndDocuments();
}
LOG.debug("save(): exit");
}
@Override
public void onFrameActivated() {
if (!ApplicationManager.getApplication().isDisposed() && mySettings.isSyncOnFrameActivation()) {
scheduleRefresh();
}
}
});
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:49,代码来源:SaveAndSyncHandlerImpl.java
示例17: SaveAndSyncHandlerImpl
import com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl; //导入依赖的package包/类
public SaveAndSyncHandlerImpl(final FrameStateManager frameStateManager,
final FileDocumentManager fileDocumentManager,
final GeneralSettings generalSettings,
final ProgressManager progressManager) {
myProgressManager = progressManager;
myIdleListener = new Runnable() {
@Override
public void run() {
if (generalSettings.isAutoSaveIfInactive() && canSyncOrSave()) {
((FileDocumentManagerImpl)fileDocumentManager).saveAllDocuments(false);
}
}
};
IdeEventQueue.getInstance().addIdleListener(
myIdleListener,
generalSettings.getInactiveTimeout() * 1000
);
myGeneralSettingsListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent e) {
if (GeneralSettings.PROP_INACTIVE_TIMEOUT.equals(e.getPropertyName())) {
IdeEventQueue eventQueue = IdeEventQueue.getInstance();
eventQueue.removeIdleListener(myIdleListener);
Integer timeout = (Integer)e.getNewValue();
eventQueue.addIdleListener(myIdleListener, timeout.intValue() * 1000);
}
}
};
generalSettings.addPropertyChangeListener(myGeneralSettingsListener);
frameStateManager.addListener(new FrameStateListener() {
@Override
public void onFrameDeactivated() {
if (canSyncOrSave()) {
saveProjectsAndDocuments();
}
}
@Override
public void onFrameActivated() {
refreshFiles();
}
});
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:48,代码来源:SaveAndSyncHandlerImpl.java
示例18: doTearDown
import com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl; //导入依赖的package包/类
public static void doTearDown(@Nonnull final Project project, ApplicationStarter application, boolean checkForEditors) throws Exception {
CodeStyleSettingsManager.getInstance(project).dropTemporarySettings();
checkAllTimersAreDisposed();
UsefulTestCase.doPostponedFormatting(project);
LookupManager lookupManager = LookupManager.getInstance(project);
if (lookupManager != null) {
lookupManager.hideActiveLookup();
}
((StartupManagerImpl)StartupManager.getInstance(project)).prepareForNextTest();
InspectionProfileManager.getInstance().deleteProfile(PROFILE);
assertNotNull("Application components damaged", ProjectManager.getInstance());
new WriteCommandAction.Simple(project) {
@Override
@RequiredWriteAction
protected void run() throws Throwable {
if (ourSourceRoot != null) {
try {
final VirtualFile[] children = ourSourceRoot.getChildren();
for (VirtualFile child : children) {
child.delete(this);
}
}
catch (IOException e) {
//noinspection CallToPrintStackTrace
e.printStackTrace();
}
}
EncodingManager encodingManager = EncodingManager.getInstance();
if (encodingManager instanceof EncodingManagerImpl) ((EncodingManagerImpl)encodingManager).clearDocumentQueue();
FileDocumentManager manager = FileDocumentManager.getInstance();
ApplicationManager.getApplication().runWriteAction(EmptyRunnable.getInstance()); // Flush postponed formatting if any.
manager.saveAllDocuments();
if (manager instanceof FileDocumentManagerImpl) {
((FileDocumentManagerImpl)manager).dropAllUnsavedDocuments();
}
}
}.execute().throwException();
assertFalse(PsiManager.getInstance(project).isDisposed());
if (!ourAssertionsInTestDetected) {
if (IdeaLogger.ourErrorsOccurred != null) {
throw IdeaLogger.ourErrorsOccurred;
}
}
PsiDocumentManagerImpl documentManager = clearUncommittedDocuments(project);
((HintManagerImpl)HintManager.getInstance()).cleanup();
UIUtil.invokeAndWaitIfNeeded(new Runnable() {
@Override
public void run() {
((UndoManagerImpl)UndoManager.getGlobalInstance()).dropHistoryInTests();
((UndoManagerImpl)UndoManager.getInstance(project)).dropHistoryInTests();
UIUtil.dispatchAllInvocationEvents();
}
});
TemplateDataLanguageMappings.getInstance(project).cleanupForNextTest();
ProjectManagerEx.getInstanceEx().closeTestProject(project);
//application.setDataProvider(null);
ourTestCase = null;
((PsiManagerImpl)PsiManager.getInstance(project)).cleanupForNextTest();
CompletionProgressIndicator.cleanupForNextTest();
if (checkForEditors) {
checkEditorsReleased();
}
if (isLight(project)) {
// mark temporarily as disposed so that rogue component trying to access it will fail
((ProjectImpl)project).setTemporarilyDisposed(true);
documentManager.clearUncommittedDocuments();
}
}
开发者ID:consulo,项目名称:consulo,代码行数:80,代码来源:LightPlatformTestCase.java
示例19: SaveAndSyncHandlerImpl
import com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl; //导入依赖的package包/类
public SaveAndSyncHandlerImpl(@Nonnull GeneralSettings generalSettings,
@Nonnull ProgressManager progressManager,
@Nonnull FrameStateManager frameStateManager,
@Nonnull FileDocumentManager fileDocumentManager) {
mySettings = generalSettings;
myProgressManager = progressManager;
myIdleListener = () -> {
if (mySettings.isAutoSaveIfInactive() && canSyncOrSave()) {
TransactionGuard.submitTransaction(ApplicationManager.getApplication(), () -> ((FileDocumentManagerImpl)fileDocumentManager).saveAllDocuments(false));
}
};
IdeEventQueue.getInstance().addIdleListener(myIdleListener, mySettings.getInactiveTimeout() * 1000);
myGeneralSettingsListener = new PropertyChangeListener() {
@Override
public void propertyChange(@Nonnull PropertyChangeEvent e) {
if (GeneralSettings.PROP_INACTIVE_TIMEOUT.equals(e.getPropertyName())) {
IdeEventQueue eventQueue = IdeEventQueue.getInstance();
eventQueue.removeIdleListener(myIdleListener);
Integer timeout = (Integer)e.getNewValue();
eventQueue.addIdleListener(myIdleListener, timeout.intValue() * 1000);
}
}
};
mySettings.addPropertyChangeListener(myGeneralSettingsListener);
frameStateManager.addListener(new FrameStateListener() {
@Override
public void onFrameDeactivated() {
LOG.debug("save(): enter");
TransactionGuard.submitTransaction(ApplicationManager.getApplication(), () -> {
if (canSyncOrSave()) {
saveProjectsAndDocuments();
}
LOG.debug("save(): exit");
});
}
@Override
public void onFrameActivated() {
if (!ApplicationManager.getApplication().isDisposed() && mySettings.isSyncOnFrameActivation()) {
scheduleRefresh();
}
}
});
}
开发者ID:consulo,项目名称:consulo,代码行数:48,代码来源:SaveAndSyncHandlerImpl.java
示例20: cacheEverything
import com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl; //导入依赖的package包/类
private static boolean cacheEverything(@Nonnull Place place, @Nonnull DocumentWindowImpl documentWindow, @Nonnull InjectedFileViewProvider viewProvider, @Nonnull PsiFile psiFile) {
FileDocumentManagerImpl.registerDocument(documentWindow, viewProvider.getVirtualFile());
DebugUtil.performPsiModification("MultiHostRegistrar cacheEverything", () -> viewProvider.forceCachedPsi(psiFile));
SmartPsiElementPointer<PsiLanguageInjectionHost> pointer = ((ShredImpl)place.get(0)).getSmartPointer();
psiFile.putUserData(FileContextUtil.INJECTED_IN_ELEMENT, pointer);
keepTreeFromChameleoningBack(psiFile);
return viewProvider.setShreds(place);
}
开发者ID:consulo,项目名称:consulo,代码行数:13,代码来源:InjectionRegistrarImpl.java
注:本文中的com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论