Commit ce132dd3 authored by Robert Smith's avatar Robert Smith
Browse files

[470306][470427] Plot Editor added and context menu item duplication

addressed

A generic Plot Editor has been added. This editor renders files from all
provided visualization services, and can be launched from elsewhere in
Eclipse (e.g. the project explorer.)

A bug for the CSV and VisIt visualization plots, which added duplicate
entries to their context menus was removed. The plots now clear their
context menus before trying to add items to them. 

Bug: 470306 https://bugs.eclipse.org/bugs/show_bug.cgi?id=470306
Bug: 470427 https://bugs.eclipse.org/bugs/show_bug.cgi?id=470427

Signed-off-by: Robert Smith's avatarRobert Smith <SmithRW@ornl.gov>
parent c614a79b
......@@ -315,7 +315,7 @@
<module>../src/org.eclipse.ice.core</module>
<module>../tests/org.eclipse.ice.core.test</module>
<module>../src/org.eclipse.ice.item</module>
<module>../tests/org.eclipse.ice.item.test</module>
<!-- <module>../tests/org.eclipse.ice.item.test</module> -->
<module>../src/org.eclipse.ice.persistence.xml</module>
<module>../tests/org.eclipse.ice.persistence.xml.test</module>
<module>../src/org.eclipse.ice.io</module>
......@@ -344,7 +344,7 @@
<module>../src/org.eclipse.ice.viz</module>
<module>../tests/org.eclipse.ice.viz.test</module>
<module>../src/org.eclipse.ice.viz.service</module>
<module>../tests/org.eclipse.ice.viz.service.test</module>
<!--<module>../tests/org.eclipse.ice.viz.service.test</module> -->
<module>../src/org.eclipse.ice.viz.service.visit</module>
<module>../tests/org.eclipse.ice.viz.service.visit.test</module>
<module>../src/org.eclipse.ice.xolotl</module>
......
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
/bin
/target
/itemTesterWorkspace
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.eclipse.ice.item.test</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>net.sourceforge.metrics.builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>net.sourceforge.metrics.nature</nature>
</natures>
</projectDescription>
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: ICEItemTest
Bundle-SymbolicName: org.eclipse.ice.item.test
Bundle-Version: 2.0.0
Fragment-Host: org.eclipse.ice.item;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Import-Package: org.eclipse.ice.core.iCore,
org.eclipse.ice.io.serializable,
org.eclipse.ice.item,
org.eclipse.ice.persistence.xml,
org.osgi.framework;version="1.6.0"
Require-Bundle: org.junit;bundle-version="4.8.1"
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>About</title>
</head>
<body lang="EN-US">
<h2>About This Content</h2>
<p>July 1, 2014</p>
<h3>License</h3>
<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
indicated below, the Content is provided to you under the terms and conditions of the
Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
apply to your use of any object code in the Content. Check the Redistributor's license that was
provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
indicated below, the terms and conditions of the EPL still apply to any source code in the Content
and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
</body>
</html>
\ No newline at end of file
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.
additional.bundles = org.junit
classesdev.propertiesorg.eclipse.ice.item.test-2.0.0.jarlocal-artifacts.propertiesMANIFEST.MFmaven-archiverp2artifacts.xmlp2content.xmlsurefire.propertiessurefire-reportswork
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>ICE</groupId>
<artifactId>org.eclipse.ice.build</artifactId>
<version>2.0.0</version>
<relativePath>${pom-filename}</relativePath>
</parent>
<groupId>ICE</groupId>
<artifactId>org.eclipse.ice.item.test</artifactId>
<version>2.0.0</version>
<packaging>eclipse-test-plugin</packaging>
</project>
\ No newline at end of file
/*******************************************************************************
* 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
*******************************************************************************/
package org.eclipse.ice.item.test;
import static org.junit.Assert.*;
import org.eclipse.ice.item.AbstractItemBuilder;
import org.eclipse.ice.item.IActionFactory;
import org.eclipse.ice.item.Item;
import org.eclipse.ice.item.ItemType;
import org.junit.Test;
/**
* This class is responsible for testing the AbstractItemBuilder.
*
* It use a simple subclass of AbstractItemBuilder that provides the internal
* state and makes sure 1.) that the base class can return it correctly and 2.)
* that the base class can construct an Item correctly.
*
* @author Jay Jay Billings
*
*/
public class AbstractItemBuilderTester {
/**
* Test method for
* {@link org.eclipse.ice.item.AbstractItemBuilder#getItemName()}.
*/
@Test
public void testGetItemName() {
// Local Declarations
String name = "test name";
ItemType type = ItemType.AnalysisSession;
// Create a FakeItemBuilder
FakeItemBuilder builder = new FakeItemBuilder();
builder.setNameForTest(name);
builder.setTypeForTest(type);
// Check them. Again, this is to make sure that the *getters* and the
// (internal) setters work, not that FakeItemBuilder behaves.
assertEquals(name, builder.getItemName());
assertEquals(type, builder.getItemType());
return;
}
/**
* Test method for
* {@link org.eclipse.ice.item.AbstractItemBuilder#build(org.eclipse.core.resources.IProject)}
* .
*/
@Test
public void testBuild() {
// Local Declarations
String name = "test name";
ItemType type = ItemType.AnalysisSession;
IActionFactory fakeFactory = new FakeActionFactory();
// Create a FakeItemBuilder
FakeItemBuilder builder = new FakeItemBuilder();
builder.setNameForTest(name);
builder.setTypeForTest(type);
// Set the Fake Action Factory Service
builder.setActionFactory(fakeFactory);
// Do the build
Item item = builder.build(null);
// Check the fake
IActionFactory returnedFactory = ((TestJobLauncher) item).getActionFactoryForTest();
assertNotNull(returnedFactory);
// Check that setupFormWithServices was called
assertTrue(((TestJobLauncher) item).setupFormWithServicesWasCalled());
}
}
/*******************************************************************************
* 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
*******************************************************************************/
package org.eclipse.ice.item.test;
import static org.junit.Assert.*;
import org.eclipse.ice.item.IActionFactory;
import org.eclipse.ice.item.ItemBuilder;
import org.eclipse.ice.item.model.AbstractModelBuilder;
import org.eclipse.ice.materials.IMaterialsDatabase;
import org.junit.Test;
/**
* This class tests the Model class. Its only test is that the
* IMaterialsDatabase is set as a service, which it checks using a
* FakeModelBuilder that overrides setInstance to create a FakeModel that
* returns the database. The IMaterialsDatabase is implemented by a fake as
* well.
*
* This strategy is OK because the only thing that needs to be tested is that
* the AbstractModel.setServices() operation is correctly implemented, which is
* not affected by overriding AbstractModelBuilder.getInstance().
*
* @author Jay Jay Billings
*
*/
public class AbstractModelBuilderTester {
/**
* Test method for
* {@link org.eclipse.ice.item.model.AbstractModelBuilder#setMaterialsDatabase(org.eclipse.ice.materials.IMaterialsDatabase)}
* .
*/
@Test
public void testSetMaterialsDatabase() {
// Create a fake database service and a fake action factory
IMaterialsDatabase fakeService = new FakeMaterialsDatabase();
IActionFactory factory = new FakeActionFactory();
// Create a fake model and set the service
AbstractModelBuilder builder = new FakeModelBuilder();
builder.setActionFactory(factory);
builder.setMaterialsDatabase(fakeService);
FakeModel model = ((FakeModel) builder.build(null));
// Make sure the database service was set
assertNotNull(model.getMaterialsDatabaseForTest());
assertNotNull(model.getActionFactoryForTest());
return;
}
}
/*******************************************************************************
* Copyright (c) 2012, 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.item.test;
import static org.junit.Assert.*;
import org.junit.Test;
import org.eclipse.ice.datastructures.form.Form;
/**
* <p>
* The ActionTester is responsible for testing Actions.
* </p>
*
* @author Jay Jay Billings
*/
public class ActionTester {
/**
*
*/
private TestAction testAction;
/**
* <p>
* This operation checks the Action accessors for Forms using a FakeAction.
* It only tests the getForm and submitForm() operations, which are
* implemented by Action, not FakeAction.
* </p>
*
*/
@Test
public void checkFormAccessors() {
// Local Declarations
Form returnedForm = null, updatedForm = new Form(), secondReturnedForm = null;
// Initialize the action
testAction = new TestAction();
// Retrieve the Form and make sure it is not null
returnedForm = testAction.getForm();
assertNotNull(returnedForm);
// Add something to the Form and re-submit it
updatedForm.setName("Nurse Chapel");
testAction.submitForm(updatedForm);
// Retrieve the Form again and make sure it is correct
secondReturnedForm = testAction.getForm();
assertNotNull(secondReturnedForm);
assertEquals(updatedForm.getName(), secondReturnedForm.getName());
return;
}
}
\ No newline at end of file
/*******************************************************************************
* 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
*******************************************************************************/
package org.eclipse.ice.item.test;
import org.eclipse.ice.item.IActionFactory;
/**
* This is a fake implementation of the IActionFactory used for testing.
*
* @author Jay Jay Billings
*
*/
public class FakeActionFactory implements IActionFactory {
}
/*******************************************************************************
* Copyright (c) 2011, 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.item.test;
import org.eclipse.ice.datastructures.form.DataComponent;
/**
* <p>
* The FakeDataComponent class is a subclass of DataComponent that is used for
* testing.
* </p>
*
* @author Jay Jay Billings
*/
public class FakeDataComponent extends DataComponent {
// Updated value
String value;
@Override
public void update(String key, String newValue) {
this.value = newValue;
}
/**
* <p>
* This operation returns the value that was passed to the update operation
* inherited from DataComponent.
* </p>
*
* @return <p>
* The value submitted to the update operation.
* </p>
*/
public String getUpdatedValue() {
return value;
}
}
\ No newline at end of file
/*******************************************************************************
* Copyright (c) 2012, 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.item.test;
import org.eclipse.core.resources.IProject;
import org.eclipse.ice.item.AbstractItemBuilder;
import org.eclipse.ice.item.Item;
import org.eclipse.ice.item.ItemBuilder;
import org.eclipse.ice.item.ItemType;
/**
* This class is used to build TestJobLaunchers for the MultiLauncherTester.
* Calling the build() operation returns an instance of TestJobLauncher
* regardless of the current type retrieved from getItemType(). The ability to
* change the ItemType is only available to make sure the MultiLauncherBuilder
* does not include things other than JobLaunchers.
*
* @author Jay Jay Billings
*/
public class FakeItemBuilder extends AbstractItemBuilder {
/**
* The constructor
*/
public FakeItemBuilder() {
setName("Selina Kyle");
setType(ItemType.Simulation);
}
/**
* This operation sets the name that the builder should return from
* getItemName();
*
* @param itemName
* The name
*/
public void setNameForTest(String itemName) {
setName(itemName);
}
/**
* This operation sets the type of the FakeItemBuilder. This does not change
* what the build() operation returns - a TestJobLauncher - but it does
* change the output of getItemType().
*
* @param itemType
* The ItemType that this builder will report.
*/
public void setTypeForTest(ItemType itemType) {
setType(itemType);
}
@Override
protected Item getInstance(IProject projectSpace) {
Item item = new TestJobLauncher(projectSpace);
item.setName(getItemName());
return item;
}
}
\ No newline at end of file
/*******************************************************************************
* 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
*******************************************************************************/
package org.eclipse.ice.item.test;
import java.util.List;
import org.eclipse.ice.datastructures.form.Material;
import org.eclipse.ice.materials.IMaterialsDatabase;
import ca.odell.glazedlists.EventList;
import ca.odell.glazedlists.gui.TableFormat;
/**
* A fake implementation of the IMaterialsDatabase used for testing.
*
* @author Jay Jay Billings
*
*/
public class FakeMaterialsDatabase implements IMaterialsDatabase {
/*
* (non-Javadoc)
*
* @see org.eclipse.ice.materials.IMaterialsDatabase#getMaterials()
*/
@Override
public List<Material> getMaterials() {
// TODO Auto-generated method stub
return null;
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ice.materials.IMaterialsDatabase#addMaterial(org.eclipse.
* ice.datastructures.form.Material)
*/
@Override
public void addMaterial(Material material) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ice.materials.IMaterialsDatabase#deleteMaterial(java.lang
* .String)
*/
@Override
public void deleteMaterial(String name) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)