Search in sources :

Example 86 with ILaunchConfiguration

use of org.eclipse.debug.core.ILaunchConfiguration in project titan.EclipsePlug-ins by eclipse.

the class JniExecutor method startSession.

/**
 * Initializes the Executor.
 *
 * @param launch the ILaunch instance to start the session with.
 */
@Override
public void startSession(final ILaunch launch) {
    super.startSession(launch);
    if (automaticExecuteSectionExecution) {
        if (!LaunchStorage.getLaunchElementMap().containsKey(launch)) {
            ILaunchConfiguration launchConfiguration = launch.getLaunchConfiguration();
            LaunchElement launchElement = new LaunchElement(launchConfiguration.getName(), launch);
            LaunchStorage.registerLaunchElement(launchElement);
            ExecutorStorage.registerExecutorStorage(launchElement);
        }
        simpleExecutionRunning = true;
        startTest(true);
    }
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) LaunchElement(org.eclipse.titan.executor.views.executormonitor.LaunchElement)

Example 87 with ILaunchConfiguration

use of org.eclipse.debug.core.ILaunchConfiguration in project titan.EclipsePlug-ins by eclipse.

the class ExecutorMonitorView method removeAllTerminated.

private void removeAllTerminated() {
    if (null == viewer) {
        return;
    }
    for (int i = root.children().size() - 1; i >= 0; i--) {
        LaunchElement element = (LaunchElement) root.children().get(i);
        ILaunch launched = element.launch();
        if (null == launched) {
            // DebugPlugin.getDefault().getLaunchManager().removeLaunch(launched);
            continue;
        }
        ILaunchConfiguration launchConfiguration = launched.getLaunchConfiguration();
        MainControllerElement mainController;
        if (1 == element.children().size()) {
            mainController = (MainControllerElement) element.children().get(0);
        } else {
            mainController = null;
        }
        if (isSupportedConfiguration(launchConfiguration) && null != mainController) {
            BaseExecutor executor = mainController.executor();
            if (executor.isTerminated()) {
                DebugPlugin.getDefault().getLaunchManager().removeLaunch(launched);
            }
        }
    }
    viewer.setSelection(null);
    updateActions();
    PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {

        @Override
        public void run() {
            viewer.refresh(root);
        }
    });
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) BaseExecutor(org.eclipse.titan.executor.executors.BaseExecutor) ILaunch(org.eclipse.debug.core.ILaunch)

Example 88 with ILaunchConfiguration

use of org.eclipse.debug.core.ILaunchConfiguration in project titan.EclipsePlug-ins by eclipse.

the class ExecutorMonitorView method terminateAll.

private void terminateAll() {
    if (null == viewer) {
        return;
    }
    for (int i = root.children().size() - 1; i >= 0; i--) {
        LaunchElement element = (LaunchElement) root.children().get(i);
        ILaunch launched = element.launch();
        ILaunchConfiguration launchConfiguration = launched.getLaunchConfiguration();
        MainControllerElement mainController;
        if (1 == (element).children().size()) {
            mainController = (MainControllerElement) (element).children().get(0);
        } else {
            mainController = null;
        }
        if (isSupportedConfiguration(launchConfiguration) && null != mainController) {
            BaseExecutor executor = mainController.executor();
            if (!executor.isTerminated()) {
                executor.terminate(false);
            }
        }
    }
    updateActions();
    PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {

        @Override
        public void run() {
            viewer.refresh(root);
        }
    });
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) BaseExecutor(org.eclipse.titan.executor.executors.BaseExecutor) ILaunch(org.eclipse.debug.core.ILaunch)

Example 89 with ILaunchConfiguration

use of org.eclipse.debug.core.ILaunchConfiguration in project titan.EclipsePlug-ins by eclipse.

the class ExecutorMonitorView method removeSelected.

private void removeSelected() {
    if (null == viewer || viewer.getSelection().isEmpty()) {
        return;
    }
    IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
    viewer.getTree().setRedraw(false);
    for (Iterator<?> iterator = selection.iterator(); iterator.hasNext(); ) {
        ITreeLeaf element = (ITreeLeaf) iterator.next();
        while (!(element instanceof LaunchElement)) {
            element = element.parent();
        }
        ILaunch launched = ((LaunchElement) element).launch();
        ILaunchConfiguration launchConfiguration = launched.getLaunchConfiguration();
        MainControllerElement mainController;
        if (1 == ((LaunchElement) element).children().size()) {
            mainController = (MainControllerElement) ((LaunchElement) element).children().get(0);
        } else {
            mainController = null;
        }
        if (isSupportedConfiguration(launchConfiguration) && null != mainController) {
            BaseExecutor executor = mainController.executor();
            if (executor.isTerminated()) {
                DebugPlugin.getDefault().getLaunchManager().removeLaunch(launched);
            }
        }
    }
    viewer.setSelection(null);
    updateActions();
    viewer.getTree().setRedraw(true);
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) BaseExecutor(org.eclipse.titan.executor.executors.BaseExecutor) ILaunch(org.eclipse.debug.core.ILaunch) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ITreeLeaf(org.eclipse.titan.executor.executors.ITreeLeaf)

Example 90 with ILaunchConfiguration

use of org.eclipse.debug.core.ILaunchConfiguration in project webtools.servertools by eclipse.

the class AntPublisher method runAnt.

private void runAnt(String buildFile, String targets, Map properties, IProgressMonitor monitor) throws CoreException {
    long time = System.currentTimeMillis();
    ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
    ILaunchConfigurationType type = launchManager.getLaunchConfigurationType(IAntLaunchConfigurationConstants.ID_ANT_LAUNCH_CONFIGURATION_TYPE);
    if (type == null) {
        IStatus s = new Status(IStatus.ERROR, CorePlugin.PLUGIN_ID, 0, GenericServerCoreMessages.antLauncherMissing, null);
        throw new CoreException(s);
    }
    // $NON-NLS-1$
    ILaunchConfigurationWorkingCopy wc = type.newInstance(null, properties.get(PROP_MODULE_NAME) + " module publisher");
    wc.setContainer(null);
    wc.setAttribute(ATTR_LOCATION, buildFile);
    // $NON-NLS-1$
    wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH_PROVIDER, "org.eclipse.ant.ui.AntClasspathProvider");
    wc.setAttribute(IAntLaunchConfigurationConstants.ATTR_ANT_TARGETS, targets);
    wc.setAttribute(IAntLaunchConfigurationConstants.ATTR_ANT_PROPERTIES, properties);
    wc.setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, false);
    wc.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, true);
    wc.setAttribute(IDebugUIConstants.ATTR_PRIVATE, true);
    // $NON-NLS-1$
    wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_SOURCE_PATH_PROVIDER, "org.eclipse.ant.ui.AntClasspathProvider");
    IVMInstall vmInstall = getServerRuntime().getVMInstall();
    if (// fallback to default VM if null.
    vmInstall == null)
        vmInstall = JavaRuntime.getDefaultVMInstall();
    wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH, JavaRuntime.newJREContainerPath(vmInstall).toPortableString());
    wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, // $NON-NLS-1$
    "org.eclipse.ant.internal.ui.antsupport.InternalAntRunner");
    wc.setAttribute(DebugPlugin.ATTR_PROCESS_FACTORY_ID, REMOTE_ANT_PROCESS_FACTORY_ID);
    setupAntLaunchConfiguration(wc);
    if (!monitor.isCanceled()) {
        ILaunchConfiguration launchConfig = wc.doSave();
        launchConfig.launch(ILaunchManager.RUN_MODE, monitor, false, true);
        // $NON-NLS-1$ //$NON-NLS-2$
        Trace.trace(Trace.PERFORMANCE, "AntPublisher.runAnt():<" + (System.currentTimeMillis() - time) + "ms> module: " + getModule()[0]);
    }
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) IStatus(org.eclipse.core.runtime.IStatus) ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) CoreException(org.eclipse.core.runtime.CoreException) IVMInstall(org.eclipse.jdt.launching.IVMInstall) ILaunchConfigurationType(org.eclipse.debug.core.ILaunchConfigurationType) ILaunchManager(org.eclipse.debug.core.ILaunchManager) ILaunchConfigurationWorkingCopy(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)

Aggregations

ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)275 CoreException (org.eclipse.core.runtime.CoreException)100 ILaunchConfigurationWorkingCopy (org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)79 Test (org.junit.Test)72 ILaunchConfigurationType (org.eclipse.debug.core.ILaunchConfigurationType)51 ILaunchManager (org.eclipse.debug.core.ILaunchManager)41 ArrayList (java.util.ArrayList)37 ILaunch (org.eclipse.debug.core.ILaunch)37 IPath (org.eclipse.core.runtime.IPath)20 IProject (org.eclipse.core.resources.IProject)19 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)17 IStatus (org.eclipse.core.runtime.IStatus)16 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)16 IEditorPart (org.eclipse.ui.IEditorPart)15 IProcess (org.eclipse.debug.core.model.IProcess)14 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)14 IFile (org.eclipse.core.resources.IFile)13 Status (org.eclipse.core.runtime.Status)13 CachegrindViewPart (org.eclipse.linuxtools.internal.valgrind.cachegrind.CachegrindViewPart)13 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)11