IDEA-104500 Gradle: Allow to reuse common logic for other external systems
authorDenis.Zhdanov <Denis.Zhdanov@jetbrains.com>
Mon, 22 Apr 2013 06:47:07 +0000 (10:47 +0400)
committerDenis.Zhdanov <Denis.Zhdanov@jetbrains.com>
Mon, 22 Apr 2013 06:47:12 +0000 (10:47 +0400)
1. 'external-system' is split into 'external-system-api' and 'external-system-impl';
2. Legacy code is removed;

230 files changed:
build/scripts/utils.gant
java/java-psi-impl/java-psi-impl.iml
java/java-psi-impl/src/com/intellij/externalSystem/JavaProjectData.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/model/project/JavaProjectData.java with 89% similarity]
java/java-psi-impl/src/com/intellij/externalSystem/JavaProjectDataService.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/service/project/manage/JavaProjectDataService.java with 65% similarity]
platform/external-system-api/external-system-api.iml [new file with mode: 0644]
platform/external-system-api/resources/i18n/ExternalSystemBundle.properties [moved from platform/external-system/resources/i18n/ExternalSystemBundle.properties with 100% similarity]
platform/external-system-api/src/com/intellij/openapi/externalSystem/ExternalSystemManager.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/ExternalSystemManager.java with 98% similarity]
platform/external-system-api/src/com/intellij/openapi/externalSystem/build/ExternalSystemBuildManager.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/build/ExternalSystemBuildManager.java with 96% similarity]
platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DataNode.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/model/DataNode.java with 100% similarity]
platform/external-system-api/src/com/intellij/openapi/externalSystem/model/ExternalSystemDataKeys.java [new file with mode: 0644]
platform/external-system-api/src/com/intellij/openapi/externalSystem/model/ExternalSystemException.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/model/ExternalSystemException.java with 100% similarity]
platform/external-system-api/src/com/intellij/openapi/externalSystem/model/Key.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/model/Key.java with 100% similarity]
platform/external-system-api/src/com/intellij/openapi/externalSystem/model/ProjectKeys.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/model/ProjectKeys.java with 87% similarity]
platform/external-system-api/src/com/intellij/openapi/externalSystem/model/ProjectSystemId.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/model/ProjectSystemId.java with 100% similarity]
platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/AbstractDependencyData.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/model/project/AbstractDependencyData.java with 100% similarity]
platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/AbstractNamedData.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/model/project/AbstractNamedData.java with 100% similarity]
platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/AbstractProjectEntityData.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/model/project/AbstractProjectEntityData.java with 98% similarity]
platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/ContentRootData.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/model/project/ContentRootData.java with 74% similarity]
platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/DependencyData.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/model/project/DependencyData.java with 100% similarity]
platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/ExternalSystemSourceType.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/model/project/ExternalSystemSourceType.java with 100% similarity]
platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/LibraryData.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/model/project/LibraryData.java with 75% similarity]
platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/LibraryDependencyData.java [new file with mode: 0644]
platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/LibraryPathType.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/model/project/LibraryPathType.java with 100% similarity]
platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/ModuleData.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/model/project/ModuleData.java with 78% similarity]
platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/ModuleDependencyData.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/model/project/ModuleDependencyData.java with 62% similarity]
platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/Named.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/model/project/Named.java with 100% similarity]
platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/ProjectData.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/model/project/ProjectData.java with 68% similarity]
platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/ProjectEntityData.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/model/project/ProjectEntityData.java with 73% similarity]
platform/external-system-api/src/com/intellij/openapi/externalSystem/model/settings/ExternalSystemExecutionSettings.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/service/remote/ExternalSystemExecutionSettings.java with 98% similarity]
platform/external-system-api/src/com/intellij/openapi/externalSystem/model/task/ExternalSystemTask.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/model/task/ExternalSystemTask.java with 100% similarity]
platform/external-system-api/src/com/intellij/openapi/externalSystem/model/task/ExternalSystemTaskDescriptor.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/model/task/ExternalSystemTaskDescriptor.java with 100% similarity]
platform/external-system-api/src/com/intellij/openapi/externalSystem/model/task/ExternalSystemTaskId.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/model/task/ExternalSystemTaskId.java with 100% similarity]
platform/external-system-api/src/com/intellij/openapi/externalSystem/model/task/ExternalSystemTaskNotificationEvent.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/model/task/ExternalSystemTaskNotificationEvent.java with 100% similarity]
platform/external-system-api/src/com/intellij/openapi/externalSystem/model/task/ExternalSystemTaskNotificationListener.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/model/task/ExternalSystemTaskNotificationListener.java with 100% similarity]
platform/external-system-api/src/com/intellij/openapi/externalSystem/model/task/ExternalSystemTaskNotificationListenerAdapter.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/model/task/ExternalSystemTaskNotificationListenerAdapter.java with 100% similarity]
platform/external-system-api/src/com/intellij/openapi/externalSystem/model/task/ExternalSystemTaskState.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/model/task/ExternalSystemTaskState.java with 100% similarity]
platform/external-system-api/src/com/intellij/openapi/externalSystem/model/task/ExternalSystemTaskType.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/model/task/ExternalSystemTaskType.java with 100% similarity]
platform/external-system-api/src/com/intellij/openapi/externalSystem/service/ParametersEnhancer.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/service/ParametersEnhancer.java with 100% similarity]
platform/external-system-api/src/com/intellij/openapi/externalSystem/service/project/ExternalLibraryPathTypeMapper.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/service/project/ExternalLibraryPathTypeMapper.java with 87% similarity]
platform/external-system-api/src/com/intellij/openapi/externalSystem/service/project/ExternalSystemProjectResolver.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/service/project/ExternalSystemProjectResolver.java with 97% similarity]
platform/external-system-api/src/com/intellij/openapi/externalSystem/service/project/ModuleAwareContentRoot.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/service/project/ModuleAwareContentRoot.java with 100% similarity]
platform/external-system-api/src/com/intellij/openapi/externalSystem/service/project/PlatformFacade.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/service/project/PlatformFacade.java with 94% similarity]
platform/external-system-api/src/com/intellij/openapi/externalSystem/service/project/manage/ProjectDataService.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/service/project/manage/ProjectDataService.java with 100% similarity]
platform/external-system-api/src/com/intellij/openapi/externalSystem/settings/AbstractExternalSystemLocalSettings.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/settings/AbstractExternalSystemLocalSettings.java with 100% similarity]
platform/external-system-api/src/com/intellij/openapi/externalSystem/settings/AbstractExternalSystemSettings.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/settings/AbstractExternalSystemSettings.java with 100% similarity]
platform/external-system-api/src/com/intellij/openapi/externalSystem/settings/ExternalSystemSettingsListener.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/settings/ExternalSystemSettingsListener.java with 100% similarity]
platform/external-system-api/src/com/intellij/openapi/externalSystem/util/ArtifactInfo.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/util/ArtifactInfo.java with 100% similarity]
platform/external-system-api/src/com/intellij/openapi/externalSystem/util/ExternalSystemApiUtil.java [new file with mode: 0644]
platform/external-system-api/src/com/intellij/openapi/externalSystem/util/ExternalSystemBundle.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/util/ExternalSystemBundle.java with 100% similarity]
platform/external-system-api/src/com/intellij/openapi/externalSystem/util/ExternalSystemConstants.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/util/ExternalSystemConstants.java with 100% similarity]
platform/external-system-api/src/com/intellij/openapi/externalSystem/util/IdeEntityVisitor.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/util/IdeEntityVisitor.java with 100% similarity]
platform/external-system-api/src/com/intellij/openapi/externalSystem/util/IntegrationKey.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/util/IntegrationKey.java with 100% similarity]
platform/external-system-api/src/com/intellij/openapi/externalSystem/util/Order.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/util/Order.java with 100% similarity]
platform/external-system-impl/external-system-impl.iml [moved from platform/external-system/external-system.iml with 73% similarity]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/model/settings/LocationSettingType.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/model/settings/LocationSettingType.java with 87% similarity]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/model/task/AbstractExternalSystemTask.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/model/task/AbstractExternalSystemTask.java with 96% similarity]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/model/task/ExternalSystemResolveProjectTask.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/model/task/ExternalSystemResolveProjectTask.java with 77% similarity]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/model/task/ExternalSystemTaskAware.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/model/task/ExternalSystemTaskAware.java with 100% similarity]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/DisposableExternalSystemService.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/service/DisposableExternalSystemService.java with 100% similarity]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/ExternalSystemFacadeImpl.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/service/ExternalSystemFacadeImpl.java with 99% similarity]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/ExternalSystemFacadeManager.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/service/ExternalSystemFacadeManager.java with 97% similarity]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/RemoteExternalSystemFacade.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/service/RemoteExternalSystemFacade.java with 98% similarity]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/RemoteExternalSystemService.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/service/RemoteExternalSystemService.java with 95% similarity]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/notification/ExternalSystemProgressNotificationManager.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/service/notification/ExternalSystemProgressNotificationManager.java with 100% similarity]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/ExternalLibraryPathTypeMapperImpl.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/service/project/ExternalLibraryPathTypeMapperImpl.java with 100% similarity]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/PlatformFacadeImpl.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/service/project/PlatformFacadeImpl.java with 86% similarity]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/ProjectStructureHelper.java [new file with mode: 0644]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/ProjectStructureServices.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/service/project/ProjectStructureServices.java with 76% similarity]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/AbstractDependencyDataService.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/service/project/manage/AbstractDependencyDataService.java with 90% similarity]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/ContentRootDataService.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/service/project/manage/ContentRootDataService.java with 93% similarity]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/LibraryDataService.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/service/project/manage/LibraryDataService.java with 84% similarity]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/LibraryDependencyDataService.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/service/project/manage/LibraryDependencyDataService.java with 91% similarity]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/ModuleDataService.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/service/project/manage/ModuleDataService.java with 96% similarity]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/ModuleDependencyDataService.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/service/project/manage/ModuleDependencyDataService.java with 93% similarity]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/ProjectDataManager.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/service/project/manage/ProjectDataManager.java with 96% similarity]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/ProjectDataServiceImpl.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/service/project/manage/ProjectDataServiceImpl.java with 92% similarity]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/ProjectEntityChangeListener.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/service/project/manage/ProjectEntityChangeListener.java with 100% similarity]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/wizard/AbstractExternalProjectImportBuilder.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/service/project/wizard/AbstractExternalProjectImportBuilder.java with 94% similarity]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/wizard/AbstractExternalProjectImportProvider.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/service/project/wizard/AbstractExternalProjectImportProvider.java with 100% similarity]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/wizard/AbstractImportFromExternalSystemWizardStep.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/service/project/wizard/AbstractImportFromExternalSystemWizardStep.java with 100% similarity]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/wizard/ExternalProjectOpenProcessor.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/service/project/wizard/ExternalProjectOpenProcessor.java with 100% similarity]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/wizard/SelectExternalProjectStepBase.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/service/project/wizard/SelectExternalProjectStepBase.java with 100% similarity]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/remote/AbstractRemoteExternalSystemService.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/service/remote/AbstractRemoteExternalSystemService.java with 97% similarity]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/remote/ExternalSystemProgressNotificationManagerImpl.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/service/remote/ExternalSystemProgressNotificationManagerImpl.java with 100% similarity]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/remote/RemoteExternalSystemBuildManager.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/service/remote/RemoteExternalSystemBuildManager.java with 97% similarity]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/remote/RemoteExternalSystemBuildManagerImpl.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/service/remote/RemoteExternalSystemBuildManagerImpl.java with 96% similarity]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/remote/RemoteExternalSystemProgressNotificationManager.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/service/remote/RemoteExternalSystemProgressNotificationManager.java with 100% similarity]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/remote/RemoteExternalSystemProjectResolver.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/service/remote/RemoteExternalSystemProjectResolver.java with 97% similarity]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/remote/RemoteExternalSystemProjectResolverImpl.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/service/remote/RemoteExternalSystemProjectResolverImpl.java with 95% similarity]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/remote/wrapper/AbstractRemoteExternalSystemServiceWrapper.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/service/remote/wrapper/AbstractRemoteExternalSystemServiceWrapper.java with 97% similarity]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/remote/wrapper/ExternalSystemBuildManagerWrapper.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/service/remote/wrapper/ExternalSystemBuildManagerWrapper.java with 97% similarity]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/remote/wrapper/ExternalSystemFacadeWrapper.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/service/remote/wrapper/ExternalSystemFacadeWrapper.java with 97% similarity]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/remote/wrapper/ExternalSystemProjectResolverWrapper.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/service/remote/wrapper/ExternalSystemProjectResolverWrapper.java with 97% similarity]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/settings/AbstractExternalProjectConfigurable.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/service/settings/AbstractExternalProjectConfigurable.java with 100% similarity]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/task/ExternalSystemTaskManager.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/service/task/ExternalSystemTaskManager.java with 100% similarity]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/settings/ExternalSystemSettingsManager.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/settings/ExternalSystemSettingsManager.java with 98% similarity]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/util/ExternalSystemUiUtil.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/util/ExternalSystemUiUtil.java with 59% similarity]
platform/external-system-impl/src/com/intellij/openapi/externalSystem/util/ExternalSystemUtil.java [moved from platform/external-system/src/com/intellij/openapi/externalSystem/util/ExternalSystemUtil.java with 55% similarity]
platform/external-system/src/com/intellij/openapi/externalSystem/model/ExternalSystemDataKeys.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/AbstractCompositeData.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/CompositeLibraryDependencyData.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/ExternalEntityCloneContext.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/JarData.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/LibraryDependencyData.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/ProjectEntityType.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/AbstractConflictingPropertyChange.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/AbstractExternalProjectStructureChange.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/AbstractProjectEntityPresenceChange.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/ContentRootPresenceChange.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/DependencyExportedChange.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/DependencyScopeChange.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/ExternalProjectStructureChange.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/ExternalProjectStructureChangeVisitor.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/ExternalProjectStructureChangeVisitorAdapter.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/ExternalProjectStructureChangesCalculator.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/GradleProjectRenameChange.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/JarPresenceChange.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/LanguageLevelChange.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/LibraryDependencyPresenceChange.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/ModuleDependencyPresenceChange.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/ModulePresenceChange.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/OutdatedLibraryVersionChange.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/user/AbstractDependencyAwareUserChange.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/user/AbstractDependencyExportedUserChange.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/user/AbstractDependencyScopeUserChange.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/user/AbstractModuleAwareUserChange.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/user/AbstractUserProjectChange.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/user/AddLibraryDependencyUserChange.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/user/AddModuleDependencyUserChange.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/user/AddModuleUserChange.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/user/LibraryDependencyExportedChange.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/user/LibraryDependencyScopeUserChange.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/user/ModuleDependencyExportedChange.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/user/ModuleDependencyScopeUserChange.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/user/RemoveLibraryDependencyUserChange.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/user/RemoveModuleDependencyUserChange.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/user/RemoveModuleUserChange.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/user/UserProjectChange.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/user/UserProjectChangeVisitor.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/id/AbstractCompositeExternalEntityId.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/id/AbstractExternalDependencyId.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/id/AbstractExternalEntityId.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/id/CompositeLibraryDependencyId.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/id/ContentRootId.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/id/EntityIdMapper.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/id/GradleSyntheticId.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/id/JarId.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/id/LibraryDependencyId.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/id/LibraryId.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/id/ModuleDependencyId.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/id/ModuleId.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/id/ProjectEntityId.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/model/project/id/ProjectId.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/service/project/ProjectStructureChangesDetector.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/service/project/ProjectStructureHelper.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/service/project/change/AutoImporter.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/service/project/change/ExternalProjectChangesCalculationContext.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/service/project/change/ExternalProjectStructureChangeListener.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/service/project/change/ExternalProjectStructureChangesPostProcessor.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/service/project/change/ExternalProjectStructureChangesPreProcessor.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/service/project/change/MovedJarsPostProcessor.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/service/project/change/OutdatedLibraryVersionPostProcessor.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/service/project/change/ProjectStructureChangesModel.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/service/project/change/user/UserProjectChangesCalculator.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/service/project/manage/EntityManageHelper.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/service/project/manage/GradleLocalNodeManageHelper.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/service/project/manage/JarDataService.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/service/project/manage/OutdatedLibraryService.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/service/project/wizard/AdjustExternalProjectImportSettingsStep.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/settings/ExternalSystemTextAttributes.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/settings/UserProjectChanges.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/ui/ExternalProjectStructureNodeComparator.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/ui/ExternalProjectStructureNodeFilter.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/ui/ExternalProjectStructureTreeModel.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/ui/ProjectStructureNode.java [deleted file]
platform/external-system/src/com/intellij/openapi/externalSystem/ui/ProjectStructureNodeDescriptor.java [deleted file]
platform/platform-resources/src/META-INF/ExternalSystemExtensions.xml
plugins/gradle/gradle.iml
plugins/gradle/src/org/jetbrains/plugins/gradle/GradleManager.java
plugins/gradle/src/org/jetbrains/plugins/gradle/action/AbstractGradleSyncTreeFilterAction.java [deleted file]
plugins/gradle/src/org/jetbrains/plugins/gradle/action/AbstractGradleSyncTreeNodeAction.java [deleted file]
plugins/gradle/src/org/jetbrains/plugins/gradle/action/GradleConflictSyncTreeFilterAction.java [deleted file]
plugins/gradle/src/org/jetbrains/plugins/gradle/action/GradleImportEntityAction.java [deleted file]
plugins/gradle/src/org/jetbrains/plugins/gradle/action/GradleLinkToProjectAction.java [deleted file]
plugins/gradle/src/org/jetbrains/plugins/gradle/action/GradleLocalSyncTreeFilterAction.java [deleted file]
plugins/gradle/src/org/jetbrains/plugins/gradle/action/GradleOutdatedSyncTreeFilterAction.java [deleted file]
plugins/gradle/src/org/jetbrains/plugins/gradle/action/GradleRebuildStructureChangesTreeAction.java [deleted file]
plugins/gradle/src/org/jetbrains/plugins/gradle/action/GradleRefreshProjectAction.java
plugins/gradle/src/org/jetbrains/plugins/gradle/action/GradleRemoveIdeEntityAction.java [deleted file]
plugins/gradle/src/org/jetbrains/plugins/gradle/action/GradleResetTreeFiltersAction.java [deleted file]
plugins/gradle/src/org/jetbrains/plugins/gradle/action/GradleShowConflictDetailsAction.java [deleted file]
plugins/gradle/src/org/jetbrains/plugins/gradle/action/GradleSyncAction.java [deleted file]
plugins/gradle/src/org/jetbrains/plugins/gradle/action/IntellijLocalSyncTreeFilterAction.java [deleted file]
plugins/gradle/src/org/jetbrains/plugins/gradle/config/GradleColorAndFontDescriptorsProvider.java [deleted file]
plugins/gradle/src/org/jetbrains/plugins/gradle/config/GradleColorAndFontPanelFactory.java [deleted file]
plugins/gradle/src/org/jetbrains/plugins/gradle/config/GradleColorAndFontPreviewPanel.java [deleted file]
plugins/gradle/src/org/jetbrains/plugins/gradle/config/GradleToolWindowPanel.java
plugins/gradle/src/org/jetbrains/plugins/gradle/diff/GradleDiffUtil.java [deleted file]
plugins/gradle/src/org/jetbrains/plugins/gradle/diff/contentroot/GradleContentRootStructureChangesCalculator.java [deleted file]
plugins/gradle/src/org/jetbrains/plugins/gradle/diff/dependency/AbstractGradleDependencyStructureChangesCalculator.java [deleted file]
plugins/gradle/src/org/jetbrains/plugins/gradle/diff/dependency/GradleLibraryDependencyStructureChangesCalculator.java [deleted file]
plugins/gradle/src/org/jetbrains/plugins/gradle/diff/dependency/GradleModuleDependencyStructureChangesCalculator.java [deleted file]
plugins/gradle/src/org/jetbrains/plugins/gradle/diff/library/GradleLibraryStructureChangesCalculator.java [deleted file]
plugins/gradle/src/org/jetbrains/plugins/gradle/diff/module/GradleModuleStructureChangesCalculator.java [deleted file]
plugins/gradle/src/org/jetbrains/plugins/gradle/diff/project/GradleProjectStructureChangesCalculator.java [deleted file]
plugins/gradle/src/org/jetbrains/plugins/gradle/manage/wizard/adjust/GradleAdjustImportSettingsUtil.java [deleted file]
plugins/gradle/src/org/jetbrains/plugins/gradle/manage/wizard/adjust/GradleContentRootSettings.java [deleted file]
plugins/gradle/src/org/jetbrains/plugins/gradle/manage/wizard/adjust/GradleJarSettings.java [deleted file]
plugins/gradle/src/org/jetbrains/plugins/gradle/manage/wizard/adjust/GradleLibraryDependencySettings.java [deleted file]
plugins/gradle/src/org/jetbrains/plugins/gradle/manage/wizard/adjust/GradleLibrarySettings.java [deleted file]
plugins/gradle/src/org/jetbrains/plugins/gradle/manage/wizard/adjust/GradleModuleDependencySettings.java [deleted file]
plugins/gradle/src/org/jetbrains/plugins/gradle/manage/wizard/adjust/GradleModuleSettings.java [deleted file]
plugins/gradle/src/org/jetbrains/plugins/gradle/manage/wizard/adjust/GradleProjectSettings.java [deleted file]
plugins/gradle/src/org/jetbrains/plugins/gradle/manage/wizard/adjust/GradleProjectSettingsBuilder.java [deleted file]
plugins/gradle/src/org/jetbrains/plugins/gradle/manage/wizard/adjust/GradleProjectStructureFactory.java [deleted file]
plugins/gradle/src/org/jetbrains/plugins/gradle/manage/wizard/adjust/GradleProjectStructureNodeSettings.java [deleted file]
plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/GradleProjectResolver.java
plugins/gradle/src/org/jetbrains/plugins/gradle/service/settings/GradleProjectImportBuilder.java
plugins/gradle/src/org/jetbrains/plugins/gradle/settings/GradleExecutionSettings.java
plugins/gradle/src/org/jetbrains/plugins/gradle/sync/GradleDuplicateLibrariesPreProcessor.java [deleted file]
plugins/gradle/src/org/jetbrains/plugins/gradle/sync/GradleProjectStructureChangesPanel.java [deleted file]
plugins/gradle/src/org/jetbrains/plugins/gradle/sync/GradleProjectStructureFiltersPanel.java [deleted file]
plugins/gradle/src/org/jetbrains/plugins/gradle/sync/conflict/GradleCommonDependencyConflictControlFactory.java [deleted file]
plugins/gradle/src/org/jetbrains/plugins/gradle/sync/conflict/GradleConflictControlFactory.java [deleted file]
plugins/gradle/src/org/jetbrains/plugins/gradle/sync/conflict/GradleProjectConflictControlFactory.java [deleted file]
plugins/gradle/src/org/jetbrains/plugins/gradle/ui/GradleToolWindowFactory.java
plugins/gradle/src/org/jetbrains/plugins/gradle/util/GradleConstants.java
plugins/gradle/src/org/jetbrains/plugins/gradle/util/GradleUtil.java
plugins/gradle/testSources/org/jetbrains/plugins/gradle/util/TestMovedJarsPostProcessor.java [deleted file]
resources/src/META-INF/IdeaPlugin.xml

index 0befbcc14ef42184ff9e3eaed02f3dbfaeb473ab..9200ecdc4b0b6762bea52166aca27958f212d9d4 100644 (file)
@@ -254,6 +254,7 @@ binding.setVariable("platformApiModules", [
         "usageView",
         "xdebugger-api",
         "xml-openapi",
+        "external-system-api",
 ])
 
 
@@ -276,7 +277,7 @@ binding.setVariable("platformImplementationModules", [
         "images",
         "RegExpSupport",
         "dvcs",
-        "external-system"
+        "external-system-impl"
 ])
 
 binding.setVariable("layoutMacApp", { String path, String ch, Map args ->
index 89e9dba328f06d7713e70a5469efcdd2000e2665..8fa9e62eb8d964083caba5dcb362b1d55567b142 100644 (file)
@@ -11,6 +11,8 @@
     <orderEntry type="module" module-name="core-impl" exported="" />
     <orderEntry type="module" module-name="resources-en" />
     <orderEntry type="library" name="asm4" level="project" />
+    <orderEntry type="module" module-name="openapi" />
+    <orderEntry type="module" module-name="external-system-api" />
   </component>
 </module>
 
similarity index 89%
rename from platform/external-system/src/com/intellij/openapi/externalSystem/model/project/JavaProjectData.java
rename to java/java-psi-impl/src/com/intellij/externalSystem/JavaProjectData.java
index fc0cae1d2e13dcba6786b573f1d5b7ec0a5627aa..d1f5bfa9503ab508fbd7be7537b8d56fa759df3e 100644 (file)
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.intellij.openapi.externalSystem.model.project;
+package com.intellij.externalSystem;
 
 import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.externalSystem.model.DataNode;
+import com.intellij.openapi.externalSystem.model.Key;
 import com.intellij.openapi.externalSystem.model.ProjectSystemId;
-import com.intellij.openapi.externalSystem.model.project.id.ProjectEntityId;
-import com.intellij.openapi.externalSystem.model.project.id.ProjectId;
-import com.intellij.openapi.externalSystem.util.ExternalSystemUtil;
+import com.intellij.openapi.externalSystem.model.project.AbstractProjectEntityData;
+import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil;
 import com.intellij.openapi.projectRoots.JavaSdkVersion;
 import com.intellij.pom.java.LanguageLevel;
 import org.jetbrains.annotations.NotNull;
@@ -34,7 +33,9 @@ import java.util.regex.Pattern;
  * @since 4/12/13 12:27 PM
  */
 public class JavaProjectData extends AbstractProjectEntityData {
-
+  
+  @NotNull public static final Key<JavaProjectData> KEY = Key.create(JavaProjectData.class);
+  
   private static final Logger LOG = Logger.getInstance("#" + JavaProjectData.class.getName());
 
   private static final long serialVersionUID = 1L;
@@ -54,18 +55,12 @@ public class JavaProjectData extends AbstractProjectEntityData {
   }
 
   @NotNull
-  @Override
-  public ProjectEntityId getId(@Nullable DataNode<?> dataNode) {
-    return new ProjectId(getOwner());
-  }
-
-  @NotNull
   public String getCompileOutputPath() {
     return myCompileOutputPath;
   }
 
   public void setCompileOutputPath(@NotNull String compileOutputPath) {
-    myCompileOutputPath = ExternalSystemUtil.toCanonicalPath(compileOutputPath);
+    myCompileOutputPath = ExternalSystemApiUtil.toCanonicalPath(compileOutputPath);
   }
 
   @NotNull
similarity index 65%
rename from platform/external-system/src/com/intellij/openapi/externalSystem/service/project/manage/JavaProjectDataService.java
rename to java/java-psi-impl/src/com/intellij/externalSystem/JavaProjectDataService.java
index d8d2c44cce28c0f3333d94de7ed4c27d699a29ec..05132a8b7734912f1f3c3d3cf07136012faa9064 100644 (file)
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.intellij.openapi.externalSystem.service.project.manage;
+package com.intellij.externalSystem;
 
-import com.intellij.ide.impl.NewProjectUtil;
 import com.intellij.openapi.externalSystem.model.DataNode;
 import com.intellij.openapi.externalSystem.model.Key;
-import com.intellij.openapi.externalSystem.model.ProjectKeys;
 import com.intellij.openapi.externalSystem.model.ProjectSystemId;
-import com.intellij.openapi.externalSystem.model.project.JavaProjectData;
-import com.intellij.openapi.externalSystem.util.ExternalSystemUtil;
+import com.intellij.openapi.externalSystem.service.project.manage.ProjectDataService;
+import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.projectRoots.JavaSdk;
 import com.intellij.openapi.projectRoots.JavaSdkVersion;
+import com.intellij.openapi.projectRoots.ProjectJdkTable;
 import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.openapi.roots.LanguageLevelProjectExtension;
-import com.intellij.openapi.roots.ex.ProjectRootManagerEx;
+import com.intellij.openapi.roots.ProjectRootManager;
 import com.intellij.pom.java.LanguageLevel;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 
 import java.util.Collection;
+import java.util.List;
 
 /**
  * @author Denis Zhdanov
@@ -42,7 +43,7 @@ public class JavaProjectDataService implements ProjectDataService<JavaProjectDat
   @NotNull
   @Override
   public Key<JavaProjectData> getTargetDataKey() {
-    return ProjectKeys.JAVA_PROJECT;
+    return JavaProjectData.KEY;
   }
 
   @Override
@@ -55,13 +56,19 @@ public class JavaProjectDataService implements ProjectDataService<JavaProjectDat
     // JDK.
     JavaSdkVersion version = projectData.getJdkVersion();
     JavaSdk javaSdk = JavaSdk.getInstance();
-    Sdk sdk = ProjectRootManagerEx.getInstanceEx(project).getProjectSdk();
+    ProjectRootManager rootManager = ProjectRootManager.getInstance(project);
+    Sdk sdk = rootManager.getProjectSdk();
     if (sdk instanceof JavaSdk) {
       JavaSdkVersion currentVersion = javaSdk.getVersion(sdk);
       if (currentVersion == null || !currentVersion.isAtLeast(version)) {
-        Sdk newJdk = ExternalSystemUtil.findJdk(version);
+        Sdk newJdk = findJdk(version);
         if (newJdk != null) {
-          NewProjectUtil.applyJdkToProject(project, newJdk);
+          rootManager.setProjectSdk(sdk);
+          LanguageLevel level = version.getMaxLanguageLevel();
+          LanguageLevelProjectExtension ext = LanguageLevelProjectExtension.getInstance(project);
+          if (level.compareTo(ext.getLanguageLevel()) < 0) {
+            ext.setLanguageLevel(level);
+          }
         }
       }
     }
@@ -69,6 +76,23 @@ public class JavaProjectDataService implements ProjectDataService<JavaProjectDat
     setLanguageLevel(projectData.getLanguageLevel(), project, synchronous);
   }
 
+  @Nullable
+  private static Sdk findJdk(@NotNull JavaSdkVersion version) {
+    JavaSdk javaSdk = JavaSdk.getInstance();
+    List<Sdk> javaSdks = ProjectJdkTable.getInstance().getSdksOfType(javaSdk);
+    Sdk candidate = null;
+    for (Sdk sdk : javaSdks) {
+      JavaSdkVersion v = javaSdk.getVersion(sdk);
+      if (v == version) {
+        return sdk;
+      }
+      else if (candidate == null && v != null && version.getMaxLanguageLevel().isAtLeast(version.getMaxLanguageLevel())) {
+        candidate = sdk;
+      }
+    }
+    return candidate;
+  }
+  
   @Override
   public void removeData(@NotNull Collection<DataNode<JavaProjectData>> toRemove, @NotNull Project project, boolean synchronous) {
   }
@@ -79,12 +103,12 @@ public class JavaProjectDataService implements ProjectDataService<JavaProjectDat
     if (languageLevelExtension.getLanguageLevel().isAtLeast(languageLevel)) {
       return;
     }
-    ExternalSystemUtil.executeProjectChangeAction(project, ProjectSystemId.IDE, synchronous, new Runnable() {
+    ExternalSystemApiUtil.executeProjectChangeAction(project, ProjectSystemId.IDE, synchronous, new Runnable() {
       @Override
       public void run() {
         languageLevelExtension.setLanguageLevel(languageLevel);
       }
     });
   }
-
+  
 }
diff --git a/platform/external-system-api/external-system-api.iml b/platform/external-system-api/external-system-api.iml
new file mode 100644 (file)
index 0000000..8df6aab
--- /dev/null
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+  <component name="NewModuleRootManager" inherit-compiler-output="true">
+    <exclude-output />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/resources" isTestSource="false" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="module" module-name="annotations" exported="" />
+    <orderEntry type="module" module-name="util" exported="" />
+    <orderEntry type="module" module-name="projectModel-api" exported="" />
+    <orderEntry type="module" module-name="platform-api" exported="" />
+    <orderEntry type="module" module-name="lang-api" exported="" />
+  </component>
+</module>
+
similarity index 98%
rename from platform/external-system/src/com/intellij/openapi/externalSystem/ExternalSystemManager.java
rename to platform/external-system-api/src/com/intellij/openapi/externalSystem/ExternalSystemManager.java
index 86cec31f9af594ee22a65e5c560a645d5593161d..84eb746a7783f7e6a63bd99400ac086aa6e76ac8 100644 (file)
@@ -3,9 +3,9 @@ package com.intellij.openapi.externalSystem;
 import com.intellij.openapi.extensions.ExtensionPointName;
 import com.intellij.openapi.externalSystem.build.ExternalSystemBuildManager;
 import com.intellij.openapi.externalSystem.model.ProjectSystemId;
+import com.intellij.openapi.externalSystem.model.settings.ExternalSystemExecutionSettings;
 import com.intellij.openapi.externalSystem.service.ParametersEnhancer;
 import com.intellij.openapi.externalSystem.service.project.ExternalSystemProjectResolver;
-import com.intellij.openapi.externalSystem.service.remote.ExternalSystemExecutionSettings;
 import com.intellij.openapi.externalSystem.settings.AbstractExternalSystemLocalSettings;
 import com.intellij.openapi.externalSystem.settings.AbstractExternalSystemSettings;
 import com.intellij.openapi.externalSystem.settings.ExternalSystemSettingsListener;
similarity index 96%
rename from platform/external-system/src/com/intellij/openapi/externalSystem/build/ExternalSystemBuildManager.java
rename to platform/external-system-api/src/com/intellij/openapi/externalSystem/build/ExternalSystemBuildManager.java
index e53b2c062feacabb4bae0440b053595cb4313edb..8b7b5a1775f5ecba569f6ac37b1eef84d3030066 100644 (file)
@@ -18,7 +18,7 @@ package com.intellij.openapi.externalSystem.build;
 import com.intellij.openapi.externalSystem.model.ExternalSystemException;
 import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskDescriptor;
 import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskId;
-import com.intellij.openapi.externalSystem.service.remote.ExternalSystemExecutionSettings;
+import com.intellij.openapi.externalSystem.model.settings.ExternalSystemExecutionSettings;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
diff --git a/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/ExternalSystemDataKeys.java b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/ExternalSystemDataKeys.java
new file mode 100644 (file)
index 0000000..a8c4742
--- /dev/null
@@ -0,0 +1,17 @@
+package com.intellij.openapi.externalSystem.model;
+
+/**
+ * @author Denis Zhdanov
+ * @since 2/7/12 11:19 AM
+ */
+public class ExternalSystemDataKeys {
+
+  // TODO den uncomment
+  
+//  public static final DataKey<GradleTasksList> RECENT_TASKS_LIST = DataKey.create("gradle.recent.tasks.list");
+
+//  public static final DataKey<GradleTasksModel> ALL_TASKS_MODEL = DataKey.create("gradle.all.tasks.model");
+
+  private ExternalSystemDataKeys() {
+  }
+}
similarity index 87%
rename from platform/external-system/src/com/intellij/openapi/externalSystem/model/ProjectKeys.java
rename to platform/external-system-api/src/com/intellij/openapi/externalSystem/model/ProjectKeys.java
index 7d8a9b1280a8677d82139e040f69a6a5565a0ae7..f18da33ffbce865690c1b30b9b4b2747f54531d7 100644 (file)
@@ -27,13 +27,11 @@ import org.jetbrains.annotations.NotNull;
 public class ProjectKeys {
 
   @NotNull public static final Key<ProjectData>           PROJECT            = Key.create(ProjectData.class);
-  @NotNull public static final Key<JavaProjectData>       JAVA_PROJECT       = Key.create(JavaProjectData.class);
   @NotNull public static final Key<ModuleData>            MODULE             = Key.create(ModuleData.class);
   @NotNull public static final Key<LibraryData>           LIBRARY            = Key.create(LibraryData.class);
   @NotNull public static final Key<ContentRootData>       CONTENT_ROOT       = Key.create(ContentRootData.class);
   @NotNull public static final Key<ModuleDependencyData>  MODULE_DEPENDENCY  = Key.create(ModuleDependencyData.class);
   @NotNull public static final Key<LibraryDependencyData> LIBRARY_DEPENDENCY = Key.create(LibraryDependencyData.class);
-  @NotNull public static final Key<JarData>               JAR                = Key.create(JarData.class);
 
   private ProjectKeys() {
   }
similarity index 74%
rename from platform/external-system/src/com/intellij/openapi/externalSystem/model/project/ContentRootData.java
rename to platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/ContentRootData.java
index 6bfbe45e545f1dc822ccb5b207db63f393890b2a..391f12316610f37bd98b3e9bc9db310f96032e4a 100644 (file)
@@ -1,14 +1,10 @@
 package com.intellij.openapi.externalSystem.model.project;
 
-import com.intellij.openapi.externalSystem.model.DataNode;
-import com.intellij.openapi.externalSystem.model.ProjectKeys;
 import com.intellij.openapi.externalSystem.model.ProjectSystemId;
-import com.intellij.openapi.externalSystem.model.project.id.ContentRootId;
-import com.intellij.openapi.externalSystem.util.ExternalSystemUtil;
+import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil;
 import com.intellij.openapi.util.io.FileUtil;
 import com.intellij.util.containers.ContainerUtilRt;
 import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
 
 import java.io.File;
 import java.util.Collection;
@@ -34,22 +30,7 @@ public class ContentRootData extends AbstractProjectEntityData {
    */
   public ContentRootData(@NotNull ProjectSystemId owner, @NotNull String rootPath) {
     super(owner);
-    myRootPath = ExternalSystemUtil.toCanonicalPath(rootPath);
-  }
-
-  @NotNull
-  @Override
-  public ContentRootId getId(@Nullable DataNode<?> dataNode) {
-    if (dataNode == null) {
-      throw new IllegalArgumentException(String.format("Can't build id for %s. Reason: given data holder is undefined", this));
-    }
-    ModuleData moduleData = dataNode.getData(ProjectKeys.MODULE);
-    if (moduleData == null) {
-      throw new IllegalArgumentException(String.format(
-        "Can't build id for %s. Reason: given data holder doesn't contain information about owner module", this
-      ));
-    }
-    return new ContentRootId(getOwner(), moduleData.getName(), getRootPath());
+    myRootPath = ExternalSystemApiUtil.toCanonicalPath(rootPath);
   }
 
   /**
@@ -76,7 +57,7 @@ public class ContentRootData extends AbstractProjectEntityData {
       if (paths == null) {
         myData.put(type, paths = ContainerUtilRt.newHashSet());
       }
-      paths.add(ExternalSystemUtil.toCanonicalPath(path));
+      paths.add(ExternalSystemApiUtil.toCanonicalPath(path));
       return;
     }
     if (!ExternalSystemSourceType.EXCLUDED.equals(type)) { // There are external systems which mark output directory as 'excluded' path.
similarity index 75%
rename from platform/external-system/src/com/intellij/openapi/externalSystem/model/project/LibraryData.java
rename to platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/LibraryData.java
index 81bd417c8c246c1e51c19e26221b2594ef4a8212..c2975e8ed605c1e27cecdc4189bfc2b71c6b7afc 100644 (file)
@@ -1,13 +1,9 @@
 package com.intellij.openapi.externalSystem.model.project;
 
-import com.intellij.openapi.externalSystem.model.DataNode;
 import com.intellij.openapi.externalSystem.model.ProjectSystemId;
-import com.intellij.openapi.externalSystem.model.project.id.LibraryId;
-import com.intellij.openapi.externalSystem.model.project.id.ProjectEntityId;
-import com.intellij.openapi.externalSystem.util.ExternalSystemUtil;
+import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil;
 import com.intellij.util.containers.HashMap;
 import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
 
 import java.util.Collections;
 import java.util.HashSet;
@@ -31,12 +27,6 @@ public class LibraryData extends AbstractNamedData implements Named {
   }
 
   @NotNull
-  @Override
-  public ProjectEntityId getId(@Nullable DataNode<?> dataNode) {
-    return new LibraryId(getOwner(), getName());
-  }
-
-  @NotNull
   public Set<String> getPaths(@NotNull LibraryPathType type) {
     Set<String> result = myPaths.get(type);
     return result == null ? Collections.<String>emptySet() : result;
@@ -47,7 +37,7 @@ public class LibraryData extends AbstractNamedData implements Named {
     if (paths == null) {
       myPaths.put(type, paths = new HashSet<String>());
     } 
-    paths.add(ExternalSystemUtil.toCanonicalPath(path));
+    paths.add(ExternalSystemApiUtil.toCanonicalPath(path));
   }
 
   public void forgetAllPaths() {
diff --git a/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/LibraryDependencyData.java b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/LibraryDependencyData.java
new file mode 100644 (file)
index 0000000..6a22185
--- /dev/null
@@ -0,0 +1,16 @@
+package com.intellij.openapi.externalSystem.model.project;
+
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Not thread-safe.
+ * 
+ * @author Denis Zhdanov
+ * @since 8/10/11 6:46 PM
+ */
+public class LibraryDependencyData extends AbstractDependencyData<LibraryData> implements Named {
+
+  public LibraryDependencyData(@NotNull ModuleData ownerModule, @NotNull LibraryData library) {
+    super(ownerModule, library);
+  }
+}
similarity index 78%
rename from platform/external-system/src/com/intellij/openapi/externalSystem/model/project/ModuleData.java
rename to platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/ModuleData.java
index b460cc5743fb144bc33f69bfa7f700e66ad2ef97..d1467cab1d59207e3e1afba7fcf2d8f5cd99dc6d 100644 (file)
@@ -1,11 +1,8 @@
 package com.intellij.openapi.externalSystem.model.project;
 
 import com.intellij.ide.highlighter.ModuleFileType;
-import com.intellij.openapi.externalSystem.model.DataNode;
 import com.intellij.openapi.externalSystem.model.ProjectSystemId;
-import com.intellij.openapi.externalSystem.model.project.id.ModuleId;
-import com.intellij.openapi.externalSystem.model.project.id.ProjectEntityId;
-import com.intellij.openapi.externalSystem.util.ExternalSystemUtil;
+import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil;
 import com.intellij.util.containers.ContainerUtilRt;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -31,18 +28,12 @@ public class ModuleData extends AbstractNamedData implements Named {
   }
 
   @NotNull
-  @Override
-  public ProjectEntityId getId(@Nullable DataNode<?> dataNode) {
-    return new ModuleId(getOwner(), getName());
-  }
-
-  @NotNull
   public String getModuleFilePath() {
     return myModuleFilePath;
   }
 
   public void setModuleFileDirectoryPath(@NotNull String path) {
-    myModuleFilePath = ExternalSystemUtil.toCanonicalPath(path + "/" + getName() + ModuleFileType.DOT_DEFAULT_EXTENSION);
+    myModuleFilePath = ExternalSystemApiUtil.toCanonicalPath(path + "/" + getName() + ModuleFileType.DOT_DEFAULT_EXTENSION);
   }
 
   public boolean isInheritProjectCompileOutputPath() {
@@ -71,7 +62,7 @@ public class ModuleData extends AbstractNamedData implements Named {
       myCompileOutputPaths.remove(type);
       return;
     }
-    myCompileOutputPaths.put(type, ExternalSystemUtil.toCanonicalPath(path));
+    myCompileOutputPaths.put(type, ExternalSystemApiUtil.toCanonicalPath(path));
   }
 
   
similarity index 62%
rename from platform/external-system/src/com/intellij/openapi/externalSystem/model/project/ModuleDependencyData.java
rename to platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/ModuleDependencyData.java
index 3054388026002ecf57640a69b8ff60054ec9d7ab..3da5e8ddfc4c7aa05d6e231b65c709280025cabf 100644 (file)
@@ -1,10 +1,6 @@
 package com.intellij.openapi.externalSystem.model.project;
 
-import com.intellij.openapi.externalSystem.model.DataNode;
-import com.intellij.openapi.externalSystem.model.project.id.ModuleDependencyId;
-import com.intellij.openapi.externalSystem.model.project.id.ProjectEntityId;
 import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
 
 import java.util.Comparator;
 
@@ -26,10 +22,4 @@ public class ModuleDependencyData extends AbstractDependencyData<ModuleData> {
   public ModuleDependencyData(@NotNull ModuleData ownerModule, @NotNull ModuleData module) {
     super(ownerModule, module);
   }
-
-  @NotNull
-  @Override
-  public ProjectEntityId getId(@Nullable DataNode<?> dataNode) {
-    return new ModuleDependencyId(getOwner(), getOwnerModule().getName(), getName());
-  }
 }
similarity index 68%
rename from platform/external-system/src/com/intellij/openapi/externalSystem/model/project/ProjectData.java
rename to platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/ProjectData.java
index 2e88624b0abff04c8839ad872539acd85d4bde89..bd10e169a481d85aa32e746fe647e13763937ccb 100644 (file)
@@ -1,12 +1,8 @@
 package com.intellij.openapi.externalSystem.model.project;
 
-import com.intellij.openapi.externalSystem.model.DataNode;
 import com.intellij.openapi.externalSystem.model.ProjectSystemId;
-import com.intellij.openapi.externalSystem.model.project.id.ProjectEntityId;
-import com.intellij.openapi.externalSystem.model.project.id.ProjectId;
-import com.intellij.openapi.externalSystem.util.ExternalSystemUtil;
+import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil;
 import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
 
 /**
  * Not thread-safe.
@@ -24,13 +20,7 @@ public class ProjectData extends AbstractNamedData {
                      @NotNull String projectFileDirectoryPath)
   {
     super(owner, "unnamed");
-    myProjectFileDirectoryPath = ExternalSystemUtil.toCanonicalPath(projectFileDirectoryPath);
-  }
-
-  @NotNull
-  @Override
-  public ProjectEntityId getId(@Nullable DataNode<?> dataNode) {
-    return new ProjectId(getOwner());
+    myProjectFileDirectoryPath = ExternalSystemApiUtil.toCanonicalPath(projectFileDirectoryPath);
   }
 
   @NotNull
@@ -39,7 +29,7 @@ public class ProjectData extends AbstractNamedData {
   }
 
   public void setProjectFileDirectoryPath(@NotNull String projectFileDirectoryPath) {
-    myProjectFileDirectoryPath = ExternalSystemUtil.toCanonicalPath(projectFileDirectoryPath);
+    myProjectFileDirectoryPath = ExternalSystemApiUtil.toCanonicalPath(projectFileDirectoryPath);
   }
 
   @Override
similarity index 73%
rename from platform/external-system/src/com/intellij/openapi/externalSystem/model/project/ProjectEntityData.java
rename to platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/ProjectEntityData.java
index 65cd93af1f54b2342d5b8824e5e0741d880548c8..bd42a60ac8728b3db4815f25666f218209092bbf 100644 (file)
@@ -1,10 +1,7 @@
 package com.intellij.openapi.externalSystem.model.project;
 
-import com.intellij.openapi.externalSystem.model.DataNode;
 import com.intellij.openapi.externalSystem.model.ProjectSystemId;
-import com.intellij.openapi.externalSystem.model.project.id.ProjectEntityId;
 import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
 
 import java.beans.PropertyChangeListener;
 import java.beans.PropertyChangeSupport;
@@ -27,15 +24,6 @@ public interface ProjectEntityData extends Serializable {
   ProjectSystemId getOwner();
 
   /**
-   * Allows to map current data to its id.
-   * 
-   * @param dataNode  data holder which holds current data (if any)
-   * @return            current data id
-   */
-  @NotNull
-  ProjectEntityId getId(@Nullable DataNode<?> dataNode);
-  
-  /**
    * Follows contract of {@link PropertyChangeSupport#addPropertyChangeListener(PropertyChangeListener)}  
    * 
    * @param listener  target listener
  */
 package com.intellij.openapi.externalSystem.service.project;
 
-import com.intellij.openapi.roots.JavadocOrderRootType;
+import com.intellij.openapi.externalSystem.model.project.LibraryPathType;
 import com.intellij.openapi.roots.OrderRootType;
 import org.jetbrains.annotations.NotNull;
-import com.intellij.openapi.externalSystem.model.project.LibraryPathType;
 
 /**
  * Strategy for mapping {@link LibraryPathType external library path types} to {@link OrderRootType ide library path types}.
  * <p/>
- * Is introduced because {@link JavadocOrderRootType#getInstance() 'real ide doc type'} assumes that project IoC is setup thus
+ * Is introduced because <code>'JavadocOrderRootType.getInstance()'</code> assumes that project IoC is setup thus
  * make it ineligible for unit testing.
  * <p/>
  * Implementations of this interface are expected to be thread-safe.
@@ -18,8 +18,8 @@ package com.intellij.openapi.externalSystem.service.project;
 import com.intellij.openapi.externalSystem.model.DataNode;
 import com.intellij.openapi.externalSystem.model.ExternalSystemException;
 import com.intellij.openapi.externalSystem.model.project.ProjectData;
+import com.intellij.openapi.externalSystem.model.settings.ExternalSystemExecutionSettings;
 import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskId;
-import com.intellij.openapi.externalSystem.service.remote.ExternalSystemExecutionSettings;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
similarity index 94%
rename from platform/external-system/src/com/intellij/openapi/externalSystem/service/project/PlatformFacade.java
rename to platform/external-system-api/src/com/intellij/openapi/externalSystem/service/project/PlatformFacade.java
index 37b1016f706f2eebae4f08ac52c3340f2d31317e..404c2091b8a41ecd20f1191249c4864e533f4606 100644 (file)
@@ -5,7 +5,6 @@ import com.intellij.openapi.project.Project;
 import com.intellij.openapi.roots.OrderEntry;
 import com.intellij.openapi.roots.libraries.LibraryTable;
 import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.pom.java.LanguageLevel;
 import org.jetbrains.annotations.NotNull;
 
 import java.util.Collection;
@@ -32,9 +31,6 @@ public interface PlatformFacade {
   LibraryTable getProjectLibraryTable(@NotNull Project project);
   
   @NotNull
-  LanguageLevel getLanguageLevel(@NotNull Project project);
-
-  @NotNull
   Collection<Module> getModules(@NotNull Project project);
   
   @NotNull
diff --git a/platform/external-system-api/src/com/intellij/openapi/externalSystem/util/ExternalSystemApiUtil.java b/platform/external-system-api/src/com/intellij/openapi/externalSystem/util/ExternalSystemApiUtil.java
new file mode 100644 (file)
index 0000000..b7f3161
--- /dev/null
@@ -0,0 +1,333 @@
+/*
+ * Copyright 2000-2013 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.openapi.externalSystem.util;
+
+import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.externalSystem.ExternalSystemManager;
+import com.intellij.openapi.externalSystem.model.DataNode;
+import com.intellij.openapi.externalSystem.model.Key;
+import com.intellij.openapi.externalSystem.model.ProjectSystemId;
+import com.intellij.openapi.fileTypes.FileTypes;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.roots.OrderRootType;
+import com.intellij.openapi.roots.libraries.Library;
+import com.intellij.openapi.util.AtomicNotNullLazyValue;
+import com.intellij.openapi.util.NotNullLazyValue;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.openapi.vfs.JarFileSystem;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.util.BooleanFunction;
+import com.intellij.util.PathUtil;
+import com.intellij.util.containers.ContainerUtilRt;
+import com.intellij.util.ui.UIUtil;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.io.File;
+import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * @author Denis Zhdanov
+ * @since 4/1/13 1:31 PM
+ */
+public class ExternalSystemApiUtil {
+
+  private static final Logger LOG = Logger.getInstance("#" + ExternalSystemApiUtil.class.getName());
+
+  @NotNull public static final String PATH_SEPARATOR = "/";
+
+  @NotNull private static final Pattern ARTIFACT_PATTERN = Pattern.compile("(?:.*/)?(.+?)(?:-([\\d+](?:\\.[\\d]+)*))?(?:\\.[^\\.]+?)?");
+
+  @NotNull private static final NotNullLazyValue<Map<ProjectSystemId, ExternalSystemManager<?, ?, ?, ?>>> MANAGERS =
+    new AtomicNotNullLazyValue<Map<ProjectSystemId, ExternalSystemManager<?, ?, ?, ?>>>() {
+      @NotNull
+      @Override
+      protected Map<ProjectSystemId, ExternalSystemManager<?, ?, ?, ?>> compute() {
+        Map<ProjectSystemId, ExternalSystemManager<?, ?, ?, ?>> result = ContainerUtilRt.newHashMap();
+        for (ExternalSystemManager manager : ExternalSystemManager.EP_NAME.getExtensions()) {
+          result.put(manager.getSystemId(), manager);
+        }
+        return result;
+      }
+    };
+
+  @NotNull public static final Comparator<Object> ORDER_AWARE_COMPARATOR = new Comparator<Object>() {
+    @Override
+    public int compare(Object o1, Object o2) {
+      int order1 = getOrder(o1);
+      int order2 = getOrder(o2);
+      return order1 > order2 ? 1 : order1 < order2 ? -1 : 0;
+    }
+
+    private int getOrder(@NotNull Object o) {
+      Queue<Class<?>> toCheck = new ArrayDeque<Class<?>>();
+      toCheck.add(o.getClass());
+      while (!toCheck.isEmpty()) {
+        Class<?> clazz = toCheck.poll();
+        Order annotation = clazz.getAnnotation(Order.class);
+        if (annotation != null) {
+          return annotation.value();
+        }
+        toCheck.add(clazz.getSuperclass());
+        Class<?>[] interfaces = clazz.getInterfaces();
+        if (interfaces != null) {
+          Collections.addAll(toCheck, interfaces);
+        }
+      }
+      return ExternalSystemConstants.UNORDERED;
+    }
+  };
+
+
+  private ExternalSystemApiUtil() {
+  }
+
+  @NotNull
+  public static String extractNameFromPath(@NotNull String path) {
+    String strippedPath = stripPath(path);
+    final int i = strippedPath.lastIndexOf(PATH_SEPARATOR);
+    final String result;
+    if (i < 0 || i >= strippedPath.length() - 1) {
+      result = strippedPath;
+    }
+    else {
+      result = strippedPath.substring(i + 1);
+    }
+    return result;
+  }
+
+  @NotNull
+  private static String stripPath(@NotNull String path) {
+    String[] endingsToStrip = {"/", "!", ".jar"};
+    StringBuilder buffer = new StringBuilder(path);
+    for (String ending : endingsToStrip) {
+      if (buffer.lastIndexOf(ending) == buffer.length() - ending.length()) {
+        buffer.setLength(buffer.length() - ending.length());
+      }
+    }
+    return buffer.toString();
+  }
+
+  @NotNull
+  public static String getLibraryName(@NotNull Library library) {
+    final String result = library.getName();
+    if (result != null) {
+      return result;
+    }
+    for (OrderRootType type : OrderRootType.getAllTypes()) {
+      for (String url : library.getUrls(type)) {
+        String candidate = extractNameFromPath(url);
+        if (!StringUtil.isEmpty(candidate)) {
+          return candidate;
+        }
+      }
+    }
+    assert false;
+    return "unknown-lib";
+  }
+
+  @Nullable
+  public static ArtifactInfo parseArtifactInfo(@NotNull String fileName) {
+    Matcher matcher = ARTIFACT_PATTERN.matcher(fileName);
+    if (!matcher.matches()) {
+      return null;
+    }
+    return new ArtifactInfo(matcher.group(1), null, matcher.group(2));
+  }
+  
+  public static void orderAwareSort(@NotNull List<?> data) {
+    Collections.sort(data, ORDER_AWARE_COMPARATOR);
+  }
+
+  /**
+   * @param path    target path
+   * @return absolute path that points to the same location as the given one and that uses only slashes
+   */
+  @NotNull
+  public static String toCanonicalPath(@NotNull String path) {
+    return PathUtil.getCanonicalPath(new File(path).getAbsolutePath());
+  }
+
+  @NotNull
+  public static String getLocalFileSystemPath(@NotNull VirtualFile file) {
+    if (file.getFileType() == FileTypes.ARCHIVE) {
+      final VirtualFile jar = JarFileSystem.getInstance().getVirtualFileForJar(file);
+      if (jar != null) {
+        return jar.getPath();
+      }
+    }
+    return file.getPath();
+  }
+
+  @Nullable
+  public static ExternalSystemManager<?, ?, ?, ?> getManager(@NotNull ProjectSystemId externalSystemId) {
+    return MANAGERS.getValue().get(externalSystemId);
+  }
+
+  @NotNull
+  public static Map<Key<?>, Collection<DataNode<?>>> group(@NotNull Collection<DataNode<?>> nodes) {
+    if (nodes.isEmpty()) {
+      return Collections.emptyMap();
+    }
+    Map<Key<?>, Collection<DataNode<?>>> result = ContainerUtilRt.newHashMap();
+    for (DataNode<?> node : nodes) {
+      Collection<DataNode<?>> n = result.get(node.getKey());
+      if (n == null) {
+        result.put(node.getKey(), n = ContainerUtilRt.newArrayList());
+      }
+      n.add(node);
+    }
+    return result;
+  }
+
+  @NotNull
+  public static <K, V> Map<DataNode<K>, Collection<DataNode<V>>> groupBy(@NotNull Collection<DataNode<V>> nodes, @NotNull Key<K> key) {
+    Map<DataNode<K>, Collection<DataNode<V>>> result = ContainerUtilRt.newHashMap();
+    for (DataNode<V> data : nodes) {
+      DataNode<K> grouper = data.getDataNode(key);
+      if (grouper == null) {
+        LOG.warn(String.format(
+          "Skipping entry '%s' during grouping. Reason: it doesn't provide a value for key %s. Given entries: %s",
+          data, key, nodes
+        ));
+        continue;
+      }
+      Collection<DataNode<V>> grouped = result.get(grouper);
+      if (grouped == null) {
+        result.put(grouper, grouped = ContainerUtilRt.newArrayList());
+      }
+      grouped.add(data);
+    }
+    return result;
+  }
+
+  @SuppressWarnings("unchecked")
+  @NotNull
+  public static <T> Collection<DataNode<T>> getChildren(@NotNull DataNode<?> node, @NotNull Key<T> key) {
+    Collection<DataNode<T>> result = null;
+    for (DataNode<?> child : node.getChildren()) {
+      if (!key.equals(child.getKey())) {
+        continue;
+      }
+      if (result == null) {
+        result = ContainerUtilRt.newArrayList();
+      }
+      result.add((DataNode<T>)child);
+    }
+    return result == null ? Collections.<DataNode<T>>emptyList() : result;
+  }
+
+  @SuppressWarnings("unchecked")
+  @Nullable
+  public static <T> DataNode<T> find(@NotNull DataNode<?> node, @NotNull Key<T> key) {
+    for (DataNode<?> child : node.getChildren()) {
+      if (key.equals(child.getKey())) {
+        return (DataNode<T>)child;
+      }
+    }
+    return null;
+  }
+
+  @SuppressWarnings("unchecked")
+  @Nullable
+  public static <T> DataNode<T> find(@NotNull DataNode<?> node, @NotNull Key<T> key, BooleanFunction<DataNode<T>> predicate) {
+    for (DataNode<?> child : node.getChildren()) {
+      if (key.equals(child.getKey()) && predicate.fun((DataNode<T>)child)) {
+        return (DataNode<T>)child;
+      }
+    }
+    return null;
+  }
+
+  @SuppressWarnings("unchecked")
+  @NotNull
+  public static <T> Collection<DataNode<T>> findAll(@NotNull DataNode<?> parent, @NotNull Key<T> key) {
+    Collection<DataNode<T>> result = null;
+    for (DataNode<?> child : parent.getChildren()) {
+      if (!key.equals(child.getKey())) {
+        continue;
+      }
+      if (result == null) {
+        result = ContainerUtilRt.newArrayList();
+      }
+      result.add((DataNode<T>)child);
+    }
+    return result == null ? Collections.<DataNode<T>>emptyList() : result;
+  }
+
+  @NotNull
+  public static String toReadableName(@NotNull ProjectSystemId id) {
+    return StringUtil.capitalize(id.toString().toLowerCase());
+  }
+
+  public static void executeProjectChangeAction(@NotNull Project project,
+                                                @NotNull final ProjectSystemId externalSystemId,
+                                                @NotNull Object entityToChange,
+                                                @NotNull Runnable task)
+  {
+    executeProjectChangeAction(project, externalSystemId, entityToChange, false, task);
+  }
+
+  public static void executeProjectChangeAction(@NotNull Project project,
+                                                @NotNull final ProjectSystemId externalSystemId,
+                                                @NotNull Object entityToChange,
+                                                boolean synchronous,
+                                                @NotNull Runnable task)
+  {
+    executeProjectChangeAction(project, externalSystemId, Collections.singleton(entityToChange), synchronous, task);
+  }
+
+  public static void executeProjectChangeAction(@NotNull final Project project,
+                                                @NotNull final ProjectSystemId externalSystemId,
+                                                @NotNull final Iterable<?> entitiesToChange,
+                                                @NotNull final Runnable task)
+  {
+    executeProjectChangeAction(project, externalSystemId, entitiesToChange, false, task);
+  }
+
+  public static void executeProjectChangeAction(@NotNull final Project project,
+                                                @NotNull final ProjectSystemId externalSystemId,
+                                                @NotNull final Iterable<?> entitiesToChange,
+                                                boolean synchronous,
+                                                @NotNull final Runnable task)
+  {
+    Runnable wrappedTask = new Runnable() {
+      public void run() {
+        ApplicationManager.getApplication().runWriteAction(new Runnable() {
+          @Override
+          public void run() {
+            task.run();
+          }
+        });
+      }
+    };
+
+    if (synchronous) {
+      if (ApplicationManager.getApplication().isDispatchThread()) {
+        wrappedTask.run();
+      }
+      else {
+        UIUtil.invokeAndWaitIfNeeded(wrappedTask);
+      }
+    }
+    else {
+      UIUtil.invokeLaterIfNeeded(wrappedTask);
+    }
+  }
+}
similarity index 73%
rename from platform/external-system/external-system.iml
rename to platform/external-system-impl/external-system-impl.iml
index 75dee1c2680c894f51673a9d1acb2f62001635aa..019eb88f1c07a3831e6515548b3428836af41f2a 100644 (file)
@@ -8,17 +8,13 @@
     </content>
     <orderEntry type="inheritedJdk" />
     <orderEntry type="sourceFolder" forTests="false" />
-    <orderEntry type="module" module-name="annotations" />
-    <orderEntry type="module" module-name="projectModel-api" />
-    <orderEntry type="module" module-name="platform-api" />
+    <orderEntry type="module" module-name="idea-ui" />
+    <orderEntry type="module" module-name="external-system-api" />
+    <orderEntry type="module" module-name="openapi" />
     <orderEntry type="module" module-name="projectModel-impl" />
+    <orderEntry type="module" module-name="compiler-openapi" />
     <orderEntry type="module" module-name="platform-impl" />
-    <orderEntry type="module" module-name="java-psi-api" />
-    <orderEntry type="module" module-name="openapi" />
     <orderEntry type="module" module-name="lang-impl" />
-    <orderEntry type="module" module-name="idea-ui" />
-    <orderEntry type="module" module-name="compiler-openapi" />
-    <orderEntry type="module" module-name="compiler-openapi" />
   </component>
 </module>
 
similarity index 87%
rename from platform/external-system/src/com/intellij/openapi/externalSystem/model/settings/LocationSettingType.java
rename to platform/external-system-impl/src/com/intellij/openapi/externalSystem/model/settings/LocationSettingType.java
index 96a142377a9578420572bbb1092eb27b04f1e82e..e546176d545e25191cb69df2d6ef455fb2d2974a 100644 (file)
@@ -1,8 +1,8 @@
 package com.intellij.openapi.externalSystem.model.settings;
 
 import com.intellij.openapi.externalSystem.model.ProjectSystemId;
+import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil;
 import com.intellij.openapi.externalSystem.util.ExternalSystemBundle;
-import com.intellij.openapi.externalSystem.util.ExternalSystemUtil;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.PropertyKey;
 
@@ -35,6 +35,6 @@ public enum LocationSettingType {
    * @return    human-readable description of the current setting type
    */
   public String getDescription(@NotNull ProjectSystemId externalSystemId) {
-    return ExternalSystemBundle.message(myKey, ExternalSystemUtil.toReadableName(externalSystemId));
+    return ExternalSystemBundle.message(myKey, ExternalSystemApiUtil.toReadableName(externalSystemId));
   }
 }
similarity index 96%
rename from platform/external-system/src/com/intellij/openapi/externalSystem/model/task/AbstractExternalSystemTask.java
rename to platform/external-system-impl/src/com/intellij/openapi/externalSystem/model/task/AbstractExternalSystemTask.java
index 7f94daacd1eaa13d7f7a9e47a81bb2b4caff606e..ce4c9e23f6918433eaa6b95c76ef5ef985475df9 100644 (file)
@@ -6,8 +6,8 @@ import com.intellij.openapi.externalSystem.model.ProjectSystemId;
 import com.intellij.openapi.externalSystem.service.ExternalSystemFacadeManager;
 import com.intellij.openapi.externalSystem.service.RemoteExternalSystemFacade;
 import com.intellij.openapi.externalSystem.service.notification.ExternalSystemProgressNotificationManager;
+import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil;
 import com.intellij.openapi.externalSystem.util.ExternalSystemBundle;
-import com.intellij.openapi.externalSystem.util.ExternalSystemUtil;
 import com.intellij.openapi.progress.ProgressIndicator;
 import com.intellij.openapi.project.Project;
 import com.intellij.util.ArrayUtil;
@@ -155,6 +155,6 @@ public abstract class AbstractExternalSystemTask implements ExternalSystemTask {
 
   @Override
   public String toString() {
-    return String.format("%s task %s: %s", ExternalSystemUtil.toReadableName(myExternalSystemId), myId, myState);
+    return String.format("%s task %s: %s", ExternalSystemApiUtil.toReadableName(myExternalSystemId), myId, myState);
   }
 }
@@ -5,12 +5,11 @@ import com.intellij.openapi.externalSystem.model.DataNode;
 import com.intellij.openapi.externalSystem.model.ProjectSystemId;
 import com.intellij.openapi.externalSystem.model.project.ProjectData;
 import com.intellij.openapi.externalSystem.service.ExternalSystemFacadeManager;
-import com.intellij.openapi.externalSystem.service.project.change.ProjectStructureChangesModel;
-import com.intellij.openapi.externalSystem.service.remote.ExternalSystemExecutionSettings;
+import com.intellij.openapi.externalSystem.model.settings.ExternalSystemExecutionSettings;
 import com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolver;
 import com.intellij.openapi.externalSystem.settings.ExternalSystemSettingsManager;
+import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil;
 import com.intellij.openapi.externalSystem.util.ExternalSystemBundle;
-import com.intellij.openapi.externalSystem.util.ExternalSystemUtil;
 import com.intellij.openapi.project.Project;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -48,10 +47,6 @@ public class ExternalSystemResolveProjectTask extends AbstractExternalSystemTask
     setState(ExternalSystemTaskState.IN_PROGRESS);
 
     ExternalSystemSettingsManager settingsManager = ServiceManager.getService(ExternalSystemSettingsManager.class);
-    ProjectStructureChangesModel model = null;
-    if (!ideProject.isDisposed()) {
-      model = ServiceManager.getService(ProjectStructureChangesModel.class);
-    }
     ExternalSystemExecutionSettings settings = settingsManager.getExecutionSettings(ideProject, getExternalSystemId());
     DataNode<ProjectData> project = resolver.resolveProjectInfo(getId(), myProjectPath, myResolveLibraries, settings);
     
@@ -60,13 +55,6 @@ public class ExternalSystemResolveProjectTask extends AbstractExternalSystemTask
     }
     myExternalProject.set(project);
     setState(ExternalSystemTaskState.FINISHED);
-    
-    if (model != null) {
-      // This task may be called during the 'import from gradle' processing, hence, no project-level IoC is up.
-      // Model update is necessary for the correct tool window project structure diff showing but we don't have
-      // gradle tool window on this stage.
-      model.update(project, ideProject, false);
-    }
   }
 
   @Nullable
@@ -77,6 +65,6 @@ public class ExternalSystemResolveProjectTask extends AbstractExternalSystemTask
   @Override
   @NotNull
   protected String wrapProgressText(@NotNull String text) {
-    return ExternalSystemBundle.message("progress.update.text", ExternalSystemUtil.toReadableName(getExternalSystemId()), text);
+    return ExternalSystemBundle.message("progress.update.text", ExternalSystemApiUtil.toReadableName(getExternalSystemId()), text);
   }
 }
similarity index 99%
rename from platform/external-system/src/com/intellij/openapi/externalSystem/service/ExternalSystemFacadeImpl.java
rename to platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/ExternalSystemFacadeImpl.java
index e17a74be1c4ab435f4ca471dc70806b86dce3f06..32084132f17fc1b2dfe2b2ca7702bd42612419d1 100644 (file)
@@ -1,6 +1,7 @@
 package com.intellij.openapi.externalSystem.service;
 
 import com.intellij.execution.rmi.RemoteServer;
+import com.intellij.openapi.externalSystem.model.settings.ExternalSystemExecutionSettings;
 import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskId;
 import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskNotificationEvent;
 import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskType;
similarity index 97%
rename from platform/external-system/src/com/intellij/openapi/externalSystem/service/ExternalSystemFacadeManager.java
rename to platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/ExternalSystemFacadeManager.java
index 8a41dd8e8638db6a79d0a245da169b8479a4f230..1e1b757bc791c737bd13954280548a19082a5823 100644 (file)
@@ -23,12 +23,14 @@ import com.intellij.openapi.extensions.ExtensionPointName;
 import com.intellij.openapi.externalSystem.ExternalSystemManager;
 import com.intellij.openapi.externalSystem.model.ProjectSystemId;
 import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskId;
+import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskNotificationListener;
 import com.intellij.openapi.externalSystem.service.notification.ExternalSystemProgressNotificationManager;
-import com.intellij.openapi.externalSystem.service.remote.ExternalSystemExecutionSettings;
+import com.intellij.openapi.externalSystem.model.settings.ExternalSystemExecutionSettings;
 import com.intellij.openapi.externalSystem.service.remote.ExternalSystemProgressNotificationManagerImpl;
 import com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProgressNotificationManager;
 import com.intellij.openapi.externalSystem.service.remote.wrapper.ExternalSystemFacadeWrapper;
 import com.intellij.openapi.externalSystem.settings.ExternalSystemSettingsManager;
+import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil;
 import com.intellij.openapi.externalSystem.util.ExternalSystemUtil;
 import com.intellij.openapi.externalSystem.util.IntegrationKey;
 import com.intellij.openapi.project.Project;
@@ -153,6 +155,7 @@ public class ExternalSystemFacadeManager {
         ContainerUtil.addIfNotNull(PathUtil.getJarPathForClass(JavaSdkVersion.class), classPath);
         ContainerUtil.addIfNotNull(PathUtil.getJarPathForClass(ExtensionPointName.class), classPath);
         ContainerUtil.addIfNotNull(PathUtil.getJarPathForClass(OpenProjectFileChooserDescriptor.class), classPath);
+        ContainerUtil.addIfNotNull(PathUtil.getJarPathForClass(ExternalSystemTaskNotificationListener.class), classPath);
 
         // External system module jars
         ContainerUtil.addIfNotNull(PathUtil.getJarPathForClass(getClass()), classPath);
@@ -172,7 +175,7 @@ public class ExternalSystemFacadeManager {
 
         ProjectSystemId externalSystemId = myTargetExternalSystemId.get();
         if (externalSystemId != null) {
-          ExternalSystemManager<?, ?, ?, ?> manager = ExternalSystemUtil.getManager(externalSystemId);
+          ExternalSystemManager<?, ?, ?, ?> manager = ExternalSystemApiUtil.getManager(externalSystemId);
           if (manager != null) {
             params.getProgramParametersList().add(manager.getProjectResolverClass().getName());
             params.getProgramParametersList().add(manager.getBuildManagerClass().getName());
@@ -260,7 +263,7 @@ public class ExternalSystemFacadeManager {
   @SuppressWarnings("ConstantConditions")
   @NotNull
   private RemoteExternalSystemFacade doGetFacade(@NotNull IntegrationKey key, @NotNull Project project) throws Exception {
-    ExternalSystemManager manager = ExternalSystemUtil.getManager(key.getExternalSystemId());
+    ExternalSystemManager manager = ExternalSystemApiUtil.getManager(key.getExternalSystemId());
     if (project.isDisposed() || manager == null || !manager.isReady(project)) {
       return RemoteExternalSystemFacade.NULL_OBJECT;
     }
similarity index 98%
rename from platform/external-system/src/com/intellij/openapi/externalSystem/service/RemoteExternalSystemFacade.java
rename to platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/RemoteExternalSystemFacade.java
index 6018ef59d03eece26f0336d539ec4c434f856b21..1560144e2314a02acc4c99ab23ef87464945f0be 100644 (file)
@@ -3,7 +3,7 @@ package com.intellij.openapi.externalSystem.service;
 import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskAware;
 import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskId;
 import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskType;
-import com.intellij.openapi.externalSystem.service.remote.ExternalSystemExecutionSettings;
+import com.intellij.openapi.externalSystem.model.settings.ExternalSystemExecutionSettings;
 import com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemBuildManager;
 import com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProgressNotificationManager;
 import com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolver;
similarity index 95%
rename from platform/external-system/src/com/intellij/openapi/externalSystem/service/RemoteExternalSystemService.java
rename to platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/RemoteExternalSystemService.java
index 959753f94a1c9b4b27bd04448547c4a6396b71f5..d33419323b4ed9a8228d31d5856c4faf10611155 100644 (file)
@@ -1,7 +1,7 @@
 package com.intellij.openapi.externalSystem.service;
 
 import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskAware;
-import com.intellij.openapi.externalSystem.service.remote.ExternalSystemExecutionSettings;
+import com.intellij.openapi.externalSystem.model.settings.ExternalSystemExecutionSettings;
 import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskNotificationListener;
 import org.jetbrains.annotations.NotNull;
 
similarity index 86%
rename from platform/external-system/src/com/intellij/openapi/externalSystem/service/project/PlatformFacadeImpl.java
rename to platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/PlatformFacadeImpl.java
index 43fcc9b5fd5204cdf9e6c63794806c29cac9ec96..206fb245995f5333662c14a4ee39241111faa7a8 100644 (file)
@@ -1,6 +1,6 @@
 package com.intellij.openapi.externalSystem.service.project;
 
-import com.intellij.openapi.externalSystem.util.ExternalSystemUtil;
+import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil;
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.module.ModuleManager;
 import com.intellij.openapi.project.Project;
@@ -30,12 +30,6 @@ public class PlatformFacadeImpl implements PlatformFacade {
 
   @NotNull
   @Override
-  public LanguageLevel getLanguageLevel(@NotNull Project project) {
-    return LanguageLevelProjectExtension.getInstance(project).getLanguageLevel();
-  }
-
-  @NotNull
-  @Override
   public Collection<Module> getModules(@NotNull Project project) {
     return Arrays.asList(ModuleManager.getInstance(project).getModules());
   }
@@ -66,6 +60,6 @@ public class PlatformFacadeImpl implements PlatformFacade {
   @NotNull
   @Override
   public String getLocalFileSystemPath(@NotNull VirtualFile file) {
-    return ExternalSystemUtil.getLocalFileSystemPath(file);
+    return ExternalSystemApiUtil.getLocalFileSystemPath(file);
   }
 }
diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/ProjectStructureHelper.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/ProjectStructureHelper.java
new file mode 100644 (file)
index 0000000..60b1457
--- /dev/null
@@ -0,0 +1,252 @@
+package com.intellij.openapi.externalSystem.service.project;
+
+import com.intellij.openapi.externalSystem.model.DataNode;
+import com.intellij.openapi.externalSystem.model.ProjectKeys;
+import com.intellij.openapi.externalSystem.model.project.ContentRootData;
+import com.intellij.openapi.externalSystem.model.project.LibraryData;
+import com.intellij.openapi.externalSystem.model.project.ModuleData;
+import com.intellij.openapi.externalSystem.model.project.ModuleDependencyData;
+import com.intellij.openapi.externalSystem.util.ArtifactInfo;
+import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil;
+import com.intellij.openapi.module.Module;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.roots.*;
+import com.intellij.openapi.roots.impl.ModuleLibraryOrderEntryImpl;
+import com.intellij.openapi.roots.libraries.Library;
+import com.intellij.openapi.roots.libraries.LibraryTable;
+import com.intellij.openapi.vfs.VirtualFile;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Thread-safe.
+ *
+ * @author Denis Zhdanov
+ * @since 2/6/12 3:28 PM
+ */
+public class ProjectStructureHelper {
+
+  @NotNull private final PlatformFacade                myFacade;
+  @NotNull private final ExternalLibraryPathTypeMapper myLibraryPathTypeMapper;
+
+  public ProjectStructureHelper(@NotNull PlatformFacade facade, @NotNull ExternalLibraryPathTypeMapper mapper) {
+    myFacade = facade;
+    myLibraryPathTypeMapper = mapper;
+  }
+
+  @Nullable
+  public Module findIdeModule(@NotNull ModuleData module, @NotNull Project ideProject) {
+    return findIdeModule(module.getName(), ideProject);
+  }
+
+  @Nullable
+  public Module findIdeModule(@NotNull String ideModuleName, @NotNull Project ideProject) {
+    for (Module module : myFacade.getModules(ideProject)) {
+      if (ideModuleName.equals(module.getName())) {
+        return module;
+      }
+    }
+    return null;
+  }
+
+  @Nullable
+  public ModuleAwareContentRoot findIdeContentRoot(@NotNull DataNode<ContentRootData> node, @NotNull Project ideProject) {
+    ModuleData moduleData = node.getData(ProjectKeys.MODULE);
+    if (moduleData == null) {
+      return null;
+    }
+    final Module module = findIdeModule(moduleData.getName(), ideProject);
+    if (module == null) {
+      return null;
+    }
+    for (ModuleAwareContentRoot contentRoot : myFacade.getContentRoots(module)) {
+      final VirtualFile file = contentRoot.getFile();
+      if (node.getData().getRootPath().equals(file.getPath())) {
+        return contentRoot;
+      }
+    }
+    return null;
+  }
+
+  @Nullable
+  public Library findIdeLibrary(@NotNull final LibraryData library, @NotNull Project ideProject) {
+    return findIdeLibrary(library.getName(), ideProject);
+  }
+
+  /**
+   * Gradle library names follow the following pattern: {@code '[base library name]-[library-version]'}.
+   * <p/>
+   * This methods serves as an utility which tries to find a library by it's given base name.
+   *
+   * @param baseName    base name of the target library
+   * @param ideProject  target ide project
+   * @return            target library for the given base name if there is one and only one library for it;
+   *                    <code>null</code> otherwise (if there are no libraries or more than one library for the given base name) 
+   */
+  @Nullable
+  public Library findIdeLibraryByBaseName(@NotNull String baseName, @NotNull Project ideProject) {
+    final LibraryTable libraryTable = myFacade.getProjectLibraryTable(ideProject);
+    Library result = null;
+    for (Library library : libraryTable.getLibraries()) {
+      ArtifactInfo info = ExternalSystemApiUtil.parseArtifactInfo(ExternalSystemApiUtil.getLibraryName(library));
+      if (info == null || !baseName.equals(info.getName())) {
+        continue;
+      }
+      if (result != null) {
+        return null;
+      }
+      result = library;
+    }
+    return result;
+  }
+
+  @Nullable
+  public Library findIdeLibrary(@NotNull String libraryName, @NotNull Project ideProject) {
+    final LibraryTable libraryTable = myFacade.getProjectLibraryTable(ideProject);
+    for (Library ideLibrary : libraryTable.getLibraries()) {
+      if (libraryName.equals(ExternalSystemApiUtil.getLibraryName(ideLibrary))) {
+        return ideLibrary;
+      }
+    }
+    return null;
+  }
+
+  @Nullable
+  public Library findIdeLibrary(@NotNull String libraryName,
+                                @NotNull OrderRootType jarType,
+                                @NotNull String jarPath,
+                                @NotNull Project ideProject)
+  {
+    Library library = findIdeLibrary(libraryName, ideProject);
+    if (library == null) {
+      return null;
+    }
+    for (VirtualFile file : library.getFiles(jarType)) {
+      if (jarPath.equals(ExternalSystemApiUtil.getLocalFileSystemPath(file))) {
+        return library;
+      }
+    }
+    return null;
+  }
+
+  @Nullable
+  public LibraryOrderEntry findIdeLibraryDependency(@NotNull final String moduleName,
+                                                    @NotNull final String libraryName,
+                                                    @NotNull Project ideProject)
+  {
+    final Module ideModule = findIdeModule(moduleName, ideProject);
+    if (ideModule == null) {
+      return null;
+    }
+    RootPolicy<LibraryOrderEntry> visitor = new RootPolicy<LibraryOrderEntry>() {
+      @Override
+      public LibraryOrderEntry visitLibraryOrderEntry(LibraryOrderEntry ideDependency, LibraryOrderEntry value) {
+        if (libraryName.equals(ideDependency.getLibraryName())) {
+          return ideDependency;
+        }
+        return value;
+      }
+    };
+    for (OrderEntry entry : myFacade.getOrderEntries(ideModule)) {
+      final LibraryOrderEntry result = entry.accept(visitor, null);
+      if (result != null) {
+        return result;
+      }
+    }
+    return null;
+  }
+
+  @Nullable
+  public ModuleLibraryOrderEntryImpl findIdeModuleLocalLibraryDependency(@NotNull final String moduleName,
+                                                                         @NotNull final String libraryName,
+                                                                         @NotNull Project ideProject)
+  {
+    final Module ideModule = findIdeModule(moduleName, ideProject);
+    if (ideModule == null) {
+      return null;
+    }
+    RootPolicy<ModuleLibraryOrderEntryImpl> visitor = new RootPolicy<ModuleLibraryOrderEntryImpl>() {
+      @Override
+      public ModuleLibraryOrderEntryImpl visitLibraryOrderEntry(LibraryOrderEntry ideDependency, ModuleLibraryOrderEntryImpl value) {
+        Library library = ideDependency.getLibrary();
+        if (library == null) {
+          return value;
+        }
+        if (ideDependency instanceof ModuleLibraryOrderEntryImpl && libraryName.equals(ExternalSystemApiUtil.getLibraryName(library))) {
+          return (ModuleLibraryOrderEntryImpl)ideDependency;
+        }
+        return value;
+      }
+    };
+    for (OrderEntry entry : myFacade.getOrderEntries(ideModule)) {
+      final ModuleLibraryOrderEntryImpl result = entry.accept(visitor, null);
+      if (result != null) {
+        return result;
+      }
+    }
+    return null;
+  }
+
+  @SuppressWarnings("MethodMayBeStatic")
+  @Nullable
+  public LibraryOrderEntry findIdeLibraryDependency(@NotNull final String libraryName,
+                                                    @NotNull ModifiableRootModel model)
+  {
+    for (OrderEntry entry : model.getOrderEntries()) {
+      if (entry instanceof LibraryOrderEntry) {
+        LibraryOrderEntry candidate = (LibraryOrderEntry)entry;
+        if (libraryName.equals(candidate.getLibraryName())) {
+          return candidate;
+        }
+      }
+    }
+    return null;
+  }
+
+  @Nullable
+  public ModuleOrderEntry findIdeModuleDependency(@NotNull final ModuleDependencyData gradleDependency, @NotNull Project ideProject) {
+    return findIdeModuleDependency(gradleDependency.getOwnerModule().getName(), gradleDependency.getTarget().getName(), ideProject);
+  }
+
+  @Nullable
+  public ModuleOrderEntry findIdeModuleDependency(@NotNull final String ownerModuleName,
+                                                  @NotNull final String dependencyModuleName,
+                                                  @NotNull Project ideProject)
+  {
+    final Module ideOwnerModule = findIdeModule(ownerModuleName, ideProject);
+    if (ideOwnerModule == null) {
+      return null;
+    }
+
+    RootPolicy<ModuleOrderEntry> visitor = new RootPolicy<ModuleOrderEntry>() {
+      @Override
+      public ModuleOrderEntry visitModuleOrderEntry(ModuleOrderEntry ideDependency, ModuleOrderEntry value) {
+        if (dependencyModuleName.equals(ideDependency.getModuleName())) {
+          return ideDependency;
+        }
+        return value;
+      }
+    };
+    for (OrderEntry orderEntry : myFacade.getOrderEntries(ideOwnerModule)) {
+      final ModuleOrderEntry result = orderEntry.accept(visitor, null);
+      if (result != null) {
+        return result;
+      }
+    }
+    return null;
+  }
+
+  @SuppressWarnings("MethodMayBeStatic")
+  @Nullable
+  public ModuleOrderEntry findIdeModuleDependency(@NotNull ModuleDependencyData dependency, @NotNull ModifiableRootModel model) {
+    for (OrderEntry entry : model.getOrderEntries()) {
+      if (entry instanceof ModuleOrderEntry) {
+        ModuleOrderEntry candidate = (ModuleOrderEntry)entry;
+        if (dependency.getName().equals(candidate.getModuleName())) {
+          return candidate;
+        }
+      }
+    }
+    return null;
+  }
+}
@@ -1,6 +1,5 @@
 package com.intellij.openapi.externalSystem.service.project;
 
-import com.intellij.openapi.externalSystem.service.project.change.ProjectStructureChangesModel;
 import org.jetbrains.annotations.NotNull;
 
 /**
@@ -15,17 +14,14 @@ public class ProjectStructureServices {
 
   @NotNull private final ProjectStructureHelper        myProjectStructureHelper;
   @NotNull private final PlatformFacade                myPlatformFacade;
-  @NotNull private final ProjectStructureChangesModel  myChangesModel;
   @NotNull private final ExternalLibraryPathTypeMapper myLibraryPathTypeMapper;
 
   public ProjectStructureServices(@NotNull ProjectStructureHelper projectStructureHelper,
                                   @NotNull PlatformFacade platformFacade,
-                                  @NotNull ProjectStructureChangesModel changesModel,
                                   @NotNull ExternalLibraryPathTypeMapper mapper)
   {
     myProjectStructureHelper = projectStructureHelper;
     myPlatformFacade = platformFacade;
-    myChangesModel = changesModel;
     myLibraryPathTypeMapper = mapper;
   }
 
@@ -40,11 +36,6 @@ public class ProjectStructureServices {
   }
 
   @NotNull
-  public ProjectStructureChangesModel getChangesModel() {
-    return myChangesModel;
-  }
-
-  @NotNull
   public ExternalLibraryPathTypeMapper getLibraryPathTypeMapper() {
     return myLibraryPathTypeMapper;
   }
@@ -17,7 +17,7 @@ package com.intellij.openapi.externalSystem.service.project.manage;
 
 import com.intellij.openapi.externalSystem.model.ProjectSystemId;
 import com.intellij.openapi.externalSystem.model.project.AbstractDependencyData;
-import com.intellij.openapi.externalSystem.util.ExternalSystemUtil;
+import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil;
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.roots.*;
@@ -37,7 +37,7 @@ public abstract class AbstractDependencyDataService<T extends AbstractDependency
       return;
     }
     for (final ExportableOrderEntry dependency : toRemove) {
-      ExternalSystemUtil.executeProjectChangeAction(module.getProject(), ProjectSystemId.IDE, toRemove, synchronous, new Runnable() {
+      ExternalSystemApiUtil.executeProjectChangeAction(module.getProject(), ProjectSystemId.IDE, toRemove, synchronous, new Runnable() {
         @Override
         public void run() {
           ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(module);
@@ -63,7 +63,7 @@ public abstract class AbstractDependencyDataService<T extends AbstractDependency
 
   public void setScope(@NotNull final DependencyScope scope, @NotNull final ExportableOrderEntry dependency, boolean synchronous) {
     Project project = dependency.getOwnerModule().getProject();
-    ExternalSystemUtil.executeProjectChangeAction(project, ProjectSystemId.IDE, dependency, synchronous, new Runnable() {
+    ExternalSystemApiUtil.executeProjectChangeAction(project, ProjectSystemId.IDE, dependency, synchronous, new Runnable() {
       @Override
       public void run() {
         doForDependency(dependency, new Consumer<ExportableOrderEntry>() {
@@ -78,7 +78,7 @@ public abstract class AbstractDependencyDataService<T extends AbstractDependency
 
   public void setExported(final boolean exported, @NotNull final ExportableOrderEntry dependency, boolean synchronous) {
     Project project = dependency.getOwnerModule().getProject();
-    ExternalSystemUtil.executeProjectChangeAction(project, ProjectSystemId.IDE, dependency, synchronous, new Runnable() {
+    ExternalSystemApiUtil.executeProjectChangeAction(project, ProjectSystemId.IDE, dependency, synchronous, new Runnable() {
       @Override
       public void run() {
         doForDependency(dependency, new Consumer<ExportableOrderEntry>() {
@@ -2,15 +2,15 @@ package com.intellij.openapi.externalSystem.service.project.manage;
 
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.externalSystem.model.DataNode;
-import com.intellij.openapi.externalSystem.model.ProjectKeys;
 import com.intellij.openapi.externalSystem.model.Key;
+import com.intellij.openapi.externalSystem.model.ProjectKeys;
 import com.intellij.openapi.externalSystem.model.ProjectSystemId;
 import com.intellij.openapi.externalSystem.model.project.ContentRootData;
 import com.intellij.openapi.externalSystem.model.project.ExternalSystemSourceType;
 import com.intellij.openapi.externalSystem.model.project.ModuleData;
 import com.intellij.openapi.externalSystem.service.project.ModuleAwareContentRoot;
 import com.intellij.openapi.externalSystem.service.project.ProjectStructureHelper;
-import com.intellij.openapi.externalSystem.util.ExternalSystemUtil;
+import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil;
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.roots.ContentEntry;
@@ -56,7 +56,7 @@ public class ContentRootDataService implements ProjectDataService<ContentRootDat
     }
 
     Map<DataNode<ModuleData>, Collection<DataNode<ContentRootData>>> byModule
-      = ExternalSystemUtil.groupBy(toImport, ProjectKeys.MODULE);
+      = ExternalSystemApiUtil.groupBy(toImport, ProjectKeys.MODULE);
     for (Map.Entry<DataNode<ModuleData>, Collection<DataNode<ContentRootData>>> entry : byModule.entrySet()) {
       final Module module = myProjectStructureHelper.findIdeModule(entry.getKey().getData(), project);
       if (module == null) {
@@ -76,7 +76,7 @@ public class ContentRootDataService implements ProjectDataService<ContentRootDat
                                  @NotNull final Module module,
                                  boolean synchronous)
   {
-    ExternalSystemUtil.executeProjectChangeAction(project, owner, datas, synchronous, new Runnable() {
+    ExternalSystemApiUtil.executeProjectChangeAction(project, owner, datas, synchronous, new Runnable() {
       @Override
       public void run() {
         final ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(module);
@@ -122,7 +122,7 @@ public class ContentRootDataService implements ProjectDataService<ContentRootDat
       return;
     }
     Map<DataNode<ModuleData>,Collection<DataNode<ContentRootData>>> byModule
-      = ExternalSystemUtil.groupBy(toRemove, ProjectKeys.MODULE);
+      = ExternalSystemApiUtil.groupBy(toRemove, ProjectKeys.MODULE);
     for (Map.Entry<DataNode<ModuleData>, Collection<DataNode<ContentRootData>>> entry : byModule.entrySet()) {
       final Module module = myProjectStructureHelper.findIdeModule(entry.getKey().getData(), project);
       if (module == null) {
@@ -134,7 +134,7 @@ public class ContentRootDataService implements ProjectDataService<ContentRootDat
       }
       List<ModuleAwareContentRoot> contentRoots = ContainerUtilRt.newArrayList();
       for (DataNode<ContentRootData> holder : entry.getValue()) {
-        ModuleAwareContentRoot contentRoot = myProjectStructureHelper.findIdeContentRoot(holder.getData().getId(holder), project);
+        ModuleAwareContentRoot contentRoot = myProjectStructureHelper.findIdeContentRoot(holder, project);
         if (contentRoot != null) {
           contentRoots.add(contentRoot);
         }
@@ -147,7 +147,7 @@ public class ContentRootDataService implements ProjectDataService<ContentRootDat
                                    @NotNull Project project,
                                    boolean synchronous)
   {
-    ExternalSystemUtil.executeProjectChangeAction(project, ProjectSystemId.IDE, contentRoots, synchronous, new Runnable() {
+    ExternalSystemApiUtil.executeProjectChangeAction(project, ProjectSystemId.IDE, contentRoots, synchronous, new Runnable() {
       @Override
       public void run() {
         for (ModuleAwareContentRoot contentRoot : contentRoots) {
@@ -5,10 +5,12 @@ import com.intellij.openapi.externalSystem.model.DataNode;
 import com.intellij.openapi.externalSystem.model.Key;
 import com.intellij.openapi.externalSystem.model.ProjectKeys;
 import com.intellij.openapi.externalSystem.model.ProjectSystemId;
-import com.intellij.openapi.externalSystem.model.project.JarData;
 import com.intellij.openapi.externalSystem.model.project.LibraryData;
+import com.intellij.openapi.externalSystem.model.project.LibraryPathType;
 import com.intellij.openapi.externalSystem.service.project.ExternalLibraryPathTypeMapper;
+import com.intellij.openapi.externalSystem.service.project.PlatformFacade;
 import com.intellij.openapi.externalSystem.service.project.ProjectStructureHelper;
+import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil;
 import com.intellij.openapi.externalSystem.util.ExternalSystemUtil;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.roots.OrderRootType;
@@ -17,16 +19,16 @@ import com.intellij.openapi.roots.libraries.LibraryTable;
 import com.intellij.openapi.vfs.JarFileSystem;
 import com.intellij.openapi.vfs.LocalFileSystem;
 import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.util.Function;
 import com.intellij.util.NotNullFunction;
 import com.intellij.util.containers.ContainerUtil;
 import com.intellij.util.containers.ContainerUtilRt;
 import org.jetbrains.annotations.NotNull;
-import com.intellij.openapi.externalSystem.service.project.PlatformFacade;
-import com.intellij.openapi.externalSystem.model.project.LibraryPathType;
 
 import java.io.File;
-import java.util.*;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
 
 /**
  * @author Denis Zhdanov
@@ -39,17 +41,14 @@ public class LibraryDataService implements ProjectDataService<LibraryData> {
   @NotNull private final PlatformFacade                myPlatformFacade;
   @NotNull private final ProjectStructureHelper        myProjectStructureHelper;
   @NotNull private final ExternalLibraryPathTypeMapper myLibraryPathTypeMapper;
-  @NotNull private final JarDataService                myJarManager;
 
   public LibraryDataService(@NotNull PlatformFacade platformFacade,
                             @NotNull ProjectStructureHelper helper,
-                            @NotNull ExternalLibraryPathTypeMapper mapper,
-                            @NotNull JarDataService manager)
+                            @NotNull ExternalLibraryPathTypeMapper mapper)
   {
     myPlatformFacade = platformFacade;
     myProjectStructureHelper = helper;
     myLibraryPathTypeMapper = mapper;
-    myJarManager = manager;
   }
 
   @NotNull
@@ -89,7 +88,7 @@ public class LibraryDataService implements ProjectDataService<LibraryData> {
                             @NotNull final Project project,
                             boolean synchronous)
   {
-    ExternalSystemUtil.executeProjectChangeAction(project, externalSystemId, libraryName, synchronous, new Runnable() {
+    ExternalSystemApiUtil.executeProjectChangeAction(project, externalSystemId, libraryName, synchronous, new Runnable() {
       @Override
       public void run() {
         // Is assumed to be called from the EDT.
@@ -161,7 +160,7 @@ public class LibraryDataService implements ProjectDataService<LibraryData> {
     if (libraries.isEmpty()) {
       return;
     }
-    ExternalSystemUtil.executeProjectChangeAction(project, ProjectSystemId.IDE, libraries, synchronous, new Runnable() {
+    ExternalSystemApiUtil.executeProjectChangeAction(project, ProjectSystemId.IDE, libraries, synchronous, new Runnable() {
       @Override
       public void run() {
         final LibraryTable libraryTable = myPlatformFacade.getProjectLibraryTable(project);
@@ -192,7 +191,7 @@ public class LibraryDataService implements ProjectDataService<LibraryData> {
     Set<String> toRemove = ContainerUtilRt.newHashSet();
     Set<String> toAdd = ContainerUtilRt.newHashSet(externalLibrary.getPaths(LibraryPathType.BINARY));
     for (VirtualFile ideFile : ideLibrary.getFiles(OrderRootType.CLASSES)) {
-      String idePath = ExternalSystemUtil.getLocalFileSystemPath(ideFile);
+      String idePath = ExternalSystemApiUtil.getLocalFileSystemPath(ideFile);
       if (!toAdd.remove(idePath)) {
         toRemove.add(idePath);
       }
@@ -200,23 +199,6 @@ public class LibraryDataService implements ProjectDataService<LibraryData> {
     if (toRemove.isEmpty() && toAdd.isEmpty()) {
       return;
     }
-
-    Function<String, DataNode<JarData>> jarMapper = new Function<String, DataNode<JarData>>() {
-      @Override
-      public DataNode<JarData> fun(String path) {
-        JarData data = new JarData(path, LibraryPathType.BINARY, ideLibrary, null, ProjectSystemId.IDE);
-        return new DataNode<JarData>(ProjectKeys.JAR, data, null);
-      }
-    };
-
-    if (!toRemove.isEmpty()) {
-      List<DataNode<JarData>> jarsToRemove = ContainerUtil.map(toRemove, jarMapper);
-      myJarManager.removeData(jarsToRemove, project, synchronous);
-    }
-
-    if (!toAdd.isEmpty()) {
-      List<DataNode<JarData>> jarsToAdd = ContainerUtil.map(toAdd, jarMapper);
-      myJarManager.importJars(jarsToAdd, ideLibrary, externalLibrary.getOwner(), project, synchronous);
-    }
+    // TODO den implement
   }
 }
@@ -18,8 +18,8 @@ package com.intellij.openapi.externalSystem.service.project.manage;
 import com.intellij.openapi.components.ServiceManager;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.externalSystem.model.DataNode;
-import com.intellij.openapi.externalSystem.model.ProjectKeys;
 import com.intellij.openapi.externalSystem.model.Key;
+import com.intellij.openapi.externalSystem.model.ProjectKeys;
 import com.intellij.openapi.externalSystem.model.ProjectSystemId;
 import com.intellij.openapi.externalSystem.model.project.LibraryData;
 import com.intellij.openapi.externalSystem.model.project.LibraryDependencyData;
@@ -27,17 +27,23 @@ import com.intellij.openapi.externalSystem.model.project.ModuleData;
 import com.intellij.openapi.externalSystem.model.project.ProjectData;
 import com.intellij.openapi.externalSystem.service.project.PlatformFacade;
 import com.intellij.openapi.externalSystem.service.project.ProjectStructureHelper;
-import com.intellij.openapi.externalSystem.util.ExternalSystemUtil;
+import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil;
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.project.Project;
-import com.intellij.openapi.roots.*;
+import com.intellij.openapi.roots.ExportableOrderEntry;
+import com.intellij.openapi.roots.LibraryOrderEntry;
+import com.intellij.openapi.roots.ModifiableRootModel;
+import com.intellij.openapi.roots.ModuleRootManager;
 import com.intellij.openapi.roots.libraries.Library;
 import com.intellij.openapi.roots.libraries.LibraryTable;
 import com.intellij.util.BooleanFunction;
 import com.intellij.util.containers.ContainerUtilRt;
 import org.jetbrains.annotations.NotNull;
 
-import java.util.*;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
 
 import static com.intellij.openapi.externalSystem.model.ProjectKeys.MODULE;
 
@@ -77,7 +83,7 @@ public class LibraryDependencyDataService extends AbstractDependencyDataService<
       return;
     }
 
-    Map<DataNode<ModuleData>, Collection<DataNode<LibraryDependencyData>>> byModule = ExternalSystemUtil.groupBy(toImport, MODULE);
+    Map<DataNode<ModuleData>, Collection<DataNode<LibraryDependencyData>>> byModule = ExternalSystemApiUtil.groupBy(toImport, MODULE);
     for (Map.Entry<DataNode<ModuleData>, Collection<DataNode<LibraryDependencyData>>> entry : byModule.entrySet()) {
       Module module = myProjectStructureHelper.findIdeModule(entry.getKey().getData(), project);
       if (module == null) {
@@ -100,7 +106,7 @@ public class LibraryDependencyDataService extends AbstractDependencyDataService<
                          @NotNull final Module module,
                          final boolean synchronous)
   {
-    ExternalSystemUtil.executeProjectChangeAction(module.getProject(), externalSystemId, nodesToImport, synchronous, new Runnable() {
+    ExternalSystemApiUtil.executeProjectChangeAction(module.getProject(), externalSystemId, nodesToImport, synchronous, new Runnable() {
       @Override
       public void run() {
         LibraryTable libraryTable = myPlatformFacade.getProjectLibraryTable(module.getProject());
@@ -112,7 +118,7 @@ public class LibraryDependencyDataService extends AbstractDependencyDataService<
             DataNode<ProjectData> projectNode = dataNode.getDataNode(ProjectKeys.PROJECT);
             if (projectNode != null) {
               DataNode<LibraryData> libraryNode =
-                ExternalSystemUtil.find(projectNode, ProjectKeys.LIBRARY, new BooleanFunction<DataNode<LibraryData>>() {
+                ExternalSystemApiUtil.find(projectNode, ProjectKeys.LIBRARY, new BooleanFunction<DataNode<LibraryData>>() {
                   @Override
                   public boolean fun(DataNode<LibraryData> node) {
                     return node.getData().equals(dependencyData.getTarget());
@@ -166,7 +172,7 @@ public class LibraryDependencyDataService extends AbstractDependencyDataService<
     if (toRemove.isEmpty()) {
       return;
     }
-    Map<DataNode<ModuleData>, Collection<DataNode<LibraryDependencyData>>> byModule = ExternalSystemUtil.groupBy(toRemove, MODULE);
+    Map<DataNode<ModuleData>, Collection<DataNode<LibraryDependencyData>>> byModule = ExternalSystemApiUtil.groupBy(toRemove, MODULE);
     for (Map.Entry<DataNode<ModuleData>, Collection<DataNode<LibraryDependencyData>>> entry : byModule.entrySet()) {
       Module module = myProjectStructureHelper.findIdeModule(entry.getKey().getData(), project);
       if (module == null) {
@@ -9,7 +9,7 @@ import com.intellij.openapi.externalSystem.model.ProjectKeys;
 import com.intellij.openapi.externalSystem.model.ProjectSystemId;
 import com.intellij.openapi.externalSystem.model.project.ModuleData;
 import com.intellij.openapi.externalSystem.service.project.ProjectStructureHelper;
-import com.intellij.openapi.externalSystem.util.ExternalSystemUtil;
+import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil;
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.module.ModuleManager;
 import com.intellij.openapi.module.StdModuleTypes;
@@ -137,7 +137,7 @@ public class ModuleDataService implements ProjectDataService<ModuleData> {
     if (nodes.isEmpty()) {
       return;
     }
-    ExternalSystemUtil.executeProjectChangeAction(project, nodes.iterator().next().getData().getOwner(), nodes, true, new Runnable() {
+    ExternalSystemApiUtil.executeProjectChangeAction(project, nodes.iterator().next().getData().getOwner(), nodes, true, new Runnable() {
       @Override
       public void run() {
         LocalFileSystem fileSystem = LocalFileSystem.getInstance();
@@ -176,7 +176,7 @@ public class ModuleDataService implements ProjectDataService<ModuleData> {
       return;
     }
     Project project = modules.iterator().next().getProject();
-    ExternalSystemUtil.executeProjectChangeAction(project, ProjectSystemId.IDE, modules, synchronous, new Runnable() {
+    ExternalSystemApiUtil.executeProjectChangeAction(project, ProjectSystemId.IDE, modules, synchronous, new Runnable() {
       @Override
       public void run() {
         for (Module module : modules) {
@@ -24,7 +24,7 @@ import com.intellij.openapi.externalSystem.model.project.ModuleData;
 import com.intellij.openapi.externalSystem.model.project.ModuleDependencyData;
 import com.intellij.openapi.externalSystem.model.project.ProjectData;
 import com.intellij.openapi.externalSystem.service.project.ProjectStructureHelper;
-import com.intellij.openapi.externalSystem.util.ExternalSystemUtil;
+import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil;
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.roots.ExportableOrderEntry;
@@ -66,8 +66,7 @@ public class ModuleDependencyDataService extends AbstractDependencyDataService<M
 
   @Override
   public void importData(@NotNull Collection<DataNode<ModuleDependencyData>> toImport, @NotNull Project project, boolean synchronous) {
-    Map<DataNode<ModuleData>, Collection<DataNode<ModuleDependencyData>>> byModule
-      = ExternalSystemUtil.groupBy(toImport, ProjectKeys.MODULE);
+    Map<DataNode<ModuleData>, Collection<DataNode<ModuleDependencyData>>> byModule= ExternalSystemApiUtil.groupBy(toImport, MODULE);
     for (Map.Entry<DataNode<ModuleData>, Collection<DataNode<ModuleDependencyData>>> entry : byModule.entrySet()) {
       Module ideModule = myProjectStructureHelper.findIdeModule(entry.getKey().getData(), project);
       if (ideModule == null) {
@@ -90,7 +89,7 @@ public class ModuleDependencyDataService extends AbstractDependencyDataService<M
                          @NotNull final Module module,
                          final boolean synchronous)
   {
-    ExternalSystemUtil.executeProjectChangeAction(module.getProject(), externalSystemId, toImport, synchronous, new Runnable() {
+    ExternalSystemApiUtil.executeProjectChangeAction(module.getProject(), externalSystemId, toImport, synchronous, new Runnable() {
       @Override
       public void run() {
         ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(module);
@@ -104,7 +103,7 @@ public class ModuleDependencyDataService extends AbstractDependencyDataService<M
               DataNode<ProjectData> projectNode = dependencyNode.getDataNode(ProjectKeys.PROJECT);
               if (projectNode != null) {
                 DataNode<ModuleData> n
-                  = ExternalSystemUtil.find(projectNode, ProjectKeys.MODULE, new BooleanFunction<DataNode<ModuleData>>() {
+                  = ExternalSystemApiUtil.find(projectNode, MODULE, new BooleanFunction<DataNode<ModuleData>>() {
                   @Override
                   public boolean fun(DataNode<ModuleData> node) {
                     return node.getData().equals(dependencyData.getTarget());
@@ -146,7 +145,7 @@ public class ModuleDependencyDataService extends AbstractDependencyDataService<M
     if (toRemove.isEmpty()) {
       return;
     }
-    Map<DataNode<ModuleData>, Collection<DataNode<ModuleDependencyData>>> byModule = ExternalSystemUtil.groupBy(toRemove, MODULE);
+    Map<DataNode<ModuleData>, Collection<DataNode<ModuleDependencyData>>> byModule = ExternalSystemApiUtil.groupBy(toRemove, MODULE);
     for (Map.Entry<DataNode<ModuleData>, Collection<DataNode<ModuleDependencyData>>> entry : byModule.entrySet()) {
       Module module = myProjectStructureHelper.findIdeModule(entry.getKey().getData(), project);
       if (module == null) {
@@ -18,7 +18,7 @@ package com.intellij.openapi.externalSystem.service.project.manage;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.externalSystem.model.DataNode;
 import com.intellij.openapi.externalSystem.model.Key;
-import com.intellij.openapi.externalSystem.util.ExternalSystemUtil;
+import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.NotNullLazyValue;
 import com.intellij.util.containers.ContainerUtilRt;
@@ -53,7 +53,7 @@ public class ProjectDataManager {
         }
 
         for (List<ProjectDataService<?>> services : result.values()) {
-          ExternalSystemUtil.orderAwareSort(services);
+          ExternalSystemApiUtil.orderAwareSort(services);
         }
 
         return result;
@@ -62,7 +62,7 @@ public class ProjectDataManager {
 
   @SuppressWarnings("unchecked")
   public <T> void importData(@NotNull Collection<DataNode<?>> nodes, @NotNull Project project, boolean synchronous) {
-    Map<Key<?>, Collection<DataNode<?>>> grouped = ExternalSystemUtil.group(nodes);
+    Map<Key<?>, Collection<DataNode<?>>> grouped = ExternalSystemApiUtil.group(nodes);
     for (Map.Entry<Key<?>, Collection<DataNode<?>>> entry : grouped.entrySet()) {
       // Simple class cast makes ide happy but compiler fails.
       Collection<DataNode<T>> dummy = ContainerUtilRt.newArrayList();
@@ -20,7 +20,7 @@ import com.intellij.openapi.externalSystem.model.Key;
 import com.intellij.openapi.externalSystem.model.ProjectKeys;
 import com.intellij.openapi.externalSystem.model.ProjectSystemId;
 import com.intellij.openapi.externalSystem.model.project.ProjectData;
-import com.intellij.openapi.externalSystem.util.ExternalSystemUtil;
+import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.project.ex.ProjectEx;
 import org.jetbrains.annotations.NotNull;
@@ -59,7 +59,7 @@ public class ProjectDataServiceImpl implements ProjectDataService<ProjectData> {
     if (!(project instanceof ProjectEx) || newName.equals(project.getName())) {
       return;
     }
-    ExternalSystemUtil.executeProjectChangeAction(project, ProjectSystemId.IDE, project, synchronous, new Runnable() {
+    ExternalSystemApiUtil.executeProjectChangeAction(project, ProjectSystemId.IDE, project, synchronous, new Runnable() {
       @Override
       public void run() {
         ((ProjectEx)project).setProjectName(newName);
@@ -13,6 +13,7 @@ import com.intellij.openapi.externalSystem.service.project.manage.ProjectDataMan
 import com.intellij.openapi.externalSystem.service.settings.AbstractExternalProjectConfigurable;
 import com.intellij.openapi.externalSystem.settings.AbstractExternalSystemSettings;
 import com.intellij.openapi.externalSystem.settings.ExternalSystemSettingsManager;
+import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil;
 import com.intellij.openapi.externalSystem.util.ExternalSystemBundle;
 import com.intellij.openapi.externalSystem.util.ExternalSystemConstants;
 import com.intellij.openapi.externalSystem.util.ExternalSystemUtil;
@@ -140,16 +141,16 @@ public abstract class AbstractExternalProjectImportBuilder<C extends AbstractExt
         onProjectInit(project);
 
         if (externalProjectNode != null) {
-          ExternalSystemUtil.executeProjectChangeAction(project, myExternalSystemId, project, new Runnable() {
+          ExternalSystemApiUtil.executeProjectChangeAction(project, myExternalSystemId, project, new Runnable() {
             @Override
             public void run() {
               ProjectRootManagerEx.getInstanceEx(project).mergeRootsChangesDuring(new Runnable() {
                 @Override
                 public void run() {
-                  Collection<DataNode<ModuleData>> modules = ExternalSystemUtil.findAll(externalProjectNode, ProjectKeys.MODULE);
+                  Collection<DataNode<ModuleData>> modules = ExternalSystemApiUtil.findAll(externalProjectNode, ProjectKeys.MODULE);
                   myProjectDataManager.importData(ProjectKeys.MODULE, modules, project, true);
                 }
-              }); 
+              });
             }
           });
 
@@ -157,7 +158,7 @@ public abstract class AbstractExternalProjectImportBuilder<C extends AbstractExt
             @Override
             public void run() {
               String progressText
-                = ExternalSystemBundle.message("progress.resolve.libraries", ExternalSystemUtil.toReadableName(myExternalSystemId));
+                = ExternalSystemBundle.message("progress.resolve.libraries", ExternalSystemApiUtil.toReadableName(myExternalSystemId));
               ProgressManager.getInstance().run(
                 new Task.Backgroundable(project, progressText, false) {
                   @Override
@@ -207,8 +208,8 @@ public abstract class AbstractExternalProjectImportBuilder<C extends AbstractExt
    *                                      dependencies information available at the given gradle project
    */
   private void setupLibraries(@NotNull final DataNode<ProjectData> projectWithResolvedLibraries, final Project project) {
-    Collection<DataNode<LibraryData>> libraries = ExternalSystemUtil.findAll(projectWithResolvedLibraries, ProjectKeys.LIBRARY);
-    ExternalSystemUtil.executeProjectChangeAction(project, projectWithResolvedLibraries.getData().getOwner(), libraries, new Runnable() {
+    Collection<DataNode<LibraryData>> libraries = ExternalSystemApiUtil.findAll(projectWithResolvedLibraries, ProjectKeys.LIBRARY);
+    ExternalSystemApiUtil.executeProjectChangeAction(project, projectWithResolvedLibraries.getData().getOwner(), libraries, new Runnable() {
       @Override
       public void run() {
         ProjectRootManagerEx.getInstanceEx(project).mergeRootsChangesDuring(new Runnable() {
@@ -270,7 +271,7 @@ public abstract class AbstractExternalProjectImportBuilder<C extends AbstractExt
    * @throws ConfigurationException   if gradle project is not defined and can't be constructed
    */
   public void ensureProjectIsDefined(@NotNull WizardContext wizardContext) throws ConfigurationException {
-    String externalSystemName = ExternalSystemUtil.toReadableName(myExternalSystemId);
+    String externalSystemName = ExternalSystemApiUtil.toReadableName(myExternalSystemId);
     File projectFile = getProjectFile();
     if (projectFile == null) {
       throw new ConfigurationException(ExternalSystemBundle.message("error.project.undefined"));
@@ -280,8 +281,8 @@ public abstract class AbstractExternalProjectImportBuilder<C extends AbstractExt
     final Ref<String> errorDetails = new Ref<String>();
     try {
       final Project project = getProject(wizardContext);
-      myExternalProjectNode= ExternalSystemUtil.refreshProject(project, myExternalSystemId, projectFile.getAbsolutePath(), errorReason,
-                                                               errorDetails, false, true);
+      myExternalProjectNode = ExternalSystemUtil.refreshProject(project, myExternalSystemId, projectFile.getAbsolutePath(), errorReason,
+                                                                errorDetails, false, true);
     }
     catch (IllegalArgumentException e) {
       throw new ConfigurationException(e.getMessage(), ExternalSystemBundle.message("error.cannot.parse.project", externalSystemName));
@@ -15,6 +15,7 @@
  */
 package com.intellij.openapi.externalSystem.service.remote;
 
+import com.intellij.openapi.externalSystem.model.settings.ExternalSystemExecutionSettings;
 import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskId;
 import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskType;
 import com.intellij.openapi.externalSystem.service.RemoteExternalSystemService;
@@ -16,6 +16,7 @@
 package com.intellij.openapi.externalSystem.service.remote;
 
 import com.intellij.openapi.externalSystem.model.ExternalSystemException;
+import com.intellij.openapi.externalSystem.model.settings.ExternalSystemExecutionSettings;
 import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskDescriptor;
 import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskId;
 import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskType;
@@ -17,6 +17,7 @@ package com.intellij.openapi.externalSystem.service.remote;
 
 import com.intellij.openapi.externalSystem.build.ExternalSystemBuildManager;
 import com.intellij.openapi.externalSystem.model.ExternalSystemException;
+import com.intellij.openapi.externalSystem.model.settings.ExternalSystemExecutionSettings;
 import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskDescriptor;
 import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskId;
 import com.intellij.util.Producer;
@@ -18,6 +18,7 @@ package com.intellij.openapi.externalSystem.service.remote;
 import com.intellij.openapi.externalSystem.model.DataNode;
 import com.intellij.openapi.externalSystem.model.ExternalSystemException;
 import com.intellij.openapi.externalSystem.model.project.ProjectData;
+import com.intellij.openapi.externalSystem.model.settings.ExternalSystemExecutionSettings;
 import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskId;
 import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskType;
 import com.intellij.openapi.externalSystem.service.RemoteExternalSystemService;
@@ -3,6 +3,7 @@ package com.intellij.openapi.externalSystem.service.remote;
 import com.intellij.openapi.externalSystem.model.DataNode;
 import com.intellij.openapi.externalSystem.model.ExternalSystemException;
 import com.intellij.openapi.externalSystem.model.project.ProjectData;
+import com.intellij.openapi.externalSystem.model.settings.ExternalSystemExecutionSettings;
 import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskId;
 import com.intellij.openapi.externalSystem.service.project.ExternalSystemProjectResolver;
 import com.intellij.util.Producer;
@@ -18,7 +18,7 @@ package com.intellij.openapi.externalSystem.service.remote.wrapper;
 import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskId;
 import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskType;
 import com.intellij.openapi.externalSystem.service.RemoteExternalSystemService;
-import com.intellij.openapi.externalSystem.service.remote.ExternalSystemExecutionSettings;
+import com.intellij.openapi.externalSystem.model.settings.ExternalSystemExecutionSettings;
 import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskNotificationListener;
 import org.jetbrains.annotations.NotNull;
 
@@ -18,7 +18,7 @@ package com.intellij.openapi.externalSystem.service.remote.wrapper;
 import com.intellij.openapi.externalSystem.model.ExternalSystemException;
 import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskDescriptor;
 import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskId;
-import com.intellij.openapi.externalSystem.service.remote.ExternalSystemExecutionSettings;
+import com.intellij.openapi.externalSystem.model.settings.ExternalSystemExecutionSettings;
 import com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemBuildManager;
 import com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProgressNotificationManager;
 import org.jetbrains.annotations.NotNull;
@@ -3,7 +3,7 @@ package com.intellij.openapi.externalSystem.service.remote.wrapper;
 import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskId;
 import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskType;
 import com.intellij.openapi.externalSystem.service.RemoteExternalSystemFacade;
-import com.intellij.openapi.externalSystem.service.remote.ExternalSystemExecutionSettings;
+import com.intellij.openapi.externalSystem.model.settings.ExternalSystemExecutionSettings;
 import com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemBuildManager;
 import com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProgressNotificationManager;
 import com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolver;
@@ -4,7 +4,7 @@ import com.intellij.openapi.externalSystem.model.DataNode;
 import com.intellij.openapi.externalSystem.model.ExternalSystemException;
 import com.intellij.openapi.externalSystem.model.project.ProjectData;
 import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskId;
-import com.intellij.openapi.externalSystem.service.remote.ExternalSystemExecutionSettings;
+import com.intellij.openapi.externalSystem.model.settings.ExternalSystemExecutionSettings;
 import com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProgressNotificationManager;
 import com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolver;
 import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskNotificationListener;
similarity index 98%
rename from platform/external-system/src/com/intellij/openapi/externalSystem/settings/ExternalSystemSettingsManager.java
rename to platform/external-system-impl/src/com/intellij/openapi/externalSystem/settings/ExternalSystemSettingsManager.java
index 2fbbbec2d6075da0b8fb311796774beaceddf523..c3acd21b8b1b8d78a02c76237cd27e2d81ac2f78 100644 (file)
@@ -17,8 +17,8 @@ package com.intellij.openapi.externalSystem.settings;
 
 import com.intellij.openapi.externalSystem.ExternalSystemManager;
 import com.intellij.openapi.externalSystem.model.ProjectSystemId;
+import com.intellij.openapi.externalSystem.model.settings.ExternalSystemExecutionSettings;
 import com.intellij.openapi.externalSystem.service.DisposableExternalSystemService;
-import com.intellij.openapi.externalSystem.service.remote.ExternalSystemExecutionSettings;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.NotNullLazyValue;
 import com.intellij.util.Function;
similarity index 59%
rename from platform/external-system/src/com/intellij/openapi/externalSystem/util/ExternalSystemUiUtil.java
rename to platform/external-system-impl/src/com/intellij/openapi/externalSystem/util/ExternalSystemUiUtil.java
index 7495474f65179d7b5801b66834b6480ccdd4e1d4..8a7135ca3ca2fc5d2bdb9b17d24bbc13759133fd 100644 (file)
 package com.intellij.openapi.externalSystem.util;
 
 import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.externalSystem.model.project.id.GradleSyntheticId;
-import com.intellij.openapi.externalSystem.model.project.id.ProjectEntityId;
-import com.intellij.openapi.externalSystem.ui.ProjectStructureNodeDescriptor;
 import com.intellij.openapi.ui.MessageType;
 import com.intellij.openapi.ui.popup.Balloon;
 import com.intellij.openapi.ui.popup.BalloonBuilder;
 import com.intellij.openapi.ui.popup.JBPopupFactory;
 import com.intellij.ui.awt.RelativePoint;
 import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
 
 import javax.swing.*;
 import java.awt.*;
@@ -37,32 +33,6 @@ import java.util.concurrent.TimeUnit;
  */
 public class ExternalSystemUiUtil {
 
-  public static final ProjectStructureNodeDescriptor<GradleSyntheticId> DEPENDENCIES_NODE_DESCRIPTOR
-    = buildSyntheticDescriptor(ExternalSystemBundle.message("entity.type.dependencies"));
-
-  public static final ProjectStructureNodeDescriptor<GradleSyntheticId> MODULES_NODE_DESCRIPTOR
-    = buildSyntheticDescriptor(ExternalSystemBundle.message("entity.type.modules"));
-
-  public static final ProjectStructureNodeDescriptor<GradleSyntheticId> LIBRARIES_NODE_DESCRIPTOR
-    = buildSyntheticDescriptor(ExternalSystemBundle.message("entity.type.libraries"));
-  
-  private ExternalSystemUiUtil() {
-  }
-
-  @NotNull
-  public static <T extends ProjectEntityId> ProjectStructureNodeDescriptor<T> buildDescriptor(@NotNull T id, @NotNull String name) {
-    return new ProjectStructureNodeDescriptor<T>(id, name, id.getType().getIcon());
-  }
-
-  @NotNull
-  public static ProjectStructureNodeDescriptor<GradleSyntheticId> buildSyntheticDescriptor(@NotNull String text) {
-    return buildSyntheticDescriptor(text, null);
-  }
-
-  public static ProjectStructureNodeDescriptor<GradleSyntheticId> buildSyntheticDescriptor(@NotNull String text, @Nullable Icon icon) {
-    return new ProjectStructureNodeDescriptor<GradleSyntheticId>(new GradleSyntheticId(text), text, icon);
-  }
-
   /**
    * Asks to show balloon that contains information related to the given component.
    *
similarity index 55%
rename from platform/external-system/src/com/intellij/openapi/externalSystem/util/ExternalSystemUtil.java
rename to platform/external-system-impl/src/com/intellij/openapi/externalSystem/util/ExternalSystemUtil.java
index 747f92221db32068a15b83253f2b9c550e66367d..e02959902248f50908e46efae7f2bd36485ee026 100644 (file)
@@ -24,19 +24,15 @@ import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.application.PathManager;
 import com.intellij.openapi.components.ServiceManager;
 import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.externalSystem.ExternalSystemManager;
 import com.intellij.openapi.externalSystem.model.DataNode;
 import com.intellij.openapi.externalSystem.model.ExternalSystemException;
-import com.intellij.openapi.externalSystem.model.Key;
 import com.intellij.openapi.externalSystem.model.ProjectSystemId;
 import com.intellij.openapi.externalSystem.model.project.ProjectData;
 import com.intellij.openapi.externalSystem.model.project.ProjectEntityData;
 import com.intellij.openapi.externalSystem.model.task.ExternalSystemResolveProjectTask;
 import com.intellij.openapi.externalSystem.service.project.ModuleAwareContentRoot;
-import com.intellij.openapi.externalSystem.service.project.manage.ProjectEntityChangeListener;
 import com.intellij.openapi.externalSystem.settings.AbstractExternalSystemSettings;
 import com.intellij.openapi.externalSystem.settings.ExternalSystemSettingsManager;
-import com.intellij.openapi.fileTypes.FileTypes;
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.progress.ProgressIndicator;
 import com.intellij.openapi.progress.ProgressManager;
@@ -48,165 +44,37 @@ import com.intellij.openapi.projectRoots.ProjectJdkTable;
 import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.openapi.roots.LibraryOrderEntry;
 import com.intellij.openapi.roots.ModuleOrderEntry;
-import com.intellij.openapi.roots.OrderRootType;
 import com.intellij.openapi.roots.libraries.Library;
-import com.intellij.openapi.util.AtomicNotNullLazyValue;
-import com.intellij.openapi.util.NotNullLazyValue;
 import com.intellij.openapi.util.Ref;
 import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vfs.JarFileSystem;
-import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.openapi.wm.ToolWindow;
 import com.intellij.openapi.wm.ToolWindowManager;
 import com.intellij.ui.content.Content;
 import com.intellij.ui.content.ContentManager;
-import com.intellij.util.BooleanFunction;
 import com.intellij.util.Consumer;
-import com.intellij.util.PathUtil;
 import com.intellij.util.PathsList;
-import com.intellij.util.containers.ContainerUtilRt;
 import com.intellij.util.ui.UIUtil;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import javax.swing.*;
-import java.io.File;
 import java.io.PrintWriter;
 import java.io.StringWriter;
-import java.util.*;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
+import java.util.Collections;
+import java.util.List;
 
 /**
  * @author Denis Zhdanov
- * @since 4/1/13 1:31 PM
+ * @since 4/22/13 9:36 AM
  */
 public class ExternalSystemUtil {
 
   private static final Logger LOG = Logger.getInstance("#" + ExternalSystemUtil.class.getName());
 
-  @NotNull public static final String PATH_SEPARATOR = "/";
-
-  @NotNull private static final Pattern ARTIFACT_PATTERN = Pattern.compile("(?:.*/)?(.+?)(?:-([\\d+](?:\\.[\\d]+)*))?(?:\\.[^\\.]+?)?");
-
-  @NotNull private static final NotNullLazyValue<Map<ProjectSystemId, ExternalSystemManager<?, ?, ?, ?>>> MANAGERS =
-    new AtomicNotNullLazyValue<Map<ProjectSystemId, ExternalSystemManager<?, ?, ?, ?>>>() {
-      @NotNull
-      @Override
-      protected Map<ProjectSystemId, ExternalSystemManager<?, ?, ?, ?>> compute() {
-        Map<ProjectSystemId, ExternalSystemManager<?, ?, ?, ?>> result = ContainerUtilRt.newHashMap();
-        for (ExternalSystemManager manager : ExternalSystemManager.EP_NAME.getExtensions()) {
-          result.put(manager.getSystemId(), manager);
-        }
-        return result;
-      }
-    };
-
-  @NotNull public static final Comparator<Object> ORDER_AWARE_COMPARATOR = new Comparator<Object>() {
-    @Override
-    public int compare(Object o1, Object o2) {
-      int order1 = getOrder(o1);
-      int order2 = getOrder(o2);
-      return order1 > order2 ? 1 : order1 < order2 ? -1 : 0;
-    }
-
-    private int getOrder(@NotNull Object o) {
-      Queue<Class<?>> toCheck = new ArrayDeque<Class<?>>();
-      toCheck.add(o.getClass());
-      while (!toCheck.isEmpty()) {
-        Class<?> clazz = toCheck.poll();
-        Order annotation = clazz.getAnnotation(Order.class);
-        if (annotation != null) {
-          return annotation.value();
-        }
-        toCheck.add(clazz.getSuperclass());
-        Class<?>[] interfaces = clazz.getInterfaces();
-        if (interfaces != null) {
-          Collections.addAll(toCheck, interfaces);
-        }
-      }
-      return ExternalSystemConstants.UNORDERED;
-    }
-  };
-
-
   private ExternalSystemUtil() {
   }
 
   /**
-   * @param path    target path
-   * @return absolute path that points to the same location as the given one and that uses only slashes
-   */
-  @NotNull
-  public static String toCanonicalPath(@NotNull String path) {
-    return PathUtil.getCanonicalPath(new File(path).getAbsolutePath());
-  }
-
-  @NotNull
-  public static String extractNameFromPath(@NotNull String path) {
-    String strippedPath = stripPath(path);
-    final int i = strippedPath.lastIndexOf(PATH_SEPARATOR);
-    final String result;
-    if (i < 0 || i >= strippedPath.length() - 1) {
-      result = strippedPath;
-    }
-    else {
-      result = strippedPath.substring(i + 1);
-    }
-    return result;
-  }
-
-  @NotNull
-  private static String stripPath(@NotNull String path) {
-    String[] endingsToStrip = {"/", "!", ".jar"};
-    StringBuilder buffer = new StringBuilder(path);
-    for (String ending : endingsToStrip) {
-      if (buffer.lastIndexOf(ending) == buffer.length() - ending.length()) {
-        buffer.setLength(buffer.length() - ending.length());
-      }
-    }
-    return buffer.toString();
-  }
-
-  @NotNull
-  public static String getLibraryName(@NotNull Library library) {
-    final String result = library.getName();
-    if (result != null) {
-      return result;
-    }
-    for (OrderRootType type : OrderRootType.getAllTypes()) {
-      for (String url : library.getUrls(type)) {
-        String candidate = extractNameFromPath(url);
-        if (!StringUtil.isEmpty(candidate)) {
-          return candidate;
-        }
-      }
-    }
-    assert false;
-    return "unknown-lib";
-  }
-
-  @Nullable
-  public static ArtifactInfo parseArtifactInfo(@NotNull String fileName) {
-    Matcher matcher = ARTIFACT_PATTERN.matcher(fileName);
-    if (!matcher.matches()) {
-      return null;
-    }
-    return new ArtifactInfo(matcher.group(1), null, matcher.group(2));
-  }
-
-  @NotNull
-  public static String getLocalFileSystemPath(@NotNull VirtualFile file) {
-    if (file.getFileType() == FileTypes.ARCHIVE) {
-      final VirtualFile jar = JarFileSystem.getInstance().getVirtualFileForJar(file);
-      if (jar != null) {
-        return jar.getPath();
-      }
-    }
-    return file.getPath();
-  }
-
-  /**
    * Tries to dispatch given entity via the given visitor.
    *
    * @param entity   intellij project entity candidate to dispatch
@@ -248,72 +116,6 @@ public class ExternalSystemUtil {
     }
   }
 
-  public static void executeProjectChangeAction(@NotNull Project project,
-                                                @NotNull final ProjectSystemId externalSystemId,
-                                                @NotNull Object entityToChange,
-                                                @NotNull Runnable task)
-  {
-    executeProjectChangeAction(project, externalSystemId, entityToChange, false, task);
-  }
-
-  public static void executeProjectChangeAction(@NotNull Project project,
-                                                @NotNull final ProjectSystemId externalSystemId,
-                                                @NotNull Object entityToChange,
-                                                boolean synchronous,
-                                                @NotNull Runnable task)
-  {
-    executeProjectChangeAction(project, externalSystemId, Collections.singleton(entityToChange), synchronous, task);
-  }
-
-  public static void executeProjectChangeAction(@NotNull final Project project,
-                                                @NotNull final ProjectSystemId externalSystemId,
-                                                @NotNull final Iterable<?> entitiesToChange,
-                                                @NotNull final Runnable task)
-  {
-    executeProjectChangeAction(project, externalSystemId, entitiesToChange, false, task);
-  }
-
-  public static void executeProjectChangeAction(@NotNull final Project project,
-                                                @NotNull final ProjectSystemId externalSystemId,
-                                                @NotNull final Iterable<?> entitiesToChange,
-                                                boolean synchronous,
-                                                @NotNull final Runnable task)
-  {
-    Runnable wrappedTask = new Runnable() {
-      public void run() {
-        ApplicationManager.getApplication().runWriteAction(new Runnable() {
-          @Override
-          public void run() {
-            final ProjectEntityChangeListener publisher = project.getMessageBus().syncPublisher(ProjectEntityChangeListener.TOPIC);
-            for (Object e : entitiesToChange) {
-              publisher.onChangeStart(e, externalSystemId);
-            }
-            try {
-              task.run();
-            }
-            finally {
-              for (Object e : entitiesToChange) {
-                publisher.onChangeEnd(e, externalSystemId);
-              }
-            }
-          }
-        });
-      }
-    };
-
-    if (synchronous) {
-      if (ApplicationManager.getApplication().isDispatchThread()) {
-        wrappedTask.run();
-      }
-      else {
-        UIUtil.invokeAndWaitIfNeeded(wrappedTask);
-      }
-    }
-    else {
-      UIUtil.invokeLaterIfNeeded(wrappedTask);
-    }
-  }
-
   @NotNull
   public static String getOutdatedEntityName(@NotNull String entityName, @NotNull String gradleVersion, @NotNull String ideVersion) {
     return String.format("%s (%s -> %s)", entityName, ideVersion, gradleVersion);
@@ -380,11 +182,6 @@ public class ExternalSystemUtil {
     return null;
   }
 
-  @Nullable
-  public static ExternalSystemManager<?, ?, ?, ?> getManager(@NotNull ProjectSystemId externalSystemId) {
-    return MANAGERS.getValue().get(externalSystemId);
-  }
-
   /**
    * Configures given classpath to reference target i18n bundle file(s).
    *
@@ -427,102 +224,6 @@ public class ExternalSystemUtil {
     }
   }
 
-  @NotNull
-  public static Map<Key<?>, Collection<DataNode<?>>> group(@NotNull Collection<DataNode<?>> nodes) {
-    if (nodes.isEmpty()) {
-      return Collections.emptyMap();
-    }
-    Map<Key<?>, Collection<DataNode<?>>> result = ContainerUtilRt.newHashMap();
-    for (DataNode<?> node : nodes) {
-      Collection<DataNode<?>> n = result.get(node.getKey());
-      if (n == null) {
-        result.put(node.getKey(), n = ContainerUtilRt.newArrayList());
-      }
-      n.add(node);
-    }
-    return result;
-  }
-
-  @NotNull
-  public static <K, V> Map<DataNode<K>, Collection<DataNode<V>>> groupBy(@NotNull Collection<DataNode<V>> nodes, @NotNull Key<K> key) {
-    Map<DataNode<K>, Collection<DataNode<V>>> result = ContainerUtilRt.newHashMap();
-    for (DataNode<V> data : nodes) {
-      DataNode<K> grouper = data.getDataNode(key);
-      if (grouper == null) {
-        LOG.warn(String.format(
-          "Skipping entry '%s' during grouping. Reason: it doesn't provide a value for key %s. Given entries: %s",
-          data, key, nodes
-        ));
-        continue;
-      }
-      Collection<DataNode<V>> grouped = result.get(grouper);
-      if (grouped == null) {
-        result.put(grouper, grouped = ContainerUtilRt.newArrayList());
-      }
-      grouped.add(data);
-    }
-    return result;
-  }
-
-  @SuppressWarnings("unchecked")
-  @NotNull
-  public static <T> Collection<DataNode<T>> getChildren(@NotNull DataNode<?> node, @NotNull Key<T> key) {
-    Collection<DataNode<T>> result = null;
-    for (DataNode<?> child : node.getChildren()) {
-      if (!key.equals(child.getKey())) {
-        continue;
-      }
-      if (result == null) {
-        result = ContainerUtilRt.newArrayList();
-      }
-      result.add((DataNode<T>)child);
-    }
-    return result == null ? Collections.<DataNode<T>>emptyList() : result;
-  }
-
-  @SuppressWarnings("unchecked")
-  @Nullable
-  public static <T> DataNode<T> find(@NotNull DataNode<?> node, @NotNull Key<T> key) {
-    for (DataNode<?> child : node.getChildren()) {
-      if (key.equals(child.getKey())) {
-        return (DataNode<T>)child;
-      }
-    }
-    return null;
-  }
-
-  @SuppressWarnings("unchecked")
-  @Nullable
-  public static <T> DataNode<T> find(@NotNull DataNode<?> node, @NotNull Key<T> key, BooleanFunction<DataNode<T>> predicate) {
-    for (DataNode<?> child : node.getChildren()) {
-      if (key.equals(child.getKey()) && predicate.fun((DataNode<T>)child)) {
-        return (DataNode<T>)child;
-      }
-    }
-    return null;
-  }
-
-  @SuppressWarnings("unchecked")
-  @NotNull
-  public static <T> Collection<DataNode<T>> findAll(@NotNull DataNode<?> parent, @NotNull Key<T> key) {
-    Collection<DataNode<T>> result = null;
-    for (DataNode<?> child : parent.getChildren()) {
-      if (!key.equals(child.getKey())) {
-        continue;
-      }
-      if (result == null) {
-        result = ContainerUtilRt.newArrayList();
-      }
-      result.add((DataNode<T>)child);
-    }
-    return result == null ? Collections.<DataNode<T>>emptyList() : result;
-  }
-
-  @NotNull
-  public static String toReadableName(@NotNull ProjectSystemId id) {
-    return StringUtil.capitalize(id.toString().toLowerCase());
-  }
-
   public static void refreshProject(@NotNull Project project, @NotNull ProjectSystemId externalSystemId) {
     refreshProject(project, externalSystemId, new Ref<String>());
   }
@@ -611,7 +312,7 @@ public class ExternalSystemUtil {
         if (StringUtil.isEmpty(message)) {
           errorMessageHolder.set(String.format(
             "Can't resolve %s project at '%s'. Reason: %s",
-            toReadableName(externalSystemId), externalProjectPath, message
+            ExternalSystemApiUtil.toReadableName(externalSystemId), externalProjectPath, message
           ));
         }
         else {
@@ -634,7 +335,7 @@ public class ExternalSystemUtil {
       @Override
       public void run() {
         if (modal) {
-          String title = ExternalSystemBundle.message("progress.import.text", toReadableName(externalSystemId));
+          String title = ExternalSystemBundle.message("progress.import.text", ExternalSystemApiUtil.toReadableName(externalSystemId));
           ProgressManager.getInstance().run(new Task.Modal(project, title, false) {
             @Override
             public void run(@NotNull ProgressIndicator indicator) {
@@ -646,7 +347,7 @@ public class ExternalSystemUtil {
           });
         }
         else {
-          String title = ExternalSystemBundle.message("progress.refresh.text", toReadableName(externalSystemId));
+          String title = ExternalSystemBundle.message("progress.refresh.text", ExternalSystemApiUtil.toReadableName(externalSystemId));
           ProgressManager.getInstance().run(new Task.Backgroundable(project, title) {
             @Override
             public void run(@NotNull ProgressIndicator indicator) {
@@ -666,24 +367,5 @@ public class ExternalSystemUtil {
     void execute(@NotNull ProgressIndicator indicator);
   }
 
-  @Nullable
-  public static Sdk findJdk(@NotNull JavaSdkVersion version) {
-    JavaSdk javaSdk = JavaSdk.getInstance();
-    List<Sdk> javaSdks = ProjectJdkTable.getInstance().getSdksOfType(javaSdk);
-    Sdk candidate = null;
-    for (Sdk sdk : javaSdks) {
-      JavaSdkVersion v = javaSdk.getVersion(sdk);
-      if (v == version) {
-        return sdk;
-      }
-      else if (candidate == null && v != null && version.getMaxLanguageLevel().isAtLeast(version.getMaxLanguageLevel())) {
-        candidate = sdk;
-      }
-    }
-    return candidate;
-  }
-
-  public static void orderAwareSort(@NotNull List<?> data) {
-    Collections.sort(data, ORDER_AWARE_COMPARATOR);
-  }
+  
 }
diff --git a/platform/external-system/src/com/intellij/openapi/externalSystem/model/ExternalSystemDataKeys.java b/platform/external-system/src/com/intellij/openapi/externalSystem/model/ExternalSystemDataKeys.java
deleted file mode 100644 (file)
index 983c387..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.intellij.openapi.externalSystem.model;
-
-import com.intellij.openapi.actionSystem.DataKey;
-import com.intellij.openapi.externalSystem.ui.ProjectStructureNode;
-import com.intellij.ui.treeStructure.Tree;
-import com.intellij.openapi.externalSystem.ui.ExternalProjectStructureTreeModel;
-
-import java.util.Collection;
-
-/**
- * @author Denis Zhdanov
- * @since 2/7/12 11:19 AM
- */
-public class ExternalSystemDataKeys {
-
-  /** Key for obtaining 'external system project structure' tree. */
-  public static final DataKey<Tree> PROJECT_TREE = DataKey.create("external.system.project.tree");
-
-  /** Key for obtaining 'external system project structure' tree model. */
-  public static final DataKey<ExternalProjectStructureTreeModel> PROJECT_TREE_MODEL = DataKey.create("external.system.project.tree.model");
-
-  /** Key for obtaining currently selected nodes at the 'external system project structure' tree. */
-  public static final DataKey<Collection<ProjectStructureNode<?>>> PROJECT_TREE_SELECTED_NODE
-    = DataKey.create("gradle.sync.tree.node.selected");
-
-  /** Key for obtaining node under mouse cursor at the 'external system project structure' tree. */
-  public static final DataKey<ProjectStructureNode<?>> SYNC_TREE_NODE_UNDER_MOUSE
-    = DataKey.create("gradle.sync.tree.node.under.mouse");
-  
-  // TODO den uncomment
-  
-//  public static final DataKey<GradleTasksList> RECENT_TASKS_LIST = DataKey.create("gradle.recent.tasks.list");
-
-//  public static final DataKey<GradleTasksModel> ALL_TASKS_MODEL = DataKey.create("gradle.all.tasks.model");
-
-  private ExternalSystemDataKeys() {
-  }
-}
diff --git a/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/AbstractCompositeData.java b/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/AbstractCompositeData.java
deleted file mode 100644 (file)
index a7afdfc..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2000-2013 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.openapi.externalSystem.model.project;
-
-import com.intellij.openapi.externalSystem.model.ProjectSystemId;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * There is a possible case that the same entity (e.g. library or jar) has different versions at external system and ide side.
- * We treat that not as two entities (external system- and ide-local) but as a single composite entity. This class is a base class
- * for such types of entities.
- * <p/>
- * Thread-safe.
- * 
- * @author Denis Zhdanov
- * @since 1/23/13 9:19 AM
- */
-public abstract class AbstractCompositeData<E extends ProjectEntityData, I> extends AbstractProjectEntityData {
-
-  @NotNull private final E myExternalEntity;
-  @NotNull private final I myIdeEntity;
-
-  public AbstractCompositeData(@NotNull E externalEntity, @NotNull I ideEntity) {
-    super(ProjectSystemId.IDE);
-    myExternalEntity = externalEntity;
-    myIdeEntity = ideEntity;
-  }
-
-  @NotNull
-  public E getExternalEntity() {
-    return myExternalEntity;
-  }
-
-  @NotNull
-  public I getIdeEntity() {
-    return myIdeEntity;
-  }
-
-  @Override
-  public int hashCode() {
-    int result = super.hashCode();
-    result = 31 * result + myExternalEntity.hashCode();
-    result = 31 * result + myIdeEntity.hashCode();
-    return result;
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (!super.equals(o)) return false;
-
-    AbstractCompositeData entity = (AbstractCompositeData)o;
-
-    if (!myExternalEntity.equals(entity.myExternalEntity)) return false;
-    if (!myIdeEntity.equals(entity.myIdeEntity)) return false;
-
-    return true;
-  }
-}
diff --git a/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/CompositeLibraryDependencyData.java b/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/CompositeLibraryDependencyData.java
deleted file mode 100644 (file)
index ff618a9..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2000-2013 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.openapi.externalSystem.model.project;
-
-import com.intellij.openapi.externalSystem.model.DataNode;
-import com.intellij.openapi.externalSystem.model.ProjectSystemId;
-import com.intellij.openapi.externalSystem.model.project.id.CompositeLibraryDependencyId;
-import com.intellij.openapi.externalSystem.model.project.id.LibraryDependencyId;
-import com.intellij.openapi.externalSystem.model.project.id.ProjectEntityId;
-import com.intellij.openapi.externalSystem.util.ExternalSystemUtil;
-import com.intellij.openapi.roots.LibraryOrderEntry;
-import com.intellij.openapi.roots.libraries.Library;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Stands for an entity which references two library dependencies.
- * 
- * @author Denis Zhdanov
- * @since 1/22/13 5:28 PM
- */
-public class CompositeLibraryDependencyData extends AbstractCompositeData<LibraryDependencyData, LibraryOrderEntry> {
-
-  public CompositeLibraryDependencyData(@NotNull LibraryDependencyData libraryDependencyData,
-                                        @NotNull LibraryOrderEntry ideLibraryDependency)
-  {
-    super(libraryDependencyData, ideLibraryDependency);
-  }
-
-  @NotNull
-  @Override
-  public ProjectEntityId getId(@Nullable DataNode<?> dataNode) {
-    Library library = getIdeEntity().getLibrary();
-    assert library != null;
-    return new CompositeLibraryDependencyId(
-      new LibraryDependencyId(getOwner(), getExternalEntity().getOwnerModule().getName(), getExternalEntity().getName()),
-      new LibraryDependencyId(ProjectSystemId.IDE, getIdeEntity().getOwnerModule().getName(), ExternalSystemUtil.getLibraryName(library))
-    );
-  }
-
-  @Override
-  public String toString() {
-    return String.format("composite library dependency - external: %s, ide: %s", getExternalEntity(), getIdeEntity());
-  }
-}
diff --git a/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/ExternalEntityCloneContext.java b/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/ExternalEntityCloneContext.java
deleted file mode 100644 (file)
index 10556c4..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.intellij.openapi.externalSystem.model.project;
-
-import com.intellij.util.containers.hash.HashMap;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.Map;
-
-/**
- * We need to be able to perform cloning of external project entities. However, there is a possible case that particular entity
- * encapsulates graph of other entities. For example, {@link ModuleData} has a number of
- * {@link ModuleData#getDependencies() dependencies} where those dependencies can reference other modules that, in turn, also
- * have dependencies.
- * <p/>
- * The problem is that we need to ensure that particular entity is shared within a single entities graph (e.g. there should
- * be a single shared instance of {@link ModuleData gradle module} after cloning). That's why we need some place to serve
- * as a cache during cloning. This class serves that purpose.
- * 
- * @author Denis Zhdanov
- * @since 9/28/11 12:36 PM
- */
-public class ExternalEntityCloneContext {
-
-  private final Map<LibraryData, LibraryData> myLibraries = new HashMap<LibraryData, LibraryData>();
-  private final Map<ModuleData, ModuleData>   myModules   = new HashMap<ModuleData, ModuleData>();
-
-  @Nullable
-  public LibraryData getLibrary(@NotNull LibraryData library) {
-    return myLibraries.get(library);
-  }
-
-  public void store(@NotNull LibraryData key, @NotNull LibraryData value) {
-    myLibraries.put(key, value);
-  }
-
-  @Nullable
-  public ModuleData getModule(@NotNull ModuleData module) {
-    return myModules.get(module);
-  }
-
-  public void store(@NotNull ModuleData key, @NotNull ModuleData value) {
-    myModules.put(key, value);
-  }
-}
diff --git a/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/JarData.java b/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/JarData.java
deleted file mode 100644 (file)
index 302dff1..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-package com.intellij.openapi.externalSystem.model.project;
-
-import com.intellij.openapi.externalSystem.model.DataNode;
-import com.intellij.openapi.externalSystem.model.ProjectSystemId;
-import com.intellij.openapi.externalSystem.model.project.id.JarId;
-import com.intellij.openapi.externalSystem.model.project.id.LibraryId;
-import com.intellij.openapi.externalSystem.model.project.id.ProjectEntityId;
-import com.intellij.openapi.externalSystem.util.ExternalSystemUtil;
-import com.intellij.openapi.roots.libraries.Library;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * @author Denis Zhdanov
- * @since 12/11/12 3:07 PM
- */
-public class JarData extends AbstractNamedData {
-
-  @NotNull private final String myPath;
-
-  @Nullable private final Library         myIdeLibrary;
-  @Nullable private final LibraryData     myLibraryData;
-  @NotNull private final  LibraryPathType myPathType;
-  @Nullable private final ProjectSystemId myExternalSystemId;
-
-  public JarData(@NotNull String path,
-                 @NotNull LibraryPathType pathType,
-                 @Nullable Library ideLibrary,
-                 @Nullable LibraryData libraryData,
-                 @Nullable ProjectSystemId owner)
-  {
-    super(ExternalSystemUtil.detectOwner(libraryData, ideLibrary), ExternalSystemUtil.extractNameFromPath(path));
-    myPathType = pathType;
-    myExternalSystemId = owner;
-    assert ideLibrary == null ^ libraryData == null;
-    myPath = path;
-    myIdeLibrary = ideLibrary;
-    myLibraryData = libraryData;
-  }
-
-  @NotNull
-  @Override
-  public ProjectEntityId getId(@Nullable DataNode<?> dataNode) {
-    return getId();
-  }
-
-  @NotNull
-  public String getPath() {
-    return myPath;
-  }
-
-  @NotNull
-  public LibraryPathType getPathType() {
-    return myPathType;
-  }
-
-  @NotNull
-  public JarId getId() {
-    return new JarId(myPath, myPathType, getLibraryId());
-  }
-  
-  @NotNull
-  public LibraryId getLibraryId() {
-    if (myIdeLibrary != null) {
-      return new LibraryId(ProjectSystemId.IDE, ExternalSystemUtil.getLibraryName(myIdeLibrary));
-    }
-    assert myExternalSystemId != null;
-    assert myLibraryData != null;
-    return new LibraryId(myExternalSystemId, myLibraryData.getName());
-  }
-
-  @Override
-  public int hashCode() {
-    int result = super.hashCode();
-    result = 31 * result + myPath.hashCode();
-    result = 31 * result + myPathType.hashCode();
-    result = 31 * result + (myIdeLibrary != null ? myIdeLibrary.hashCode() : 0);
-    result = 31 * result + (myLibraryData != null ? myLibraryData.hashCode() : 0);
-    return result;
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (!super.equals(o)) return false;
-
-    JarData that = (JarData)o;
-    
-    if (!myPath.equals(that.myPath)) return false;
-    if (!myPathType.equals(that.myPathType)) return false;
-    if (myLibraryData != null ? !myLibraryData.equals(that.myLibraryData) : that.myLibraryData != null) return false;
-    if (myIdeLibrary == null && that.myIdeLibrary != null) {
-      return false;
-    }
-    else if (myIdeLibrary != null) {
-      if (that.myIdeLibrary == null) {
-        return false;
-      }
-      else if (!ExternalSystemUtil.getLibraryName(myIdeLibrary).equals(ExternalSystemUtil.getLibraryName(that.myIdeLibrary))) {
-        return false;
-      }
-    }
-    return true;
-  }
-
-  @SuppressWarnings("ConstantConditions")
-  @Override
-  public String toString() {
-    return String.format(
-      "%s jar at '%s'. Belongs to library '%s'",
-      myPathType.toString().toLowerCase(), myPath,
-      myIdeLibrary == null ? myLibraryData.getName() : ExternalSystemUtil.getLibraryName(myIdeLibrary)
-    );
-  }
-}
diff --git a/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/LibraryDependencyData.java b/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/LibraryDependencyData.java
deleted file mode 100644 (file)
index b534459..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.intellij.openapi.externalSystem.model.project;
-
-import com.intellij.openapi.externalSystem.model.DataNode;
-import com.intellij.openapi.externalSystem.model.project.id.LibraryDependencyId;
-import com.intellij.openapi.externalSystem.model.project.id.ProjectEntityId;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Not thread-safe.
- * 
- * @author Denis Zhdanov
- * @since 8/10/11 6:46 PM
- */
-public class LibraryDependencyData extends AbstractDependencyData<LibraryData> implements Named {
-
-  public LibraryDependencyData(@NotNull ModuleData ownerModule, @NotNull LibraryData library) {
-    super(ownerModule, library);
-  }
-
-  @NotNull
-  @Override
-  public ProjectEntityId getId(@Nullable DataNode<?> dataNode) {
-    return new LibraryDependencyId(getOwner(), getOwnerModule().getName(), getName());
-  }
-}
diff --git a/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/ProjectEntityType.java b/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/ProjectEntityType.java
deleted file mode 100644 (file)
index 0b8308d..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-package com.intellij.openapi.externalSystem.model.project;
-
-import com.intellij.icons.AllIcons;
-import com.intellij.openapi.application.ex.ApplicationInfoEx;
-import com.intellij.openapi.util.IconLoader;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import javax.swing.*;
-
-/**
- * @author Denis Zhdanov
- * @since 2/7/12 11:18 AM
- */
-public class ProjectEntityType {
-
-  @NotNull public static final ProjectEntityType PROJECT            = new ProjectEntityType("PROJECT", getProjectIcon());
-  @NotNull public static final ProjectEntityType MODULE             = new ProjectEntityType("MODULE", AllIcons.Nodes.Module);
-  @NotNull public static final ProjectEntityType MODULE_DEPENDENCY  = new ProjectEntityType("MODULE_DEPENDENCY", MODULE.getIcon());
-  @NotNull public static final ProjectEntityType LIBRARY            = new ProjectEntityType("LIBRARY", AllIcons.Nodes.PpLib);
-  @NotNull public static final ProjectEntityType LIBRARY_DEPENDENCY = new ProjectEntityType("LIBRARY_DEPENDENCY", LIBRARY.getIcon());
-  @NotNull public static final ProjectEntityType CONTENT_ROOT       = new ProjectEntityType("CONTENT_ROOT", null);
-  @NotNull public static final ProjectEntityType SYNTHETIC          = new ProjectEntityType("SYNTHETIC", null);
-  @NotNull public static final ProjectEntityType JAR                = new ProjectEntityType("JAR", AllIcons.FileTypes.Archive);
-
-  @NotNull public static final ProjectEntityType DEPENDENCY_TO_OUTDATED_LIBRARY = new ProjectEntityType(
-    "DEPENDENCY_TO_OUTDATED_LIBRARY", LIBRARY.getIcon()
-  );
-
-  @NotNull private final  String myId;
-  @Nullable private final Icon   myIcon;
-
-  ProjectEntityType(@NotNull String id, @Nullable Icon icon) {
-    myId = id;
-    myIcon = icon;
-  }
-
-  @Nullable
-  public Icon getIcon() {
-    return myIcon;
-  }
-
-  @NotNull
-  public String getId() {
-    return myId;
-  }
-
-  @Override
-  public int hashCode() {
-    return myId.hashCode();
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) return true;
-    if (o == null || getClass() != o.getClass()) return false;
-
-    ProjectEntityType type = (ProjectEntityType)o;
-
-    if (!myId.equals(type.myId)) return false;
-
-    return true;
-  }
-
-  @Override
-  public String toString() {
-    return myId;
-  }
-
-  @NotNull
-  private static Icon getProjectIcon() {
-    try {
-      return IconLoader.getIcon(ApplicationInfoEx.getInstanceEx().getSmallIconUrl());
-    }
-    catch (Exception e) {
-      // Control flow may reach this place if we run tests and platform IoC has not been initialised.
-      return IconLoader.getIcon("/nodes/ideProject.png");
-    }
-  }
-}
diff --git a/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/AbstractConflictingPropertyChange.java b/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/AbstractConflictingPropertyChange.java
deleted file mode 100644 (file)
index 639d355..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright 2000-2011 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.openapi.externalSystem.model.project.change;
-
-import com.intellij.openapi.externalSystem.model.project.id.ProjectEntityId;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Defines general contract for a change that encapsulates information about conflicting property value of the matched external system
- * and ide entities.
- * <p/>
- * For example we may match particular external system library to an ide library but they may have different set of attached binaries.
- * <p/>
- * Thread-safe.
- * 
- * @author Denis Zhdanov
- * @since 11/15/11 7:57 PM
- * @param <T>   target property value type
- */
-public abstract class AbstractConflictingPropertyChange<T> extends AbstractExternalProjectStructureChange {
-
-  @NotNull private final ProjectEntityId myEntityId;
-  @NotNull private final String          myPropertyDescription;
-  @NotNull private final T               myExternalValue;
-  @NotNull private final T               myIdeValue;
-
-  public AbstractConflictingPropertyChange(@NotNull ProjectEntityId id,
-                                           @NotNull String propertyDescription,
-                                           @NotNull T externalValue,
-                                           @NotNull T ideValue)
-  {
-    myEntityId = id;
-    myPropertyDescription = propertyDescription;
-    myExternalValue = externalValue;
-    myIdeValue = ideValue;
-  }
-
-  @NotNull
-  public ProjectEntityId getEntityId() {
-    return myEntityId;
-  }
-
-  /**
-   * @return target property's value at external system side
-   */
-  @NotNull
-  public T getExternalValue() {
-    return myExternalValue;
-  }
-
-  /**
-   * @return target property's value at ide side
-   */
-  @NotNull
-  public T getIdeValue() {
-    return myIdeValue;
-  }
-
-  @Override
-  public int hashCode() {
-    int result = 31 * super.hashCode() + myEntityId.hashCode();
-    result = 31 * result + myExternalValue.hashCode();
-    return 31 * result + myIdeValue.hashCode();
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) return true;
-    if (o == null || getClass() != o.getClass()) return false;
-    if (!super.equals(o)) return false;
-
-    AbstractConflictingPropertyChange that = (AbstractConflictingPropertyChange)o;
-
-    return myEntityId.equals(that.myEntityId) && myExternalValue.equals(that.myExternalValue) && myIdeValue.equals(that.myIdeValue);
-  }
-
-  @Override
-  public String toString() {
-    return String.format("%s change: external='%s', ide='%s'", myPropertyDescription, myExternalValue, myIdeValue);
-  }
-}
diff --git a/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/AbstractExternalProjectStructureChange.java b/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/AbstractExternalProjectStructureChange.java
deleted file mode 100644 (file)
index 4f2e825..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2000-2011 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.openapi.externalSystem.model.project.change;
-
-import com.intellij.openapi.externalSystem.model.project.change.ExternalProjectStructureChange;
-
-/**
- * @author Denis Zhdanov
- * @since 11/15/11 1:33 PM
- */
-public abstract class AbstractExternalProjectStructureChange implements ExternalProjectStructureChange {
-
-  @Override
-  public int hashCode() {
-    return 31;
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) return true;
-    return o != null && getClass() == o.getClass();
-  }
-}
diff --git a/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/AbstractProjectEntityPresenceChange.java b/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/AbstractProjectEntityPresenceChange.java
deleted file mode 100644 (file)
index d63d76a..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright 2000-2011 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.openapi.externalSystem.model.project.change;
-
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Defines common interface for a change that indicates that particular entity has been added/removed at Gradle or IntelliJ IDEA.
- * <p/>
- * Thread-safe.
- * 
- * @author Denis Zhdanov
- * @since 11/17/11 12:43 PM
- * @param <T>   entity type
- */
-public abstract class AbstractProjectEntityPresenceChange<T> extends AbstractExternalProjectStructureChange {
-
-  private final T      myExternalEntity;
-  private final T      myIdeEntity;
-  private final String myEntityName;
-
-  /**
-   * Creates new <code>AbstractProjectEntityPresenceChange</code> change.
-   *
-   * @param externalEntity    target entity at external system side. <code>null</code> as indication that the entity was
-   *                          removed at external system side or added at ide side
-   * @param ideEntity         target entity at ide side. <code>null</code> as indication that the entity was removed
-   *                          at ide side or added at ide side
-   * @throws IllegalArgumentException    if both of the given entities are defined or undefined. Expecting this constructor to be
-   *                                     called with one <code>null</code> argument and one non-<code>null</code> argument
-   */
-  public AbstractProjectEntityPresenceChange(@NotNull String entityName,
-                                             @Nullable T externalEntity,
-                                             @Nullable T ideEntity)
-    throws IllegalArgumentException
-  {
-    if (!(externalEntity == null ^ ideEntity == null)) {
-      throw new IllegalArgumentException(String.format(
-        "Can't construct %s object. Reason: expected that only gradle or ide entity is null, actual: external='%s'; ide='%s'",
-        getClass(), externalEntity, ideEntity
-      ));
-    }
-    myExternalEntity = externalEntity;
-    myIdeEntity = ideEntity;
-    myEntityName = entityName;
-  }
-
-  @Nullable
-  public T getExternalEntity() {
-    return myExternalEntity;
-  }
-  
-  @Nullable
-  public T getIdeEntity() {
-    return myIdeEntity;
-  }
-
-  @Override
-  public int hashCode() {
-    int result = super.hashCode();
-    result = 31 * result + (myExternalEntity != null ? myExternalEntity.hashCode() : 0);
-    return 31 * result + (myIdeEntity != null ? myIdeEntity.hashCode() : 0);
-  }
-
-  @SuppressWarnings("EqualsWhichDoesntCheckParameterClass")
-  @Override
-  public boolean equals(Object o) {
-    if (!super.equals(o)) return false;
-
-    AbstractProjectEntityPresenceChange that = (AbstractProjectEntityPresenceChange)o;
-
-    if (myExternalEntity != null ? !myExternalEntity.equals(that.myExternalEntity) : that.myExternalEntity != null) return false;
-    if (myIdeEntity != null ? !myIdeEntity.equals(that.myIdeEntity) : that.myIdeEntity != null) return false;
-
-    return true;
-  }
-
-  @Override
-  public String toString() {
-    return String.format("%s presence change: external='%s', ide='%s'", myEntityName, myExternalEntity, myIdeEntity);
-  }
-}
diff --git a/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/ContentRootPresenceChange.java b/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/ContentRootPresenceChange.java
deleted file mode 100644 (file)
index 6a61723..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.intellij.openapi.externalSystem.model.project.change;
-
-import com.intellij.openapi.externalSystem.model.project.ContentRootData;
-import com.intellij.openapi.externalSystem.model.project.id.ContentRootId;
-import com.intellij.openapi.externalSystem.model.project.id.EntityIdMapper;
-import com.intellij.openapi.externalSystem.util.ExternalSystemBundle;
-import com.intellij.openapi.roots.ContentEntry;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * @author Denis Zhdanov
- * @since 2/22/12 5:12 PM
- */
-public class ContentRootPresenceChange extends AbstractProjectEntityPresenceChange<ContentRootId> {
-
-  public ContentRootPresenceChange(@Nullable ContentRootData gradleEntity, @Nullable ContentEntry intellijEntity)
-    throws IllegalArgumentException
-  {
-    super(ExternalSystemBundle.message("entity.type.content.root"), of(gradleEntity), of(intellijEntity));
-  }
-
-  @Nullable
-  private static ContentRootId of(@Nullable Object contentRoot) {
-    if (contentRoot == null) {
-      return null;
-    }
-    return EntityIdMapper.mapEntityToId(contentRoot);
-  }
-
-  @Override
-  public void invite(@NotNull ExternalProjectStructureChangeVisitor visitor) {
-    visitor.visit(this); 
-  }
-}
diff --git a/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/DependencyExportedChange.java b/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/DependencyExportedChange.java
deleted file mode 100644 (file)
index 3aa9f47..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.intellij.openapi.externalSystem.model.project.change;
-
-import com.intellij.openapi.externalSystem.model.project.id.AbstractExternalDependencyId;
-import com.intellij.openapi.externalSystem.util.ExternalSystemBundle;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @author Denis Zhdanov
- * @since 3/14/12 1:34 PM
- */
-public class DependencyExportedChange extends AbstractConflictingPropertyChange<Boolean> {
-
-  public DependencyExportedChange(@NotNull AbstractExternalDependencyId id, boolean gradleValue, boolean intellijValue) {
-    super(id, ExternalSystemBundle.message("change.dependency.exported", id), gradleValue, intellijValue);
-  }
-
-  @NotNull
-  @Override
-  public AbstractExternalDependencyId getEntityId() {
-    return (AbstractExternalDependencyId)super.getEntityId();
-  }
-
-  @Override
-  public void invite(@NotNull ExternalProjectStructureChangeVisitor visitor) {
-    visitor.visit(this);
-  }
-}
diff --git a/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/DependencyScopeChange.java b/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/DependencyScopeChange.java
deleted file mode 100644 (file)
index b462756..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.intellij.openapi.externalSystem.model.project.change;
-
-import com.intellij.openapi.externalSystem.model.project.id.AbstractExternalDependencyId;
-import com.intellij.openapi.externalSystem.util.ExternalSystemBundle;
-import com.intellij.openapi.roots.DependencyScope;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @author Denis Zhdanov
- * @since 3/12/12 6:02 PM
- */
-public class DependencyScopeChange extends AbstractConflictingPropertyChange<DependencyScope> {
-  
-  public DependencyScopeChange(@NotNull AbstractExternalDependencyId id,
-                               @NotNull DependencyScope gradleValue,
-                               @NotNull DependencyScope intellijValue)
-  {
-    super(id, ExternalSystemBundle.message("change.dependency.scope", id), gradleValue, intellijValue);
-  }
-
-  @NotNull
-  @Override
-  public AbstractExternalDependencyId getEntityId() {
-    return (AbstractExternalDependencyId)super.getEntityId();
-  }
-
-  @Override
-  public void invite(@NotNull ExternalProjectStructureChangeVisitor visitor) {
-    visitor.visit(this);
-  }
-}
diff --git a/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/ExternalProjectStructureChange.java b/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/ExternalProjectStructureChange.java
deleted file mode 100644 (file)
index 77c89a9..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.intellij.openapi.externalSystem.model.project.change;
-
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Defines common interface for the change between Gradle and IntelliJ IDEA project structures.
- * <p/>
- * Implementations of this interface are assumed to provide correct {@link #hashCode()}/{@link #equals(Object)}.
- * <p/>
- * Implementations of this interface are not obliged to be thread-safe.
- * 
- * @author Denis Zhdanov
- * @since 11/3/11 3:54 PM
- */
-public interface ExternalProjectStructureChange {
-
-  /**
-   * Allows to perform double-dispatch of the current change object within the given visitor.
-   *
-   * @param visitor  visitor to use
-   */
-  void invite(@NotNull ExternalProjectStructureChangeVisitor visitor);
-}
diff --git a/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/ExternalProjectStructureChangeVisitor.java b/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/ExternalProjectStructureChangeVisitor.java
deleted file mode 100644 (file)
index e62594b..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2000-2011 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.openapi.externalSystem.model.project.change;
-
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Defines common interface for dispatching gradle project structure change objects.
- * 
- * @author Denis Zhdanov
- * @since 11/16/11 8:48 PM
- */
-public interface ExternalProjectStructureChangeVisitor {
-  void visit(@NotNull GradleProjectRenameChange change);
-  void visit(@NotNull LanguageLevelChange change);
-  void visit(@NotNull ModulePresenceChange change);
-  void visit(@NotNull ContentRootPresenceChange change);
-  void visit(@NotNull LibraryDependencyPresenceChange change);
-  void visit(@NotNull JarPresenceChange change);
-  void visit(@NotNull OutdatedLibraryVersionChange change);
-  void visit(@NotNull ModuleDependencyPresenceChange change);
-  void visit(@NotNull DependencyScopeChange change);
-  void visit(@NotNull DependencyExportedChange change);
-}
diff --git a/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/ExternalProjectStructureChangeVisitorAdapter.java b/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/ExternalProjectStructureChangeVisitorAdapter.java
deleted file mode 100644 (file)
index 0bce404..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-package com.intellij.openapi.externalSystem.model.project.change;
-
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @author Denis Zhdanov
- * @since 3/2/12 4:21 PM
- */
-public abstract class ExternalProjectStructureChangeVisitorAdapter implements ExternalProjectStructureChangeVisitor {
-  @Override
-  public void visit(@NotNull GradleProjectRenameChange change) {
-  }
-
-  @Override
-  public void visit(@NotNull LanguageLevelChange change) {
-  }
-
-  @Override
-  public void visit(@NotNull ModulePresenceChange change) {
-  }
-
-  @Override
-  public void visit(@NotNull ContentRootPresenceChange change) {
-  }
-
-  @Override
-  public void visit(@NotNull LibraryDependencyPresenceChange change) {
-  }
-
-  @Override
-  public void visit(@NotNull JarPresenceChange change) {
-  }
-
-  @Override
-  public void visit(@NotNull OutdatedLibraryVersionChange change) {
-  }
-
-  @Override
-  public void visit(@NotNull ModuleDependencyPresenceChange change) {
-  }
-
-  @Override
-  public void visit(@NotNull DependencyScopeChange change) {
-  }
-
-  @Override
-  public void visit(@NotNull DependencyExportedChange change) {
-  }
-}
diff --git a/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/ExternalProjectStructureChangesCalculator.java b/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/ExternalProjectStructureChangesCalculator.java
deleted file mode 100644 (file)
index d391e12..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.intellij.openapi.externalSystem.model.project.change;
-
-import com.intellij.openapi.externalSystem.model.project.ProjectEntityData;
-import com.intellij.openapi.externalSystem.service.project.change.ExternalProjectChangesCalculationContext;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Defines common interface to the strategy that calculates difference between the corresponding external system and ide entities
- * (e.g. between an external and ide module).
- * <p/>
- * Implementations of this interface are expected to be thread-safe.
- * 
- * @author Denis Zhdanov
- * @since 1/24/12 12:15 PM
- * @param <I>   target intellij entity type
- * @param <G>   target gradle entity type
- */
-public interface ExternalProjectStructureChangesCalculator<G extends ProjectEntityData, I> {
-
-  /**
-   * Calculates changes between the given entities.
-   *
-   * @param externalEntity    target external system entity
-   * @param ideEntity         target ide entity
-   * @param context           target diff calculation context
-   */
-  void calculate(@NotNull G externalEntity, @NotNull I ideEntity, @NotNull ExternalProjectChangesCalculationContext context);
-}
diff --git a/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/GradleProjectRenameChange.java b/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/GradleProjectRenameChange.java
deleted file mode 100644 (file)
index 8c47933..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.intellij.openapi.externalSystem.model.project.change;
-
-import com.intellij.openapi.externalSystem.model.ProjectSystemId;
-import com.intellij.openapi.externalSystem.model.project.id.ProjectId;
-import com.intellij.openapi.externalSystem.util.ExternalSystemBundle;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Describes project name change.
- * 
- * @author Denis Zhdanov
- * @since 11/3/11 3:54 PM
- */
-public class GradleProjectRenameChange extends AbstractConflictingPropertyChange<String> {
-
-  public GradleProjectRenameChange(@NotNull String gradleName, @NotNull String intellijName) {
-    super(new ProjectId(ProjectSystemId.IDE), ExternalSystemBundle.message("change.project.name"), gradleName, intellijName);
-  }
-
-  @Override
-  public void invite(@NotNull ExternalProjectStructureChangeVisitor visitor) {
-    visitor.visit(this);
-  }
-}
diff --git a/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/JarPresenceChange.java b/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/JarPresenceChange.java
deleted file mode 100644 (file)
index 6e37443..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.intellij.openapi.externalSystem.model.project.change;
-
-import com.intellij.openapi.externalSystem.model.project.id.JarId;
-import com.intellij.openapi.externalSystem.util.ExternalSystemBundle;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * @author Denis Zhdanov
- * @since 12/11/12 7:52 PM
- */
-public class JarPresenceChange extends AbstractProjectEntityPresenceChange<JarId> {
-
-  public JarPresenceChange(@Nullable JarId gradleEntity, @Nullable JarId ideEntity) {
-    super(ExternalSystemBundle.message("entity.type.jar"), gradleEntity, ideEntity);
-  }
-
-  @Override
-  public void invite(@NotNull ExternalProjectStructureChangeVisitor visitor) {
-    visitor.visit(this); 
-  }
-}
diff --git a/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/LanguageLevelChange.java b/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/LanguageLevelChange.java
deleted file mode 100644 (file)
index f8472d9..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 2000-2011 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.openapi.externalSystem.model.project.change;
-
-import com.intellij.openapi.externalSystem.model.ProjectSystemId;
-import com.intellij.openapi.externalSystem.model.project.id.ProjectId;
-import com.intellij.openapi.externalSystem.util.ExternalSystemBundle;
-import com.intellij.pom.java.LanguageLevel;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @author Denis Zhdanov
- * @since 11/15/11 8:05 PM
- */
-public class LanguageLevelChange extends AbstractConflictingPropertyChange<LanguageLevel> {
-  
-  public LanguageLevelChange(@NotNull LanguageLevel gradleValue, @NotNull LanguageLevel intellijValue) {
-    super(new ProjectId(ProjectSystemId.IDE), ExternalSystemBundle.message("change.project.language.level"), gradleValue, intellijValue);
-  }
-
-  @Override
-  public void invite(@NotNull ExternalProjectStructureChangeVisitor visitor) {
-    visitor.visit(this);
-  }
-}
diff --git a/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/LibraryDependencyPresenceChange.java b/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/LibraryDependencyPresenceChange.java
deleted file mode 100644 (file)
index 0502252..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-package com.intellij.openapi.externalSystem.model.project.change;
-
-import com.intellij.openapi.externalSystem.model.project.LibraryDependencyData;
-import com.intellij.openapi.externalSystem.model.project.id.EntityIdMapper;
-import com.intellij.openapi.externalSystem.model.project.id.LibraryDependencyId;
-import com.intellij.openapi.externalSystem.util.ExternalSystemBundle;
-import com.intellij.openapi.roots.LibraryOrderEntry;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Thread-safe.
- * 
- * @author Denis Zhdanov
- * @since 1/24/12 9:48 AM
- */
-public class LibraryDependencyPresenceChange extends AbstractProjectEntityPresenceChange<LibraryDependencyId> {
-
-  public LibraryDependencyPresenceChange(@Nullable LibraryDependencyData gradleDependency,
-                                         @Nullable LibraryOrderEntry intellijDependency) throws IllegalArgumentException
-  {
-    super(ExternalSystemBundle.message("entity.type.library.dependency"), of(gradleDependency), of(intellijDependency));
-  }
-
-  @Override
-  public void invite(@NotNull ExternalProjectStructureChangeVisitor visitor) {
-    visitor.visit(this);
-  }
-
-  @Nullable
-  private static LibraryDependencyId of(@Nullable Object dependency) {
-    if (dependency == null) {
-      return null;
-    }
-    return EntityIdMapper.mapEntityToId(dependency);
-  }
-}
diff --git a/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/ModuleDependencyPresenceChange.java b/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/ModuleDependencyPresenceChange.java
deleted file mode 100644 (file)
index b258c95..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.intellij.openapi.externalSystem.model.project.change;
-
-import com.intellij.openapi.externalSystem.model.project.ModuleDependencyData;
-import com.intellij.openapi.externalSystem.model.project.id.EntityIdMapper;
-import com.intellij.openapi.externalSystem.model.project.id.ModuleDependencyId;
-import com.intellij.openapi.externalSystem.util.ExternalSystemBundle;
-import com.intellij.openapi.roots.ModuleOrderEntry;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * @author Denis Zhdanov
- * @since 2/17/12 3:14 PM
- */
-public class ModuleDependencyPresenceChange extends AbstractProjectEntityPresenceChange<ModuleDependencyId> {
-
-  public ModuleDependencyPresenceChange(@Nullable ModuleDependencyData gradle, @Nullable ModuleOrderEntry intellij) {
-    super(ExternalSystemBundle.message("entity.type.module.dependency"), of(gradle), of(intellij));
-  }
-
-  @Override
-  public void invite(@NotNull ExternalProjectStructureChangeVisitor visitor) {
-    visitor.visit(this);
-  }
-
-  @Nullable
-  private static ModuleDependencyId of(@Nullable Object dependency) {
-    if (dependency == null) {
-      return null;
-    }
-    return EntityIdMapper.mapEntityToId(dependency);
-  }
-}
diff --git a/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/ModulePresenceChange.java b/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/ModulePresenceChange.java
deleted file mode 100644 (file)
index 72c369c..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2000-2011 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.openapi.externalSystem.model.project.change;
-
-import com.intellij.openapi.externalSystem.model.project.ModuleData;
-import com.intellij.openapi.externalSystem.model.project.id.EntityIdMapper;
-import com.intellij.openapi.externalSystem.model.project.id.ModuleId;
-import com.intellij.openapi.externalSystem.util.ExternalSystemBundle;
-import com.intellij.openapi.module.Module;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * @author Denis Zhdanov
- * @since 11/17/11 12:50 PM
- */
-public class ModulePresenceChange extends AbstractProjectEntityPresenceChange<ModuleId> {
-
-  public ModulePresenceChange(@Nullable ModuleData externalModule, @Nullable Module ideModule)
-    throws IllegalArgumentException
-  {
-    super(ExternalSystemBundle.message("entity.type.module"), of(externalModule), of(ideModule));
-  }
-
-  @Override
-  public void invite(@NotNull ExternalProjectStructureChangeVisitor visitor) {
-    visitor.visit(this);
-  }
-
-  @Nullable
-  private static ModuleId of(@Nullable Object module) {
-    if (module == null) {
-      return null;
-    }
-    return EntityIdMapper.mapEntityToId(module);
-  }
-}
diff --git a/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/OutdatedLibraryVersionChange.java b/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/OutdatedLibraryVersionChange.java
deleted file mode 100644 (file)
index 0035254..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright 2000-2013 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.openapi.externalSystem.model.project.change;
-
-import org.jetbrains.annotations.NotNull;
-import com.intellij.openapi.externalSystem.model.project.id.LibraryId;
-
-/**
- * There is a possible case that particular library has different versions at external system and ide sides. Object of this class
- * encapsulates that information.
- * 
- * @author Denis Zhdanov
- * @since 1/22/13 12:21 PM
- */
-public class OutdatedLibraryVersionChange extends AbstractExternalProjectStructureChange {
-
-  @NotNull private final String    myBaseLibraryName;
-  @NotNull private final LibraryId myLibraryId;
-  @NotNull private final String    myExternalLibraryVersion;
-  @NotNull private final LibraryId myIdeLibraryId;
-  @NotNull private final String    myIdeLibraryVersion;
-
-  public OutdatedLibraryVersionChange(@NotNull String baseLibraryName,
-                                      @NotNull LibraryId libraryId,
-                                      @NotNull String externalLibraryVersion,
-                                      @NotNull LibraryId ideLibraryId,
-                                      @NotNull String ideLibraryVersion)
-  {
-    myBaseLibraryName = baseLibraryName;
-    myLibraryId = libraryId;
-    myExternalLibraryVersion = externalLibraryVersion;
-    myIdeLibraryId = ideLibraryId;
-    myIdeLibraryVersion = ideLibraryVersion;
-  }
-
-  @NotNull
-  public String getBaseLibraryName() {
-    return myBaseLibraryName;
-  }
-
-  @NotNull
-  public LibraryId getLibraryId() {
-    return myLibraryId;
-  }
-
-  @NotNull
-  public String getExternalLibraryVersion() {
-    return myExternalLibraryVersion;
-  }
-
-  @NotNull
-  public LibraryId getIdeLibraryId() {
-    return myIdeLibraryId;
-  }
-
-  @NotNull
-  public String getIdeLibraryVersion() {
-    return myIdeLibraryVersion;
-  }
-
-  @Override
-  public int hashCode() {
-    int result = super.hashCode();
-    result = 31 * result + myBaseLibraryName.hashCode();
-    result = 31 * result + myLibraryId.hashCode();
-    result = 31 * result + myExternalLibraryVersion.hashCode();
-    result = 31 * result + myIdeLibraryId.hashCode();
-    result = 31 * result + myIdeLibraryVersion.hashCode();
-    return result;
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (!super.equals(o)) return false;
-
-    OutdatedLibraryVersionChange change = (OutdatedLibraryVersionChange)o;
-
-    if (!myBaseLibraryName.equals(change.myBaseLibraryName)) return false;
-    if (!myLibraryId.equals(change.myLibraryId)) return false;
-    if (!myExternalLibraryVersion.equals(change.myExternalLibraryVersion)) return false;
-    if (!myIdeLibraryId.equals(change.myIdeLibraryId)) return false;
-    if (!myIdeLibraryVersion.equals(change.myIdeLibraryVersion)) return false;
-
-    return true;
-  }
-
-  @Override
-  public void invite(@NotNull ExternalProjectStructureChangeVisitor visitor) {
-    visitor.visit(this);
-  }
-
-  @Override
-  public String toString() {
-    return String.format("'%s' library version change: '%s' -> '%s'", myBaseLibraryName, myIdeLibraryVersion, myExternalLibraryVersion);
-  }
-}
\ No newline at end of file
diff --git a/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/user/AbstractDependencyAwareUserChange.java b/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/user/AbstractDependencyAwareUserChange.java
deleted file mode 100644 (file)
index 30bff61..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright 2000-2013 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.openapi.externalSystem.model.project.change.user;
-
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * @author Denis Zhdanov
- * @since 2/19/13 8:54 AM
- */
-public abstract class AbstractDependencyAwareUserChange<T extends AbstractDependencyAwareUserChange<T>>
-  extends AbstractModuleAwareUserChange<T>
-{
-
-  @Nullable
-  private String myDependencyName;
-
-  protected AbstractDependencyAwareUserChange() {
-    // Required for IJ serialization
-  }
-
-  @SuppressWarnings("NullableProblems")
-  protected AbstractDependencyAwareUserChange(@NotNull String moduleName, @NotNull String dependencyName) {
-    super(moduleName);
-    myDependencyName = dependencyName;
-  }
-
-  @Nullable
-  public String getDependencyName() {
-    return myDependencyName;
-  }
-
-  public void setDependencyName(@Nullable String dependencyName) {
-    myDependencyName = dependencyName;
-  }
-
-  @Override
-  public int hashCode() {
-    int result = super.hashCode();
-    result = 31 * result + (myDependencyName != null ? myDependencyName.hashCode() : 0);
-    return result;
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (!super.equals(o)) return false;
-
-    AbstractDependencyAwareUserChange change = (AbstractDependencyAwareUserChange)o;
-
-    if (myDependencyName != null ? !myDependencyName.equals(change.myDependencyName) : change.myDependencyName != null) return false;
-
-    return true;
-  }
-
-  @SuppressWarnings({"unchecked"})
-  @Override
-  public int compareTo(@NotNull UserProjectChange<?> o) {
-    int cmp = super.compareTo(o);
-    if (cmp != 0 || (!(o instanceof AbstractDependencyAwareUserChange))) {
-      return cmp;
-    }
-
-    AbstractDependencyAwareUserChange<T> that = (AbstractDependencyAwareUserChange<T>)o;
-    if (myDependencyName == null) {
-      return that.myDependencyName == null ? 0 : 1;
-    }
-    else if (that.myDependencyName == null) {
-      return -1;
-    }
-    else {
-      return myDependencyName.compareTo(that.myDependencyName);
-    }
-  }
-}
diff --git a/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/user/AbstractDependencyExportedUserChange.java b/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/user/AbstractDependencyExportedUserChange.java
deleted file mode 100644 (file)
index 8bbefc5..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright 2000-2013 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.openapi.externalSystem.model.project.change.user;
-
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @author Denis Zhdanov
- * @since 3/4/13 12:17 PM
- */
-public abstract class AbstractDependencyExportedUserChange<T extends AbstractDependencyExportedUserChange<T>> 
-  extends AbstractDependencyAwareUserChange<T>
-{
-  private boolean myExported;
-
-  protected AbstractDependencyExportedUserChange() {
-    // Required for IJ serialization
-  }
-
-  protected AbstractDependencyExportedUserChange(@NotNull String moduleName, @NotNull String dependencyName, boolean exported) {
-    super(moduleName, dependencyName);
-    myExported = exported;
-  }
-
-  public boolean isExported() {
-    return myExported;
-  }
-
-  @SuppressWarnings("UnusedDeclaration")
-  public void setExported(boolean exported) {
-    myExported = exported;
-  }
-
-  @Override
-  public int hashCode() {
-    int result = super.hashCode();
-    return 31 * result + (myExported ? 1 : 0);
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (!super.equals(o)) return false;
-
-    AbstractDependencyExportedUserChange<?> change = (AbstractDependencyExportedUserChange<?>)o;
-
-    return myExported == change.myExported;
-  }
-
-  @SuppressWarnings({"unchecked"})
-  @Override
-  public int compareTo(@NotNull UserProjectChange<?> o) {
-    int cmp = super.compareTo(o);
-    if (cmp != 0 || (!(o instanceof AbstractDependencyExportedUserChange<?>))) {
-      return cmp;
-    }
-
-    AbstractDependencyExportedUserChange<T> that = (AbstractDependencyExportedUserChange<T>)o;
-    if (myExported) {
-      return that.myExported ? 0 : 1;
-    }
-    else {
-      return that.myExported ? -1 : 0;
-    }
-  }
-}
diff --git a/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/user/AbstractDependencyScopeUserChange.java b/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/user/AbstractDependencyScopeUserChange.java
deleted file mode 100644 (file)
index 0aac800..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright 2000-2013 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.openapi.externalSystem.model.project.change.user;
-
-import com.intellij.openapi.roots.DependencyScope;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * @author Denis Zhdanov
- * @since 3/4/13 12:08 PM
- */
-public abstract class AbstractDependencyScopeUserChange<T extends AbstractDependencyScopeUserChange<T>>
-  extends AbstractDependencyAwareUserChange<T>
-{
-  @Nullable
-  private DependencyScope myScope;
-
-  protected AbstractDependencyScopeUserChange() {
-    // Required for IJ serialization
-  }
-
-  @SuppressWarnings("NullableProblems")
-  protected AbstractDependencyScopeUserChange(@NotNull String moduleName,
-                                              @NotNull String dependencyName,
-                                              @NotNull DependencyScope scope)
-  {
-    super(moduleName, dependencyName);
-    myScope = scope;
-  }
-
-  @Nullable
-  public DependencyScope getScope() {
-    return myScope;
-  }
-
-  @SuppressWarnings("UnusedDeclaration")
-  public void setScope(@Nullable DependencyScope scope) {
-    myScope = scope;
-  }
-
-  @Override
-  public int hashCode() {
-    int result = super.hashCode();
-    result = 31 * result + (myScope != null ? myScope.hashCode() : 0);
-    return result;
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (!super.equals(o)) return false;
-
-    AbstractDependencyScopeUserChange<?> change = (AbstractDependencyScopeUserChange<?>)o;
-
-    if (myScope != null ? !myScope.equals(change.myScope) : change.myScope != null) return false;
-
-    return true;
-  }
-
-  @SuppressWarnings({"unchecked"})
-  @Override
-  public int compareTo(@NotNull UserProjectChange<?> o) {
-    int cmp = super.compareTo(o);
-    if (cmp != 0 || (!(o instanceof AbstractDependencyScopeUserChange<?>))) {
-      return cmp;
-    }
-
-    AbstractDependencyScopeUserChange<T> that = (AbstractDependencyScopeUserChange<T>)o;
-    if (myScope == null) {
-      return that.myScope == null ? 0 : 1;
-    }
-    else if (that.myScope == null) {
-      return -1;
-    }
-    else {
-      return myScope.compareTo(that.myScope);
-    }
-  }
-}
diff --git a/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/user/AbstractModuleAwareUserChange.java b/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/user/AbstractModuleAwareUserChange.java
deleted file mode 100644 (file)
index 0b6421c..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright 2000-2013 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.openapi.externalSystem.model.project.change.user;
-
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * @author Denis Zhdanov
- * @since 2/19/13 8:48 AM
- */
-public abstract class AbstractModuleAwareUserChange<T extends AbstractModuleAwareUserChange<T>> extends AbstractUserProjectChange<T> {
-
-  @Nullable
-  private String myModuleName;
-
-  @SuppressWarnings("UnusedDeclaration")
-  protected AbstractModuleAwareUserChange() {
-    // Required for IJ serialization
-  }
-
-  @SuppressWarnings("NullableProblems")
-  protected AbstractModuleAwareUserChange(@NotNull String moduleName) {
-    myModuleName = moduleName;
-  }
-
-  @Nullable
-  public String getModuleName() {
-    return myModuleName;
-  }
-
-  public void setModuleName(@Nullable String moduleName) {
-    myModuleName = moduleName;
-  }
-
-  @Override
-  public int hashCode() {
-    return myModuleName != null ? myModuleName.hashCode() : 0;
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) return true;
-    if (o == null || getClass() != o.getClass()) return false;
-
-    AbstractModuleAwareUserChange<?> change = (AbstractModuleAwareUserChange<?>)o;
-
-    if (myModuleName != null ? !myModuleName.equals(change.myModuleName) : change.myModuleName != null) return false;
-
-    return true;
-  }
-
-  @SuppressWarnings("unchecked")
-  @Override
-  public int compareTo(@NotNull UserProjectChange<?> o) {
-    int cmp = super.compareTo(o);
-    if (cmp != 0 || !(o instanceof AbstractModuleAwareUserChange<?>)) {
-      return cmp;
-    }
-    AbstractModuleAwareUserChange<T> that = (AbstractModuleAwareUserChange<T>)o;
-    if (myModuleName == null) {
-      return that.myModuleName == null ? 0 : 1;
-    }
-    else if (that.myModuleName == null) {
-      return -1;
-    }
-    else {
-      return myModuleName.compareTo(that.myModuleName);
-    }
-  }
-}
diff --git a/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/user/AbstractUserProjectChange.java b/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/user/AbstractUserProjectChange.java
deleted file mode 100644 (file)
index d18cd85..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2000-2013 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.openapi.externalSystem.model.project.change.user;
-
-import com.intellij.util.xmlb.XmlSerializerUtil;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * @author Denis Zhdanov
- * @since 2/18/13 8:29 PM
- */
-public abstract class AbstractUserProjectChange<T extends AbstractUserProjectChange<T>> implements UserProjectChange<T> {
-  
-  @SuppressWarnings("unchecked")
-  @Nullable
-  @Override
-  public T getState() {
-    return (T)this;
-  }
-
-  @Override
-  public void loadState(T state) {
-    XmlSerializerUtil.copyBean(state, this); 
-  }
-
-  @Override
-  public int compareTo(@NotNull UserProjectChange<?> o) {
-    return getClass().getName().compareTo(o.getClass().getName());
-  }
-}
diff --git a/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/user/AddLibraryDependencyUserChange.java b/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/user/AddLibraryDependencyUserChange.java
deleted file mode 100644 (file)
index cc92367..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2000-2013 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.openapi.externalSystem.model.project.change.user;
-
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @author Denis Zhdanov
- * @since 2/18/13 8:51 PM
- */
-public class AddLibraryDependencyUserChange extends AbstractDependencyAwareUserChange<AddLibraryDependencyUserChange> {
-
-  @SuppressWarnings("UnusedDeclaration")
-  public AddLibraryDependencyUserChange() {
-    // Necessary for IJ serialization.
-  }
-
-  public AddLibraryDependencyUserChange(@NotNull String moduleName, @NotNull String dependencyName) {
-    super(moduleName, dependencyName);
-  }
-
-  @Override
-  public void invite(@NotNull UserProjectChangeVisitor visitor) {
-    visitor.visit(this);
-  }
-  
-  @Override
-  public String toString() {
-    return String.format("library '%s' is added as a dependency to module '%s'", getDependencyName(), getModuleName());
-  }
-}
\ No newline at end of file
diff --git a/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/user/AddModuleDependencyUserChange.java b/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/user/AddModuleDependencyUserChange.java
deleted file mode 100644 (file)
index 874a543..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2000-2013 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.openapi.externalSystem.model.project.change.user;
-
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @author Denis Zhdanov
- * @since 2/19/13 9:05 AM
- */
-public class AddModuleDependencyUserChange extends AbstractDependencyAwareUserChange<AddModuleDependencyUserChange> {
-
-  @SuppressWarnings("UnusedDeclaration")
-  public AddModuleDependencyUserChange() {
-    // Necessary for IJ serialization.
-  }
-
-  public AddModuleDependencyUserChange(@NotNull String moduleName, @NotNull String dependencyName) {
-    super(moduleName, dependencyName);
-  }
-
-  @Override
-  public void invite(@NotNull UserProjectChangeVisitor visitor) {
-    visitor.visit(this);
-  }
-  
-  @Override
-  public String toString() {
-    return String.format("module '%s' is added as a dependency to module '%s'", getDependencyName(), getModuleName());
-  }
-}
diff --git a/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/user/AddModuleUserChange.java b/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/user/AddModuleUserChange.java
deleted file mode 100644 (file)
index c1022c6..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2000-2013 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.openapi.externalSystem.model.project.change.user;
-
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @author Denis Zhdanov
- * @since 2/18/13 8:28 PM
- */
-public class AddModuleUserChange extends AbstractModuleAwareUserChange<AddModuleUserChange> {
-  
-  @SuppressWarnings("UnusedDeclaration")
-  public AddModuleUserChange() {
-    // Required for IJ serialization
-  }
-
-  @SuppressWarnings("NullableProblems")
-  public AddModuleUserChange(@NotNull String moduleName) {
-    super(moduleName);
-  }
-
-  @Override
-  public void invite(@NotNull UserProjectChangeVisitor visitor) {
-    visitor.visit(this);
-  }
-
-  @Override
-  public String toString() {
-    return "added module " + getModuleName();
-  }
-}
diff --git a/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/user/LibraryDependencyExportedChange.java b/platform/external-system/src/com/intellij/openapi/externalSystem/model/project/change/user/LibraryDependencyExportedChange.java
deleted file mode 100644 (file)
index 1076255..0000000
--- a/