Commit 62dd75b3 authored by Robert Smith's avatar Robert Smith
Browse files

Fixed Nek5000 bug



Fixed a bug where the visualization service was not being set to the nek
reader, causing Nek Models to be nonfunctional.

Also fixed a bug that caused some ICEResources to display in a very
small square on the page. 
Signed-off-by: Robert Smith's avatarRobert Smith <SmithRW@ornl.gov>
parent d5ab4488
......@@ -211,16 +211,9 @@ public class ICEResourcePage extends ICEFormPage implements ISelectionListener,
// It is possible that constructing the Browser throws an SWTError.
// Thus, to create the browser, we must use a try-catch block.
try {
// Initialize the browser and apply the layout. It should use a
// FillLayout so its contents take up all available space.
// Initialize the browser and apply the layout.
browser = new Browser(parent, SWT.NONE);
toolkit.adapt(browser);
// A Grid Layout must be used, instead of the more natural
// FillLayout, in order to avoid a bug in which the browser is
// capable of forcing its parent section to resize.
browser.setLayout(new GridLayout());
browser.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
browser.layout(true);
// Display the default-selected Resource from the Resource View in
......
......@@ -4,11 +4,12 @@ Bundle-Name: Nek5000 ICE Plug-in
Bundle-SymbolicName: org.eclipse.ice.nek5000;singleton:=true
Bundle-Version: 2.1.8.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Import-Package: org.eclipse.eavp.viz.modeling,
Import-Package: org.eclipse.eavp.viz.datastructures.VizObject,
org.eclipse.eavp.viz.modeling,
org.eclipse.eavp.viz.modeling.base,
org.eclipse.eavp.viz.modeling.factory,
org.eclipse.eavp.viz.modeling.properties,
org.eclipse.eavp.viz.datastructures.VizObject,
org.eclipse.eavp.viz.service,
org.eclipse.eavp.viz.service.mesh.datastructures,
org.eclipse.ice.datastructures.ICEObject,
org.eclipse.ice.datastructures.form,
......@@ -16,7 +17,8 @@ Import-Package: org.eclipse.eavp.viz.modeling,
org.eclipse.ice.item.jobLauncher,
org.slf4j;version="1.7.2"
Service-Component: OSGI-INF/nekModelComponent.xml,
OSGI-INF/nek5000LauncherComponent.xml
OSGI-INF/nek5000LauncherComponent.xml,
OSGI-INF/nekVizServiceFactory.xml
Require-Bundle: org.eclipse.ice.item;bundle-version="2.0.0",
org.eclipse.ice.datastructures,
org.eclipse.core.resources;bundle-version="3.7.100",
......
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.ice.nek5000.VizServiceFactoryHolder">
<implementation class="org.eclipse.ice.nek5000.internal.VizServiceFactoryHolder"/>
<reference bind="setVizServiceFactory" cardinality="1..1" interface="org.eclipse.eavp.viz.service.IVizServiceFactory" name="IVizServiceFactory" policy="dynamic"/>
</scr:component>
\ No newline at end of file
......@@ -2,6 +2,7 @@ bin.includes = META-INF/,\
.,\
OSGI-INF/nekModelComponent.xml,\
OSGI-INF/nek5000LauncherComponent.xml,\
plugin.xml
plugin.xml,\
OSGI-INF/nekVizServiceFactory.xml
output.. = bin/
source.. = src/
......@@ -26,6 +26,8 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.eavp.viz.modeling.factory.IControllerProviderFactory;
import org.eclipse.eavp.viz.service.IVizService;
import org.eclipse.eavp.viz.service.IVizServiceFactory;
import org.eclipse.ice.datastructures.ICEObject.Component;
import org.eclipse.ice.datastructures.entry.DiscreteEntry;
import org.eclipse.ice.datastructures.entry.IEntry;
......@@ -35,6 +37,7 @@ import org.eclipse.ice.datastructures.form.FormStatus;
import org.eclipse.ice.datastructures.form.MeshComponent;
import org.eclipse.ice.item.Item;
import org.eclipse.ice.item.ItemType;
import org.eclipse.ice.nek5000.internal.VizServiceFactoryHolder;
/**
* This class extends the Item to create a modeler for Nek5000 input files. It
......@@ -81,6 +84,11 @@ public class NekModel extends Item {
* A flag signaling that the construction of the item has finished.
*/
private boolean constructionFinished = false;
/**
* The factory containing the visualization services.
*/
private IVizServiceFactory factory;
/**
* The nullary constructor. This should only be used for testing.
......@@ -309,6 +317,16 @@ public class NekModel extends Item {
private void loadExample(String name)
throws FileNotFoundException, IOException {
//Get the factory
if(factory == null){
factory = VizServiceFactoryHolder.getFactory();
}
//TODO Provide a way for the user to select which mesh editor service is desired
//Set the reader's ControllerProviderFactory
IVizService service = factory.get("ICE JavaFX Mesh Editor");
reader.setControllerFactory(service.getControllerProviderFactory());
// Load the components from the file
File file = new File(name);
ArrayList<Component> components = reader.loadREAFile(file);
......@@ -463,8 +481,7 @@ public class NekModel extends Item {
problemFiles = getProjectFiles();
// Create the DataComponent that selects which problem
// to
// load
// to load
form.addComponent(
createSelectorComponent(problemFiles));
......
......@@ -113,6 +113,7 @@ public class NekReader {
* elements, number of fluid elements, number of passive scalar sets).
*/
private ProblemProperties properties;
/**
* The factory which the reader will use to produce views and controllers
* for the objects it generates.
......
/*******************************************************************************
* Copyright (c) 2016 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 -
* Robert Smith
*******************************************************************************/
package org.eclipse.ice.nek5000.internal;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.Platform;
import org.eclipse.eavp.viz.service.IVizServiceFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Holder class for a VizServiceFactory.
*
* @author Robert Smith
*
*/
public class VizServiceFactoryHolder {
// The VizServiceFactory held by the VizServiceFactory
private static IVizServiceFactory factory;
/**
* Getter for the held VizServiceFactory.
*
* @return the held VizServiceFactory
*/
public static IVizServiceFactory getFactory() {
return factory;
}
/**
* Setter for the VizServiceFactory.
*
* @param input
* the VizServiceFactory to hold
*/
public static void setVizServiceFactory(IVizServiceFactory input) {
VizServiceFactoryHolder.factory = input;
Logger staticLogger = LoggerFactory
.getLogger(VizServiceFactoryHolder.class);
IConfigurationElement[] elements = Platform.getExtensionRegistry()
.getConfigurationElementsFor(
"org.eclipse.eavp.viz.service.IVizServiceFactory");
staticLogger.info("Available configuration elements");
for (IConfigurationElement element : elements) {
staticLogger.info(element.getName());
}
return;
}
/**
* Remove the given VizServiceFactory if it is held by the
* VizServiceFactoryHolder.
*
* @input A VizServiceFactory to remove.
*/
public static void unsetVizServiceFactory(IVizServiceFactory input) {
if (input == factory) {
factory = null;
}
return;
}
}
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