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 2006/12/15 04:36:07 UTC

svn commit: r487439 - in /incubator/uima/uimaj/trunk/uimaj-ep-configurator: ./ src/main/java/org/apache/uima/taeconfigurator/editors/ui/ src/main/java/org/apache/uima/taeconfigurator/editors/ui/dialogs/ src/main/java/org/apache/uima/taeconfigurator/files/

Author: schor
Date: Thu Dec 14 19:36:06 2006
New Revision: 487439

URL: http://svn.apache.org/viewvc?view=rev&rev=487439
Log:
UIMA-2 Remove EPL code. Remove use of tree hierarchy with
checkbox widgets.  Replace with simpler design.  Remove the
About.html file also

Added:
    incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui/dialogs/ResourcePickerDialog.java
Removed:
    incubator/uima/uimaj/trunk/uimaj-ep-configurator/about.html
    incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/files/LimitedResourceSelectionDialog.java
    incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/files/TreeGroup.java
    incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/files/WbContentProvider.java
Modified:
    incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui/OverviewPage.java
    incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui/ParameterSection.java
    incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui/dialogs/AbstractDialog.java
    incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/files/ContextForPartDialog.java
    incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/files/MultiResourceSelectionDialog.java
    incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/files/PickOverrideKeysAndParmName.java

Modified: incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui/OverviewPage.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui/OverviewPage.java?view=diff&rev=487439&r1=487438&r2=487439
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui/OverviewPage.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui/OverviewPage.java Thu Dec 14 19:36:06 2006
@@ -30,6 +30,9 @@
 public class OverviewPage extends HeaderPageWithSash {
 
   private PrimitiveSection primitiveSection;
+  
+  // should always exist
+  private MetaDataSection metadataSection;  
 
   /**
    */
@@ -47,9 +50,9 @@
     if (isLocalProcessingDescriptor()) {
       managedForm.addPart(new GeneralSection(editor, form.left));
       managedForm.addPart(primitiveSection = new PrimitiveSection(editor, form.left));
-      managedForm.addPart(new MetaDataSection(editor, form.right));
+      managedForm.addPart(metadataSection= new MetaDataSection(editor, form.right));
     } else {
-      managedForm.addPart(new MetaDataSection(editor, form.left));
+      managedForm.addPart(metadataSection = new MetaDataSection(editor, form.left));
     }
     createToolBarActions(managedForm);
     sashForm.setOrientation(SWT.HORIZONTAL);
@@ -64,4 +67,7 @@
     return primitiveSection;
   }
 
+  public MetaDataSection getMetaDataSection() {
+    return metadataSection;
+  }
 }

Modified: incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui/ParameterSection.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui/ParameterSection.java?view=diff&rev=487439&r1=487438&r2=487439
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui/ParameterSection.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui/ParameterSection.java Thu Dec 14 19:36:06 2006
@@ -474,47 +474,36 @@
     }
     // only picks one override key - but code is from earlier design where multiple keys were
     // possible
-    PickOverrideKeysAndParmName dialog = new PickOverrideKeysAndParmName(getSection().getShell(),
-            delegateMap, "Override Keys and Parameter Name Selection", cp, cpd, overrideIndex == -1);
+    PickOverrideKeysAndParmName dialog = new PickOverrideKeysAndParmName(this, delegateMap,
+            "Override Keys and Parameter Name Selection", cp, cpd, overrideIndex == -1);
 
     dialog.setTitle("Delegate Keys and Parameter Name Selection");
     dialog
             .setMessage("Select the override key path from the left panel, and the overridden parameter from the right panel.\nOnly valid parameters will be shown.");
     if (dialog.open() == Window.CANCEL)
       return;
-    Object[] keysAndParms = dialog.getResult();
-    // NOTE: this code is written presuming you could have multiple keys:
-    // key1/key2/parm
-    // but this is not the case. There is always one and only one key
-    if (null != keysAndParms && keysAndParms.length > 0) {
-      Map.Entry[] keys = (Map.Entry[]) keysAndParms[0];
-      StringBuffer keyNames = new StringBuffer();
-      for (int i = keys.length - 1; i >= 0; i--) {
-        if (i < (keys.length - 1))
-          keyNames.append('/');
-        keyNames.append(keys[i].getKey());
-      }
 
-      // update the existing item
-      // have to do a 3 step update because the getOverrides returns a
-      // cloned array
-      valueChanged = false;
-      String overrideSpec = keyNames.append('/').append((String) ((Object[]) keysAndParms[1])[0])
-              .toString();
-      // updateOneOverride(cp, overrideIndex, dialog.overrideSpec);
-      if (overrideIndex < 0) {
-        addOverride(cp, overrideSpec);
-        valueChanged = true;
-      } else {
-        String[] overrides = cp.getOverrides();
-        overrides[overrideIndex] = setValueChanged(overrideSpec, overrides[overrideIndex]);
-        cp.setOverrides(overrides);
-        parent.getItems()[overrideIndex].setText(OVERRIDE_HEADER + overrideSpec);
-      }
-      // TODO consequences of changes in rest of model?
-      commonActionFinishDirtyIfChange();
+    String delegateKeyName = dialog.delegateKeyName;
+    String delegateParameterName = dialog.delegateParameterName;
+    // update the existing item
+    // have to do a 3 step update because the getOverrides returns a
+    // cloned array
+    valueChanged = false;
+    String overrideSpec = delegateKeyName + '/' + delegateParameterName;
+    // updateOneOverride(cp, overrideIndex, dialog.overrideSpec);
+    if (overrideIndex < 0) {
+      addOverride(cp, overrideSpec);
+      valueChanged = true;
+    } else {
+      String[] overrides = cp.getOverrides();
+      overrides[overrideIndex] = setValueChanged(overrideSpec, overrides[overrideIndex]);
+      cp.setOverrides(overrides);
+      parent.getItems()[overrideIndex].setText(OVERRIDE_HEADER + overrideSpec);
     }
+    // TODO consequences of changes in rest of model?
+    commonActionFinishDirtyIfChange();
   }
+  
 
   private boolean removeItems(TreeItem[] itemsToRemove, boolean giveWarningMsg) {
     String[] namesToRemove = new String[itemsToRemove.length];

Modified: incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui/dialogs/AbstractDialog.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui/dialogs/AbstractDialog.java?view=diff&rev=487439&r1=487438&r2=487439
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui/dialogs/AbstractDialog.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui/dialogs/AbstractDialog.java Thu Dec 14 19:36:06 2006
@@ -52,6 +52,7 @@
 import org.eclipse.swt.widgets.Table;
 import org.eclipse.swt.widgets.TableItem;
 import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.Tree;
 import org.eclipse.ui.fieldassist.ContentAssistField;
 
 public abstract class AbstractDialog extends Dialog implements Listener, StandardStrings {
@@ -81,16 +82,32 @@
   /**
    * @param parentShell
    */
-  protected AbstractDialog(AbstractSection aSection, String title, String description) {
+  protected AbstractDialog(AbstractSection section, String title, String description) {
     // maintainers: don't use new shell; see comment in Dialog class
-    super(aSection.getSection().getShell());
+    super(section.getSection().getShell());
+    commonInit(section, title, description);
+  }
+  
+  protected AbstractDialog(Shell shell, String title, String description) {
+    super(shell);
+    commonInit(null, title, description);
+  }
+  
+  private void commonInit(AbstractSection aSection, String aTitle, String aDescription) {
     section = aSection;
-    editor = section.editor;
+    editor = (null == section)? null : section.editor;
     setShellStyle(getShellStyle() | SWT.RESIZE);
+    title = aTitle;
+    dialogDescription = aDescription;
+  }
+  
+  public void setTitle(String title) {
     this.title = title;
-    this.dialogDescription = description;
   }
 
+  public void setMessage(String msg) {
+    this.dialogDescription = msg;
+  }
   protected Control createDialogArea(Composite parent) {
     // create composite
     Composite composite = (Composite) super.createDialogArea(parent);
@@ -223,6 +240,13 @@
   protected Text newLabeledText(Composite parent, int style, String label, String tip) {
     setTextAndTip(new Label(parent, SWT.NONE), label, tip);
     return newText(parent, style, tip);
+  }
+
+  protected Tree newTree(Composite parent, int style) {
+    Tree tree = new Tree(parent, style | SWT.BORDER);
+    GridData gd = new GridData(GridData.FILL_BOTH);
+    tree.setLayoutData(gd);
+    return tree;
   }
 
   /**

Added: incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui/dialogs/ResourcePickerDialog.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui/dialogs/ResourcePickerDialog.java?view=auto&rev=487439
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui/dialogs/ResourcePickerDialog.java (added)
+++ incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui/dialogs/ResourcePickerDialog.java Thu Dec 14 19:36:06 2006
@@ -0,0 +1,159 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.taeconfigurator.editors.ui.dialogs;
+
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.List;
+
+import org.apache.uima.taeconfigurator.InternalErrorCDE;
+import org.apache.uima.taeconfigurator.TAEConfiguratorPlugin;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+
+public class ResourcePickerDialog extends AbstractDialog {
+
+  protected Tree resourcesUI;
+  public IResource pickedResource;
+  private Object [] result;
+    
+  public ResourcePickerDialog(Shell shell) {
+    super(shell, "Select a File", "Use this panel to select a file in the Workspace");
+  }
+  
+  private static final Comparator resourceComparator = new Comparator () {
+    public int compare(Object arg0, Object arg1) {
+       IResource r0 = (IResource) arg0;   
+       IResource r1 = (IResource) arg1;   
+        return r0.getName().compareTo(r1.getName());
+    }
+  };
+  
+  private void populate(TreeItem parent, IResource[] resources) {
+    Arrays.sort(resources, resourceComparator);
+    for (int i = 0; i < resources.length; i++) {
+      TreeItem item = new TreeItem(parent, SWT.NULL);
+      IResource r = resources[i];
+      item.setText(r.getName());
+      item.setData(r);
+      if (r instanceof IContainer) {
+        new TreeItem(item, SWT.NULL);
+      }
+    }
+  }
+ 
+  protected Control createDialogArea(Composite parent) {
+    Composite mainArea = (Composite) super.createDialogArea(parent);
+    
+    resourcesUI = newTree(mainArea, SWT.SINGLE);
+    ((GridData)resourcesUI.getLayoutData()).heightHint = 400;
+    TreeItem topItem = new TreeItem(resourcesUI, SWT.NONE);
+    topItem.setText("Workspace");
+    IWorkspaceRoot root = TAEConfiguratorPlugin.getWorkspace().getRoot().getWorkspace().getRoot();
+    try {
+    IResource[] projects = root.members();
+    populate(topItem, projects);
+    } catch (CoreException e) {
+      throw new InternalErrorCDE("unhandled exception", e);
+    }
+    topItem.setExpanded(true);
+    resourcesUI.addListener(SWT.Expand, this);
+    resourcesUI.addListener(SWT.Selection, this);
+    return mainArea;
+  }
+  
+  /* (non-Javadoc)
+   * @see org.apache.uima.taeconfigurator.editors.ui.dialogs.AbstractDialog#handleEvent(org.eclipse.swt.widgets.Event)
+   */
+  public void handleEvent(Event event) {
+    if (event.widget == resourcesUI &&
+        event.type == SWT.Expand) {
+      TreeItem expandedNode = (TreeItem) event.item;
+      TreeItem maybeDummy = expandedNode.getItem(0);
+      if (null == maybeDummy.getData()) {
+        maybeDummy.dispose();
+        IResource parentResource = (IResource)expandedNode.getData();
+        try {
+          populate(expandedNode, ((IContainer)parentResource).members());
+        } catch (CoreException e) {
+          throw new InternalErrorCDE("unhandled exception", e);
+        }
+      }
+    } else if (event.widget == resourcesUI && event.type == SWT.Selection) {
+      copyValuesFromGUI();
+    }
+    enableOK();
+  }
+  /* (non-Javadoc)
+   * @see org.apache.uima.taeconfigurator.editors.ui.dialogs.AbstractDialog#copyValuesFromGUI()
+   */
+  public void copyValuesFromGUI() {
+    if (resourcesUI.getSelectionCount() > 0) {
+      pickedResource = (IResource)resourcesUI.getSelection()[0].getData();
+      result = (null == pickedResource) ? null 
+                                        : new IFile[] { 
+        TAEConfiguratorPlugin.getWorkspace().getRoot().getFile(
+                pickedResource.getFullPath())};        
+    }
+  }
+
+  /* (non-Javadoc)
+   * @see org.apache.uima.taeconfigurator.editors.ui.dialogs.AbstractDialog#enableOK()
+   */
+  public void enableOK() {
+    if ( (0 < resourcesUI.getSelectionCount()) &&
+            (resourcesUI.getSelection()[0].getData() instanceof IFile)) {
+      okButton.setEnabled(true);
+    } else {
+      okButton.setEnabled(false);
+    }
+  }
+
+  /* (non-Javadoc)
+   * @see org.apache.uima.taeconfigurator.editors.ui.dialogs.AbstractDialog#isValid()
+   */
+  public boolean isValid() {
+    return true;
+  }
+
+  public Object[] getResult() {
+    return result; 
+  }
+  
+  public void setResult(List aResult) {
+    if (null == aResult) {
+      result = null;
+    } else {
+      aResult.toArray(result = new Object[aResult.size()]);
+    }
+  }
+  
+}

Modified: incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/files/ContextForPartDialog.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/files/ContextForPartDialog.java?view=diff&rev=487439&r1=487438&r2=487439
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/files/ContextForPartDialog.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/files/ContextForPartDialog.java Thu Dec 14 19:36:06 2006
@@ -20,31 +20,30 @@
 package org.apache.uima.taeconfigurator.files;
 
 import java.text.MessageFormat;
-import java.util.ArrayList;
 
+import org.apache.uima.resource.metadata.FsIndexCollection;
+import org.apache.uima.resource.metadata.ResourceManagerConfiguration;
+import org.apache.uima.resource.metadata.TypePriorities;
+import org.apache.uima.taeconfigurator.editors.MultiPageEditor;
+import org.apache.uima.taeconfigurator.editors.ui.AbstractSection;
+import org.apache.uima.taeconfigurator.editors.ui.dialogs.ResourcePickerDialog;
+import org.apache.uima.util.XMLizable;
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.core.runtime.IPath;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.ICheckStateListener;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Text;
 
-import org.apache.uima.resource.metadata.FsIndexCollection;
-import org.apache.uima.resource.metadata.ResourceManagerConfiguration;
-import org.apache.uima.resource.metadata.TypePriorities;
-import org.apache.uima.taeconfigurator.editors.MultiPageEditor;
-import org.apache.uima.taeconfigurator.editors.ui.AbstractSection;
-import org.apache.uima.util.XMLizable;
-
-public class ContextForPartDialog extends LimitedResourceSelectionDialog implements
-        ICheckStateListener {
+public class ContextForPartDialog extends /*LimitedResourceSelectionDialog*/ 
+        ResourcePickerDialog /*implements
+        ICheckStateListener*/ {
 
   // private MultiPageEditor editor;
   private Text contextPathGUI;
@@ -59,12 +58,19 @@
           XMLizable thingBeingEdited, IPath aExcludeDescriptor, MultiPageEditor aEditor,
           String aInitialPath) {
 
+    super(parentShell);
+    initialPath = aInitialPath;
+    setTitle("Context for importable part");
+    tbe = thingBeingEdited;
+
+/*
     super(parentShell, rootElement, "Context for importable part");
     // editor = aEditor;
     initialPath = aInitialPath;
     setTitle("Context for importable part");
     tbe = thingBeingEdited;
     setShellStyle(getShellStyle() | SWT.RESIZE);
+    */
   }
 
   protected Control createDialogArea(Composite parent) {
@@ -111,91 +117,49 @@
     // AbstractSection.spacer(parent);
 
     Composite composite = (Composite) super.createDialogArea(parent);
-    // FormToolkit factory = new
-    // FormToolkit(TAEConfiguratorPlugin.getDefault().getFormColors(parent.getDisplay()));
-    // Label label = new Label(composite, SWT.WRAP /*SWT.CENTER*/);
-    // label.setText(Messages.getString("MultiResourceSelectionDialog.Or")); //$NON-NLS-1$
-    // browseButton =
-    // factory.createButton(
-    // composite,
-    // Messages.getString("MultiResourceSelectionDialog.BrowseFileSys"), //$NON-NLS-1$
-    // SWT.PUSH);
-    // browseButton.setLayoutData(
-    // new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
-    // browseButton.pack(false);
-    // browseButton.addListener(SWT.MouseUp, new Listener() {
-    // public void handleEvent(Event event) {
-    // FileDialog dialog = new FileDialog(getShell(), /*SWT.OPEN |*/
-    // SWT.MULTI);
-    // String[] extensions = { Messages.getString("MultiResourceSelectionDialog.starDotXml") };
-    // //$NON-NLS-1$
-    // dialog.setFilterExtensions(extensions);
-    // String sStartDir =
-    // TAEConfiguratorPlugin
-    // .getWorkspace()
-    // .getRoot()
-    // .getLocation()
-    // .toOSString();
-    // dialog.setFilterPath(sStartDir);
-    // String file = dialog.open();
-    //
-    // if (file != null && !file.equals("")) { //$NON-NLS-1$
-    // //close();
-    // okPressed();
-    // ArrayList list = new ArrayList();
-    // IPath iPath = new Path(file);
-    // list.add(iPath);
-    // localSetResult(list);
-    // }
-    // }
-    //
-    // });
-    //
-    // new Label(composite, SWT.NONE).setText("");
-    // importByNameUI = new Button(composite, SWT.RADIO);
-    // importByNameUI.setText("Import by Name");
-    // importByNameUI.setToolTipText(
-    // "Importing by name looks up the name on the datapath, and if not found there, on the
-    // classpath.");
-    //
-    //		
-    // importByLocationUI = new Button(composite, SWT.RADIO);
-    // importByLocationUI.setText("Import By Location");
-    // importByLocationUI.setToolTipText(
-    // "Importing by location requires a relative or absolute URL");
-    //		
-    // String defaultBy = CDEpropertyPage.getImportByDefault(editor.getProject());
-    // if (defaultBy.equals("location")) {
-    // importByNameUI.setSelection(false);
-    // importByLocationUI.setSelection(true);
-    // }
-    // else {
-    // importByNameUI.setSelection(true);
-    // importByLocationUI.setSelection(false);
-    // }
     return composite;
   }
 
+  /* (non-Javadoc)
+   * @see org.apache.uima.taeconfigurator.editors.ui.dialogs.AbstractDialog#handleEvent(org.eclipse.swt.widgets.Event)
+   */
+  public void handleEvent(Event event) {
+    super.handleEvent(event);
+    
+    if (event.widget == resourcesUI && event.type == SWT.Selection) {
+      if (null != pickedResource) { 
+        IFile f = (IFile)getResult()[0];
+        contextPathGUI.setText(f.getLocation().toOSString());
+      }   
+    }
+    enableOK();
+  }
+
   protected void okPressed() {
-    // isImportByName = importByNameUI.getSelection();
-    // CDEpropertyPage.setImportByDefault(editor.getProject(), isImportByName ? "name" :
-    // "location");
     contextPath = contextPathGUI.getText();
     super.okPressed();
   }
-
-  // This is to avoid synthetic access method warning
-  protected void localSetResult(ArrayList list) {
-    setResult(list);
+  
+  /* (non-Javadoc)
+   * @see org.apache.uima.taeconfigurator.editors.ui.dialogs.AbstractDialog#enableOK()
+   */
+  public void enableOK() {
+    super.enableOK();
+    String path = contextPathGUI.getText();
+    if (null != path && 
+        !"".equals(path))
+      okButton.setEnabled(true);
   }
 
+  
+  /*
   public void checkStateChanged(CheckStateChangedEvent event) {
     // event.getChecked(); // true if checked
     // event.getElement(); // File with workspace-relative path
     if (event.getChecked() && event.getElement() instanceof IFile) {
       contextPathGUI.setText(((IFile) event.getElement()).getLocation().toString());
     }
-    getOkButton().setEnabled(
+    okButton.setEnabled(
             selectionGroup.getCheckedElementCount() > 0 || contextPathGUI.getText().length() > 0);
   }
 
@@ -203,5 +167,5 @@
     selectionGroup.addCheckStateListener(this);
     getOkButton().setEnabled(contextPathGUI.getText().length() > 0);
   }
-
+  */
 }

Modified: incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/files/MultiResourceSelectionDialog.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/files/MultiResourceSelectionDialog.java?view=diff&rev=487439&r1=487438&r2=487439
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/files/MultiResourceSelectionDialog.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/files/MultiResourceSelectionDialog.java Thu Dec 14 19:36:06 2006
@@ -21,6 +21,11 @@
 
 import java.util.ArrayList;
 
+import org.apache.uima.taeconfigurator.CDEpropertyPage;
+import org.apache.uima.taeconfigurator.Messages;
+import org.apache.uima.taeconfigurator.TAEConfiguratorPlugin;
+import org.apache.uima.taeconfigurator.editors.MultiPageEditor;
+import org.apache.uima.taeconfigurator.editors.ui.dialogs.ResourcePickerDialog;
 import org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.Path;
@@ -36,12 +41,7 @@
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.forms.widgets.FormToolkit;
 
-import org.apache.uima.taeconfigurator.CDEpropertyPage;
-import org.apache.uima.taeconfigurator.Messages;
-import org.apache.uima.taeconfigurator.TAEConfiguratorPlugin;
-import org.apache.uima.taeconfigurator.editors.MultiPageEditor;
-
-public class MultiResourceSelectionDialog extends LimitedResourceSelectionDialog {
+public class MultiResourceSelectionDialog extends ResourcePickerDialog {
 
   private Button browseButton; // for browsing the file system
 
@@ -55,7 +55,10 @@
 
   public MultiResourceSelectionDialog(Shell parentShell, IAdaptable rootElement, String message,
           IPath aExcludeDescriptor, MultiPageEditor aEditor) {
+    super(parentShell);
+    editor = aEditor;
 
+    /*
     super(parentShell, rootElement, message);
     editor = aEditor;
     setTitle(Messages.getString("ResourceSelectionDialog.title")); //$NON-NLS-1$
@@ -65,6 +68,7 @@
     else
       setMessage(Messages.getString("ResourceSelectionDialog.message")); //$NON-NLS-1$
     setShellStyle(getShellStyle() | SWT.RESIZE);
+ */
   }
 
   protected Control createDialogArea(Composite parent) {

Modified: incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/files/PickOverrideKeysAndParmName.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/files/PickOverrideKeysAndParmName.java?view=diff&rev=487439&r1=487438&r2=487439
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/files/PickOverrideKeysAndParmName.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/files/PickOverrideKeysAndParmName.java Thu Dec 14 19:36:06 2006
@@ -19,22 +19,9 @@
 
 package org.apache.uima.taeconfigurator.files;
 
-import java.util.AbstractList;
-import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.Iterator;
-import java.util.List;
 import java.util.Map;
 
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-
 import org.apache.uima.analysis_engine.AnalysisEngineDescription;
 import org.apache.uima.collection.CasConsumerDescription;
 import org.apache.uima.flow.FlowControllerDescription;
@@ -43,38 +30,186 @@
 import org.apache.uima.resource.metadata.ConfigurationGroup;
 import org.apache.uima.resource.metadata.ConfigurationParameter;
 import org.apache.uima.resource.metadata.ConfigurationParameterDeclarations;
+import org.apache.uima.taeconfigurator.editors.ui.AbstractSection;
 import org.apache.uima.taeconfigurator.editors.ui.ParameterDelegatesSection;
+import org.apache.uima.taeconfigurator.editors.ui.dialogs.AbstractDialog;
 import org.apache.uima.taeconfigurator.editors.ui.dialogs.AddParameterDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableItem;
 
-/**
- */
-public class PickOverrideKeysAndParmName extends LimitedResourceSelectionDialog {
 
-  final static private Object[] objectArray0 = new Object[0];
+public class PickOverrideKeysAndParmName extends AbstractDialog {
 
   private AddParameterDialog parameterDialog = null; // not currently used
 
   private ConfigurationParameter cp;
 
-  private ITreeContentProvider keyTreeProvider;
-
   private ConfigurationParameterDeclarations cpd;
 
   private boolean adding;
 
-  // rootElement is the map returned from getDelegateAnalysisEngineSpecifiers()
+  private Table paramsUI;
 
-  public PickOverrideKeysAndParmName(Shell parentShell,
-          Object rootElement, // is editor.getResolvedDelegates(), a Map, key = keyname,
-          // value = delegate description object
+  private Table keysUI;
+
+  private Map delegates;
+  
+  //returned values
+  public String delegateKeyName;
+  public String delegateParameterName;
+
+   /*
+   * Shows 2 side-by-side windows.
+   * 
+   * Left one is a list of keys of next-level-delegates
+   * Right one is a list of parms of those delegates that 
+   *   match sufficiently to be overridden by this overriding parm
+   * If adding to existing override - current overrides are not shown as
+   *   candidates.
+   * If editing - all are shown (you can delete)  
+   *
+   */
+  public PickOverrideKeysAndParmName(AbstractSection aSection,
+          Map delegateMap,
           String message, ConfigurationParameter aCp, ConfigurationParameterDeclarations aCpd,
           boolean aAdding) {
-    super(parentShell, rootElement, message);
+    super(aSection, "Delegate Keys and Parameter Name Selection", message);
+    delegates = delegateMap;
     cp = aCp;
     cpd = aCpd;
     adding = aAdding; // true if we're adding, not editing
   }
 
+  protected Control createDialogArea(Composite parent) {
+    Composite mainArea = (Composite)super.createDialogArea(parent);
+    
+    Composite twoCol = new2ColumnComposite(mainArea);
+    
+    
+    keysUI = newTable(twoCol, SWT.SINGLE);
+    paramsUI = newTable(twoCol, SWT.SINGLE);
+    
+    for (Iterator it = delegates.entrySet().iterator(); it.hasNext();) {
+      Map.Entry entry = (Map.Entry)it.next();
+      TableItem item = new TableItem(keysUI, SWT.NULL);
+      item.setText((String)entry.getKey());
+      item.setData(entry);
+    }
+    keysUI.addListener(SWT.Selection, this);
+    if (0 < keysUI.getItemCount()) {
+      keysUI.setSelection(0);
+    }
+    
+    return mainArea;
+  }
+    
+  
+  
+  /* (non-Javadoc)
+   * @see org.apache.uima.taeconfigurator.editors.ui.dialogs.AbstractDialog#handleEvent(org.eclipse.swt.widgets.Event)
+   */
+  public void handleEvent(Event event) {
+    if (event.widget == keysUI && event.type == SWT.Selection) {
+      fillParameterCandidates();
+      enableOK();
+    }
+    
+    else if (event.widget == paramsUI && event.type == SWT.Selection) {
+      copyValuesFromGUI();
+      enableOK();
+    }
+  }
+
+  private void fillParameterCandidates() {
+    paramsUI.setRedraw(false);
+    paramsUI.removeAll();
+    TableItem selectedItem = keysUI.getSelection()[0];
+
+    Map.Entry entry = (Map.Entry) selectedItem.getData();
+    String keyName = (String) entry.getKey();
+    // support CasConsumers also
+    // support Flow Controllers too
+    // and skip remote service descriptors
+
+    ResourceSpecifier rs = (ResourceSpecifier) entry.getValue();
+    if (rs instanceof AnalysisEngineDescription || rs instanceof CasConsumerDescription
+            || rs instanceof FlowControllerDescription) {
+      ConfigurationParameterDeclarations delegateCpd = ((ResourceCreationSpecifier) rs)
+              .getMetaData().getConfigurationParameterDeclarations();
+      addSelectedParms(delegateCpd.getCommonParameters(), keyName);
+
+      ConfigurationGroup[] groups = delegateCpd.getConfigurationGroups();
+      if (null != groups) {
+        for (int i = 0; i < groups.length; i++) {
+          addSelectedParms(groups[i].getConfigurationParameters(), keyName);
+        }
+      }
+      addSelectedParms(delegateCpd.getConfigurationParameters(), keyName);
+    }
+    if (0 < paramsUI.getItemCount()) {
+      paramsUI.setSelection(0);
+    }
+    paramsUI.setRedraw(true);
+  }
+ 
+  /*
+   * Filter overridable parameters to exclude: - already overridden (can't override same parameter
+   * twice) - those with different type or multi-valued-ness (Group match not required)
+   */
+  private void addSelectedParms(ConfigurationParameter[] parms, String keyName) {
+    boolean isMultiValued = (null != parameterDialog) ? parameterDialog.multiValueUI
+            .getSelection() : cp.isMultiValued();
+    String type = (null != parameterDialog) ? parameterDialog.parmTypeUI.getText() : cp.getType();
+
+    if (null != parms) {
+      for (int i = 0; i < parms.length; i++) {
+        // multi-valued-ness must match
+        if ((isMultiValued != parms[i].isMultiValued()))
+          continue;
+        // types must match, but we also allow if no type is spec'd - not sure if this is useful
+        if ((null != type && !"".equals(type) && //$NON-NLS-1$
+        !type.equals(parms[i].getType())))
+          continue;
+        // parameter must not be already overridden, unless we're editing an existing one
+        String override = keyName + '/' + parms[i].getName();
+        if (adding && null != ParameterDelegatesSection.getOverridingParmName(override, cpd))
+          continue;
+
+        TableItem tableItem = new TableItem(paramsUI, SWT.NULL);
+        tableItem.setText(parms[i].getName());
+        tableItem.setData(parms[i]);
+      }
+    }
+  }
+  
+  /* (non-Javadoc)
+   * @see org.apache.uima.taeconfigurator.editors.ui.dialogs.AbstractDialog#copyValuesFromGUI()
+   */
+  public void copyValuesFromGUI() {
+    delegateKeyName = keysUI.getSelection()[0].getText();
+    delegateParameterName = paramsUI.getSelection()[0].getText();
+  }
+
+  /* (non-Javadoc)
+   * @see org.apache.uima.taeconfigurator.editors.ui.dialogs.AbstractDialog#enableOK()
+   */
+  public void enableOK() {
+    okButton.setEnabled( (0 < keysUI.getSelectionCount()) && 
+                         (0 < paramsUI.getSelectionCount()));   
+  }
+
+  /* (non-Javadoc)
+   * @see org.apache.uima.taeconfigurator.editors.ui.dialogs.AbstractDialog#isValid()
+   */
+  public boolean isValid() {
+    return true;
+  }
+
+    /*
   protected TreeGroup createTreeGroup(Composite composite, Object rootObject) {
     return new TreeGroup(composite, rootObject, (keyTreeProvider = new KeyTreeProvider()),
             new KeyTreeLabelProvider(), new ParmNameProvider(), new ParmNameLabelProvider(),
@@ -102,12 +237,13 @@
   Map keyTreeParent = new HashMap();
 
   class KeyTreeProvider implements ITreeContentProvider {
-
+ */
     /**
      * for a given map of delegates, return an array of maps representing the those delegates having
      * children. Not called for the top element, but called for subsequent layers
      */
-    public Object[] getChildren(Object parentElement) {
+  /* 
+  public Object[] getChildren(Object parentElement) {
       return objectArray0;
     }
 
@@ -118,11 +254,12 @@
     public boolean hasChildren(Object element) {
       return false;
     }
-
+ */
     /**
      * returns an array of Map.Entry elements: Key and AE or flow ctlr Description. Called only for
      * the top element
      */
+  /*
     public Object[] getElements(Object inputElement) {
       AbstractList items = new ArrayList();
       if (inputElement instanceof ArrayList)
@@ -141,11 +278,12 @@
     public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
       keyTreeParent.clear();
     }
-  }
+*/
 
   /**
    * elements are Map.Entry
    */
+  /*
   static class KeyTreeLabelProvider implements ILabelProvider {
 
     public Image getImage(Object element) {
@@ -170,10 +308,11 @@
     }
 
   }
-
+  */
   /**
    * Element is: Map Entry Set ConfigurationParameterDeclarations
    */
+  /*
   class ParmNameProvider implements ITreeContentProvider {
 
     public Object[] getChildren(Object parentElement) {
@@ -189,12 +328,13 @@
       // TODO Auto-generated method stub
       return false;
     }
-
+ */
     /*
      * Get elements (which are overridable parameters) for one delegate
      * 
      * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
      */
+  /*
     public Object[] getElements(Object inputElement) {
       AbstractList items = new ArrayList();
       Map.Entry entry = (Map.Entry) inputElement;
@@ -222,34 +362,6 @@
       return items.toArray();
     }
 
-    /*
-     * Filter overridable parameters to exclude: - already overridden (can't override same parameter
-     * twice) - those with different type or multi-valued-ness (Group match not required)
-     */
-    private void addSelectedParms(ConfigurationParameter[] parms, AbstractList items, String keyName) {
-      boolean isMultiValued = (null != parameterDialog) ? parameterDialog.multiValueUI
-              .getSelection() : cp.isMultiValued();
-      String type = (null != parameterDialog) ? parameterDialog.parmTypeUI.getText() : cp.getType();
-
-      if (null != parms) {
-        for (int i = 0; i < parms.length; i++) {
-          // multi-valued-ness must match
-          if ((isMultiValued != parms[i].isMultiValued()))
-            continue;
-          // types must match, but we also allow if no type is spec'd - not sure if this is useful
-          if ((null != type && !"".equals(type) && //$NON-NLS-1$
-          !type.equals(parms[i].getType())))
-            continue;
-          // parameter must not be already overridden, unless we're editing an existing one
-          String override = keyName + '/' + parms[i].getName();
-          if (adding && null != ParameterDelegatesSection.getOverridingParmName(override, cpd))
-            continue;
-
-          items.add(parms[i].getName());
-        }
-      }
-
-    }
 
     public void dispose() {
     }
@@ -281,5 +393,7 @@
     public void removeListener(ILabelProviderListener listener) {
     }
   }
+ */
+
 
 }