diff --git a/bundles/org.eclipse.launchbar.ui/src/org/eclipse/launchbar/ui/internal/Messages.java b/bundles/org.eclipse.launchbar.ui/src/org/eclipse/launchbar/ui/internal/Messages.java index 9a432ba18db..c230dfc30a7 100644 --- a/bundles/org.eclipse.launchbar.ui/src/org/eclipse/launchbar/ui/internal/Messages.java +++ b/bundles/org.eclipse.launchbar.ui/src/org/eclipse/launchbar/ui/internal/Messages.java @@ -17,6 +17,7 @@ public class Messages extends NLS { public static String LaunchBarControl_Build; public static String LaunchBarControl_Launch; public static String LaunchBarControl_Stop; + public static String TargetSelector_CreateNewTarget; static { // initialize resource bundle NLS.initializeMessages(BUNDLE_NAME, Messages.class); diff --git a/bundles/org.eclipse.launchbar.ui/src/org/eclipse/launchbar/ui/internal/controls/TargetSelector.java b/bundles/org.eclipse.launchbar.ui/src/org/eclipse/launchbar/ui/internal/controls/TargetSelector.java index 911044c12f0..3e8965dc45a 100644 --- a/bundles/org.eclipse.launchbar.ui/src/org/eclipse/launchbar/ui/internal/controls/TargetSelector.java +++ b/bundles/org.eclipse.launchbar.ui/src/org/eclipse/launchbar/ui/internal/controls/TargetSelector.java @@ -13,6 +13,12 @@ package org.eclipse.launchbar.ui.internal.controls; import java.util.Comparator; import java.util.List; +import org.eclipse.core.commands.Command; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.NotEnabledException; +import org.eclipse.core.commands.NotHandledException; +import org.eclipse.core.commands.common.NotDefinedException; import org.eclipse.core.runtime.CoreException; import org.eclipse.jface.viewers.IStructuredContentProvider; import org.eclipse.jface.viewers.LabelProvider; @@ -20,6 +26,7 @@ import org.eclipse.jface.viewers.Viewer; import org.eclipse.launchbar.core.internal.LaunchBarManager; import org.eclipse.launchbar.ui.internal.Activator; import org.eclipse.launchbar.ui.internal.LaunchBarUIManager; +import org.eclipse.launchbar.ui.internal.Messages; import org.eclipse.remote.core.IRemoteConnection; import org.eclipse.swt.SWT; import org.eclipse.swt.events.MouseAdapter; @@ -36,12 +43,14 @@ 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.ui.PlatformUI; +import org.eclipse.ui.commands.ICommandService; public class TargetSelector extends CSelector { private final LaunchBarUIManager uiManager = Activator.getDefault().getLaunchBarUIManager(); - private static final String[] noTargets = new String[] { "---" }; + private static final String[] noTargets = new String[] { "---" }; //$NON-NLS-1$ public TargetSelector(Composite parent, int style) { super(parent, style); @@ -74,7 +83,7 @@ public class TargetSelector extends CSelector { @Override public Image getImage(Object element) { if (element instanceof IRemoteConnection) { - IRemoteConnection target = (IRemoteConnection) element; + //IRemoteConnection target = (IRemoteConnection) element; // TODO need to get icon form ui service } return super.getImage(element); @@ -141,15 +150,19 @@ public class TargetSelector extends CSelector { final Label createLabel = new Label(createButton, SWT.None); createLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); - createLabel.setText("Create New Target..."); + createLabel.setText(Messages.TargetSelector_CreateNewTarget); createLabel.setBackground(backgroundColor); MouseListener mouseListener = new MouseAdapter() { - public void mouseUp(org.eclipse.swt.events.MouseEvent e) { - // TODO - // NewLaunchTargetWizard wizard = new NewLaunchTargetWizard(uiManager); - // WizardDialog dialog = new WizardDialog(getShell(), wizard); - // dialog.open(); + public void mouseUp(org.eclipse.swt.events.MouseEvent event) { + try { + ICommandService commandService = PlatformUI.getWorkbench().getService(ICommandService.class); + // TODO the command id should be in a remote ui interface + Command newConnectionCmd = commandService.getCommand("org.eclipse.remote.ui.command.newConnection"); //$NON-NLS-1$ + newConnectionCmd.executeWithChecks(new ExecutionEvent()); + } catch (ExecutionException | NotDefinedException | NotEnabledException | NotHandledException e) { + Activator.log(e); + } } }; diff --git a/bundles/org.eclipse.launchbar.ui/src/org/eclipse/launchbar/ui/internal/messages.properties b/bundles/org.eclipse.launchbar.ui/src/org/eclipse/launchbar/ui/internal/messages.properties index 52dfb3cfd9c..cf06ea8f1ad 100644 --- a/bundles/org.eclipse.launchbar.ui/src/org/eclipse/launchbar/ui/internal/messages.properties +++ b/bundles/org.eclipse.launchbar.ui/src/org/eclipse/launchbar/ui/internal/messages.properties @@ -1,3 +1,4 @@ LaunchBarControl_Build=Build LaunchBarControl_Launch=Launch LaunchBarControl_Stop=Stop +TargetSelector_CreateNewTarget=Create New Connection... diff --git a/pom.xml b/pom.xml index d87c22f2e7b..36f59e97155 100644 --- a/pom.xml +++ b/pom.xml @@ -45,7 +45,7 @@ platform - http://download.eclipse.org/eclipse/updates/4.5milestones + http://download.eclipse.org/eclipse/updates/4.5milestones/ p2 @@ -60,7 +60,7 @@ remote - http://download.eclipse.org/tools/ptp/builds/remote/2.0.0 + http://download.eclipse.org/tools/ptp/builds/remote/2.0.0/ p2