Skip to content

Commit

Permalink
Merge pull request #352 from eclipse/displayConfiguredProject
Browse files Browse the repository at this point in the history
CHE-507. Fix displaying configured project in project explorer after importing project
  • Loading branch information
RomanNikitenko committed Feb 17, 2016
2 parents c77e5ac + 88fda3a commit 9c6047f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.google.web.bindery.event.shared.EventBus;

import org.eclipse.che.api.core.ErrorCodes;
import org.eclipse.che.api.project.gwt.client.ProjectServiceClient;
Expand All @@ -25,6 +26,7 @@
import org.eclipse.che.api.workspace.shared.dto.SourceStorageDto;
import org.eclipse.che.ide.CoreLocalizationConstant;
import org.eclipse.che.ide.api.app.AppContext;
import org.eclipse.che.ide.api.event.project.CreateProjectEvent;
import org.eclipse.che.ide.api.importer.AbstractImporter;
import org.eclipse.che.ide.api.project.wizard.ProjectNotificationSubscriber;
import org.eclipse.che.ide.api.project.wizard.ImportProjectNotificationSubscriberFactory;
Expand All @@ -42,6 +44,7 @@ public class ProjectImporter extends AbstractImporter {

private final VfsServiceClient vfsServiceClient;
private final CoreLocalizationConstant localizationConstant;
private final EventBus eventBus;
private final ProjectResolver projectResolver;

private ProjectConfigDto projectConfig;
Expand All @@ -53,11 +56,13 @@ public ProjectImporter(ProjectServiceClient projectService,
CoreLocalizationConstant localizationConstant,
ImportProjectNotificationSubscriberFactory subscriberFactory,
AppContext appContext,
EventBus eventBus,
ProjectResolver projectResolver) {
super(appContext, projectService, subscriberFactory);
this.vfsServiceClient = vfsServiceClient;
this.localizationConstant = localizationConstant;
this.projectResolver = projectResolver;
this.eventBus = eventBus;
}

public void checkFolderExistenceAndImport(final CompleteCallback callback, final ProjectConfigDto projectConfig) {
Expand Down Expand Up @@ -92,6 +97,7 @@ protected Promise<Void> importProject(@NotNull String pathToProject,
return importPromise.then(new Operation<Void>() {
@Override
public void apply(Void arg) throws OperationException {
eventBus.fireEvent(new CreateProjectEvent(projectConfig));
projectResolver.resolveProject(callback, projectConfig);

subscriber.onSuccess();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
package org.eclipse.che.ide.projectimport.wizard;

import com.google.gwt.event.shared.EventBus;
import com.google.web.bindery.event.shared.Event;

import org.eclipse.che.api.project.gwt.client.ProjectServiceClient;
import org.eclipse.che.api.promises.client.Operation;
Expand Down Expand Up @@ -103,6 +104,7 @@ public void setUp() {
localizationConstant,
subscriberFactory,
appContext,
eventBus,
resolver);
}

Expand Down Expand Up @@ -131,7 +133,8 @@ public void importShouldBeSuccessAndProjectStartsResolving() throws OperationExc
verify(importPromise, times(2)).then(voidOperationCaptor.capture());
voidOperationCaptor.getAllValues().get(0).apply(null);

verify(eventBus).fireEvent(Matchers.<Event>anyObject());
verify(resolver).resolveProject(completeCallback, projectConfig);
verify(subscriber).onSuccess();
}
}
}

0 comments on commit 9c6047f

Please sign in to comment.