mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-16 04:35:45 +02:00
Set title and description for new target wizard selection page.
Change-Id: I15ade69533ef0227864c0723678d9df672db39c4
This commit is contained in:
parent
9419e2213f
commit
eb93740aba
3 changed files with 174 additions and 165 deletions
|
@ -39,6 +39,10 @@ public class Messages extends NLS {
|
||||||
|
|
||||||
public static String NewLaunchTargetWizard_Title;
|
public static String NewLaunchTargetWizard_Title;
|
||||||
|
|
||||||
|
public static String NewLaunchTargetWizardSelectionPage_Description;
|
||||||
|
|
||||||
|
public static String NewLaunchTargetWizardSelectionPage_Title;
|
||||||
|
|
||||||
public static String DescriptorMustNotBeNull;
|
public static String DescriptorMustNotBeNull;
|
||||||
public static String DescriptorMustNotBeNullDesc;
|
public static String DescriptorMustNotBeNullDesc;
|
||||||
public static String NoActiveTarget;
|
public static String NoActiveTarget;
|
||||||
|
|
|
@ -28,6 +28,8 @@ NewLaunchConfigTypePage2_Mode=Launch Mode
|
||||||
NewLaunchConfigTypePage2_Type=Launch Configuration Type
|
NewLaunchConfigTypePage2_Type=Launch Configuration Type
|
||||||
NewLaunchConfigWizard_0=Create Launch Configuration
|
NewLaunchConfigWizard_0=Create Launch Configuration
|
||||||
NewLaunchTargetWizard_Title=New Launch Target
|
NewLaunchTargetWizard_Title=New Launch Target
|
||||||
|
NewLaunchTargetWizardSelectionPage_Description=Select the type of target to create.
|
||||||
|
NewLaunchTargetWizardSelectionPage_Title=New Launch Target
|
||||||
|
|
||||||
DescriptorMustNotBeNull=Descriptor must not be null
|
DescriptorMustNotBeNull=Descriptor must not be null
|
||||||
DescriptorMustNotBeNullDesc=The launch descriptor must not be null.
|
DescriptorMustNotBeNullDesc=The launch descriptor must not be null.
|
||||||
|
|
|
@ -1,165 +1,168 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2015 IBM Corporation and others.
|
* Copyright (c) 2000, 2015 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.launchbar.ui.internal.target;
|
package org.eclipse.launchbar.ui.internal.target;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
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;
|
||||||
import org.eclipse.core.runtime.IExtensionPoint;
|
import org.eclipse.core.runtime.IExtensionPoint;
|
||||||
import org.eclipse.core.runtime.Platform;
|
import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.jface.resource.ImageDescriptor;
|
import org.eclipse.jface.resource.ImageDescriptor;
|
||||||
import org.eclipse.jface.viewers.StructuredSelection;
|
import org.eclipse.jface.viewers.StructuredSelection;
|
||||||
import org.eclipse.jface.wizard.IWizardPage;
|
import org.eclipse.jface.wizard.IWizardPage;
|
||||||
import org.eclipse.jface.wizard.Wizard;
|
import org.eclipse.jface.wizard.Wizard;
|
||||||
import org.eclipse.jface.wizard.WizardPage;
|
import org.eclipse.jface.wizard.WizardPage;
|
||||||
import org.eclipse.launchbar.ui.internal.Activator;
|
import org.eclipse.launchbar.ui.internal.Activator;
|
||||||
import org.eclipse.launchbar.ui.target.LaunchTargetWizard;
|
import org.eclipse.launchbar.ui.internal.Messages;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.launchbar.ui.target.LaunchTargetWizard;
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.SelectionListener;
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
import org.eclipse.swt.layout.GridData;
|
import org.eclipse.swt.events.SelectionListener;
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
import org.eclipse.swt.layout.GridData;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
import org.eclipse.swt.widgets.Table;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.TableItem;
|
import org.eclipse.swt.widgets.Table;
|
||||||
import org.eclipse.ui.IWorkbenchWizard;
|
import org.eclipse.swt.widgets.TableItem;
|
||||||
import org.eclipse.ui.PlatformUI;
|
import org.eclipse.ui.IWorkbenchWizard;
|
||||||
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
import org.eclipse.ui.PlatformUI;
|
||||||
|
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
||||||
class NewLaunchTargetWizardSelectionPage extends WizardPage {
|
|
||||||
|
class NewLaunchTargetWizardSelectionPage extends WizardPage {
|
||||||
private Table table;
|
|
||||||
|
private Table table;
|
||||||
public NewLaunchTargetWizardSelectionPage() {
|
|
||||||
super(NewLaunchTargetWizardSelectionPage.class.getName());
|
public NewLaunchTargetWizardSelectionPage() {
|
||||||
}
|
super(NewLaunchTargetWizardSelectionPage.class.getName());
|
||||||
|
setTitle(Messages.NewLaunchTargetWizardSelectionPage_Title);
|
||||||
@Override
|
setDescription(Messages.NewLaunchTargetWizardSelectionPage_Description);
|
||||||
public void createControl(Composite parent) {
|
}
|
||||||
Composite comp = new Composite(parent, SWT.NONE);
|
|
||||||
comp.setLayout(new GridLayout());
|
@Override
|
||||||
|
public void createControl(Composite parent) {
|
||||||
table = new Table(comp, SWT.BORDER | SWT.SINGLE);
|
Composite comp = new Composite(parent, SWT.NONE);
|
||||||
table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
|
comp.setLayout(new GridLayout());
|
||||||
|
|
||||||
List<IConfigurationElement> elements = new ArrayList<>();
|
table = new Table(comp, SWT.BORDER | SWT.SINGLE);
|
||||||
IExtensionPoint point = Platform.getExtensionRegistry()
|
table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
|
||||||
.getExtensionPoint(Activator.PLUGIN_ID + ".launchTargetTypeUI"); //$NON-NLS-1$
|
|
||||||
for (IExtension extension : point.getExtensions()) {
|
List<IConfigurationElement> elements = new ArrayList<>();
|
||||||
for (IConfigurationElement element : extension.getConfigurationElements()) {
|
IExtensionPoint point = Platform.getExtensionRegistry()
|
||||||
String elementName = element.getName();
|
.getExtensionPoint(Activator.PLUGIN_ID + ".launchTargetTypeUI"); //$NON-NLS-1$
|
||||||
if ("wizard2".equals(elementName) || "wizard".equals(elementName)) { //$NON-NLS-1$ //$NON-NLS-2$
|
for (IExtension extension : point.getExtensions()) {
|
||||||
elements.add(element);
|
for (IConfigurationElement element : extension.getConfigurationElements()) {
|
||||||
}
|
String elementName = element.getName();
|
||||||
}
|
if ("wizard2".equals(elementName) || "wizard".equals(elementName)) { //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
elements.add(element);
|
||||||
|
}
|
||||||
elements.sort(new Comparator<IConfigurationElement>() {
|
}
|
||||||
@Override
|
}
|
||||||
public int compare(IConfigurationElement o1, IConfigurationElement o2) {
|
|
||||||
String name1 = o1.getAttribute("name"); //$NON-NLS-1$
|
elements.sort(new Comparator<IConfigurationElement>() {
|
||||||
String name2 = o2.getAttribute("name"); //$NON-NLS-1$
|
@Override
|
||||||
return name1.compareTo(name2);
|
public int compare(IConfigurationElement o1, IConfigurationElement o2) {
|
||||||
}
|
String name1 = o1.getAttribute("name"); //$NON-NLS-1$
|
||||||
});
|
String name2 = o2.getAttribute("name"); //$NON-NLS-1$
|
||||||
|
return name1.compareTo(name2);
|
||||||
for (IConfigurationElement element : elements) {
|
}
|
||||||
String name = element.getAttribute("name"); //$NON-NLS-1$
|
});
|
||||||
TableItem item = new TableItem(table, SWT.NONE);
|
|
||||||
item.setText(name);
|
for (IConfigurationElement element : elements) {
|
||||||
|
String name = element.getAttribute("name"); //$NON-NLS-1$
|
||||||
String iconFile = element.getAttribute("icon"); //$NON-NLS-1$
|
TableItem item = new TableItem(table, SWT.NONE);
|
||||||
if (iconFile != null) {
|
item.setText(name);
|
||||||
ImageDescriptor desc = Activator.imageDescriptorFromPlugin(element.getNamespaceIdentifier(), iconFile);
|
|
||||||
if (desc != null) {
|
String iconFile = element.getAttribute("icon"); //$NON-NLS-1$
|
||||||
item.setImage(desc.createImage());
|
if (iconFile != null) {
|
||||||
}
|
ImageDescriptor desc = Activator.imageDescriptorFromPlugin(element.getNamespaceIdentifier(), iconFile);
|
||||||
}
|
if (desc != null) {
|
||||||
|
item.setImage(desc.createImage());
|
||||||
item.setData(element);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
table.addSelectionListener(new SelectionListener() {
|
item.setData(element);
|
||||||
@Override
|
}
|
||||||
public void widgetSelected(SelectionEvent e) {
|
|
||||||
getContainer().updateButtons();
|
table.addSelectionListener(new SelectionListener() {
|
||||||
}
|
@Override
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
@Override
|
getContainer().updateButtons();
|
||||||
public void widgetDefaultSelected(SelectionEvent e) {
|
}
|
||||||
widgetSelected(e);
|
|
||||||
if (canFlipToNextPage()) {
|
@Override
|
||||||
getContainer().showPage(getNextPage());
|
public void widgetDefaultSelected(SelectionEvent e) {
|
||||||
}
|
widgetSelected(e);
|
||||||
}
|
if (canFlipToNextPage()) {
|
||||||
});
|
getContainer().showPage(getNextPage());
|
||||||
|
}
|
||||||
setControl(comp);
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
@Override
|
setControl(comp);
|
||||||
public void dispose() {
|
}
|
||||||
for (TableItem item : table.getItems()) {
|
|
||||||
Object obj = item.getData();
|
@Override
|
||||||
if (obj instanceof Wizard) {
|
public void dispose() {
|
||||||
((Wizard) obj).dispose();
|
for (TableItem item : table.getItems()) {
|
||||||
}
|
Object obj = item.getData();
|
||||||
}
|
if (obj instanceof Wizard) {
|
||||||
super.dispose();
|
((Wizard) obj).dispose();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public ImageDescriptor getDescriptionImage(IConfigurationElement element) {
|
super.dispose();
|
||||||
String descImage = element.getAttribute("icon"); //$NON-NLS-1$
|
}
|
||||||
if (descImage == null) {
|
|
||||||
return null;
|
public ImageDescriptor getDescriptionImage(IConfigurationElement element) {
|
||||||
}
|
String descImage = element.getAttribute("icon"); //$NON-NLS-1$
|
||||||
return AbstractUIPlugin.imageDescriptorFromPlugin(element.getNamespaceIdentifier(), descImage);
|
if (descImage == null) {
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
@Override
|
return AbstractUIPlugin.imageDescriptorFromPlugin(element.getNamespaceIdentifier(), descImage);
|
||||||
public boolean canFlipToNextPage() {
|
}
|
||||||
return table.getSelectionIndex() >= 0;
|
|
||||||
}
|
@Override
|
||||||
|
public boolean canFlipToNextPage() {
|
||||||
@Override
|
return table.getSelectionIndex() >= 0;
|
||||||
public IWizardPage getNextPage() {
|
}
|
||||||
int i = table.getSelectionIndex();
|
|
||||||
if (i >= 0) {
|
@Override
|
||||||
TableItem item = table.getItem(i);
|
public IWizardPage getNextPage() {
|
||||||
Object obj = item.getData();
|
int i = table.getSelectionIndex();
|
||||||
Wizard nextWizard;
|
if (i >= 0) {
|
||||||
if (obj instanceof IConfigurationElement) {
|
TableItem item = table.getItem(i);
|
||||||
IConfigurationElement element = (IConfigurationElement) obj;
|
Object obj = item.getData();
|
||||||
try {
|
Wizard nextWizard;
|
||||||
nextWizard = (Wizard) element.createExecutableExtension("class"); //$NON-NLS-1$
|
if (obj instanceof IConfigurationElement) {
|
||||||
nextWizard.addPages();
|
IConfigurationElement element = (IConfigurationElement) obj;
|
||||||
if (nextWizard instanceof IWorkbenchWizard) {
|
try {
|
||||||
((IWorkbenchWizard) nextWizard).init(PlatformUI.getWorkbench(), new StructuredSelection());
|
nextWizard = (Wizard) element.createExecutableExtension("class"); //$NON-NLS-1$
|
||||||
}
|
nextWizard.addPages();
|
||||||
item.setData(nextWizard);
|
if (nextWizard instanceof IWorkbenchWizard) {
|
||||||
} catch (CoreException e) {
|
((IWorkbenchWizard) nextWizard).init(PlatformUI.getWorkbench(), new StructuredSelection());
|
||||||
Activator.log(e);
|
}
|
||||||
return null;
|
item.setData(nextWizard);
|
||||||
}
|
} catch (CoreException e) {
|
||||||
} else {
|
Activator.log(e);
|
||||||
nextWizard = (LaunchTargetWizard) obj;
|
return null;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
return nextWizard.getStartingPage();
|
nextWizard = (LaunchTargetWizard) obj;
|
||||||
}
|
}
|
||||||
return super.getNextPage();
|
|
||||||
}
|
return nextWizard.getStartingPage();
|
||||||
|
}
|
||||||
}
|
return super.getNextPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue