diff --git a/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/command/CommandExecutor.java b/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/command/CommandExecutor.java
index c03c8f1cc2..348181cf63 100644
--- a/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/command/CommandExecutor.java
+++ b/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/command/CommandExecutor.java
@@ -11,7 +11,7 @@
package org.eclipse.che.ide.api.command;
import org.eclipse.che.api.core.model.workspace.config.Command;
-import org.eclipse.che.api.core.model.workspace.runtime.Machine;
+import org.eclipse.che.ide.api.machine.MachineEntity;
import org.eclipse.che.ide.api.macro.Macro;
/**
@@ -32,7 +32,7 @@ public interface CommandExecutor {
* machine to execute the command
* @see Macro
*/
- void executeCommand(Command command, Machine machine);
+ void executeCommand(Command command, MachineEntity machine);
/**
* Sends the the given {@code command} for execution.
diff --git a/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/command/CommandProducer.java b/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/command/CommandProducer.java
index a5fc3a2250..6ddf4b9c8a 100644
--- a/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/command/CommandProducer.java
+++ b/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/command/CommandProducer.java
@@ -10,16 +10,12 @@
*******************************************************************************/
package org.eclipse.che.ide.api.command;
-import org.eclipse.che.api.core.model.workspace.runtime.Machine;
-
-import java.util.Set;
+import org.eclipse.che.ide.api.machine.MachineEntity;
/**
* Defines the requirements for a component which can produce the commands from the current context.
*
For every registered {@link CommandProducer} an appropriate action
* will be added in context menus (e.g., explorer, editor tab).
- *
Implementor can restrict machine types where command may be executed with {@link #getMachineTypes()}.
- * In that case, sub menu will be created with separate sub actions which are correspond to each machine.
*
Implementations of this interface have to be registered with
* a GIN multibinder in order to be picked-up on application's start-up.
*
@@ -41,11 +37,5 @@ public interface CommandProducer {
* Target for command execution will be provided through {@code machine} parameter.
* Called when user performs corresponded action.
*/
- CommandImpl createCommand(Machine machine);
-
- /**
- * Returns machine types for restricting machines where command may be executed.
- * If returns empty set then ws-agent will be used for executing a command.
- */
- Set getMachineTypes();
+ CommandImpl createCommand(MachineEntity machine);
}
diff --git a/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/component/Component.java b/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/component/Component.java
deleted file mode 100644
index 4dbca01fda..0000000000
--- a/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/component/Component.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012-2017 Codenvy, S.A.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Codenvy, S.A. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.che.ide.api.component;
-
-import com.google.gwt.core.client.Callback;
-
-/**
- * Components that have to be started on application's startup
- * must implement this interface.
- * All components are registered via gin map binding.
- * For example, if you have YourComponent class, implementation of this interface, you must write in your GinModule this:
- *
- * GinMapBinder mapBinder =
- * GinMapBinder.newMapBinder(binder(), String.class, Component.class);
- * mapBinder.addBinding("your key").to(YourComponent.class);
- *
- *
- * @author Nikolay Zamosenchuk
- * @author Evgen Vidolob
- */
-public interface Component {
-
- /**
- * Starts Component.
- * Must do not throw any exceptions.
- * All exceptions must be passed in {@code Callback.onFailure(java.lang.Exception)}
- */
- void start(Callback callback);
-}
diff --git a/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/component/WsAgentComponent.java b/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/component/WsAgentComponent.java
deleted file mode 100644
index 713d4d024c..0000000000
--- a/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/component/WsAgentComponent.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012-2017 Codenvy, S.A.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Codenvy, S.A. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.che.ide.api.component;
-
-import com.google.gwt.core.client.Callback;
-
-/**
- * Defines the requirements for a component that have to be started after starting ws-agent.
- *
Component should be registered via GIN MapBinder:
- *
- * Note: Ws Agent Component start order will be calculated upon component key.
- * All keys will be sorted in alphabet order.
- *
- * @author Artem Zatsarynnyi
- */
-public interface WsAgentComponent {
-
- /**
- * Starts component. Must do not throw any exceptions.
- *
All exceptions must be passed in {@code Callback.onFailure(Exception)}
- */
- void start(Callback callback);
-}
diff --git a/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/machine/DevMachine.java b/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/machine/DevMachine.java
index 9868437647..0ecb924a6a 100644
--- a/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/machine/DevMachine.java
+++ b/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/machine/DevMachine.java
@@ -52,7 +52,7 @@ public class DevMachine extends MachineEntityImpl {
if (url.endsWith("/")) {
url = url.substring(0, url.length() - 1);
}
- // FIXME: spi
+
return url + "/api";
} else {
//should not be
diff --git a/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/machine/events/ProcessStartedEvent.java b/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/machine/events/ProcessStartedEvent.java
index be1b921997..7380e61f9f 100644
--- a/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/machine/events/ProcessStartedEvent.java
+++ b/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/machine/events/ProcessStartedEvent.java
@@ -13,16 +13,16 @@ package org.eclipse.che.ide.api.machine.events;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
-import org.eclipse.che.api.core.model.workspace.runtime.Machine;
+import org.eclipse.che.ide.api.machine.MachineEntity;
public class ProcessStartedEvent extends GwtEvent {
public static final Type TYPE = new Type<>();
- private final int processID;
- private final Machine machine;
+ private final int processID;
+ private final MachineEntity machine;
- public ProcessStartedEvent(int processID, Machine machine) {
+ public ProcessStartedEvent(int processID, MachineEntity machine) {
this.processID = processID;
this.machine = machine;
}
@@ -31,7 +31,7 @@ public class ProcessStartedEvent extends GwtEvent {
return processID;
}
- public Machine getMachine() {
+ public MachineEntity getMachine() {
return machine;
}
diff --git a/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/project/NewProjectConfigImpl.java b/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/project/NewProjectConfigImpl.java
index b341615930..4f545109b4 100644
--- a/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/project/NewProjectConfigImpl.java
+++ b/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/project/NewProjectConfigImpl.java
@@ -10,16 +10,18 @@
*******************************************************************************/
package org.eclipse.che.ide.api.project;
-import org.eclipse.che.api.project.shared.NewProjectConfig;
import org.eclipse.che.api.core.model.workspace.config.SourceStorage;
+import org.eclipse.che.api.project.shared.NewProjectConfig;
import org.eclipse.che.api.project.templates.shared.dto.ProjectTemplateDescriptor;
-import org.eclipse.che.api.project.shared.dto.NewProjectConfigDto;
+import org.eclipse.che.api.workspace.shared.dto.ProjectConfigDto;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import static java.util.Collections.emptyMap;
+
/**
* Implementation of {@link NewProjectConfig} for creating project
*
@@ -67,7 +69,7 @@ public class NewProjectConfigImpl implements NewProjectConfig {
}
/** Constructor for creating configuration from DTO object */
- public NewProjectConfigImpl(NewProjectConfigDto dto) {
+ public NewProjectConfigImpl(ProjectConfigDto dto) {
this(dto.getName(),
dto.getPath(),
dto.getDescription(),
@@ -75,7 +77,7 @@ public class NewProjectConfigImpl implements NewProjectConfig {
dto.getSource(),
dto.getMixins(),
dto.getAttributes(),
- dto.getOptions());
+ emptyMap());
}
public NewProjectConfigImpl(String name,
diff --git a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/actions/RunCommandAction.java b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/actions/RunCommandAction.java
index 467dfa3550..1a58963aa0 100644
--- a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/actions/RunCommandAction.java
+++ b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/actions/RunCommandAction.java
@@ -61,6 +61,6 @@ public class RunCommandAction extends Action {
commandManager.getCommand(name)
.ifPresent(command -> commandExecutor.executeCommand(command,
- appContext.getDevMachine().getDescriptor()));
+ appContext.getDevMachine()));
}
}
diff --git a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/CommandApiModule.java b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/CommandApiModule.java
index ae28c5e5b2..eb95e43bec 100644
--- a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/CommandApiModule.java
+++ b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/CommandApiModule.java
@@ -12,7 +12,6 @@ package org.eclipse.che.ide.command;
import com.google.gwt.inject.client.AbstractGinModule;
import com.google.gwt.inject.client.assistedinject.GinFactoryModuleBuilder;
-import com.google.gwt.inject.client.multibindings.GinMapBinder;
import com.google.gwt.inject.client.multibindings.GinMultibinder;
import com.google.inject.Provides;
import com.google.inject.Singleton;
@@ -25,7 +24,6 @@ import org.eclipse.che.ide.api.command.CommandGoalRegistry;
import org.eclipse.che.ide.api.command.CommandManager;
import org.eclipse.che.ide.api.command.CommandType;
import org.eclipse.che.ide.api.command.CommandTypeRegistry;
-import org.eclipse.che.ide.api.component.Component;
import org.eclipse.che.ide.api.filetypes.FileType;
import org.eclipse.che.ide.command.editor.CommandEditorView;
import org.eclipse.che.ide.command.editor.CommandEditorViewImpl;
@@ -100,9 +98,7 @@ public class CommandApiModule extends AbstractGinModule {
bind(CommandManager.class).asEagerSingleton();
bind(ExecuteCommandActionManager.class).asEagerSingleton();
- // start-up components
- GinMapBinder componentBinder = GinMapBinder.newMapBinder(binder(), String.class, Component.class);
- componentBinder.addBinding("CommandProducerActionManager").to(CommandProducerActionManager.class);
+ bind(CommandProducerActionManager.class).asEagerSingleton();
install(new GinFactoryModuleBuilder().build(ExecuteCommandActionFactory.class));
install(new GinFactoryModuleBuilder().build(GoalPopUpGroupFactory.class));
diff --git a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/execute/CommandExecutorImpl.java b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/execute/CommandExecutorImpl.java
index f98e4b3400..0b9351a8d3 100644
--- a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/execute/CommandExecutorImpl.java
+++ b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/execute/CommandExecutorImpl.java
@@ -13,18 +13,18 @@ package org.eclipse.che.ide.command.execute;
import com.google.inject.Inject;
import org.eclipse.che.api.core.model.workspace.config.Command;
-import org.eclipse.che.api.core.model.workspace.runtime.Machine;
import org.eclipse.che.commons.annotation.Nullable;
import org.eclipse.che.ide.api.command.CommandExecutor;
import org.eclipse.che.ide.api.command.CommandImpl;
import org.eclipse.che.ide.api.machine.ExecAgentCommandManager;
+import org.eclipse.che.ide.api.machine.MachineEntity;
import org.eclipse.che.ide.api.macro.MacroProcessor;
import org.eclipse.che.ide.api.selection.Selection;
import org.eclipse.che.ide.api.selection.SelectionAgent;
import org.eclipse.che.ide.console.CommandConsoleFactory;
import org.eclipse.che.ide.console.CommandOutputConsole;
-import org.eclipse.che.ide.processes.panel.ProcessesPanelPresenter;
import org.eclipse.che.ide.machine.chooser.MachineChooser;
+import org.eclipse.che.ide.processes.panel.ProcessesPanelPresenter;
import java.util.Map;
@@ -54,7 +54,7 @@ public class CommandExecutorImpl implements CommandExecutor {
}
@Override
- public void executeCommand(Command command, Machine machine) {
+ public void executeCommand(Command command, MachineEntity machine) {
final String name = command.getName();
final String type = command.getType();
final String commandLine = command.getCommandLine();
@@ -63,22 +63,21 @@ public class CommandExecutorImpl implements CommandExecutor {
macroProcessor.expandMacros(commandLine).then(expandedCommandLine -> {
final CommandImpl expandedCommand = new CommandImpl(name, expandedCommandLine, type, attributes);
final CommandOutputConsole console = commandConsoleFactory.create(expandedCommand, machine);
- // FIXME: spi
-// final String machineId = machine.getId();
-//
-// processesPanelPresenter.addCommandOutput(machineId, console);
-//
-// execAgentClient.startProcess(machineId, expandedCommand)
-// .thenIfProcessStartedEvent(console.getProcessStartedConsumer())
-// .thenIfProcessDiedEvent(console.getProcessDiedConsumer())
-// .thenIfProcessStdOutEvent(console.getStdOutConsumer())
-// .thenIfProcessStdErrEvent(console.getStdErrConsumer());
+ final String machineId = machine.getId();
+
+ processesPanelPresenter.addCommandOutput(machineId, console);
+
+ execAgentClient.startProcess(machineId, expandedCommand)
+ .thenIfProcessStartedEvent(console.getProcessStartedConsumer())
+ .thenIfProcessDiedEvent(console.getProcessDiedConsumer())
+ .thenIfProcessStdOutEvent(console.getStdOutConsumer())
+ .thenIfProcessStdErrEvent(console.getStdErrConsumer());
});
}
@Override
public void executeCommand(CommandImpl command) {
- final Machine selectedMachine = getSelectedMachine();
+ final MachineEntity selectedMachine = getSelectedMachine();
if (selectedMachine != null) {
executeCommand(command, selectedMachine);
@@ -91,14 +90,14 @@ public class CommandExecutorImpl implements CommandExecutor {
/** Returns the currently selected machine or {@code null} if none. */
@Nullable
- private Machine getSelectedMachine() {
+ private MachineEntity getSelectedMachine() {
final Selection> selection = selectionAgent.getSelection();
if (selection != null && !selection.isEmpty() && selection.isSingleSelection()) {
final Object possibleNode = selection.getHeadElement();
- if (possibleNode instanceof Machine) {
- return (Machine)possibleNode;
+ if (possibleNode instanceof MachineEntity) {
+ return (MachineEntity)possibleNode;
}
}
diff --git a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/producer/CommandProducerAction.java b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/producer/CommandProducerAction.java
index 2a5f7490b1..92cb3c3735 100644
--- a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/producer/CommandProducerAction.java
+++ b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/producer/CommandProducerAction.java
@@ -13,12 +13,12 @@ package org.eclipse.che.ide.command.producer;
import com.google.inject.Inject;
import com.google.inject.assistedinject.Assisted;
-import org.eclipse.che.api.core.model.workspace.runtime.Machine;
import org.eclipse.che.ide.api.action.Action;
import org.eclipse.che.ide.api.action.ActionEvent;
-import org.eclipse.che.ide.api.command.CommandImpl;
import org.eclipse.che.ide.api.command.CommandExecutor;
+import org.eclipse.che.ide.api.command.CommandImpl;
import org.eclipse.che.ide.api.command.CommandProducer;
+import org.eclipse.che.ide.api.machine.MachineEntity;
/**
* Action for executing command which produced by {@link CommandProducer}.
@@ -29,13 +29,13 @@ import org.eclipse.che.ide.api.command.CommandProducer;
public class CommandProducerAction extends Action {
private final CommandProducer commandProducer;
- private final Machine machine;
+ private final MachineEntity machine;
private final CommandExecutor commandExecutor;
@Inject
public CommandProducerAction(@Assisted String name,
@Assisted CommandProducer commandProducer,
- @Assisted Machine machine,
+ @Assisted MachineEntity machine,
CommandExecutor commandExecutor) {
super(name);
diff --git a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/producer/CommandProducerActionFactory.java b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/producer/CommandProducerActionFactory.java
index 1e7edaf13d..2471fb40fd 100644
--- a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/producer/CommandProducerActionFactory.java
+++ b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/producer/CommandProducerActionFactory.java
@@ -10,8 +10,8 @@
*******************************************************************************/
package org.eclipse.che.ide.command.producer;
-import org.eclipse.che.api.core.model.workspace.runtime.Machine;
import org.eclipse.che.ide.api.command.CommandProducer;
+import org.eclipse.che.ide.api.machine.MachineEntity;
/**
* Factory for creating {@link CommandProducerAction} instances.
@@ -21,5 +21,5 @@ import org.eclipse.che.ide.api.command.CommandProducer;
public interface CommandProducerActionFactory {
/** Creates action for executing command produced by the specified {@code commandProducer}. */
- CommandProducerAction create(String name, CommandProducer commandProducer, Machine machine);
+ CommandProducerAction create(String name, CommandProducer commandProducer, MachineEntity machine);
}
diff --git a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/producer/CommandProducerActionManager.java b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/producer/CommandProducerActionManager.java
index 832b806094..4617cb439f 100644
--- a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/producer/CommandProducerActionManager.java
+++ b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/producer/CommandProducerActionManager.java
@@ -10,12 +10,10 @@
*******************************************************************************/
package org.eclipse.che.ide.command.producer;
-import com.google.gwt.core.client.Callback;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.google.web.bindery.event.shared.EventBus;
-import org.eclipse.che.api.core.model.workspace.runtime.Machine;
import org.eclipse.che.ide.Resources;
import org.eclipse.che.ide.api.action.Action;
import org.eclipse.che.ide.api.action.ActionEvent;
@@ -23,18 +21,11 @@ import org.eclipse.che.ide.api.action.ActionManager;
import org.eclipse.che.ide.api.action.DefaultActionGroup;
import org.eclipse.che.ide.api.app.AppContext;
import org.eclipse.che.ide.api.command.CommandProducer;
-import org.eclipse.che.ide.api.component.Component;
import org.eclipse.che.ide.api.constraints.Constraints;
-import org.eclipse.che.ide.api.machine.ActiveRuntime;
-import org.eclipse.che.ide.api.machine.events.MachineStateEvent;
import org.eclipse.che.ide.api.machine.events.WsAgentStateEvent;
import org.eclipse.che.ide.api.machine.events.WsAgentStateHandler;
-import java.util.ArrayList;
-import java.util.HashMap;
import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
import java.util.Set;
import static org.eclipse.che.ide.api.action.IdeActions.GROUP_EDITOR_TAB_CONTEXT_MENU;
@@ -45,17 +36,11 @@ import static org.eclipse.che.ide.api.constraints.Anchor.AFTER;
/**
* Manages actions for the commands.
*
Manager gets all registered {@link CommandProducer}s and creates related actions in context menus.
- *
Manager listens all machines's state (running/destroyed) in order to
- * create/remove actions for the related {@link CommandProducer}s in case
- * they are applicable only for the certain machine types.
*
- * @author Artem Zatsarynnyi
* @see CommandProducer
*/
@Singleton
-public class CommandProducerActionManager implements MachineStateEvent.Handler,
- WsAgentStateHandler,
- Component {
+public class CommandProducerActionManager implements WsAgentStateHandler {
private final ActionManager actionManager;
private final CommandProducerActionFactory commandProducerActionFactory;
@@ -63,11 +48,7 @@ public class CommandProducerActionManager implements MachineStateEvent.Handler,
private final Resources resources;
private final ProducerMessages messages;
- private final List machines;
- private final Set commandProducers;
- private final Map actionsToActionGroups;
- private final Map> actionsByMachines;
- private final Map producersToActionGroups;
+ private final Set commandProducers;
private DefaultActionGroup commandActionsPopUpGroup;
@@ -84,13 +65,8 @@ public class CommandProducerActionManager implements MachineStateEvent.Handler,
this.resources = resources;
this.messages = messages;
- machines = new ArrayList<>();
commandProducers = new HashSet<>();
- actionsToActionGroups = new HashMap<>();
- actionsByMachines = new HashMap<>();
- producersToActionGroups = new HashMap<>();
- eventBus.addHandler(MachineStateEvent.TYPE, this);
eventBus.addHandler(WsAgentStateEvent.TYPE, this);
}
@@ -116,34 +92,6 @@ public class CommandProducerActionManager implements MachineStateEvent.Handler,
mainToolbarGroup.add(commandActionsToolbarGroup, new Constraints(AFTER, "changeResourceGroup"));
}
- @Override
- public void start(final Callback callback) {
- ActiveRuntime activeRuntime = appContext.getActiveRuntime();
- if (activeRuntime != null) {
- machines.addAll(activeRuntime.getMachines());
- }
-
- callback.onSuccess(this);
- }
-
- @Override
- public void onMachineCreating(MachineStateEvent event) {
- }
-
- @Override
- public void onMachineRunning(MachineStateEvent event) {
- machines.add(event.getMachine());
-
- createActionsForMachine(event.getMachine());
- }
-
- @Override
- public void onMachineDestroyed(MachineStateEvent event) {
- machines.remove(event.getMachine());
-
- removeActionsForMachine(event.getMachine());
- }
-
@Override
public void onWsAgentStarted(WsAgentStateEvent event) {
for (CommandProducer commandProducer : commandProducers) {
@@ -157,69 +105,11 @@ public class CommandProducerActionManager implements MachineStateEvent.Handler,
/** Creates actions for the given {@link CommandProducer}. */
private void createActionsForProducer(CommandProducer producer) {
- // FIXME: spi
-// Action action;
+ Action action = commandProducerActionFactory.create(producer.getName(), producer, appContext.getDevMachine());
-// if (producer.getMachineTypes().isEmpty()) {
-// action = commandProducerActionFactory.create(producer.getName(), producer, appContext.getDevMachine().getDescriptor());
-//
-// actionManager.registerAction(producer.getName(), action);
-// } else {
-// action = new DefaultActionGroup(producer.getName(), true, actionManager);
-//
-// producersToActionGroups.put(producer, (DefaultActionGroup)action);
-//
-// actionManager.registerAction(producer.getName(), action);
-//
-// for (Machine machine : machines) {
-// createActionsForMachine(machine);
-// }
-// }
+ actionManager.registerAction(producer.getName(), action);
-// commandActionsPopUpGroup.add(action);
- }
-
- /**
- * Creates actions for that {@link CommandProducer}s
- * which are applicable for the given machine's type.
- */
- private void createActionsForMachine(Machine machine) {
- // FIXME: spi
-// for (CommandProducer commandProducer : commandProducers) {
-// if (commandProducer.getMachineTypes().contains(machine.getConfig().getType())) {
-// CommandProducerAction machineAction = commandProducerActionFactory.create(machine.getConfig().getName(),
-// commandProducer,
-// machine);
-// final List actionList = actionsByMachines.computeIfAbsent(machine, key -> new ArrayList<>());
-// actionList.add(machineAction);
-//
-// actionManager.registerAction(machine.getConfig().getName(), machineAction);
-//
-// DefaultActionGroup actionGroup = producersToActionGroups.get(commandProducer);
-// if (actionGroup != null) {
-// actionGroup.add(machineAction);
-//
-// actionsToActionGroups.put(machineAction, actionGroup);
-// }
-// }
-// }
- }
-
- private void removeActionsForMachine(Machine machine) {
- List actions = actionsByMachines.remove(machine);
- if (actions != null) {
- for (Action action : actions) {
- DefaultActionGroup actionGroup = actionsToActionGroups.remove(action);
- if (actionGroup != null) {
- actionGroup.remove(action);
-
- String id = actionManager.getId(action);
- if (id != null) {
- actionManager.unregisterAction(id);
- }
- }
- }
- }
+ commandActionsPopUpGroup.add(action);
}
/**
diff --git a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/toolbar/commands/ExecuteCommandPresenter.java b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/toolbar/commands/ExecuteCommandPresenter.java
index 7877e0a72a..9165c55008 100644
--- a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/toolbar/commands/ExecuteCommandPresenter.java
+++ b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/toolbar/commands/ExecuteCommandPresenter.java
@@ -16,7 +16,6 @@ import com.google.inject.Provider;
import com.google.inject.Singleton;
import com.google.web.bindery.event.shared.EventBus;
-import org.eclipse.che.api.core.model.workspace.runtime.Machine;
import org.eclipse.che.ide.api.command.CommandAddedEvent;
import org.eclipse.che.ide.api.command.CommandExecutor;
import org.eclipse.che.ide.api.command.CommandGoal;
@@ -25,6 +24,7 @@ import org.eclipse.che.ide.api.command.CommandManager;
import org.eclipse.che.ide.api.command.CommandRemovedEvent;
import org.eclipse.che.ide.api.command.CommandUpdatedEvent;
import org.eclipse.che.ide.api.command.CommandsLoadedEvent;
+import org.eclipse.che.ide.api.machine.MachineEntity;
import org.eclipse.che.ide.api.mvp.Presenter;
import org.eclipse.che.ide.command.goal.DebugGoal;
import org.eclipse.che.ide.command.goal.RunGoal;
@@ -84,7 +84,7 @@ public class ExecuteCommandPresenter implements Presenter, ExecuteCommandView.Ac
}
@Override
- public void onCommandExecute(CommandImpl command, Machine machine) {
+ public void onCommandExecute(CommandImpl command, MachineEntity machine) {
commandExecutorProvider.get().executeCommand(command, machine);
}
diff --git a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/toolbar/commands/ExecuteCommandView.java b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/toolbar/commands/ExecuteCommandView.java
index e9cc38bfbf..c235d318fd 100644
--- a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/toolbar/commands/ExecuteCommandView.java
+++ b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/toolbar/commands/ExecuteCommandView.java
@@ -10,9 +10,9 @@
*******************************************************************************/
package org.eclipse.che.ide.command.toolbar.commands;
-import org.eclipse.che.api.core.model.workspace.runtime.Machine;
import org.eclipse.che.ide.api.command.CommandGoal;
import org.eclipse.che.ide.api.command.CommandImpl;
+import org.eclipse.che.ide.api.machine.MachineEntity;
import org.eclipse.che.ide.api.mvp.View;
import java.util.Set;
@@ -35,7 +35,7 @@ public interface ExecuteCommandView extends View entry : devMachine.getServers().entrySet()) {
Server server = entry.getValue();
diff --git a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/toolbar/previews/PreviewsPresenter.java b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/toolbar/previews/PreviewsPresenter.java
index 43c7e56d9f..a34bfda4da 100644
--- a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/toolbar/previews/PreviewsPresenter.java
+++ b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/toolbar/previews/PreviewsPresenter.java
@@ -17,7 +17,6 @@ import com.google.inject.Provider;
import com.google.inject.Singleton;
import com.google.web.bindery.event.shared.EventBus;
-import org.eclipse.che.api.core.model.workspace.runtime.Machine;
import org.eclipse.che.api.machine.shared.dto.execagent.GetProcessesResponseDto;
import org.eclipse.che.api.promises.client.Promise;
import org.eclipse.che.api.promises.client.PromiseProvider;
@@ -26,6 +25,7 @@ import org.eclipse.che.ide.api.command.CommandImpl;
import org.eclipse.che.ide.api.command.CommandManager;
import org.eclipse.che.ide.api.machine.ActiveRuntime;
import org.eclipse.che.ide.api.machine.ExecAgentCommandManager;
+import org.eclipse.che.ide.api.machine.MachineEntity;
import org.eclipse.che.ide.api.machine.events.ProcessFinishedEvent;
import org.eclipse.che.ide.api.machine.events.ProcessStartedEvent;
import org.eclipse.che.ide.api.machine.events.WsAgentStateEvent;
@@ -91,15 +91,14 @@ public class PreviewsPresenter implements Presenter, PreviewsView.ActionDelegate
return;
}
- // FIXME: spi
-// runtime.getMachines()
-// .stream()
-// .map(Machine::getId)
-// .map(id -> execAgentClient.getProcesses(id, false))
-// .forEach(promise -> promise.onSuccess(processes -> processes.stream()
-// .map(GetProcessesResponseDto::getName)
-// .map(this::getPreviewUrlByName)
-// .forEach(it -> it.then(view::addUrl))));
+ runtime.getMachines()
+ .stream()
+ .map(MachineEntity::getId)
+ .map(id -> execAgentClient.getProcesses(id, false))
+ .forEach(promise -> promise.onSuccess(processes -> processes.stream()
+ .map(GetProcessesResponseDto::getName)
+ .map(this::getPreviewUrlByName)
+ .forEach(it -> it.then(view::addUrl))));
}
/**
diff --git a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/toolbar/processes/Process.java b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/toolbar/processes/Process.java
index bf4dda2a43..6735ba3cd7 100644
--- a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/toolbar/processes/Process.java
+++ b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/toolbar/processes/Process.java
@@ -10,7 +10,7 @@
*******************************************************************************/
package org.eclipse.che.ide.command.toolbar.processes;
-import org.eclipse.che.api.core.model.workspace.runtime.Machine;
+import org.eclipse.che.ide.api.machine.MachineEntity;
/** Model of the process. */
public interface Process {
@@ -23,5 +23,5 @@ public interface Process {
boolean isAlive();
- Machine getMachine();
+ MachineEntity getMachine();
}
diff --git a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/toolbar/processes/ProcessImpl.java b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/toolbar/processes/ProcessImpl.java
index 5014c03efe..18d25adc68 100644
--- a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/toolbar/processes/ProcessImpl.java
+++ b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/toolbar/processes/ProcessImpl.java
@@ -10,20 +10,20 @@
*******************************************************************************/
package org.eclipse.che.ide.command.toolbar.processes;
-import org.eclipse.che.api.core.model.workspace.runtime.Machine;
+import org.eclipse.che.ide.api.machine.MachineEntity;
import java.util.Objects;
/** Data object for {@link Process}. */
public class ProcessImpl implements Process {
- private final String commandName;
- private final String commandLine;
- private final int pid;
- private final boolean alive;
- private final Machine machine;
+ private final String commandName;
+ private final String commandLine;
+ private final int pid;
+ private final boolean alive;
+ private final MachineEntity machine;
- public ProcessImpl(String commandName, String commandLine, int pid, boolean alive, Machine machine) {
+ public ProcessImpl(String commandName, String commandLine, int pid, boolean alive, MachineEntity machine) {
this.commandName = commandName;
this.commandLine = commandLine;
this.pid = pid;
@@ -52,7 +52,7 @@ public class ProcessImpl implements Process {
}
@Override
- public Machine getMachine() {
+ public MachineEntity getMachine() {
return machine;
}
diff --git a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/toolbar/processes/ProcessWidget.java b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/toolbar/processes/ProcessWidget.java
index 7adf62fb9f..465022d167 100644
--- a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/toolbar/processes/ProcessWidget.java
+++ b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/toolbar/processes/ProcessWidget.java
@@ -85,8 +85,7 @@ class ProcessWidget extends FlowPanel {
}
private Label createMachineNameLabel(Process process) {
- // FIXME: spi
- final Label label = new InlineHTML(/*process.getMachine().getConfig().getName() + */": ");
+ final Label label = new InlineHTML(process.getMachine().getName() + ": ");
label.addStyleName(RESOURCES.commandToolbarCss().processWidgetText());
label.addStyleName(RESOURCES.commandToolbarCss().processWidgetMachineNameLabel());
diff --git a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/toolbar/processes/ProcessesListPresenter.java b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/toolbar/processes/ProcessesListPresenter.java
index c766572510..607d230450 100644
--- a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/toolbar/processes/ProcessesListPresenter.java
+++ b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/command/toolbar/processes/ProcessesListPresenter.java
@@ -14,7 +14,6 @@ import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.google.inject.Provider;
import com.google.web.bindery.event.shared.EventBus;
-import org.eclipse.che.api.core.model.workspace.runtime.Machine;
import org.eclipse.che.api.machine.shared.dto.execagent.GetProcessesResponseDto;
import org.eclipse.che.ide.api.app.AppContext;
import org.eclipse.che.ide.api.command.CommandExecutor;
@@ -135,9 +134,8 @@ public class ProcessesListPresenter implements Presenter, ProcessesListView.Acti
* @param machine
* machine where process were run or currently running
*/
- private void addProcessToList(int pid, Machine machine) {
- // FIXME: spi
- execAgentClient.getProcess(""/*machine.getId()*/, pid).onSuccess(processDto -> {
+ private void addProcessToList(int pid, MachineEntity machine) {
+ execAgentClient.getProcess(machine.getId(), pid).onSuccess(processDto -> {
final Process process = new ProcessImpl(processDto.getName(),
processDto.getCommandLine(),
processDto.getPid(),
@@ -167,8 +165,7 @@ public class ProcessesListPresenter implements Presenter, ProcessesListView.Acti
@Override
public void onStopProcess(Process process) {
- // FIXME: spi
- execAgentClient.killProcess(""/*process.getMachine().getId()*/, process.getPid());
+ execAgentClient.killProcess(process.getMachine().getId(), process.getPid());
}
@Override
diff --git a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/console/CommandConsoleFactory.java b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/console/CommandConsoleFactory.java
index 81a53a67d1..180c113d6a 100644
--- a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/console/CommandConsoleFactory.java
+++ b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/console/CommandConsoleFactory.java
@@ -12,16 +12,16 @@ package org.eclipse.che.ide.console;
import com.google.inject.name.Named;
-import org.eclipse.che.api.core.model.workspace.runtime.Machine;
-import org.eclipse.che.ide.api.outputconsole.OutputConsole;
import org.eclipse.che.ide.api.command.CommandImpl;
+import org.eclipse.che.ide.api.machine.MachineEntity;
+import org.eclipse.che.ide.api.outputconsole.OutputConsole;
/** @author Artem Zatsarynnyi */
public interface CommandConsoleFactory {
/** Create the instance of {@link CommandOutputConsole} for the given {@code command}. */
@Named("command")
- CommandOutputConsole create(CommandImpl command, Machine machine);
+ CommandOutputConsole create(CommandImpl command, MachineEntity machine);
/** Create the instance of {@link DefaultOutputConsole} for the given title. */
@Named("default")
diff --git a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/console/CommandOutputConsolePresenter.java b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/console/CommandOutputConsolePresenter.java
index a16a2dc34f..2ede6f83ee 100644
--- a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/console/CommandOutputConsolePresenter.java
+++ b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/console/CommandOutputConsolePresenter.java
@@ -15,7 +15,6 @@ import com.google.inject.Inject;
import com.google.inject.assistedinject.Assisted;
import com.google.web.bindery.event.shared.EventBus;
-import org.eclipse.che.api.core.model.workspace.runtime.Machine;
import org.eclipse.che.api.machine.shared.dto.MachineProcessDto;
import org.eclipse.che.api.machine.shared.dto.execagent.ProcessSubscribeResponseDto;
import org.eclipse.che.api.machine.shared.dto.execagent.event.ProcessDiedEventDto;
@@ -28,6 +27,7 @@ import org.eclipse.che.commons.annotation.Nullable;
import org.eclipse.che.ide.api.command.CommandExecutor;
import org.eclipse.che.ide.api.command.CommandImpl;
import org.eclipse.che.ide.api.machine.ExecAgentCommandManager;
+import org.eclipse.che.ide.api.machine.MachineEntity;
import org.eclipse.che.ide.api.machine.events.ProcessFinishedEvent;
import org.eclipse.che.ide.api.machine.events.ProcessStartedEvent;
import org.eclipse.che.ide.api.macro.MacroProcessor;
@@ -52,7 +52,7 @@ public class CommandOutputConsolePresenter implements CommandOutputConsole, Outp
private final MachineResources resources;
private final CommandImpl command;
private final EventBus eventBus;
- private final Machine machine;
+ private final MachineEntity machine;
private final CommandExecutor commandExecutor;
private final ExecAgentCommandManager execAgentCommandManager;
@@ -75,7 +75,7 @@ public class CommandOutputConsolePresenter implements CommandOutputConsole, Outp
EventBus eventBus,
ExecAgentCommandManager execAgentCommandManager,
@Assisted CommandImpl command,
- @Assisted Machine machine) {
+ @Assisted MachineEntity machine) {
this.view = view;
this.resources = resources;
this.execAgentCommandManager = execAgentCommandManager;
@@ -204,8 +204,7 @@ public class CommandOutputConsolePresenter implements CommandOutputConsole, Outp
@Override
public void stop() {
- // FIXME: spi
- execAgentCommandManager.killProcess(""/*machine.getId()*/, pid);
+ execAgentCommandManager.killProcess(machine.getId(), pid);
}
@Override
@@ -223,8 +222,7 @@ public class CommandOutputConsolePresenter implements CommandOutputConsole, Outp
if (isFinished()) {
commandExecutor.executeCommand(command, machine);
} else {
- // FIXME: spi
- execAgentCommandManager.killProcess(""/*machine.getId()*/, pid)
+ execAgentCommandManager.killProcess(machine.getId(), pid)
.onSuccess(() -> commandExecutor.executeCommand(command, machine));
}
}
diff --git a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/core/StandardComponentInitializer.java b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/core/StandardComponentInitializer.java
index a7032d7880..ff48a5da79 100644
--- a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/core/StandardComponentInitializer.java
+++ b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/core/StandardComponentInitializer.java
@@ -79,9 +79,7 @@ import org.eclipse.che.ide.imageviewer.ImageViewerProvider;
import org.eclipse.che.ide.imageviewer.PreviewImageAction;
import org.eclipse.che.ide.machine.MachineResources;
import org.eclipse.che.ide.macro.ServerHostNameMacro;
-import org.eclipse.che.ide.macro.ServerMacro;
import org.eclipse.che.ide.macro.ServerPortMacro;
-import org.eclipse.che.ide.macro.ServerProtocolMacro;
import org.eclipse.che.ide.newresource.NewFileAction;
import org.eclipse.che.ide.newresource.NewFolderAction;
import org.eclipse.che.ide.part.editor.actions.CloseAction;
@@ -477,13 +475,6 @@ public class StandardComponentInitializer {
@Inject
private TreeResourceRevealer treeResourceRevealer; //just to work with it
- // do not remove the injections below
- @Inject
- private ServerMacro serverMacro;
-
- @Inject
- private ServerProtocolMacro serverProtocolMacro;
-
@Inject
private ServerHostNameMacro serverHostNameMacro;
diff --git a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/machine/MachineItem.java b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/machine/MachineItem.java
deleted file mode 100644
index ead47d90f1..0000000000
--- a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/machine/MachineItem.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012-2017 Codenvy, S.A.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Codenvy, S.A. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.che.ide.machine;
-
-import com.google.inject.Inject;
-import com.google.inject.assistedinject.Assisted;
-
-import org.eclipse.che.api.machine.shared.dto.MachineDto;
-import org.eclipse.che.ide.api.machine.MachineEntityImpl;
-
-/**
- * The class which describes machine entity.
- *
- * @author Dmitry Shnurenko
- * @author Roman Nikitenko
- */
-public class MachineItem extends MachineEntityImpl {
-
- @Inject
- public MachineItem(@Assisted MachineDto descriptor) {
- // FIXME: spi
- super("", descriptor);
- }
-
-}
diff --git a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/machine/chooser/MachineChooser.java b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/machine/chooser/MachineChooser.java
index 2b3d1baee0..80e048f298 100644
--- a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/machine/chooser/MachineChooser.java
+++ b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/machine/chooser/MachineChooser.java
@@ -12,7 +12,6 @@ package org.eclipse.che.ide.machine.chooser;
import com.google.inject.Inject;
-import org.eclipse.che.api.core.model.workspace.Runtime;
import org.eclipse.che.api.core.model.workspace.runtime.Machine;
import org.eclipse.che.api.promises.client.Promise;
import org.eclipse.che.api.promises.client.PromiseProvider;
@@ -22,9 +21,10 @@ import org.eclipse.che.api.promises.client.js.JsPromiseError;
import org.eclipse.che.api.promises.client.js.RejectFunction;
import org.eclipse.che.api.promises.client.js.ResolveFunction;
import org.eclipse.che.ide.api.app.AppContext;
+import org.eclipse.che.ide.api.machine.ActiveRuntime;
+import org.eclipse.che.ide.api.machine.MachineEntity;
import java.util.List;
-import java.util.Map;
/**
* Provides a simple mechanism for the user to choose a {@link Machine}.
@@ -37,8 +37,8 @@ public class MachineChooser implements MachineChooserView.ActionDelegate {
private final AppContext appContext;
private final PromiseProvider promiseProvider;
- private ResolveFunction resolveFunction;
- private RejectFunction rejectFunction;
+ private ResolveFunction resolveFunction;
+ private RejectFunction rejectFunction;
@Inject
public MachineChooser(MachineChooserView view,
@@ -56,33 +56,32 @@ public class MachineChooser implements MachineChooserView.ActionDelegate {
*
Note: if there is only one machine running in the workspace
* then returned promise will be resolved with that machine without asking user.
*
- * @return promise that will be resolved with a chosen {@link Machine}
+ * @return promise that will be resolved with a chosen {@link MachineEntity}
* or rejected in case machine selection has been cancelled.
*/
- public Promise show() {
- final Runtime runtime = appContext.getWorkspace().getRuntime();
+ public Promise show() {
+ final ActiveRuntime runtime = appContext.getActiveRuntime();
if (runtime != null) {
- final Map machines = runtime.getMachines();
+ final List machines = runtime.getMachines();
if (machines.size() == 1) {
return promiseProvider.resolve(machines.get(0));
}
-// FIXME: spi
-// view.setMachines(machines);
+ view.setMachines(machines);
}
view.show();
- return promiseProvider.create(Executor.create((ExecutorBody)(resolve, reject) -> {
+ return promiseProvider.create(Executor.create((ExecutorBody)(resolve, reject) -> {
resolveFunction = resolve;
rejectFunction = reject;
}));
}
@Override
- public void onMachineSelected(Machine machine) {
+ public void onMachineSelected(MachineEntity machine) {
view.close();
resolveFunction.apply(machine);
diff --git a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/machine/chooser/MachineChooserView.java b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/machine/chooser/MachineChooserView.java
index bba3c36372..88008aae26 100644
--- a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/machine/chooser/MachineChooserView.java
+++ b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/machine/chooser/MachineChooserView.java
@@ -10,12 +10,11 @@
*******************************************************************************/
package org.eclipse.che.ide.machine.chooser;
-import org.eclipse.che.api.core.model.workspace.runtime.Machine;
+import org.eclipse.che.ide.api.machine.MachineEntity;
import org.eclipse.che.ide.api.mvp.View;
import java.util.List;
-
/**
* Contract for the view of the machine chooser.
*
@@ -30,13 +29,13 @@ public interface MachineChooserView extends View machines);
+ void setMachines(List machines);
/** The action delegate for this view. */
interface ActionDelegate {
/** Called when machine is selected. */
- void onMachineSelected(Machine machine);
+ void onMachineSelected(MachineEntity machine);
/** Called when machine selection has been canceled. Note that view will be already closed. */
void onCanceled();
diff --git a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/machine/chooser/MachineChooserViewImpl.java b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/machine/chooser/MachineChooserViewImpl.java
index 1c9f478076..4321fa4313 100644
--- a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/machine/chooser/MachineChooserViewImpl.java
+++ b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/machine/chooser/MachineChooserViewImpl.java
@@ -19,7 +19,7 @@ import com.google.gwt.user.client.ui.ListBox;
import com.google.gwt.user.client.ui.PopupPanel;
import com.google.inject.Inject;
-import org.eclipse.che.api.core.model.workspace.runtime.Machine;
+import org.eclipse.che.ide.api.machine.MachineEntity;
import java.util.HashMap;
import java.util.List;
@@ -36,7 +36,7 @@ public class MachineChooserViewImpl extends PopupPanel implements MachineChooser
private static final MachineChooserViewImplUiBinder UI_BINDER = GWT.create(MachineChooserViewImplUiBinder.class);
/** Map that contains all shown machines. */
- private final Map machinesById;
+ private final Map machinesById;
@UiField
ListBox machinesList;
@@ -70,7 +70,7 @@ public class MachineChooserViewImpl extends PopupPanel implements MachineChooser
final String selectedMachineId = machinesList.getSelectedValue();
if (selectedMachineId != null) {
- final Machine selectedMachine = machinesById.get(selectedMachineId);
+ final MachineEntity selectedMachine = machinesById.get(selectedMachineId);
if (selectedMachine != null) {
delegate.onMachineSelected(selectedMachine);
@@ -85,7 +85,7 @@ public class MachineChooserViewImpl extends PopupPanel implements MachineChooser
final String selectedMachineId = machinesList.getSelectedValue();
if (selectedMachineId != null) {
- final Machine selectedMachine = machinesById.get(selectedMachineId);
+ final MachineEntity selectedMachine = machinesById.get(selectedMachineId);
if (selectedMachine != null) {
delegate.onMachineSelected(selectedMachine);
@@ -120,14 +120,13 @@ public class MachineChooserViewImpl extends PopupPanel implements MachineChooser
}
@Override
- public void setMachines(List extends Machine> machines) {
+ public void setMachines(List machines) {
machinesList.clear();
machinesById.clear();
machines.forEach(machine -> {
-// FIXME: spi
-// machinesById.put(machine.getId(), machine);
-// machinesList.addItem(machine.getConfig().getName(), machine.getId());
+ machinesById.put(machine.getId(), machine);
+ machinesList.addItem(machine.getName(), machine.getId());
});
machinesList.setVisibleItemCount(machines.size());
diff --git a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/macro/AbstractServerMacro.java b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/macro/AbstractServerMacro.java
index 858e9fac45..dc60acaf91 100644
--- a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/macro/AbstractServerMacro.java
+++ b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/macro/AbstractServerMacro.java
@@ -14,11 +14,11 @@ import com.google.common.annotations.Beta;
import com.google.web.bindery.event.shared.EventBus;
import org.eclipse.che.ide.api.app.AppContext;
-import org.eclipse.che.ide.api.macro.Macro;
-import org.eclipse.che.ide.api.macro.MacroRegistry;
import org.eclipse.che.ide.api.machine.DevMachine;
import org.eclipse.che.ide.api.machine.events.WsAgentStateEvent;
import org.eclipse.che.ide.api.machine.events.WsAgentStateHandler;
+import org.eclipse.che.ide.api.macro.Macro;
+import org.eclipse.che.ide.api.macro.MacroRegistry;
import java.util.Set;
@@ -32,9 +32,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
* @see MacroRegistry
* @see Macro
* @see ServerHostNameMacro
- * @see ServerMacro
* @see ServerPortMacro
- * @see ServerProtocolMacro
* @since 4.7.0
*/
@Beta
diff --git a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/macro/ServerHostNameMacro.java b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/macro/ServerHostNameMacro.java
index 381182cfec..f4bf127964 100644
--- a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/macro/ServerHostNameMacro.java
+++ b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/macro/ServerHostNameMacro.java
@@ -11,16 +11,20 @@
package org.eclipse.che.ide.macro;
import com.google.common.annotations.Beta;
+import com.google.common.base.Strings;
import com.google.common.collect.Sets;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.google.web.bindery.event.shared.EventBus;
+import org.eclipse.che.api.core.model.workspace.runtime.Server;
import org.eclipse.che.ide.api.app.AppContext;
import org.eclipse.che.ide.api.machine.DevMachine;
+import org.eclipse.che.ide.api.macro.BaseMacro;
import org.eclipse.che.ide.api.macro.Macro;
import org.eclipse.che.ide.api.macro.MacroRegistry;
+import java.util.Map;
import java.util.Set;
/**
@@ -51,30 +55,29 @@ public class ServerHostNameMacro extends AbstractServerMacro {
public Set getMacros(DevMachine devMachine) {
final Set macros = Sets.newHashSet();
- // FIXME: spi
-// for (Map.Entry entry : devMachine.getDescriptor().getServers().entrySet()) {
-//
-// if (Strings.isNullOrEmpty(entry.getValue().getRef())) {
-// continue;
-// }
-//
-// Macro macro = new BaseMacro(KEY.replace("%", entry.getKey()),
-// entry.getValue().getRef(),
-// "Returns hostname of a server registered by name");
-//
-// macros.add(macro);
-//
-// // register port without "/tcp" suffix
-// if (entry.getKey().endsWith("/tcp")) {
-// final String port = entry.getKey().substring(0, entry.getKey().length() - 4);
-//
-// Macro shortMacro = new BaseMacro(KEY.replace("%", port),
-// entry.getValue().getRef(),
-// "Returns hostname of a server registered by name");
-//
-// macros.add(shortMacro);
-// }
-// }
+ for (Map.Entry entry : devMachine.getDescriptor().getServers().entrySet()) {
+
+ if (Strings.isNullOrEmpty(entry.getValue().getUrl())) {
+ continue;
+ }
+
+ Macro macro = new BaseMacro(KEY.replace("%", entry.getKey()),
+ entry.getValue().getUrl(),
+ "Returns hostname of a server registered by name");
+
+ macros.add(macro);
+
+ // register port without "/tcp" suffix
+ if (entry.getKey().endsWith("/tcp")) {
+ final String port = entry.getKey().substring(0, entry.getKey().length() - 4);
+
+ Macro shortMacro = new BaseMacro(KEY.replace("%", port),
+ entry.getValue().getUrl(),
+ "Returns hostname of a server registered by name");
+
+ macros.add(shortMacro);
+ }
+ }
return macros;
}
diff --git a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/macro/ServerMacro.java b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/macro/ServerMacro.java
deleted file mode 100644
index 344ba6b6ab..0000000000
--- a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/macro/ServerMacro.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012-2017 Codenvy, S.A.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Codenvy, S.A. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.che.ide.macro;
-
-import com.google.common.annotations.Beta;
-import com.google.common.collect.Sets;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-import com.google.web.bindery.event.shared.EventBus;
-
-import org.eclipse.che.ide.api.app.AppContext;
-import org.eclipse.che.ide.api.machine.DevMachine;
-import org.eclipse.che.ide.api.macro.Macro;
-import org.eclipse.che.ide.api.macro.MacroRegistry;
-
-import java.util.Set;
-
-/**
- * Macro which is responsible for the retrieving the address of the registered server.
- *
- * Macro provided: ${server.[port]}
- *
- * @author Vlad Zhukovskyi
- * @see AbstractServerMacro
- * @see DevMachine
- * @since 4.7.0
- */
-@Beta
-@Singleton
-public class ServerMacro extends AbstractServerMacro {
-
- public static final String KEY = "${server.%}";
-
- @Inject
- public ServerMacro(MacroRegistry macroRegistry,
- EventBus eventBus,
- AppContext appContext) {
- super(macroRegistry, eventBus, appContext);
- }
-
- /** {@inheritDoc} */
- @Override
- public Set getMacros(DevMachine devMachine) {
- final Set macros = Sets.newHashSet();
-
- // FIXME: spi
-// for (Map.Entry entry : devMachine.getDescriptor().getRuntime().getServers().entrySet()) {
-//
-// final String prefix = isNullOrEmpty(entry.getValue().getProtocol()) ? "" : entry.getValue().getProtocol() + "://";
-// final String value = prefix + entry.getValue().getAddress() + (isNullOrEmpty(prefix) ? "" : "/");
-//
-// Macro macro = new BaseMacro(KEY.replace("%", entry.getKey()),
-// value,
-// "Returns protocol, hostname and port of an internal server");
-//
-// macros.add(macro);
-//
-// // register port without "/tcp" suffix
-// if (entry.getKey().endsWith("/tcp")) {
-// final String port = entry.getKey().substring(0, entry.getKey().length() - 4);
-//
-// Macro shortMacro = new BaseMacro(KEY.replace("%", port),
-// value,
-// "Returns protocol, hostname and port of an internal server");
-//
-// macros.add(shortMacro);
-// }
-// }
-
- return macros;
- }
-}
diff --git a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/macro/ServerPortMacro.java b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/macro/ServerPortMacro.java
index 6e6535197e..5252c1cf70 100644
--- a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/macro/ServerPortMacro.java
+++ b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/macro/ServerPortMacro.java
@@ -18,10 +18,10 @@ import com.google.web.bindery.event.shared.EventBus;
import org.eclipse.che.api.core.model.workspace.runtime.Server;
import org.eclipse.che.ide.api.app.AppContext;
+import org.eclipse.che.ide.api.machine.DevMachine;
import org.eclipse.che.ide.api.macro.BaseMacro;
import org.eclipse.che.ide.api.macro.Macro;
import org.eclipse.che.ide.api.macro.MacroRegistry;
-import org.eclipse.che.ide.api.machine.DevMachine;
import java.util.Map;
import java.util.Set;
@@ -56,12 +56,11 @@ public class ServerPortMacro extends AbstractServerMacro {
for (Map.Entry entry : devMachine.getDescriptor().getServers().entrySet()) {
- // FIXME: spi
-// if (!entry.getValue().getAddress().contains(":")) {
-// continue;
-// }
+ if (!entry.getValue().getUrl().contains(":")) {
+ continue;
+ }
- final String externalPort = ""/*entry.getValue().getAddress().split(":")[1]*/;
+ final String externalPort = entry.getValue().getUrl().split(":")[1];
Macro macro = new BaseMacro(KEY.replace("%", entry.getKey()),
externalPort,
diff --git a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/macro/ServerProtocolMacro.java b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/macro/ServerProtocolMacro.java
deleted file mode 100644
index 6143827a2a..0000000000
--- a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/macro/ServerProtocolMacro.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012-2017 Codenvy, S.A.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Codenvy, S.A. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.che.ide.macro;
-
-import com.google.common.annotations.Beta;
-import com.google.common.collect.Sets;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-import com.google.web.bindery.event.shared.EventBus;
-
-import org.eclipse.che.ide.api.app.AppContext;
-import org.eclipse.che.ide.api.machine.DevMachine;
-import org.eclipse.che.ide.api.macro.Macro;
-import org.eclipse.che.ide.api.macro.MacroRegistry;
-
-import java.util.Set;
-
-/**
- * Macro which is responsible for the retrieving the protocol of the registered server.
- *
- * Macro provided: ${server.[port].protocol}
- *
- * @author Vlad Zhukovskyi
- * @see AbstractServerMacro
- * @see DevMachine
- * @since 4.7.0
- */
-@Beta
-@Singleton
-public class ServerProtocolMacro extends AbstractServerMacro {
-
- public static final String KEY = "${server.%.protocol}";
-
- @Inject
- public ServerProtocolMacro(MacroRegistry macroRegistry,
- EventBus eventBus,
- AppContext appContext) {
- super(macroRegistry, eventBus, appContext);
- }
-
- /** {@inheritDoc} */
- @Override
- public Set getMacros(DevMachine devMachine) {
- final Set macros = Sets.newHashSet();
-
- // FIXME: spi
-// for (Map.Entry entry : devMachine.getDescriptor().getServers().entrySet()) {
-//
-// if (Strings.isNullOrEmpty(entry.getValue().getProtocol())) {
-// continue;
-// }
-//
-// Macro macro = new BaseMacro(KEY.replace("%", entry.getKey()),
-// entry.getValue().getProtocol(),
-// "Returns protocol of a server registered by name");
-//
-// macros.add(macro);
-//
-// // register port without "/tcp" suffix
-// if (entry.getKey().endsWith("/tcp")) {
-// final String port = entry.getKey().substring(0, entry.getKey().length() - 4);
-//
-// Macro shortMacro = new BaseMacro(KEY.replace("%", port),
-// entry.getValue().getProtocol(),
-// "Returns protocol of a server registered by name");
-//
-// macros.add(shortMacro);
-// }
-// }
-
- return macros;
- }
-}
diff --git a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/processes/ProcessTreeRenderer.java b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/processes/ProcessTreeRenderer.java
index d492a9315f..0cae03264a 100644
--- a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/processes/ProcessTreeRenderer.java
+++ b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/processes/ProcessTreeRenderer.java
@@ -121,14 +121,11 @@ public class ProcessTreeRenderer implements NodeRenderer {
private SpanElement createMachineElement(final ProcessTreeNode node) {
final MachineEntity machine = (MachineEntity)node.getData();
- // FIXME: spi
-// final String machineId = machine.getId();
-// final MachineConfig machineConfig = machine.getConfig();
-// final String machineCategory = machineConfig.isDev() ? locale.devMachineCategory() : machineConfig.getType();
+ final String machineId = machine.getId();
+ final String machineCategory = machine.isDev() ? locale.devMachineCategory() : "";
SpanElement root = Elements.createSpanElement();
- // FIXME: spi
-// root.appendChild(createMachineLabel(machineCategory));
+ root.appendChild(createMachineLabel(machineCategory));
Element statusElement = Elements.createSpanElement(resources.getCss().machineStatus());
root.appendChild(statusElement);
@@ -168,8 +165,7 @@ public class ProcessTreeRenderer implements NodeRenderer {
event.preventDefault();
if (addTerminalClickHandler != null) {
- // FIXME: spi
-// addTerminalClickHandler.onAddTerminalClick(machineId);
+ addTerminalClickHandler.onAddTerminalClick(machineId);
}
}
}, true);
@@ -208,8 +204,7 @@ public class ProcessTreeRenderer implements NodeRenderer {
@Override
public void handleEvent(Event event) {
if (previewSshClickHandler != null) {
- // FIXME: spi
-// previewSshClickHandler.onPreviewSshClick(machineId);
+ previewSshClickHandler.onPreviewSshClick(machineId);
}
}
}, true);
@@ -223,17 +218,15 @@ public class ProcessTreeRenderer implements NodeRenderer {
Element monitorsElement = Elements.createSpanElement(resources.getCss().machineMonitors());
root.appendChild(monitorsElement);
- // FIXME: spi
-// Node monitorNode = (Node)machineMonitors.getMonitorWidget(machineId, this).getElement();
-// monitorsElement.appendChild(monitorNode);
+ Node monitorNode = (Node)machineMonitors.getMonitorWidget(machineId, this).getElement();
+ monitorsElement.appendChild(monitorNode);
Element nameElement = Elements.createSpanElement(resources.getCss().nameLabel());
- // FIXME: spi
-// nameElement.setTextContent(machineConfig.getName());
-// Tooltip.create(nameElement,
-// BOTTOM,
-// MIDDLE,
-// machineConfig.getName());
+ nameElement.setTextContent(machine.getName());
+ Tooltip.create(nameElement,
+ BOTTOM,
+ MIDDLE,
+ machine.getName());
root.appendChild(nameElement);
return root;
diff --git a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/processes/panel/ProcessesPanelPresenter.java b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/processes/panel/ProcessesPanelPresenter.java
index 03339f0b9c..793cb97fd2 100644
--- a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/processes/panel/ProcessesPanelPresenter.java
+++ b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/processes/panel/ProcessesPanelPresenter.java
@@ -19,7 +19,6 @@ import com.google.inject.Provider;
import com.google.inject.Singleton;
import com.google.web.bindery.event.shared.EventBus;
-import org.eclipse.che.api.core.model.workspace.Runtime;
import org.eclipse.che.api.core.model.workspace.Workspace;
import org.eclipse.che.api.core.model.workspace.WorkspaceConfig;
import org.eclipse.che.api.core.model.workspace.config.Command;
@@ -27,6 +26,7 @@ import org.eclipse.che.api.core.model.workspace.config.Environment;
import org.eclipse.che.api.core.model.workspace.config.MachineConfig;
import org.eclipse.che.api.core.model.workspace.runtime.Machine;
import org.eclipse.che.api.core.model.workspace.runtime.Server;
+import org.eclipse.che.api.machine.shared.dto.MachineDto;
import org.eclipse.che.api.machine.shared.dto.execagent.GetProcessLogsResponseDto;
import org.eclipse.che.api.machine.shared.dto.execagent.GetProcessesResponseDto;
import org.eclipse.che.api.promises.client.Operation;
@@ -41,8 +41,10 @@ import org.eclipse.che.ide.api.command.CommandImpl;
import org.eclipse.che.ide.api.command.CommandTypeRegistry;
import org.eclipse.che.ide.api.dialogs.ConfirmCallback;
import org.eclipse.che.ide.api.dialogs.DialogFactory;
+import org.eclipse.che.ide.api.machine.ActiveRuntime;
import org.eclipse.che.ide.api.machine.ExecAgentCommandManager;
import org.eclipse.che.ide.api.machine.MachineEntity;
+import org.eclipse.che.ide.api.machine.MachineEntityImpl;
import org.eclipse.che.ide.api.machine.events.ActivateProcessOutputEvent;
import org.eclipse.che.ide.api.machine.events.MachineStateEvent;
import org.eclipse.che.ide.api.machine.events.ProcessFinishedEvent;
@@ -65,6 +67,7 @@ import org.eclipse.che.ide.console.CommandConsoleFactory;
import org.eclipse.che.ide.console.CommandOutputConsole;
import org.eclipse.che.ide.console.CommandOutputConsolePresenter;
import org.eclipse.che.ide.console.DefaultOutputConsole;
+import org.eclipse.che.ide.dto.DtoFactory;
import org.eclipse.che.ide.machine.MachineResources;
import org.eclipse.che.ide.processes.ProcessTreeNode;
import org.eclipse.che.ide.processes.ProcessTreeNodeSelectedEvent;
@@ -138,6 +141,7 @@ public class ProcessesPanelPresenter extends BasePresenter implements ProcessesP
private final CommandTypeRegistry commandTypeRegistry;
private final ExecAgentCommandManager execAgentCommandManager;
private final Provider macroProcessorProvider;
+ private final DtoFactory dtoFactory;
private final EventBus eventBus;
ProcessTreeNode rootNode;
@@ -161,7 +165,8 @@ public class ProcessesPanelPresenter extends BasePresenter implements ProcessesP
CommandTypeRegistry commandTypeRegistry,
SshServiceClient sshServiceClient,
ExecAgentCommandManager execAgentCommandManager,
- Provider macroProcessorProvider) {
+ Provider macroProcessorProvider,
+ DtoFactory dtoFactory) {
this.view = view;
this.localizationConstant = localizationConstant;
this.resources = resources;
@@ -177,6 +182,7 @@ public class ProcessesPanelPresenter extends BasePresenter implements ProcessesP
this.commandTypeRegistry = commandTypeRegistry;
this.execAgentCommandManager = execAgentCommandManager;
this.macroProcessorProvider = macroProcessorProvider;
+ this.dtoFactory = dtoFactory;
machineNodes = new HashMap<>();
machines = new HashMap<>();
@@ -208,7 +214,7 @@ public class ProcessesPanelPresenter extends BasePresenter implements ProcessesP
return;
}
- List machines = getMachines(appContext.getWorkspace());
+ List machines = getMachines();
if (machines.isEmpty()) {
return;
}
@@ -452,13 +458,12 @@ public class ProcessesPanelPresenter extends BasePresenter implements ProcessesP
return;
}
- Machine machine = (Machine)machineTreeNode.getData();
+ MachineEntity machine = (MachineEntity)machineTreeNode.getData();
final OutputConsole defaultConsole = commandConsoleFactory.create("SSH");
addCommandOutput(machineId, defaultConsole);
- // FIXME: spi
- final String machineName = ""/*machine.getConfig().getName()*/;
+ final String machineName = machine.getName();
String sshServiceAddress = getSshServerAddress(machine);
final String machineHost;
final String sshPort;
@@ -546,7 +551,6 @@ public class ProcessesPanelPresenter extends BasePresenter implements ProcessesP
private String getSshServerAddress(Machine machine) {
Map servers = machine.getServers();
final Server sshServer = servers.get(SSH_PORT + "/tcp");
- // FIXME: spi
return sshServer != null ? sshServer.getUrl() : null;
}
@@ -838,7 +842,7 @@ public class ProcessesPanelPresenter extends BasePresenter implements ProcessesP
* @return true is the terminal url, otherwise return false
*/
private boolean hasTerminal(String machineId) {
- List wsMachines = getMachines(appContext.getWorkspace());
+ List wsMachines = getMachines();
for (MachineEntity machineEntity : wsMachines) {
if (machineId.equals(machineEntity.getId())) {
return false;
@@ -881,7 +885,6 @@ public class ProcessesPanelPresenter extends BasePresenter implements ProcessesP
// create new node
final ProcessTreeNode newMachineNode = new ProcessTreeNode(MACHINE_NODE, rootNode, machine, null, children);
- // FIXME: spi
// newMachineNode.setRunning(RUNNING == machine.getStatus());
newMachineNode.setHasTerminalAgent(hasAgent(machine.getDisplayName(), TERMINAL_AGENT) || hasTerminal(machineId));
newMachineNode.setHasSSHAgent(hasAgent(machine.getDisplayName(), SSH_AGENT));
@@ -906,32 +909,18 @@ public class ProcessesPanelPresenter extends BasePresenter implements ProcessesP
return newMachineNode;
}
- private List getMachines(Workspace workspace) {
- Runtime workspaceRuntime = workspace.getRuntime();
+ private List getMachines() {
+ final ActiveRuntime workspaceRuntime = appContext.getActiveRuntime();
if (workspaceRuntime == null) {
return emptyList();
}
- Map runtimeMachines = workspaceRuntime.getMachines();
- List machines = new ArrayList<>(runtimeMachines.size());
- // FIXME: spi
-// for (Machine machine : runtimeMachines.entrySet()) {
-// if (machine instanceof MachineDto) {
-// MachineEntity machineEntity = new MachineEntityImpl(machine);
-// machines.add(machineEntity);
-// }
-// }
- return machines;
+ return new ArrayList<>(workspaceRuntime.getMachines());
}
@Nullable
private MachineEntity getMachine(@NotNull String machineId) {
- Workspace workspace = appContext.getWorkspace();
- if (workspace == null) {
- return null;
- }
-
- List wsMachines = getMachines(workspace);
+ List wsMachines = getMachines();
for (MachineEntity machine : wsMachines) {
if (machineId.equals(machine.getId())) {
return machine;
@@ -947,7 +936,7 @@ public class ProcessesPanelPresenter extends BasePresenter implements ProcessesP
@Override
public void onWorkspaceStarted(WorkspaceStartedEvent event) {
- List wsMachines = getMachines(event.getWorkspace());
+ List wsMachines = getMachines();
if (wsMachines.isEmpty()) {
return;
}
@@ -979,12 +968,11 @@ public class ProcessesPanelPresenter extends BasePresenter implements ProcessesP
notifyTreeNodeSelected(machineToSelect);
}
- // FIXME: spi
-// for (MachineEntity machine : machines.values()) {
-// if (RUNNING.equals(machine.getStatus()) && !wsMachines.contains(machine)) {
-// provideMachineNode(machine, true);
-// }
-// }
+ for (MachineEntity machine : machines.values()) {
+ if (/*RUNNING.equals(machine.getStatus()) && */!wsMachines.contains(machine)) {
+ provideMachineNode(machine, true);
+ }
+ }
}
@Override
@@ -1033,7 +1021,7 @@ public class ProcessesPanelPresenter extends BasePresenter implements ProcessesP
@Override
public void onWsAgentStarted(WsAgentStateEvent event) {
- List machines = getMachines(appContext.getWorkspace());
+ List machines = getMachines();
if (machines.isEmpty()) {
return;
}
@@ -1188,18 +1176,11 @@ public class ProcessesPanelPresenter extends BasePresenter implements ProcessesP
*/
public void printMachineOutput(final String machineName, final String text) {
// Create a temporary machine node to display outputs.
- // FIXME: spi
-// if (!consoles.containsKey(machineName)) {
-// MachineDto machineDto = dtoFactory.createDto(MachineDto.class)
-// .withId(machineName)
-// .withStatus(CREATING)
-// .withConfig(dtoFactory.createDto(MachineConfigDto.class)
-// .withDev("dev-machine".equals(machineName))
-// .withName(machineName)
-// .withType("docker")
-// );
-// provideMachineNode(new MachineItem(machineDto), true);
-// }
+
+ if (!consoles.containsKey(machineName)) {
+ MachineDto machineDto = dtoFactory.createDto(MachineDto.class);
+ provideMachineNode(new MachineEntityImpl(machineName, machineDto), true);
+ }
OutputConsole console = consoles.get(machineName);
if (console != null && console instanceof DefaultOutputConsole) {
@@ -1300,18 +1281,18 @@ public class ProcessesPanelPresenter extends BasePresenter implements ProcessesP
@Override
public void onDownloadWorkspaceOutput(DownloadWorkspaceOutputEvent event) {
- Machine devMachine = null;
+ MachineEntity devMachine = null;
for (ProcessTreeNode machineNode : machineNodes.values()) {
- if (!(machineNode.getData() instanceof Machine)) {
+ if (!(machineNode.getData() instanceof MachineEntity)) {
continue;
}
- Machine machine = (Machine)machineNode.getData();
- // FIXME: spi
-// if (!machine.isDev()) {
-// continue;
-// }
+ MachineEntity machine = (MachineEntity)machineNode.getData();
+
+ if (!machine.isDev()) {
+ continue;
+ }
devMachine = machine;
break;
@@ -1325,8 +1306,7 @@ public class ProcessesPanelPresenter extends BasePresenter implements ProcessesP
" " + DateTimeFormat.getFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) +
".log";
- // FIXME: spi
-// download(fileName, getText(devMachine.getId()));
+ download(fileName, getText(devMachine.getId()));
}
@Override
diff --git a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/projecttype/wizard/categoriespage/CategoriesPagePresenter.java b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/projecttype/wizard/categoriespage/CategoriesPagePresenter.java
index 3dc4959115..51a805caea 100644
--- a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/projecttype/wizard/categoriespage/CategoriesPagePresenter.java
+++ b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/projecttype/wizard/categoriespage/CategoriesPagePresenter.java
@@ -231,15 +231,7 @@ public class CategoriesPagePresenter extends AbstractWizardPage updatedConfigs = new ArrayList<>(configDtoList.size());
for (ProjectConfigDto configDto : configDtoList) {
- // FIXME: spi
- final NewProjectConfig newConfig = new NewProjectConfigImpl(configDto.getName(),
- configDto.getPath(),
- configDto.getDescription(),
- configDto.getType(),
- configDto.getSource(),
- configDto.getMixins(),
- configDto.getAttributes(),
- null);
+ final NewProjectConfig newConfig = new NewProjectConfigImpl(configDto);
final String projectPath = configDto.getPath();
if (projectPath.startsWith(templatePath)) {
final String path = projectPath.replaceFirst(templatePath, newProjectPath);
diff --git a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/workspace/create/CreateWorkspacePresenter.java b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/workspace/create/CreateWorkspacePresenter.java
index 63b792ce84..155f1614ef 100644
--- a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/workspace/create/CreateWorkspacePresenter.java
+++ b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/workspace/create/CreateWorkspacePresenter.java
@@ -34,7 +34,6 @@ import java.util.ArrayList;
import java.util.List;
import static java.util.Collections.singletonMap;
-import static org.eclipse.che.api.machine.shared.Constants.WS_MACHINE_NAME;
/**
* The class contains business logic which allow to create user workspace if it doesn't exist.
@@ -199,7 +198,7 @@ public class CreateWorkspacePresenter implements CreateWorkspaceView.ActionDeleg
EnvironmentDto environment = dtoFactory.createDto(EnvironmentDto.class)
.withRecipe(recipe)
- .withMachines(singletonMap(WS_MACHINE_NAME, machine));
+ .withMachines(singletonMap("default", machine));
return dtoFactory.createDto(WorkspaceConfigDto.class)
.withName(wsName)
diff --git a/ide/che-core-ide-app/src/test/java/org/eclipse/che/ide/machine/MachineItemTest.java b/ide/che-core-ide-app/src/test/java/org/eclipse/che/ide/machine/MachineItemTest.java
deleted file mode 100644
index c8d5f80653..0000000000
--- a/ide/che-core-ide-app/src/test/java/org/eclipse/che/ide/machine/MachineItemTest.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package org.eclipse.che.ide.machine;
-/*******************************************************************************
- * Copyright (c) 2012-2017 Codenvy, S.A.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Codenvy, S.A. - initial API and implementation
- *******************************************************************************/
-
-import org.eclipse.che.api.core.rest.shared.dto.Link;
-import org.eclipse.che.api.machine.shared.dto.MachineConfigDto;
-import org.eclipse.che.api.machine.shared.dto.MachineDto;
-import org.eclipse.che.api.machine.shared.dto.MachineRuntimeInfoDto;
-import org.eclipse.che.api.machine.shared.dto.ServerDto;
-import org.eclipse.che.ide.CoreLocalizationConstant;
-import org.eclipse.che.ide.api.app.AppContext;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.runners.MockitoJUnitRunner;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import static org.eclipse.che.api.machine.shared.Constants.TERMINAL_REFERENCE;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-/**
- * @author Dmitry Shnurenko
- */
-@RunWith(MockitoJUnitRunner.class)
-public class MachineItemTest {
-
- private final static String SOME_TEXT = "someText";
-
- @Mock
- private MachineDto descriptor;
- @Mock
- private MachineConfigDto machineConfig;
- @Mock
- private MachineRuntimeInfoDto machineRuntimeDto;
- @Mock
- private ServerDto serverDescriptor;
- @Mock
- private CoreLocalizationConstant locale;
- @Mock
- private AppContext appContext;
-
- private MachineItem machine;
-
- @Before
- public void setUp() {
- Map servers = new HashMap<>();
- servers.put(SOME_TEXT, serverDescriptor);
-
- when(descriptor.getRuntime()).thenReturn(machineRuntimeDto);
- when(descriptor.getConfig()).thenReturn(machineConfig);
- when(serverDescriptor.getAddress()).thenReturn(SOME_TEXT);
- when(machineRuntimeDto.getServers()).thenReturn(servers);
-
- machine = new MachineItem(descriptor);
- }
-
- @Test
- public void constructorShouldBeVerified() {
- verify(descriptor).getLinks();
- verify(descriptor).getConfig();
- }
-
- @Test
- public void displayNameShouldBeReturned() {
- machine.getDisplayName();
-
- verify(machineConfig).getName();
- }
-
- @Test
- public void idShouldBeReturned() {
- machine.getId();
-
- verify(descriptor).getId();
- }
-
- @Test
- public void stateShouldBeReturned() {
- machine.getStatus();
-
- verify(descriptor).getStatus();
- }
-
- @Test
- public void typeShouldBeReturned() {
- machine.getType();
-
- verify(machineConfig).getType();
- }
-
- @Test
- public void boundedStateShouldBeReturned() {
- machine.isDev();
-
- verify(machineConfig).isDev();
- }
-
- @Test
- public void shouldReturnTerminalUrl() {
- String terminalHref = "terminalHref";
- Link someLink = mock(Link.class);
- Link terminalLink = mock(Link.class);
- List links = new ArrayList<>(2);
- links.add(someLink);
- links.add(terminalLink);
- when(terminalLink.getHref()).thenReturn(terminalHref);
- when(terminalLink.getRel()).thenReturn(TERMINAL_REFERENCE);
- when(descriptor.getLinks()).thenReturn(links);
-
- machine = new MachineItem(descriptor);
- String terminalUrl = machine.getTerminalUrl();
-
- assertEquals(terminalHref, terminalUrl);
- }
-
- @Test
- public void shouldReturnProperties() {
- Map properties = Collections.emptyMap();
- when(machineRuntimeDto.getProperties()).thenReturn(properties);
-
- machine = new MachineItem(descriptor);
- Map result = machine.getProperties();
-
- assertEquals(properties, result);
- }
-
- @Test
- public void shouldAvoidNPEWhenMachineRuntimeIsNull() {
- when(descriptor.getRuntime()).thenReturn(null);
- machine = new MachineItem(descriptor);
-
- Map result = machine.getProperties();
-
- assertNull(result);
- }
-}
diff --git a/ide/che-core-ide-app/src/test/java/org/eclipse/che/ide/macro/ServerMacroTest.java b/ide/che-core-ide-app/src/test/java/org/eclipse/che/ide/macro/ServerMacroTest.java
deleted file mode 100644
index eb47c49806..0000000000
--- a/ide/che-core-ide-app/src/test/java/org/eclipse/che/ide/macro/ServerMacroTest.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012-2017 Codenvy, S.A.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Codenvy, S.A. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.che.ide.macro;
-
-import com.google.gwtmockito.GwtMockitoTestRunner;
-import com.google.web.bindery.event.shared.EventBus;
-
-import org.eclipse.che.api.core.model.machine.Machine;
-import org.eclipse.che.api.core.model.machine.MachineRuntimeInfo;
-import org.eclipse.che.api.core.model.machine.Server;
-import org.eclipse.che.api.machine.shared.Constants;
-import org.eclipse.che.api.promises.client.Operation;
-import org.eclipse.che.api.promises.client.OperationException;
-import org.eclipse.che.ide.api.app.AppContext;
-import org.eclipse.che.ide.api.macro.BaseMacro;
-import org.eclipse.che.ide.api.macro.Macro;
-import org.eclipse.che.ide.api.macro.MacroRegistry;
-import org.eclipse.che.ide.api.machine.DevMachine;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.Set;
-
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.when;
-
-/**
- * Unit tests for the {@link ServerMacro}
- *
- * @author Vlad Zhukovskyi
- */
-@RunWith(GwtMockitoTestRunner.class)
-public class ServerMacroTest {
-
- public static final String WS_AGENT_PORT = Constants.WS_AGENT_PORT; // 4401/tcp
- public static final String ADDRESS = "127.0.0.1";
-
- @Mock
- private MacroRegistry macroRegistry;
-
- @Mock
- private EventBus eventBus;
-
- @Mock
- private AppContext appContext;
-
- @Mock
- private DevMachine devMachine;
-
- @Mock
- private Machine machine;
-
- @Mock
- private MachineRuntimeInfo machineRuntimeInfo;
-
- @Mock
- private Server server;
-
- private ServerMacro provider;
-
- @Before
- public void setUp() throws Exception {
- provider = new ServerMacro(macroRegistry, eventBus, appContext);
-
- registerProvider();
- }
-
- @Test
- public void getMacros() throws Exception {
- final Set macros = provider.getMacros(devMachine);
-
- assertEquals(macros.size(), 2);
-
- final Iterator iterator = macros.iterator();
-
- final Macro provider1 = iterator.next();
-
- assertTrue(provider1 instanceof BaseMacro);
- assertEquals(provider1.getName(), ServerMacro.KEY.replace("%", WS_AGENT_PORT.substring(0, WS_AGENT_PORT.length() - 4)));
-
- provider1.expand().then(new Operation() {
- @Override
- public void apply(String address) throws OperationException {
- assertEquals(address, ADDRESS);
- }
- });
-
- final Macro provider2 = iterator.next();
-
- assertTrue(provider2 instanceof BaseMacro);
- assertEquals(provider2.getName(), ServerMacro.KEY.replace("%", WS_AGENT_PORT));
-
- provider2.expand().then(new Operation() {
- @Override
- public void apply(String address) throws OperationException {
- assertEquals(address, ADDRESS);
- }
- });
- }
-
- protected void registerProvider() {
- when(devMachine.getDescriptor()).thenReturn(machine);
- when(machine.getRuntime()).thenReturn(machineRuntimeInfo);
- doReturn(Collections.singletonMap(WS_AGENT_PORT, server)).when(machineRuntimeInfo).getServers();
- when(server.getAddress()).thenReturn(ADDRESS);
- }
-
-}
\ No newline at end of file
diff --git a/ide/che-core-ide-app/src/test/java/org/eclipse/che/ide/macro/ServerProtocolMacroTest.java b/ide/che-core-ide-app/src/test/java/org/eclipse/che/ide/macro/ServerProtocolMacroTest.java
deleted file mode 100644
index a9ee5d6459..0000000000
--- a/ide/che-core-ide-app/src/test/java/org/eclipse/che/ide/macro/ServerProtocolMacroTest.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012-2017 Codenvy, S.A.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Codenvy, S.A. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.che.ide.macro;
-
-import com.google.gwtmockito.GwtMockitoTestRunner;
-import com.google.web.bindery.event.shared.EventBus;
-
-import org.eclipse.che.api.core.model.machine.Machine;
-import org.eclipse.che.api.core.model.machine.MachineRuntimeInfo;
-import org.eclipse.che.api.core.model.machine.Server;
-import org.eclipse.che.api.machine.shared.Constants;
-import org.eclipse.che.api.promises.client.Operation;
-import org.eclipse.che.api.promises.client.OperationException;
-import org.eclipse.che.ide.api.app.AppContext;
-import org.eclipse.che.ide.api.macro.BaseMacro;
-import org.eclipse.che.ide.api.macro.Macro;
-import org.eclipse.che.ide.api.macro.MacroRegistry;
-import org.eclipse.che.ide.api.machine.DevMachine;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.Set;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.when;
-
-/**
- * Unit tests for the {@link ServerProtocolMacro}
- *
- * @author Vlad Zhukovskyi
- */
-@RunWith(GwtMockitoTestRunner.class)
-public class ServerProtocolMacroTest {
-
- public static final String WS_AGENT_PORT = Constants.WS_AGENT_PORT; // 4401/tcp
- public static final String PORT = "1234";
- public static final String ADDRESS = "127.0.0.1" + ":" + PORT;
- public static final String PROTOCOL = "protocol";
-
- @Mock
- private MacroRegistry macroRegistry;
-
- @Mock
- private EventBus eventBus;
-
- @Mock
- private AppContext appContext;
-
- @Mock
- private DevMachine devMachine;
-
- @Mock
- private Machine machine;
-
- @Mock
- private MachineRuntimeInfo machineRuntimeInfo;
-
- @Mock
- private Server server;
-
- private ServerProtocolMacro provider;
-
- @Before
- public void setUp() throws Exception {
- provider = new ServerProtocolMacro(macroRegistry, eventBus, appContext);
-
- registerProvider();
- }
-
- @Test
- public void getMacros() throws Exception {
- final Set macros = provider.getMacros(devMachine);
-
- assertEquals(macros.size(), 2);
-
- final Iterator iterator = macros.iterator();
-
- final Macro provider1 = iterator.next();
-
- assertTrue(provider1 instanceof BaseMacro);
- assertEquals(provider1.getName(), ServerProtocolMacro.KEY.replace("%", WS_AGENT_PORT));
-
- provider1.expand().then(new Operation() {
- @Override
- public void apply(String address) throws OperationException {
- assertEquals(address, PROTOCOL);
- }
- });
-
- final Macro provider2 = iterator.next();
-
- assertTrue(provider2 instanceof BaseMacro);
- assertEquals(provider2.getName(), ServerProtocolMacro.KEY.replace("%", WS_AGENT_PORT.substring(0, WS_AGENT_PORT.length() - 4)));
-
- provider2.expand().then(new Operation() {
- @Override
- public void apply(String address) throws OperationException {
- assertEquals(address, PROTOCOL);
- }
- });
- }
-
- protected void registerProvider() {
- when(devMachine.getDescriptor()).thenReturn(machine);
- when(machine.getRuntime()).thenReturn(machineRuntimeInfo);
- doReturn(Collections.singletonMap(WS_AGENT_PORT, server)).when(machineRuntimeInfo).getServers();
- when(server.getAddress()).thenReturn(ADDRESS);
- when(server.getProtocol()).thenReturn(PROTOCOL);
- }
-
-}
\ No newline at end of file
diff --git a/plugins/plugin-gdb/che-plugin-gdb-ide/src/main/java/org/eclipse/che/plugin/gdb/ide/configuration/GdbConfigurationPagePresenter.java b/plugins/plugin-gdb/che-plugin-gdb-ide/src/main/java/org/eclipse/che/plugin/gdb/ide/configuration/GdbConfigurationPagePresenter.java
index 8cced7d158..b74d96b279 100644
--- a/plugins/plugin-gdb/che-plugin-gdb-ide/src/main/java/org/eclipse/che/plugin/gdb/ide/configuration/GdbConfigurationPagePresenter.java
+++ b/plugins/plugin-gdb/che-plugin-gdb-ide/src/main/java/org/eclipse/che/plugin/gdb/ide/configuration/GdbConfigurationPagePresenter.java
@@ -15,10 +15,10 @@ import com.google.inject.Inject;
import com.google.inject.Singleton;
import org.eclipse.che.api.core.model.workspace.Workspace;
-import org.eclipse.che.api.core.model.workspace.runtime.Machine;
import org.eclipse.che.ide.api.app.AppContext;
import org.eclipse.che.ide.api.debug.DebugConfiguration;
import org.eclipse.che.ide.api.debug.DebugConfigurationPage;
+import org.eclipse.che.ide.api.machine.MachineEntity;
import org.eclipse.che.ide.macro.CurrentProjectPathMacro;
import java.util.ArrayList;
@@ -97,43 +97,34 @@ public class GdbConfigurationPagePresenter implements GdbConfigurationPageView.A
view.setPortEnableState(!devHost);
view.setHostEnableState(!devHost);
- List machines = getMachines();
+ List machines = getMachines();
if (!machines.isEmpty()) {
setHosts(machines);
}
}
- private void setHosts(List machines) {
+ private void setHosts(List machines) {
Map hosts = new HashMap<>();
- for (Machine machine : machines) {
+ for (MachineEntity machine : machines) {
String host = machine.getProperties().get("network.ipAddress");
if (host == null) {
continue;
}
-// FIXME: spi
-// String description = host + " (" + machine.getConfig().getName() + ")";
-// hosts.put(host, description);
+
+ String description = host + " (" + machine.getName() + ")";
+ hosts.put(host, description);
}
view.setHostsList(hosts);
}
- private List getMachines() {
+ private List getMachines() {
Workspace workspace = appContext.getWorkspace();
if (workspace == null || workspace.getRuntime() == null) {
return emptyList();
}
- Map runtimeMachines = workspace.getRuntime().getMachines();
- List machines = new ArrayList<>(runtimeMachines.size());
-// FIXME: spi
-// for (Machine currentMachine : runtimeMachines.entrySet()) {
-// if (currentMachine instanceof MachineDto) {
-// Machine machine = new MachineEntityImpl(currentMachine);
-// machines.add(machine);
-// }
-// }
- return machines;
+ return new ArrayList<>(appContext.getActiveRuntime().getMachines());
}
@Override
diff --git a/plugins/plugin-java-debugger/che-plugin-java-debugger-ide/src/main/java/org/eclipse/che/plugin/jdb/ide/configuration/JavaDebugConfigurationPagePresenter.java b/plugins/plugin-java-debugger/che-plugin-java-debugger-ide/src/main/java/org/eclipse/che/plugin/jdb/ide/configuration/JavaDebugConfigurationPagePresenter.java
index 287dea87d7..56fc5f55f3 100644
--- a/plugins/plugin-java-debugger/che-plugin-java-debugger-ide/src/main/java/org/eclipse/che/plugin/jdb/ide/configuration/JavaDebugConfigurationPagePresenter.java
+++ b/plugins/plugin-java-debugger/che-plugin-java-debugger-ide/src/main/java/org/eclipse/che/plugin/jdb/ide/configuration/JavaDebugConfigurationPagePresenter.java
@@ -90,11 +90,10 @@ public class JavaDebugConfigurationPagePresenter implements JavaDebugConfigurati
String port = entry.getKey();
if (port.endsWith("/tcp")) {
String portWithoutTcp = port.substring(0, port.length() - 4);
- // FIXME: spi
-// String description = portWithoutTcp + " (" + entry.getValue().getRef() + ")";
-// Pair pair = new Pair<>(description, portWithoutTcp);
+ String description = portWithoutTcp + " (" + entry.getValue().getUrl() + ")";
+ Pair pair = new Pair<>(description, portWithoutTcp);
-// ports.add(pair);
+ ports.add(pair);
}
}
diff --git a/plugins/plugin-testing/che-plugin-testing-ide/src/main/java/org/eclipse/che/plugin/testing/ide/TestServiceClient.java b/plugins/plugin-testing/che-plugin-testing-ide/src/main/java/org/eclipse/che/plugin/testing/ide/TestServiceClient.java
index 8ac7436de1..633043e4f3 100644
--- a/plugins/plugin-testing/che-plugin-testing-ide/src/main/java/org/eclipse/che/plugin/testing/ide/TestServiceClient.java
+++ b/plugins/plugin-testing/che-plugin-testing-ide/src/main/java/org/eclipse/che/plugin/testing/ide/TestServiceClient.java
@@ -14,7 +14,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.eclipse.che.api.core.model.workspace.runtime.Machine;
import org.eclipse.che.api.machine.shared.dto.execagent.ProcessStartResponseDto;
import org.eclipse.che.api.promises.client.Operation;
import org.eclipse.che.api.promises.client.OperationException;
@@ -32,6 +31,7 @@ import org.eclipse.che.ide.api.app.AppContext;
import org.eclipse.che.ide.api.command.CommandImpl;
import org.eclipse.che.ide.api.command.CommandManager;
import org.eclipse.che.ide.api.machine.ExecAgentCommandManager;
+import org.eclipse.che.ide.api.machine.MachineEntity;
import org.eclipse.che.ide.api.machine.execagent.ExecAgentConsumer;
import org.eclipse.che.ide.api.macro.MacroProcessor;
import org.eclipse.che.ide.api.notification.StatusNotification;
@@ -150,11 +150,11 @@ public class TestServiceClient {
StatusNotification statusNotification,
Promise compileCommand) {
return compileCommand.thenPromise(command -> {
- final Machine machine;
+ final MachineEntity machine;
if (command == null) {
machine = null;
} else {
- machine = appContext.getDevMachine().getDescriptor();
+ machine = appContext.getDevMachine();
}
if (machine == null) {
if (statusNotification != null) {
@@ -182,8 +182,7 @@ public class TestServiceClient {
command.getType(), attributes);
final CommandOutputConsole console = commandConsoleFactory.create(expandedCommand, machine);
- // FIXME: spi
- final String machineId = ""/*machine.getId()*/;
+ final String machineId = machine.getId();
processesPanelPresenter.addCommandOutput(machineId, console);
ExecAgentConsumer processPromise = execAgentCommandManager.startProcess(machineId,