Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'debug/org.eclipse.cdt.debug.ui')
-rw-r--r--debug/org.eclipse.cdt.debug.ui/plugin.xml6
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/GenericTargetPropertiesBlock.java51
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/NewGenericTargetWizard.java36
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/NewGenericTargetWizardPage.java61
4 files changed, 81 insertions, 73 deletions
diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.xml b/debug/org.eclipse.cdt.debug.ui/plugin.xml
index 30dd0676ed3..ce9b8636f3d 100644
--- a/debug/org.eclipse.cdt.debug.ui/plugin.xml
+++ b/debug/org.eclipse.cdt.debug.ui/plugin.xml
@@ -2585,12 +2585,12 @@
id="org.eclipse.cdt.launchTargetType.generic"
labelProvider="org.eclipse.cdt.debug.internal.ui.launch.GenericTargetLabelProvider">
</launchTargetTypeUI>
- <wizard
+ <wizard2
class="org.eclipse.cdt.debug.internal.ui.launch.NewGenericTargetWizard"
icon="icons/obj16/cdt_logo_16.png"
- id="org.eclipse.cdt.debug.ui.newGenericTargetWizard"
+ id="org.eclipse.cdt.launchTargetType.generic"
name="%GenericTarget.name">
- </wizard>
+ </wizard2>
</extension>
</plugin>
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/GenericTargetPropertiesBlock.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/GenericTargetPropertiesBlock.java
deleted file mode 100644
index bc5f6fd6892..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/GenericTargetPropertiesBlock.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.eclipse.cdt.debug.internal.ui.launch;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-
-public class GenericTargetPropertiesBlock extends Composite {
-
- private Text nameText;
- private Text osText;
- private Text archText;
-
- public GenericTargetPropertiesBlock(Composite parent, int style) {
- super(parent, style);
- setLayout(new GridLayout(2, false));
-
- Label label = new Label(this, SWT.NONE);
- label.setText("Name:");
-
- nameText = new Text(this, SWT.BORDER);
- nameText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
- label = new Label(this, SWT.NONE);
- label.setText("Operating System:");
-
- osText = new Text(this, SWT.BORDER);
- osText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
- label = new Label(this, SWT.NONE);
- label.setText("CPU Architecture:");
-
- archText = new Text(this, SWT.BORDER);
- archText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- }
-
- public String getTargetName() {
- return nameText.getText();
- }
-
- public String getOS() {
- return osText.getText();
- }
-
- public String getArch() {
- return archText.getText();
- }
-
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/NewGenericTargetWizard.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/NewGenericTargetWizard.java
index a8f982dc916..1f9e8e0f3e5 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/NewGenericTargetWizard.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/NewGenericTargetWizard.java
@@ -9,15 +9,13 @@ package org.eclipse.cdt.debug.internal.ui.launch;
import org.eclipse.cdt.debug.core.launch.GenericTargetTypeProvider;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
import org.eclipse.launchbar.core.target.ILaunchTarget;
import org.eclipse.launchbar.core.target.ILaunchTargetManager;
import org.eclipse.launchbar.core.target.ILaunchTargetWorkingCopy;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IWorkbench;
+import org.eclipse.launchbar.ui.internal.Activator;
+import org.eclipse.launchbar.ui.target.LaunchTargetWizard;
-public class NewGenericTargetWizard extends Wizard implements INewWizard {
+public class NewGenericTargetWizard extends LaunchTargetWizard {
private NewGenericTargetWizardPage page;
@@ -26,15 +24,10 @@ public class NewGenericTargetWizard extends Wizard implements INewWizard {
}
@Override
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- // nothing
- }
-
- @Override
public void addPages() {
super.addPages();
- page = new NewGenericTargetWizardPage();
+ page = new NewGenericTargetWizardPage(getLaunchTarget());
addPage(page);
}
@@ -44,8 +37,13 @@ public class NewGenericTargetWizard extends Wizard implements INewWizard {
String typeId = GenericTargetTypeProvider.TYPE_ID;
String id = page.getTargetName();
- ILaunchTarget target = manager.addLaunchTarget(typeId, id);
+ ILaunchTarget target = getLaunchTarget();
+ if (target == null) {
+ target = manager.addLaunchTarget(typeId, id);
+ }
+
ILaunchTargetWorkingCopy wc = target.getWorkingCopy();
+ wc.setId(id);
wc.setAttribute(ILaunchTarget.ATTR_OS, page.getOS());
wc.setAttribute(ILaunchTarget.ATTR_ARCH, page.getArch());
wc.save();
@@ -53,4 +51,18 @@ public class NewGenericTargetWizard extends Wizard implements INewWizard {
return true;
}
+ @Override
+ public boolean canDelete() {
+ return true;
+ }
+
+ @Override
+ public void performDelete() {
+ ILaunchTargetManager manager = Activator.getService(ILaunchTargetManager.class);
+ ILaunchTarget target = getLaunchTarget();
+ if (target != null) {
+ manager.removeLaunchTarget(getLaunchTarget());
+ }
+ }
+
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/NewGenericTargetWizardPage.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/NewGenericTargetWizardPage.java
index 9f3f557d4f0..c3a064a8798 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/NewGenericTargetWizardPage.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/NewGenericTargetWizardPage.java
@@ -8,35 +8,82 @@
package org.eclipse.cdt.debug.internal.ui.launch;
import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.launchbar.core.target.ILaunchTarget;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
public class NewGenericTargetWizardPage extends WizardPage {
- private GenericTargetPropertiesBlock propertiesBlock;
+ private final ILaunchTarget launchTarget;
- public NewGenericTargetWizardPage() {
+ private Text nameText;
+ private Text osText;
+ private Text archText;
+
+ public NewGenericTargetWizardPage(ILaunchTarget launchTarget) {
super(NewGenericTargetWizardPage.class.getName());
setTitle("Generic Target");
setDescription("Enter name and properties for the target.");
+ this.launchTarget = launchTarget;
}
@Override
public void createControl(Composite parent) {
- propertiesBlock = new GenericTargetPropertiesBlock(parent, SWT.NONE);
- setControl(propertiesBlock);
+ Composite comp = new Composite(parent, SWT.NONE);
+ comp.setLayout(new GridLayout(2, false));
+
+ Label label = new Label(comp, SWT.NONE);
+ label.setText("Name:");
+
+ nameText = new Text(comp, SWT.BORDER);
+ nameText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ if (launchTarget != null) {
+ nameText.setText(launchTarget.getId());
+ }
+
+ label = new Label(comp, SWT.NONE);
+ label.setText("Operating System:");
+
+ osText = new Text(comp, SWT.BORDER);
+ osText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ if (launchTarget != null) {
+ String os = launchTarget.getAttribute(ILaunchTarget.ATTR_OS, null);
+ if (os != null) {
+ osText.setText(os);
+ }
+ }
+
+ label = new Label(comp, SWT.NONE);
+ label.setText("CPU Architecture:");
+
+ archText = new Text(comp, SWT.BORDER);
+ archText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ if (launchTarget != null) {
+ String arch = launchTarget.getAttribute(ILaunchTarget.ATTR_ARCH, null);
+ if (arch != null) {
+ archText.setText(arch);
+ }
+ }
+
+ setControl(comp);
}
public String getTargetName() {
- return propertiesBlock.getTargetName();
+ return nameText.getText().trim();
}
public String getOS() {
- return propertiesBlock.getOS();
+ String os = osText.getText().trim();
+ return !os.isEmpty() ? os : null;
}
public String getArch() {
- return propertiesBlock.getArch();
+ String arch = archText.getText().trim();
+ return !arch.isEmpty() ? arch : null;
}
}

Back to the top