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

Started reworking the ICore acquisition in IClient.


Signed-off-by: default avatarJay Jay Billings <billingsjj@ornl.gov>
parent a402c4f6
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension-point id="clientInstance" name="ICE Client" schema="schema/clientInstance.exsd"/>
<extension point="org.eclipse.ui.newWizards">
<category
id="org.eclipse.ice.wizards"
......@@ -44,4 +45,12 @@
name="ICE">
</category>
</extension>
<extension
id="client"
name="ICE Client"
point="org.eclipse.ice.client.clientInstance">
<client
class="org.eclipse.ice.client.internal.Client">
</client>
</extension>
</plugin>
<?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="clientInstance" name="ICE Client"/>
</appinfo>
<documentation>
This extension point shall provide an instance of the IClient interface that is used as the Eclipse ICE interface.
</documentation>
</annotation>
<element name="extension">
<annotation>
<appinfo>
<meta.element />
</appinfo>
</annotation>
<complexType>
<choice>
<element ref="client"/>
</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="client">
<complexType>
<attribute name="class" type="string">
<annotation>
<documentation>
This class must implement the IClient interface to provide ICE Client services.
</documentation>
<appinfo>
<meta.attribute kind="java" basedOn=":org.eclipse.ice.iclient.IClient"/>
</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>
......@@ -15,7 +15,14 @@ package org.eclipse.ice.client.common.wizards;
import java.util.Collections;
import java.util.List;
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.client.internal.Client;
import org.eclipse.ice.iclient.IClient;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
......@@ -37,6 +44,9 @@ 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;
/**
* This class provides the main page for the {@link NewItemWizard}. It includes
......@@ -47,6 +57,11 @@ import org.eclipse.swt.widgets.MessageBox;
*/
public class NewItemWizardPage extends WizardPage {
/**
* Logger for handling event messages and other information.
*/
private static final Logger logger = LoggerFactory.getLogger(Client.class);
/**
* The name of the Item that was selected in the list.
*/
......@@ -98,9 +113,6 @@ public class NewItemWizardPage extends WizardPage {
// Set the parent reference
parentComposite = parent;
// Get the client
IClient client = ClientHolder.getClient();
// Create the composite for file selection pieces
Composite itemSelectionComposite = new Composite(parentComposite,
SWT.NONE);
......@@ -111,16 +123,30 @@ public class NewItemWizardPage extends WizardPage {
GridData data = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
itemSelectionComposite.setLayoutData(data);
// Only create the wizard if the client is available
if (client != null) {
IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint point = registry
.getExtensionPoint("org.eclipse.ice.client.clientInstance");
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];
// Get the client
try {
IClient client = (IClient) element
.createExecutableExtension("class");
// Draw the list of Items and present the selection wizard.
drawWizard(itemSelectionComposite, client);
} else {
} catch (CoreException e) {
// Otherwise throw an error
MessageBox errorMessage = new MessageBox(parent.getShell(), ERROR);
errorMessage.setMessage("The ICE Client is not available. "
+ "Please file a bug report.");
errorMessage.open();
// Log the error
logger.error("ICEClient Extension not found.",e);
}
// Set the control
......
......@@ -19,6 +19,7 @@ import java.util.Hashtable;
import java.util.concurrent.atomic.AtomicBoolean;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.Platform;
import org.eclipse.ice.client.common.internal.ClientHolder;
import org.eclipse.ice.core.iCore.ICore;
import org.eclipse.ice.datastructures.ICEObject.Identifiable;
......@@ -36,6 +37,8 @@ import org.eclipse.ice.iclient.uiwidgets.ITextEditor;
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;
......@@ -157,8 +160,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 "
......@@ -201,8 +204,7 @@ public class Client implements IUpdateEventListener, IProcessEventListener,
if (iCore == null) {
logger.info("IClient Message: Retrieving ICore for the client.");
iCoreServiceRef = context.getServiceReference(ICore.class);
iCore = context.getService(iCoreServiceRef);
iCore = PlatformUI.getWorkbench().getService(ICore.class);
logger.info("IClient Message: Core service set.");
}
......@@ -318,8 +320,8 @@ public class Client implements IUpdateEventListener, IProcessEventListener,
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 " + itemId + " after creating it.");
}
}
......@@ -336,8 +338,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;
}
......@@ -366,15 +368,16 @@ 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);
......@@ -566,8 +569,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