From 32a92ce2d338c91c17e6420284037c1aa2f1c98a Mon Sep 17 00:00:00 2001 From: Alex McCaskey Date: Mon, 13 Apr 2015 16:07:35 -0400 Subject: [PATCH 1/6] Committing initial work on a new MOOSE Fork the Stork toolbar action button. Currently this successfully forks idaholab/stork to username/stork, and changes the repo name to the provided application name. Signed-off-by: Alex McCaskey --- .../kepler_rcp.target | 6 +- .../ice.product.launch | 66 ++++----- .../META-INF/MANIFEST.MF | 6 +- .../plugin.xml | 28 ++++ .../widgets/moose/ForkStorkHandler.java | 126 +++++++++++++++++ .../client/widgets/moose/ForkStorkWizard.java | 110 +++++++++++++++ .../widgets/moose/ForkStorkWizardPage.java | 131 ++++++++++++++++++ 7 files changed, 438 insertions(+), 35 deletions(-) create mode 100644 src/org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/ForkStorkHandler.java create mode 100644 src/org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/ForkStorkWizard.java create mode 100644 src/org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/ForkStorkWizardPage.java diff --git a/org.eclipse.ice.target.kepler/kepler_rcp.target b/org.eclipse.ice.target.kepler/kepler_rcp.target index 9ced507cf..cc11e8cd9 100644 --- a/org.eclipse.ice.target.kepler/kepler_rcp.target +++ b/org.eclipse.ice.target.kepler/kepler_rcp.target @@ -1,5 +1,5 @@ - + @@ -82,5 +82,9 @@ + + + + diff --git a/repository/org.eclipse.ice.repository/ice.product.launch b/repository/org.eclipse.ice.repository/ice.product.launch index e4bcc03ba..f2aa49347 100644 --- a/repository/org.eclipse.ice.repository/ice.product.launch +++ b/repository/org.eclipse.ice.repository/ice.product.launch @@ -1,33 +1,33 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/org.eclipse.ice.client.widgets.moose/META-INF/MANIFEST.MF b/src/org.eclipse.ice.client.widgets.moose/META-INF/MANIFEST.MF index ae9cc4726..5fc4592b1 100644 --- a/src/org.eclipse.ice.client.widgets.moose/META-INF/MANIFEST.MF +++ b/src/org.eclipse.ice.client.widgets.moose/META-INF/MANIFEST.MF @@ -27,6 +27,10 @@ Import-Package: com.jme3.math, org.osgi.framework;version="1.7.0" Require-Bundle: org.eclipse.ice.client.compatibility;bundle-version="2.0.0", org.eclipse.ice.datastructures;bundle-version="2.0.0", - org.eclipse.jface + org.eclipse.jface, + org.eclipse.jgit;bundle-version="3.2.0", + org.eclipse.egit;bundle-version="3.2.0", + org.eclipse.egit.core;bundle-version="3.2.0", + org.eclipse.egit.github.core;bundle-version="3.2.0" Service-Component: OSGI-INF/MOOSEEditorComponent.xml Export-Package: org.eclipse.ice.client.widgets.moose diff --git a/src/org.eclipse.ice.client.widgets.moose/plugin.xml b/src/org.eclipse.ice.client.widgets.moose/plugin.xml index 795513189..f5795c0e1 100644 --- a/src/org.eclipse.ice.client.widgets.moose/plugin.xml +++ b/src/org.eclipse.ice.client.widgets.moose/plugin.xml @@ -125,4 +125,32 @@ + + + + + + + + + + + + + + + diff --git a/src/org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/ForkStorkHandler.java b/src/org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/ForkStorkHandler.java new file mode 100644 index 000000000..a3f2c4808 --- /dev/null +++ b/src/org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/ForkStorkHandler.java @@ -0,0 +1,126 @@ +/******************************************************************************* + * Copyright (c) 2013, 2014 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: + * Initial API and implementation and/or initial documentation - Jay Jay Billings, + * Jordan H. Deyton, Dasha Gorin, Alexander J. McCaskey, Taylor Patterson, + * Claire Saunders, Matthew Wang, Anna Wojtowicz + *******************************************************************************/ +package org.eclipse.ice.client.widgets.moose; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.egit.github.core.Repository; +import org.eclipse.egit.github.core.RepositoryId; +import org.eclipse.egit.github.core.User; +import org.eclipse.egit.github.core.client.GitHubClient; +import org.eclipse.egit.github.core.service.RepositoryService; +import org.eclipse.ice.client.widgets.EclipseStreamingTextWidget; +import org.eclipse.ice.datastructures.form.AllowedValueType; +import org.eclipse.ice.datastructures.form.BasicEntryContentProvider; +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.FormStatus; +import org.eclipse.ice.datastructures.form.IEntryContentProvider; +import org.eclipse.ice.datastructures.form.TableComponent; +import org.eclipse.ice.item.nuclear.MOOSELauncher; +import org.eclipse.jface.wizard.WizardDialog; +import org.eclipse.jgit.api.CloneCommand; +import org.eclipse.jgit.api.Git; +import org.eclipse.jgit.api.errors.GitAPIException; +import org.eclipse.jgit.api.errors.InvalidRemoteException; +import org.eclipse.jgit.api.errors.TransportException; +import org.eclipse.jgit.errors.NoWorkTreeException; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * + * @author Alex McCaskey + * + */ +public class ForkStorkHandler extends AbstractHandler { + + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + + // Create a new Generate YAML Wizard and Dialog + Shell shell = HandlerUtil.getActiveWorkbenchWindow(event).getShell(); + ForkStorkWizard wizard = new ForkStorkWizard(); + WizardDialog dialog = new WizardDialog(shell, wizard); + Git result = null; + String sep = System.getProperty("file.separator"); + + // Open the dialog + if (dialog.open() != 0) { + return null; + } + + String appName = wizard.getMooseAppName(); + String gitHubUser = wizard.getGitUsername(); + String password = wizard.getGitPassword(); + String remoteURI = "https://github.com/" + gitHubUser + "/" + appName; + File workspace = new File(ResourcesPlugin.getWorkspace().getRoot() + .getLocation().toOSString() + sep + appName); + + System.out.println(appName + ", " + gitHubUser + ", "); + + RepositoryService service = new RepositoryService(); + service.getClient().setCredentials(gitHubUser, password); + RepositoryId id = new RepositoryId("idaholab", "stork"); + try { + Repository repo = service.forkRepository(id); + //GitHubClient client = service.getClient(); + System.out.println(repo.getCloneUrl() + ", " + repo.getName()); + + Map fields = new HashMap(); + fields.put("name", appName); + + service.editRepository(repo, fields); + + } catch (IOException e1) { + e1.printStackTrace(); + } + + try { + result = Git.cloneRepository().setURI(remoteURI) + .setDirectory(workspace).call(); + } catch (InvalidRemoteException e1) { + e1.printStackTrace(); + } catch (TransportException e1) { + e1.printStackTrace(); + } catch (GitAPIException e1) { + e1.printStackTrace(); + } + + try { + System.out.println("HELLO: " + result.status().call().toString()); + } catch (NoWorkTreeException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (GitAPIException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + result.close(); + + return null; + + } +} diff --git a/src/org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/ForkStorkWizard.java b/src/org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/ForkStorkWizard.java new file mode 100644 index 000000000..c41943e22 --- /dev/null +++ b/src/org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/ForkStorkWizard.java @@ -0,0 +1,110 @@ +/******************************************************************************* + * Copyright (c) 2013, 2014 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: + * Initial API and implementation and/or initial documentation - Jay Jay Billings, + * Jordan H. Deyton, Dasha Gorin, Alexander J. McCaskey, Taylor Patterson, + * Claire Saunders, Matthew Wang, Anna Wojtowicz + *******************************************************************************/ +package org.eclipse.ice.client.widgets.moose; + +import java.util.ArrayList; + +import org.eclipse.core.commands.IHandler; +import org.eclipse.jface.wizard.Wizard; +import org.eclipse.ui.IWorkbenchWindow; + +/** + * + * @author Alex McCaskey + * + */ +public class ForkStorkWizard extends Wizard { + + /** + * Handle to the workbench window. + */ + protected IWorkbenchWindow workbenchWindow; + + /** + * + */ + private ForkStorkWizardPage page; + + /** + * + */ + private ArrayList forkData; + + /** + * A nullary constructor. This is used by the platform. If called from an + * {@link IHandler}, use {@link #NewItemWizard(IWorkbenchWindow)} . + */ + public ForkStorkWizard() { + page = new ForkStorkWizardPage("Fork the Stork!"); + setWindowTitle("MOOSE Fork the Stork"); + this.setForcePreviousAndNextButtons(false); + + } + + /** + * The default constructor. This is not normally called by the platform but + * via handlers. + * + * @param window + * The workbench window. + */ + public ForkStorkWizard(IWorkbenchWindow window) { + // Initialize the default information. + this(); + // Store a reference to the workbench window. + workbenchWindow = window; + page = new ForkStorkWizardPage("Fork the Stork!"); + + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.wizard.Wizard#addPages() + */ + @Override + public void addPages() { + addPage(page); + } + + /** + * + */ + @Override + public boolean performFinish() { + + // Gather up all the data entered by the user + forkData = new ArrayList(); + forkData.add(page.getMooseAppName()); + forkData.add(page.getGitUserName()); + forkData.add(page.getGitPassword()); + + return true; + } + + /** + * + * @return + */ + public String getMooseAppName() { + return forkData.get(0); + } + + public String getGitUsername() { + return forkData.get(1); + } + + public String getGitPassword() { + return forkData.get(2); + } +} diff --git a/src/org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/ForkStorkWizardPage.java b/src/org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/ForkStorkWizardPage.java new file mode 100644 index 000000000..e3be67685 --- /dev/null +++ b/src/org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/ForkStorkWizardPage.java @@ -0,0 +1,131 @@ +/******************************************************************************* + * Copyright (c) 2013, 2014 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: + * Initial API and implementation and/or initial documentation - Jay Jay Billings, + * Jordan H. Deyton, Dasha Gorin, Alexander J. McCaskey, Taylor Patterson, + * Claire Saunders, Matthew Wang, Anna Wojtowicz + *******************************************************************************/ +package org.eclipse.ice.client.widgets.moose; + +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.KeyListener; +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; + +/** + * + * @author Alex McCaskey + * + */ +public class ForkStorkWizardPage extends WizardPage { + + /** + * + */ + private Composite container; + + /** + * + */ + private Text appName; + + private Text uName; + + /** + * + */ + private Text password; + + /** + * + * @param pageName + */ + protected ForkStorkWizardPage(String pageName) { + super(pageName); + setTitle(pageName); + setDescription("Please provide the name of the Moose Application you'd like to create."); + } + + /** + * + */ + @Override + public void createControl(Composite parent) { + container = new Composite(parent, SWT.NONE); + GridLayout layout = new GridLayout(); + container.setLayout(layout); + layout.numColumns = 1; + Label label1 = new Label(container, SWT.NONE); + label1.setText("MooseApp Name:"); + + appName = new Text(container, SWT.BORDER | SWT.SINGLE); + appName.setText(""); + appName.addKeyListener(new KeyListener() { + + @Override + public void keyPressed(KeyEvent e) { + } + + @Override + public void keyReleased(KeyEvent e) { + if (!appName.getText().isEmpty()) { + setPageComplete(true); + + } + } + + }); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + appName.setLayoutData(gd); + + new Label(container, SWT.NONE).setText("GitHub Username:"); + uName = new Text(container, SWT.BORDER | SWT.SINGLE); + uName.setText(System.getProperty("user.name")); + uName.setLayoutData(gd); + + new Label(container, SWT.NONE).setText("GitHub Password:"); + password = new Text(container, SWT.BORDER | SWT.SINGLE | SWT.PASSWORD); + password.setText(""); + password.setLayoutData(gd); + + // required to avoid an error in the system + setControl(container); + setPageComplete(true); + + } + + /** + * + * @return + */ + public String getMooseAppName() { + return appName.getText(); + } + + /** + * + * @return + */ + public String getGitUserName() { + return uName.getText(); + } + + /** + * + * @return + */ + public String getGitPassword() { + return password.getText(); + } + +} From feee9968386180b9f1dcc97b922dec85d9a274d2 Mon Sep 17 00:00:00 2001 From: Alex McCaskey Date: Mon, 13 Apr 2015 16:21:54 -0400 Subject: [PATCH 2/6] Updating documentation on the ForkStork action classes. Signed-off-by: Alex McCaskey --- .../widgets/moose/ForkStorkHandler.java | 70 +++++++++++-------- .../client/widgets/moose/ForkStorkWizard.java | 14 +++- .../widgets/moose/ForkStorkWizardPage.java | 23 ++++-- 3 files changed, 69 insertions(+), 38 deletions(-) diff --git a/src/org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/ForkStorkHandler.java b/src/org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/ForkStorkHandler.java index a3f2c4808..b7900a186 100644 --- a/src/org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/ForkStorkHandler.java +++ b/src/org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/ForkStorkHandler.java @@ -51,56 +51,78 @@ import org.eclipse.ui.handlers.HandlerUtil; /** + * 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. * * @author Alex McCaskey * */ public class ForkStorkHandler extends AbstractHandler { + /** + * (non-Javadoc) + * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ @Override public Object execute(ExecutionEvent event) throws ExecutionException { - // Create a new Generate YAML Wizard and Dialog + // Local Declarations Shell shell = HandlerUtil.getActiveWorkbenchWindow(event).getShell(); + String sep = System.getProperty("file.separator"), appName = "", + gitHubUser = "", password = "", remoteURI = ""; + + // Create a new ForkStorkWizard and Dialog ForkStorkWizard wizard = new ForkStorkWizard(); WizardDialog dialog = new WizardDialog(shell, wizard); - Git result = null; - String sep = System.getProperty("file.separator"); - + // Open the dialog if (dialog.open() != 0) { return null; } - String appName = wizard.getMooseAppName(); - String gitHubUser = wizard.getGitUsername(); - String password = wizard.getGitPassword(); - String remoteURI = "https://github.com/" + gitHubUser + "/" + appName; - File workspace = new File(ResourcesPlugin.getWorkspace().getRoot() - .getLocation().toOSString() + sep + appName); + // Get the User Input Data + appName = wizard.getMooseAppName(); + gitHubUser = wizard.getGitUsername(); + password = wizard.getGitPassword(); - System.out.println(appName + ", " + gitHubUser + ", "); + // Construct the Remote URI for the repo + remoteURI = "https://github.com/" + gitHubUser + "/" + appName; + // Create a File reference to the repo in the Eclipse workspace + File workspace = new File(ResourcesPlugin.getWorkspace().getRoot() + .getLocation().toOSString() + + sep + appName); + + // Create a EGit-GitHub RepositoryService and Id to + // connect and create our Fork RepositoryService service = new RepositoryService(); - service.getClient().setCredentials(gitHubUser, password); RepositoryId id = new RepositoryId("idaholab", "stork"); + + // Set the user's GitHub credentials + service.getClient().setCredentials(gitHubUser, password); + + // Fork the Repository!!! try { + // Fork and get the repo Repository repo = service.forkRepository(id); - //GitHubClient client = service.getClient(); - System.out.println(repo.getCloneUrl() + ", " + repo.getName()); - + + // Reset the project name to the provided app name Map fields = new HashMap(); fields.put("name", appName); - + + // Edit the name service.editRepository(repo, fields); - } catch (IOException e1) { e1.printStackTrace(); } + // Now that it is all set on the GitHub end, + // Let's pull it down into our workspace try { - result = Git.cloneRepository().setURI(remoteURI) - .setDirectory(workspace).call(); + Git result = Git.cloneRepository().setURI(remoteURI).setDirectory(workspace) + .call(); } catch (InvalidRemoteException e1) { e1.printStackTrace(); } catch (TransportException e1) { @@ -109,16 +131,6 @@ public Object execute(ExecutionEvent event) throws ExecutionException { e1.printStackTrace(); } - try { - System.out.println("HELLO: " + result.status().call().toString()); - } catch (NoWorkTreeException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (GitAPIException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - result.close(); return null; diff --git a/src/org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/ForkStorkWizard.java b/src/org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/ForkStorkWizard.java index c41943e22..f97ec485b 100644 --- a/src/org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/ForkStorkWizard.java +++ b/src/org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/ForkStorkWizard.java @@ -19,6 +19,9 @@ import org.eclipse.ui.IWorkbenchWindow; /** + * The ForkStorkWizard is a subclass of Wizard that + * provides a ForkStorkWizardPage to get user input for + * forking the MOOSE Stork. * * @author Alex McCaskey * @@ -31,12 +34,13 @@ public class ForkStorkWizard extends Wizard { protected IWorkbenchWindow workbenchWindow; /** - * + * Reference to the ForStorkWizardPage */ private ForkStorkWizardPage page; /** - * + * List of retrieved user input data + * from the ForkStorkWizardPage */ private ArrayList forkData; @@ -93,6 +97,7 @@ public boolean performFinish() { } /** + * Return the input Moose App name. * * @return */ @@ -100,10 +105,15 @@ public String getMooseAppName() { return forkData.get(0); } + /** + * Retrieve the users GitHub username + * @return + */ public String getGitUsername() { return forkData.get(1); } + // Retrieve the GitHub password public String getGitPassword() { return forkData.get(2); } diff --git a/src/org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/ForkStorkWizardPage.java b/src/org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/ForkStorkWizardPage.java index e3be67685..8dc345beb 100644 --- a/src/org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/ForkStorkWizardPage.java +++ b/src/org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/ForkStorkWizardPage.java @@ -23,6 +23,10 @@ import org.eclipse.swt.widgets.Text; /** + * The ForkStorkWizardPage is a subclass of WizardPage that + * provides a Composite for the Wizard that takes the user's + * desired MOOSE app name and GitHub credentials for forking the + * MOOSE stork. * * @author Alex McCaskey * @@ -30,24 +34,28 @@ public class ForkStorkWizardPage extends WizardPage { /** - * + * Reference to the Parent Composite. */ private Composite container; /** - * + * The text box for the Moose application name. */ private Text appName; + /** + * The text box for the GitHub user name. + */ private Text uName; /** + * The text box for the user's password. * */ private Text password; /** - * + * The constructor * @param pageName */ protected ForkStorkWizardPage(String pageName) { @@ -57,7 +65,8 @@ protected ForkStorkWizardPage(String pageName) { } /** - * + * Create a Composite with fields for the application name + * and GitHub user credentials. */ @Override public void createControl(Composite parent) { @@ -105,7 +114,7 @@ public void keyReleased(KeyEvent e) { } /** - * + * Return the Moose application name * @return */ public String getMooseAppName() { @@ -113,7 +122,7 @@ public String getMooseAppName() { } /** - * + * Return the GitHub user name. * @return */ public String getGitUserName() { @@ -121,7 +130,7 @@ public String getGitUserName() { } /** - * + * Return the GitHub password. * @return */ public String getGitPassword() { From a680aad3e2ed962cf1176ff9437913736d63d283 Mon Sep 17 00:00:00 2001 From: Alex McCaskey Date: Mon, 13 Apr 2015 17:00:32 -0400 Subject: [PATCH 3/6] Committing update to ForkStorkHandler that executes the MOOSE make_new_application.py python script and pulls in the cloned application into the Project Explorer as a new CDT C++ project. Signed-off-by: Alex McCaskey --- .../META-INF/MANIFEST.MF | 3 +- .../widgets/moose/ForkStorkHandler.java | 74 +++++++++++++++---- 2 files changed, 60 insertions(+), 17 deletions(-) diff --git a/src/org.eclipse.ice.client.widgets.moose/META-INF/MANIFEST.MF b/src/org.eclipse.ice.client.widgets.moose/META-INF/MANIFEST.MF index 5fc4592b1..0821e4c96 100644 --- a/src/org.eclipse.ice.client.widgets.moose/META-INF/MANIFEST.MF +++ b/src/org.eclipse.ice.client.widgets.moose/META-INF/MANIFEST.MF @@ -31,6 +31,7 @@ Require-Bundle: org.eclipse.ice.client.compatibility;bundle-version="2.0.0", org.eclipse.jgit;bundle-version="3.2.0", org.eclipse.egit;bundle-version="3.2.0", org.eclipse.egit.core;bundle-version="3.2.0", - org.eclipse.egit.github.core;bundle-version="3.2.0" + org.eclipse.egit.github.core;bundle-version="3.2.0", + org.eclipse.cdt.core;bundle-version="5.6.0" Service-Component: OSGI-INF/MOOSEEditorComponent.xml Export-Package: org.eclipse.ice.client.widgets.moose diff --git a/src/org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/ForkStorkHandler.java b/src/org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/ForkStorkHandler.java index b7900a186..b5becb4ff 100644 --- a/src/org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/ForkStorkHandler.java +++ b/src/org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/ForkStorkHandler.java @@ -21,10 +21,18 @@ import java.util.HashMap; import java.util.Map; +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.model.CoreModel; +import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager; 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.IProjectDescription; +import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.OperationCanceledException; import org.eclipse.egit.github.core.Repository; import org.eclipse.egit.github.core.RepositoryId; import org.eclipse.egit.github.core.User; @@ -51,10 +59,9 @@ import org.eclipse.ui.handlers.HandlerUtil; /** - * 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. + * 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. * * @author Alex McCaskey * @@ -63,6 +70,7 @@ public class ForkStorkHandler extends AbstractHandler { /** * (non-Javadoc) + * * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent) */ @Override @@ -70,13 +78,19 @@ public Object execute(ExecutionEvent event) throws ExecutionException { // Local Declarations Shell shell = HandlerUtil.getActiveWorkbenchWindow(event).getShell(); - String sep = System.getProperty("file.separator"), appName = "", - gitHubUser = "", password = "", remoteURI = ""; - + String sep = System.getProperty("file.separator"), appName = "", gitHubUser = "", password = "", remoteURI = ""; + ArrayList cmdList = new ArrayList(); + ProcessBuilder jobBuilder = null; + + // Set the pyton command + cmdList.add("/bin/bash"); + cmdList.add("-c"); + cmdList.add("python make_new_application.py"); + // Create a new ForkStorkWizard and Dialog ForkStorkWizard wizard = new ForkStorkWizard(); WizardDialog dialog = new WizardDialog(shell, wizard); - + // Open the dialog if (dialog.open() != 0) { return null; @@ -86,23 +100,23 @@ public Object execute(ExecutionEvent event) throws ExecutionException { appName = wizard.getMooseAppName(); gitHubUser = wizard.getGitUsername(); password = wizard.getGitPassword(); - + // Construct the Remote URI for the repo remoteURI = "https://github.com/" + gitHubUser + "/" + appName; - + // Create a File reference to the repo in the Eclipse workspace File workspace = new File(ResourcesPlugin.getWorkspace().getRoot() .getLocation().toOSString() + sep + appName); - // Create a EGit-GitHub RepositoryService and Id to + // 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); - + // Fork the Repository!!! try { // Fork and get the repo @@ -118,11 +132,11 @@ public Object execute(ExecutionEvent event) throws ExecutionException { e1.printStackTrace(); } - // Now that it is all set on the GitHub end, + // 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(workspace) - .call(); + Git result = Git.cloneRepository().setURI(remoteURI) + .setDirectory(workspace).call(); } catch (InvalidRemoteException e1) { e1.printStackTrace(); } catch (TransportException e1) { @@ -131,7 +145,35 @@ public Object execute(ExecutionEvent event) throws ExecutionException { e1.printStackTrace(); } + // Create the ProcessBuilder and change to the project dir + jobBuilder = new ProcessBuilder(cmdList); + jobBuilder.directory(new File(workspace.getAbsolutePath())); + + // Do not direct the error to stdout. Catch it separately. + jobBuilder.redirectErrorStream(false); + try { + // Execute the python script! + Process job = jobBuilder.start(); + } catch (IOException e) { + e.printStackTrace(); + } + // Pull this into the Project Explorer as CDT project! + IProject appProject = ResourcesPlugin.getWorkspace().getRoot() + .getProject(appName); + IProjectDescription desc = ResourcesPlugin.getWorkspace() + .newProjectDescription(appName); + try { + IProject proj = CCorePlugin.getDefault().createCDTProject(desc, + appProject, null); + proj.refreshLocal(IResource.DEPTH_INFINITE, null); + } catch (OperationCanceledException e) { + e.printStackTrace(); + } catch (CoreException e) { + e.printStackTrace(); + } + + return null; } From a8482e6dd90468297424c771ba34f88db3b0e87a Mon Sep 17 00:00:00 2001 From: Alex McCaskey Date: Mon, 13 Apr 2015 21:10:02 -0400 Subject: [PATCH 4/6] Adding EGit plugins so that imported project is connected to the Git/Team perspective/context menu. Signed-off-by: Alex McCaskey --- org.eclipse.ice.target.kepler/kepler_rcp.target | 6 +++++- repository/org.eclipse.ice.repository/ice.product.launch | 5 +++-- .../eclipse/ice/client/widgets/moose/ForkStorkHandler.java | 6 +++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/org.eclipse.ice.target.kepler/kepler_rcp.target b/org.eclipse.ice.target.kepler/kepler_rcp.target index cc11e8cd9..592131de9 100644 --- a/org.eclipse.ice.target.kepler/kepler_rcp.target +++ b/org.eclipse.ice.target.kepler/kepler_rcp.target @@ -1,5 +1,5 @@ - + @@ -86,5 +86,9 @@ + + + + diff --git a/repository/org.eclipse.ice.repository/ice.product.launch b/repository/org.eclipse.ice.repository/ice.product.launch index f2aa49347..2d9aa80a6 100644 --- a/repository/org.eclipse.ice.repository/ice.product.launch +++ b/repository/org.eclipse.ice.repository/ice.product.launch @@ -14,14 +14,15 @@ - + + - + diff --git a/src/org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/ForkStorkHandler.java b/src/org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/ForkStorkHandler.java index b5becb4ff..01ae30bee 100644 --- a/src/org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/ForkStorkHandler.java +++ b/src/org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/ForkStorkHandler.java @@ -30,8 +30,10 @@ import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProjectDescription; import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspaceRunnable; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.OperationCanceledException; import org.eclipse.egit.github.core.Repository; import org.eclipse.egit.github.core.RepositoryId; @@ -56,6 +58,8 @@ import org.eclipse.jgit.api.errors.TransportException; import org.eclipse.jgit.errors.NoWorkTreeException; import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IWorkingSetManager; +import org.eclipse.ui.PlatformUI; import org.eclipse.ui.handlers.HandlerUtil; /** @@ -173,8 +177,8 @@ public Object execute(ExecutionEvent event) throws ExecutionException { e.printStackTrace(); } - return null; } + } From 5c91b8098695eeb32f56e512a157f2403cb695fa Mon Sep 17 00:00:00 2001 From: Alex McCaskey Date: Tue, 21 Apr 2015 09:11:29 -0400 Subject: [PATCH 5/6] Adding new extensions and unimplemented command handler to create a new MOOSE Kernel class by right clicking a 'fork the stork' moose app and selecting New > New MOOSE Kernel from the context menu. Signed-off-by: Alex McCaskey --- .../plugin.xml | 42 +++++++++++++++++++ .../widgets/moose/ForkStorkHandler.java | 4 +- .../widgets/moose/NewKernelHandler.java | 22 ++++++++++ 3 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 src/org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/NewKernelHandler.java diff --git a/src/org.eclipse.ice.client.widgets.moose/plugin.xml b/src/org.eclipse.ice.client.widgets.moose/plugin.xml index 3c7283c46..63cb21258 100644 --- a/src/org.eclipse.ice.client.widgets.moose/plugin.xml +++ b/src/org.eclipse.ice.client.widgets.moose/plugin.xml @@ -161,4 +161,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/ForkStorkHandler.java b/src/org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/ForkStorkHandler.java index 4665cb8fc..f3f2fafa0 100644 --- a/src/org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/ForkStorkHandler.java +++ b/src/org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/ForkStorkHandler.java @@ -182,7 +182,7 @@ public Object execute(ExecutionEvent event) throws ExecutionException { e.printStackTrace(); } - try { + /*try { IMakeTargetManager manager = MakeCorePlugin.getDefault() .getTargetManager(); String[] ids = manager.getTargetBuilders(cProject); @@ -198,7 +198,7 @@ public Object execute(ExecutionEvent event) throws ExecutionException { manager.addTarget(cProject, target); } catch (CoreException e) { e.printStackTrace(); - } + }*/ return null; } diff --git a/src/org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/NewKernelHandler.java b/src/org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/NewKernelHandler.java new file mode 100644 index 000000000..7e47f5aa6 --- /dev/null +++ b/src/org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/NewKernelHandler.java @@ -0,0 +1,22 @@ +package org.eclipse.ice.client.widgets.moose; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +public class NewKernelHandler extends AbstractHandler { + + /** + * (non-Javadoc) + * + * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + + + System.out.println("HELLO WORLD FROM NEW KERNEL HANDLER"); + return null; + } + +} From 81bb57d483ed2263144fef8eb3cb9b0aa00487e8 Mon Sep 17 00:00:00 2001 From: Alex McCaskey Date: Wed, 22 Apr 2015 12:49:03 -0400 Subject: [PATCH 6/6] Committing work done on ForkStorkHandler to setup include paths for the new C++ project. Signed-off-by: Alex McCaskey --- .../kepler_rcp.target | 86 ++--- .../.classpath | 2 +- .../.settings/org.eclipse.jdt.core.prefs | 6 +- .../widgets/moose/ForkStorkHandler.java | 327 +++++++++--------- .../org/eclipse/ice/core/internal/Core.java | 16 +- 5 files changed, 220 insertions(+), 217 deletions(-) diff --git a/org.eclipse.ice.target.kepler/kepler_rcp.target b/org.eclipse.ice.target.kepler/kepler_rcp.target index d5ad57fdd..7d10e5688 100644 --- a/org.eclipse.ice.target.kepler/kepler_rcp.target +++ b/org.eclipse.ice.target.kepler/kepler_rcp.target @@ -1,40 +1,9 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -70,8 +39,13 @@ - - + + + + + + + @@ -83,17 +57,43 @@ - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/org.eclipse.ice.client.widgets.moose/.classpath b/src/org.eclipse.ice.client.widgets.moose/.classpath index ad32c83a7..098194ca4 100644 --- a/src/org.eclipse.ice.client.widgets.moose/.classpath +++ b/src/org.eclipse.ice.client.widgets.moose/.classpath @@ -1,6 +1,6 @@ - + diff --git a/src/org.eclipse.ice.client.widgets.moose/.settings/org.eclipse.jdt.core.prefs b/src/org.eclipse.ice.client.widgets.moose/.settings/org.eclipse.jdt.core.prefs index c537b6306..f42de363a 100644 --- a/src/org.eclipse.ice.client.widgets.moose/.settings/org.eclipse.jdt.core.prefs +++ b/src/org.eclipse.ice.client.widgets.moose/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,7 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.compliance=1.7 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/src/org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/ForkStorkHandler.java b/src/org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/ForkStorkHandler.java index 16cc94c17..8170620a2 100644 --- a/src/org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/ForkStorkHandler.java +++ b/src/org.eclipse.ice.client.widgets.moose/src/org/eclipse/ice/client/widgets/moose/ForkStorkHandler.java @@ -25,6 +25,7 @@ import org.eclipse.cdt.core.CCProjectNature; import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.dom.IPDOMManager; +import org.eclipse.cdt.core.index.IIndex; import org.eclipse.cdt.core.index.IIndexManager; import org.eclipse.cdt.core.model.CoreModel; import org.eclipse.cdt.core.model.ICProject; @@ -69,6 +70,7 @@ import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.OperationCanceledException; import org.eclipse.egit.github.core.Repository; import org.eclipse.egit.github.core.RepositoryId; @@ -200,15 +202,42 @@ public Object execute(ExecutionEvent event) throws ExecutionException { } // Pull this into the Project Explorer as CDT project! + String projectTypeString = "cdt.managedbuild.target.macosx.so"; IProject appProject = root.getProject(appName), cProject = null; IWorkspaceDescription workspaceDesc = workspace.getDescription(); workspaceDesc.setAutoBuilding(false); try { + + /* + * + * + * PROJECT TYPE: + * org.eclipse.linuxtools.cdt.autotools.core.projectType PROJECT + * TYPE: cdt.managedbuild.target.gnu.cross.exe PROJECT TYPE: + * cdt.managedbuild.target.gnu.cross.so PROJECT TYPE: + * cdt.managedbuild.target.gnu.cross.lib PROJECT TYPE: + * cdt.managedbuild.target.gnu.exe PROJECT TYPE: + * cdt.managedbuild.target.gnu.so PROJECT TYPE: + * cdt.managedbuild.target.gnu.lib PROJECT TYPE: + * cdt.managedbuild.target.gnu.cygwin.exe PROJECT TYPE: + * cdt.managedbuild.target.gnu.cygwin.so PROJECT TYPE: + * cdt.managedbuild.target.gnu.cygwin.lib PROJECT TYPE: + * cdt.managedbuild.target.gnu.mingw.exe PROJECT TYPE: + * cdt.managedbuild.target.gnu.mingw.so PROJECT TYPE: + * cdt.managedbuild.target.gnu.mingw.lib PROJECT TYPE: + * cdt.managedbuild.target.macosx.exe PROJECT TYPE: + * cdt.managedbuild.target.macosx.so PROJECT TYPE: + * cdt.managedbuild.target.macosx.lib PROJECT TYPE: + * cdt.managedbuild.target.gnu.solaris.exe PROJECT TYPE: + * cdt.managedbuild.target.gnu.solaris.so PROJECT TYPE: + * cdt.managedbuild.target.gnu.solaris.lib + */ workspace.setDescription(workspaceDesc); IProjectDescription description = workspace .newProjectDescription(appProject.getName()); + // Create the CDT Project cProject = CCorePlugin.getDefault().createCDTProject(description, appProject, null); @@ -216,25 +245,21 @@ public Object execute(ExecutionEvent event) throws ExecutionException { cProject.open(null); } cProject.refreshLocal(IResource.DEPTH_INFINITE, null); - } catch (CoreException e1) { - e1.printStackTrace(); - } - String projTypeId = "cdt.managedbuild.target.macosx.exe"; + // Set the project type id + String projTypeId = "cdt.managedbuild.target.macosx.exe"; - // ICProjectDescription des = - // CCorePlugin.getDefault().getProjectDescription(cProject, true); - IManagedBuildInfo info = ManagedBuildManager.createBuildInfo(cProject); + // Create the ManagedBuildInfo + IManagedBuildInfo info = ManagedBuildManager + .createBuildInfo(cProject); - for (IProjectType t : ManagedBuildManager.getDefinedProjectTypes()) { - System.out.println("PROJECT TYPE: " + t.getId()); - } + for (IProjectType t : ManagedBuildManager.getDefinedProjectTypes()) { + System.out.println("PROJECT TYPE: " + t.getId()); + } - try { IProjectType type = ManagedBuildManager.getProjectType(projTypeId); IManagedProject mProj = ManagedBuildManager.createManagedProject( cProject, type); - // info.setManagedProject(mProj); IConfiguration cfgs[] = type.getConfigurations(); IConfiguration config = mProj @@ -254,19 +279,18 @@ public Object execute(ExecutionEvent event) throws ExecutionException { 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); + ICSourceEntry srcFolderEntry = new CSourceEntry(srcFolder, null, + ICSettingEntry.RESOLVED); + ICSourceEntry includeFolderEntry = new CSourceEntry(includeFolder, + null, ICSettingEntry.RESOLVED); + + cConfigDescription.setSourceEntries(new ICSourceEntry[] { + srcFolderEntry, includeFolderEntry }); - cConfigDescription.setSourceEntries(new ICSourceEntry[]{srcFolderEntry, includeFolderEntry}); - info.setManagedProject(mProj); cDescription.setCdtProjectCreated(); - //IIndexManager indexMgr = CCorePlugin.getIndexManager(); - //ICProject proj = CoreModel.getDefault().getCModel() - // .getCProject(cProject.getName()); - //indexMgr.setIndexerId(proj, IPDOMManager.ID_FAST_INDEXER); CoreModel.getDefault() .setProjectDescription(cProject, cDescription); ManagedBuildManager.setDefaultConfiguration(cProject, config); @@ -274,28 +298,8 @@ public Object execute(ExecutionEvent event) throws ExecutionException { ManagedBuildManager.setNewProjectVersion(cProject); ManagedBuildManager.saveBuildInfo(cProject, true); - } catch (CoreException e) { - e.printStackTrace(); - } catch (BuildException b) { - b.printStackTrace(); - } - // IProjectDescription desc = ResourcesPlugin.getWorkspace() - // .newProjectDescription(appName); - // IProject cProject = null; - // try { - // cProject = CCorePlugin.getDefault().createCDTProject(desc, - // appProject, null); - // MakeProjectNature.addNature(cProject, null); - // cProject.refreshLocal(IResource.DEPTH_INFINITE, null); - // } catch (OperationCanceledException e) { - // e.printStackTrace(); - // } catch (CoreException e) { - // e.printStackTrace(); - // } - - // Now create a default Make Target for the Moose user to use to - // build the new app - try { + // Now create a default Make Target for the Moose user to use to + // build the new app IMakeTargetManager manager = MakeCorePlugin.getDefault() .getTargetManager(); String[] ids = manager.getTargetBuilders(cProject); @@ -305,138 +309,133 @@ public Object execute(ExecutionEvent event) throws ExecutionException { target.setRunAllBuilders(false); target.setUseDefaultBuildCmd(true); target.setBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND, "make"); - target.setBuildAttribute(IMakeTarget.BUILD_LOCATION, ""); + target.setBuildAttribute(IMakeTarget.BUILD_LOCATION, cProject + .getLocation().toOSString()); target.setBuildAttribute(IMakeTarget.BUILD_ARGUMENTS, ""); target.setBuildAttribute(IMakeTarget.BUILD_TARGET, "all"); manager.addTarget(cProject, target); - } catch (CoreException e) { - e.printStackTrace(); - } - String workspacePath = ResourcesPlugin.getWorkspace().getRoot() - .getLocation().toOSString(); - 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 includes = new ArrayList(); - includes.addAll(setting - .getSettingEntriesList(ICSettingEntry.INCLUDE_PATH)); - - includes.add(new CIncludePathEntry( - "/moose/framework/include/actions", - ICSettingEntry.VALUE_WORKSPACE_PATH)); - includes.add(new CIncludePathEntry( - "/moose/framework/include/auxkernels", - ICSettingEntry.VALUE_WORKSPACE_PATH)); - includes.add(new CIncludePathEntry( - "/moose/framework/include/base", ICSettingEntry.VALUE_WORKSPACE_PATH)); - includes.add(new CIncludePathEntry( - "/moose/framework/include/bcs", ICSettingEntry.VALUE_WORKSPACE_PATH)); - includes.add(new CIncludePathEntry( - "/moose/framework/include/contraints", - ICSettingEntry.VALUE_WORKSPACE_PATH)); - includes.add(new CIncludePathEntry( - "/moose/framework/include/dampers", - ICSettingEntry.VALUE_WORKSPACE_PATH)); - includes.add(new CIncludePathEntry( - "/moose/framework/include/dgkernels", - ICSettingEntry.VALUE_WORKSPACE_PATH)); - includes.add(new CIncludePathEntry( - "/moose/framework/include/dirackernels", - ICSettingEntry.VALUE_WORKSPACE_PATH)); - includes.add(new CIncludePathEntry( - "/moose/framework/include/executioners", - ICSettingEntry.VALUE_WORKSPACE_PATH)); - includes.add(new CIncludePathEntry( - "/moose/framework/include/functions", - ICSettingEntry.VALUE_WORKSPACE_PATH)); - includes.add(new CIncludePathEntry( - "/moose/framework/include/geomsearch", - ICSettingEntry.VALUE_WORKSPACE_PATH)); - includes.add(new CIncludePathEntry( - "/moose/framework/include/ics", - ICSettingEntry.VALUE_WORKSPACE_PATH)); - includes.add(new CIncludePathEntry( - "/moose/framework/include/indicators", - ICSettingEntry.VALUE_WORKSPACE_PATH)); - includes.add(new CIncludePathEntry( - "/moose/framework/include/kernels", - ICSettingEntry.VALUE_WORKSPACE_PATH)); - includes.add(new CIncludePathEntry( - "/moose/framework/include/markers", - ICSettingEntry.VALUE_WORKSPACE_PATH)); - includes.add(new CIncludePathEntry( - "/moose/framework/include/materials", - ICSettingEntry.VALUE_WORKSPACE_PATH)); - includes.add(new CIncludePathEntry( - "/moose/framework/include/mesh", - ICSettingEntry.VALUE_WORKSPACE_PATH)); - includes.add(new CIncludePathEntry( - "/moose/framework/include/meshmodifiers", - ICSettingEntry.VALUE_WORKSPACE_PATH)); - includes.add(new CIncludePathEntry( - "/moose/framework/include/multiapps", - ICSettingEntry.VALUE_WORKSPACE_PATH)); - includes.add(new CIncludePathEntry( - "/moose/framework/include/outputs", - ICSettingEntry.VALUE_WORKSPACE_PATH)); - includes.add(new CIncludePathEntry( - "/moose/framework/include/parser", - ICSettingEntry.VALUE_WORKSPACE_PATH)); - includes.add(new CIncludePathEntry( - "/moose/framework/include/postprocessors", - ICSettingEntry.VALUE_WORKSPACE_PATH)); - includes.add(new CIncludePathEntry( - "/moose/framework/include/preconditioners", - ICSettingEntry.VALUE_WORKSPACE_PATH)); - includes.add(new CIncludePathEntry( - "/moose/framework/include/predictors", - ICSettingEntry.VALUE_WORKSPACE_PATH)); - includes.add(new CIncludePathEntry( - "/moose/framework/include/restart", - ICSettingEntry.VALUE_WORKSPACE_PATH)); - includes.add(new CIncludePathEntry( - "/moose/framework/include/splits", - ICSettingEntry.VALUE_WORKSPACE_PATH)); - includes.add(new CIncludePathEntry( - "/moose/framework/include/timeintegrators", - ICSettingEntry.VALUE_WORKSPACE_PATH)); - includes.add(new CIncludePathEntry( - "/moose/framework/include/timesteppers", - ICSettingEntry.VALUE_WORKSPACE_PATH)); - includes.add(new CIncludePathEntry( - "/moose/framework/include/userobject", - ICSettingEntry.VALUE_WORKSPACE_PATH)); - includes.add(new CIncludePathEntry( - "/moose/framework/include/utils", - ICSettingEntry.VALUE_WORKSPACE_PATH)); - includes.add(new CIncludePathEntry( - "/moose/framework/include/vectorpostprocessors", - ICSettingEntry.VALUE_WORKSPACE_PATH)); - includes.add(new CIncludePathEntry( - "/moose/libmesh/installed/include", - ICSettingEntry.VALUE_WORKSPACE_PATH)); - //includes.add(new CIncludePathEntry(appName + "/include/base", - // ICSettingEntry.VALUE_WORKSPACE_PATH)); - - setting.setSettingEntries(ICSettingEntry.INCLUDE_PATH, includes); + 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) { + System.out.println("Setting: " + setting.toString()); + List includes = getIncludePaths(); + includes.addAll(setting + .getSettingEntriesList(ICSettingEntry.INCLUDE_PATH)); + setting.setSettingEntries(ICSettingEntry.INCLUDE_PATH, + includes); + } } - } - - try { + CoreModel.getDefault().setProjectDescription(cProject, projectDescription); - } catch (CoreException e) { - // TODO Auto-generated catch block + + ICProject proj = CoreModel.getDefault().getCModel() + .getCProject(cProject.getName()); + IIndexManager indexManager = CCorePlugin.getIndexManager(); + IIndex index = indexManager.getIndex(proj, + IIndexManager.ADD_DEPENDENCIES); + indexManager.reindex(proj); + } catch (BuildException | CoreException e) { e.printStackTrace(); } return null; } + + private List getIncludePaths() { + List includes = new ArrayList(); + + includes.add(new CIncludePathEntry("/moose/framework/include/actions", + ICSettingEntry.VALUE_WORKSPACE_PATH)); + includes.add(new CIncludePathEntry( + "/moose/framework/include/auxkernels", + ICSettingEntry.VALUE_WORKSPACE_PATH)); + includes.add(new CIncludePathEntry("/moose/framework/include/base", + ICSettingEntry.VALUE_WORKSPACE_PATH)); + includes.add(new CIncludePathEntry("/moose/framework/include/bcs", + ICSettingEntry.VALUE_WORKSPACE_PATH)); + includes.add(new CIncludePathEntry( + "/moose/framework/include/constraints", + ICSettingEntry.VALUE_WORKSPACE_PATH)); + includes.add(new CIncludePathEntry("/moose/framework/include/dampers", + ICSettingEntry.VALUE_WORKSPACE_PATH)); + includes.add(new CIncludePathEntry( + "/moose/framework/include/dgkernels", + ICSettingEntry.VALUE_WORKSPACE_PATH)); + includes.add(new CIncludePathEntry( + "/moose/framework/include/dirackernels", + ICSettingEntry.VALUE_WORKSPACE_PATH)); + includes.add(new CIncludePathEntry( + "/moose/framework/include/executioners", + ICSettingEntry.VALUE_WORKSPACE_PATH)); + includes.add(new CIncludePathEntry( + "/moose/framework/include/functions", + ICSettingEntry.VALUE_WORKSPACE_PATH)); + includes.add(new CIncludePathEntry( + "/moose/framework/include/geomsearch", + ICSettingEntry.VALUE_WORKSPACE_PATH)); + includes.add(new CIncludePathEntry("/moose/framework/include/ics", + ICSettingEntry.VALUE_WORKSPACE_PATH)); + includes.add(new CIncludePathEntry( + "/moose/framework/include/indicators", + ICSettingEntry.VALUE_WORKSPACE_PATH)); + includes.add(new CIncludePathEntry("/moose/framework/include/kernels", + ICSettingEntry.VALUE_WORKSPACE_PATH)); + includes.add(new CIncludePathEntry("/moose/framework/include/markers", + ICSettingEntry.VALUE_WORKSPACE_PATH)); + includes.add(new CIncludePathEntry( + "/moose/framework/include/materials", + ICSettingEntry.VALUE_WORKSPACE_PATH)); + includes.add(new CIncludePathEntry("/moose/framework/include/mesh", + ICSettingEntry.VALUE_WORKSPACE_PATH)); + includes.add(new CIncludePathEntry( + "/moose/framework/include/meshmodifiers", + ICSettingEntry.VALUE_WORKSPACE_PATH)); + includes.add(new CIncludePathEntry( + "/moose/framework/include/multiapps", + ICSettingEntry.VALUE_WORKSPACE_PATH)); + includes.add(new CIncludePathEntry("/moose/framework/include/outputs", + ICSettingEntry.VALUE_WORKSPACE_PATH)); + includes.add(new CIncludePathEntry("/moose/framework/include/parser", + ICSettingEntry.VALUE_WORKSPACE_PATH)); + includes.add(new CIncludePathEntry( + "/moose/framework/include/postprocessors", + ICSettingEntry.VALUE_WORKSPACE_PATH)); + includes.add(new CIncludePathEntry( + "/moose/framework/include/preconditioners", + ICSettingEntry.VALUE_WORKSPACE_PATH)); + includes.add(new CIncludePathEntry( + "/moose/framework/include/predictors", + ICSettingEntry.VALUE_WORKSPACE_PATH)); + includes.add(new CIncludePathEntry("/moose/framework/include/restart", + ICSettingEntry.VALUE_WORKSPACE_PATH)); + includes.add(new CIncludePathEntry("/moose/framework/include/splits", + ICSettingEntry.VALUE_WORKSPACE_PATH)); + includes.add(new CIncludePathEntry( + "/moose/framework/include/timeintegrators", + ICSettingEntry.VALUE_WORKSPACE_PATH)); + includes.add(new CIncludePathEntry( + "/moose/framework/include/timesteppers", + ICSettingEntry.VALUE_WORKSPACE_PATH)); + includes.add(new CIncludePathEntry( + "/moose/framework/include/userobject", + ICSettingEntry.VALUE_WORKSPACE_PATH)); + includes.add(new CIncludePathEntry("/moose/framework/include/utils", + ICSettingEntry.VALUE_WORKSPACE_PATH)); + includes.add(new CIncludePathEntry( + "/moose/framework/include/vectorpostprocessors", + ICSettingEntry.VALUE_WORKSPACE_PATH)); + includes.add(new CIncludePathEntry("/moose/libmesh/installed/include", + ICSettingEntry.VALUE_WORKSPACE_PATH)); + + return includes; + } } \ No newline at end of file diff --git a/src/org.eclipse.ice.core/src/org/eclipse/ice/core/internal/Core.java b/src/org.eclipse.ice.core/src/org/eclipse/ice/core/internal/Core.java index 835b088f8..a8a85de1b 100644 --- a/src/org.eclipse.ice.core/src/org/eclipse/ice/core/internal/Core.java +++ b/src/org.eclipse.ice.core/src/org/eclipse/ice/core/internal/Core.java @@ -752,14 +752,18 @@ public void setHttpService(HttpService service) { if (componentContext != null) { bundle = componentContext.getBundleContext().getBundle(); } else { + System.out + .println("ICore Message: ICE Core ComponentContext was null! No web service started."); return; } - + // Make sure we got a valid bundle if (bundle == null) { + System.out + .println("ICore Message: ICE Core Bundle was null! No web service started."); return; } - + // Find the root location and the jaas_config file URL resourceURL = bundle.getEntry(""); URL configFileURL = bundle.getEntry("jaas_config.txt"); @@ -1043,10 +1047,10 @@ public String postUpdateMessage(String message) { String retVal = null; // Print the message if debugging is enabled - //if (debuggingEnabled) { - System.out.println("Core Message: " - + "Update received with message: " + message); - //} + // if (debuggingEnabled) { + System.out.println("Core Message: " + "Update received with message: " + + message); + // } // Only process the message if it exists and is not empty if (message != null && !message.isEmpty() && message.contains("=")) {