Skip to content

Commit

Permalink
CHE-5592: refresh commands list in project's context menu in IDE (ecl…
Browse files Browse the repository at this point in the history
…ipse-che#5717)

* update context menu commands list after commands are added

Signed-off-by: Oleksii Kurinnyi <okurinny@redhat.com>

* fix project's type resolving

Signed-off-by: Oleksii Kurinnyi <okurinny@redhat.com>
  • Loading branch information
akurinnoy authored Jul 18, 2017
1 parent 32d3545 commit 8611c99
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,20 +109,26 @@ export class ProjectSourceSelectorService extends ProjectSourceSelectorServiceOb
case ProjectSource.GIT: {
const projectProps = this.importGitProjectService.getProjectProps();
const projectTemplate = this.buildProjectTemplate(projectProps);
delete projectTemplate.type;
delete projectTemplate.projectType;
this.addProjectTemplate(source, projectTemplate);
}
break;
case ProjectSource.GITHUB: {
const repositoriesProps = this.importGithubProjectService.getRepositoriesProps();
repositoriesProps.forEach((repositoryProps: che.IProjectTemplate) => {
const projectTemplate = this.buildProjectTemplate(repositoryProps);
delete projectTemplate.type;
delete projectTemplate.projectType;
this.addProjectTemplate(source, projectTemplate);
});
}
break;
case ProjectSource.ZIP: {
const projectProps = this.importZipProjectService.getProjectProps();
const projectTemplate = this.buildProjectTemplate(projectProps);
delete projectTemplate.type;
delete projectTemplate.projectType;
this.addProjectTemplate(source, projectTemplate);
}
break;
Expand All @@ -148,6 +154,10 @@ export class ProjectSourceSelectorService extends ProjectSourceSelectorServiceOb
projectTemplate.path = '/' + newName.replace(/[^\w-_]/g, '_');
}

if (!projectTemplate.type && projectTemplate.projectType) {
projectTemplate.type = projectTemplate.projectType;
}

this.projectTemplates.push(projectTemplate);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.eclipse.che.ide.api.command.CommandGoalRegistry;
import org.eclipse.che.ide.api.command.CommandImpl;
import org.eclipse.che.ide.api.command.CommandManager;
import org.eclipse.che.ide.api.command.CommandsLoadedEvent;
import org.eclipse.che.ide.api.command.CommandRemovedEvent;
import org.eclipse.che.ide.api.command.CommandUpdatedEvent;
import org.eclipse.che.ide.api.component.WsAgentComponent;
Expand Down Expand Up @@ -84,6 +85,10 @@ public void start(Callback<WsAgentComponent, Exception> callback) {

eventBus.addHandler(CommandAddedEvent.getType(), e -> addAction(e.getCommand()));
eventBus.addHandler(CommandRemovedEvent.getType(), e -> removeAction(e.getCommand()));
eventBus.addHandler(CommandsLoadedEvent.getType(), e -> {
commandManager.getCommands().forEach(this::removeAction);
commandManager.getCommands().forEach(this::addAction);
});
eventBus.addHandler(CommandUpdatedEvent.getType(), e -> {
removeAction(e.getInitialCommand());
addAction(e.getUpdatedCommand());
Expand Down

0 comments on commit 8611c99

Please sign in to comment.