1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-25 18:05:33 +02:00

Add build settings tabs for descriptor/config editor.

Add a mechanism to allow extenders to provide tabs for build settings
in the descriptor config editor.

Also move to pom-less builds.

Change-Id: I850898aba94c38d69717c9b8366de3b9a7031ff6
This commit is contained in:
Doug Schaefer 2017-09-06 13:28:47 -04:00
parent 374059131b
commit 4a25d3cf1d
16 changed files with 215 additions and 198 deletions

8
.mvn/extensions.xml Normal file
View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<extensions>
<extension>
<groupId>org.eclipse.tycho.extras</groupId>
<artifactId>tycho-pomless</artifactId>
<version>1.0.0</version>
</extension>
</extensions>

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: LaunchBar Core
Bundle-SymbolicName: org.eclipse.launchbar.core;singleton:=true
Bundle-Version: 2.1.1.qualifier
Bundle-Version: 2.2.0.qualifier
Bundle-Activator: org.eclipse.launchbar.core.internal.Activator
Bundle-Vendor: Eclipse CDT
Require-Bundle: org.eclipse.core.runtime,
@ -11,6 +11,6 @@ Require-Bundle: org.eclipse.core.runtime,
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.launchbar.core,
org.eclipse.launchbar.core.internal;x-friends:="org.eclipse.launchbar.core.tests",
org.eclipse.launchbar.core.internal;x-friends:="org.eclipse.launchbar.core.tests,org.eclipse.launchbar.ui",
org.eclipse.launchbar.core.target,
org.eclipse.launchbar.core.target.launch

View file

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.launchbar</groupId>
<artifactId>parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>org.eclipse.launchbar.core</artifactId>
<version>2.1.1-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2014 QNX Software Systems and others.
* Copyright (c) 2014, 2017 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
@ -34,6 +34,12 @@ public class DefaultLaunchDescriptor extends PlatformObject implements ILaunchDe
if (ILaunchConfiguration.class.equals(adapter)) {
return adapter.cast(configuration);
}
T obj = configuration.getAdapter(adapter);
if (obj != null) {
return obj;
}
return super.getAdapter(adapter);
}

View file

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.launchbar</groupId>
<artifactId>parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>org.eclipse.launchbar.remote.core</artifactId>
<version>1.0.1-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>

View file

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.launchbar</groupId>
<artifactId>parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>org.eclipse.launchbar.remote.ui</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>

View file

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.launchbar</groupId>
<artifactId>parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>org.eclipse.launchbar.ui.controls</artifactId>
<version>1.0.1-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>

View file

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.launchbar</groupId>
<artifactId>parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>org.eclipse.launchbar.ui</artifactId>
<version>2.1.1-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>

View file

@ -19,6 +19,7 @@
<complexType>
<sequence minOccurs="0" maxOccurs="unbounded">
<element ref="descriptorUI"/>
<element ref="buildTabGroup"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
@ -48,6 +49,11 @@
</element>
<element name="descriptorUI">
<annotation>
<documentation>
Provides a label provider to visualize launch descriptors in the descriptor selector.
</documentation>
</annotation>
<complexType>
<attribute name="descriptorTypeId" type="string" use="required">
<annotation>
@ -72,6 +78,46 @@
</complexType>
</element>
<element name="buildTabGroup">
<annotation>
<documentation>
Allows launch config providers to add build settings tabs to existing launch configuration tab groups when edited from the launch bar.
</documentation>
</annotation>
<complexType>
<attribute name="launchConfigType" type="string" use="required">
<annotation>
<documentation>
</documentation>
<appinfo>
<meta.attribute kind="identifier" basedOn="org.eclipse.debug.core.launchConfigurationTypes/launchConfigurationType/@id"/>
</appinfo>
</annotation>
</attribute>
<attribute name="launchDescriptorType" type="string" use="required">
<annotation>
<documentation>
</documentation>
<appinfo>
<meta.attribute kind="identifier" basedOn="org.eclipse.launchbar.core.launchBarContributions/descriptorType/@id"/>
</appinfo>
</annotation>
</attribute>
<attribute name="tabGroup" type="string" use="required">
<annotation>
<documentation>
</documentation>
<appinfo>
<meta.attribute kind="java" basedOn=":org.eclipse.debug.ui.ILaunchConfigurationTabGroup"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appinfo>
<meta.section type="since"/>

View file

@ -39,6 +39,7 @@ public class LaunchBarLaunchConfigDialog extends TitleAreaDialog implements ILau
private final ILaunchDescriptor descriptor;
private final ILaunchMode mode;
private final ILaunchTarget target;
private final ILaunchConfigurationTabGroup buildTabGroup;
private ILaunchConfigurationTabGroup group;
private CTabFolder tabFolder;
@ -47,12 +48,16 @@ public class LaunchBarLaunchConfigDialog extends TitleAreaDialog implements ILau
private boolean initing;
public LaunchBarLaunchConfigDialog(Shell shell, ILaunchConfigurationWorkingCopy workingCopy,
ILaunchDescriptor descriptor, ILaunchMode mode, ILaunchTarget target) {
ILaunchDescriptor descriptor, ILaunchMode mode, ILaunchTarget target,
ILaunchConfigurationTabGroup buildTabGroup) {
super(shell);
this.workingCopy = workingCopy;
this.descriptor = descriptor;
this.mode = mode;
this.target = target;
this.buildTabGroup = buildTabGroup;
setShellStyle(getShellStyle() | SWT.RESIZE);
}
@ -123,25 +128,21 @@ public class LaunchBarLaunchConfigDialog extends TitleAreaDialog implements ILau
});
try {
if (buildTabGroup != null) {
buildTabGroup.createTabs(this, mode.getIdentifier());
for (ILaunchConfigurationTab configTab : buildTabGroup.getTabs()) {
installTab(configTab, tabFolder);
}
buildTabGroup.initializeFrom(workingCopy);
}
group = LaunchConfigurationPresentationManager.getDefault().getTabGroup(workingCopy, mode.getIdentifier());
group.createTabs(this, mode.getIdentifier());
for (ILaunchConfigurationTab configTab : group.getTabs()) {
configTab.setLaunchConfigurationDialog(this);
CTabItem tabItem = new CTabItem(tabFolder, SWT.NONE);
tabItem.setData(configTab);
tabItem.setText(configTab.getName());
tabItem.setImage(configTab.getImage());
Composite tabComp = new Composite(tabFolder, SWT.NONE);
tabComp.setLayout(new GridLayout());
tabItem.setControl(tabComp);
configTab.createControl(tabComp);
Control configControl = configTab.getControl();
configControl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
CTabItem tabItem = installTab(configTab, tabFolder);
if (lastSelection == null) {
// Select the first tab by default
tabFolder.setSelection(tabItem);
@ -162,8 +163,30 @@ public class LaunchBarLaunchConfigDialog extends TitleAreaDialog implements ILau
return composite;
}
private CTabItem installTab(ILaunchConfigurationTab tab, CTabFolder tabFolder) {
tab.setLaunchConfigurationDialog(this);
CTabItem tabItem = new CTabItem(tabFolder, SWT.NONE);
tabItem.setData(tab);
tabItem.setText(tab.getName());
tabItem.setImage(tab.getImage());
Composite tabComp = new Composite(tabFolder, SWT.NONE);
tabComp.setLayout(new GridLayout());
tabItem.setControl(tabComp);
tab.createControl(tabComp);
Control configControl = tab.getControl();
configControl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
return tabItem;
}
@Override
protected void okPressed() {
if (buildTabGroup != null) {
buildTabGroup.performApply(workingCopy);
}
group.performApply(workingCopy);
super.okPressed();
}
@ -285,7 +308,16 @@ public class LaunchBarLaunchConfigDialog extends TitleAreaDialog implements ILau
@Override
public ILaunchConfigurationTab[] getTabs() {
return group.getTabs();
if (buildTabGroup != null) {
ILaunchConfigurationTab[] buildTabs = buildTabGroup.getTabs();
ILaunchConfigurationTab[] mainTabs = group.getTabs();
ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[buildTabs.length + mainTabs.length];
System.arraycopy(buildTabs, 0, tabs, 0, buildTabs.length);
System.arraycopy(mainTabs, 0, tabs, buildTabs.length, mainTabs.length);
return tabs;
} else {
return group.getTabs();
}
}
@Override

View file

@ -31,7 +31,6 @@ import org.eclipse.debug.ui.ILaunchConfigurationTabGroup;
import org.eclipse.debug.ui.ILaunchGroup;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.window.Window;
import org.eclipse.launchbar.core.ILaunchBarManager;
import org.eclipse.launchbar.core.ILaunchDescriptor;
@ -43,12 +42,18 @@ import org.eclipse.ui.PlatformUI;
public class LaunchBarUIManager implements ILaunchBarUIManager {
private Map<String, ExecutableExtension<ILabelProvider>> descriptorLabelProviders = null;
private Map<String, ExecutableExtension<ILabelProvider>> descriptorLabelProviders;
// Map<configTypeId, descriptorTypeId, tabGroup>
private Map<String, Map<String, ExecutableExtension<ILaunchConfigurationTabGroup>>> buildTabGroups;
private ILaunchBarManager manager = Activator.getService(ILaunchBarManager.class);
private void init() {
if (descriptorLabelProviders == null) {
descriptorLabelProviders = new HashMap<>();
buildTabGroups = new HashMap<>();
IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(Activator.PLUGIN_ID,
"launchBarUIContributions"); //$NON-NLS-1$
IExtension[] extensions = point.getExtensions();
@ -60,6 +65,19 @@ public class LaunchBarUIManager implements ILaunchBarUIManager {
ExecutableExtension<ILabelProvider> labelProvider = new ExecutableExtension<>(element,
"labelProvider"); //$NON-NLS-1$
descriptorLabelProviders.put(descriptorTypeId, labelProvider);
} else if (elementName.equals("buildTabGroup")) { //$NON-NLS-1$
String launchConfigTypeId = element.getAttribute("launchConfigType"); //$NON-NLS-1$
String descriptorTypeId = element.getAttribute("launchDescriptorType"); //$NON-NLS-1$
ExecutableExtension<ILaunchConfigurationTabGroup> tabGroup = new ExecutableExtension<>(element,
"tabGroup"); //$NON-NLS-1$
Map<String, ExecutableExtension<ILaunchConfigurationTabGroup>> descGroup = buildTabGroups.get(launchConfigTypeId);
if (descGroup == null) {
descGroup = new HashMap<>();
buildTabGroups.put(launchConfigTypeId, descGroup);
}
descGroup.put(descriptorTypeId, tabGroup);
}
}
}
@ -88,46 +106,36 @@ public class LaunchBarUIManager implements ILaunchBarUIManager {
return s;
}
if (true) {
try {
ILaunchMode mode = manager.getActiveLaunchMode();
ILaunchTarget target = manager.getActiveLaunchTarget();
ILaunchConfiguration config = manager.getLaunchConfiguration(descriptor, target);
try {
ILaunchMode mode = manager.getActiveLaunchMode();
ILaunchTarget target = manager.getActiveLaunchTarget();
ILaunchConfiguration config = manager.getLaunchConfiguration(descriptor, target);
ILaunchConfigurationWorkingCopy workingCopy = config.getWorkingCopy();
LaunchBarLaunchConfigDialog dialog = new LaunchBarLaunchConfigDialog(shell, workingCopy, descriptor,
mode, target);
if (dialog.open() == Window.OK) {
if (!workingCopy.getOriginal().equals(workingCopy)
&& !workingCopy.getOriginal().getAttributes().equals(workingCopy.getAttributes())) {
workingCopy.doSave();
}
ILaunchConfigurationWorkingCopy workingCopy = config.getWorkingCopy();
ILaunchConfigurationTabGroup buildTabGroup = null;
Map<String, ExecutableExtension<ILaunchConfigurationTabGroup>> descGroups = buildTabGroups
.get(config.getType().getIdentifier());
if (descGroups != null) {
ExecutableExtension<ILaunchConfigurationTabGroup> tabGroup = descGroups
.get(manager.getDescriptorTypeId(descriptor.getType()));
if (tabGroup != null) {
buildTabGroup = tabGroup.create();
}
} catch (CoreException e) {
return e.getStatus();
}
} else {
// At this point, no error handling should be needed.
try {
ILaunchBarManager manager = Activator.getService(ILaunchBarManager.class);
ILaunchMode mode = manager.getActiveLaunchMode();
ILaunchTarget target = manager.getActiveLaunchTarget();
ILaunchConfigurationType configType = manager.getLaunchConfigurationType(descriptor, target);
ILaunchGroup group = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(
configType,
mode.getIdentifier());
ILaunchConfiguration config = manager.getLaunchConfiguration(descriptor, target);
if (config instanceof ILaunchConfigurationWorkingCopy
&& ((ILaunchConfigurationWorkingCopy) config).isDirty()) {
config = ((ILaunchConfigurationWorkingCopy) config).doSave();
LaunchBarLaunchConfigDialog dialog = new LaunchBarLaunchConfigDialog(shell, workingCopy, descriptor, mode,
target, buildTabGroup);
if (dialog.open() == Window.OK) {
if (!workingCopy.getOriginal().equals(workingCopy)
&& !workingCopy.getOriginal().getAttributes().equals(workingCopy.getAttributes())) {
workingCopy.doSave();
}
// open real eclipse launch configurations dialog
DebugUIPlugin.openLaunchConfigurationsDialog(shell, new StructuredSelection(config),
group.getIdentifier(), false);
} catch (CoreException e2) {
return e2.getStatus();
}
} catch (CoreException e) {
return e.getStatus();
}
return Status.OK_STATUS;
}

15
bundles/pom.xml Normal file
View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.launchbar</groupId>
<artifactId>parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>bundles-parent</artifactId>
<packaging>pom</packaging>
</project>

View file

@ -2,7 +2,7 @@
<feature
id="org.eclipse.launchbar"
label="%featureName"
version="2.1.2.qualifier"
version="2.2.0.qualifier"
provider-name="%providerName"
license-feature="org.eclipse.license"
license-feature-version="0.0.0">

View file

@ -1,51 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.launchbar</groupId>
<artifactId>parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<groupId>org.eclipse.launchbar.features</groupId>
<artifactId>org.eclipse.launchbar</artifactId>
<version>2.1.2-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho.extras</groupId>
<artifactId>tycho-source-feature-plugin</artifactId>
<version>${tycho-extras-version}</version>
<executions>
<execution>
<id>source-feature</id>
<phase>package</phase>
<goals>
<goal>source-feature</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-p2-plugin</artifactId>
<version>${tycho-version}</version>
<executions>
<execution>
<id>attach-p2-metadata</id>
<phase>package</phase>
<goals>
<goal>p2-metadata</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

15
features/pom.xml Normal file
View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.launchbar</groupId>
<artifactId>parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>features-parent</artifactId>
<packaging>pom</packaging>
</project>

28
pom.xml
View file

@ -253,6 +253,34 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho.extras</groupId>
<artifactId>tycho-source-feature-plugin</artifactId>
<version>${tycho-extras-version}</version>
<executions>
<execution>
<id>source-feature</id>
<phase>package</phase>
<goals>
<goal>source-feature</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-p2-plugin</artifactId>
<version>${tycho-version}</version>
<executions>
<execution>
<id>attach-p2-metadata</id>
<phase>package</phase>
<goals>
<goal>p2-metadata</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>