use of org.eclipse.debug.core.ILaunchConfiguration in project linuxtools by eclipse.
the class ImageRunSWTBotTest method testNetworkModeOther.
@Test
public void testNetworkModeOther() throws CoreException {
final DockerClient client = MockDockerClientFactory.image(MockImageFactory.name("foo:latest").build()).container(MockContainerFactory.name("foo_bar").build()).build();
final DockerConnection connection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
final String runImageLaunchConfigurationName = configureRunImageLaunchConfiguration(connection, "jeffnet");
final ILaunchConfiguration runDockerImageLaunchConfig = LaunchConfigurationUtils.getLaunchConfigurationByName(IRunDockerImageLaunchConfigurationConstants.CONFIG_TYPE_ID, runImageLaunchConfigurationName);
assertThat(runDockerImageLaunchConfig).isNotNull();
assertThat(runDockerImageLaunchConfig.getAttribute(IRunDockerImageLaunchConfigurationConstants.CONNECTION_NAME, "")).isEqualTo("Test");
assertThat(runDockerImageLaunchConfig.getAttribute(IRunDockerImageLaunchConfigurationConstants.NETWORK_MODE, "")).isEqualTo("jeffnet");
}
use of org.eclipse.debug.core.ILaunchConfiguration in project linuxtools by eclipse.
the class ImageRunSWTBotTest method testNetworkModeBridge.
@Test
public void testNetworkModeBridge() throws CoreException {
final DockerClient client = MockDockerClientFactory.image(MockImageFactory.name("foo:latest").build()).container(MockContainerFactory.name("foo_bar").build()).build();
final DockerConnection connection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
final String runImageLaunchConfigurationName = configureRunImageLaunchConfiguration(connection, "bridge");
final ILaunchConfiguration runDockerImageLaunchConfig = LaunchConfigurationUtils.getLaunchConfigurationByName(IRunDockerImageLaunchConfigurationConstants.CONFIG_TYPE_ID, runImageLaunchConfigurationName);
assertThat(runDockerImageLaunchConfig).isNotNull();
assertThat(runDockerImageLaunchConfig.getAttribute(IRunDockerImageLaunchConfigurationConstants.CONNECTION_NAME, "")).isEqualTo("Test");
assertThat(runDockerImageLaunchConfig.getAttribute(IRunDockerImageLaunchConfigurationConstants.NETWORK_MODE, "")).isEqualTo("bridge");
}
use of org.eclipse.debug.core.ILaunchConfiguration in project dbeaver by dbeaver.
the class DatabaseLaunchShortcut method getCandidates.
protected List<ILaunchConfiguration> getCandidates(DBSObject launchable, ILaunchConfigurationType configType, Map<String, Object> databaseContext) {
List<ILaunchConfiguration> candidateConfigs = Collections.emptyList();
try {
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfiguration[] configs = launchManager.getLaunchConfigurations(configType);
candidateConfigs = new ArrayList<ILaunchConfiguration>(configs.length);
for (int i = 0; i < configs.length; i++) {
ILaunchConfiguration config = configs[i];
if (isCandidate(config, launchable, databaseContext)) {
candidateConfigs.add(config);
}
}
} catch (CoreException e) {
DebugUI.log(e.getStatus());
}
return candidateConfigs;
}
use of org.eclipse.debug.core.ILaunchConfiguration in project dbeaver by dbeaver.
the class DatabaseLaunchShortcut method launch.
protected void launch(DBSObject launchable, String mode) {
Map<String, Object> databaseContext = DebugCore.resolveDatabaseContext(launchable);
List<ILaunchConfiguration> configs = getCandidates(launchable, getConfigurationType(), databaseContext);
if (configs != null) {
ILaunchConfiguration config = null;
int count = configs.size();
if (count == 1) {
config = configs.get(0);
} else if (count > 1) {
config = chooseConfiguration(configs, mode);
if (config == null) {
return;
}
}
if (config == null) {
try {
config = createConfiguration(launchable);
} catch (CoreException e) {
IStatus status = e.getStatus();
DebugUI.log(status);
MessageDialog.openError(getShell(), DebugUIMessages.DatabaseLaunchShortcut_e_launch, status.getMessage());
return;
}
}
if (config != null) {
DebugUITools.launch(config, mode);
}
}
}
use of org.eclipse.debug.core.ILaunchConfiguration in project liferay-ide by liferay.
the class PortalServerBehavior method stop.
@Override
public void stop(boolean force) {
if (force) {
terminate();
return;
}
int state = getServer().getServerState();
// If stopped or stopping, no need to run stop command again
if (state == IServer.STATE_STOPPED || state == IServer.STATE_STOPPING) {
return;
} else if (state == IServer.STATE_STARTING) {
terminate();
return;
}
try {
if (state != IServer.STATE_STOPPED) {
setServerState(IServer.STATE_STOPPING);
}
final ILaunchConfiguration launchConfig = ((Server) getServer()).getLaunchConfiguration(false, null);
final ILaunchConfigurationWorkingCopy wc = launchConfig.getWorkingCopy();
final String args = renderCommandLine(getRuntimeStopProgArgs(), " ");
// Remove JMX arguments if present
final String existingVMArgs = wc.getAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, (String) null);
if (existingVMArgs.indexOf(JMX_EXCLUDE_ARGS[0]) >= 0) {
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, mergeArguments(existingVMArgs, getRuntimeStopVMArguments(), JMX_EXCLUDE_ARGS, false));
} else {
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, mergeArguments(existingVMArgs, getRuntimeStopVMArguments(), null, true));
}
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, args);
wc.setAttribute("org.eclipse.debug.ui.private", true);
wc.setAttribute(ATTR_STOP, "true");
wc.launch(ILaunchManager.RUN_MODE, new NullProgressMonitor());
} catch (Exception e) {
LiferayServerCore.logError("Error stopping portal", e);
}
}
Aggregations