mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
storage reload logging added
This commit is contained in:
+6
@@ -264,6 +264,12 @@ public class ModuleStoreImpl extends BaseFileConfigurableStoreImpl implements IM
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reinitComponents(Set<String> componentNames, boolean reloadData) {
|
||||
LOG.info("[STORAGE] Module: " + myModule.getName());
|
||||
super.reinitComponents(componentNames, reloadData);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean optimizeTestLoading() {
|
||||
return ((ProjectEx)myModule.getProject()).isOptimiseTestLoadSpeed();
|
||||
|
||||
+1
@@ -497,6 +497,7 @@ abstract class ComponentStoreImpl implements IComponentStore {
|
||||
for (String componentName : componentNames) {
|
||||
final PersistentStateComponent component = (PersistentStateComponent)myComponents.get(componentName);
|
||||
if (component != null) {
|
||||
LOG.info("[STORAGE] Reinit component '" + componentName + "'");
|
||||
initPersistentComponent(component, reloadData);
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -93,6 +93,7 @@ public class FileBasedStorage extends XmlElementStorage {
|
||||
final Listener listener = messageBus.syncPublisher(STORAGE_TOPIC);
|
||||
virtualFileTracker.addTracker(fileUrl, new VirtualFileAdapter() {
|
||||
public void contentsChanged(final VirtualFileEvent event) {
|
||||
LOG.info("[STORAGE] Changed: " + myFilePath);
|
||||
listener.storageFileChanged(event, FileBasedStorage.this);
|
||||
}
|
||||
}, false, this);
|
||||
|
||||
+7
-1
@@ -624,11 +624,16 @@ class ProjectStoreImpl extends BaseFileConfigurableStoreImpl implements IProject
|
||||
final Set<String> componentNames;
|
||||
try {
|
||||
componentNames = saveSession.analyzeExternalChanges(changedFiles);
|
||||
LOG.info("[STORAGE] Changes affects: " + (componentNames == null ? "[NONE]" :
|
||||
StringUtil.join(componentNames.toArray(new String[componentNames.size()]), ", ")));
|
||||
if (componentNames == null) return false;
|
||||
|
||||
// TODO[mike]: This is a hack to prevent NPE (assert != null) in StateStorageManagerImpl.reload, storage is null for...
|
||||
for (Pair<VirtualFile, StateStorage> pair : changedFiles) {
|
||||
if (pair.second == null) return false;
|
||||
if (pair.second == null) {
|
||||
LOG.info("[STORAGE] Soft reload is not possible: no state for:" + pair.first.getName());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!componentNames.isEmpty()) {
|
||||
@@ -636,6 +641,7 @@ class ProjectStoreImpl extends BaseFileConfigurableStoreImpl implements IProject
|
||||
}
|
||||
|
||||
if (!isReloadPossible(componentNames)) {
|
||||
LOG.info("[STORAGE] Soft reload is not possible for some components :(");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,7 +115,9 @@ public class ProjectManagerImpl extends ProjectManagerEx implements NamedJDOMExt
|
||||
connection.subscribe(StateStorage.STORAGE_TOPIC, new StateStorage.Listener() {
|
||||
public void storageFileChanged(final VirtualFileEvent event, @NotNull final StateStorage storage) {
|
||||
VirtualFile file = event.getFile();
|
||||
LOG.info("[STORAGE] Check if application reload is required for: " + file.getPath());
|
||||
if (!file.isDirectory() && !(event.getRequestor() instanceof StateStorage.SaveSession)) {
|
||||
LOG.info("[STORAGE] Scheduling application reload triggered by change in: " + file.getPath());
|
||||
saveChangedProjectFile(file, null, storage);
|
||||
}
|
||||
}
|
||||
@@ -130,7 +132,9 @@ public class ProjectManagerImpl extends ProjectManagerEx implements NamedJDOMExt
|
||||
connection.subscribe(StateStorage.STORAGE_TOPIC, new StateStorage.Listener() {
|
||||
public void storageFileChanged(final VirtualFileEvent event, @NotNull final StateStorage storage) {
|
||||
VirtualFile file = event.getFile();
|
||||
LOG.info("[STORAGE] Check if project reload is required for: " + file.getPath());
|
||||
if (!file.isDirectory() && !(event.getRequestor() instanceof StateStorage.SaveSession)) {
|
||||
LOG.info("[STORAGE] Scheduling project reload triggered by change in: " + file.getPath());
|
||||
saveChangedProjectFile(file, project, storage);
|
||||
}
|
||||
}
|
||||
@@ -654,6 +658,7 @@ public class ProjectManagerImpl extends ProjectManagerEx implements NamedJDOMExt
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
LOG.info("[STORAGE] Checking if we could reinit components w/o project reload...");
|
||||
reloadOk[0] = ((ProjectEx)project).getStateStore().reload(causes);
|
||||
}
|
||||
catch (StateStorage.StateStorageException e) {
|
||||
@@ -668,6 +673,8 @@ public class ProjectManagerImpl extends ProjectManagerEx implements NamedJDOMExt
|
||||
});
|
||||
if (reloadOk[0]) return false;
|
||||
|
||||
LOG.info("[STORAGE] Unable to reinit components, scheduling full project reload...");
|
||||
|
||||
String message;
|
||||
if (causes.size() == 1) {
|
||||
message = ProjectBundle.message("project.reload.external.change.single", causes.iterator().next().first.getPresentableUrl());
|
||||
|
||||
Reference in New Issue
Block a user