Commit bd78edcc authored by amccaskey's avatar amccaskey
Browse files

Merge remote-tracking branch 'origin/mccaskey/entryRefactor' into next



Conflicts:
	org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/MOOSEFormEditor.java
	org.eclipse.ice.client.widgets.test/META-INF/MANIFEST.MF
	org.eclipse.ice.materials/data/userMatDB.xml
	org.eclipse.ice.materials/src/org/eclipse/ice/materials/XMLMaterialsDatabase.java
	org.eclipse.ice.nek5000/src/org/eclipse/ice/nek5000/NekReader.java
	org.eclipse.ice.reflectivity.ui/plugin.xml
	org.eclipse.ice.repository/ice.macosx_product.launch
	org.eclipse.ice.tablecomponenttester/src/org/eclipse/ice/tablecomponenttester/TableComponentTester.java
	org.eclipse.ice.target.mars/mars.target
Signed-off-by: default avataramccaskey <mccaskeyaj@ornl.gov>
parents f7b0145a a09f2fce
......@@ -185,14 +185,6 @@
</menu>
</menuContribution>
</extension>
<extension
id="mooseformwidgetbuilder"
name="MOOSE Form Widget Builder"
point="org.eclipse.ice.client.widgets.iformwidgetbuilder">
<implementation
class="org.eclipse.ice.client.widgets.moose.MOOSEFormWidgetBuilder">
</implementation>
</extension>
<extension
......@@ -223,5 +215,13 @@
</contentTypeBinding>
</editor>
</extension>
<extension
id="mooseformwidgetbuilder"
name="MOOSE Form Widget Builder"
point="org.eclipse.ice.client.widgets.iformwidgetbuilder">
<implementation
class="org.eclipse.ice.client.widgets.moose.MOOSEFormWidgetBuilder">
</implementation>
</extension>
</plugin>
......@@ -18,7 +18,7 @@ import org.eclipse.ice.client.common.properties.IButtonCellContentProvider;
import org.eclipse.ice.client.common.properties.ICellContentProvider;
import org.eclipse.ice.client.common.properties.TreeProperty;
import org.eclipse.ice.client.common.properties.TreePropertyCellContentProvider;
import org.eclipse.ice.datastructures.form.Entry;
import org.eclipse.ice.datastructures.entry.IEntry;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.viewers.ColumnViewer;
......@@ -190,7 +190,7 @@ public class CheckboxCellContentProvider extends
if (isValid(element) && value != null) {
String newValue = ((Boolean) value).toString();
Entry entry = ((TreeProperty) element).getEntry();
IEntry entry = ((TreeProperty) element).getEntry();
// If the value has changed, mark the changed flag and set the new
// value.
if (changed = !newValue.equals(entry.getTag())) {
......
......@@ -27,8 +27,8 @@ import org.eclipse.ice.client.widgets.ICEFormEditor;
import org.eclipse.ice.client.widgets.ICEFormInput;
import org.eclipse.ice.client.widgets.ICEFormPage;
import org.eclipse.ice.client.widgets.moose.components.PlantBlockManager;
import org.eclipse.ice.datastructures.entry.IEntry;
import org.eclipse.ice.datastructures.form.DataComponent;
import org.eclipse.ice.datastructures.form.Entry;
import org.eclipse.ice.datastructures.form.Form;
import org.eclipse.ice.datastructures.form.ResourceComponent;
import org.eclipse.ice.datastructures.form.TreeComposite;
......@@ -173,8 +173,7 @@ public class MOOSEFormEditor extends ICEFormEditor {
// names
// to the String list if they are enabled by the
// user
for (Entry postProcessor : postProcessors
.retrieveAllEntries()) {
for (IEntry postProcessor : postProcessors.retrieveAllEntries()) {
if ("yes".equals(postProcessor.getValue())) {
enabledPPs.add(postProcessor.getName());
}
......
......@@ -13,7 +13,7 @@ package org.eclipse.ice.client.widgets.moose;
import org.eclipse.ice.client.common.properties.TreeProperty;
import org.eclipse.ice.client.common.properties.TreePropertyCellContentProvider;
import org.eclipse.ice.datastructures.form.Entry;
import org.eclipse.ice.datastructures.entry.IEntry;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.ICheckStateListener;
import org.eclipse.jface.viewers.ICheckStateProvider;
......@@ -136,7 +136,7 @@ public class TableCheckStateManager extends TreePropertyCellContentProvider
if (isValid(element) && value != null && isEnabled(element)) {
String newValue = ((Boolean) value).toString();
Entry entry = ((TreeProperty) element).getEntry();
IEntry entry = ((TreeProperty) element).getEntry();
// If the value has changed, mark the changed flag and set the new
// value.
if (changed = !newValue.equals(entry.getTag())) {
......
/*******************************************************************************
* 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.client.widgets.moose.actions;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.handlers.HandlerUtil;
/**
* This handler triggers the "Clone MOOSE" action.
*
* TODO Update this documentation with more appropriate details.
*
* @author Alex McCaskey
*
*/
public class CloneMOOSEHandler extends AbstractHandler {
/*
* (non-Javadoc)
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
// Get the current shell from the HandlerUtil.
Shell shell = HandlerUtil.getActiveWorkbenchWindow(event).getShell();
// TODO Implement. Note: This is using the UI thread.
return null;
}
}
\ No newline at end of file
/*******************************************************************************
* 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.client.widgets.moose.actions;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.handlers.HandlerUtil;
/**
* This handler triggers the "Fork MOOSE" action.
*
* TODO Update this documentation with more appropriate details.
*
* @author Alex McCaskey
*
*/
public class ForkMOOSEHandler extends AbstractHandler {
/*
* (non-Javadoc)
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
// Get the current shell from the HandlerUtil.
Shell shell = HandlerUtil.getActiveWorkbenchWindow(event).getShell();
// TODO Implement. Note: This is using the UI thread.
return null;
}
}
\ No newline at end of file
/*******************************************************************************
* 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.client.widgets.moose.actions;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.eclipse.cdt.core.CCProjectNature;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.settings.model.CIncludePathEntry;
import org.eclipse.cdt.core.settings.model.CSourceEntry;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICFolderDescription;
import org.eclipse.cdt.core.settings.model.ICLanguageSetting;
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
import org.eclipse.cdt.core.settings.model.ICSourceEntry;
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
import org.eclipse.cdt.make.core.IMakeCommonBuildInfo;
import org.eclipse.cdt.make.core.IMakeTarget;
import org.eclipse.cdt.make.core.IMakeTargetManager;
import org.eclipse.cdt.make.core.MakeCorePlugin;
import org.eclipse.cdt.managedbuilder.core.IBuilder;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IToolChain;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo;
import org.eclipse.cdt.managedbuilder.internal.core.ManagedProject;
import org.eclipse.cdt.managedbuilder.ui.wizards.CfgHolder;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.egit.github.core.Repository;
import org.eclipse.egit.github.core.RepositoryId;
import org.eclipse.egit.github.core.service.RepositoryService;
import org.eclipse.ice.client.widgets.moose.nature.MooseNature;
import org.eclipse.ice.client.widgets.moose.wizards.ForkStorkWizard;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.handlers.HandlerUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* The ForkStorkHandler displays a Wizard to the user to gather a new MOOSE
* application name and the users GitHub credentials, and then forks
* idaholab/stork and renames the repository to the provided application name.
* Additionally, it imports the project as a CDT Makefile project with existing
* code, creates a new Make Target, and adds the appropriate MOOSE include files
* to the Paths and Symbols preference page.
*
* @author Alex McCaskey
*
*/
public class ForkStorkHandler extends AbstractHandler {
/**
* Logger for handling event messages and other information.
*/
private static final Logger logger = LoggerFactory.getLogger(ForkStorkHandler.class);
/**
* (non-Javadoc)
*
* @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
// Local Declarations
Shell shell = HandlerUtil.getActiveWorkbenchWindow(event).getShell();
// Create a new ForkStorkWizard and Dialog
final ForkStorkWizard wizard = new ForkStorkWizard();
WizardDialog dialog = new WizardDialog(shell, wizard);
// Open the dialog
if (dialog.open() != 0) {
return null;
}
// Create a File reference to the repo in the Eclipse workspace
final Job job = new Job("Forking the MOOSE Stork!") {
@Override
protected IStatus run(IProgressMonitor monitor) {
monitor.beginTask(
"Attempting to Fork the Stork with supplied credentials",
100);
// Local Declarations
IWorkspace workspace = ResourcesPlugin.getWorkspace();
ArrayList<String> cmdList = new ArrayList<String>();
ProcessBuilder jobBuilder = null;
String os = System.getProperty("os.name");
String sep = System.getProperty("file.separator");
// Get the user specified data
String appName = wizard.getMooseAppName();
String gitHubUser = wizard.getGitUsername();
String password = wizard.getGitPassword();
// Construct the Remote URI for the repo
String remoteURI = "https://github.com/" + gitHubUser + "/"
+ appName;
// Create the workspace file
File workspaceFile = new File(ResourcesPlugin.getWorkspace()
.getRoot().getLocation().toOSString()
+ sep + appName);
// Set the pyton command
cmdList.add("/bin/bash");
cmdList.add("-c");
cmdList.add("python make_new_application.py");
// Create a EGit-GitHub RepositoryService and Id to
// connect and create our Fork
RepositoryService service = new RepositoryService();
RepositoryId id = new RepositoryId("idaholab", "stork");
// Set the user's GitHub credentials
service.getClient().setCredentials(gitHubUser, password);
monitor.subTask("Connecting to GitHub...");
monitor.worked(20);
// Fork the Repository!!!
try {
// Fork and get the repo
Repository repo = service.forkRepository(id);
// Reset the project name to the provided app name
Map<String, Object> fields = new HashMap<String, Object>();
fields.put("name", appName);
// Edit the name
service.editRepository(repo, fields);
} catch (IOException e) {
logger.error(getClass().getName() + " Exception!",e);
String errorMessage = "ICE failed in forking the new stork.";
return new Status(IStatus.ERROR,
"org.eclipse.ice.client.widgets.moose", 1,
errorMessage, null);
}
monitor.subTask("Stork Forked, cloning to local machine...");
monitor.worked(40);
// Now that it is all set on the GitHub end,
// Let's pull it down into our workspace
try {
Git result = Git.cloneRepository().setURI(remoteURI)
.setDirectory(workspaceFile).call();
} catch (GitAPIException e) {
logger.error(getClass().getName() + " Exception!",e);
String errorMessage = "ICE failed in cloning the new application.";
return new Status(IStatus.ERROR,
"org.eclipse.ice.client.widgets.moose", 1,
errorMessage, null);
}
monitor.subTask("Executing make_new_application.py...");
monitor.worked(60);
// We can only run the python script on Linux or Mac
// And Moose devs only use Linux or Macs to build their apps
if (os.contains("Linux") || os.contains("Mac")) {
// Create the ProcessBuilder and change to the project dir
jobBuilder = new ProcessBuilder(cmdList);
jobBuilder.directory(new File(workspaceFile
.getAbsolutePath()));
// Do not direct the error to stdout. Catch it separately.
jobBuilder.redirectErrorStream(false);
try {
// Execute the python script!
jobBuilder.start();
} catch (IOException e) {
logger.error(getClass().getName() + " Exception!",e);
String errorMessage = "ICE could not execute the make_new_application python script.";
return new Status(IStatus.ERROR,
"org.eclipse.ice.client.widgets.moose", 1,
errorMessage, null);
}
}
/*------------ The rest is about importing the C++ project correctly ---------*/
// Get the project and project description handles
IProject project = workspace.getRoot().getProject(appName);
IProjectDescription description = workspace
.newProjectDescription(appName);
monitor.subTask("Converting application to CDT C++ Project...");
monitor.worked(80);
try {
// Create the CDT Project
CCorePlugin.getDefault().createCDTProject(description,
project, new NullProgressMonitor());
// Add the CPP nature
CCProjectNature.addCCNature(project,
new NullProgressMonitor());
// Set up build information
ICProjectDescriptionManager pdMgr = CoreModel.getDefault()
.getProjectDescriptionManager();
ICProjectDescription projDesc = pdMgr
.createProjectDescription(project, false);
ManagedBuildInfo info = ManagedBuildManager
.createBuildInfo(project);
ManagedProject mProj = new ManagedProject(projDesc);
info.setManagedProject(mProj);
// Grab the correct toolchain
// FIXME this should be better...
IToolChain toolChain = null;
for (IToolChain tool : ManagedBuildManager
.getRealToolChains()) {
if (os.contains("Mac")
&& tool.getName().contains("Mac")
&& tool.getName().contains("GCC")) {
toolChain = tool;
break;
} else if (os.contains("Linux")
&& tool.getName().contains("Linux")
&& tool.getName().contains("GCC")) {
toolChain = tool;
break;
} else if (os.contains("Windows")
&& tool.getName().contains("Cygwin")) {
toolChain = tool;
break;
} else {
toolChain = null;
}
}
// Set up the Build configuratino
CfgHolder cfgHolder = new CfgHolder(toolChain, null);
String s = toolChain == null ? "0" : toolChain.getId(); //$NON-NLS-1$
IConfiguration config = new Configuration(
mProj,
(org.eclipse.cdt.managedbuilder.internal.core.ToolChain) toolChain,
ManagedBuildManager.calculateChildId(s, null),
cfgHolder.getName());
IBuilder builder = config.getEditableBuilder();
builder.setManagedBuildOn(false);
CConfigurationData data = config.getConfigurationData();
projDesc.createConfiguration(
ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
pdMgr.setProjectDescription(project, projDesc);
// Now create a default Make Target for the Moose user to
// use to
// build the new app
IProject cProject = projDesc.getProject();
IMakeTargetManager manager = MakeCorePlugin.getDefault()
.getTargetManager();
String[] ids = manager.getTargetBuilders(cProject);
IMakeTarget target = manager.createTarget(cProject,
"make all", ids[0]);
target.setStopOnError(false);
target.setRunAllBuilders(false);
target.setUseDefaultBuildCmd(false);
target.setBuildAttribute(
IMakeCommonBuildInfo.BUILD_COMMAND, "make");
target.setBuildAttribute(IMakeCommonBuildInfo.BUILD_LOCATION,
cProject.getLocation().toOSString());
target.setBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS, "");
target.setBuildAttribute(IMakeTarget.BUILD_TARGET, "all");
manager.addTarget(cProject, target);
// Set the include and src folders as actual CDT source
// folders
ICProjectDescription cDescription = CoreModel.getDefault()
.getProjectDescriptionManager()
.createProjectDescription(cProject, false);
ICConfigurationDescription cConfigDescription = cDescription
.createConfiguration(
ManagedBuildManager.CFG_DATA_PROVIDER_ID,
config.getConfigurationData());
cDescription.setActiveConfiguration(cConfigDescription);
cConfigDescription.setSourceEntries(null);
IFolder srcFolder = cProject.getFolder("src");
IFolder includeFolder = cProject.getFolder("include");
ICSourceEntry srcFolderEntry = new CSourceEntry(srcFolder,
null, ICSettingEntry.RESOLVED);
ICSourceEntry includeFolderEntry = new CSourceEntry(
includeFolder, null, ICSettingEntry.RESOLVED);
cConfigDescription.setSourceEntries(new ICSourceEntry[] {
srcFolderEntry, includeFolderEntry });
// Add the Moose include paths
ICProjectDescription projectDescription = CoreModel
.getDefault().getProjectDescription(cProject, true);
ICConfigurationDescription configDecriptions[] = projectDescription
.getConfigurations();
for (ICConfigurationDescription configDescription : configDecriptions) {
ICFolderDescription projectRoot = configDescription
.getRootFolderDescription();
ICLanguageSetting[] settings = projectRoot
.getLanguageSettings();
for (ICLanguageSetting setting : settings) {
List<ICLanguageSettingEntry> includes = getIncludePaths();
includes.addAll(setting
.getSettingEntriesList(ICSettingEntry.INCLUDE_PATH));
setting.setSettingEntries(
ICSettingEntry.INCLUDE_PATH, includes);
}
}
CoreModel.getDefault().setProjectDescription(cProject,
projectDescription);
// Add a MOOSE Project Nature
IProjectDescription desc = project.getDescription();
String[] prevNatures = desc.getNatureIds();
String[] newNatures = new String[prevNatures.length + 1];
System.arraycopy(prevNatures, 0, newNatures, 0,
prevNatures.length);
newNatures[prevNatures.length] = MooseNature.NATURE_ID;
desc.setNatureIds(newNatures);
project.setDescription(desc, new NullProgressMonitor());
} catch (CoreException e) {
logger.error(getClass().getName() + " Exception!",e);
String errorMessage = "ICE could not import the new MOOSE application as a C++ project.";
return new Status(IStatus.ERROR,
"org.eclipse.ice.client.widgets.moose", 1,
errorMessage, null);
}
monitor.subTask("Importing into ICE.");
monitor.worked(100);
monitor.done();
return Status.OK_STATUS;
}
};
job.schedule();
// FIXME SHOULD WE CHECK IF MOOSE IS IN THE WORKSPACE
// AND CLONE IT IF ITS NOT
return null;
}
/**