Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions bundles/org.eclipse.launchbar.ui.controls/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@ Bundle-Vendor: Eclipse CDT
Require-Bundle: org.eclipse.osgi.services;bundle-version="3.5.0",
org.eclipse.core.runtime,
org.eclipse.ui,
org.eclipse.e4.core.di.annotations;bundle-version="1.5.0",
org.eclipse.e4.core.contexts;bundle-version="1.5.0",
org.eclipse.e4.core.di.annotations;bundle-version="1.4.0",
org.eclipse.e4.core.contexts;bundle-version="1.4.0",
org.eclipse.e4.core.services;bundle-version="2.0.0",
org.eclipse.e4.ui.model.workbench;bundle-version="1.2.0",
org.eclipse.e4.ui.workbench;bundle-version="1.4.0",
org.eclipse.debug.ui;bundle-version="3.11.200",
org.eclipse.launchbar.core;bundle-version="2.0.0",
org.eclipse.launchbar.ui;bundle-version="2.0.0"
org.eclipse.e4.ui.model.workbench;bundle-version="1.1.0",
org.eclipse.e4.ui.workbench;bundle-version="1.3.0",
org.eclipse.debug.ui;bundle-version="3.11.101",
org.eclipse.jface,
org.eclipse.debug.core,
org.eclipse.launchbar.core;bundle-version="2.0.1",
org.eclipse.launchbar.ui;bundle-version="2.0.1"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
Export-Package: org.eclipse.launchbar.ui.controls.internal;x-internal:=true
Export-Package: org.eclipse.launchbar.ui.controls.internal
Binary file modified bundles/org.eclipse.launchbar.ui.controls/icons/build.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file modified bundles/org.eclipse.launchbar.ui.controls/icons/launch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified bundles/org.eclipse.launchbar.ui.controls/icons/stop.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public class Activator extends AbstractUIPlugin {
public static final String IMG_BUTTON_BUILD = "build"; //$NON-NLS-1$
public static final String IMG_BUTTON_LAUNCH = "launch"; //$NON-NLS-1$
public static final String IMG_BUTTON_STOP = "stop"; //$NON-NLS-1$
public static final String IMG_BUTTON_DEPLOY = "deploy"; //$NON-NLS-1$
public static final String IMG_CONFIG_CONFIG = "config_config"; //$NON-NLS-1$
public static final String IMG_EDIT_COLD = "edit_cold"; //$NON-NLS-1$

Expand All @@ -50,6 +51,7 @@ public void start(BundleContext context) throws Exception {
imageRegistry.put(IMG_BUTTON_BUILD, imageDescriptorFromPlugin(PLUGIN_ID, "icons/build_16.png")); //$NON-NLS-1$
imageRegistry.put(IMG_BUTTON_LAUNCH, imageDescriptorFromPlugin(PLUGIN_ID, "icons/launch_16.png")); //$NON-NLS-1$
imageRegistry.put(IMG_BUTTON_STOP, imageDescriptorFromPlugin(PLUGIN_ID, "icons/stop_16.png")); //$NON-NLS-1$
imageRegistry.put(IMG_BUTTON_DEPLOY, imageDescriptorFromPlugin(PLUGIN_ID, "icons/deploy.png")); //$NON-NLS-1$
imageRegistry.put(IMG_CONFIG_CONFIG, imageDescriptorFromPlugin(PLUGIN_ID, "icons/config_config.png")); //$NON-NLS-1$
imageRegistry.put(IMG_EDIT_COLD, imageDescriptorFromPlugin(PLUGIN_ID, "icons/edit_cold.png")); //$NON-NLS-1$
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* Contributors:
* Doug Schaefer
* Torkild U. Resheim - add preference to control target selector
* Torkild U. Resheim
* Vincent Guignot - Ingenico - add preference to control Build button
*******************************************************************************/
package org.eclipse.launchbar.ui.controls.internal;
Expand Down Expand Up @@ -85,6 +85,8 @@ public void widgetDisposed(DisposeEvent e) {

createButton(toolBar, Activator.IMG_BUTTON_LAUNCH, Messages.LaunchBarControl_Launch,
ILaunchBarUIConstants.CMD_LAUNCH);
createButton(toolBar, Activator.IMG_BUTTON_DEPLOY, Messages.LaunchBarControl_Deploy,
ILaunchBarUIConstants.CMD_DEPLOY);
createButton(toolBar, Activator.IMG_BUTTON_STOP, Messages.LaunchBarControl_Stop,
ILaunchBarUIConstants.CMD_STOP);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* Contributors:
* Doug Schaefer
* Torkild U. Resheim - add preference to control target selector
* Torkild U. Resheim
* Vincent Guignot - Ingenico - add preference to control Build button
*******************************************************************************/
package org.eclipse.launchbar.ui.controls.internal;
Expand All @@ -29,6 +29,7 @@ public class Messages extends NLS {
public static String LaunchBarControl_Build;
public static String LaunchBarControl_Launch;
public static String LaunchBarControl_Stop;
public static String LaunchBarControl_Deploy;
public static String LaunchBarListViewer_0;
public static String LaunchBarPreferencePage_0;
public static String LaunchBarPreferencePage_1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ LaunchBarControl_0=on
LaunchBarControl_Build=Build
LaunchBarControl_Launch=Launch
LaunchBarControl_Stop=Stop
LaunchBarControl_Deploy=Deploy into running instance
LaunchBarListViewer_0=Increase/Decrease size of recently used elements pane
LaunchBarPreferencePage_0=Preferences for the Launch Bar
LaunchBarPreferencePage_1=Enable the Launch Bar
Expand Down
13 changes: 13 additions & 0 deletions bundles/org.eclipse.launchbar.ui/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@ Bundle-Vendor: Eclipse CDT
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ui,
org.eclipse.ui.ide,
org.eclipse.swt,
org.eclipse.ui.navigator,
org.eclipse.remote.core;bundle-version="2.0.0",
org.eclipse.remote.ui;bundle-version="1.1.0",
org.eclipse.e4.core.contexts,
org.eclipse.pde.core,
org.eclipse.core.resources,
org.eclipse.pde.ui,
org.eclipse.core.jobs,
org.eclipse.pde.build,
org.eclipse.jface,
org.eclipse.pde.api.tools,
org.eclipse.debug.core,
org.eclipse.debug.ui,
org.eclipse.launchbar.core
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Expand Down
Binary file added bundles/org.eclipse.launchbar.ui/icons/publish.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 15 additions & 1 deletion bundles/org.eclipse.launchbar.ui/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
id="org.eclipse.launchbar.ui.command.buildActive"
name="Build Active Launch Configuration">
</command>
<command
categoryId="org.eclipse.launchbar.ui.category.launchBar"
defaultHandler="org.eclipse.launchbar.ui.internal.commands.DeployCommandHandler"
id="org.eclipse.launchbar.ui.command.deploy"
name="Deploy Workspace Plugins">
</command>
<command
categoryId="org.eclipse.launchbar.ui.category.launchBar"
defaultHandler="org.eclipse.launchbar.ui.internal.commands.LaunchActiveCommandHandler"
Expand All @@ -41,7 +47,6 @@
labelProvider="org.eclipse.launchbar.ui.DefaultDescriptorLabelProvider">
</descriptorUI>
</extension>


<extension
point="org.eclipse.ui.newWizards">
Expand All @@ -57,7 +62,16 @@
name="Launch Target"
project="false">
</wizard>
</extension>

<extension
point="org.eclipse.ui.bindings">
<key
commandId="org.eclipse.launchbar.ui.command.launchActive"
contextId="org.eclipse.ui.contexts.dialogAndWindow"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
sequence="F12">
</key>
</extension>

</plugin>
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public interface ILaunchBarUIConstants {
public static final String CMD_BUILD = Activator.PLUGIN_ID + ".command.buildActive"; //$NON-NLS-1$
public static final String CMD_LAUNCH = Activator.PLUGIN_ID + ".command.launchActive"; //$NON-NLS-1$
public static final String CMD_STOP = Activator.PLUGIN_ID + ".command.stop"; //$NON-NLS-1$
public static final String CMD_DEPLOY = Activator.PLUGIN_ID + ".command.deploy"; //$NON-NLS-1$
public static final String CMD_CONFIG = Activator.PLUGIN_ID + ".command.configureActiveLaunch"; //$NON-NLS-1$

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@
*
* Contributors:
* Doug Schaefer
<<<<<<< HEAD
* Torkild U. Resheim - add preference to control target selector
* Vincent Guignot - Ingenico - add preference to control Build button
=======
* Torkild U. Resheim
>>>>>>> 7acff04... Add button to deploy all plug-in projects. Use styleguide palette.
*******************************************************************************/
package org.eclipse.launchbar.ui.internal;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
/*******************************************************************************
* Copyright (c) 2016 Diamond Light Source Ltd.
* 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:
* Torkild U. Resheim - initial API and implementation
*******************************************************************************/
package org.eclipse.launchbar.ui.internal.commands;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.attribute.FileAttribute;
import java.util.ArrayList;

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.debug.core.ILaunchMode;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.osgi.util.NLS;
import org.eclipse.pde.core.IModel;
import org.eclipse.pde.core.plugin.IPluginModelBase;
import org.eclipse.pde.core.plugin.PluginRegistry;
import org.eclipse.pde.internal.build.site.QualifierReplacer;
import org.eclipse.pde.internal.core.ICoreConstants;
import org.eclipse.pde.internal.core.PDECoreMessages;
import org.eclipse.pde.internal.core.WorkspaceModelManager;
import org.eclipse.pde.internal.core.exports.FeatureExportInfo;
import org.eclipse.pde.internal.core.exports.PluginExportOperation;
import org.eclipse.pde.internal.ui.PDEPluginImages;
import org.eclipse.pde.internal.ui.PDEUIMessages;
import org.eclipse.pde.internal.ui.build.RuntimeInstallJob;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.program.Program;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Link;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.progress.IProgressConstants;
import org.eclipse.ui.progress.UIJob;
import org.eclipse.launchbar.ui.internal.Activator;

/**
* Command to build and install all <b>open</b> Eclipse plug-in projects into
* the running Eclipse instance. PDE build will be used for the operation.
*
* @author Torkild U. Resheim
*/
@SuppressWarnings("restriction")
public class DeployCommandHandler extends AbstractHandler {

protected class AntErrorDialog extends MessageDialog {
private File fLogLocation;

public AntErrorDialog(File logLocation) {
super(PlatformUI.getWorkbench().getDisplay().getActiveShell(), PDECoreMessages.FeatureBasedExportOperation_ProblemDuringExport, null, null, MessageDialog.ERROR, new String[] {IDialogConstants.OK_LABEL}, 0);
fLogLocation = logLocation;
}

protected Control createMessageArea(Composite composite) {
Link link = new Link(composite, SWT.WRAP);
try {
link.setText(NLS.bind(PDEUIMessages.PluginExportWizard_Ant_errors_during_export_logs_generated, "<a>" + fLogLocation.getCanonicalPath() + "</a>")); //$NON-NLS-1$ //$NON-NLS-2$
} catch (IOException e) {
Activator.log(e);
}
GridData data = new GridData();
data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
link.setLayoutData(data);
link.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
try {
Program.launch(fLogLocation.getCanonicalPath());
} catch (IOException ex) {
Activator.log(ex);
}
}
});
return link;
}
}

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
new UIJob(Display.getDefault(), "Installing plug-ins into running Eclipse instance") {
public IStatus runInUIThread(IProgressMonitor monitor) {
try {
scheduleExportJob();
} catch (IOException e) {
return new Status(IStatus.ERROR, "", "Could not install plug-in",e);
}
return Status.OK_STATUS;
};
}.schedule();

return Status.OK_STATUS;
}

protected String getMode(ILaunchMode launchMode) {
return launchMode.getIdentifier(); //$NON-NLS-1$
}

protected boolean isValidModel(IModel model) {
return model != null && model instanceof IPluginModelBase;
}
private boolean hasBuildProperties(IPluginModelBase model) {
File file = new File(model.getInstallLocation(), ICoreConstants.BUILD_FILENAME_DESCRIPTOR);
return file.exists();
}
public Object[] getListElements() {
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
ArrayList<IModel> result = new ArrayList<IModel>();
for (int i = 0; i < projects.length; i++) {
if (!WorkspaceModelManager.isBinaryProject(projects[i]) && WorkspaceModelManager.isPluginProject(projects[i])) {
IModel model = PluginRegistry.findModel(projects[i]);
if (model != null && isValidModel(model) && hasBuildProperties((IPluginModelBase) model)) {
result.add(model);
}
}
}
return result.toArray();
}

protected void scheduleExportJob() throws IOException {

Path folder = Files.createTempDirectory("eclipse-export", new FileAttribute<?>[0]);
final FeatureExportInfo info = new FeatureExportInfo();
info.toDirectory = true; // in order to install from the repository
info.useJarFormat = true;
info.exportSource = false;
info.exportSourceBundle = false;
info.allowBinaryCycles = true;
info.useWorkspaceCompiledClasses = false;
info.destinationDirectory = folder.toString();
info.zipFileName = "dawn-plugin-deployment.zip";
info.items = getListElements(); // all open plug-in projects
info.signingInfo = null; //
info.qualifier = QualifierReplacer.getDateQualifier();

final boolean installAfterExport = true;
if (installAfterExport) {
RuntimeInstallJob.modifyInfoForInstall(info);
}

final PluginExportOperation job = new PluginExportOperation(info, PDEUIMessages.PluginExportJob_name);
job.setUser(true);
job.setRule(ResourcesPlugin.getWorkspace().getRoot());
job.setProperty(IProgressConstants.ICON_PROPERTY, PDEPluginImages.DESC_PLUGIN_OBJ);
job.addJobChangeListener(new JobChangeAdapter() {
public void done(IJobChangeEvent event) {
if (job.hasAntErrors()) {
// If there were errors when running the ant scripts, inform the user where the logs can be found.
final File logLocation = new File(info.destinationDirectory, "logs.zip"); //$NON-NLS-1$
if (logLocation.exists()) {
PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
public void run() {
AntErrorDialog dialog = new AntErrorDialog(logLocation);
dialog.open();
}
});
}
} else if (event.getResult().isOK() && installAfterExport) {
// install the export into the current running platform
RuntimeInstallJob installJob = new RuntimeInstallJob(PDEUIMessages.PluginExportWizard_InstallJobName, info);
installJob.setUser(true);
installJob.setProperty(IProgressConstants.ICON_PROPERTY, PDEPluginImages.DESC_FEATURE_OBJ);
installJob.schedule();
}
}
});
job.schedule();
}
}