Commit f955022b authored by Greg Watson's avatar Greg Watson
Browse files

Merge branch 'next' of https://github.com/eclipse/ice into next

parents 4d72aac5 850a3a58
......@@ -18,6 +18,7 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.11.0",
org.eclipse.equinox.security;bundle-version="1.2.100",
org.eclipse.m2e.core;bundle-version="1.6.0"
Import-Package: org.apache.commons.io;version="2.2.0",
org.apache.commons.lang,
org.eclipse.egit.github.core;version="4.0.0",
org.eclipse.egit.github.core.service;version="4.0.0",
org.eclipse.jgit.api;version="4.0.0",
......
......@@ -31,6 +31,10 @@
commandName="Build ICE"
implementation="org.eclipse.ice.developer.actions.BuildICEHandler">
</command>
<command
commandName="Launch New ICE Instance"
implementation="org.eclipse.ice.developer.actions.LaunchNewICEHandler">
</command>
</code>
</extension>
<extension
......
/*******************************************************************************
* Copyright (c) 2015 UT-Battelle, LLC.
* 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:
* Alex McCaskey - Initial API and implementation and/or initial documentation
*
*******************************************************************************/
package org.eclipse.ice.developer.actions;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.apache.commons.lang.SystemUtils;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.resources.WorkspaceJob;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.window.Window;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.ListSelectionDialog;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* This class extends the Eclipse AbstractHandler to provide an action to
* the ICE Developer Menu that let's users launch a new instance of ICE with a
* the addition of new plugins and without having to go through the usual
* Eclipse Run Configuration wizard.
*
* @author Alex McCaskey
*
*/
public class LaunchNewICEHandler extends AbstractHandler {
/**
* Logger for handling event messages and other information.
*/
protected static final Logger logger = LoggerFactory.getLogger(GitCloneHandler.class);
/*
* (non-Javadoc)
*
* @see
* org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.
* ExecutionEvent)
*/
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
// Get the Launch Manager
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
if (manager != null) {
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IProject productProject = root.getProject("org.eclipse.ice.product");
if (productProject != null) {
// Local Declarations
ArrayList<String> currentPlugins = new ArrayList<String>();
ArrayList<String> notIncludedProjects = new ArrayList<String>();
String fileName = "", currentPluginsStr = "", key = "selected_workspace_plugins";
String vmArgs = "", vmArgsKey = "org.eclipse.jdt.launching.VM_ARGUMENTS";
String[] plugins;
// Get the proper file name
if (SystemUtils.IS_OS_WINDOWS) {
fileName = "ice.product_WINDOWS.launch";
} else if (SystemUtils.IS_OS_MAC_OSX) {
fileName = "ice.macosx_product.launch";
} else if (SystemUtils.IS_OS_LINUX) {
fileName = "ice.product_linux.launch";
} else {
throw new ExecutionException("Could not get the current OS. Cannot launch new version of ICE.");
}
// Get the Launch Configurations files
IFile launchICE = productProject.getFile("modified_" + fileName);
if (!launchICE.exists()) {
IFile tempCopy = productProject.getFile(fileName);
try {
launchICE.create(tempCopy.getContents(), true, null);
} catch (CoreException e1) {
e1.printStackTrace();
logger.error("Could not create file withe name modified_" + fileName, e1);
}
}
// Get the Launch Configuration from those files
ILaunchConfiguration launchConfig = manager.getLaunchConfiguration(launchICE);
try {
currentPluginsStr = launchConfig.getAttribute(key, "");
vmArgs = launchConfig.getAttribute(vmArgsKey, "");
vmArgs = vmArgs.replace("org.eclipse.equinox.http.jetty.http.port=8081", "org.eclipse.equinox.http.jetty.http.port=8082");
// Put all workspace plugins in the launch config into a
// list
plugins = currentPluginsStr.split(",");
for (String s : plugins) {
currentPlugins.add(s.split("@")[0]);
}
// Get any project name that is not currently in the run
// config
List<String> pluginsToIgnore = Arrays.asList("org.eclipse.ice.aggregator", "reflectivity", "xsede",
"ICEDocCleaner", "all", "default", "developerMenu", "dynamicUI", "fileFormats",
"installation", "introToPTP", "itemDB", "moose-tutorial", "newItemGeneration",
"org.eclipse.ice.examples.reflectivity", "org.eclipse.ice.installer",
"org.eclipse.ice.parent", "org.eclipse.ice.product", "org.eclipse.ice.repository");
for (IProject p : root.getProjects()) {
String name = p.getName();
if (!currentPlugins.contains(p.getName()) && !name.endsWith(".test")
&& !name.contains("Tutorial")
&& !name.contains("target.") && !name.contains("feature")
&& !pluginsToIgnore.contains(name)) {
notIncludedProjects.add(p.getName());
}
}
// Display a list selection for the user to select which
// plugins to add.
ListSelectionDialog dialog = new ListSelectionDialog(
PlatformUI.getWorkbench().getDisplay().getActiveShell(), notIncludedProjects.toArray(),
ArrayContentProvider.getInstance(), new LabelProvider(),
"Select new plugins to include in the new ICE instance.");
dialog.setTitle("Plugin Addition Selection");
// Open the dialog
int ok = dialog.open();
if (ok == Window.OK) {
// Get the results
Object[] results = dialog.getResult();
for (Object s : results) {
currentPluginsStr = s.toString() + "@default:true," + currentPluginsStr;
}
ILaunchConfigurationWorkingCopy wc = launchConfig.getWorkingCopy();
// Set the launch configs list of plugins
wc.setAttribute(key, currentPluginsStr);
wc.setAttribute(vmArgsKey, vmArgs);
// Save the configuration
ILaunchConfiguration config = wc.doSave();
// Create and launch the Job.
Job job = new WorkspaceJob("Launching New Instance of ICE") {
@Override
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
config.launch(ILaunchManager.RUN_MODE, monitor);
return Status.OK_STATUS;
}
};
// Launch the job
job.schedule();
}
} catch (CoreException e) {
e.printStackTrace();
logger.error("Could not create or launch new run configuration.", e);
}
}
}
return null;
}
}
......@@ -139,10 +139,10 @@ def get_package_file(pkg, os_type, arch_type):
"Darwin" : {"x86_64" : "ice-macosx-cocoa-x86_64"+VERSION+".zip" },
"Linux" : {"x86_64" : "ice-linux-gtk-x86_64-"+VERSION+".zip" ,
"x86" : "ice-linux-gtk-x86-"+VERSION+".zip" }},
"VisIt" : {"Windows" : {"x86_64" : "visit2.10.0_x64.exe" ,
"x86" : "visit2.10.0.exe" },
"Darwin" : {"x86_64" : "VisIt-2.10.0.dmg" },
"Linux" : {"x86_64" : "visit2_10_0.linux-x86_64-rhel6.tar.gz" }},
"VisIt" : {"Windows" : {"x86_64" : "visit2.9.2_x64.exe" ,
"x86" : "visit2.9.2.exe" },
"Darwin" : {"x86_64" : "VisIt-2.9.2.dmg" },
"Linux" : {"x86_64" : "visit2_9_2.linux-x86_64-rhel6.tar.gz" }},
"HDFJava":{"Windows" : {"x86_64" : "HDFView-2.11-win64-vs2012.zip" ,
"x86" : "HDFView-2.11-win32-vs2012.zip" },
"Darwin" : {"x86_64" : "HDFView-2.11.0-Darwin.dmg" },
......
This diff is collapsed.
......@@ -36,7 +36,7 @@ public class NewICEItemProjectTester {
private static SWTWorkbenchBot bot;
private static final String SEP = System.getProperty("file.separator");
private static final String PROJECT_NAME = "org.eclipse.ice.newitem";
private static final int MANIFEST_LINE_COUNT = 21;
private static final int MANIFEST_LINE_COUNT = 16;
private static final int MODEL_LINE_COUNT = 235;
private static final int LAUNCHER_LINE_COUNT = 82;
......@@ -116,7 +116,7 @@ public class NewICEItemProjectTester {
try {
lnr = new LineNumberReader(new FileReader(modelFile.getLocation().toFile()));
lnr.skip(Long.MAX_VALUE);
lineCount = lnr.getLineNumber() + 1;
lineCount = lnr.getLineNumber();
lnr.close();
} catch (Exception e) {
e.printStackTrace();
......
......@@ -12,15 +12,16 @@
*******************************************************************************/
package org.eclipse.ice.projectgeneration.wizards;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import static java.nio.file.StandardCopyOption.*;
import java.util.Arrays;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IResource;
......@@ -271,29 +272,25 @@ public class NewICEItemProjectWizard extends NewPluginProjectFromTemplateWizard
* Update the new project manifest to have required packages imported.
*/
private void updateManifest() {
IProject project = fProjectProvider.getProject();
IFile manifestFile = project.getFolder("META-INF").getFile("MANIFEST.MF");
String packageBase = fProjectProvider.getProjectName();
String sep = System.getProperty("file.separator");
String manifestFile = fProjectProvider.getLocationPath().makeAbsolute().toOSString() + sep
+ fProjectProvider.getProjectName() + sep + "META-INF" + sep + "MANIFEST.MF";
StringBuilder manifestLines = new StringBuilder();
manifestLines.append("Import-Package: org.eclipse.ice.datastructures.form,\n");
manifestLines.append(" org.eclipse.ice.io.serializable,\n");
manifestLines.append(" org.eclipse.ice.item,\n");
manifestLines.append(" org.eclipse.ice.item.jobLauncher,\n");
manifestLines.append(" org.eclipse.ice.item.model,\n");
manifestLines.append(" org.eclipse.ice.datastructures.entry,\n");
manifestLines.append(" org.eclipse.ice.datastructures.ICEObject,\n");
manifestLines.append(" org.eclipse.core.resources,\n");
manifestLines.append(" org.eclipse.core.runtime,\n");
manifestLines.append(" org.eclipse.core.runtime.jobs,\n");
manifestLines.append(" org.slf4j\n");
manifestLines.append("Import-Package: org.slf4j\n");
manifestLines.append("Export-Package: " + packageBase + ".model,\n");
manifestLines.append(" " + packageBase + ".launcher\n");
manifestLines.append("Require-Bundle: org.eclipse.core.resources,\n");
manifestLines.append(" org.eclipse.core.runtime,\n");
manifestLines.append(" org.eclipse.ice.item,\n");
manifestLines.append(" org.eclipse.ice.datastructures,\n");
manifestLines.append(" org.eclipse.ice.io\n");
// Append to the MANIFEST.MF IFile
try {
Files.write(Paths.get(manifestFile), manifestLines.toString().getBytes(), StandardOpenOption.APPEND);
} catch (IOException e) {
logger.error(getClass().getName() + " Exception!", e);
manifestFile.appendContents(new ByteArrayInputStream(manifestLines.toString().getBytes()), IResource.FORCE,
null);
} catch (CoreException e) {
e.printStackTrace();
}
}
......
......@@ -76,24 +76,13 @@ public class $className$Model extends Model {
@Override
public void setupForm() {
form = new Form();
ioService = getIOService();
if (ioService == null) {
setIOService(new IOService());
ioService = getIOService();
}
if (ioFormat != "") {
reader = ioService.getReader(ioFormat);
writer = ioService.getWriter(ioFormat);
}
// Populate the Form with Components for your
// application Model. The default behavior is
// only invoked if there are valid IO services
if (project != null && reader != null && writer != null) {
loadInput(null);
}
/* Alternate Example:
// Get the reference to the IOService,
// This will let us get IReaders/IWriters for
// or Model
ioService = getIOService();
/* SetupForm Example:
*
* DataComponent data = new DataComponent();
* data.setName("Example Input Data");
......@@ -116,6 +105,12 @@ public class $className$Model extends Model {
*
* form.addComponent(data);
*/
// Set the Form ID info
form.setName(getName());
form.setDescription(getDescription());
form.setId(getId());
form.setItemID(getId());
}
/**
......@@ -157,10 +152,16 @@ public class $className$Model extends Model {
// setupItemInfo() method defined above.
if (actionName == exportString) {
IFile outputFile = project.getFile(outputName);
retStatus = FormStatus.Processing;
writer.write(form, outputFile);
refreshProjectSpace();
retStatus = FormStatus.Processed;
writer = ioService.getWriter(ioFormat);
if (writer != null) {
retStatus = FormStatus.Processing;
writer.write(form, outputFile);
refreshProjectSpace();
retStatus = FormStatus.Processed;
} else {
logger.error("Could not get reference to the IWriter " + ioFormat);
retStatus = FormStatus.InfoError;
}
} else {
retStatus = super.process(actionName);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment