Skip to content

Commit ffef620

Browse files
author
Igor Vinokur
committed
CHE-1113: Add ability to clone project with submodules
1 parent 38c3ca0 commit ffef620

19 files changed

Lines changed: 138 additions & 12 deletions

File tree

plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/GitLocalizationConstant.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,9 @@ public interface GitLocalizationConstant extends Messages {
260260
@Key("view.import.gitImporterPage.projectUrl")
261261
String gitImporterPageProjectUrl();
262262

263+
@Key("view.import.gitImporterPage.recursive")
264+
String gitImporterPageRecursive();
265+
263266
@Key("view.import.gitImporterPage.projectInfo")
264267
String gitImporterPageProjectInfo();
265268

@@ -692,4 +695,4 @@ public interface GitLocalizationConstant extends Messages {
692695

693696
@Key("console.project.name")
694697
String consoleProjectName(String projectName);
695-
}
698+
}

plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/importer/page/GitImporterPagePresenter.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,15 @@ public void projectUrlChanged(@NotNull String url) {
101101
updateDelegate.updateControls();
102102
}
103103

104+
@Override
105+
public void onRecursiveSelected(boolean recursiveSelected) {
106+
if (recursiveSelected) {
107+
projectParameters().put("recursive", null);
108+
} else {
109+
projectParameters().remove("recursive");
110+
}
111+
}
112+
104113
@Override
105114
public void projectDescriptionChanged(@NotNull String projectDescription) {
106115
dataObject.setDescription(projectDescription);

plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/importer/page/GitImporterPageView.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ interface ActionDelegate {
2828
/** Performs any actions appropriate in response to the user having changed the project's URL. */
2929
void projectUrlChanged(@NotNull String url);
3030

31+
/** Performs any actions appropriate in response to the user has selected recursive checkbox. */
32+
void onRecursiveSelected(boolean recursiveSelected);
33+
3134
/** Performs any actions appropriate in response to the user having changed the project's description. */
3235
void projectDescriptionChanged(@NotNull String projectDescriptionValue);
3336

plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/importer/page/GitImporterPageViewImpl.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ public class GitImporterPageViewImpl extends Composite implements GitImporterPag
5151
@UiField
5252
TextBox projectUrl;
5353

54+
@UiField
55+
CheckBox recursive;
56+
5457
@UiField
5558
FlowPanel importerPanel;
5659

@@ -100,6 +103,11 @@ void onProjectUrlChanged(KeyUpEvent event) {
100103
delegate.projectUrlChanged(projectUrl.getValue());
101104
}
102105

106+
@UiHandler("recursive")
107+
void recursiveHandler(ValueChangeEvent<Boolean> event) {
108+
delegate.onRecursiveSelected(event.getValue());
109+
}
110+
103111
@UiHandler("projectDescription")
104112
void onProjectDescriptionChanged(KeyUpEvent event) {
105113
if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {

plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/importer/page/GitImporterPageViewImpl.ui.xml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
debugId="file-importProject-projectUrl"/>
2626
<g:Label ui:field="labelUrlError" width="100%" wordWrap="true" addStyleNames="{style.labelErrorPosition}"/>
2727
</g:FlowPanel>
28+
<g:FlowPanel height="20px" addStyleNames="{style.namePanel}">
29+
<g:CheckBox ui:field="recursive" text="{locale.gitImporterPageRecursive}"
30+
debugId="file-importProject-recursive" addStyleNames="{style.alignLeft}" />
31+
</g:FlowPanel>
2832
<g:FlowPanel height="0" addStyleNames="{style.horizontalLine}"/>
2933
<g:FlowPanel height="35px" addStyleNames="{style.namePanel}">
3034
<g:Label text="{locale.gitImporterPageProjectInfo}" addStyleNames="{style.label}"/>
@@ -45,7 +49,7 @@
4549
tabIndex="5"/>
4650
</g:FlowPanel>
4751

48-
<g:FlowPanel height="25px" addStyleNames="{style.namePanel}">
52+
<g:FlowPanel height="20px" addStyleNames="{style.namePanel}">
4953
<g:CheckBox ui:field="keepDirectory" text="{locale.gitImporterPageKeepDirectory}"
5054
debugId="file-importProject-keepDirectory" addStyleNames="{style.alignLeft}" />
5155
</g:FlowPanel>
@@ -56,7 +60,7 @@
5660
tabIndex="9" debugId="file-importProject-keepDirectoryName" title="{locale.gitImporterPageBranchField}"/>
5761
</g:FlowPanel>
5862

59-
<g:FlowPanel height="25px" addStyleNames="{style.namePanel}">
63+
<g:FlowPanel height="20px" addStyleNames="{style.namePanel}">
6064
<g:CheckBox ui:field="branchSelection" text="{locale.gitImporterPageBranch}"
6165
debugId="file-importProject-branch" addStyleNames="{style.alignLeft}" />
6266
</g:FlowPanel>

plugins/plugin-git/che-plugin-git-ext-git/src/main/resources/org/eclipse/che/ide/ext/git/client/GitLocalizationConstant.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ importProject.messageStartWithWhiteSpace = The url can not start with a whitespa
9696
#GitImporterPage
9797
view.import.gitImporterPage.projectUrl = URL:
9898
view.import.gitImporterPage.projectInfo = Project Information
99+
view.import.gitImporterPage.recursive = Import recursively (for multi-module projects)
99100
view.import.gitImporterPage.projectName = Name:
100101
view.import.gitImporterPageProjectNamePrompt = Define the name of your project...
101102
view.import.gitImporterPage.projectDescription = Description:

plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/importer/page/GitImporterPagePresenterTest.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,28 @@ public void directoryNameEnteredTest() {
342342
verify(view).highlightDirectoryNameField(false);
343343
}
344344

345+
@Test
346+
public void recursiveCloneSelectedTest() {
347+
Map<String, String> parameters = new HashMap<>();
348+
when(source.getParameters()).thenReturn(parameters);
349+
when(view.getDirectoryName()).thenReturn("recursive");
350+
351+
presenter.onRecursiveSelected(true);
352+
353+
assertTrue(parameters.containsKey("recursive"));
354+
}
355+
356+
@Test
357+
public void recursiveCloneUnSelectedTest() {
358+
Map<String, String> parameters = new HashMap<>();
359+
parameters.put("recursive", null);
360+
when(source.getParameters()).thenReturn(parameters);
361+
362+
presenter.onRecursiveSelected(false);
363+
364+
assertTrue(parameters.isEmpty());
365+
}
366+
345367
private void verifyInvocationsForCorrectUrl(String correctUrl) {
346368
verify(view, never()).markURLInvalid();
347369
verify(source).setLocation(eq(correctUrl));

plugins/plugin-github/che-plugin-github-ide/src/main/java/org/eclipse/che/plugin/github/ide/GitHubLocalizationConstant.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ public interface GitHubLocalizationConstant extends Messages {
7070
@Key("view.import.githubImporterPage.projectUrl")
7171
String githubImporterPageProjectUrl();
7272

73+
@Key("view.import.githubImporterPage.recursive")
74+
String githubImporterPageRecursive();
75+
7376
@Key("view.import.githubImporterPage.projectInfo")
7477
String githubImporterPageProjectInfo();
7578

plugins/plugin-github/che-plugin-github-ide/src/main/java/org/eclipse/che/plugin/github/ide/importer/page/GithubImporterPagePresenter.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,15 @@ public void projectUrlChanged(@NotNull String url) {
144144
updateDelegate.updateControls();
145145
}
146146

147+
@Override
148+
public void onRecursiveSelected(boolean recursiveSelected) {
149+
if (recursiveSelected) {
150+
projectParameters().put("recursive", null);
151+
} else {
152+
projectParameters().remove("recursive");
153+
}
154+
}
155+
147156
@Override
148157
public void projectDescriptionChanged(@NotNull String projectDescription) {
149158
dataObject.setDescription(projectDescription);

plugins/plugin-github/che-plugin-github-ide/src/main/java/org/eclipse/che/plugin/github/ide/importer/page/GithubImporterPageView.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ interface ActionDelegate {
3636
*/
3737
void projectUrlChanged(@NotNull String url);
3838

39+
/** Performs any actions appropriate in response to the user has selected recursive checkbox. */
40+
void onRecursiveSelected(boolean recursiveSelected);
41+
3942
/**
4043
* Performs any actions appropriate in response to the user having changed the project's description.
4144
*/

0 commit comments

Comments
 (0)