Commit fb6b0563 authored by Jay Jay Billings's avatar Jay Jay Billings
Browse files

Fixed the extension point hook up for the client.


Signed-off-by: default avatarJay Jay Billings <billingsjj@ornl.gov>
parent ceb574e7
......@@ -348,5 +348,13 @@
type="java.lang.Object">
</propertyTester>
</extension>
<extension
id="eclipsewidgetfactory"
name="Eclipse UI Widget Factory"
point="org.eclipse.ice.client.iwidgetfactory">
<iwidgetfactory
class="org.eclipse.ice.client.widgets.EclipseUIWidgetFactory">
</iwidgetfactory>
</extension>
</plugin>
......@@ -6,6 +6,8 @@ bin.includes = META-INF/,\
build.properties,\
pom.xml,\
plugin.xml,\
icons/
icons/,\
schema/
src.includes = pom.xml,\
icons/
icons/,\
schema/
......@@ -2,6 +2,7 @@
<?eclipse version="3.4"?>
<plugin>
<extension-point id="clientInstance" name="ICE Client" schema="schema/clientInstance.exsd"/>
<extension-point id="iwidgetfactory" name="Widget Factory" schema="schema/iwidgetfactory.exsd"/>
<extension point="org.eclipse.ui.newWizards">
<category
id="org.eclipse.ice.wizards"
......
......@@ -49,7 +49,7 @@
<element name="client">
<complexType>
<attribute name="class" type="string">
<attribute name="class" type="string" use="required">
<annotation>
<documentation>
This class must implement the IClient interface to provide ICE Client services.
......
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.eclipse.ice.client" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
<meta.schema plugin="org.eclipse.ice.client" id="iwidgetfactory" name="Widget Factory"/>
</appinfo>
<documentation>
This extension point shall provide a realization of the IWidgetFactory interface that is used by the Client to render widgets on the screen.
</documentation>
</annotation>
<element name="extension">
<annotation>
<appinfo>
<meta.element />
</appinfo>
</annotation>
<complexType>
<choice>
<element ref="iwidgetfactory"/>
</choice>
<attribute name="point" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>
</documentation>
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="iwidgetfactory">
<complexType>
<attribute name="class" type="string" use="required">
<annotation>
<documentation>
This class must implement the IWidgetFactory interface to provide widgets to Eclipse ICE client.
</documentation>
<appinfo>
<meta.attribute kind="java" basedOn=":org.eclipse.ice.iclient.uiwidgets.IWidgetFactory"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appinfo>
<meta.section type="since"/>
</appinfo>
<documentation>
[Enter the first release in which this extension point appears.]
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="examples"/>
</appinfo>
<documentation>
[Enter extension point usage example here.]
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="apiinfo"/>
</appinfo>
<documentation>
[Enter API information here.]
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="implementation"/>
</appinfo>
<documentation>
[Enter information about supplied implementation of this extension point.]
</documentation>
</annotation>
</schema>
......@@ -125,8 +125,12 @@ public class NewItemWizard extends Wizard implements INewWizard {
// Get the selected Item from the dialog
String selectedItem = page.getSelectedItem();
// Direct the client to create a new Item if a selection was made
if (selectedItem != null) {
// Direct the client to create a new Item if a selection was made.
// It should put the Item into the default project if none was
// selected or into the designated project if one was provided.
if (selectedItem != null && project == null) {
finished = client.createItem(selectedItem) > 0;
} else if (selectedItem != null) {
finished = client.createItem(selectedItem, project) > 0;
}
......
......@@ -21,7 +21,6 @@ import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
import org.eclipse.ice.client.common.internal.ClientHolder;
import org.eclipse.ice.client.internal.Client;
import org.eclipse.ice.iclient.IClient;
import org.eclipse.jface.viewers.DoubleClickEvent;
......@@ -44,7 +43,6 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.ui.PlatformUI;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -123,6 +121,7 @@ public class NewItemWizardPage extends WizardPage {
GridData data = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
itemSelectionComposite.setLayoutData(data);
// Get the extension registry and retrieve the client.
IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint point = registry
.getExtensionPoint("org.eclipse.ice.client.clientInstance");
......
......@@ -19,6 +19,11 @@ import java.util.Hashtable;
import java.util.concurrent.atomic.AtomicBoolean;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
import org.eclipse.ice.client.common.internal.ClientHolder;
import org.eclipse.ice.core.iCore.ICore;
......@@ -38,7 +43,6 @@ import org.eclipse.ice.iclient.uiwidgets.IUpdateEventListener;
import org.eclipse.ice.iclient.uiwidgets.IWidgetClosedListener;
import org.eclipse.ice.iclient.uiwidgets.IWidgetFactory;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.services.IServiceLocator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.slf4j.Logger;
......@@ -160,8 +164,8 @@ public class Client implements IUpdateEventListener, IProcessEventListener,
// posted to the IFormWidget based on the status of the process.
statusMessageMap.put(FormStatus.Processed, "Done!");
statusMessageMap.put(FormStatus.Processing, "Processing Form...");
statusMessageMap.put(FormStatus.InfoError,
"The Form contains an error" + " and cannot be processed.");
statusMessageMap.put(FormStatus.InfoError, "The Form contains an error"
+ " and cannot be processed.");
statusMessageMap.put(FormStatus.ReadyToProcess, "Ready to process.");
statusMessageMap.put(FormStatus.NeedsInfo,
"The Form requires additional information before "
......@@ -170,6 +174,26 @@ public class Client implements IUpdateEventListener, IProcessEventListener,
statusMessageMap.put(FormStatus.Unacceptable, "This Form will not be "
+ "processed or updated. It should be considered read-only.");
// Get the widgets factory from the registry
IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint point = registry
.getExtensionPoint("org.eclipse.ice.client.iwidgetfactory");
IExtension[] extensions = point.getExtensions();
// Get the configuration element. The extension point can only have one
// extension by default, so no need for a loop or check.
IConfigurationElement[] elements = extensions[0]
.getConfigurationElements();
IConfigurationElement element = elements[0];
// Set the widget factory
try {
setUIWidgetFactory((IWidgetFactory) element
.createExecutableExtension("class"));
} catch (CoreException e) {
// Complain
logger.error("Unable to retrieve UI Widget factory from registry!",
e);
}
// Set the reference to this in the Singleton for the widget classes to
// retrieve as needed.
ClientHolder.setClient(this);
......@@ -287,7 +311,7 @@ public class Client implements IUpdateEventListener, IProcessEventListener,
itemId = Integer.valueOf(getCore().createItem(itemType));
// Load the Item into the editor
loadAfterCreate(itemId);
loadAfterCreate(itemId, itemType);
return itemId;
}
......@@ -308,20 +332,29 @@ public class Client implements IUpdateEventListener, IProcessEventListener,
itemId = Integer.valueOf(getCore().createItem(itemType, project));
// Load the Item into the editor
loadAfterCreate(itemId);
loadAfterCreate(itemId, itemType);
return itemId;
}
private void loadAfterCreate(int itemId) {
/**
* This operation attempts to load a recently created Item into the UI an
* throws an error message if it cannot.
*
* @param itemId
* The id of the Item to load.
* @param itemType
* The type of the Item that was created.
*/
private void loadAfterCreate(int itemId, String itemType) {
// FIXME - Get the status! Need ItemStatus type or something
// Either load the Item or throw an error
if (itemId > 0) {// FIXME Status check!
loadItem(itemId);
} else if (itemId <= 0) {
throwSimpleError(
"Unable to load Item " + itemId + " after creating it.");
throwSimpleError("Unable to load Item " + itemType
+ " after creating it.");
}
}
......@@ -338,8 +371,8 @@ public class Client implements IUpdateEventListener, IProcessEventListener,
if (iWidgetFactory != null) {
logger.info("IClient Message: Widget Factory set!");
} else {
logger.info(
"IClient Message: " + "Widget Factory set, but is null.");
logger.info("IClient Message: "
+ "Widget Factory set, but is null.");
}
return;
}
......@@ -368,16 +401,15 @@ public class Client implements IUpdateEventListener, IProcessEventListener,
formWidget.display();
// Set the initial status of the Form
formStatus = getCore().getItemStatus(itemId);
formWidget.updateStatus(
statusMessageMap.get(iCore.getItemStatus(itemId)));
formWidget.updateStatus(statusMessageMap.get(iCore
.getItemStatus(itemId)));
// If the FormStatus signifies that the Form is absolutely
// unacceptable, then the user should be warned.
if (formStatus.equals(FormStatus.Unacceptable)) {
formWidget.disable(true);
throwSimpleError(
"This Form has been set to a read-only mode by "
+ "ICE. Please be advised that it can not be upated"
+ " or processed.");
throwSimpleError("This Form has been set to a read-only mode by "
+ "ICE. Please be advised that it can not be upated"
+ " or processed.");
}
// Register for updates
formWidget.registerUpdateListener(this);
......@@ -569,8 +601,8 @@ public class Client implements IUpdateEventListener, IProcessEventListener,
// Update the status of the Item update
if (formWidgetTable.containsKey(form.getItemID())) {
String statusMessage = statusMessageMap.get(status);
formWidgetTable.get(form.getItemID())
.updateStatus(statusMessage);
formWidgetTable.get(form.getItemID()).updateStatus(
statusMessage);
}
} else {
// Notify the user that there is some invalid information in the
......
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