mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 14:12:10 +02:00
Bug 437392 - Add support for multiple target types per launch thing.
Introduces a whole lot new concepts that will be documented in the wiki. Change-Id: Idd05d5232b88be7ac1d400e5b9618cf08716abf4 Reviewed-on: https://git.eclipse.org/r/29849 Tested-by: Hudson CI Reviewed-by: Doug Schaefer <dschaefer@qnx.com>
This commit is contained in:
parent
8f40037326
commit
b318ffaedb
39 changed files with 1546 additions and 975 deletions
|
@ -1,13 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<?eclipse version="3.4"?>
|
<?eclipse version="3.4"?>
|
||||||
<plugin>
|
<plugin>
|
||||||
<extension
|
|
||||||
id="cdtLaunchConfigProvider"
|
|
||||||
name="CDT Launch Config Provider"
|
|
||||||
point="org.eclipse.cdt.launchbar.core.launchConfigProvider">
|
|
||||||
<provider
|
|
||||||
class="org.eclipse.cdt.launchbar.cdt.core.internal.CDTLaunchConfigProvider"
|
|
||||||
priority="5"></provider>
|
|
||||||
</extension>
|
|
||||||
|
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014 QNX Software Systems and others.
|
||||||
|
* 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:
|
||||||
|
* Doug Schaefer
|
||||||
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.launchbar.cdt.core.internal;
|
package org.eclipse.cdt.launchbar.cdt.core.internal;
|
||||||
|
|
||||||
import org.osgi.framework.BundleActivator;
|
import org.osgi.framework.BundleActivator;
|
||||||
|
@ -5,6 +15,8 @@ import org.osgi.framework.BundleContext;
|
||||||
|
|
||||||
public class Activator implements BundleActivator {
|
public class Activator implements BundleActivator {
|
||||||
|
|
||||||
|
public static final String ID = "org.eclipse.cdt.launchbar.cdt.core";
|
||||||
|
|
||||||
private static BundleContext context;
|
private static BundleContext context;
|
||||||
|
|
||||||
static BundleContext getContext() {
|
static BundleContext getContext() {
|
||||||
|
|
|
@ -1,128 +0,0 @@
|
||||||
package org.eclipse.cdt.launchbar.cdt.core.internal;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
|
||||||
import org.eclipse.cdt.launchbar.core.ILaunchBarManager;
|
|
||||||
import org.eclipse.cdt.launchbar.core.ILaunchConfigurationDescriptor;
|
|
||||||
import org.eclipse.cdt.launchbar.core.ILaunchTarget;
|
|
||||||
import org.eclipse.core.resources.IProject;
|
|
||||||
import org.eclipse.core.resources.IResource;
|
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
|
||||||
import org.eclipse.debug.core.DebugPlugin;
|
|
||||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
|
||||||
import org.eclipse.debug.core.ILaunchConfigurationType;
|
|
||||||
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
|
|
||||||
import org.eclipse.debug.core.ILaunchManager;
|
|
||||||
import org.eclipse.debug.core.ILaunchMode;
|
|
||||||
|
|
||||||
public class CDTLaunchConfigDescriptor implements ILaunchConfigurationDescriptor {
|
|
||||||
|
|
||||||
private final ILaunchBarManager manager;
|
|
||||||
private String projectName;
|
|
||||||
private ILaunchConfiguration config;
|
|
||||||
private ILaunchMode[] launchModes;
|
|
||||||
|
|
||||||
public CDTLaunchConfigDescriptor(ILaunchBarManager manager, IProject project) {
|
|
||||||
this.manager = manager;
|
|
||||||
this.projectName = project.getName();
|
|
||||||
}
|
|
||||||
|
|
||||||
public CDTLaunchConfigDescriptor(ILaunchBarManager manager, ILaunchConfiguration config) {
|
|
||||||
this.manager = manager;
|
|
||||||
this.config = config;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
if (config != null)
|
|
||||||
return config.getName();
|
|
||||||
else
|
|
||||||
return projectName;
|
|
||||||
}
|
|
||||||
|
|
||||||
private ILaunchManager getLaunchManager() {
|
|
||||||
return DebugPlugin.getDefault().getLaunchManager();
|
|
||||||
}
|
|
||||||
|
|
||||||
private IProject getProject() {
|
|
||||||
return ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ILaunchConfiguration getLaunchConfiguration() throws CoreException {
|
|
||||||
if (config == null) {
|
|
||||||
ILaunchConfigurationType configType = config.getType();
|
|
||||||
ILaunchConfigurationWorkingCopy wc = configType.newInstance(null, getLaunchManager().generateLaunchConfigurationName(projectName));
|
|
||||||
wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, projectName);
|
|
||||||
wc.setMappedResources(new IResource[] { getProject() });
|
|
||||||
wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, (String) null);
|
|
||||||
|
|
||||||
// TODO finish this off
|
|
||||||
|
|
||||||
config = wc.doSave();
|
|
||||||
}
|
|
||||||
return config;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean matches(ILaunchConfiguration launchConfiguration) throws CoreException {
|
|
||||||
if (config == launchConfiguration)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
String pname = launchConfiguration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, "");
|
|
||||||
return pname.equals(projectName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ILaunchTarget[] getLaunchTargets() {
|
|
||||||
return new ILaunchTarget[] { manager.getLocalLaunchTarget() };
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ILaunchTarget getLaunchTarget(String id) {
|
|
||||||
ILaunchTarget localTarget = manager.getLocalLaunchTarget();
|
|
||||||
if (localTarget.getId().equals(id))
|
|
||||||
return localTarget;
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setActiveLaunchTarget(ILaunchTarget target) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ILaunchMode[] getLaunchModes() throws CoreException {
|
|
||||||
if (launchModes == null) {
|
|
||||||
List<ILaunchMode> mymodes = new ArrayList<>();
|
|
||||||
ILaunchConfigurationType type = config.getType();
|
|
||||||
ILaunchMode[] modes = DebugPlugin.getDefault().getLaunchManager().getLaunchModes();
|
|
||||||
for (ILaunchMode mode : modes) {
|
|
||||||
if (type.supportsMode(mode.getIdentifier())) {
|
|
||||||
mymodes.add(mode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
launchModes = mymodes.toArray(new ILaunchMode[mymodes.size()]);
|
|
||||||
}
|
|
||||||
return launchModes;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ILaunchMode getLaunchMode(String id) throws CoreException {
|
|
||||||
for (ILaunchMode mode : getLaunchModes())
|
|
||||||
if (mode.getIdentifier().equals(id))
|
|
||||||
return mode;
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setActiveLaunchMode(ILaunchMode mode) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,24 +0,0 @@
|
||||||
package org.eclipse.cdt.launchbar.cdt.core.internal;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.launchbar.core.ILaunchBarManager;
|
|
||||||
import org.eclipse.cdt.launchbar.core.ILaunchConfigurationDescriptor;
|
|
||||||
import org.eclipse.cdt.launchbar.core.ILaunchConfigurationsProvider;
|
|
||||||
|
|
||||||
public class CDTLaunchConfigProvider implements ILaunchConfigurationsProvider {
|
|
||||||
|
|
||||||
public CDTLaunchConfigProvider() {
|
|
||||||
// TODO Auto-generated constructor stub
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void init(ILaunchBarManager manager) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ILaunchConfigurationDescriptor filterDescriptor(ILaunchBarManager manager, ILaunchConfigurationDescriptor descriptor) {
|
|
||||||
return descriptor;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,6 +1,28 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<?eclipse version="3.4"?>
|
<?eclipse version="3.4"?>
|
||||||
<plugin>
|
<plugin>
|
||||||
<extension-point id="launchConfigProvider" name="Launch Configuration Descriptor Provider" schema="schema/launchConfigProvider.exsd"/>
|
<extension-point id="launchBarContributions" name="Launch Bar Contributions" schema="schema/launchBarContributions.exsd"/>
|
||||||
|
<extension
|
||||||
|
point="org.eclipse.cdt.launchbar.core.launchBarContributions">
|
||||||
|
<descriptorType
|
||||||
|
class="org.eclipse.cdt.launchbar.core.internal.DefaultLaunchDescriptorType"
|
||||||
|
id="org.eclipse.cdt.launchbar.core.descriptor.default"
|
||||||
|
priority="0">
|
||||||
|
</descriptorType>
|
||||||
|
<targetType
|
||||||
|
class="org.eclipse.cdt.launchbar.core.internal.LocalTargetType"
|
||||||
|
id="org.eclipse.cdt.launchbar.core.target.local">
|
||||||
|
</targetType>
|
||||||
|
<configProvider
|
||||||
|
class="org.eclipse.cdt.launchbar.core.internal.DefaultLaunchConfigurationProvider"
|
||||||
|
descriptorType="org.eclipse.cdt.launchbar.core.descriptor.default"
|
||||||
|
isDefault="true"
|
||||||
|
targetType="org.eclipse.cdt.launchbar.core.target.local">
|
||||||
|
</configProvider>
|
||||||
|
<objectProvider
|
||||||
|
class="org.eclipse.cdt.launchbar.core.internal.ProjectLaunchObjectProvider"
|
||||||
|
id="org.eclipse.cdt.launchbar.core.objectProvider.project">
|
||||||
|
</objectProvider>
|
||||||
|
</extension>
|
||||||
|
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
@ -0,0 +1,205 @@
|
||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<!-- Schema file written by PDE -->
|
||||||
|
<schema targetNamespace="org.eclipse.cdt.launchbar.core" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||||
|
<annotation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.schema plugin="org.eclipse.cdt.launchbar.core" id="launchBarContributions" name="Launch Bar Contributions"/>
|
||||||
|
</appinfo>
|
||||||
|
<documentation>
|
||||||
|
[Enter description of this extension point.]
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
<element name="extension">
|
||||||
|
<annotation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.element />
|
||||||
|
</appinfo>
|
||||||
|
</annotation>
|
||||||
|
<complexType>
|
||||||
|
<sequence minOccurs="0" maxOccurs="unbounded">
|
||||||
|
<element ref="descriptorType"/>
|
||||||
|
<element ref="targetType"/>
|
||||||
|
<element ref="configProvider"/>
|
||||||
|
<element ref="objectProvider"/>
|
||||||
|
</sequence>
|
||||||
|
<attribute name="point" type="string" use="required">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="id" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="name" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.attribute translatable="true"/>
|
||||||
|
</appinfo>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
</complexType>
|
||||||
|
</element>
|
||||||
|
|
||||||
|
<element name="descriptorType">
|
||||||
|
<complexType>
|
||||||
|
<attribute name="id" type="string" use="required">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="priority" type="string" use="required">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="class" type="string" use="required">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.attribute kind="java" basedOn=":org.eclipse.cdt.launchbar.core.ILaunchDescriptorType"/>
|
||||||
|
</appinfo>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
</complexType>
|
||||||
|
</element>
|
||||||
|
|
||||||
|
<element name="targetType">
|
||||||
|
<complexType>
|
||||||
|
<attribute name="id" type="string" use="required">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="class" type="string" use="required">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.attribute kind="java" basedOn=":org.eclipse.cdt.launchbar.core.ILaunchTargetType"/>
|
||||||
|
</appinfo>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
</complexType>
|
||||||
|
</element>
|
||||||
|
|
||||||
|
<element name="configProvider">
|
||||||
|
<complexType>
|
||||||
|
<attribute name="descriptorType" type="string" use="required">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.attribute kind="identifier" basedOn="org.eclipse.cdt.launchbar.core.launchBarContributions/descriptorType/@id"/>
|
||||||
|
</appinfo>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="targetType" type="string" use="required">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.attribute kind="identifier" basedOn="org.eclipse.cdt.launchbar.core.launchBarContributions/targetType/@id"/>
|
||||||
|
</appinfo>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="class" type="string" use="required">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.attribute kind="java" basedOn=":org.eclipse.cdt.launchbar.core.ILaunchConfigurationProvider"/>
|
||||||
|
</appinfo>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="isDefault" type="boolean">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
Is this the default target type for this descriptor type.
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
</complexType>
|
||||||
|
</element>
|
||||||
|
|
||||||
|
<element name="objectProvider">
|
||||||
|
<complexType>
|
||||||
|
<attribute name="id" type="string" use="required">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="class" type="string" use="required">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.attribute kind="java" basedOn=":org.eclipse.cdt.launchbar.core.ILaunchObjectProvider"/>
|
||||||
|
</appinfo>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
</complexType>
|
||||||
|
</element>
|
||||||
|
|
||||||
|
<annotation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.section type="since"/>
|
||||||
|
</appinfo>
|
||||||
|
<documentation>
|
||||||
|
[Enter the first release in which this extension point appears.]
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
<annotation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.section type="examples"/>
|
||||||
|
</appinfo>
|
||||||
|
<documentation>
|
||||||
|
[Enter extension point usage example here.]
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
<annotation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.section type="apiinfo"/>
|
||||||
|
</appinfo>
|
||||||
|
<documentation>
|
||||||
|
[Enter API information here.]
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
<annotation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.section type="implementation"/>
|
||||||
|
</appinfo>
|
||||||
|
<documentation>
|
||||||
|
[Enter information about supplied implementation of this extension point.]
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
|
||||||
|
</schema>
|
|
@ -1,109 +0,0 @@
|
||||||
<?xml version='1.0' encoding='UTF-8'?>
|
|
||||||
<!-- Schema file written by PDE -->
|
|
||||||
<schema targetNamespace="org.eclipse.cdt.launchbar.core" xmlns="http://www.w3.org/2001/XMLSchema">
|
|
||||||
<annotation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.schema plugin="org.eclipse.cdt.launchbar.core" id="launchConfigProvider" name="Launch Configuration Descriptor Provider"/>
|
|
||||||
</appinfo>
|
|
||||||
<documentation>
|
|
||||||
[Enter description of this extension point.]
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
|
|
||||||
<element name="extension">
|
|
||||||
<annotation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.element />
|
|
||||||
</appinfo>
|
|
||||||
</annotation>
|
|
||||||
<complexType>
|
|
||||||
<sequence>
|
|
||||||
<element ref="provider"/>
|
|
||||||
</sequence>
|
|
||||||
<attribute name="point" type="string" use="required">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="id" type="string">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="name" type="string">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
|
|
||||||
</documentation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.attribute translatable="true"/>
|
|
||||||
</appinfo>
|
|
||||||
</annotation>
|
|
||||||
</attribute>
|
|
||||||
</complexType>
|
|
||||||
</element>
|
|
||||||
|
|
||||||
<element name="provider">
|
|
||||||
<complexType>
|
|
||||||
<attribute name="class" type="string">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
|
|
||||||
</documentation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.attribute kind="java" basedOn=":org.eclipse.cdt.launchbar.core.ILaunchConfigurationsProvider"/>
|
|
||||||
</appinfo>
|
|
||||||
</annotation>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="priority" type="string">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
</attribute>
|
|
||||||
</complexType>
|
|
||||||
</element>
|
|
||||||
|
|
||||||
<annotation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.section type="since"/>
|
|
||||||
</appinfo>
|
|
||||||
<documentation>
|
|
||||||
[Enter the first release in which this extension point appears.]
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
|
|
||||||
<annotation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.section type="examples"/>
|
|
||||||
</appinfo>
|
|
||||||
<documentation>
|
|
||||||
[Enter extension point usage example here.]
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
|
|
||||||
<annotation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.section type="apiinfo"/>
|
|
||||||
</appinfo>
|
|
||||||
<documentation>
|
|
||||||
[Enter API information here.]
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
|
|
||||||
<annotation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.section type="implementation"/>
|
|
||||||
</appinfo>
|
|
||||||
<documentation>
|
|
||||||
[Enter information about supplied implementation of this extension point.]
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
|
|
||||||
|
|
||||||
</schema>
|
|
|
@ -13,48 +13,53 @@ package org.eclipse.cdt.launchbar.core;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IAdaptable;
|
import org.eclipse.core.runtime.IAdaptable;
|
||||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||||
|
import org.eclipse.debug.core.ILaunchConfigurationType;
|
||||||
import org.eclipse.debug.core.ILaunchMode;
|
import org.eclipse.debug.core.ILaunchMode;
|
||||||
|
|
||||||
public interface ILaunchBarManager extends IAdaptable {
|
public interface ILaunchBarManager extends IAdaptable {
|
||||||
|
|
||||||
ILaunchConfigurationDescriptor[] getLaunchConfigurationDescriptors();
|
ILaunchDescriptor[] getLaunchDescriptors() throws CoreException;
|
||||||
|
|
||||||
ILaunchConfigurationDescriptor getActiveLaunchConfigurationDescriptor();
|
ILaunchDescriptor getActiveLaunchDescriptor() throws CoreException;
|
||||||
|
|
||||||
void setActiveLaunchConfigurationDescriptor(ILaunchConfigurationDescriptor configDesc) throws CoreException;
|
void setActiveLaunchDescriptor(ILaunchDescriptor configDesc) throws CoreException;
|
||||||
|
|
||||||
void addLaunchConfigurationDescriptor(ILaunchConfigurationDescriptor configDesc) throws CoreException;
|
|
||||||
|
|
||||||
void removeLaunchConfigurationDescriptor(ILaunchConfigurationDescriptor configDesc);
|
|
||||||
|
|
||||||
ILaunchConfigurationDescriptor getLaunchConfigurationDescriptor(ILaunchConfiguration configuration) throws CoreException;
|
|
||||||
|
|
||||||
ILaunchMode getActiveLaunchMode();
|
ILaunchMode[] getLaunchModes() throws CoreException;
|
||||||
|
|
||||||
|
ILaunchMode getActiveLaunchMode() throws CoreException;
|
||||||
|
|
||||||
|
void setActiveLaunchMode(ILaunchMode mode) throws CoreException;
|
||||||
|
|
||||||
|
ILaunchTarget[] getLaunchTargets() throws CoreException;
|
||||||
|
|
||||||
void setActiveLaunchMode(ILaunchMode mode);
|
ILaunchTarget getLaunchTarget(String id) throws CoreException;
|
||||||
|
|
||||||
ILaunchTarget getActiveLaunchTarget();
|
ILaunchTarget getActiveLaunchTarget() throws CoreException;
|
||||||
|
|
||||||
void setActiveLaunchTarget(ILaunchTarget target);
|
void setActiveLaunchTarget(ILaunchTarget target) throws CoreException;
|
||||||
|
|
||||||
void addLaunchTarget(ILaunchTarget target);
|
ILaunchConfigurationType getLaunchConfigurationType(ILaunchDescriptor descriptor, ILaunchTarget target) throws CoreException;
|
||||||
|
|
||||||
void removeLaunchTarget(ILaunchTarget target);
|
ILaunchConfiguration getLaunchConfiguration(ILaunchDescriptor descriptor, ILaunchTarget target) throws CoreException;
|
||||||
|
|
||||||
ILaunchTarget getLocalLaunchTarget();
|
ILaunchDescriptor launchObjectAdded(Object element) throws CoreException;
|
||||||
|
|
||||||
|
void launchObjectRemoved(Object element) throws CoreException;
|
||||||
|
|
||||||
interface Listener {
|
interface Listener {
|
||||||
|
|
||||||
void activeConfigurationDescriptorChanged();
|
void activeConfigurationDescriptorChanged();
|
||||||
|
|
||||||
void activeLaunchModeChanged();
|
void activeLaunchModeChanged();
|
||||||
|
|
||||||
void activeLaunchTargetChanged();
|
void activeLaunchTargetChanged();
|
||||||
|
|
||||||
|
void launchDescriptorRemoved(ILaunchDescriptor descriptor);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void addListener(Listener listener);
|
void addListener(Listener listener);
|
||||||
|
|
||||||
void removeListener(Listener listener);
|
void removeListener(Listener listener);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,92 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2014 QNX Software Systems and others.
|
|
||||||
* 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:
|
|
||||||
* Doug Schaefer
|
|
||||||
*******************************************************************************/
|
|
||||||
package org.eclipse.cdt.launchbar.core;
|
|
||||||
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
|
||||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
|
||||||
import org.eclipse.debug.core.ILaunchMode;
|
|
||||||
|
|
||||||
public interface ILaunchConfigurationDescriptor {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Name to show in the launch configuration selector.
|
|
||||||
*
|
|
||||||
* @return name of the launch configuration
|
|
||||||
*/
|
|
||||||
String getName();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The corresponding launch configuration.
|
|
||||||
* If this launch config hasn't been created yet, it will be
|
|
||||||
*
|
|
||||||
* @return the corresponding launch configuration
|
|
||||||
* @throws CoreException
|
|
||||||
*/
|
|
||||||
ILaunchConfiguration getLaunchConfiguration() throws CoreException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Is this launch configuration managed by this descriptor.
|
|
||||||
*
|
|
||||||
* @param launchConfiguration
|
|
||||||
* @return
|
|
||||||
* @throws CoreException
|
|
||||||
*/
|
|
||||||
boolean matches(ILaunchConfiguration launchConfiguration) throws CoreException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the list of launch targets this configuration can launcht to.
|
|
||||||
*
|
|
||||||
* @return launch targets
|
|
||||||
*/
|
|
||||||
ILaunchTarget[] getLaunchTargets();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the launch target with the given id.
|
|
||||||
*
|
|
||||||
* @param id id of target
|
|
||||||
* @return launch target
|
|
||||||
*/
|
|
||||||
ILaunchTarget getLaunchTarget(String id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the active launch target. Allows the descriptor to prepare for
|
|
||||||
* a launch on that target.
|
|
||||||
*
|
|
||||||
* @param target the new active launch target
|
|
||||||
*/
|
|
||||||
void setActiveLaunchTarget(ILaunchTarget target);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the launch modes supported by this descriptor.
|
|
||||||
*
|
|
||||||
* @return launch modes
|
|
||||||
* @throws CoreException
|
|
||||||
*/
|
|
||||||
ILaunchMode[] getLaunchModes() throws CoreException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the launch mode with the given identifier.
|
|
||||||
*
|
|
||||||
* @param id
|
|
||||||
* @return launch mode with id
|
|
||||||
* @throws CoreException
|
|
||||||
*/
|
|
||||||
ILaunchMode getLaunchMode(String id) throws CoreException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the active launch mode. Allows the descriptor to prepare for a
|
|
||||||
* launch in that mode.
|
|
||||||
*
|
|
||||||
* @param mode the new active launch mode
|
|
||||||
*/
|
|
||||||
void setActiveLaunchMode(ILaunchMode mode);
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,65 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014 QNX Software Systems and others.
|
||||||
|
* 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:
|
||||||
|
* Doug Schaefer
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.launchbar.core;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||||
|
import org.eclipse.debug.core.ILaunchConfigurationType;
|
||||||
|
|
||||||
|
public interface ILaunchConfigurationProvider {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Do any initialization.
|
||||||
|
*
|
||||||
|
* @param manager
|
||||||
|
* @throws CoreException
|
||||||
|
*/
|
||||||
|
void init(ILaunchBarManager manager) throws CoreException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Does this provider own this launch configuration. If so, make sure the launch descriptor
|
||||||
|
* is properly constructed by sending in a launch object to the launch manager.
|
||||||
|
*
|
||||||
|
* @param configuration
|
||||||
|
* @return
|
||||||
|
* @throws CoreException
|
||||||
|
*/
|
||||||
|
boolean ownsLaunchConfiguration(ILaunchConfiguration configuration) throws CoreException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the launch configuration type used to launch the descriptor on this target type.
|
||||||
|
*
|
||||||
|
* @param descriptor
|
||||||
|
* @param target
|
||||||
|
* @return launch configuration type
|
||||||
|
* @throws CoreException
|
||||||
|
*/
|
||||||
|
ILaunchConfigurationType getLaunchConfigurationType(ILaunchDescriptor descriptor) throws CoreException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a launch configuration for the descriptor to launch on the target.
|
||||||
|
*
|
||||||
|
* @param descriptor
|
||||||
|
* @param target
|
||||||
|
* @return launch configuration
|
||||||
|
* @throws CoreException
|
||||||
|
*/
|
||||||
|
ILaunchConfiguration getLaunchConfiguration(ILaunchDescriptor descriptor) throws CoreException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A launch configuration has been removed.
|
||||||
|
*
|
||||||
|
* @param configuration
|
||||||
|
* @throws CoreException
|
||||||
|
*/
|
||||||
|
void launchConfigurationRemoved(ILaunchConfiguration configuration) throws CoreException;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014 QNX Software Systems and others.
|
||||||
|
* 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:
|
||||||
|
* Doug Schaefer
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.launchbar.core;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a thing that can be launched.
|
||||||
|
*/
|
||||||
|
public interface ILaunchDescriptor {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name to show in the launch descriptor selector.
|
||||||
|
*
|
||||||
|
* @return name of the launch descriptor
|
||||||
|
*/
|
||||||
|
String getName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of launch descriptor.
|
||||||
|
*
|
||||||
|
* @return provider
|
||||||
|
*/
|
||||||
|
ILaunchDescriptorType getType();
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,64 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014 QNX Software Systems and others.
|
||||||
|
* 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:
|
||||||
|
* Doug Schaefer
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.launchbar.core;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides the list of launch configurations
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface ILaunchDescriptorType {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The id for the provider.
|
||||||
|
*
|
||||||
|
* @return provider id
|
||||||
|
*/
|
||||||
|
String getId();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called after existing launch configs have been added. The provider
|
||||||
|
* can now add any more that they'd like to have.
|
||||||
|
*/
|
||||||
|
void init(ILaunchBarManager manager);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Does this type own this launch element.
|
||||||
|
*
|
||||||
|
* @param element
|
||||||
|
* @return owns element
|
||||||
|
* @throws CoreException
|
||||||
|
*/
|
||||||
|
boolean ownsLaunchObject(Object element) throws CoreException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a descriptor for the given element. The element can be a launch
|
||||||
|
* configuration, a project, or anything else that gets fed to the
|
||||||
|
* launch bar manager.
|
||||||
|
*
|
||||||
|
* May return null to essentially eat the element so no other types
|
||||||
|
* create a descriptor for it.
|
||||||
|
*
|
||||||
|
* @param descriptor candidate descriptor
|
||||||
|
* @return the best descriptor
|
||||||
|
* @throws CoreException
|
||||||
|
*/
|
||||||
|
ILaunchDescriptor getDescriptor(Object element) throws CoreException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a handle to the launch bar manager.
|
||||||
|
*
|
||||||
|
* @return launchbar manager
|
||||||
|
*/
|
||||||
|
ILaunchBarManager getManager();
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package org.eclipse.cdt.launchbar.core;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An extension that serves up objects to feed launch descriptors.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface ILaunchObjectProvider {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add initial launch descriptors and set up listeners.
|
||||||
|
*
|
||||||
|
* @param launchbar manager
|
||||||
|
*/
|
||||||
|
void init(ILaunchBarManager manager);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shutting down, remove any listeners.
|
||||||
|
*/
|
||||||
|
void dispose();
|
||||||
|
|
||||||
|
}
|
|
@ -26,4 +26,17 @@ public interface ILaunchTarget {
|
||||||
* @return name
|
* @return name
|
||||||
*/
|
*/
|
||||||
String getName();
|
String getName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the type for this target.
|
||||||
|
*
|
||||||
|
* @return target type
|
||||||
|
*/
|
||||||
|
ILaunchTargetType getType();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This target has been made active.
|
||||||
|
*/
|
||||||
|
void setActive();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,25 +10,35 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.launchbar.core;
|
package org.eclipse.cdt.launchbar.core;
|
||||||
|
|
||||||
/**
|
public interface ILaunchTargetType {
|
||||||
* Provides the list of launch configurations
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public interface ILaunchConfigurationsProvider {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called after existing launch configs have been added. The provider
|
* Called by the launchbar manager to initialize and pass a hendle to itself.
|
||||||
* can now add any more that they'd like to have.
|
*
|
||||||
|
* @param manager
|
||||||
*/
|
*/
|
||||||
void init(ILaunchBarManager manager);
|
void init(ILaunchBarManager manager);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the provider has a better descriptor than the suggested one, return a better one.
|
* The id of the target type.
|
||||||
* Otherwise, return the one that was passed in.
|
|
||||||
*
|
*
|
||||||
* @param descriptor candidate descriptor
|
* @return target type id
|
||||||
* @return the best descriptor
|
|
||||||
*/
|
*/
|
||||||
ILaunchConfigurationDescriptor filterDescriptor(ILaunchBarManager manager, ILaunchConfigurationDescriptor descriptor);
|
String getId();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the list of targets for this type.
|
||||||
|
*
|
||||||
|
* @return targets
|
||||||
|
*/
|
||||||
|
ILaunchTarget[] getTargets();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the target with the specified id.
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return target
|
||||||
|
*/
|
||||||
|
ILaunchTarget getTarget(String id);
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,96 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2014 QNX Software Systems and others.
|
|
||||||
* 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:
|
|
||||||
* Doug Schaefer
|
|
||||||
*******************************************************************************/
|
|
||||||
package org.eclipse.cdt.launchbar.core.internal;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.launchbar.core.ILaunchBarManager;
|
|
||||||
import org.eclipse.cdt.launchbar.core.ILaunchConfigurationDescriptor;
|
|
||||||
import org.eclipse.cdt.launchbar.core.ILaunchTarget;
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
|
||||||
import org.eclipse.debug.core.DebugPlugin;
|
|
||||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
|
||||||
import org.eclipse.debug.core.ILaunchConfigurationType;
|
|
||||||
import org.eclipse.debug.core.ILaunchMode;
|
|
||||||
|
|
||||||
public class DefaultLaunchConfigurationDescriptor implements ILaunchConfigurationDescriptor {
|
|
||||||
|
|
||||||
private final ILaunchBarManager manager;
|
|
||||||
private ILaunchConfiguration config;
|
|
||||||
private ILaunchMode[] launchModes;
|
|
||||||
|
|
||||||
public DefaultLaunchConfigurationDescriptor(ILaunchBarManager manager, ILaunchConfiguration config) {
|
|
||||||
this.manager = manager;
|
|
||||||
this.config = config;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return config.getName();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ILaunchConfiguration getLaunchConfiguration() throws CoreException {
|
|
||||||
return config;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean matches(ILaunchConfiguration launchConfiguration) {
|
|
||||||
return config.equals(launchConfiguration);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ILaunchTarget getLaunchTarget(String id) {
|
|
||||||
return LocalTarget.ID.equals(id) ? manager.getLocalLaunchTarget() : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ILaunchTarget[] getLaunchTargets() {
|
|
||||||
return new ILaunchTarget[] { manager.getLocalLaunchTarget() };
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setActiveLaunchTarget(ILaunchTarget target) {
|
|
||||||
// nothing to do
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ILaunchMode[] getLaunchModes() throws CoreException {
|
|
||||||
if (launchModes == null) {
|
|
||||||
List<ILaunchMode> mymodes = new ArrayList<>();
|
|
||||||
ILaunchConfigurationType type = config.getType();
|
|
||||||
ILaunchMode[] modes = DebugPlugin.getDefault().getLaunchManager().getLaunchModes();
|
|
||||||
for (ILaunchMode mode : modes) {
|
|
||||||
if (type.supportsMode(mode.getIdentifier())) {
|
|
||||||
mymodes.add(mode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
launchModes = mymodes.toArray(new ILaunchMode[mymodes.size()]);
|
|
||||||
}
|
|
||||||
return launchModes;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ILaunchMode getLaunchMode(String id) throws CoreException {
|
|
||||||
for (ILaunchMode mode : getLaunchModes()) {
|
|
||||||
if (mode.getIdentifier().equals(id))
|
|
||||||
return mode;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setActiveLaunchMode(ILaunchMode mode) {
|
|
||||||
// nothing to do
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
package org.eclipse.cdt.launchbar.core.internal;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.launchbar.core.ILaunchBarManager;
|
||||||
|
import org.eclipse.cdt.launchbar.core.ILaunchConfigurationProvider;
|
||||||
|
import org.eclipse.cdt.launchbar.core.ILaunchDescriptor;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||||
|
import org.eclipse.debug.core.ILaunchConfigurationType;
|
||||||
|
|
||||||
|
public class DefaultLaunchConfigurationProvider implements ILaunchConfigurationProvider {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(ILaunchBarManager manager) throws CoreException {
|
||||||
|
// nothing to do
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean ownsLaunchConfiguration(ILaunchConfiguration configuration) throws CoreException {
|
||||||
|
// We may own it but return false to let it percolate through to the descriptor type.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ILaunchConfiguration getLaunchConfiguration(ILaunchDescriptor descriptor) throws CoreException {
|
||||||
|
if (descriptor instanceof DefaultLaunchDescriptor) {
|
||||||
|
return ((DefaultLaunchDescriptor) descriptor).getConfig();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ILaunchConfigurationType getLaunchConfigurationType(ILaunchDescriptor descriptor) throws CoreException {
|
||||||
|
if (descriptor instanceof DefaultLaunchDescriptor) {
|
||||||
|
return ((DefaultLaunchDescriptor) descriptor).getConfig().getType();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void launchConfigurationRemoved(ILaunchConfiguration configation) throws CoreException {
|
||||||
|
// The descriptor will handle the remove.
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014 QNX Software Systems and others.
|
||||||
|
* 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:
|
||||||
|
* Doug Schaefer
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.launchbar.core.internal;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.launchbar.core.ILaunchDescriptor;
|
||||||
|
import org.eclipse.cdt.launchbar.core.ILaunchDescriptorType;
|
||||||
|
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||||
|
|
||||||
|
public class DefaultLaunchDescriptor implements ILaunchDescriptor {
|
||||||
|
|
||||||
|
private final DefaultLaunchDescriptorType type;
|
||||||
|
private final ILaunchConfiguration config;
|
||||||
|
|
||||||
|
public DefaultLaunchDescriptor(DefaultLaunchDescriptorType type, ILaunchConfiguration config) {
|
||||||
|
this.type = type;
|
||||||
|
this.config = config;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return config.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ILaunchDescriptorType getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ILaunchConfiguration getConfig() {
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
package org.eclipse.cdt.launchbar.core.internal;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.launchbar.core.ILaunchBarManager;
|
||||||
|
import org.eclipse.cdt.launchbar.core.ILaunchDescriptor;
|
||||||
|
import org.eclipse.cdt.launchbar.core.ILaunchDescriptorType;
|
||||||
|
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||||
|
|
||||||
|
public class DefaultLaunchDescriptorType implements ILaunchDescriptorType {
|
||||||
|
|
||||||
|
public static final String ID = "org.eclipse.cdt.launchbar.core.descriptor.default";
|
||||||
|
|
||||||
|
private ILaunchBarManager manager;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getId() {
|
||||||
|
return ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(ILaunchBarManager manager) {
|
||||||
|
this.manager = manager;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean ownsLaunchObject(Object element) {
|
||||||
|
return element instanceof ILaunchConfiguration;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ILaunchDescriptor getDescriptor(Object element) {
|
||||||
|
return new DefaultLaunchDescriptor(this, (ILaunchConfiguration) element);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ILaunchBarManager getManager() {
|
||||||
|
return manager;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -20,9 +20,12 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.launchbar.core.ILaunchBarManager;
|
import org.eclipse.cdt.launchbar.core.ILaunchBarManager;
|
||||||
import org.eclipse.cdt.launchbar.core.ILaunchConfigurationDescriptor;
|
import org.eclipse.cdt.launchbar.core.ILaunchConfigurationProvider;
|
||||||
import org.eclipse.cdt.launchbar.core.ILaunchConfigurationsProvider;
|
import org.eclipse.cdt.launchbar.core.ILaunchDescriptor;
|
||||||
|
import org.eclipse.cdt.launchbar.core.ILaunchDescriptorType;
|
||||||
|
import org.eclipse.cdt.launchbar.core.ILaunchObjectProvider;
|
||||||
import org.eclipse.cdt.launchbar.core.ILaunchTarget;
|
import org.eclipse.cdt.launchbar.core.ILaunchTarget;
|
||||||
|
import org.eclipse.cdt.launchbar.core.ILaunchTargetType;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IConfigurationElement;
|
import org.eclipse.core.runtime.IConfigurationElement;
|
||||||
import org.eclipse.core.runtime.IExtension;
|
import org.eclipse.core.runtime.IExtension;
|
||||||
|
@ -34,6 +37,7 @@ import org.eclipse.core.runtime.preferences.InstanceScope;
|
||||||
import org.eclipse.debug.core.DebugPlugin;
|
import org.eclipse.debug.core.DebugPlugin;
|
||||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||||
import org.eclipse.debug.core.ILaunchConfigurationListener;
|
import org.eclipse.debug.core.ILaunchConfigurationListener;
|
||||||
|
import org.eclipse.debug.core.ILaunchConfigurationType;
|
||||||
import org.eclipse.debug.core.ILaunchManager;
|
import org.eclipse.debug.core.ILaunchManager;
|
||||||
import org.eclipse.debug.core.ILaunchMode;
|
import org.eclipse.debug.core.ILaunchMode;
|
||||||
import org.osgi.service.prefs.BackingStoreException;
|
import org.osgi.service.prefs.BackingStoreException;
|
||||||
|
@ -42,142 +46,183 @@ import org.osgi.service.prefs.Preferences;
|
||||||
public class LaunchBarManager extends PlatformObject implements ILaunchBarManager, ILaunchConfigurationListener {
|
public class LaunchBarManager extends PlatformObject implements ILaunchBarManager, ILaunchConfigurationListener {
|
||||||
|
|
||||||
private List<Listener> listeners = new LinkedList<>();
|
private List<Listener> listeners = new LinkedList<>();
|
||||||
private List<ProviderExtensionDescriptor> providers = new ArrayList<>();
|
private Map<String, ILaunchTargetType> targetTypes = new HashMap<>();
|
||||||
private Map<String, ILaunchConfigurationDescriptor> configDescs = new HashMap<>();
|
private List<ILaunchDescriptorType> descriptorTypes = new ArrayList<>();
|
||||||
private ILaunchConfigurationDescriptor lastConfigDesc;
|
private Map<String, ILaunchDescriptor> descriptors = new HashMap<>();
|
||||||
|
private List<ILaunchObjectProvider> objectProviders = new ArrayList<>();
|
||||||
private ILaunchConfigurationDescriptor activeConfigDesc;
|
// Map descriptor type to target type to provider
|
||||||
|
private Map<String, Map<String, ILaunchConfigurationProvider>> configProviders = new HashMap<>();
|
||||||
|
// Map descriptor type to target type
|
||||||
|
private Map<String, String> defaultTargetTypes = new HashMap<>();
|
||||||
|
private Map<Object, ILaunchDescriptor> objectDescriptorMap = new HashMap<>();
|
||||||
|
|
||||||
|
private ILaunchDescriptor activeLaunchDesc;
|
||||||
private ILaunchMode activeLaunchMode;
|
private ILaunchMode activeLaunchMode;
|
||||||
private ILaunchTarget activeLaunchTarget;
|
private ILaunchTarget activeLaunchTarget;
|
||||||
|
|
||||||
private static final LocalTarget localLaunchTarget = new LocalTarget();
|
private ILaunchDescriptor lastLaunchDesc;
|
||||||
|
|
||||||
private static final String PREF_ACTIVE_CONFIG_DESC = "activeConfigDesc";
|
private static final String PREF_ACTIVE_CONFIG_DESC = "activeConfigDesc";
|
||||||
private static final String PREF_ACTIVE_LAUNCH_MODE = "activeLaunchMode";
|
private static final String PREF_ACTIVE_LAUNCH_MODE = "activeLaunchMode";
|
||||||
private static final String PREF_ACTIVE_LAUNCH_TARGET = "activeLaunchTarget";
|
private static final String PREF_ACTIVE_LAUNCH_TARGET = "activeLaunchTarget";
|
||||||
|
|
||||||
private class ProviderExtensionDescriptor {
|
|
||||||
private ILaunchConfigurationsProvider provider;
|
|
||||||
private int priority;
|
|
||||||
|
|
||||||
public ProviderExtensionDescriptor(ILaunchConfigurationsProvider provider, int priority) {
|
|
||||||
super();
|
|
||||||
this.provider = provider;
|
|
||||||
this.priority = priority;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ILaunchConfigurationsProvider getProvider() {
|
|
||||||
return provider;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getPriority() {
|
|
||||||
return priority;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public LaunchBarManager() throws CoreException {
|
public LaunchBarManager() throws CoreException {
|
||||||
IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(Activator.PLUGIN_ID, "launchConfigProvider");
|
final Map<ILaunchDescriptorType, Integer> typePriorities = new HashMap<>();
|
||||||
|
|
||||||
|
IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(Activator.PLUGIN_ID, "launchBarContributions");
|
||||||
IExtension[] extensions = point.getExtensions();
|
IExtension[] extensions = point.getExtensions();
|
||||||
for (IExtension extension : extensions) {
|
for (IExtension extension : extensions) {
|
||||||
// provider is manditory
|
for (IConfigurationElement element : extension.getConfigurationElements()) {
|
||||||
IConfigurationElement element = extension.getConfigurationElements()[0];
|
String elementName = element.getName();
|
||||||
ILaunchConfigurationsProvider provider = (ILaunchConfigurationsProvider) element.createExecutableExtension("class");
|
if (elementName.equals("descriptorType")) {
|
||||||
String priorityString = element.getAttribute("priority");
|
String id = element.getAttribute("id");
|
||||||
int priority = 100;
|
String priorityStr = element.getAttribute("priority");
|
||||||
if (priorityString != null) {
|
ILaunchDescriptorType type = (ILaunchDescriptorType) element.createExecutableExtension("class");
|
||||||
try {
|
|
||||||
priority = Integer.parseInt(priorityString);
|
assert id.equals(type.getId());
|
||||||
} catch (NumberFormatException e) {
|
descriptorTypes.add(type);
|
||||||
// Log it but keep going with the default
|
|
||||||
Activator.log(e);
|
int priority = 1;
|
||||||
|
if (priorityStr != null) {
|
||||||
|
try {
|
||||||
|
priority = Integer.parseInt(priorityStr);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
// Log it but keep going with the default
|
||||||
|
Activator.log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
typePriorities.put(type, priority);
|
||||||
|
} else if (elementName.equals("targetType")) {
|
||||||
|
String id = element.getAttribute("id");
|
||||||
|
ILaunchTargetType targetType = (ILaunchTargetType) element.createExecutableExtension("class");
|
||||||
|
|
||||||
|
assert id.equals(targetType.getId());
|
||||||
|
targetTypes.put(id, targetType);
|
||||||
|
} else if (elementName.equals("objectProvider")) {
|
||||||
|
ILaunchObjectProvider objectProvider = (ILaunchObjectProvider) element.createExecutableExtension("class");
|
||||||
|
objectProviders.add(objectProvider);
|
||||||
|
} else if (elementName.equals("configProvider")) {
|
||||||
|
String descriptorType = element.getAttribute("descriptorType");
|
||||||
|
String targetType = element.getAttribute("targetType");
|
||||||
|
// TODO don't instantiate this until we need it
|
||||||
|
ILaunchConfigurationProvider configProvider = (ILaunchConfigurationProvider) element.createExecutableExtension("class");
|
||||||
|
|
||||||
|
Map<String, ILaunchConfigurationProvider> targetTypes = configProviders.get(descriptorType);
|
||||||
|
if (targetTypes == null) {
|
||||||
|
targetTypes = new HashMap<>();
|
||||||
|
configProviders.put(descriptorType, targetTypes);
|
||||||
|
}
|
||||||
|
targetTypes.put(targetType, configProvider);
|
||||||
|
|
||||||
|
String isDefault = element.getAttribute("isDefault");
|
||||||
|
if (isDefault != null && Boolean.valueOf(isDefault)) {
|
||||||
|
defaultTargetTypes.put(descriptorType, targetType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
providers.add(new ProviderExtensionDescriptor(provider, priority));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Collections.sort(providers, new Comparator<ProviderExtensionDescriptor>() {
|
Collections.sort(descriptorTypes, new Comparator<ILaunchDescriptorType>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(ProviderExtensionDescriptor o1, ProviderExtensionDescriptor o2) {
|
public int compare(ILaunchDescriptorType o1, ILaunchDescriptorType o2) {
|
||||||
int p1 = o1.getPriority();
|
int p1 = typePriorities.get(o1);
|
||||||
int p2 = o2.getPriority();
|
int p2 = typePriorities.get(o2);
|
||||||
if (p1 > p2)
|
// Reverse order, highest priority first
|
||||||
|
if (p1 < p2)
|
||||||
return 1;
|
return 1;
|
||||||
else if (p1 < p2)
|
else if (p1 > p2)
|
||||||
return -1;
|
return -1;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
for (ILaunchDescriptorType descriptorType : descriptorTypes) {
|
||||||
|
descriptorType.init(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (ILaunchTargetType targetType : targetTypes.values()) {
|
||||||
|
targetType.init(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (ILaunchObjectProvider objectProvider : objectProviders) {
|
||||||
|
objectProvider.init(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Map<String, ILaunchConfigurationProvider> targetMap : configProviders.values()) {
|
||||||
|
for (ILaunchConfigurationProvider configProvider : targetMap.values()) {
|
||||||
|
configProvider.init(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hook up the existing launch configurations and listen
|
||||||
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
|
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
|
||||||
for (ILaunchConfiguration configuration : launchManager.getLaunchConfigurations()) {
|
for (ILaunchConfiguration configuration : launchManager.getLaunchConfigurations()) {
|
||||||
ILaunchConfigurationDescriptor configDesc = new DefaultLaunchConfigurationDescriptor(this, configuration);
|
launchConfigurationAdded(configuration);
|
||||||
|
|
||||||
|
|
||||||
for (ProviderExtensionDescriptor provider : providers) {
|
|
||||||
configDesc = provider.getProvider().filterDescriptor(this, configDesc);
|
|
||||||
}
|
|
||||||
configDescs.put(configDesc.getName(), configDesc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ProviderExtensionDescriptor providerDesc : providers) {
|
|
||||||
providerDesc.getProvider().init(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
launchManager.addLaunchConfigurationListener(this);
|
launchManager.addLaunchConfigurationListener(this);
|
||||||
|
|
||||||
// Load up the active from the preferences or pick reasonable defaults
|
// Load up the active from the preferences or pick reasonable defaults
|
||||||
IEclipsePreferences store = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID);
|
IEclipsePreferences store = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID);
|
||||||
String activeConfigDescName = store.get(PREF_ACTIVE_CONFIG_DESC, null);
|
String activeConfigDescName = store.get(PREF_ACTIVE_CONFIG_DESC, null);
|
||||||
if (activeConfigDescName == null && !configDescs.isEmpty()) {
|
if (activeConfigDescName == null && !descriptors.isEmpty()) {
|
||||||
activeConfigDescName = configDescs.values().iterator().next().getName();
|
activeConfigDescName = descriptors.values().iterator().next().getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (activeConfigDescName != null) {
|
if (activeConfigDescName != null) {
|
||||||
ILaunchConfigurationDescriptor configDesc = configDescs.get(activeConfigDescName);
|
ILaunchDescriptor configDesc = descriptors.get(activeConfigDescName);
|
||||||
if (configDesc != null) {
|
if (configDesc != null) {
|
||||||
setActiveLaunchConfigurationDescriptor(configDesc);
|
setActiveLaunchDescriptor(configDesc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void launchConfigurationAdded(ILaunchConfiguration configuration) {
|
public ILaunchDescriptor launchObjectAdded(Object element) {
|
||||||
ILaunchConfigurationDescriptor configDesc = new DefaultLaunchConfigurationDescriptor(this, configuration);
|
ILaunchDescriptor desc = objectDescriptorMap.get(element);
|
||||||
for (ProviderExtensionDescriptor provider : providers) {
|
if (desc != null)
|
||||||
configDesc = provider.getProvider().filterDescriptor(this, configDesc);
|
return desc;
|
||||||
|
|
||||||
|
for (ILaunchDescriptorType descriptorType : descriptorTypes) {
|
||||||
|
try {
|
||||||
|
if (descriptorType.ownsLaunchObject(element)) {
|
||||||
|
desc = descriptorType.getDescriptor(element);
|
||||||
|
if (desc != null) {
|
||||||
|
descriptors.put(desc.getName(), desc);
|
||||||
|
objectDescriptorMap.put(element, desc);
|
||||||
|
setActiveLaunchDescriptor(desc);
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
Activator.log(e.getStatus());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
try {
|
return null;
|
||||||
addLaunchConfigurationDescriptor(configDesc);
|
}
|
||||||
} catch (CoreException e) {
|
|
||||||
// TODO Auto-generated catch block
|
@Override
|
||||||
e.printStackTrace();
|
public void launchObjectRemoved(Object element) throws CoreException {
|
||||||
|
ILaunchDescriptor desc = objectDescriptorMap.get(element);
|
||||||
|
if (desc != null) {
|
||||||
|
descriptors.remove(desc.getName());
|
||||||
|
objectDescriptorMap.remove(element);
|
||||||
|
if (desc.equals(activeLaunchDesc)) {
|
||||||
|
// Roll back to the last one and make sure we don't come back
|
||||||
|
ILaunchDescriptor nextDesc = lastLaunchDesc;
|
||||||
|
activeLaunchDesc = null;
|
||||||
|
setActiveLaunchDescriptor(nextDesc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void launchConfigurationChanged(ILaunchConfiguration configuration) {
|
public ILaunchDescriptor[] getLaunchDescriptors() {
|
||||||
// TODO Auto-generated method stub
|
ILaunchDescriptor[] descs = descriptors.values().toArray(new ILaunchDescriptor[descriptors.size()]);
|
||||||
}
|
Arrays.sort(descs, new Comparator<ILaunchDescriptor>() {
|
||||||
|
|
||||||
@Override
|
|
||||||
public void launchConfigurationRemoved(ILaunchConfiguration configuration) {
|
|
||||||
try {
|
|
||||||
ILaunchConfigurationDescriptor configDesc = getLaunchConfigurationDescriptor(configuration);
|
|
||||||
if (configDesc != null)
|
|
||||||
removeLaunchConfigurationDescriptor(configDesc);
|
|
||||||
} catch (CoreException e) {
|
|
||||||
Activator.log(e.getStatus());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ILaunchConfigurationDescriptor[] getLaunchConfigurationDescriptors() {
|
|
||||||
ILaunchConfigurationDescriptor[] descs = configDescs.values().toArray(new ILaunchConfigurationDescriptor[configDescs.size()]);
|
|
||||||
Arrays.sort(descs, new Comparator<ILaunchConfigurationDescriptor>() {
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(ILaunchConfigurationDescriptor o1, ILaunchConfigurationDescriptor o2) {
|
public int compare(ILaunchDescriptor o1, ILaunchDescriptor o2) {
|
||||||
return o1.getName().compareTo(o2.getName());
|
return o1.getName().compareTo(o2.getName());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -185,51 +230,27 @@ public class LaunchBarManager extends PlatformObject implements ILaunchBarManage
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ILaunchConfigurationDescriptor getActiveLaunchConfigurationDescriptor() {
|
public ILaunchDescriptor getActiveLaunchDescriptor() {
|
||||||
return activeConfigDesc;
|
return activeLaunchDesc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ILaunchConfigurationDescriptor getLaunchConfigurationDescriptor(ILaunchConfiguration configuration) throws CoreException {
|
public void setActiveLaunchDescriptor(ILaunchDescriptor configDesc) throws CoreException {
|
||||||
// Check by name
|
if (activeLaunchDesc != null && activeLaunchDesc == configDesc)
|
||||||
ILaunchConfigurationDescriptor configDesc = configDescs.get(configuration.getName());
|
|
||||||
if (configDesc.matches(configuration))
|
|
||||||
return configDesc;
|
|
||||||
|
|
||||||
// Nope, try all descs
|
|
||||||
for (ILaunchConfigurationDescriptor cd : configDescs.values()) {
|
|
||||||
if (cd.matches(configuration))
|
|
||||||
return cd;
|
|
||||||
}
|
|
||||||
|
|
||||||
// nothing, weird
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setActiveLaunchConfigurationDescriptor(ILaunchConfigurationDescriptor configDesc) throws CoreException {
|
|
||||||
if (activeConfigDesc == configDesc)
|
|
||||||
return;
|
return;
|
||||||
lastConfigDesc = activeConfigDesc;
|
lastLaunchDesc = activeLaunchDesc;
|
||||||
activeConfigDesc = configDesc;
|
activeLaunchDesc = configDesc;
|
||||||
|
|
||||||
IEclipsePreferences store = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID);
|
IEclipsePreferences store = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID);
|
||||||
if (activeConfigDesc != null) {
|
if (activeLaunchDesc != null) {
|
||||||
store.put(PREF_ACTIVE_CONFIG_DESC, activeConfigDesc.getName());
|
store.put(PREF_ACTIVE_CONFIG_DESC, activeLaunchDesc.getName());
|
||||||
} else {
|
} else {
|
||||||
store.remove(PREF_ACTIVE_CONFIG_DESC);
|
store.remove(PREF_ACTIVE_CONFIG_DESC);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
store.flush();
|
store.flush();
|
||||||
} catch (BackingStoreException e) {
|
} catch (BackingStoreException e) {
|
||||||
// TODO log
|
Activator.log(e);
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (activeConfigDesc == null) {
|
|
||||||
setActiveLaunchMode(null);
|
|
||||||
setActiveLaunchTarget(null);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send notifications
|
// Send notifications
|
||||||
|
@ -237,76 +258,58 @@ public class LaunchBarManager extends PlatformObject implements ILaunchBarManage
|
||||||
listener.activeConfigurationDescriptorChanged();
|
listener.activeConfigurationDescriptorChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set active mode
|
if (activeLaunchDesc == null) {
|
||||||
String activeModeName = store.node(activeConfigDesc.getName()).get(PREF_ACTIVE_LAUNCH_MODE, null);
|
setActiveLaunchMode(null);
|
||||||
ILaunchMode[] launchModes = activeConfigDesc.getLaunchModes();
|
setActiveLaunchTarget(null);
|
||||||
boolean foundMode = false;
|
return;
|
||||||
if (activeModeName != null) {
|
|
||||||
for (ILaunchMode mode : launchModes) {
|
|
||||||
if (activeModeName.equals(mode.getIdentifier())) {
|
|
||||||
setActiveLaunchMode(mode);
|
|
||||||
foundMode = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!foundMode) {
|
|
||||||
if (launchModes.length > 0) {
|
|
||||||
ILaunchMode mode = activeConfigDesc.getLaunchMode("debug");
|
|
||||||
if (mode == null) {
|
|
||||||
mode = activeConfigDesc.getLaunchMode("run");
|
|
||||||
}
|
|
||||||
if (mode == null) {
|
|
||||||
mode = launchModes[0];
|
|
||||||
}
|
|
||||||
setActiveLaunchMode(mode);
|
|
||||||
} else {
|
|
||||||
setActiveLaunchMode(null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set active target
|
// Set active target
|
||||||
String activeTargetId = store.node(activeConfigDesc.getName()).get(PREF_ACTIVE_LAUNCH_TARGET, null);
|
String activeTargetId = store.node(activeLaunchDesc.getName()).get(PREF_ACTIVE_LAUNCH_TARGET, null);
|
||||||
ILaunchTarget target = null;
|
ILaunchTarget target = null;
|
||||||
if (activeTargetId != null) {
|
if (activeTargetId != null) {
|
||||||
target = activeConfigDesc.getLaunchTarget(activeTargetId);
|
target = getLaunchTarget(activeTargetId);
|
||||||
}
|
}
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
ILaunchTarget[] targets = activeConfigDesc.getLaunchTargets();
|
ILaunchTarget[] targets = getLaunchTargets();
|
||||||
if (targets.length > 0) {
|
if (targets.length > 0) {
|
||||||
target = targets[0];
|
target = targets[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setActiveLaunchTarget(target);
|
setActiveLaunchTarget(target);
|
||||||
|
|
||||||
|
// Set active mode
|
||||||
|
String activeModeName = store.node(activeLaunchDesc.getName()).get(PREF_ACTIVE_LAUNCH_MODE, null);
|
||||||
|
ILaunchConfigurationType configType = getLaunchConfigurationType(activeLaunchDesc, activeLaunchTarget);
|
||||||
|
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
|
||||||
|
ILaunchMode foundMode = null;
|
||||||
|
if (activeModeName != null && configType.supportsMode(activeModeName)) {
|
||||||
|
foundMode = launchManager.getLaunchMode(activeModeName);
|
||||||
|
}
|
||||||
|
if (foundMode == null && configType.supportsMode("debug")) {
|
||||||
|
foundMode = launchManager.getLaunchMode("debug");
|
||||||
|
}
|
||||||
|
if (foundMode == null && configType.supportsMode("run")) {
|
||||||
|
foundMode = launchManager.getLaunchMode("run");
|
||||||
|
}
|
||||||
|
setActiveLaunchMode(foundMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addLaunchConfigurationDescriptor(ILaunchConfigurationDescriptor configDesc) throws CoreException {
|
public ILaunchMode[] getLaunchModes() throws CoreException {
|
||||||
configDescs.put(configDesc.getName(), configDesc);
|
ILaunchConfigurationType configType = getLaunchConfigurationType(activeLaunchDesc, activeLaunchTarget);
|
||||||
setActiveLaunchConfigurationDescriptor(configDesc);
|
if (configType == null)
|
||||||
}
|
return new ILaunchMode[0];
|
||||||
|
|
||||||
@Override
|
List<ILaunchMode> modeList = new ArrayList<>();
|
||||||
public void removeLaunchConfigurationDescriptor(ILaunchConfigurationDescriptor configDesc) {
|
ILaunchMode[] modes = DebugPlugin.getDefault().getLaunchManager().getLaunchModes();
|
||||||
configDescs.remove(configDesc.getName());
|
for (ILaunchMode mode : modes) {
|
||||||
|
if (configType.supportsMode(mode.getIdentifier())) {
|
||||||
// Fix up the active config if this one was it
|
modeList.add(mode);
|
||||||
if (activeConfigDesc.equals(configDesc)) {
|
|
||||||
try {
|
|
||||||
if (configDescs.isEmpty()) {
|
|
||||||
setActiveLaunchConfigurationDescriptor(null);
|
|
||||||
} else if (lastConfigDesc != null) {
|
|
||||||
setActiveLaunchConfigurationDescriptor(lastConfigDesc);
|
|
||||||
// Clear out the last desc since we just used it
|
|
||||||
lastConfigDesc = null;
|
|
||||||
} else {
|
|
||||||
setActiveLaunchConfigurationDescriptor(configDescs.values().iterator().next());
|
|
||||||
}
|
|
||||||
} catch (CoreException e) {
|
|
||||||
// TODO log
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return modeList.toArray(new ILaunchMode[modeList.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -320,10 +323,13 @@ public class LaunchBarManager extends PlatformObject implements ILaunchBarManage
|
||||||
return;
|
return;
|
||||||
activeLaunchMode = mode;
|
activeLaunchMode = mode;
|
||||||
|
|
||||||
if (activeConfigDesc == null)
|
for (Listener listener : listeners)
|
||||||
|
listener.activeLaunchModeChanged();
|
||||||
|
|
||||||
|
if (activeLaunchDesc == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Preferences store = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID).node(activeConfigDesc.getName());
|
Preferences store = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID).node(activeLaunchDesc.getName());
|
||||||
if (mode != null) {
|
if (mode != null) {
|
||||||
store.put(PREF_ACTIVE_LAUNCH_MODE, mode.getIdentifier());
|
store.put(PREF_ACTIVE_LAUNCH_MODE, mode.getIdentifier());
|
||||||
} else {
|
} else {
|
||||||
|
@ -335,10 +341,27 @@ public class LaunchBarManager extends PlatformObject implements ILaunchBarManage
|
||||||
// TODO log
|
// TODO log
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
activeConfigDesc.setActiveLaunchMode(mode);
|
@Override
|
||||||
for (Listener listener : listeners)
|
public ILaunchTarget[] getLaunchTargets() {
|
||||||
listener.activeLaunchModeChanged();
|
if (activeLaunchDesc == null)
|
||||||
|
return new ILaunchTarget[0];
|
||||||
|
|
||||||
|
List<ILaunchTarget> targetList = new ArrayList<>();
|
||||||
|
Map<String, ILaunchConfigurationProvider> targetMap = configProviders.get(activeLaunchDesc.getType().getId());
|
||||||
|
if (targetMap != null) {
|
||||||
|
for (String id : targetMap.keySet()) {
|
||||||
|
ILaunchTargetType type = targetTypes.get(id);
|
||||||
|
if (type != null) {
|
||||||
|
ILaunchTarget[] targets = type.getTargets();
|
||||||
|
for (ILaunchTarget target : targets) {
|
||||||
|
targetList.add(target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return targetList.toArray(new ILaunchTarget[targetList.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -349,13 +372,16 @@ public class LaunchBarManager extends PlatformObject implements ILaunchBarManage
|
||||||
@Override
|
@Override
|
||||||
public void setActiveLaunchTarget(ILaunchTarget target) {
|
public void setActiveLaunchTarget(ILaunchTarget target) {
|
||||||
if (activeLaunchTarget == target) return;
|
if (activeLaunchTarget == target) return;
|
||||||
|
|
||||||
activeLaunchTarget = target;
|
activeLaunchTarget = target;
|
||||||
|
|
||||||
if (activeConfigDesc == null)
|
for (Listener listener : listeners)
|
||||||
|
listener.activeLaunchTargetChanged();
|
||||||
|
|
||||||
|
if (activeLaunchDesc == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Preferences store = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID).node(activeConfigDesc.getName());
|
Preferences store = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID).node(activeLaunchDesc.getName());
|
||||||
if (target != null) {
|
if (target != null) {
|
||||||
store.put(PREF_ACTIVE_LAUNCH_TARGET, target.getId());
|
store.put(PREF_ACTIVE_LAUNCH_TARGET, target.getId());
|
||||||
} else {
|
} else {
|
||||||
|
@ -368,25 +394,51 @@ public class LaunchBarManager extends PlatformObject implements ILaunchBarManage
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
activeConfigDesc.setActiveLaunchTarget(target);
|
target.setActive();
|
||||||
for (Listener listener : listeners)
|
|
||||||
listener.activeLaunchTargetChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
public LocalTarget getLocalLaunchTarget() {
|
|
||||||
return localLaunchTarget;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addLaunchTarget(ILaunchTarget target) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeLaunchTarget(ILaunchTarget target) {
|
public ILaunchTarget getLaunchTarget(String id) {
|
||||||
// TODO Auto-generated method stub
|
for (ILaunchTargetType type : targetTypes.values()) {
|
||||||
|
ILaunchTarget target = type.getTarget(id);
|
||||||
|
if (target != null)
|
||||||
|
return target;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ILaunchConfigurationType getLaunchConfigurationType(ILaunchDescriptor descriptor, ILaunchTarget target) throws CoreException {
|
||||||
|
if (descriptor == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
String descriptorTypeId = descriptor.getType().getId();
|
||||||
|
Map<String, ILaunchConfigurationProvider> targetMap = configProviders.get(descriptorTypeId);
|
||||||
|
if (targetMap != null) {
|
||||||
|
String targetTypeId = target != null ? target.getType().getId() : defaultTargetTypes.get(descriptorTypeId);
|
||||||
|
if (targetTypeId != null) {
|
||||||
|
ILaunchConfigurationProvider configProvider = targetMap.get(targetTypeId);
|
||||||
|
if (configProvider != null) {
|
||||||
|
return configProvider.getLaunchConfigurationType(descriptor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ILaunchConfiguration getLaunchConfiguration(ILaunchDescriptor descriptor, ILaunchTarget target) throws CoreException {
|
||||||
|
if (activeLaunchDesc == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
Map<String, ILaunchConfigurationProvider> targetMap = configProviders.get(descriptor.getType().getId());
|
||||||
|
if (targetMap != null) {
|
||||||
|
ILaunchConfigurationProvider configProvider = targetMap.get(target.getType().getId());
|
||||||
|
if (configProvider != null) {
|
||||||
|
return configProvider.getLaunchConfiguration(descriptor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -399,4 +451,39 @@ public class LaunchBarManager extends PlatformObject implements ILaunchBarManage
|
||||||
listeners.remove(listener);
|
listeners.remove(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void launchConfigurationAdded(ILaunchConfiguration configuration) {
|
||||||
|
try {
|
||||||
|
boolean owned = false;
|
||||||
|
// TODO filter by launch configuration type
|
||||||
|
|
||||||
|
for (Map<String, ILaunchConfigurationProvider> targetMap : configProviders.values()) {
|
||||||
|
for (ILaunchConfigurationProvider configProvider : targetMap.values()) {
|
||||||
|
if (configProvider.ownsLaunchConfiguration(configuration)) {
|
||||||
|
owned = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!owned) {
|
||||||
|
launchObjectAdded(configuration);
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
Activator.log(e.getStatus());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void launchConfigurationChanged(ILaunchConfiguration configuration) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void launchConfigurationRemoved(ILaunchConfiguration configuration) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,19 +11,35 @@
|
||||||
package org.eclipse.cdt.launchbar.core.internal;
|
package org.eclipse.cdt.launchbar.core.internal;
|
||||||
|
|
||||||
import org.eclipse.cdt.launchbar.core.ILaunchTarget;
|
import org.eclipse.cdt.launchbar.core.ILaunchTarget;
|
||||||
|
import org.eclipse.cdt.launchbar.core.ILaunchTargetType;
|
||||||
|
|
||||||
public class LocalTarget implements ILaunchTarget {
|
public class LocalTarget implements ILaunchTarget {
|
||||||
|
|
||||||
public static final String ID = "org.eclipse.cdt.local";
|
private final LocalTargetType type;
|
||||||
|
|
||||||
|
public LocalTarget(LocalTargetType type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return ID;
|
// Use the same ID as the type since we're really a singleton
|
||||||
|
return type.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "Local Machine"; // TODO externalize
|
return "Local Machine"; // TODO externalize
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ILaunchTargetType getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setActive() {
|
||||||
|
// nothing to do
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
package org.eclipse.cdt.launchbar.core.internal;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.launchbar.core.ILaunchBarManager;
|
||||||
|
import org.eclipse.cdt.launchbar.core.ILaunchTarget;
|
||||||
|
import org.eclipse.cdt.launchbar.core.ILaunchTargetType;
|
||||||
|
|
||||||
|
public class LocalTargetType implements ILaunchTargetType {
|
||||||
|
|
||||||
|
public static final String ID = "org.eclipse.cdt.launchbar.core.target.local";
|
||||||
|
private LocalTarget localTarget;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(ILaunchBarManager manager) {
|
||||||
|
localTarget = new LocalTarget(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getId() {
|
||||||
|
return ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ILaunchTarget[] getTargets() {
|
||||||
|
return new ILaunchTarget[] { localTarget };
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ILaunchTarget getTarget(String id) {
|
||||||
|
if (ID.equals(id))
|
||||||
|
return localTarget;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,67 @@
|
||||||
|
package org.eclipse.cdt.launchbar.core.internal;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.launchbar.core.ILaunchBarManager;
|
||||||
|
import org.eclipse.cdt.launchbar.core.ILaunchObjectProvider;
|
||||||
|
import org.eclipse.core.resources.IFile;
|
||||||
|
import org.eclipse.core.resources.IFolder;
|
||||||
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.core.resources.IResource;
|
||||||
|
import org.eclipse.core.resources.IResourceChangeEvent;
|
||||||
|
import org.eclipse.core.resources.IResourceChangeListener;
|
||||||
|
import org.eclipse.core.resources.IResourceDelta;
|
||||||
|
import org.eclipse.core.resources.IResourceDeltaVisitor;
|
||||||
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
|
public class ProjectLaunchObjectProvider implements ILaunchObjectProvider, IResourceChangeListener {
|
||||||
|
|
||||||
|
private ILaunchBarManager manager;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(ILaunchBarManager manager) {
|
||||||
|
this.manager = manager;
|
||||||
|
|
||||||
|
try {
|
||||||
|
for (IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects()) {
|
||||||
|
manager.launchObjectAdded(project);
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
Activator.log(e.getStatus());
|
||||||
|
}
|
||||||
|
|
||||||
|
ResourcesPlugin.getWorkspace().addResourceChangeListener(this, IResourceChangeEvent.POST_CHANGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dispose() {
|
||||||
|
ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void resourceChanged(IResourceChangeEvent event) {
|
||||||
|
try {
|
||||||
|
event.getDelta().accept(new IResourceDeltaVisitor() {
|
||||||
|
@Override
|
||||||
|
public boolean visit(IResourceDelta delta) throws CoreException {
|
||||||
|
IResource res = delta.getResource();
|
||||||
|
if (res instanceof IProject) {
|
||||||
|
IProject project = (IProject) delta.getResource();
|
||||||
|
int kind = delta.getKind();
|
||||||
|
if ((kind & IResourceDelta.ADDED) != 0) {
|
||||||
|
manager.launchObjectAdded(project);
|
||||||
|
} else if ((kind & IResourceDelta.REMOVED) != 0) {
|
||||||
|
manager.launchObjectRemoved(project);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
} else if (res instanceof IFile || res instanceof IFolder) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (CoreException e) {
|
||||||
|
Activator.log(e.getStatus());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -19,3 +19,4 @@ Require-Bundle: org.eclipse.ui,
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Bundle-Localization: plugin
|
Bundle-Localization: plugin
|
||||||
|
Export-Package: org.eclipse.cdt.launchbar.ui
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<?eclipse version="3.4"?>
|
<?eclipse version="3.4"?>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
<extension-point id="launchBarUIContributions" name="launchBar UI Contributions" schema="schema/launchBarUIContributions.exsd"/>
|
||||||
<extension
|
<extension
|
||||||
id="launchBarInjector"
|
id="launchBarInjector"
|
||||||
point="org.eclipse.e4.workbench.model">
|
point="org.eclipse.e4.workbench.model">
|
||||||
|
@ -58,5 +59,16 @@
|
||||||
name="Launch Bar">
|
name="Launch Bar">
|
||||||
</page>
|
</page>
|
||||||
</extension>
|
</extension>
|
||||||
|
<extension
|
||||||
|
point="org.eclipse.cdt.launchbar.ui.launchBarUIContributions">
|
||||||
|
<descriptorUI
|
||||||
|
descriptorTypeId="org.eclipse.cdt.launchbar.core.descriptor.default"
|
||||||
|
labelProvider="org.eclipse.cdt.launchbar.ui.internal.DefaultDescriptorLabelProvider">
|
||||||
|
</descriptorUI>
|
||||||
|
<targetUI
|
||||||
|
labelProvider="org.eclipse.cdt.launchbar.ui.internal.LocalTargetLabelProvider"
|
||||||
|
targetTypeId="org.eclipse.cdt.launchbar.core.target.local">
|
||||||
|
</targetUI>
|
||||||
|
</extension>
|
||||||
|
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
@ -0,0 +1,168 @@
|
||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<!-- Schema file written by PDE -->
|
||||||
|
<schema targetNamespace="org.eclipse.cdt.launchbar.ui" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||||
|
<annotation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.schema plugin="org.eclipse.cdt.launchbar.ui" id="launchBarUIContributions" name="launchBar UI Contributions"/>
|
||||||
|
</appinfo>
|
||||||
|
<documentation>
|
||||||
|
[Enter description of this extension point.]
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
<element name="extension">
|
||||||
|
<annotation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.element />
|
||||||
|
</appinfo>
|
||||||
|
</annotation>
|
||||||
|
<complexType>
|
||||||
|
<sequence minOccurs="0" maxOccurs="unbounded">
|
||||||
|
<element ref="descriptorUI"/>
|
||||||
|
<element ref="targetUI"/>
|
||||||
|
</sequence>
|
||||||
|
<attribute name="point" type="string" use="required">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="id" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="name" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.attribute translatable="true"/>
|
||||||
|
</appinfo>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
</complexType>
|
||||||
|
</element>
|
||||||
|
|
||||||
|
<element name="descriptorUI">
|
||||||
|
<complexType>
|
||||||
|
<attribute name="descriptorTypeId" type="string" use="required">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.attribute kind="identifier" basedOn="org.eclipse.cdt.launchbar.core.launchBarContributions/descriptorType/@id"/>
|
||||||
|
</appinfo>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="labelProvider" type="string" use="required">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.attribute kind="java" basedOn=":org.eclipse.jface.viewers.ILabelProvider"/>
|
||||||
|
</appinfo>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
</complexType>
|
||||||
|
</element>
|
||||||
|
|
||||||
|
<element name="targetUI">
|
||||||
|
<complexType>
|
||||||
|
<attribute name="targetTypeId" type="string" use="required">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.attribute kind="identifier" basedOn="org.eclipse.cdt.launchbar.core.launchBarContributions/targetType/@id"/>
|
||||||
|
</appinfo>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="labelProvider" type="string" use="required">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.attribute kind="java" basedOn=":org.eclipse.jface.viewers.ILabelProvider"/>
|
||||||
|
</appinfo>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="hoverProvider" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.attribute kind="java" basedOn=":org.eclipse.cdt.launchbar.ui.IHoverProvider"/>
|
||||||
|
</appinfo>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="editCommandId" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.attribute kind="identifier" basedOn="org.eclipse.ui.commands/command/@id"/>
|
||||||
|
</appinfo>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="addNewTargetCommandId" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.attribute kind="identifier" basedOn="org.eclipse.ui.commands/command/@id"/>
|
||||||
|
</appinfo>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
</complexType>
|
||||||
|
</element>
|
||||||
|
|
||||||
|
<annotation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.section type="since"/>
|
||||||
|
</appinfo>
|
||||||
|
<documentation>
|
||||||
|
[Enter the first release in which this extension point appears.]
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
<annotation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.section type="examples"/>
|
||||||
|
</appinfo>
|
||||||
|
<documentation>
|
||||||
|
[Enter extension point usage example here.]
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
<annotation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.section type="apiinfo"/>
|
||||||
|
</appinfo>
|
||||||
|
<documentation>
|
||||||
|
[Enter API information here.]
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
<annotation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.section type="implementation"/>
|
||||||
|
</appinfo>
|
||||||
|
<documentation>
|
||||||
|
[Enter information about supplied implementation of this extension point.]
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
|
||||||
|
</schema>
|
|
@ -12,6 +12,9 @@ package org.eclipse.cdt.launchbar.ui;
|
||||||
|
|
||||||
public interface ILaunchBarUIConstants {
|
public interface ILaunchBarUIConstants {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parameter name for the edit target command.
|
||||||
|
*/
|
||||||
public static final String TARGET_NAME = "targetName";
|
public static final String TARGET_NAME = "targetName";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,11 +125,13 @@ public class Activator extends AbstractUIPlugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void log(CoreException e) {
|
public static void log(IStatus status) {
|
||||||
plugin.getLog().log(e.getStatus());
|
plugin.getLog().log(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void log(Exception e) {
|
public static void log(Exception e) {
|
||||||
|
if (e instanceof CoreException)
|
||||||
|
log(((CoreException) e).getStatus());
|
||||||
plugin.getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, e.getLocalizedMessage(), e));
|
plugin.getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, e.getLocalizedMessage(), e));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,60 @@
|
||||||
|
package org.eclipse.cdt.launchbar.ui.internal;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.launchbar.core.ILaunchBarManager;
|
||||||
|
import org.eclipse.cdt.launchbar.core.ILaunchDescriptor;
|
||||||
|
import org.eclipse.cdt.launchbar.core.ILaunchTarget;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.debug.core.ILaunchConfigurationType;
|
||||||
|
import org.eclipse.debug.ui.DebugUITools;
|
||||||
|
import org.eclipse.jface.resource.ImageDescriptor;
|
||||||
|
import org.eclipse.jface.viewers.LabelProvider;
|
||||||
|
import org.eclipse.swt.graphics.Image;
|
||||||
|
|
||||||
|
public class DefaultDescriptorLabelProvider extends LabelProvider {
|
||||||
|
|
||||||
|
private Map<ImageDescriptor, Image> images = new HashMap<>();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dispose() {
|
||||||
|
super.dispose();
|
||||||
|
for (Image image : images.values()) {
|
||||||
|
image.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Image getImage(Object element) {
|
||||||
|
if (element instanceof ILaunchDescriptor) {
|
||||||
|
try {
|
||||||
|
ILaunchDescriptor desc = (ILaunchDescriptor) element;
|
||||||
|
ILaunchBarManager manager = desc.getType().getManager();
|
||||||
|
ILaunchTarget target = manager.getActiveLaunchTarget();
|
||||||
|
ILaunchConfigurationType type = manager.getLaunchConfigurationType(desc, target);
|
||||||
|
ImageDescriptor imageDescriptor = DebugUITools.getDefaultImageDescriptor(type);
|
||||||
|
if (imageDescriptor != null) {
|
||||||
|
Image image = images.get(imageDescriptor);
|
||||||
|
if (image == null) {
|
||||||
|
image = imageDescriptor.createImage();
|
||||||
|
images.put(imageDescriptor, image);
|
||||||
|
}
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
Activator.log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return super.getImage(element);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getText(Object element) {
|
||||||
|
if (element instanceof ILaunchDescriptor) {
|
||||||
|
return ((ILaunchDescriptor) element).getName();
|
||||||
|
}
|
||||||
|
return super.getText(element);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -10,46 +10,95 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.launchbar.ui.internal;
|
package org.eclipse.cdt.launchbar.ui.internal;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.launchbar.core.ILaunchBarManager;
|
import org.eclipse.cdt.launchbar.core.ILaunchBarManager;
|
||||||
import org.eclipse.cdt.launchbar.core.ILaunchConfigurationDescriptor;
|
import org.eclipse.cdt.launchbar.core.ILaunchDescriptor;
|
||||||
import org.eclipse.cdt.launchbar.core.ILaunchTarget;
|
import org.eclipse.cdt.launchbar.core.ILaunchTarget;
|
||||||
|
import org.eclipse.cdt.launchbar.core.ILaunchTargetType;
|
||||||
|
import org.eclipse.cdt.launchbar.core.internal.Activator;
|
||||||
import org.eclipse.cdt.launchbar.ui.IHoverProvider;
|
import org.eclipse.cdt.launchbar.ui.IHoverProvider;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IConfigurationElement;
|
||||||
|
import org.eclipse.core.runtime.IExtension;
|
||||||
|
import org.eclipse.core.runtime.IExtensionPoint;
|
||||||
|
import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.jface.viewers.ILabelProvider;
|
import org.eclipse.jface.viewers.ILabelProvider;
|
||||||
|
|
||||||
public class LaunchBarUIManager {
|
public class LaunchBarUIManager {
|
||||||
|
|
||||||
ILaunchBarManager manager;
|
ILaunchBarManager manager;
|
||||||
|
Map<String, ILabelProvider> descriptorLabelProviders = new HashMap<>();
|
||||||
|
Map<String, ILabelProvider> targetLabelProviders = new HashMap<>();
|
||||||
|
Map<String, IHoverProvider> targetHoverProviders = new HashMap<>();
|
||||||
|
Map<String, String> targetEditCommandIds = new HashMap<>();
|
||||||
|
Map<String, String> targetAddNewCommandIds = new HashMap<>();
|
||||||
|
|
||||||
public LaunchBarUIManager(ILaunchBarManager manager) {
|
public LaunchBarUIManager(ILaunchBarManager manager) {
|
||||||
this.manager = manager;
|
this.manager = manager;
|
||||||
|
|
||||||
|
IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(Activator.PLUGIN_ID, "launchBarContributions");
|
||||||
|
IExtension[] extensions = point.getExtensions();
|
||||||
|
for (IExtension extension : extensions) {
|
||||||
|
for (IConfigurationElement element : extension.getConfigurationElements()) {
|
||||||
|
String elementName = element.getName();
|
||||||
|
if (elementName.equals("descriptorUI")) {
|
||||||
|
try {
|
||||||
|
String descriptorTypeId = element.getAttribute("descriptorTypeId");
|
||||||
|
|
||||||
|
ILabelProvider labelProvider = (ILabelProvider) element.createExecutableExtension("labelProvider");
|
||||||
|
descriptorLabelProviders.put(descriptorTypeId, labelProvider);
|
||||||
|
} catch (CoreException e) {
|
||||||
|
Activator.log(e.getStatus());
|
||||||
|
}
|
||||||
|
} else if (elementName.equals("targetUI")) {
|
||||||
|
try {
|
||||||
|
String targetTypeId = element.getAttribute("targetTypeId");
|
||||||
|
|
||||||
|
ILabelProvider labelProvider = (ILabelProvider) element.createExecutableExtension("labelProvider");
|
||||||
|
targetLabelProviders.put(targetTypeId, labelProvider);
|
||||||
|
|
||||||
|
IHoverProvider hoverProvider = (IHoverProvider) element.createExecutableExtension("hoverProvider");
|
||||||
|
if (hoverProvider != null)
|
||||||
|
targetHoverProviders.put(targetTypeId, hoverProvider);
|
||||||
|
|
||||||
|
String editCommandId = element.getAttribute("editCommandId");
|
||||||
|
if (editCommandId != null && editCommandId.length() > 0)
|
||||||
|
targetEditCommandIds.put(targetTypeId, editCommandId);
|
||||||
|
|
||||||
|
String addNewCommandId = element.getAttribute("addNewTargetCommandId");
|
||||||
|
if (addNewCommandId != null && addNewCommandId.length() > 0)
|
||||||
|
targetAddNewCommandIds.put(targetTypeId, addNewCommandId);
|
||||||
|
} catch (CoreException e) {
|
||||||
|
Activator.log(e.getStatus());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ILaunchBarManager getManager() {
|
public ILaunchBarManager getManager() {
|
||||||
return manager;
|
return manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ILabelProvider getLabelProvider(ILaunchConfigurationDescriptor configDesc) {
|
public ILabelProvider getLabelProvider(ILaunchDescriptor descriptor) {
|
||||||
// TODO
|
return descriptorLabelProviders.get(descriptor.getType().getId());
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ILabelProvider getLabelProvider(ILaunchTarget target) {
|
public ILabelProvider getLabelProvider(ILaunchTarget target) {
|
||||||
// TODO
|
return targetLabelProviders.get(target.getType().getId());
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEditCommand(ILaunchTarget target) {
|
|
||||||
// TODO
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IHoverProvider getHoverProvider(ILaunchTarget target) {
|
public IHoverProvider getHoverProvider(ILaunchTarget target) {
|
||||||
// TODO
|
return targetHoverProviders.get(target.getType().getId());
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAddTargetCommand(ILaunchConfigurationDescriptor configDesc) {
|
public String getEditCommand(ILaunchTarget target) {
|
||||||
// TODO
|
return targetEditCommandIds.get(target.getType().getId());
|
||||||
return null;
|
}
|
||||||
|
|
||||||
|
public String getAddTargetCommand(ILaunchTargetType targetType) {
|
||||||
|
return targetAddNewCommandIds.get(targetType.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
package org.eclipse.cdt.launchbar.ui.internal;
|
||||||
|
import org.eclipse.cdt.launchbar.core.ILaunchTarget;
|
||||||
|
import org.eclipse.jface.viewers.LabelProvider;
|
||||||
|
|
||||||
|
|
||||||
|
public class LocalTargetLabelProvider extends LabelProvider {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getText(Object element) {
|
||||||
|
if (element instanceof ILaunchTarget) {
|
||||||
|
return ((ILaunchTarget) element).getName();
|
||||||
|
}
|
||||||
|
return super.getText(element);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -16,7 +16,8 @@ import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.cdt.launchbar.core.ILaunchBarManager;
|
import org.eclipse.cdt.launchbar.core.ILaunchBarManager;
|
||||||
import org.eclipse.cdt.launchbar.core.ILaunchConfigurationDescriptor;
|
import org.eclipse.cdt.launchbar.core.ILaunchDescriptor;
|
||||||
|
import org.eclipse.cdt.launchbar.core.ILaunchTarget;
|
||||||
import org.eclipse.cdt.launchbar.ui.internal.Activator;
|
import org.eclipse.cdt.launchbar.ui.internal.Activator;
|
||||||
import org.eclipse.core.commands.AbstractHandler;
|
import org.eclipse.core.commands.AbstractHandler;
|
||||||
import org.eclipse.core.commands.ExecutionEvent;
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
|
@ -31,7 +32,6 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.core.runtime.jobs.Job;
|
|
||||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||||
import org.eclipse.debug.core.ILaunchDelegate;
|
import org.eclipse.debug.core.ILaunchDelegate;
|
||||||
import org.eclipse.debug.core.ILaunchMode;
|
import org.eclipse.debug.core.ILaunchMode;
|
||||||
|
@ -60,70 +60,60 @@ public class BuildActiveCommandHandler extends AbstractHandler {
|
||||||
@Override
|
@Override
|
||||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||||
new UIJob(Display.getDefault(), "Building Active Configuration") {
|
new UIJob(Display.getDefault(), "Building Active Configuration") {
|
||||||
|
@Override
|
||||||
|
public boolean belongsTo(Object family) {
|
||||||
|
return ResourcesPlugin.FAMILY_MANUAL_BUILD.equals(family);
|
||||||
|
}
|
||||||
|
|
||||||
public IStatus runInUIThread(IProgressMonitor monitor) {
|
public IStatus runInUIThread(IProgressMonitor monitor) {
|
||||||
final ILaunchConfigurationDescriptor desc = launchBarManager.getActiveLaunchConfigurationDescriptor();
|
try {
|
||||||
|
ILaunchDescriptor desc = launchBarManager.getActiveLaunchDescriptor();
|
||||||
|
ILaunchTarget target = launchBarManager.getActiveLaunchTarget();
|
||||||
|
ILaunchConfiguration config = launchBarManager.getLaunchConfiguration(desc, target);
|
||||||
|
|
||||||
if (desc == null) {
|
if (config == null) {
|
||||||
// popout - No launch configuration
|
// Default, build the workspace
|
||||||
// showConfigurationErrorCallOut(NLS.bind("{0}\n{1}", Messages.RunActiveCommandHandler_No_Launch_Configuration_Selected,
|
ResourcesPlugin.getWorkspace().build(IncrementalProjectBuilder.INCREMENTAL_BUILD, monitor);
|
||||||
// Messages.RunActiveCommandHanlder_Create_Launch_Configuration));
|
|
||||||
}
|
|
||||||
|
|
||||||
new Job("Building Active Configuration") {
|
|
||||||
@Override
|
|
||||||
public boolean belongsTo(Object family) {
|
|
||||||
return ResourcesPlugin.FAMILY_MANUAL_BUILD.equals(family);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected IStatus run(IProgressMonitor monitor) {
|
|
||||||
try {
|
|
||||||
if (desc == null) {
|
|
||||||
ResourcesPlugin.getWorkspace().build(IncrementalProjectBuilder.INCREMENTAL_BUILD, monitor);
|
|
||||||
return Status.OK_STATUS;
|
|
||||||
}
|
|
||||||
|
|
||||||
ILaunchMode launchMode = launchBarManager.getActiveLaunchMode();
|
|
||||||
|
|
||||||
ILaunchConfiguration config = desc.getLaunchConfiguration();
|
|
||||||
Collection<IProject> projects = getProjects(config);
|
|
||||||
|
|
||||||
if (BuildAction.isSaveAllSet()) {
|
|
||||||
saveEditors(projects);
|
|
||||||
}
|
|
||||||
|
|
||||||
String mode = launchMode.getIdentifier();
|
|
||||||
Set<String> modes = new HashSet<>();
|
|
||||||
modes.add(mode);
|
|
||||||
ILaunchDelegate delegate = config.getType().getPreferredDelegate(modes);
|
|
||||||
if (delegate == null)
|
|
||||||
delegate = config.getType().getDelegates(modes)[0];
|
|
||||||
ILaunchConfigurationDelegate configDel = delegate.getDelegate();
|
|
||||||
if (configDel instanceof ILaunchConfigurationDelegate2) {
|
|
||||||
ILaunchConfigurationDelegate2 configDel2 = (ILaunchConfigurationDelegate2)configDel;
|
|
||||||
boolean ret;
|
|
||||||
ret = configDel2.preLaunchCheck(config, mode, monitor);
|
|
||||||
if (!ret)
|
|
||||||
return Status.CANCEL_STATUS;
|
|
||||||
if (!configDel2.buildForLaunch(config, mode, monitor))
|
|
||||||
return Status.OK_STATUS;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fall through, do a normal build
|
|
||||||
if (projects.isEmpty()) {
|
|
||||||
ResourcesPlugin.getWorkspace().build(IncrementalProjectBuilder.INCREMENTAL_BUILD, monitor);
|
|
||||||
} else {
|
|
||||||
Collection<IBuildConfiguration> buildConfigs = getBuildConfigs(projects);
|
|
||||||
ResourcesPlugin.getWorkspace().build(buildConfigs.toArray(new IBuildConfiguration[buildConfigs.size()]),
|
|
||||||
IncrementalProjectBuilder.INCREMENTAL_BUILD, true, monitor);
|
|
||||||
// TODO, may need to get the buildReferences argument from the descriptor
|
|
||||||
}
|
|
||||||
} catch (CoreException e) {
|
|
||||||
return e.getStatus();
|
|
||||||
}
|
|
||||||
return Status.OK_STATUS;
|
return Status.OK_STATUS;
|
||||||
}
|
}
|
||||||
}.schedule();
|
|
||||||
|
|
||||||
|
ILaunchMode launchMode = launchBarManager.getActiveLaunchMode();
|
||||||
|
|
||||||
|
Collection<IProject> projects = getProjects(config);
|
||||||
|
if (BuildAction.isSaveAllSet()) {
|
||||||
|
saveEditors(projects);
|
||||||
|
}
|
||||||
|
|
||||||
|
String mode = launchMode.getIdentifier();
|
||||||
|
Set<String> modes = new HashSet<>();
|
||||||
|
modes.add(mode);
|
||||||
|
ILaunchDelegate delegate = config.getType().getPreferredDelegate(modes);
|
||||||
|
if (delegate == null)
|
||||||
|
delegate = config.getType().getDelegates(modes)[0];
|
||||||
|
ILaunchConfigurationDelegate configDel = delegate.getDelegate();
|
||||||
|
if (configDel instanceof ILaunchConfigurationDelegate2) {
|
||||||
|
ILaunchConfigurationDelegate2 configDel2 = (ILaunchConfigurationDelegate2)configDel;
|
||||||
|
boolean ret;
|
||||||
|
ret = configDel2.preLaunchCheck(config, mode, monitor);
|
||||||
|
if (!ret)
|
||||||
|
return Status.CANCEL_STATUS;
|
||||||
|
if (!configDel2.buildForLaunch(config, mode, monitor))
|
||||||
|
return Status.OK_STATUS;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fall through, do a normal build
|
||||||
|
if (projects.isEmpty()) {
|
||||||
|
ResourcesPlugin.getWorkspace().build(IncrementalProjectBuilder.INCREMENTAL_BUILD, monitor);
|
||||||
|
} else {
|
||||||
|
Collection<IBuildConfiguration> buildConfigs = getBuildConfigs(projects);
|
||||||
|
ResourcesPlugin.getWorkspace().build(buildConfigs.toArray(new IBuildConfiguration[buildConfigs.size()]),
|
||||||
|
IncrementalProjectBuilder.INCREMENTAL_BUILD, true, monitor);
|
||||||
|
// TODO, may need to get the buildReferences argument from the descriptor
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
return e.getStatus();
|
||||||
|
}
|
||||||
|
|
||||||
return Status.OK_STATUS;
|
return Status.OK_STATUS;
|
||||||
};
|
};
|
||||||
}.schedule();
|
}.schedule();
|
||||||
|
|
|
@ -11,7 +11,8 @@
|
||||||
package org.eclipse.cdt.launchbar.ui.internal.commands;
|
package org.eclipse.cdt.launchbar.ui.internal.commands;
|
||||||
|
|
||||||
import org.eclipse.cdt.launchbar.core.ILaunchBarManager;
|
import org.eclipse.cdt.launchbar.core.ILaunchBarManager;
|
||||||
import org.eclipse.cdt.launchbar.core.ILaunchConfigurationDescriptor;
|
import org.eclipse.cdt.launchbar.core.ILaunchDescriptor;
|
||||||
|
import org.eclipse.cdt.launchbar.core.ILaunchTarget;
|
||||||
import org.eclipse.cdt.launchbar.ui.internal.Activator;
|
import org.eclipse.cdt.launchbar.ui.internal.Activator;
|
||||||
import org.eclipse.core.commands.AbstractHandler;
|
import org.eclipse.core.commands.AbstractHandler;
|
||||||
import org.eclipse.core.commands.ExecutionEvent;
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
|
@ -37,22 +38,15 @@ public class ConfigureActiveLaunchHandler extends AbstractHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||||
ILaunchConfigurationDescriptor activeLaunchConfiguration = launchBarManager.getActiveLaunchConfigurationDescriptor();
|
|
||||||
ILaunchMode activeLaunchMode = launchBarManager.getActiveLaunchMode();
|
|
||||||
|
|
||||||
if (activeLaunchConfiguration == null)
|
|
||||||
return Status.OK_STATUS;
|
|
||||||
|
|
||||||
ILaunchConfiguration launchConfiguration;
|
|
||||||
try {
|
|
||||||
launchConfiguration = activeLaunchConfiguration.getLaunchConfiguration();
|
|
||||||
} catch (CoreException e1) {
|
|
||||||
return e1.getStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
ILaunchDescriptor desc = launchBarManager.getActiveLaunchDescriptor();
|
||||||
|
ILaunchTarget target = launchBarManager.getActiveLaunchTarget();
|
||||||
|
ILaunchConfiguration launchConfiguration = launchBarManager.getLaunchConfiguration(desc, target);
|
||||||
|
if (launchConfiguration == null)
|
||||||
|
return Status.OK_STATUS;
|
||||||
ILaunchConfigurationWorkingCopy wc = launchConfiguration.getWorkingCopy();
|
ILaunchConfigurationWorkingCopy wc = launchConfiguration.getWorkingCopy();
|
||||||
// TODO, gah, this is internal. Get it added to DebugUIUtil
|
|
||||||
|
ILaunchMode activeLaunchMode = launchBarManager.getActiveLaunchMode();
|
||||||
ILaunchGroup group = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(launchConfiguration.getType(), activeLaunchMode.getIdentifier());
|
ILaunchGroup group = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(launchConfiguration.getType(), activeLaunchMode.getIdentifier());
|
||||||
|
|
||||||
if (DebugUITools.openLaunchConfigurationPropertiesDialog(HandlerUtil.getActiveShell(event), wc, group.getIdentifier()) == Window.OK)
|
if (DebugUITools.openLaunchConfigurationPropertiesDialog(HandlerUtil.getActiveShell(event), wc, group.getIdentifier()) == Window.OK)
|
||||||
|
@ -60,11 +54,6 @@ public class ConfigureActiveLaunchHandler extends AbstractHandler {
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
return e.getStatus();
|
return e.getStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status.OK_STATUS;
|
return Status.OK_STATUS;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getMode() {
|
|
||||||
return "config"; //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
package org.eclipse.cdt.launchbar.ui.internal.commands;
|
package org.eclipse.cdt.launchbar.ui.internal.commands;
|
||||||
|
|
||||||
import org.eclipse.cdt.launchbar.core.ILaunchBarManager;
|
import org.eclipse.cdt.launchbar.core.ILaunchBarManager;
|
||||||
import org.eclipse.cdt.launchbar.core.ILaunchConfigurationDescriptor;
|
import org.eclipse.cdt.launchbar.core.ILaunchDescriptor;
|
||||||
import org.eclipse.cdt.launchbar.core.ILaunchTarget;
|
import org.eclipse.cdt.launchbar.core.ILaunchTarget;
|
||||||
import org.eclipse.cdt.launchbar.ui.internal.Activator;
|
import org.eclipse.cdt.launchbar.ui.internal.Activator;
|
||||||
import org.eclipse.core.commands.AbstractHandler;
|
import org.eclipse.core.commands.AbstractHandler;
|
||||||
|
@ -21,50 +21,32 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
|
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||||
import org.eclipse.debug.core.ILaunchMode;
|
import org.eclipse.debug.core.ILaunchMode;
|
||||||
import org.eclipse.debug.ui.DebugUITools;
|
import org.eclipse.debug.ui.DebugUITools;
|
||||||
import org.eclipse.swt.widgets.Control;
|
|
||||||
import org.eclipse.swt.widgets.Display;
|
import org.eclipse.swt.widgets.Display;
|
||||||
import org.eclipse.ui.progress.UIJob;
|
import org.eclipse.ui.progress.UIJob;
|
||||||
|
|
||||||
public class LaunchActiveCommandHandler extends AbstractHandler {
|
public class LaunchActiveCommandHandler extends AbstractHandler {
|
||||||
|
|
||||||
private final ILaunchBarManager launchBarManager;
|
private final ILaunchBarManager launchBarManager;
|
||||||
|
|
||||||
public LaunchActiveCommandHandler() {
|
public LaunchActiveCommandHandler() {
|
||||||
launchBarManager = Activator.getService(ILaunchBarManager.class);
|
launchBarManager = Activator.getService(ILaunchBarManager.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||||
new UIJob(Display.getDefault(), "Launching Active Configuration") {
|
new UIJob(Display.getDefault(), "Launching Active Configuration") {
|
||||||
public IStatus runInUIThread(IProgressMonitor monitor) {
|
public IStatus runInUIThread(IProgressMonitor monitor) {
|
||||||
try {
|
try {
|
||||||
ILaunchConfigurationDescriptor desc = launchBarManager.getActiveLaunchConfigurationDescriptor();
|
ILaunchDescriptor desc = launchBarManager.getActiveLaunchDescriptor();
|
||||||
|
|
||||||
if (desc == null) {
|
|
||||||
// popout - No launch configuration
|
|
||||||
// showConfigurationErrorCallOut(NLS.bind("{0}\n{1}", Messages.RunActiveCommandHandler_No_Launch_Configuration_Selected,
|
|
||||||
// Messages.RunActiveCommandHanlder_Create_Launch_Configuration));
|
|
||||||
return Status.OK_STATUS;
|
|
||||||
}
|
|
||||||
|
|
||||||
ILaunchMode launchMode = launchBarManager.getActiveLaunchMode();
|
|
||||||
ILaunchTarget target = launchBarManager.getActiveLaunchTarget();
|
ILaunchTarget target = launchBarManager.getActiveLaunchTarget();
|
||||||
|
ILaunchConfiguration config = launchBarManager.getLaunchConfiguration(desc, target);
|
||||||
if (target == null) {
|
if (config == null)
|
||||||
// popout - No target
|
|
||||||
// if (TargetCorePlugin.getDefault().getTargetRegistry().getTargets().length == 1) {
|
|
||||||
// showTargetErrorCallOut(NLS.bind("{0}{1}", Messages.RunActiveCommandHandler_Cannot, getMode(launchMode)),
|
|
||||||
// DeviceErrors.Error.NO_DEVICES, Messages.RunActiveCommandHandler_Select_Manage_Devices);
|
|
||||||
// } else { // Don't think this can occur. Leaving just in case.
|
|
||||||
// showTargetErrorCallOut(NLS.bind("{0}{1}", Messages.RunActiveCommandHandler_Cannot, getMode(launchMode)),
|
|
||||||
// DeviceErrors.Error.NO_ACTIVE, Messages.RunActiveCommandHandler_Select_Device_Or_Simulator);
|
|
||||||
// }
|
|
||||||
return Status.OK_STATUS;
|
return Status.OK_STATUS;
|
||||||
}
|
ILaunchMode launchMode = launchBarManager.getActiveLaunchMode();
|
||||||
|
DebugUITools.launch(config, launchMode.getIdentifier());
|
||||||
DebugUITools.launch(desc.getLaunchConfiguration(), launchMode.getIdentifier());
|
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
return e.getStatus();
|
return e.getStatus();
|
||||||
}
|
}
|
||||||
|
@ -75,24 +57,6 @@ public class LaunchActiveCommandHandler extends AbstractHandler {
|
||||||
return Status.OK_STATUS;
|
return Status.OK_STATUS;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void showConfigurationErrorCallOut(final String error) {
|
|
||||||
// Control activeProjectControl = LaunchToolBar.getInstance().getActiveConfigurationControl();
|
|
||||||
// showErrorToolTipOnControl(error, activeProjectControl);
|
|
||||||
}
|
|
||||||
|
|
||||||
// protected void showTargetErrorCallOut(final String title, DeviceErrors.Error e, String action) {
|
|
||||||
// Control activeTargetControl = LaunchToolBar.getInstance().getActiveTargetControl();
|
|
||||||
// DeviceErrors.showCallOutErrorOnControl(activeTargetControl, title, e, action);
|
|
||||||
// }
|
|
||||||
|
|
||||||
public static void showErrorToolTipOnControl(final String error, Control activeProjectControl) {
|
|
||||||
// CalloutError tip = new CalloutError();
|
|
||||||
// tip.setTarget(activeProjectControl);
|
|
||||||
// tip.setHook(Position.BOTTOM_CENTER, Position.TOP_CENTER, new Point(0, 0));
|
|
||||||
// tip.setData(error);
|
|
||||||
// tip.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected String getMode(ILaunchMode launchMode) {
|
protected String getMode(ILaunchMode launchMode) {
|
||||||
return launchMode.getIdentifier(); //$NON-NLS-1$
|
return launchMode.getIdentifier(); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,13 +11,11 @@
|
||||||
package org.eclipse.cdt.launchbar.ui.internal.commands;
|
package org.eclipse.cdt.launchbar.ui.internal.commands;
|
||||||
|
|
||||||
import org.eclipse.cdt.launchbar.core.ILaunchBarManager;
|
import org.eclipse.cdt.launchbar.core.ILaunchBarManager;
|
||||||
import org.eclipse.cdt.launchbar.core.ILaunchConfigurationDescriptor;
|
|
||||||
import org.eclipse.cdt.launchbar.ui.internal.Activator;
|
import org.eclipse.cdt.launchbar.ui.internal.Activator;
|
||||||
import org.eclipse.core.commands.AbstractHandler;
|
import org.eclipse.core.commands.AbstractHandler;
|
||||||
import org.eclipse.core.commands.ExecutionEvent;
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
import org.eclipse.core.commands.ExecutionException;
|
import org.eclipse.core.commands.ExecutionException;
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
|
@ -26,7 +24,6 @@ import org.eclipse.core.runtime.jobs.Job;
|
||||||
import org.eclipse.debug.core.DebugException;
|
import org.eclipse.debug.core.DebugException;
|
||||||
import org.eclipse.debug.core.DebugPlugin;
|
import org.eclipse.debug.core.DebugPlugin;
|
||||||
import org.eclipse.debug.core.ILaunch;
|
import org.eclipse.debug.core.ILaunch;
|
||||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
|
||||||
|
|
||||||
public class StopActiveCommandHandler extends AbstractHandler {
|
public class StopActiveCommandHandler extends AbstractHandler {
|
||||||
private ILaunchBarManager launchBarManager;
|
private ILaunchBarManager launchBarManager;
|
||||||
|
@ -47,39 +44,25 @@ public class StopActiveCommandHandler extends AbstractHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void stopActiveLaunches() {
|
protected void stopActiveLaunches() {
|
||||||
ILaunch[] activeLaunches = DebugPlugin.getDefault().getLaunchManager().getLaunches();
|
final ILaunch[] activeLaunches = DebugPlugin.getDefault().getLaunchManager().getLaunches();
|
||||||
ILaunchConfigurationDescriptor desc = launchBarManager.getActiveLaunchConfigurationDescriptor();
|
if (activeLaunches != null && activeLaunches.length > 0) {
|
||||||
ILaunchConfiguration activeLaunchConfiguration;
|
new Job("Stopping launches") {
|
||||||
try {
|
protected IStatus run(IProgressMonitor monitor) {
|
||||||
activeLaunchConfiguration = desc.getLaunchConfiguration();
|
// TODO only stop the launches for the active launch descriptor
|
||||||
} catch (CoreException e) {
|
// Not sure we have the API to map that out yet.
|
||||||
Activator.log(e);
|
for (ILaunch launch : activeLaunches) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (int i = 0; i < activeLaunches.length; i++) {
|
|
||||||
final ILaunch launch = activeLaunches[i];
|
|
||||||
if (!launch.isTerminated() && activeLaunchConfiguration != null
|
|
||||||
&& matches(activeLaunchConfiguration, launch.getLaunchConfiguration())) {
|
|
||||||
Job job = new Job("Stopping " + activeLaunchConfiguration.getName()) {
|
|
||||||
@Override
|
|
||||||
protected IStatus run(IProgressMonitor monitor) {
|
|
||||||
try {
|
try {
|
||||||
launch.terminate();
|
launch.terminate();
|
||||||
} catch (DebugException e) {
|
} catch (DebugException e) {
|
||||||
Activator.log(e);
|
return e.getStatus();
|
||||||
}
|
}
|
||||||
return Status.OK_STATUS;
|
|
||||||
}
|
}
|
||||||
|
return Status.OK_STATUS;
|
||||||
};
|
};
|
||||||
job.schedule();
|
}.schedule();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean matches(ILaunchConfiguration activeLaunchConfiguration, ILaunchConfiguration launchConfiguration) {
|
|
||||||
return activeLaunchConfiguration.getName().equals(launchConfiguration.getName()); // just name for now
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void stopBuild() {
|
protected void stopBuild() {
|
||||||
Job job = new Job("Stopping build") {
|
Job job = new Job("Stopping build") {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -11,12 +11,10 @@
|
||||||
package org.eclipse.cdt.launchbar.ui.internal.controls;
|
package org.eclipse.cdt.launchbar.ui.internal.controls;
|
||||||
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.launchbar.core.ILaunchBarManager;
|
import org.eclipse.cdt.launchbar.core.ILaunchBarManager;
|
||||||
import org.eclipse.cdt.launchbar.core.ILaunchConfigurationDescriptor;
|
import org.eclipse.cdt.launchbar.core.ILaunchDescriptor;
|
||||||
import org.eclipse.cdt.launchbar.core.internal.DefaultLaunchConfigurationDescriptor;
|
import org.eclipse.cdt.launchbar.core.ILaunchTarget;
|
||||||
import org.eclipse.cdt.launchbar.ui.internal.Activator;
|
import org.eclipse.cdt.launchbar.ui.internal.Activator;
|
||||||
import org.eclipse.cdt.launchbar.ui.internal.LaunchBarUIManager;
|
import org.eclipse.cdt.launchbar.ui.internal.LaunchBarUIManager;
|
||||||
import org.eclipse.cdt.launchbar.ui.internal.dialogs.LaunchConfigurationEditDialog;
|
import org.eclipse.cdt.launchbar.ui.internal.dialogs.LaunchConfigurationEditDialog;
|
||||||
|
@ -26,13 +24,12 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.core.runtime.jobs.Job;
|
import org.eclipse.core.runtime.jobs.Job;
|
||||||
|
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||||
import org.eclipse.debug.core.ILaunchConfigurationType;
|
import org.eclipse.debug.core.ILaunchConfigurationType;
|
||||||
import org.eclipse.debug.core.ILaunchMode;
|
import org.eclipse.debug.core.ILaunchMode;
|
||||||
import org.eclipse.debug.internal.ui.DebugUIPlugin;
|
import org.eclipse.debug.internal.ui.DebugUIPlugin;
|
||||||
import org.eclipse.debug.internal.ui.launchConfigurations.LaunchGroupExtension;
|
import org.eclipse.debug.internal.ui.launchConfigurations.LaunchGroupExtension;
|
||||||
import org.eclipse.debug.ui.DebugUITools;
|
|
||||||
import org.eclipse.debug.ui.ILaunchGroup;
|
import org.eclipse.debug.ui.ILaunchGroup;
|
||||||
import org.eclipse.jface.resource.ImageDescriptor;
|
|
||||||
import org.eclipse.jface.viewers.ILabelProvider;
|
import org.eclipse.jface.viewers.ILabelProvider;
|
||||||
import org.eclipse.jface.viewers.IStructuredContentProvider;
|
import org.eclipse.jface.viewers.IStructuredContentProvider;
|
||||||
import org.eclipse.jface.viewers.LabelProvider;
|
import org.eclipse.jface.viewers.LabelProvider;
|
||||||
|
@ -78,58 +75,35 @@ public class ConfigSelector extends CSelector {
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public Object[] getElements(Object inputElement) {
|
public Object[] getElements(Object inputElement) {
|
||||||
ILaunchConfigurationDescriptor[] descs = getManager().getLaunchConfigurationDescriptors();
|
try {
|
||||||
if (descs.length > 0)
|
ILaunchDescriptor[] descs = getManager().getLaunchDescriptors();
|
||||||
return descs;
|
if (descs.length > 0)
|
||||||
|
return descs;
|
||||||
|
} catch (CoreException e) {
|
||||||
|
Activator.log(e.getStatus());
|
||||||
|
}
|
||||||
return noConfigs;
|
return noConfigs;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
setLabelProvider(new LabelProvider() {
|
setLabelProvider(new LabelProvider() {
|
||||||
private Map<ImageDescriptor, Image> images = new HashMap<>();
|
|
||||||
@Override
|
|
||||||
public void dispose() {
|
|
||||||
super.dispose();
|
|
||||||
for (Image image : images.values()) {
|
|
||||||
image.dispose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@Override
|
@Override
|
||||||
public Image getImage(Object element) {
|
public Image getImage(Object element) {
|
||||||
if (element instanceof ILaunchConfigurationDescriptor) {
|
if (element instanceof ILaunchDescriptor) {
|
||||||
ILaunchConfigurationDescriptor configDesc = (ILaunchConfigurationDescriptor)element;
|
ILaunchDescriptor configDesc = (ILaunchDescriptor)element;
|
||||||
ILabelProvider labelProvider = uiManager.getLabelProvider(configDesc);
|
ILabelProvider labelProvider = uiManager.getLabelProvider(configDesc);
|
||||||
if (labelProvider != null) {
|
if (labelProvider != null) {
|
||||||
return labelProvider.getImage(element);
|
return labelProvider.getImage(element);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default
|
|
||||||
if (element instanceof DefaultLaunchConfigurationDescriptor) {
|
|
||||||
try {
|
|
||||||
ILaunchConfigurationType type = configDesc.getLaunchConfiguration().getType();
|
|
||||||
ImageDescriptor imageDescriptor = DebugUITools.getDefaultImageDescriptor(type);
|
|
||||||
if (imageDescriptor != null) {
|
|
||||||
Image image = images.get(imageDescriptor);
|
|
||||||
if (image == null) {
|
|
||||||
image = imageDescriptor.createImage();
|
|
||||||
images.put(imageDescriptor, image);
|
|
||||||
}
|
|
||||||
return image;
|
|
||||||
}
|
|
||||||
} catch (CoreException e) {
|
|
||||||
Activator.log(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Default
|
return super.getImage(element);
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public String getText(Object element) {
|
public String getText(Object element) {
|
||||||
if (element instanceof String) {
|
if (element instanceof String) {
|
||||||
return (String)element;
|
return (String)element;
|
||||||
} else if (element instanceof ILaunchConfigurationDescriptor) {
|
} else if (element instanceof ILaunchDescriptor) {
|
||||||
ILaunchConfigurationDescriptor configDesc = (ILaunchConfigurationDescriptor)element;
|
ILaunchDescriptor configDesc = (ILaunchDescriptor)element;
|
||||||
ILabelProvider labelProvider = uiManager.getLabelProvider(configDesc);
|
ILabelProvider labelProvider = uiManager.getLabelProvider(configDesc);
|
||||||
if (labelProvider != null) {
|
if (labelProvider != null) {
|
||||||
return labelProvider.getText(element);
|
return labelProvider.getText(element);
|
||||||
|
@ -137,8 +111,7 @@ public class ConfigSelector extends CSelector {
|
||||||
// Default
|
// Default
|
||||||
return configDesc.getName();
|
return configDesc.getName();
|
||||||
}
|
}
|
||||||
|
return super.getText(element);
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -155,10 +128,10 @@ public class ConfigSelector extends CSelector {
|
||||||
@Override
|
@Override
|
||||||
protected void fireSelectionChanged() {
|
protected void fireSelectionChanged() {
|
||||||
Object selected = getSelection();
|
Object selected = getSelection();
|
||||||
if (selected instanceof ILaunchConfigurationDescriptor) {
|
if (selected instanceof ILaunchDescriptor) {
|
||||||
ILaunchConfigurationDescriptor configDesc = (ILaunchConfigurationDescriptor) selected;
|
ILaunchDescriptor configDesc = (ILaunchDescriptor) selected;
|
||||||
try {
|
try {
|
||||||
getManager().setActiveLaunchConfigurationDescriptor(configDesc);
|
getManager().setActiveLaunchDescriptor(configDesc);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
Activator.log(e);
|
Activator.log(e);
|
||||||
}
|
}
|
||||||
|
@ -167,20 +140,22 @@ public class ConfigSelector extends CSelector {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isEditable(Object element) {
|
public boolean isEditable(Object element) {
|
||||||
return element instanceof ILaunchConfigurationDescriptor;
|
return element instanceof ILaunchDescriptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleEdit(Object element) {
|
public void handleEdit(Object element) {
|
||||||
try {
|
try {
|
||||||
ILaunchConfigurationDescriptor config = (ILaunchConfigurationDescriptor) element;
|
ILaunchDescriptor desc = (ILaunchDescriptor) element;
|
||||||
ILaunchMode mode = getManager().getActiveLaunchMode();
|
ILaunchMode mode = getManager().getActiveLaunchMode();
|
||||||
ILaunchGroup group = DebugUIPlugin.getDefault().getLaunchConfigurationManager()
|
ILaunchTarget target = getManager().getActiveLaunchTarget();
|
||||||
.getLaunchGroup(config.getLaunchConfiguration().getType(), mode.getIdentifier());
|
ILaunchConfigurationType configType = getManager().getLaunchConfigurationType(desc, target);
|
||||||
|
ILaunchGroup group = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(configType, mode.getIdentifier());
|
||||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
|
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
|
||||||
LaunchGroupExtension groupExt = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(group.getIdentifier());
|
LaunchGroupExtension groupExt = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(group.getIdentifier());
|
||||||
if (groupExt != null) {
|
if (groupExt != null) {
|
||||||
final LaunchConfigurationEditDialog dialog = new LaunchConfigurationEditDialog(shell, config.getLaunchConfiguration(), groupExt);
|
ILaunchConfiguration config = getManager().getLaunchConfiguration(desc, target);
|
||||||
|
final LaunchConfigurationEditDialog dialog = new LaunchConfigurationEditDialog(shell, config, groupExt);
|
||||||
dialog.setInitialStatus(Status.OK_STATUS);
|
dialog.setInitialStatus(Status.OK_STATUS);
|
||||||
dialog.open();
|
dialog.open();
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,10 +15,11 @@ import javax.annotation.PreDestroy;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import org.eclipse.cdt.launchbar.core.ILaunchBarManager;
|
import org.eclipse.cdt.launchbar.core.ILaunchBarManager;
|
||||||
import org.eclipse.cdt.launchbar.core.ILaunchConfigurationDescriptor;
|
import org.eclipse.cdt.launchbar.core.ILaunchDescriptor;
|
||||||
import org.eclipse.cdt.launchbar.core.ILaunchTarget;
|
import org.eclipse.cdt.launchbar.core.ILaunchTarget;
|
||||||
import org.eclipse.cdt.launchbar.ui.internal.Activator;
|
import org.eclipse.cdt.launchbar.ui.internal.Activator;
|
||||||
import org.eclipse.cdt.launchbar.ui.internal.Messages;
|
import org.eclipse.cdt.launchbar.ui.internal.Messages;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.debug.core.ILaunchMode;
|
import org.eclipse.debug.core.ILaunchMode;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.DisposeEvent;
|
import org.eclipse.swt.events.DisposeEvent;
|
||||||
|
@ -80,14 +81,18 @@ public class LaunchBarControl implements ILaunchBarManager.Listener {
|
||||||
targetSelector.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
|
targetSelector.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
|
||||||
targetSelector.setInput(manager);
|
targetSelector.setInput(manager);
|
||||||
|
|
||||||
ILaunchConfigurationDescriptor configDesc = manager.getActiveLaunchConfigurationDescriptor();
|
try {
|
||||||
configSelector.setSelection(configDesc == null ? null : configDesc);
|
ILaunchDescriptor configDesc = manager.getActiveLaunchDescriptor();
|
||||||
|
configSelector.setSelection(configDesc == null ? null : configDesc);
|
||||||
ILaunchMode mode = manager.getActiveLaunchMode();
|
|
||||||
modeSelector.setSelection(mode == null ? null : mode);
|
ILaunchMode mode = manager.getActiveLaunchMode();
|
||||||
|
modeSelector.setSelection(mode == null ? null : mode);
|
||||||
ILaunchTarget target = manager.getActiveLaunchTarget();
|
|
||||||
targetSelector.setSelection(target == null ? null : target);
|
ILaunchTarget target = manager.getActiveLaunchTarget();
|
||||||
|
targetSelector.setSelection(target == null ? null : target);
|
||||||
|
} catch (CoreException e) {
|
||||||
|
Activator.log(e.getStatus());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreDestroy
|
@PreDestroy
|
||||||
|
@ -113,43 +118,61 @@ public class LaunchBarControl implements ILaunchBarManager.Listener {
|
||||||
@Override
|
@Override
|
||||||
public void activeConfigurationDescriptorChanged() {
|
public void activeConfigurationDescriptorChanged() {
|
||||||
if (configSelector != null && !configSelector.isDisposed()) {
|
if (configSelector != null && !configSelector.isDisposed()) {
|
||||||
final ILaunchConfigurationDescriptor configDesc = manager.getActiveLaunchConfigurationDescriptor();
|
try {
|
||||||
configSelector.getDisplay().asyncExec(new Runnable() {
|
final ILaunchDescriptor configDesc = manager.getActiveLaunchDescriptor();
|
||||||
@Override
|
configSelector.getDisplay().asyncExec(new Runnable() {
|
||||||
public void run() {
|
@Override
|
||||||
if (!configSelector.isDisposed())
|
public void run() {
|
||||||
configSelector.setSelection(configDesc == null ? null : configDesc);
|
if (!configSelector.isDisposed())
|
||||||
}
|
configSelector.setSelection(configDesc == null ? null : configDesc);
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
} catch (CoreException e) {
|
||||||
|
Activator.log(e.getStatus());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void activeLaunchModeChanged() {
|
public void activeLaunchModeChanged() {
|
||||||
if (modeSelector != null && !modeSelector.isDisposed()) {
|
if (modeSelector != null && !modeSelector.isDisposed()) {
|
||||||
final ILaunchMode mode = manager.getActiveLaunchMode();
|
try {
|
||||||
modeSelector.getDisplay().asyncExec(new Runnable() {
|
final ILaunchMode mode = manager.getActiveLaunchMode();
|
||||||
@Override
|
modeSelector.getDisplay().asyncExec(new Runnable() {
|
||||||
public void run() {
|
@Override
|
||||||
if (!modeSelector.isDisposed())
|
public void run() {
|
||||||
modeSelector.setSelection(mode == null ? null : mode);
|
if (!modeSelector.isDisposed())
|
||||||
}
|
modeSelector.setSelection(mode == null ? null : mode);
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
} catch (CoreException e) {
|
||||||
|
Activator.log(e.getStatus());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void activeLaunchTargetChanged() {
|
public void activeLaunchTargetChanged() {
|
||||||
if (targetSelector != null && !targetSelector.isDisposed()) {
|
if (targetSelector != null && !targetSelector.isDisposed()) {
|
||||||
final ILaunchTarget target = manager.getActiveLaunchTarget();
|
try {
|
||||||
targetSelector.getDisplay().asyncExec(new Runnable() {
|
final ILaunchTarget target = manager.getActiveLaunchTarget();
|
||||||
@Override
|
targetSelector.getDisplay().asyncExec(new Runnable() {
|
||||||
public void run() {
|
@Override
|
||||||
if (!targetSelector.isDisposed())
|
public void run() {
|
||||||
targetSelector.setSelection(target == null ? null : target);
|
if (!targetSelector.isDisposed())
|
||||||
}
|
targetSelector.setSelection(target == null ? null : target);
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
} catch (CoreException e) {
|
||||||
|
Activator.log(e.getStatus());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void launchDescriptorRemoved(ILaunchDescriptor descriptor) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,6 @@ import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.launchbar.core.ILaunchBarManager;
|
import org.eclipse.cdt.launchbar.core.ILaunchBarManager;
|
||||||
import org.eclipse.cdt.launchbar.core.ILaunchConfigurationDescriptor;
|
|
||||||
import org.eclipse.cdt.launchbar.ui.internal.Activator;
|
import org.eclipse.cdt.launchbar.ui.internal.Activator;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.debug.core.ILaunchMode;
|
import org.eclipse.debug.core.ILaunchMode;
|
||||||
|
@ -49,7 +48,7 @@ public class ModeSelector extends CSelector {
|
||||||
@Override
|
@Override
|
||||||
public Object[] getElements(Object inputElement) {
|
public Object[] getElements(Object inputElement) {
|
||||||
try {
|
try {
|
||||||
ILaunchMode[] modes = getManager().getActiveLaunchConfigurationDescriptor().getLaunchModes();
|
ILaunchMode[] modes = getManager().getLaunchModes();
|
||||||
if (modes.length > 0)
|
if (modes.length > 0)
|
||||||
return modes;
|
return modes;
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
|
@ -70,8 +69,7 @@ public class ModeSelector extends CSelector {
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public Image getImage(Object element) {
|
public Image getImage(Object element) {
|
||||||
ILaunchConfigurationDescriptor config = getManager().getActiveLaunchConfigurationDescriptor();
|
if (element instanceof ILaunchMode) {
|
||||||
if (config != null && element instanceof ILaunchMode) {
|
|
||||||
ILaunchMode mode = (ILaunchMode) element;
|
ILaunchMode mode = (ILaunchMode) element;
|
||||||
ILaunchGroup group = getLaunchGroup(mode.getIdentifier());
|
ILaunchGroup group = getLaunchGroup(mode.getIdentifier());
|
||||||
if (group != null) {
|
if (group != null) {
|
||||||
|
@ -88,8 +86,7 @@ public class ModeSelector extends CSelector {
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public String getText(Object element) {
|
public String getText(Object element) {
|
||||||
ILaunchConfigurationDescriptor config = getManager().getActiveLaunchConfigurationDescriptor();
|
if (element instanceof ILaunchMode) {
|
||||||
if (config != null && element instanceof ILaunchMode) {
|
|
||||||
ILaunchMode mode = (ILaunchMode) element;
|
ILaunchMode mode = (ILaunchMode) element;
|
||||||
ILaunchGroup group = getLaunchGroup(mode.getIdentifier());
|
ILaunchGroup group = getLaunchGroup(mode.getIdentifier());
|
||||||
if (group != null) {
|
if (group != null) {
|
||||||
|
@ -147,7 +144,11 @@ public class ModeSelector extends CSelector {
|
||||||
Object selected = getSelection();
|
Object selected = getSelection();
|
||||||
if (selected instanceof ILaunchMode) {
|
if (selected instanceof ILaunchMode) {
|
||||||
ILaunchMode mode = (ILaunchMode) selected;
|
ILaunchMode mode = (ILaunchMode) selected;
|
||||||
getManager().setActiveLaunchMode(mode);
|
try {
|
||||||
|
getManager().setActiveLaunchMode(mode);
|
||||||
|
} catch (CoreException e) {
|
||||||
|
Activator.log(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,14 +18,13 @@ import org.eclipse.cdt.launchbar.ui.IHoverProvider;
|
||||||
import org.eclipse.cdt.launchbar.ui.ILaunchBarUIConstants;
|
import org.eclipse.cdt.launchbar.ui.ILaunchBarUIConstants;
|
||||||
import org.eclipse.cdt.launchbar.ui.internal.Activator;
|
import org.eclipse.cdt.launchbar.ui.internal.Activator;
|
||||||
import org.eclipse.cdt.launchbar.ui.internal.LaunchBarUIManager;
|
import org.eclipse.cdt.launchbar.ui.internal.LaunchBarUIManager;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.jface.viewers.ILabelProvider;
|
import org.eclipse.jface.viewers.ILabelProvider;
|
||||||
import org.eclipse.jface.viewers.IStructuredContentProvider;
|
import org.eclipse.jface.viewers.IStructuredContentProvider;
|
||||||
import org.eclipse.jface.viewers.LabelProvider;
|
import org.eclipse.jface.viewers.LabelProvider;
|
||||||
import org.eclipse.jface.viewers.Viewer;
|
import org.eclipse.jface.viewers.Viewer;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.MouseAdapter;
|
|
||||||
import org.eclipse.swt.events.MouseEvent;
|
import org.eclipse.swt.events.MouseEvent;
|
||||||
import org.eclipse.swt.events.MouseListener;
|
|
||||||
import org.eclipse.swt.events.MouseTrackAdapter;
|
import org.eclipse.swt.events.MouseTrackAdapter;
|
||||||
import org.eclipse.swt.events.MouseTrackListener;
|
import org.eclipse.swt.events.MouseTrackListener;
|
||||||
import org.eclipse.swt.events.PaintEvent;
|
import org.eclipse.swt.events.PaintEvent;
|
||||||
|
@ -63,9 +62,13 @@ public class TargetSelector extends CSelector {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object[] getElements(Object inputElement) {
|
public Object[] getElements(Object inputElement) {
|
||||||
ILaunchTarget[] targets = getManager().getActiveLaunchConfigurationDescriptor().getLaunchTargets();
|
try {
|
||||||
if (targets.length > 0)
|
ILaunchTarget[] targets = getManager().getLaunchTargets();
|
||||||
return targets;
|
if (targets.length > 0)
|
||||||
|
return targets;
|
||||||
|
} catch (CoreException e) {
|
||||||
|
Activator.log(e.getStatus());
|
||||||
|
}
|
||||||
return noTargets;
|
return noTargets;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -151,7 +154,10 @@ public class TargetSelector extends CSelector {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasActionArea() {
|
public boolean hasActionArea() {
|
||||||
return uiManager.getAddTargetCommand(getManager().getActiveLaunchConfigurationDescriptor()) != null;
|
// TODO need an add target command similar to the add configuration that allows the user
|
||||||
|
// to select the target type.
|
||||||
|
// return uiManager.getAddTargetCommand(getManager().getActiveLaunchDescriptor()) != null;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -184,15 +190,19 @@ public class TargetSelector extends CSelector {
|
||||||
createLabel.setText("Add New Target...");
|
createLabel.setText("Add New Target...");
|
||||||
createLabel.setBackground(white);
|
createLabel.setBackground(white);
|
||||||
|
|
||||||
final String command = uiManager.getAddTargetCommand(getManager().getActiveLaunchConfigurationDescriptor());
|
// try {
|
||||||
MouseListener mouseListener = new MouseAdapter() {
|
// final String command = uiManager.getAddTargetCommand(getManager().getActiveLaunchDescriptor());
|
||||||
public void mouseUp(org.eclipse.swt.events.MouseEvent e) {
|
// MouseListener mouseListener = new MouseAdapter() {
|
||||||
Activator.runCommand(command);
|
// public void mouseUp(org.eclipse.swt.events.MouseEvent e) {
|
||||||
}
|
// Activator.runCommand(command);
|
||||||
};
|
// }
|
||||||
|
// };
|
||||||
createButton.addMouseListener(mouseListener);
|
//
|
||||||
createLabel.addMouseListener(mouseListener);
|
// createButton.addMouseListener(mouseListener);
|
||||||
|
// createLabel.addMouseListener(mouseListener);
|
||||||
|
// } catch (CoreException e) {
|
||||||
|
// Activator.log(e.getStatus());
|
||||||
|
// }
|
||||||
|
|
||||||
MouseTrackListener mouseTrackListener = new MouseTrackAdapter() {
|
MouseTrackListener mouseTrackListener = new MouseTrackAdapter() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -216,7 +226,11 @@ public class TargetSelector extends CSelector {
|
||||||
Object selection = getSelection();
|
Object selection = getSelection();
|
||||||
if (selection instanceof ILaunchTarget) {
|
if (selection instanceof ILaunchTarget) {
|
||||||
ILaunchTarget target = (ILaunchTarget) selection;
|
ILaunchTarget target = (ILaunchTarget) selection;
|
||||||
uiManager.getManager().setActiveLaunchTarget(target);
|
try {
|
||||||
|
uiManager.getManager().setActiveLaunchTarget(target);
|
||||||
|
} catch (CoreException e) {
|
||||||
|
Activator.log(e.getStatus());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue