Project: aptanastudio
Issue APSTUD-7267: Switching branch outside IDE doesn't auto-close projects not on new branch
When we switch branches through our git support in the IDE we check to see if projects exist on the destination branch and then auto-close any that don't exist on the destination before switching - so that we avoid errors popping up and leaving orphaned .project files around. If a user switches branches outside the IDE we don't handle that in a similar way, so an error dialog can pop up. We do detect the branch change but can get into an error state as a result. We may need to catch and handle the exceptions or possibly even do the same sort of auto-closing of projects. Otherwise you get the error dialog and then in the log you see things like: {code} !ENTRY org.eclipse.core.filesystem 4 271 2012-08-07 09:23:04.739 !MESSAGE File not found: /Users/cwilliams/repos/titanium/tests/com.appcelerator.titanium.acs.core.tests/build.properties. !STACK 0 java.io.FileNotFoundException: /Users/cwilliams/repos/titanium/tests/com.appcelerator.titanium.acs.core.tests/build.properties (No such file or directory) java.io.FileInputStream.open(Native Method) java.io.FileInputStream.(FileInputStream.java:120) org.eclipse.core.internal.filesystem.local.LocalFile.openInputStream(LocalFile.java:362) org.eclipse.core.internal.localstore.FileSystemResourceManager.read(FileSystemResourceManager.java:797) org.eclipse.core.internal.resources.File.getContents(File.java:289) org.eclipse.pde.internal.core.build.WorkspaceBuildModel.load(WorkspaceBuildModel.java:67) org.eclipse.pde.core.plugin.PluginRegistry.createBuildModel(PluginRegistry.java:414) org.eclipse.pde.internal.core.ClasspathUtilCore.getBuild(ClasspathUtilCore.java:194) org.eclipse.pde.internal.core.PluginModelManager.updateAffectedEntries(PluginModelManager.java:342) org.eclipse.pde.internal.core.PluginModelManager.modelsChanged(PluginModelManager.java:280) org.eclipse.pde.internal.core.AbstractModelManager.fireModelProviderEvent(AbstractModelManager.java:35) org.eclipse.pde.internal.core.WorkspaceModelManager.createAndFireEvent(WorkspaceModelManager.java:263) org.eclipse.pde.internal.core.WorkspacePluginModelManager.createAndFireEvent(WorkspacePluginModelManager.java:471) org.eclipse.pde.internal.core.WorkspaceModelManager.processModelChanges(WorkspaceModelManager.java:235) org.eclipse.pde.internal.core.WorkspaceModelManager.processModelChanges(WorkspaceModelManager.java:197) org.eclipse.pde.internal.core.WorkspacePluginModelManager.processModelChanges(WorkspacePluginModelManager.java:461) org.eclipse.pde.internal.core.WorkspaceModelManager.resourceChanged(WorkspaceModelManager.java:114) org.eclipse.jdt.internal.core.DeltaProcessingState$1.run(DeltaProcessingState.java:465) org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) org.eclipse.jdt.internal.core.DeltaProcessingState.resourceChanged(DeltaProcessingState.java:460) org.eclipse.core.internal.events.NotificationManager$1.run(NotificationManager.java:291) org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) org.eclipse.core.internal.events.NotificationManager.notify(NotificationManager.java:285) org.eclipse.core.internal.events.NotificationManager.broadcastChanges(NotificationManager.java:149) org.eclipse.core.internal.resources.Workspace.broadcastPostChange(Workspace.java:395) org.eclipse.core.internal.resources.Workspace.endOperation(Workspace.java:1530) org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:45) org.eclipse.core.internal.jobs.Worker.run(Worker.java:54) !ENTRY org.eclipse.core.filesystem 4 271 2012-08-07 09:23:04.740 !MESSAGE File not found: /Users/cwilliams/repos/titanium/tests/com.appcelerator.titanium.acs.core.tests/build.properties. !STACK 0 java.io.FileNotFoundException: /Users/cwilliams/repos/titanium/tests/com.appcelerator.titanium.acs.core.tests/build.properties (No such file or directory) java.io.FileInputStream.open(Native Method) java.io.FileInputStream.(FileInputStream.java:120) org.eclipse.core.internal.filesystem.local.LocalFile.openInputStream(LocalFile.java:362) org.eclipse.core.internal.localstore.FileSystemResourceManager.read(FileSystemResourceManager.java:797) org.eclipse.core.internal.resources.File.getContents(File.java:289) org.eclipse.pde.internal.core.build.WorkspaceBuildModel.load(WorkspaceBuildModel.java:67) org.eclipse.pde.internal.core.build.BuildModel.getBuild(BuildModel.java:36) org.eclipse.pde.internal.core.ClasspathUtilCore.getBuild(ClasspathUtilCore.java:195) org.eclipse.pde.internal.core.PluginModelManager.updateAffectedEntries(PluginModelManager.java:342) org.eclipse.pde.internal.core.PluginModelManager.modelsChanged(PluginModelManager.java:280) org.eclipse.pde.internal.core.AbstractModelManager.fireModelProviderEvent(AbstractModelManager.java:35) org.eclipse.pde.internal.core.WorkspaceModelManager.createAndFireEvent(WorkspaceModelManager.java:263) org.eclipse.pde.internal.core.WorkspacePluginModelManager.createAndFireEvent(WorkspacePluginModelManager.java:471) org.eclipse.pde.internal.core.WorkspaceModelManager.processModelChanges(WorkspaceModelManager.java:235) org.eclipse.pde.internal.core.WorkspaceModelManager.processModelChanges(WorkspaceModelManager.java:197) org.eclipse.pde.internal.core.WorkspacePluginModelManager.processModelChanges(WorkspacePluginModelManager.java:461) org.eclipse.pde.internal.core.WorkspaceModelManager.resourceChanged(WorkspaceModelManager.java:114) org.eclipse.jdt.internal.core.DeltaProcessingState$1.run(DeltaProcessingState.java:465) org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) org.eclipse.jdt.internal.core.DeltaProcessingState.resourceChanged(DeltaProcessingState.java:460) org.eclipse.core.internal.events.NotificationManager$1.run(NotificationManager.java:291) org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) org.eclipse.core.internal.events.NotificationManager.notify(NotificationManager.java:285) org.eclipse.core.internal.events.NotificationManager.broadcastChanges(NotificationManager.java:149) org.eclipse.core.internal.resources.Workspace.broadcastPostChange(Workspace.java:395) org.eclipse.core.internal.resources.Workspace.endOperation(Workspace.java:1530) org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:45) org.eclipse.core.internal.jobs.Worker.run(Worker.java:54) !ENTRY org.eclipse.core.resources 4 271 2012-08-07 09:23:06.164 !MESSAGE Errors occurred while refreshing resources with the local file system. !SUBENTRY 1 org.eclipse.core.resources 4 567 2012-08-07 09:23:06.165 !MESSAGE The project description file (.project) for 'com.appcelerator.titanium.acs.ui' is missing. This file contains important information about the project. The project will not function properly until this file is restored. !ENTRY org.eclipse.core.filesystem 4 271 2012-08-07 09:23:06.501 !MESSAGE File not found: /Users/cwilliams/repos/titanium/features/com.appcelerator.titanium.acs.feature/feature.xml. !STACK 0 java.io.FileNotFoundException: /Users/cwilliams/repos/titanium/features/com.appcelerator.titanium.acs.feature/feature.xml (No such file or directory) java.io.FileInputStream.open(Native Method) java.io.FileInputStream.(FileInputStream.java:120) org.eclipse.core.internal.filesystem.local.LocalFile.openInputStream(LocalFile.java:362) org.eclipse.core.internal.localstore.FileSystemResourceManager.read(FileSystemResourceManager.java:797) org.eclipse.core.internal.resources.File.getContents(File.java:289) org.eclipse.pde.internal.core.WorkspaceModelManager.loadModel(WorkspaceModelManager.java:243) org.eclipse.pde.internal.core.WorkspaceFeatureModelManager.createModel(WorkspaceFeatureModelManager.java:30) org.eclipse.pde.internal.core.WorkspaceModelManager.initialize(WorkspaceModelManager.java:84) org.eclipse.pde.internal.core.WorkspaceFeatureModelManager.getFeatureModels(WorkspaceFeatureModelManager.java:68) org.eclipse.pde.internal.core.FeatureModelManager.init(FeatureModelManager.java:85) org.eclipse.pde.internal.core.FeatureModelManager.getWorkspaceModels(FeatureModelManager.java:117) org.eclipse.pde.internal.core.builders.FeatureRebuilder.touchFeatures(FeatureRebuilder.java:78) org.eclipse.pde.internal.core.builders.FeatureRebuilder.resourceChanged(FeatureRebuilder.java:72) org.eclipse.jdt.internal.core.DeltaProcessingState$1.run(DeltaProcessingState.java:465) org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) org.eclipse.jdt.internal.core.DeltaProcessingState.resourceChanged(DeltaProcessingState.java:460) org.eclipse.core.internal.events.NotificationManager$1.run(NotificationManager.java:291) org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) org.eclipse.core.internal.events.NotificationManager.notify(NotificationManager.java:285) org.eclipse.core.internal.events.NotificationManager.broadcastChanges(NotificationManager.java:149) org.eclipse.core.internal.resources.Workspace.broadcastBuildEvent(Workspace.java:381) org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:139) org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241) org.eclipse.core.internal.jobs.Worker.run(Worker.java:54) {code}
Story points: 8