use of org.eclipse.debug.core.ILaunchConfiguration in project liferay-ide by liferay.
the class SDKHelper method runTarget.
public void runTarget(IPath buildFile, String targets, Map<String, String> properties, boolean separateJRE, String workingDir) throws CoreException {
if (isLaunchRunning()) {
throw new IllegalStateException("Existing launch in progress");
}
currentBuildFile = buildFile;
currentTargets = targets;
ILaunchConfiguration launchConfig = createLaunchConfiguration(buildFile, targets, properties, separateJRE, workingDir);
launch(launchConfig, ILaunchManager.RUN_MODE, _monitor);
currentBuildFile = null;
currentTargets = null;
}
use of org.eclipse.debug.core.ILaunchConfiguration in project liferay-ide by liferay.
the class PortalSourcePathComputerDelegate method addSourceContainers.
private void addSourceContainers(ILaunchConfiguration configuration, IProgressMonitor monitor, final List<ISourceContainer> sourceContainers, IProject project) {
String projectName = project.getName();
try {
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType launchConfigurationType = manager.getLaunchConfigurationType("org.eclipse.jdt.launching.localJavaApplication");
ILaunchConfigurationWorkingCopy sourceLookupConfig = launchConfigurationType.newInstance(null, configuration.getName());
sourceLookupConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, projectName);
ISourceContainer[] computedSourceContainers = super.computeSourceContainers(sourceLookupConfig, monitor);
Stream.of(computedSourceContainers).filter(computedSourceContainer -> !sourceContainers.contains(computedSourceContainer)).forEach(sourceContainers::add);
} catch (CoreException e) {
LiferayServerCore.logError("Unable to add source container for project " + projectName, e);
}
}
use of org.eclipse.debug.core.ILaunchConfiguration in project liferay-ide by liferay.
the class PortalSourcePathComputerDelegate method computeSourceContainers.
@Override
public ISourceContainer[] computeSourceContainers(ILaunchConfiguration configuration, IProgressMonitor monitor) throws CoreException {
final List<ISourceContainer> sourceContainers = new ArrayList<ISourceContainer>();
final IServer server = ServerUtil.getServer(configuration);
IWorkspaceProject workspaceProject = LiferayCore.create(IWorkspaceProject.class, server);
if (workspaceProject != null) {
addSourceContainers(configuration, monitor, sourceContainers, workspaceProject.getProject());
}
Stream.of(server.getModules()).map(module -> LiferayCore.create(module.getProject())).filter(liferayProject -> liferayProject != null).forEach(liferayProject -> addSourceContainers(configuration, monitor, sourceContainers, liferayProject.getProject()));
return sourceContainers.toArray(new ISourceContainer[0]);
}
use of org.eclipse.debug.core.ILaunchConfiguration in project liferay-ide by liferay.
the class PortalSourceLookupTests method testPortalSourcePathComputerDelegateDefaults.
@Test
public void testPortalSourcePathComputerDelegateDefaults() throws Exception {
IServer portalServer = createPortalServer();
addProjectToServer(CoreUtil.getLiferayProject("debug-lib"), portalServer);
addProjectToServer(CoreUtil.getLiferayProject("debug-test"), portalServer);
ILaunchConfiguration launchConfig = portalServer.getLaunchConfiguration(true, _NPM);
ISourcePathComputer sourcePathComputer = getPortalSourcePathComputer(launchConfig);
Assert.assertNotNull(sourcePathComputer);
ISourceContainer[] sourceContainers = sourcePathComputer.computeSourceContainers(launchConfig, new NullProgressMonitor());
Assert.assertNotNull(sourceContainers);
Assert.assertEquals(2, Stream.of(sourceContainers).filter(sourceContainer -> sourceContainer instanceof JavaProjectSourceContainer).count());
Assert.assertTrue(Stream.of(sourceContainers).filter(sourceContainer -> sourceContainer instanceof PackageFragmentRootSourceContainer).map(sourceContainer -> ((PackageFragmentRootSourceContainer) sourceContainer).getPath()).anyMatch(path -> path.lastSegment().endsWith("commons-io-2.5.jar")));
}
use of org.eclipse.debug.core.ILaunchConfiguration in project liferay-ide by liferay.
the class CreateHelper method runTarget.
public void runTarget(IPath createFile, ArrayList<String> arguments, String workingDir) throws CoreException {
if (isLaunchRunning()) {
throw new IllegalStateException("Existing launch in progress");
}
currentCreateFile = createFile;
currentCreateFile.toFile().setExecutable(true);
ILaunchConfiguration launchConfig = createLaunchConfiguration(createFile, arguments, workingDir);
int exitValue = launch(launchConfig, ILaunchManager.RUN_MODE, _monitor);
if (exitValue > 0) {
throw new CoreException(SDKCorePlugin.createErrorStatus("create script failed with error code " + exitValue));
}
currentCreateFile = null;
}
Aggregations