Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display configured project in project explorer after importing project #352

Merged
merged 1 commit into from
Feb 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
}
}
}