orphanModules,
- @NotNull final Project project,
- @NotNull final ProjectSystemId externalSystemId)
+ /**
+ * There is a possible case that an external module has been un-linked from ide project. There are two ways to process
+ * ide modules which correspond to that external project:
+ *
+ *
+ * - Remove them from ide project as well;
+ * - Keep them at ide project as well;
+ *
+ *
+ * This method handles that situation, i.e. it asks a user what should be done and acts accordingly.
+ *
+ * @param orphanModules modules which correspond to the un-linked external project
+ * @param project current ide project
+ * @param externalSystemId id of the external system which project has been un-linked from ide project
+ */
+ public static void ruleOrphanModules(@NotNull final List orphanModules,
+ @NotNull final Project project,
+ @NotNull final ProjectSystemId externalSystemId)
{
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
-
+
final JPanel content = new JPanel(new GridBagLayout());
content.add(new JLabel(ExternalSystemBundle.message("orphan.modules.text", externalSystemId.getReadableName())),
ExternalSystemUiUtil.getFillLineConstraints(0));
-
+
final CheckBoxList orphanModulesList = new CheckBoxList();
orphanModulesList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
orphanModulesList.setItems(orphanModules, new Function() {
@@ -244,15 +260,17 @@ public class ExternalSystemUtil {
for (Module module : orphanModules) {
orphanModulesList.setItemSelected(module, true);
}
+ orphanModulesList.setBorder(IdeBorderFactory.createEmptyBorder(8));
content.add(orphanModulesList, ExternalSystemUiUtil.getFillLineConstraints(0));
-
+ content.setBorder(IdeBorderFactory.createEmptyBorder(0, 0, 8, 0));
+
DialogWrapper dialog = new DialogWrapper(project) {
{
setTitle(ExternalSystemBundle.message("import.title", externalSystemId.getReadableName()));
init();
}
-
+
@Nullable
@Override
protected JComponent createCenterPanel() {
@@ -263,7 +281,7 @@ public class ExternalSystemUtil {
if (!ok) {
return;
}
-
+
List toRemove = ContainerUtilRt.newArrayList();
for (int i = 0; i < orphanModules.size(); i++) {
Module module = orphanModules.get(i);