You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by sc...@apache.org on 2008/01/08 03:35:05 UTC
svn commit: r609842 [1/4] - in
/incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor: ./ META-INF/
icons/ src/ src/main/ src/main/java/ src/main/java/org/
src/main/java/org/apache/ src/main/java/org/apache/uima/
src/main/java/org/apache/uima/dde/...
Author: schor
Date: Mon Jan 7 18:35:02 2008
New Revision: 609842
URL: http://svn.apache.org/viewvc?rev=609842&view=rev
Log:
[UIMA-689] initial import under software grant to ASF.
Added:
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/META-INF/
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/META-INF/MANIFEST.MF
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/build.properties
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/icons/
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/plugin.xml
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/DeploymentDescriptorEditor.java
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/Messages.java
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/details/
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/details/AEMetaDataDetailsPage.java
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/details/DetailsPageProvider.java
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/details/EmptyDetailsPage.java
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/details/ErrorConfigDetailsPage.java
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/details/TemplateDetailsPage.java
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/hover/
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/hover/DDEInformationControl.java
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/hover/HoverManager.java
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/hover/KeyValuePair.java
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/messages.properties
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/page/
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/page/AEConfigurationPage.java
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/page/AbstractHeaderPage.java
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/page/MasterDetails.java
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/page/OverviewPage.java
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/provider/
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/provider/DDTreeContentProvider.java
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/provider/DDTreeLabelProvider.java
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/provider/ErrorConfigContentProvider.java
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/provider/ErrorsConfigLabelProvider.java
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/provider/NameValuePair.java
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/wizards/
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/wizards/DDENewWizard.java
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/wizards/DDENewWizardPage.java
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/editors/
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/editors/dde/
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/editors/dde/internal/
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/editors/dde/internal/Activator.java
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/tools/
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/tools/images/
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/tools/images/internal/
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/tools/images/internal/ImageLoader.java
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/tools/images/internal/ImageRegistryUtil.java
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/tools/internal/
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/tools/internal/cde/
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/tools/internal/cde/uima/
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/tools/internal/cde/uima/util/
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/tools/internal/cde/uima/util/UimaDescriptionUtils.java
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/tools/internal/ui/
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/tools/internal/ui/forms/
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/tools/internal/ui/forms/FormSection.java
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/tools/internal/ui/forms/FormSection2.java
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/tools/internal/uima/
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/tools/internal/uima/util/
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/tools/internal/uima/util/AETreeBuilder.java
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/tools/internal/uima/util/FormMessage.java
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/tools/internal/uima/util/WorkspaceResourceDialog.java
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/resources/
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/test/
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/test/java/
incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/test/resources/
Added: incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/META-INF/MANIFEST.MF?rev=609842&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/META-INF/MANIFEST.MF (added)
+++ incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/META-INF/MANIFEST.MF Mon Jan 7 18:35:02 2008
@@ -0,0 +1,32 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: UIMA Deployment Descriptor Editor Plug-in
+Bundle-SymbolicName: org.apache.uima.editors.dde;singleton:=true
+Bundle-Version: 0.5.2
+Bundle-Activator: org.apache.uima.editors.dde.internal.Activator
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.apache.uima.desceditor,
+ org.apache.uima.runtime,
+ org.eclipse.core.resources,
+ org.eclipse.ui.editors,
+ org.eclipse.ui.forms,
+ org.eclipse.ui.ide,
+ org.eclipse.jdt.core,
+ org.eclipse.jdt.launching,
+ org.eclipse.jface.text,
+ org.eclipse.ui.workbench.texteditor
+Eclipse-LazyStart: true
+Export-Package: org.apache.uima.dde.internal,
+ org.apache.uima.dde.internal.details,
+ org.apache.uima.dde.internal.hover,
+ org.apache.uima.dde.internal.page,
+ org.apache.uima.dde.internal.provider,
+ org.apache.uima.dde.internal.wizards,
+ org.apache.uima.editors.dde.internal,
+ org.apache.uima.tools.images.internal,
+ org.apache.uima.tools.internal.cde.uima.util,
+ org.apache.uima.tools.internal.ui.forms,
+ org.apache.uima.tools.internal.uima.util
+Bundle-ClassPath: uima-ep-dde.jar
Added: incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/build.properties
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/build.properties?rev=609842&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/build.properties (added)
+++ incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/build.properties Mon Jan 7 18:35:02 2008
@@ -0,0 +1,15 @@
+bin.includes = META-INF/,\
+ plugin.xml,\
+ icons/,\
+ uima-ep-dde.jar
+src.includes = .classpath,\
+ .project,\
+ META-INF/,\
+ bin/,\
+ build.properties,\
+ icons/,\
+ plugin.xml,\
+ src/
+output.uima-ep-dde.jar = bin/
+jars.compile.order = uima-ep-dde.jar
+source.uima-ep-dde.jar = src/
Added: incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/plugin.xml
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/plugin.xml?rev=609842&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/plugin.xml (added)
+++ incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/plugin.xml Mon Jan 7 18:35:02 2008
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+
+ <extension
+ point="org.eclipse.ui.newWizards">
+
+ <wizard
+ name="Deployment Descriptor File"
+ icon="icons/editor.gif"
+ category="org.apache.uima.cpe.UIMA"
+ class="org.apache.uima.dde.internal.wizards.DDENewWizard"
+ id="org.apache.uima.desceditor.fragments.dde.wizards.DDENewWizard">
+ </wizard>
+ </extension>
+
+ <extension
+ point="org.apache.uima.desceditor.externalEditor">
+ <editor
+ class="org.apache.uima.dde.internal.DeploymentDescriptorEditor"
+ id="org.apache.uima.dde"
+ name="Deployment Descriptor Editor">
+ <handlesElement
+ class="org.apache.uima.aae.deployment.AEService"
+ elementName="analysisEngineDeploymentDescription"
+ internalParseClass="org.apache.uima.aae.deployment.impl.AEDeploymentDescription_Impl"/>
+ </editor>
+ </extension>
+</plugin>
Added: incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/DeploymentDescriptorEditor.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/DeploymentDescriptorEditor.java?rev=609842&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/DeploymentDescriptorEditor.java (added)
+++ incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/DeploymentDescriptorEditor.java Mon Jan 7 18:35:02 2008
@@ -0,0 +1,545 @@
+/**
+ *
+ * Project UIMA Tooling
+ *
+ *
+ * creation date: Aug 5, 2007, 6:09:52 PM
+ * source: MultiPageEditor.java
+ */
+package org.apache.uima.dde.internal;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.uima.UIMAFramework;
+import org.apache.uima.aae.deployment.AEDeploymentDescription;
+import org.apache.uima.aae.deployment.impl.AEDeploymentDescription_Impl;
+import org.apache.uima.analysis_engine.AnalysisEngineDescription;
+import org.apache.uima.analysis_engine.impl.AnalysisEngineDescription_impl;
+import org.apache.uima.application.metadata.impl.UimaApplication_Impl;
+import org.apache.uima.application.util.UimaXmlParsingUtil;
+import org.apache.uima.dde.internal.page.AEConfigurationPage;
+import org.apache.uima.dde.internal.page.OverviewPage;
+import org.apache.uima.resource.ResourceManager;
+import org.apache.uima.resource.ResourceSpecifier;
+import org.apache.uima.taeconfigurator.CDEpropertyPage;
+import org.apache.uima.taeconfigurator.InternalErrorCDE;
+import org.apache.uima.taeconfigurator.Messages;
+import org.apache.uima.taeconfigurator.editors.MultiPageEditor;
+import org.apache.uima.taeconfigurator.editors.MultiPageEditorContributor;
+import org.apache.uima.taeconfigurator.editors.point.IUimaEditorExtension;
+import org.apache.uima.taeconfigurator.editors.point.IUimaMultiPageEditor;
+import org.apache.uima.taeconfigurator.editors.ui.AbstractSection;
+import org.apache.uima.taeconfigurator.editors.ui.Utility;
+import org.apache.uima.taeconfigurator.editors.xml.XMLEditor;
+import org.apache.uima.tools.debug.util.Trace;
+import org.apache.uima.tools.internal.cde.uima.util.UimaDescriptionUtils;
+import org.apache.uima.util.InvalidXMLException;
+import org.apache.uima.util.XMLInputSource;
+import org.apache.uima.util.XMLizable;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.ISaveablePart;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.forms.AbstractFormPart;
+import org.eclipse.ui.forms.IFormPart;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.texteditor.ITextEditor;
+
+
+/**
+ *
+ *
+ */
+public class DeploymentDescriptorEditor implements IUimaMultiPageEditor, IUimaEditorExtension {
+
+ protected boolean isBadXML = true;
+
+ static public final String ID = "com.ibm.apache.uima.dde.internal.MultiPageEditor";
+
+ static public final String TITLE = "UIMA DDE";
+ static public final String VERSION = "0.1.2";
+
+ public MultiPageEditor cde;
+
+// private String inputFileName = null;
+
+ private IFile inputIFile;
+
+ private AEDeploymentDescription aeDD;
+
+ private OverviewPage overviewPage;
+
+ private AEConfigurationPage aeConfigPage;
+
+ /** The text editor used in page 0. */
+ private XMLEditor sourceTextEditor;
+
+ protected int sourceIndex = -1;
+
+ // private Color fadeColor; // used for disable table's items
+
+ /** ********************************************************************** */
+
+ public DeploymentDescriptorEditor() {
+ super();
+ }
+
+ public void init () {
+ UimaApplication_Impl.initUimaApplicationFramework();
+ }
+
+ public boolean canEdit(MultiPageEditor cde, XMLizable xmlizable) {
+ if (xmlizable instanceof AEDeploymentDescription) {
+ return true;
+ }
+ return false;
+ }
+
+ public void activateEditor(IEditorSite site, IEditorInput editorInput, MultiPageEditor cde,
+ XMLizable xmlizable) throws PartInitException {
+ this.cde = cde;
+ aeDD = (AEDeploymentDescription) xmlizable;
+ inputIFile = ((IFileEditorInput) cde.getEditorInput()).getFile();
+ cde.setPartNameSuper(inputIFile.getName() + " (" + VERSION + ")");
+
+ isBadXML = false;
+ // init(site, editorInput);
+
+ // XML source editor may be opened by CDE
+ // when the source is "initially" invalid
+ if (cde.getSourceEditor() != null) {
+ sourceTextEditor = cde.getSourceEditor();
+ }
+ }
+
+ protected void init(IEditorSite site, IEditorInput input) throws PartInitException {
+ if (!(input instanceof IFileEditorInput)) {
+ throw new PartInitException("Invalid Input: " + input.getClass().getName() + " (Must be IFileEditorInput)");
+ }
+
+ cde.initSuper(site, input);
+
+ String filePathName = null;
+ inputIFile = ((IFileEditorInput) input).getFile();
+ filePathName = inputIFile.getLocation().toOSString();
+ cde.setPartNameSuper(inputIFile.getName() + " (" + VERSION + ")");
+
+ try {
+ aeDD = (AEDeploymentDescription) UimaXmlParsingUtil.parseUimaXmlDescriptor(filePathName);
+
+ isBadXML = false;
+ } catch (InvalidXMLException e) {
+ Utility.popMessage(
+ Messages.getString("MultiPageEditor.XMLerrorInDescriptorTitle"), //$NON-NLS-1$
+ Messages.getString("MultiPageEditor.XMLerrorInDescriptor") + "\n" + cde.getMessagesToRootCause(e), //$NON-NLS-1$ //$NON-NLS-2$
+ MessageDialog.ERROR);
+ } catch (IOException e) {
+ e.printStackTrace();
+ Utility.popMessage(Messages.getString("IOException"), //$NON-NLS-1$
+ cde.getMessagesToRootCause(e), MessageDialog.ERROR);
+ }
+ } // init
+
+ public void setFileDirty() {
+ cde.setFileDirty();
+ }
+
+ public AEDeploymentDescription getAEDeploymentDescription() {
+ return aeDD;
+ }
+
+ public void refresh() {
+ aeConfigPage.setInput(aeDD);
+ }
+
+ public void setInput () {
+ overviewPage.setInput(aeDD);
+ aeConfigPage.setInput(aeDD);
+ }
+
+ // From CDE
+// public Color getFadeColor() {
+// if (null == fadeColor)
+// // COLOR_WIDGET_DARK_SHADOW is the same as black on SUSE KDE
+// fadeColor = getSite().getShell().getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
+// return fadeColor;
+// }
+
+ /** ********************************************************************** */
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.forms.editor.FormEditor#addPages()
+ */
+ public void addPagesForCurrentEditor() {
+ try {
+
+ if (!isBadXML) {
+ cde.addPage(overviewPage = new OverviewPage(this, "123", "Overview"));
+ cde.addPage(aeConfigPage = new AEConfigurationPage(this, "123", "Deployment Configurations"));
+ }
+ createSourcePage();
+
+ if (aeDD != null) {
+ ResourceSpecifier aed;
+ try {
+ aed = aeDD.getAeService()
+ .resolveTopAnalysisEngineDescription(cde.createResourceManager(), false);
+ if (aed instanceof AnalysisEngineDescription
+ && ( ! ((AnalysisEngineDescription) aed).isPrimitive()) ) {
+ // if (aeDD.getAeService().getAnalysisEngineDeploymentMetaData().isAsync()) {
+ // Resolve delegates
+ aeDD.getAeService().getAnalysisEngineDeploymentMetaData()
+ .resolveDelegates(cde.createResourceManager(), true);
+ }
+ } catch (InvalidXMLException e) {
+ e.printStackTrace();
+ isBadXML = true;
+ Utility.popMessage(Messages.getString("InvalidXMLException"), //$NON-NLS-1$
+ cde.getMessagesToRootCause(e), MessageDialog.ERROR);
+ }
+ // return;
+ }
+ } catch (PartInitException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ if (isBadXML) {
+ pageChangeForCurrentEditor(sourceIndex);
+ }
+ }
+
+ /**
+ * Creates a page of the multi-page editor, which contains a text editor.
+ */
+ protected void createSourcePage () {
+ // XML source editor may be opened by CDE
+ // when the source is "initially" invalid
+ if (sourceTextEditor != null) {
+ return;
+ }
+ try {
+ sourceTextEditor = new XMLEditor(cde);
+ sourceIndex = cde.addPage(sourceTextEditor, cde.getEditorInput());
+ cde.setPageTextSuper(sourceIndex, "Source");
+ } catch (PartInitException e) {
+ ErrorDialog.openError(cde.getSite().getShell(), "Error creating nested text editor", null, e
+ .getStatus());
+ }
+ }
+
+ public String prettyPrintModel() {
+ return ((AEDeploymentDescription_Impl) aeDD).prettyPrint(MultiPageEditorContributor.getXMLindent());
+ }
+
+ boolean inside = false;
+ boolean isPageChangeRecursion = false;
+ public void pageChangeForCurrentEditor_OLD(int newPageIndex) {
+ if (inside) {
+ return;
+ }
+ int oldPageIndex = cde.getCurrentPageSuper();
+
+ if (newPageIndex == sourceIndex) {
+ // Switch to Source Page
+ if (!isBadXML) {
+ updateSourceFromModel();
+ }
+ } else {
+ // Switch FROM Source Page
+ if (oldPageIndex == sourceIndex) {
+ // Validate source
+ if ( ! validateSource() ) {
+ inside = true;
+ cde.setActivePageSuper(sourceIndex);
+ inside = false;
+ return ;
+ }
+ cde.pageChangeSuper(newPageIndex);
+ setInput();
+ return;
+ }
+ }
+ cde.pageChangeSuper(newPageIndex);
+ }
+
+ public void pageChangeForCurrentEditor(int newPageIndex) {
+ if (/*inside ||*/ isPageChangeRecursion) {
+ return;
+ }
+ int oldPageIndex = cde.getCurrentPageSuper();
+
+ if (oldPageIndex != -1) {
+ if (oldPageIndex == sourceIndex) {
+ if (!validateSource()) {
+ setActivePageWhileBlockingRecursion(sourceIndex);
+ return;
+ }
+ }
+ }
+
+ // Set the current page to source page
+ cde.pageChangeSuper(newPageIndex);
+
+ if (newPageIndex == sourceIndex) {
+ // Switch to Source Page
+ if (!isBadXML) {
+ updateSourceFromModel();
+ }
+ } else {
+ // Switch FROM Source Page
+ if (oldPageIndex == sourceIndex) {
+ // Validate source
+ if ( ! validateSource() ) {
+ // inside = true;
+ setActivePageWhileBlockingRecursion(sourceIndex);
+ // inside = false;
+ return ;
+ }
+ cde.pageChangeSuper(newPageIndex);
+ setInput();
+ return;
+ }
+ }
+ setActivePageWhileBlockingRecursion(newPageIndex);
+ }
+
+ protected void setActivePageWhileBlockingRecursion(int sourceIndex) {
+ try {
+ isPageChangeRecursion = true;
+ // next call needed to be done but wasn't prior to
+ // Eclipse 3.2
+ // In Eclipse 3.2 they fixed this, but call this now
+ // calls pageChange, and makes a recursive loop
+ // We break that loop here.
+ cde.setActivePageSuper(sourceIndex); // isn't being done otherwise?
+ } finally {
+ isPageChangeRecursion = false;
+ }
+ }
+
+
+ public void updateSourceFromModel() {
+// XMLEditor sourceEd;
+// if (sourceTextEditor == null) {
+// sourceEd = cde.getSourceEditor ();
+// sourceTextEditor = sourceEd;
+// } else {
+// sourceEd = sourceTextEditor;
+// }
+ sourceTextEditor.setIgnoreTextEvent(true);
+ IDocument doc = sourceTextEditor.getDocumentProvider().getDocument(
+ sourceTextEditor.getEditorInput());
+ doc.set(prettyPrintModel());
+ sourceTextEditor.setIgnoreTextEvent(false);
+ }
+
+ public void switchToBadSource (boolean genSource) {
+ isBadXML = true;
+ if (genSource) {
+ updateSourceFromModel();
+ }
+
+ cde.setActivePageSuper(sourceIndex);
+ }
+
+ /** ********************************************************************** */
+
+ // From CDE MultiPageEditor.java
+ protected boolean validateSource () {
+ isBadXML = true; // preset
+ IDocument doc = sourceTextEditor.getDocumentProvider().getDocument(
+ sourceTextEditor.getEditorInput());
+ String text = doc.get();
+ InputStream is;
+ try {
+ is = new ByteArrayInputStream(text.getBytes(cde.getCharSet(text)));
+ } catch (UnsupportedEncodingException e2) {
+ Utility.popMessage(Messages.getString("MultiPageEditor.19"), //$NON-NLS-1$
+ cde.getMessagesToRootCause(e2), MessageDialog.ERROR);
+ // super.setActivePage(sourceIndex);
+ return false;
+ }
+
+ // Set the location of XML descriptor
+ String filePathName = getFile().getLocation().toString();
+ XMLInputSource input = new XMLInputSource(is, new File(filePathName));
+
+ // Parse the XML descriptor
+ try {
+ XMLizable inputDescription = UimaDescriptionUtils.parseDescriptor(input);
+ if (inputDescription instanceof AEDeploymentDescription) {
+ aeDD = (AEDeploymentDescription) inputDescription;
+ ResourceSpecifier aed = aeDD.getAeService()
+ .resolveTopAnalysisEngineDescription(cde.createResourceManager(), false);
+ if (aed instanceof AnalysisEngineDescription
+ && ( ! ((AnalysisEngineDescription) aed).isPrimitive()) ) {
+ // if (aeDD.getAeService().getAnalysisEngineDeploymentMetaData().isAsync()) {
+ // Resolve delegates
+ aeDD.getAeService().getAnalysisEngineDeploymentMetaData()
+ .resolveDelegates(cde.createResourceManager(), true);
+ }
+ isBadXML = false;
+ } else {
+ String msg = Messages.getFormattedString(
+ "Unrecognized descriptor type for file ''{0}''.", //$NON-NLS-1$
+ new String[] { AbstractSection.maybeShortenFileName(filePathName) })
+ + "\n"; //$NON-NLS-1$
+ Utility.popMessage("Error", //$NON-NLS-1$
+ msg, MessageDialog.ERROR);
+ return false;
+ }
+ } catch (InvalidXMLException e) {
+ // super.setActivePage(sourceIndex);
+ Utility.popMessage(Messages.getString("InvalidXMLException"), //$NON-NLS-1$
+ cde.getMessagesToRootCause(e), MessageDialog.ERROR);
+ return false;
+ }
+
+ return true;
+ }
+
+ /** **************************** Possible Merge with CDE ***************************** */
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.part.EditorPart#doSave(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void doSaveForCurrentEditor(IProgressMonitor monitor) {
+ if (cde.getCurrentPageSuper() != sourceIndex) {
+ updateSourceFromModel(); // Only when it is not in source page
+ }
+ sourceTextEditor.doSave(monitor);
+ cde.setFileDirtyFlag(false);
+ cde.firePropertyChangeSuper(ISaveablePart.PROP_DIRTY);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.part.EditorPart#doSaveAs()
+ */
+ public void doSaveAsForCurrentEditor() {
+ if (cde.getCurrentPageSuper() != sourceIndex) {
+ updateSourceFromModel(); // Only when it is not in source page
+ }
+
+ cde.setSaveAsStatus(cde.SAVE_AS_STARTED);
+ sourceTextEditor.doSaveAs();
+
+ if (cde.m_nSaveAsStatus == cde.SAVE_AS_CANCELLED) {
+ cde.m_nSaveAsStatus = cde.SAVE_AS_NOT_IN_PROGRESS;
+ return;
+ }
+ // should only do if editorInput is new
+ FileEditorInput newEditorInput = (FileEditorInput) sourceTextEditor.getEditorInput();
+
+ // if(old)
+ cde.setInputSuper(newEditorInput);
+ cde.firePropertyChangeSuper(cde.PROP_INPUT);
+ // setTitle(newEditorInput.getFile().getName());
+ cde.setPartNameSuper(newEditorInput.getFile().getName());
+ // this next does NOT seem to change the overall page title
+
+ cde.firePropertyChangeSuper(cde.PROP_TITLE);
+ cde.setFileDirtyFlag(false);
+ cde.firePropertyChangeSuper(ISaveablePart.PROP_DIRTY);
+ }
+
+ /** ************************* From CDE ********************************** */
+
+ /**
+ * @return current file being edited
+ */
+ public IFile getFile() {
+ return inputIFile;
+ }
+
+ /**
+ * Returns the workspace instance.
+ */
+ public static IWorkspace getWorkspace() {
+ return ResourcesPlugin.getWorkspace();
+ }
+
+ private IJavaProject javaProject = null;
+
+ public IJavaProject getJavaProject() {
+ IFile iFile = getFile();
+ if (null == javaProject && null != iFile) {
+ javaProject = JavaCore.create(iFile.getProject());
+ }
+ return javaProject;
+ }
+
+ /**
+ * Convenience method to get the workspace root.
+ */
+ public IWorkspaceRoot getWorkspaceRoot() {
+ return ResourcesPlugin.getWorkspace().getRoot();
+ }
+
+ // Won't work for "linked" project !
+// public String getDescriptorRelativePath(String aFullOrRelativePath) {
+// String sEditorFileFullPath = getFile().getLocation().toString();
+// String sFullOrRelativePath = aFullOrRelativePath.replace('\\', '/');
+//
+// // Won't work for "linked" project !
+// // Comment out !
+// //
+// // first, if not in workspace, or if a relative path, not a full path, return path
+// // String sWorkspacePath = getWorkspace().getRoot().getLocation().toString();
+// // if (sFullOrRelativePath.indexOf(sWorkspacePath) == -1) {
+// // return sFullOrRelativePath;
+// // }
+//
+// String sFullPath = sFullOrRelativePath; // rename the var to its semantics
+//
+// String commonPrefix = getCommonParentFolder(sEditorFileFullPath, sFullPath);
+// if (commonPrefix.length() < 2 || commonPrefix.indexOf(':') == commonPrefix.length() - 2) {
+// return sFullPath;
+// }
+//
+// // now count extra slashes to determine how many ..'s are needed
+// int nCountBackDirs = 0;
+// String sRelativePath = ""; //$NON-NLS-1$
+// for (int i = commonPrefix.length(); i < sEditorFileFullPath.length(); i++) {
+// if (sEditorFileFullPath.charAt(i) == '/') {
+// sRelativePath += "../"; //$NON-NLS-1$
+// nCountBackDirs++;
+// }
+// }
+// sRelativePath += sFullPath.substring(commonPrefix.length());
+// return sRelativePath;
+// }
+
+}
Added: incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/Messages.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/Messages.java?rev=609842&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/Messages.java (added)
+++ incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/Messages.java Mon Jan 7 18:35:02 2008
@@ -0,0 +1,54 @@
+package org.apache.uima.dde.internal;
+
+import java.text.MessageFormat;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ */
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.apache.uima.dde.internal.messages";//$NON-NLS-1$
+
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ // Overview Page
+ static public String DDE_OverviewPage_General_Section_Title;
+
+ static public String DDE_OverviewPage_General_Section_Description;
+
+ static public String DDE_OverviewPage_Service_Section_Title;
+
+ static public String DDE_OverviewPage_Service_Section_Description;
+
+ // AE Configurations Page
+ static public String DDE_AEConfigPage_AEConfigTree_Section_Title;
+
+ static public String DDE_AEConfigPage_AEConfigTree_Section_Description;
+
+ static public String DDE_AEConfigPage_AEConfig_Section_Title;
+
+ static public String DDE_AEConfigPage_ErrorConfig_Section_Title;
+
+ /** ************************************************************************ */
+
+ private Messages() {
+ }
+
+ public static String getString(String key) {
+ try {
+ return RESOURCE_BUNDLE.getString(key);
+ } catch (MissingResourceException e) {
+ return '!' + key + '!';
+ }
+ }
+
+ public static String getFormattedString(String key, String[] args) {
+ return MessageFormat.format(RESOURCE_BUNDLE.getString(key), args);
+ }
+
+}
Added: incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/details/AEMetaDataDetailsPage.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/details/AEMetaDataDetailsPage.java?rev=609842&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/details/AEMetaDataDetailsPage.java (added)
+++ incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/details/AEMetaDataDetailsPage.java Mon Jan 7 18:35:02 2008
@@ -0,0 +1,798 @@
+package org.apache.uima.dde.internal.details;
+
+import org.apache.uima.aae.deployment.AEDeploymentMetaData;
+import org.apache.uima.aae.deployment.AEService;
+import org.apache.uima.aae.deployment.AsyncAEErrorConfiguration;
+import org.apache.uima.aae.deployment.RemoteAEDeploymentMetaData;
+import org.apache.uima.aae.deployment.impl.AEDeploymentDescription_Impl;
+import org.apache.uima.aae.deployment.impl.DeploymentMetaData_Impl;
+import org.apache.uima.analysis_engine.AnalysisEngineDescription;
+import org.apache.uima.application.metadata.impl.UimaApplication_Impl;
+import org.apache.uima.dde.internal.DeploymentDescriptorEditor;
+import org.apache.uima.dde.internal.Messages;
+import org.apache.uima.dde.internal.page.MasterDetails;
+import org.apache.uima.resource.ResourceSpecifier;
+import org.apache.uima.resource.metadata.MetaDataObject;
+import org.apache.uima.taeconfigurator.editors.ui.Utility;
+import org.apache.uima.tools.debug.util.Trace;
+import org.apache.uima.tools.internal.ui.forms.FormSection;
+import org.apache.uima.tools.internal.ui.forms.FormSection2;
+import org.apache.uima.tools.internal.uima.util.AETreeBuilder;
+import org.apache.uima.tools.internal.uima.util.FormMessage;
+import org.apache.uima.tools.internal.uima.util.WorkspaceResourceDialog;
+import org.apache.uima.util.InvalidXMLException;
+import org.apache.uima.util.XMLizable;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.fieldassist.DecoratedField;
+import org.eclipse.jface.fieldassist.FieldDecoration;
+import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.custom.StackLayout;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Spinner;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.AbstractFormPart;
+import org.eclipse.ui.forms.FormColors;
+import org.eclipse.ui.forms.IDetailsPage;
+import org.eclipse.ui.forms.IFormPart;
+import org.eclipse.ui.forms.IManagedForm;
+import org.eclipse.ui.forms.SectionPart;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.ScrolledPageBook;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.forms.widgets.TableWrapData;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
+
+
+public class AEMetaDataDetailsPage extends AbstractFormPart implements IDetailsPage {
+ private DeploymentDescriptorEditor multiPageEditor;
+
+ private MasterDetails masterPart;
+
+ private boolean isDelegate;
+
+ private Object selectedObject = null;
+
+ private IManagedForm mform;
+
+// private ScrolledPageBook myScrolledPageBook = null; // used to support Section
+
+ private Section sectionAEMetaDataDetails;
+
+ private Button asMode;
+
+ private Spinner scaleout;
+
+ private Label casMultiplierLabelRemote;
+
+ private Spinner casMultiplierRemote;
+
+ private Label casMultiplierLabel;
+
+ private Spinner casMultiplier;
+
+ private ErrorConfigDetailsPage errorConfigDetails;
+
+ private Button deploymentCoLocated;
+
+ private Button deploymentRemote;
+
+ private StackLayout stackLayout;
+
+ private Composite stackLayoutComposite;
+
+ private Composite compositeCoLocatedSetting;
+
+ private Composite compositeRemoteSetting;
+
+ private MetaDataObject currentMetaDataObject;
+
+ // For Remote Deployment
+
+ private DecoratedField brokerUrlDecoField;
+
+ private DecoratedField endPointDecoField;
+
+ private FieldDecoration decorationBrokerUrl;
+
+ private FieldDecoration decorationEndPoint;
+
+ protected Text brokerUrl;
+
+ protected Text endPoint;
+
+ protected CCombo remoteQueueLocation;
+
+ protected Label serializerMethod;
+
+ private boolean ignoreUpdate = false; // Used to update Text without setting dirty flag
+
+ /** ********************************************************************** */
+
+ private ModifyListener fModifyListener = new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ Object source = e.getSource();
+
+ if (source == brokerUrl) {
+ ((RemoteAEDeploymentMetaData) currentMetaDataObject).getInputQueue().setBrokerURL(brokerUrl.getText().trim());
+
+ } else if (source == endPoint) {
+ ((RemoteAEDeploymentMetaData) currentMetaDataObject).getInputQueue().setEndPoint(endPoint.getText().trim());
+
+ }
+ isValid();
+ if (!ignoreUpdate) {
+ multiPageEditor.setFileDirty();
+ }
+ }
+ };
+
+ protected SelectionListener asynAggregateListener = new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent e) {
+ if (e.getSource() == asMode) {
+ if (asMode.getSelection()) {
+ changeToAsyncAggregate(true);
+ } else {
+ changeToAsyncAggregate(false);
+ }
+ } else if (e.getSource() == scaleout) {
+ // Trace.err("scaleout: " + scaleout.getSelection());
+ updateScaleOut(scaleout.getSelection());
+
+ } else if (e.getSource() == casMultiplier) {
+ updateCasMultiplierPoolSize(casMultiplier.getSelection());
+
+ } else if (e.getSource() == casMultiplierRemote) {
+ updateCasMultiplierPoolSize(casMultiplierRemote.getSelection());
+
+ } else if (e.getSource() == remoteQueueLocation) {
+ String location;
+ if (remoteQueueLocation.getText().equals("no")) {
+ location = "local";
+ } else {
+ location = "remote";
+ }
+ ((RemoteAEDeploymentMetaData) currentMetaDataObject).setReplyQueueLocation(location);
+ }
+ multiPageEditor.setFileDirty();
+ }
+ };
+
+ protected SelectionListener deploymentListener = new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent e) {
+ Composite switchTo = null;
+ if (e.getSource() == deploymentCoLocated) {
+ if (deploymentCoLocated.getSelection()) {
+ // Trace.err("deploymentCoLocated");
+ switchTo = compositeCoLocatedSetting;
+ }
+ } else if (e.getSource() == deploymentRemote) {
+ if (deploymentRemote.getSelection()) {
+ // Trace.err("deploymentRemote");
+ switchTo = compositeRemoteSetting;
+ }
+ }
+ if (switchTo != null && stackLayout.topControl != switchTo) {
+ if (currentMetaDataObject instanceof AEDeploymentMetaData) {
+ // Switch to Remote
+ AEDeploymentMetaData parent = ((AEDeploymentMetaData) currentMetaDataObject).getParent();
+ if (parent == null) {
+ Trace.err("parent == null");
+ return;
+ }
+ int index = parent.getDelegates()
+ .indexOf((DeploymentMetaData_Impl) currentMetaDataObject);
+
+ currentMetaDataObject = (MetaDataObject) AETreeBuilder
+ .createRemoteAEDeploymentMetaData((AEDeploymentMetaData) currentMetaDataObject);
+ index = parent.getDelegates().replaceDelegate(index,
+ (DeploymentMetaData_Impl) currentMetaDataObject);
+
+ } else if (currentMetaDataObject instanceof RemoteAEDeploymentMetaData) {
+ AEDeploymentMetaData parent = ((RemoteAEDeploymentMetaData) currentMetaDataObject)
+ .getParent();
+ if (parent == null) {
+ Trace.err("parent == null");
+ return;
+ }
+ int index = parent.getDelegates()
+ .indexOf((DeploymentMetaData_Impl) currentMetaDataObject);
+
+ currentMetaDataObject = (MetaDataObject) AETreeBuilder
+ .createAEDeploymentMetaData((RemoteAEDeploymentMetaData) currentMetaDataObject);
+ index = parent.getDelegates().replaceDelegate(index,
+ (DeploymentMetaData_Impl) currentMetaDataObject);
+ }
+ masterPart.refresh();
+
+ stackLayout.topControl = switchTo;
+ stackLayoutComposite.layout();
+
+ multiPageEditor.setFileDirty();
+ }
+ }
+
+ };
+
+ /** ********************************************************************** */
+
+ public AEMetaDataDetailsPage(DeploymentDescriptorEditor editor, IManagedForm mform,
+ MasterDetails master, boolean isDelegate) {
+ this.multiPageEditor = editor;
+ this.mform = mform;
+ this.masterPart = master;
+ this.isDelegate = isDelegate;
+ }
+
+ /** ********************************************************************** */
+
+ //
+ // Note: "parent" is a "LayoutComposite" created by "ScrolledPageBook pageBook"
+ // in "DetailsPart".
+ // The parent of "parent" is "WrappedPageBook pageBook".
+ // The grand-parent of "parent" is ScrolledPageBook which needs to be
+ // "reflowed" when Section is expanded/collapsed.
+ public void createContents(Composite parent) {
+ // Get ScrolledPageBook
+ Control c = parent.getParent();
+ while (!(c instanceof ScrolledPageBook)) {
+ c = c.getParent();
+ }
+// myScrolledPageBook = (ScrolledPageBook) c;
+
+ // Set Layout for "parent"
+ TableWrapLayout layout = new TableWrapLayout();
+ layout.topMargin = 0;
+ layout.leftMargin = 5;
+ layout.rightMargin = 2;
+ layout.bottomMargin = 2;
+ parent.setLayout(layout);
+
+ FormToolkit toolkit = mform.getToolkit();
+
+ createIdentitySection(parent, toolkit);
+ errorConfigDetails = new ErrorConfigDetailsPage(multiPageEditor, mform, isDelegate);
+ errorConfigDetails.createConfigurationsSection(parent, toolkit);
+ }
+
+ private Section createIdentitySection(Composite parent, FormToolkit toolkit) {
+ TableWrapData td;
+
+ sectionAEMetaDataDetails = FormSection.createTableWrapDataSection(toolkit, parent,
+ Section.TWISTIE,
+ Messages.DDE_AEConfigPage_AEConfig_Section_Title,
+ "Set the properties of ...", 10, 5,
+ TableWrapData.FILL_GRAB, TableWrapData.FILL_GRAB, 1, 1);
+ final SectionPart spart = new SectionPart(sectionAEMetaDataDetails);
+ mform.addPart(spart);
+ spart.initialize(mform); // Need this code. Otherwise, exception in SectionPart !!!
+ sectionAEMetaDataDetails.setExpanded(true);
+
+ // /////////////////////////////////////////////////////////////////////
+
+ Composite sectionClient = toolkit.createComposite(sectionAEMetaDataDetails);
+ TableWrapLayout tl = new TableWrapLayout();
+ tl.numColumns = 2;
+ tl.leftMargin = 0;
+ tl.rightMargin = 0;
+ tl.topMargin = 10;
+ tl.bottomMargin = 0;
+ sectionClient.setLayout(tl);
+ sectionAEMetaDataDetails.setClient(sectionClient);
+
+ // Co-located or Remote
+ // toolkit.createLabel(sectionClient, "", SWT.NONE);
+ Composite colocatedOrRemote = toolkit.createComposite(sectionClient, SWT.NONE);
+ GridLayout gl = new GridLayout(3, true);
+ gl.marginWidth = 0;
+ colocatedOrRemote.setLayout(gl);
+ td = new TableWrapData(TableWrapData.FILL);
+ td.colspan = 2;
+ td.grabHorizontal = true;
+ td.indent = 0;
+ colocatedOrRemote.setLayoutData(td);
+ Label label = toolkit.createLabel(colocatedOrRemote, "Deployment:", SWT.NONE);
+ label.setForeground(toolkit.getColors().getColor(FormColors.TITLE));
+ deploymentCoLocated = toolkit.createButton(colocatedOrRemote, "Co-located", SWT.RADIO);
+ deploymentRemote = toolkit.createButton(colocatedOrRemote, "Remote", SWT.RADIO);
+ deploymentCoLocated.setSelection(true);
+ deploymentCoLocated.addSelectionListener(deploymentListener);
+ deploymentRemote.addSelectionListener(deploymentListener);
+
+ stackLayoutComposite = new Composite(sectionClient, SWT.NONE);
+ stackLayout = new StackLayout();
+ stackLayoutComposite.setLayout(stackLayout);
+ td = new TableWrapData(TableWrapData.FILL);
+ td.colspan = 2;
+ td.grabHorizontal = true;
+ td.indent = 0;
+ stackLayoutComposite.setLayoutData(td);
+
+ compositeCoLocatedSetting = toolkit.createComposite(stackLayoutComposite, SWT.NONE);
+ gl = new GridLayout(2, false);
+ gl.marginWidth = 0;
+ compositeCoLocatedSetting.setLayout(gl);
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ compositeCoLocatedSetting.setLayoutData(gd);
+
+ compositeRemoteSetting = toolkit.createComposite(stackLayoutComposite, SWT.NONE);
+ gl = new GridLayout(2, false);
+ gl.marginWidth = 0;
+ compositeRemoteSetting.setLayout(gl);
+ gd = new GridData(GridData.FILL_BOTH);
+ compositeRemoteSetting.setLayoutData(gd);
+
+ // /////////////////////////////////////////////////////////////////////
+
+ // Run in AS mode
+ asMode = toolkit.createButton(compositeCoLocatedSetting, "Run as AS aggregate", SWT.CHECK);
+ gd = new GridData();
+ gd.horizontalSpan = 2;
+ asMode.setLayoutData(gd);
+ asMode.addSelectionListener(asynAggregateListener);
+
+ // <scaleout numberOfInstances="1"/> <!-- optional -->
+ scaleout = FormSection2.createLabelAndSpinner(toolkit, compositeCoLocatedSetting,
+ "Number of replicated instances:", SWT.BORDER, 1, Integer.MAX_VALUE, false);
+ scaleout.setSelection(1);
+ scaleout.addSelectionListener(asynAggregateListener);
+
+ // <casMultiplier poolSize="5"/> <!-- optional -->
+ casMultiplierLabel = toolkit.createLabel(compositeCoLocatedSetting,
+ "Pool size for CAS Multiplier:");
+ casMultiplier = FormSection2.createLabelAndSpinner(toolkit, compositeCoLocatedSetting,
+ casMultiplierLabel, SWT.BORDER, 0, Integer.MAX_VALUE, false);
+ casMultiplier.setSelection(0);
+ casMultiplier.addSelectionListener(asynAggregateListener);
+
+ // /////////////////////////////////////////////////////////////////////
+
+ brokerUrlDecoField = FormSection2.createLabelAndDecoratedText(toolkit,
+ compositeRemoteSetting, "Broker URL for remote service:",
+ currentMetaDataObject == null ?
+ "":((RemoteAEDeploymentMetaData) currentMetaDataObject).getInputQueue().getBrokerURL(), SWT.WRAP, 10, 0);
+
+ // Create an error decoration
+ decorationBrokerUrl = FormSection2.registerFieldDecoration("brokerUrl2",
+ "The broker URL cannot be empty");
+ brokerUrlDecoField.addFieldDecoration(decorationBrokerUrl, SWT.LEFT | SWT.TOP, false);
+ brokerUrl = (Text) brokerUrlDecoField.getControl();
+ brokerUrl.addModifyListener(fModifyListener);
+
+ endPointDecoField = FormSection2.createLabelAndDecoratedText(toolkit,
+ compositeRemoteSetting, "Queue name for remote service:",
+ currentMetaDataObject == null ?
+ "":((RemoteAEDeploymentMetaData) currentMetaDataObject).getInputQueue().getEndPoint(), SWT.WRAP, 10, 0);
+ endPoint = (Text) endPointDecoField.getControl();
+ endPoint.addModifyListener(fModifyListener);
+ decorationEndPoint =
+ FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);
+ decorationEndPoint.setDescription("The name of the queue cannot be empty");
+ endPointDecoField.addFieldDecoration(decorationEndPoint, SWT.LEFT | SWT.TOP, false);
+
+ // Create pop-up context menu
+// createContextMenu(brokerUrl);
+// createContextMenu(endPoint);
+
+ remoteQueueLocation = FormSection.createLabelAndCCombo(toolkit, compositeRemoteSetting,
+ "Service client is inside firewall:", SWT.BORDER | SWT.FLAT | SWT.READ_ONLY);
+ remoteQueueLocation.add("no"); // local
+ remoteQueueLocation.add("yes"); // remote
+ remoteQueueLocation.select(0);
+ remoteQueueLocation.addSelectionListener(asynAggregateListener);
+
+ // <casMultiplier poolSize="5"/> <!-- optional -->
+ casMultiplierLabelRemote = toolkit.createLabel(compositeRemoteSetting,
+ "Pool size of CasMultiplier:");
+ casMultiplierRemote = FormSection2.createLabelAndSpinner(toolkit, compositeRemoteSetting,
+ casMultiplierLabelRemote, SWT.BORDER, 0, Integer.MAX_VALUE, false);
+ casMultiplierRemote.setSelection(0);
+ casMultiplierRemote.addSelectionListener(asynAggregateListener);
+
+ stackLayout.topControl = compositeCoLocatedSetting;
+
+ return sectionAEMetaDataDetails;
+ }
+
+ protected void displayDetails(AEDeploymentMetaData obj) {
+ sectionAEMetaDataDetails.setRedraw(false);
+ sectionAEMetaDataDetails.setText(Messages.DDE_AEConfigPage_AEConfig_Section_Title
+ + " - " + obj.getKey());
+ sectionAEMetaDataDetails.setExpanded(false);
+ sectionAEMetaDataDetails.setExpanded(true);
+ sectionAEMetaDataDetails.setRedraw(true);
+
+ if (obj.isTopAnalysisEngine()) {
+ deploymentRemote.setEnabled(false);
+ deploymentCoLocated.setEnabled(false);
+ } else {
+ deploymentRemote.setEnabled(true);
+ deploymentCoLocated.setEnabled(true);
+ if (!deploymentCoLocated.getSelection()) {
+ deploymentRemote.setSelection(false);
+ deploymentCoLocated.setSelection(true);
+ }
+ }
+
+ if (stackLayout.topControl != compositeCoLocatedSetting) {
+ stackLayout.topControl = compositeCoLocatedSetting;
+ stackLayoutComposite.layout();
+ }
+ if (obj.isAsync()) {
+ scaleout.setSelection(1);
+ scaleout.setEnabled(false);
+ } else {
+ scaleout.setEnabled(true);
+ scaleout.setSelection(obj.getNumberOfInstances());
+ }
+
+ ResourceSpecifier rs = obj.getResourceSpecifier();
+ showStatus(null, IMessageProvider.ERROR);
+ if (rs != null) {
+ // Is AnalysisEngineDescription ?
+ if (rs instanceof AnalysisEngineDescription) {
+ AnalysisEngineDescription aed = (AnalysisEngineDescription) rs;
+
+ // Is CAs Multiplier ?
+ if (AETreeBuilder.isCASMultiplier(aed)) {
+ // Trace.err("CASMultiplier pool size: " + obj.getCasMultiplierPoolSize());
+ casMultiplierLabel.setVisible(true);
+ casMultiplier.setVisible(true);
+ casMultiplier.setSelection(obj.getCasMultiplierPoolSize());
+ } else {
+ casMultiplierLabel.setVisible(false);
+ casMultiplier.setVisible(false);
+ }
+ // Is Primitive ?
+ if (aed.isPrimitive()) {
+ asMode.setEnabled(false);
+ asMode.setSelection(false);
+ } else {
+ asMode.setEnabled(true);
+ asMode.setSelection(obj.isAsync());
+ }
+ } else {
+ // CAS Consumer, ...
+ casMultiplierLabel.setVisible(false);
+ casMultiplier.setVisible(false);
+ asMode.setEnabled(false);
+ asMode.setSelection(false);
+ }
+ } else {
+ String parentKey = null;
+ if (obj.getParent() != null) {
+ parentKey = obj.getParent().getKey();
+ } else {
+ if (obj.isTopAnalysisEngine()) {
+ showStatus("The top descriptor is not specified.", IMessageProvider.ERROR);
+ return;
+ }
+ }
+ if (parentKey == null) {
+ parentKey = "Top Analysis Engine";
+ }
+ Trace.err("The analysis engine's key=\"" + obj.getKey()
+ + "\" is not valid for the aggregate \"" + parentKey + "\"");
+ showStatus("The analysis engine's key=\"" + obj.getKey()
+ + "\" is not valid for the aggregate \"" + parentKey + "\"", IMessageProvider.ERROR);
+ }
+ // casMultiplier.setVisible(show);
+
+ // Error Config
+ AsyncAEErrorConfiguration errorConfig = obj.getAsyncAEErrorConfiguration();
+ if (errorConfig != null) {
+ errorConfigDetails.displayDetails((DeploymentMetaData_Impl)obj, errorConfig);
+ } else {
+ Trace.bug("errorConfig == null");
+ }
+
+ }
+
+ protected void displayDetails(RemoteAEDeploymentMetaData obj) {
+ ignoreUpdate = true;
+ sectionAEMetaDataDetails.setRedraw(false);
+ sectionAEMetaDataDetails.setText(Messages.DDE_AEConfigPage_AEConfig_Section_Title
+ + " - " + obj.getKey());
+ sectionAEMetaDataDetails.setExpanded(false);
+ sectionAEMetaDataDetails.setExpanded(true);
+ sectionAEMetaDataDetails.setRedraw(true);
+
+ deploymentRemote.setEnabled(true);
+ deploymentCoLocated.setEnabled(true);
+ if (!deploymentRemote.getSelection()) {
+ deploymentCoLocated.setSelection(false);
+ deploymentRemote.setSelection(true);
+ }
+
+ if (stackLayout.topControl != compositeRemoteSetting) {
+ stackLayout.topControl = compositeRemoteSetting;
+ stackLayoutComposite.layout();
+ }
+ if (obj.getInputQueue() != null) {
+ brokerUrl.setText(obj.getInputQueue().getBrokerURL());
+ endPoint.setText(obj.getInputQueue().getEndPoint());
+ }
+
+ if (obj.getReplyQueueLocation() != null) {
+ String yesOrno;
+ if (obj.getReplyQueueLocation().equals("local")) {
+ yesOrno = "no";
+ } else {
+ yesOrno = "yes";
+ }
+
+ int i = remoteQueueLocation.indexOf(yesOrno);
+ if (i >= 0) {
+ remoteQueueLocation.select(i);
+ }
+ }
+
+ if (obj.getResourceSpecifier() != null) {
+ // Is AnalysisEngineDescription ?
+ if (obj.getResourceSpecifier() instanceof AnalysisEngineDescription) {
+ showStatus(null, IMessageProvider.ERROR); // clear error msg
+ AnalysisEngineDescription aed = (AnalysisEngineDescription) obj.getResourceSpecifier();
+ // Is CAs Multiplier ?
+ if (AETreeBuilder.isCASMultiplier(aed)) {
+ // Trace.err("CASMultiplier");
+ casMultiplierLabelRemote.setVisible(true);
+ casMultiplierRemote.setVisible(true);
+ casMultiplierRemote.setSelection(obj.getCasMultiplierPoolSize());
+ } else {
+ casMultiplierLabelRemote.setVisible(false);
+ casMultiplierRemote.setVisible(false);
+ }
+ }
+ }
+
+ // Error Config
+ AsyncAEErrorConfiguration errorConfig = obj.getAsyncAEErrorConfiguration();
+ if (errorConfig != null) {
+ errorConfigDetails.displayDetails((DeploymentMetaData_Impl) obj, errorConfig);
+ }
+ ignoreUpdate = false;
+ }
+
+ protected void isValid() {
+ if (brokerUrl.getText().trim().length() == 0) {
+ brokerUrlDecoField.showDecoration(decorationBrokerUrl);
+ // return;
+ } else {
+ brokerUrlDecoField.hideDecoration(decorationBrokerUrl);
+ }
+
+ if (endPoint.getText().trim().length() == 0) {
+ endPointDecoField.showDecoration(decorationEndPoint);
+ // return;
+ } else {
+ endPointDecoField.hideDecoration(decorationEndPoint);
+ }
+ }
+
+ protected void showStatus(String msg, int msgType) {
+ Trace.err(msg==null? "Clear msg": msg);
+ FormMessage.setMessage(mform.getForm().getForm(), msg, msgType);
+ }
+
+ /** ********************************************************************** */
+
+ public void commit(boolean onSave) {
+
+ super.commit(onSave);
+ }
+
+ public void dispose() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void initialize(IManagedForm form) {
+ this.mform = form;
+ }
+
+ public boolean isDirty() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean isStale() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.forms.IDetailsPage#refresh()
+ */
+ public void refresh() {
+ update();
+ super.refresh();
+ }
+
+ public void setFocus() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public boolean setFormInput(Object input) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public void selectionChanged(IFormPart part, ISelection selection) {
+ Trace.err();
+ if (selection == null || !(selection instanceof IStructuredSelection)) {
+ return;
+ }
+ IStructuredSelection ssel = (IStructuredSelection) selection;
+ if (ssel.size() != 1) {
+ return;
+ }
+
+ selectedObject = ssel.getFirstElement();
+ if (selectedObject instanceof AEDeploymentMetaData) {
+ currentMetaDataObject = (MetaDataObject) selectedObject;
+ displayDetails((AEDeploymentMetaData) selectedObject);
+ } else if (selectedObject instanceof RemoteAEDeploymentMetaData) {
+ currentMetaDataObject = (MetaDataObject) selectedObject;
+ displayDetails((RemoteAEDeploymentMetaData) selectedObject);
+ } else {
+ selectedObject = null;
+ }
+ }
+
+ private void updateScaleOut(int value) {
+ if (currentMetaDataObject instanceof AEDeploymentMetaData) {
+ ((AEDeploymentMetaData) currentMetaDataObject).setNumberOfInstances(value);
+
+ } else if (currentMetaDataObject instanceof RemoteAEDeploymentMetaData) {
+ // ((RemoteAEDeploymentMetaData) currentMetaDataObject).setNumberOfInstances(value);
+
+ }
+ masterPart.refresh();
+ multiPageEditor.setFileDirty();
+ }
+
+ private void updateCasMultiplierPoolSize(int value) {
+ if (currentMetaDataObject instanceof AEDeploymentMetaData) {
+ ((AEDeploymentMetaData) currentMetaDataObject).setCasMultiplierPoolSize(value);
+
+ } else if (currentMetaDataObject instanceof RemoteAEDeploymentMetaData) {
+ ((RemoteAEDeploymentMetaData) currentMetaDataObject).setCasMultiplierPoolSize(value);
+
+ }
+ multiPageEditor.setFileDirty();
+ }
+
+ private void update() {
+ // id.setValue(input!=null?input.getId():null, true);
+ // name.setValue(input!=null?input.getName():null, true);
+ // point.setValue(input!=null?input.getPoint():null, true);
+ }
+
+ protected void changeToAsyncAggregate(boolean toAsyncAggreagte) {
+ AEDeploymentMetaData metaData = (AEDeploymentMetaData) currentMetaDataObject;
+ if (toAsyncAggreagte) {
+ // Resolve delegates
+ try {
+ metaData.resolveDelegates(multiPageEditor.cde.createResourceManager(), false);
+ } catch (InvalidXMLException e) {
+ e.printStackTrace();
+ Utility.popMessage(Messages.getString("InvalidXMLException"), //$NON-NLS-1$
+ multiPageEditor.cde.getMessagesToRootCause(e), MessageDialog.ERROR);
+ multiPageEditor.switchToBadSource(false);
+ return;
+ }
+ if (metaData.getNumberOfInstances() != 1) {
+ metaData.setNumberOfInstances(1);
+ }
+ }
+ metaData.setAsync(toAsyncAggreagte);
+
+ masterPart.refresh();
+ multiPageEditor.setFileDirty();
+ }
+
+ /** ********************************************************************** */
+ /* Context Sensitive Pop-up Menu */
+ /** ********************************************************************** */
+
+ /**
+ * Creates a pop-up menu on the given control
+ *
+ * @param menuControl
+ * the control with which the pop-up menu will be associated
+ */
+ private void createContextMenu(Control menuControl) {
+ MenuManager menuMgr = new MenuManager("#PopUp"); //$NON-NLS-1$
+ menuMgr.setRemoveAllWhenShown(true);
+ menuMgr.addMenuListener(new IMenuListener() {
+ public void menuAboutToShow(IMenuManager mgr) {
+ fillContextMenu(mgr);
+ }
+ });
+ Menu menu = menuMgr.createContextMenu(menuControl);
+ menuControl.setMenu(menu);
+
+ // register the context menu such that other plugins may contribute to it
+ //
+ // __workbenchPartSite.registerContextMenu(menuMgr, _catTreeViewer);
+ }
+
+ /**
+ * Adds items to the context menu
+ *
+ * @param menu
+ * The menu to contribute to
+ */
+ protected void fillContextMenu(IMenuManager menu) {
+ Action action = new Action() {
+ public void run() {
+ handleBrowseDD();
+ }
+ };
+ action.setText("Browse DD ...");
+ action.setEnabled(true);
+ menu.add(action);
+
+ } // fillContextMenu
+
+ protected void handleBrowseDD() {
+ IResource resource = WorkspaceResourceDialog.getWorkspaceResourceElement(multiPageEditor.cde.getEditorSite().getShell(),
+ getWorkspaceRoot(), "Select UIMA deployment descriptor",
+ "Select Analysis Engine's deployment descriptor file");
+ if (resource != null) {
+ XMLizable xmlizable = UimaApplication_Impl.parseUimaXmlDescriptor(resource.getLocation().toOSString());
+ if (xmlizable == null || !(xmlizable instanceof AEDeploymentDescription_Impl)) {
+ // Trace.err("xmlizable: " + xmlizable.getClass().getName());
+ return;
+ }
+ AEService aeService = ((AEDeploymentDescription_Impl) xmlizable).getAeService();
+ brokerUrl.setText(aeService.getBrokerURL());
+ endPoint.setText(aeService.getEndPoint());
+ }
+ }
+ /**
+ * Convenience method to get the workspace root.
+ */
+ private IWorkspaceRoot getWorkspaceRoot() {
+ return ResourcesPlugin.getWorkspace().getRoot();
+ }
+
+ /** ********************************************************************** */
+
+// public void modelChanged(IModelChangedEvent event) {
+// if (event.getChangeType() == IModelChangedEvent.CHANGE) {
+// Object obj = event.getChangedObjects()[0];
+// if (obj.equals(selectedObject))
+// refresh();
+// }
+// }
+
+}
Added: incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/details/DetailsPageProvider.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/details/DetailsPageProvider.java?rev=609842&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/details/DetailsPageProvider.java (added)
+++ incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/details/DetailsPageProvider.java Mon Jan 7 18:35:02 2008
@@ -0,0 +1,173 @@
+/**
+ *
+ * Project UIMA Tooling
+ *
+ *
+ * creation date: Aug 15, 2007, 10:44:17 PM
+ * source: DetailsPageProvider.java
+ */
+package org.apache.uima.dde.internal.details;
+
+import org.apache.uima.aae.deployment.AEDeploymentMetaData;
+import org.apache.uima.aae.deployment.AsyncAggregateErrorConfiguration;
+import org.apache.uima.aae.deployment.AsyncPrimitiveErrorConfiguration;
+import org.apache.uima.aae.deployment.RemoteAEDeploymentMetaData;
+import org.apache.uima.aae.deployment.impl.RemoteAEDeploymentMetaData_Impl;
+import org.apache.uima.analysis_engine.AnalysisEngineDescription;
+import org.apache.uima.dde.internal.DeploymentDescriptorEditor;
+import org.apache.uima.dde.internal.page.MasterDetails;
+import org.apache.uima.resource.ResourceSpecifier;
+import org.apache.uima.tools.debug.util.Trace;
+import org.apache.uima.tools.internal.uima.util.FormMessage;
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.ui.forms.DetailsPart;
+import org.eclipse.ui.forms.IDetailsPage;
+import org.eclipse.ui.forms.IDetailsPageProvider;
+import org.eclipse.ui.forms.IManagedForm;
+
+
+/**
+ *
+ *
+ */
+public class DetailsPageProvider implements IDetailsPageProvider {
+ private DeploymentDescriptorEditor multiPageEditor;
+
+ private IManagedForm managedForm = null;
+
+ private MasterDetails masterPart;
+
+// private DetailsPart detailsPart;
+
+ public DetailsPageProvider(DeploymentDescriptorEditor editor, IManagedForm managedForm,
+ MasterDetails master, DetailsPart detailsPart) {
+ this.multiPageEditor = editor;
+ this.managedForm = managedForm;
+ this.masterPart = master;
+// this.detailsPart = detailsPart;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.forms.IDetailsPageProvider#getPage(java.lang.Object)
+ */
+ public IDetailsPage getPage(Object key) {
+ if (key.equals(AsyncPrimitiveErrorConfiguration.class)) {
+ return new AEMetaDataDetailsPage(multiPageEditor, managedForm, masterPart, false);
+
+ } else if (key.equals(AsyncAggregateErrorConfiguration.class)) {
+ return new AEMetaDataDetailsPage(multiPageEditor, managedForm, masterPart, true);
+
+ // } else if ( key.equals(RemoteAEDeploymentMetaData.class) ) {
+ // return new RemoteAEMetaDataDetails_V1(managedForm);
+ }
+
+ // Note: Cannot overcome blank page issue for unknown selection
+ // if (detailsPart != null) {
+ // return detailsPart.getCurrentPage();
+ // }
+ return new EmptyDetailsPage(managedForm);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.forms.IDetailsPageProvider#getPageKey(java.lang.Object)
+ */
+ public Object getPageKey(Object object) {
+ updateStatus(null, IMessageProvider.ERROR);
+ if (object instanceof AEDeploymentMetaData) {
+ AEDeploymentMetaData metaData = (AEDeploymentMetaData) object;
+
+ Class cls = null;
+ if ( metaData.isTopAnalysisEngine() ) {
+ // Top AE
+ // Trace.err("Top AE: " + metaData.getKey());
+ cls = AsyncPrimitiveErrorConfiguration.class;
+ } else {
+ // Delegate
+ // Trace.err("NOT Top AE: " + metaData.getKey());
+ cls = AsyncAggregateErrorConfiguration.class;
+ }
+
+ return cls;
+
+ } else if (object instanceof RemoteAEDeploymentMetaData) {
+ return AsyncAggregateErrorConfiguration.class;
+ } else {
+
+ }
+
+ Trace.trace("Unkown class: " + object.getClass().getName());
+ return EmptyDetailsPage.class;
+ }
+ public Object getPageKey_OLD(Object object) {
+ updateStatus(null, IMessageProvider.ERROR);
+ if (object instanceof AEDeploymentMetaData) {
+ AEDeploymentMetaData metaData = (AEDeploymentMetaData) object;
+
+ Class cls = null;
+ ResourceSpecifier rs = metaData.getResourceSpecifier();
+ if (rs != null) {
+ if (rs instanceof AnalysisEngineDescription) {
+ if ( metaData.isTopAnalysisEngine() ) {
+ // Prmitive
+ cls = AsyncPrimitiveErrorConfiguration.class;
+ } else {
+ // Aggregate
+ cls = AsyncAggregateErrorConfiguration.class;
+ }
+ }
+ } else {
+ String parentKey = null;
+ if (metaData.getParent() != null) {
+ parentKey = metaData.getParent().getKey();
+ } else {
+ if (metaData.isTopAnalysisEngine()) {
+ updateStatus("The top descriptor is not specified.", IMessageProvider.ERROR);
+ return null;
+ }
+ }
+ if (parentKey == null) {
+ parentKey = "Top Analysis Engine";
+ }
+ updateStatus("The analysis engine's key=\"" + metaData.getKey()
+ + "\" is not valid for the aggregate \"" + parentKey + "\"", IMessageProvider.ERROR);
+ }
+ return cls;
+
+ } else if (object instanceof RemoteAEDeploymentMetaData) {
+ RemoteAEDeploymentMetaData metaData = (RemoteAEDeploymentMetaData) object;
+
+ Class cls = null;
+ ResourceSpecifier rs = metaData.getResourceSpecifier();
+ if (rs != null) {
+ if (rs instanceof AnalysisEngineDescription) {
+ cls = AsyncAggregateErrorConfiguration.class;
+ }
+ } else {
+ String parentKey = metaData.getParent().getKey();
+ if (parentKey == null) {
+ parentKey = "Top Analysis Engine";
+ }
+ updateStatus("The analysis engine's key=\"" + metaData.getKey()
+ + "\" is not valid for the aggregate \"" + parentKey + "\"", IMessageProvider.ERROR);
+ }
+ return cls;
+ // return AsyncPrimitiveErrorConfiguration.class;
+ } else {
+
+ }
+
+ Trace.trace("Unkown class: " + object.getClass().getName());
+ return EmptyDetailsPage.class;
+ }
+
+ /** ********************************************************************** */
+
+ protected void updateStatus(String msg, int msgType) {
+ FormMessage.setMessage(managedForm.getForm().getForm(), msg, msgType);
+ }
+
+}
Added: incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/details/EmptyDetailsPage.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/details/EmptyDetailsPage.java?rev=609842&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/details/EmptyDetailsPage.java (added)
+++ incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/details/EmptyDetailsPage.java Mon Jan 7 18:35:02 2008
@@ -0,0 +1,153 @@
+package org.apache.uima.dde.internal.details;
+
+import org.apache.uima.aae.deployment.RemoteAEDeploymentMetaData;
+import org.apache.uima.tools.debug.util.Trace;
+import org.apache.uima.tools.internal.ui.forms.FormSection;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.forms.IDetailsPage;
+import org.eclipse.ui.forms.IFormPart;
+import org.eclipse.ui.forms.IManagedForm;
+import org.eclipse.ui.forms.SectionPart;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.ScrolledPageBook;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.forms.widgets.TableWrapData;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
+
+
+public class EmptyDetailsPage implements IDetailsPage {
+ private Object selectedObject = null;
+
+ private IManagedForm mform;
+
+ private ScrolledPageBook myScrolledPageBook = null; // used to support Section
+
+ /** ********************************************************************** */
+
+ public EmptyDetailsPage(IManagedForm mform) {
+ this.mform = mform;
+ }
+
+ /** ********************************************************************** */
+
+ //
+ // Note: "parent" is a "LayoutComposite" created by "ScrolledPageBook pageBook"
+ // in "DetailsPart".
+ // The parent of "parent" is "WrappedPageBook pageBook".
+ // The grand-parent of "parent" is ScrolledPageBook which needs to be
+ // "reflowed" when Section is expanded/collapsed.
+ public void createContents(Composite parent) {
+ Trace.err();
+ // Get ScrolledPageBook
+ myScrolledPageBook = (ScrolledPageBook) parent.getParent().getParent();
+
+ // Set Layout for "parent"
+ TableWrapLayout layout = new TableWrapLayout();
+ layout.topMargin = 0;
+ layout.leftMargin = 5;
+ layout.rightMargin = 2;
+ layout.bottomMargin = 2;
+ parent.setLayout(layout);
+
+ FormToolkit toolkit = mform.getToolkit();
+
+ createIdentitySection(parent, toolkit);
+ }
+
+ private Section createIdentitySection(Composite parent, FormToolkit toolkit) {
+ Section section = FormSection.createTableWrapDataSection(toolkit, parent, Section.DESCRIPTION
+ | Section.TWISTIE | Section.EXPANDED, "No Details are available", "No information is available.",
+ 10, 5, TableWrapData.FILL_GRAB, TableWrapData.FILL_GRAB, 1, 1);
+ final SectionPart spart = new SectionPart(section);
+ mform.addPart(spart);
+ spart.initialize(mform); // Need this code. Otherwise, exception in SectionPart !!!
+ section.setExpanded(true);
+
+ // /////////////////////////////////////////////////////////////////////
+
+ Composite sectionClient = toolkit.createComposite(section);
+ section.setClient(sectionClient);
+ TableWrapLayout tl = new TableWrapLayout();
+ tl.numColumns = 2;
+ tl.leftMargin = 10;
+ tl.rightMargin = 10;
+ tl.topMargin = 10;
+ tl.bottomMargin = 10;
+ sectionClient.setLayout(tl);
+
+ // /////////////////////////////////////////////////////////////////////
+
+ return section;
+ }
+
+ protected void displayDetails(RemoteAEDeploymentMetaData obj) {
+ // textBrokerURL.setText(obj.getInputQueue().getBrokerURL());
+ // textEndPoint.setText(obj.getInputQueue().getEndPoint());
+ //
+ // if (obj.getReplyQueueLocation() != null) {
+ // int i = remoteQueueLocation.indexOf(obj.getReplyQueueLocation());
+ // if (i >= 0) {
+ // remoteQueueLocation.select(i);
+ // }
+ // }
+ }
+
+ /** ********************************************************************** */
+
+ public void commit(boolean onSave) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void dispose() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void initialize(IManagedForm form) {
+ this.mform = form;
+ }
+
+ public boolean isDirty() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean isStale() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public void refresh() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setFocus() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public boolean setFormInput(Object input) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public void selectionChanged(IFormPart part, ISelection selection) {
+ if (selection == null || !(selection instanceof IStructuredSelection)) {
+ return;
+ }
+ IStructuredSelection ssel = (IStructuredSelection) selection;
+ if (ssel.size() != 1) {
+ return;
+ }
+
+ selectedObject = ssel.getFirstElement();
+ if (selectedObject instanceof RemoteAEDeploymentMetaData) {
+ displayDetails((RemoteAEDeploymentMetaData) selectedObject);
+ }
+ }
+
+}