From 332aa4d48873b2283c7dd1ddee18d03bbee1bb58 Mon Sep 17 00:00:00 2001
From: David Dykstal
+ */
+ protected void moveTreeItems(Widget parentItem, Object[] src, int delta)
+ {
+ int[] oldPositions = new int[src.length];
+ Item[] oldItems = new Item[src.length];
+
+ for (int idx=0; idx
+ * Assumption:
+ * 1. event.getGrandParent() == subsystem (one event fired per affected subsystem)
+ * 2. event.getSource() == filter or filter string (not the reference, the real filter or string)
+ * 3. event.getParent() == parent of filter or filter string. One of:
+ * a. filterPool reference or filter reference (nested)
+ * b. filterPool for non-nested filters when showing filter pools
+ * c. subsystem for non-nested filters when not showing filter pools
+ * d. filter for nested filters
+ *
+ * Our job here:
+ * 1. Determine if we are even showing the given subsystem
+ * 2. Find the reference to the updated filter in that subsystem's subtree
+ * 3. Ask that parent to either update its name or collapse and refresh its children
+ * 4. Forget selecting something ... the original item remains selected!
+ */
+ protected void findAndUpdateFilter(ISystemResourceChangeEvent event, int type)
+ {
+ ISystemFilter filter = (ISystemFilter)event.getSource();
+ //Object parent = event.getParent();
+ if (debug)
+ {
+ String eventType = null;
+ switch(type)
+ {
+ case EVENT_RENAME_FILTER_REFERENCE:
+ eventType = "EVENT_RENAME_FILTER_REFERENCE";
+ break;
+ case EVENT_CHANGE_FILTER_REFERENCE:
+ eventType = "EVENT_CHANGE_FILTER_REFERENCE";
+ break;
+ }
+ logDebugMsg("SV event: "+eventType);
+ }
+
+ // STEP 1. ARE WE EVEN SHOWING THE GIVEN SUBSYSTEM?
+ ISubSystem ss = (ISubSystem)event.getGrandParent();
+ Widget widget = findItem(ss);
+
+ if (widget != null)
+ {
+
+ // STEP 2: ARE WE SHOWING A REFERENCE TO RENAMED OR UPDATED FILTER?
+ Widget item = null;
+
+ Control c = getControl();
+
+ // KM: defect 53008.
+ // Yes we are showing the subsystem, so widget is the subsystem item
+ if (widget != c && widget instanceof Item) {
+
+ if (debug)
+ logDebugMsg("...Found ss " + ss);
+
+ item = internalFindReferencedItem(widget, filter, SEARCH_INFINITE);
+ }
+ // No, we are not showing the subsystem, so widget is the control
+ else if (widget == c) {
+
+ if (debug)
+ logDebugMsg("...Din not find ss " + ss);
+
+ item = internalFindReferencedItem(widget, filter, SEARCH_INFINITE);
+ }
+
+ if (item == null)
+ logDebugMsg("......didn't find renamed/updated filter's reference!");
+ else
+ {
+ // STEP 3: UPDATE THAT FILTER...
+ if (type == EVENT_RENAME_FILTER_REFERENCE)
+ {
+ String[] rproperties = {IBasicPropertyConstants.P_TEXT};
+ update(item.getData(), rproperties); // for refreshing non-structural properties in viewer when model changes
+ }
+ else if (type == EVENT_CHANGE_FILTER_REFERENCE)
+ {
+ //if (((TreeItem)item).getExpanded())
+ //refresh(item.getData());
+ smartRefresh(new TreeItem[] {(TreeItem)item});
+ /*
+ Object data = item.getData();
+ boolean wasExpanded = getExpanded((Item)item);
+ setExpandedState(data, false); // collapse node
+ refresh(data); // clear all cached widgets
+ if (wasExpanded)
+ setExpandedState(data, true); // by doing this all subnodes that were expanded are now collapsed
+ */
+ }
+ updatePropertySheet();
+ }
+ }
+ }
+ protected void findAndUpdateFilterString(ISystemResourceChangeEvent event, int type)
+ {
+ ISystemFilterString filterString = (ISystemFilterString)event.getSource();
+ // STEP 1. ARE WE EVEN SHOWING THE GIVEN SUBSYSTEM?
+ ISubSystem ss = (ISubSystem)event.getGrandParent();
+ Widget item = findItem(ss);
+ if (item != null && item != getControl())
+ {
+ Item ssItem = (Item)item;
+ if (debug)
+ logDebugMsg("...Found ss "+ss);
+ // STEP 2: ARE WE SHOWING A REFERENCE TO THE UPDATED FILTER STRING?
+ item = internalFindReferencedItem(ssItem, filterString, SEARCH_INFINITE);
+ if (item == null)
+ logDebugMsg("......didn't find updated filter string's reference!");
+ else
+ {
+ // STEP 3: UPDATE THAT FILTER STRING...
+ if (type == EVENT_CHANGE_FILTERSTRING_REFERENCE) // HAD BETTER!
+ {
+ //if (((TreeItem)item).getExpanded())
+ //refresh(item.getData());
+ // boolean wasExpanded = getExpanded((Item)item);
+ Object data = item.getData();
+ setExpandedState(data, false); // collapse node
+ refresh(data); // clear all cached widgets
+ //if (wasExpanded)
+ //setExpandedState(data, true); // hmm, should we?
+ String properties[] = {IBasicPropertyConstants.P_TEXT};
+ update(item.getData(), properties); // for refreshing non-structural properties in viewer when model changes
+ updatePropertySheet();
+ }
+ }
+ }
+ }
+
+ /**
+ * We don't show actual filters, only filter references that are unique generated
+ * for each subtree of each subsystem. Yet, each event is relative to the filter,
+ * not our special filter references. Hence, all this code!!
+ *
+ * Special case handling for updates to filters which affect the parent of the
+ * filter, such that the parent's children must be re-generated:
+ * 1. New filter created (ADD)
+ * 2. Existing filter deleted (DELETE)
+ * 3. Existing filters reordered (MOVE)
+ *
+ * Assumption:
+ * 1. event.getGrandParent() == subsystem (one event fired per affected subsystem)
+ * 2. event.getSource() == filter (not the reference, the real filter)
+ * 3. event.getParent() == parent of filter. One of:
+ * a. filterPool reference or filter reference (nested)
+ * b. filterPool for non-nested filters when showing filter pools
+ * c. subsystem for non-nested filters when not showing filter pools
+ * d. filter for nested filters
+ *
+ * Our job here:
+ * 1. Determine if we are even showing the given subsystem
+ * 2. Find the parent to the given filter: filterPool or subsystem
+ * 3. Ask that parent to refresh its children (causes re-gen of filter references)
+ * 4. Select something: QUESTION: is this subsystem the origin of this action??
+ * a. For ADD, select the newly created filter reference for the new filter
+ * ANSWER: IF PARENT OF NEW FILTER IS WITHIN THIS SUBSYSTEM, AND WAS SELECTED PREVIOUSLY
+ * b. For DELETE, select the parent of the filter?
+ * ANSWER: IF DELETED FILTER IS WITHING THIS SUBSYSTEM AND WAS SELECTED PREVIOUSLY
+ * c. For MOVE, select the moved filters
+ * ANSWER: IF MOVED FILTERS ARE WITHIN THIS SUBSYSTEM, AND WERE SELECTED PREVIOUSLY
+ */
+ protected void findAndUpdateFilterParent(ISystemResourceChangeEvent event, int type)
+ {
+ ISubSystem ss = (ISubSystem)event.getGrandParent();
+ boolean add = false, move = false, delete = false;
+ boolean afilterstring = false;
+ //if (debug)
+ //{
+ String eventType = null;
+ switch(type)
+ {
+ case EVENT_ADD_FILTER_REFERENCE:
+ add = true;
+ if (debug)
+ eventType = "EVENT_ADD_FILTER_REFERENCE";
+ break;
+ case EVENT_DELETE_FILTER_REFERENCE:
+ delete = true;
+ if (debug)
+ eventType = "EVENT_DELETE_FILTER_REFERENCE";
+ break;
+ case EVENT_MOVE_FILTER_REFERENCES:
+ move = true;
+ if (debug)
+ eventType = "EVENT_MOVE_FILTER_REFERENCES";
+ break;
+ case EVENT_ADD_FILTERSTRING_REFERENCE:
+ add = true;
+ afilterstring = true;
+ if (debug)
+ eventType = "EVENT_ADD_FILTERSTRING_REFERENCE";
+ break;
+ case EVENT_DELETE_FILTERSTRING_REFERENCE:
+ delete = true;
+ afilterstring = true;
+ if (debug)
+ eventType = "EVENT_DELETE_FILTERSTRING_REFERENCE";
+ break;
+ case EVENT_MOVE_FILTERSTRING_REFERENCES:
+ move = true;
+ afilterstring = true;
+ if (debug)
+ eventType = "EVENT_MOVE_FILTERSTRING_REFERENCES";
+ break;
+
+ }
+ if (debug)
+ logDebugMsg("SV event: "+eventType);
+ //}
+ //clearSelection();
+
+ ISystemFilter filter = null;
+ ISystemFilterString filterstring = null;
+ if (!afilterstring)
+ filter = (ISystemFilter)event.getSource(); // for multi-source move, gets first filter
+ else
+ filterstring = (ISystemFilterString)event.getSource();
+
+ boolean multiSource = move;
+ // STEP 1: ARE WE SHOWING THE SUBSYSTEM GRANDPARENT OF CURRENT REFRESH?
+ Widget item = findItem(ss);
+
+ if (item == null)
+ {
+ refresh();
+
+ if (debug)
+ logDebugMsg("...Did not find ss "+ss.getName());
+ return;
+ }
+ Item ssItem = (Item)item;
+ boolean wasSelected = false;
+ IStructuredSelection oldSelections = (IStructuredSelection)getSelection();
+
+
+
+ Object parent = event.getParent();
+ if (debug)
+ logDebugMsg("...Found ss "+ss);
+
+ // STEP 2: ARE WE SHOWING A REFERENCE TO THE FILTER's PARENT POOL?
+ Item parentRefItem = null;
+ ISystemFilterContainer refdParent = null;
+ // 3a (reference to filter pool or filter)
+ if (parent instanceof ISystemFilterContainerReference) // given a reference to parent?
+ {
+ refdParent = ((ISystemFilterContainerReference)parent).getReferencedSystemFilterContainer();
+ parentRefItem = (Item)internalFindReferencedItem(ssItem, refdParent, SEARCH_INFINITE);
+ }
+ // 3b and 3d. (filter pool or filter)
+ else if (parent instanceof ISystemFilterContainer)
+ {
+ refdParent = (ISystemFilterContainer)parent;
+ parentRefItem = (Item)internalFindReferencedItem(ssItem, refdParent, SEARCH_INFINITE);
+ }
+ // 3c (subsystem)
+ else
+ {
+ parentRefItem = ssItem;
+ }
+ if (parentRefItem != null)
+ {
+ if (debug)
+ logDebugMsg("......We are showing reference to parent");
+ // STEP 3... YES, SO REFRESH PARENT... IT WILL RE-GEN THE FILTER REFERENCES FOR EACH CHILD FILTER
+ // ... actually, call off the whole show if that parent is currently not expanded!!
+ // HMMM... WE NEED TO REFRESH EVEN IF NOT EXPANDED IF ADDING FIRST CHILD
+ if (!add) // move or delete
+ {
+ if ( !(((TreeItem)parentRefItem).getExpanded()))
+ {
+ refresh(parentRefItem.getData()); // flush cached widgets so next expand is fresh
+ return;
+ }
+ // move or delete and parent is expanded...
+ Item oldItem = (Item)internalFindReferencedItem(parentRefItem, afilterstring?(Object)filterstring:(Object)filter, 1);
+ //if (debug)
+ //logDebugMsg("oldItem null? " + (oldItem==null));
+ if (oldItem != null) // found moved or deleted filter in our subtree
+ {
+ wasSelected = isSelected(oldItem.getData(), oldSelections); // was it selected before?
+ //if (debug)
+ //logDebugMsg("was selected? " + wasSelected);
+ }
+ else
+ {
+ // else interesting case ... we are showing the parent, but can't find the child!
+ }
+ if (move)
+ {
+ Object[] srcObjects = null;
+ if (multiSource)
+ srcObjects = event.getMultiSource();
+ else
+ {
+ srcObjects = new Object[1];
+ srcObjects[0] = event.getSource();
+ }
+ moveReferencedTreeItems(parentRefItem, srcObjects, event.getPosition());
+ //refresh(parentRefItem.getData());
+ }
+ else // remove
+ {
+ remove(oldItem.getData());
+ }
+ }
+ else // add operation
+ {
+ if ( !(((TreeItem)parentRefItem).getExpanded()))
+ {
+ refresh(parentRefItem.getData()); // delete cached GUIs
+ //setExpandedState(parentRefItem,true); // not our job to expand here.
+ }
+ else if (afilterstring)
+ {
+ ISystemFilterReference fr = (ISystemFilterReference)parentRefItem.getData();
+ ISystemFilterStringReference fsr = fr.getSystemFilterStringReference(filterstring);
+ createTreeItem(parentRefItem, fsr, event.getPosition());
+ //setSelection(new StructuredSelection(fsr),true);
+ }
+ else
+ {
+ Object data = parentRefItem.getData();
+ if (data instanceof ISystemFilterContainerReference)
+ {
+ ISystemFilterContainerReference sfcr = (ISystemFilterContainerReference)data;
+ ISystemFilterReference sfr = sfcr.getSystemFilterReference(ss, filter);
+ createTreeItem(parentRefItem, sfr, event.getPosition());
+ }
+ else // hmm, could be parent is a subsystem, child is a filter in no-show-filter-pools mode
+ {
+ if (data instanceof ISystemFilterPoolReferenceManagerProvider) // that's a subsystem!
+ {
+ ISystemFilterPoolReferenceManagerProvider sfprmp = (ISystemFilterPoolReferenceManagerProvider)data;
+ ISystemFilterPoolReferenceManager sfprm = sfprmp.getSystemFilterPoolReferenceManager();
+ ISystemFilterReference sfr = sfprm.getSystemFilterReference(ss, filter);
+ createTreeItem(parentRefItem, sfr, sfprm.getSystemFilterReferencePosition(sfr));
+ }
+ }
+ }
+ //refresh(parentRefItem.getData());
+ }
+
+ // STEP 4: DECIDE WHAT TO SELECT:
+
+ // 4a. ADD ... only select if parent of new filter was previously selected...
+ if (add && isSelected(parentRefItem.getData(),oldSelections))
+ {
+ if (debug)
+ logDebugMsg(".........that parent was previously selected");
+ // .... YES, SO SELECT NEW FILTER'S REFERENCE
+ Item filterItem = (Item)internalFindReferencedItem(parentRefItem, afilterstring?(Object)filterstring:(Object)filter, 1); // start at filter's parent, search for filter
+ if (filterItem == null)
+ {
+ if (debug)
+ logDebugMsg("Hmm, didn't find new filter's reference!");
+ }
+ else
+ {
+ if (debug)
+ logDebugMsg(".........Trying to set selection to " + filterItem.getData());
+ setSelection(new StructuredSelection(filterItem.getData()),true);
+ }
+ }
+ // 4b. DELETE ... select parent if deleted filter was previously selected
+ else if (delete && wasSelected)
+ {
+ setSelection(new StructuredSelection(parentRefItem.getData())); // select parent
+ }
+ // 4c. MOVE ... only select if any of moved references were previously selected...
+ else if (move && wasSelected && !afilterstring)
+ {
+ ISystemFilter[] filters = (ISystemFilter[])event.getMultiSource();
+ if (filters != null)
+ {
+ ISystemFilterReference[] newRefs = new ISystemFilterReference[filters.length];
+ for (int idx=0; idx
+ * The getParent() method in the adapter is very unreliable... adapters can't be sure
+ * of the context which can change via filtering and view options.
+ */
+ public Object getSelectedParent()
+ {
+ Tree tree = getTree();
+ TreeItem[] items = tree.getSelection();
+ if ((items==null) || (items.length==0))
+ {
+ return tree.getData();
+ }
+ else
+ {
+ TreeItem parentItem = items[0].getParentItem();
+ if (parentItem != null)
+ return parentItem.getData();
+ else
+ return tree.getData();
+ }
+ }
+ /**
+ * Return the TreeItem of the parent of the selected node. Or null if a root is selected.
+ */
+ public TreeItem getSelectedParentItem()
+ {
+ Tree tree = getTree();
+ TreeItem[] items = tree.getSelection();
+ if ((items==null) || (items.length==0))
+ {
+ return null;
+ }
+ else
+ {
+ return items[0].getParentItem();
+ }
+ }
+ /**
+ * This returns the element immediately before the first selected element in this tree level.
+ * Often needed for enablement decisions for move up actions.
+ */
+ public Object getPreviousElement()
+ {
+ Object prevElement = null;
+ Tree tree = getTree();
+ TreeItem[] items = tree.getSelection();
+ if ((items != null) && (items.length>0))
+ {
+ TreeItem item1 = items[0];
+ TreeItem[] parentItems = null;
+ TreeItem parentItem = item1.getParentItem();
+ if (parentItem != null)
+ parentItems = parentItem.getItems();
+ else
+ parentItems = item1.getParent().getItems();
+ if (parentItems != null)
+ {
+ TreeItem prevItem = null;
+ for (int idx=0; (prevItem==null) && (idx
+ * This interface is used by the remote object selection dialogs when Add mode is enabled.
+ *
+ * This interface allows you to listen generically for selection events on any remote object,
+ * and be called when the user selects something or presses. You can use instanceof to
+ * decide what was selected.
+ *
+ * If you call the enableAddButton method you must pass an object that implements this interface.
+ * The dialog will call you back when the user presses the Add button, so you can take
+ * appropriate action.
+ */
+public interface IRemoteSelectionAddListener
+{
+
+
+ /**
+ * The user has selected a remote object. Is this object valid to be added?
+ * If so, return null. If not, return a string to display on the
+ * message line indicating why it is not valid, such as it already has
+ * been added.
+ *
+ * @param selectedConnection The connection the object was selected in
+ * @param selectedObjects Will be a list of objects such as AS400Library or IRemoteFile. They are
+ * resolved so that the remote adapter is not required.
+ *
+ * @return A String or SystemMessage object that will be displayed if the
+ * action fails, null if the action was successfull
+ */
+ public Object okToEnableAddButton(IHost selectedConnection, Object[] selectedObjects);
+
+ /**
+ * The user has pressed the Add button.
+ * Do something appropriate with the request.
+ * If this action fails for some reason, or you wish to display a completion
+ * message, return message text that will be displayed in the dialog's message
+ * line. Else, return null.
+ *
+ * @param selectedConnection The connection the object was selected in
+ * @param selectedObjects Will be a list of objects such as AS400Library or IRemoteFile. They are
+ * resolved so that the remote adapter is not required.
+ *
+ * @return A String or SystemMessage object that will be displayed if the
+ * action fails, null if the action was successfull
+ */
+ public Object addButtonPressed(IHost selectedConnection, Object[] selectedObjects);
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemConnectionFormCaller.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemConnectionFormCaller.java
new file mode 100644
index 00000000000..a35ea42cf57
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemConnectionFormCaller.java
@@ -0,0 +1,38 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * Interface that any UI that uses the SystemConnectionForm must implement
+ */
+public interface ISystemConnectionFormCaller
+{
+
+
+ /**
+ * Event: the user has selected a system type.
+ * @param systemType the type of system selected
+ * @param duringInitialization true if this is being set at page initialization time versus selected by the user
+ */
+ public void systemTypeSelected(String systemType, boolean duringInitialization);
+ /**
+ * Return the shell hosting this form
+ */
+ public Shell getShell();
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemContextMenuConstants.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemContextMenuConstants.java
new file mode 100644
index 00000000000..fa1c048fc08
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemContextMenuConstants.java
@@ -0,0 +1,296 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui;
+import org.eclipse.ui.IWorkbenchActionConstants;
+/**
+ * Constants defining our groups inside our right-click popup menu in the system view.
+ *
+ * Examples for open actions are:
+ *
+ * Examples for open-with actions are:
+ *
+ * Examples for open-to actions are:
+ *
+ * Examples for work-with actions are:
+ * false
if only label provider changes are of interest
+ */
+ protected void ourInternalRefresh(Widget widget, Object element, boolean doStruct, boolean forceRemote, boolean doTimings)
+ {
+ final Widget fWidget = widget;
+ final Object fElement = element;
+ final boolean fDoStruct = doStruct;
+
+ // we have to take special care if one of our kids are selected and it is a remote object...
+ if (forceRemote || (isSelectionRemote() && isTreeItemSelectedOrChildSelected(widget)))
+ {
+ if (!isTreeItemSelected(widget)) // it is one of our kids that is selected
+ {
+ clearSelection(); // there is nothing much else we can do. Calling code will restore it anyway hopefully
+ doOurInternalRefresh(fWidget, fElement, fDoStruct, doTimings);
+ }
+ else // it is us that is selected. This might be a refresh selected operation. TreeItem address won't change
+ {
+ doOurInternalRefresh(fWidget, fElement, fDoStruct, doTimings);
+ }
+ }
+ else
+ {
+ final boolean finalDoTimings = doTimings;
+ preservingSelection(new Runnable()
+ {
+ public void run()
+ {
+ doOurInternalRefresh(fWidget, fElement, fDoStruct, finalDoTimings);
+ }
+ });
+ }
+ }
+ protected boolean isSelectionRemote()
+ {
+ ISelection s = getSelection();
+ if ((s!=null)&&(s instanceof IStructuredSelection))
+ {
+ IStructuredSelection ss = (IStructuredSelection)s;
+ Object firstSel = ss.getFirstElement();
+ if ((firstSel != null) && (getRemoteAdapter(firstSel) != null))
+ return true;
+ }
+ return false;
+ }
+ protected void doOurInternalRefresh(Widget widget, Object element, boolean doStruct, boolean doTimings)
+ {
+ if (debug)
+ {
+ logDebugMsg("in doOurInternalRefresh on " + getAdapter(element).getName(element));
+ logDebugMsg("...current selection is " + getFirstSelectionName(getSelection()));
+ }
+ SystemElapsedTimer timer = null;
+ if (doTimings)
+ timer = new SystemElapsedTimer();
+ if (widget instanceof Item)
+ {
+ //System.out.println("Inside doOurInternalRefresh. widget = " + ((TreeItem)widget).handle);
+ if (doStruct) {
+ updatePlus((Item)widget, element);
+ }
+ updateItem((Item)widget, element);
+ if (doTimings)
+ {
+ System.out.println("doOurInternalRefresh timer 1: time to updatePlus and updateItem:" + timer.setEndTime());
+ timer.setStartTime();
+ }
+ }
+
+ if (doStruct) {
+ // pass null for children, to allow updateChildren to get them only if needed
+ Object[] newChildren = null;
+ if ((widget instanceof Item) && getExpanded((Item)widget))
+ {
+ // DKM - get raw children does a query but so does internalRefresh()
+ // newChildren = getRawChildren(widget);
+ if (doTimings)
+ {
+ System.out.println("doOurInternalRefresh timer 2: time to getRawChildren:" + timer.setEndTime());
+ timer.setStartTime();
+ }
+ }
+ // DKM - without the else we get duplicate queries on expanded folder
+ // uncommented - seems new results after query aren't showing up
+ //else
+ {
+ internalRefresh(element);
+ }
+
+ if (doTimings)
+ {
+ System.out.println("doOurInternalRefresh timer 3: time to updateChildren:" + timer.setEndTime());
+ timer.setStartTime();
+ }
+ }
+ // recurse
+ Item[] children= getChildren(widget);
+ if (children != null)
+ {
+ //SystemElapsedTimer timer2 = null;
+ //int intervalCount = 0;
+ //if (doTimings)
+ //timer2 = new SystemElapsedTimer();
+ for (int i= 0; i < children.length; i++)
+ {
+ Widget item= children[i];
+ Object data= item.getData();
+ if (data != null)
+ doOurInternalRefresh(item, data, doStruct, false);
+ /*
+ if (doTimings)
+ {
+ ++intervalCount;
+ if (intervalCount == 1000)
+ {
+ System.out.println("...time to recurse next 1000 children: " + timer2.setEndTime());
+ intervalCount = 0;
+ timer2.setStartTime();
+ }
+ }*/
+ }
+ }
+ if (doTimings)
+ {
+ System.out.println("doOurInternalRefresh timer 4: time to recurse children:" + timer.setEndTime());
+ timer.setStartTime();
+ }
+ }
+ protected Object[] getRawChildren(Widget w)
+ {
+ Object parent = w.getData();
+ if (w != null)
+ {
+ if (parent.equals(getRoot()))
+ return super.getRawChildren(parent);
+ Object[] result = ((ITreeContentProvider) getContentProvider()).getChildren(parent);
+ if (result != null)
+ return result;
+ }
+ return new Object[0];
+ }
+
+ /*
+ protected void preservingSelection(Runnable updateCode)
+ {
+ super.preservingSelection(updateCode);
+ System.out.println("After preservingSelection: new selection = "+getFirstSelectionName(getSelection()));
+ }
+ protected void handleInvalidSelection(ISelection invalidSelection, ISelection newSelection)
+ {
+ System.out.println("Inside handleInvalidSelection: old = "+getFirstSelectionName(invalidSelection)+", new = "+getFirstSelectionName(newSelection));
+ updateSelection(newSelection);
+ }
+ */
+ protected String getFirstSelectionName(ISelection s)
+ {
+ if ((s!=null) && (s instanceof IStructuredSelection))
+ {
+ IStructuredSelection ss = (IStructuredSelection)s;
+ Object firstSel = ss.getFirstElement();
+ String name = null;
+ if (firstSel != null)
+ {
+ ISystemRemoteElementAdapter ra = getRemoteAdapter(firstSel);
+ if (ra != null)
+ name = ra.getAbsoluteName(firstSel);
+ else
+ name = getAdapter(firstSel).getName(firstSel);
+ }
+ return name;
+ }
+ else
+ return null;
+ }
+
+ /**
+ * Expand a remote object within the tree. Must be given its parent element within the tree,
+ * in order to uniquely find it. If not given this, we expand the first occurrence we find!
+ * @param remoteObject - either a remote object or a remote object absolute name
+ * @param subsystem - the subsystem that owns the remote objects, to optimize searches.
+ * @param parentobject - the parent that owns the remote objects, to optimize searches. Can
+ * be an object or the absolute name of a remote object.
+ * @return the tree item of the remote object if found and expanded, else null
+ */
+ public Item expandRemoteObject(Object remoteObject, ISubSystem subsystem, Object parentObject)
+ {
+ // given the parent? Should be easy
+ Item remoteItem = null;
+ if (parentObject != null)
+ {
+ Item parentItem = null;
+ if (parentObject instanceof Item)
+ parentItem = (Item)parentObject;
+ else if (parentObject instanceof String) // given absolute name of remote object
+ parentItem = findFirstRemoteItemReference((String)parentObject, subsystem, (Item)null); // search all roots for the parent
+ else // given actual remote object
+ {
+ ISystemRemoteElementAdapter ra = getRemoteAdapter(parentObject);
+ if (ra != null)
+ {
+ if (subsystem == null)
+ subsystem = ra.getSubSystem(parentObject);
+ parentItem = findFirstRemoteItemReference(ra.getAbsoluteName(parentObject), subsystem, (Item)null); // search all roots for the parent
+ }
+ else // else parent is not a remote object. Probably its a filter
+ {
+ Widget parentWidget = findItem(parentObject);
+ if (parentWidget instanceof Item)
+ parentItem = (Item)parentWidget;
+ }
+ }
+ // ok, we have the parent item! Hopefully!
+ if (remoteObject instanceof String)
+ remoteItem = findFirstRemoteItemReference((String)remoteObject, subsystem, parentItem);
+ else
+ remoteItem = findFirstRemoteItemReference(remoteObject, parentItem);
+ if (remoteItem == null)
+ return null;
+ setExpandedState(remoteItem.getData(), true);
+ }
+ else // not given a parent to refine search with. Better have a subsystem!!
+ {
+ remoteItem = null;
+ if (remoteObject instanceof String)
+ remoteItem = findFirstRemoteItemReference((String)remoteObject, subsystem, (Item)null);
+ else
+ {
+ ISystemRemoteElementAdapter ra = getRemoteAdapter(remoteObject);
+ if (ra != null)
+ {
+ if (subsystem == null)
+ subsystem = ra.getSubSystem(remoteObject);
+ remoteItem = findFirstRemoteItemReference(ra.getAbsoluteName(remoteObject), subsystem, (Item)null);
+ }
+ }
+ if (remoteItem == null)
+ return null;
+ setExpandedState(remoteItem.getData(), true);
+ }
+ return remoteItem;
+ }
+
+ /**
+ * Select a remote object or objects given the parent remote object (can be null) and subsystem (can be null)
+ * @param src - either a remote object, a remote object absolute name, or a vector of remote objects or remote object absolute names
+ * @param subsystem - the subsystem that owns the remote objects, to optimize searches.
+ * @param parentobject - the parent that owns the remote objects, to optimize searches.
+ * @return true if found and selected
+ */
+ public boolean selectRemoteObjects(Object src, ISubSystem subsystem, Object parentObject)
+ {
+ //String parentName = null;
+ // given a parent object? That makes it easy...
+ if (parentObject != null)
+ {
+ ISystemRemoteElementAdapter ra = getRemoteAdapter(parentObject);
+ if (ra != null)
+ {
+ //parentName = ra.getAbsoluteName(parentObject);
+ if (subsystem == null)
+ subsystem = ra.getSubSystem(parentObject);
+ Item parentItem = (Item)findFirstRemoteItemReference(parentObject, (Item)null); // search all roots for the parent
+ return selectRemoteObjects(src, subsystem, parentItem);
+ }
+ else // else parent is not a remote object. Probably its a filter
+ {
+ Item parentItem = null;
+ if (parentObject instanceof Item)
+ parentItem = (Item)parentObject;
+ else
+ {
+ Widget parentWidget = findItem(parentObject);
+ if (parentWidget instanceof Item)
+ parentItem = (Item)parentWidget;
+ }
+ if (parentItem != null)
+ return selectRemoteObjects(src, (ISubSystem)null, parentItem);
+ else
+ return false;
+ }
+ }
+ else
+ //return selectRemoteObjects(src, (SubSystem)null, (Item)null); // Phil test
+ return selectRemoteObjects(src, subsystem, (Item)null);
+ }
+ /**
+ * Select a remote object or objects given the parent remote object (can be null) and subsystem (can be null) and parent TreeItem to
+ * start the search at (can be null)
+ * @param src - either a remote object, a remote object absolute name, or a vector of remote objects or remote object absolute names
+ * @param subsystem - the subsystem that owns the remote objects, to optimize searches.
+ * @param parentItem - the parent at which to start the search to find the remote objects. Else, starts at the roots.
+ * @return true if found and selected
+ */
+ protected boolean selectRemoteObjects(Object src, ISubSystem subsystem, Item parentItem)
+ {
+ clearSelection();
+ Item selItem = null;
+
+ if (parentItem != null && parentItem.isDisposed()) {
+ return false;
+ }
+
+ if ((parentItem!=null) && !getExpanded(parentItem))
+ //setExpanded(parentItem, true);
+ setExpandedState(parentItem.getData(), true);
+
+ //System.out.println("SELECT_REMOTE: PARENT = " + parent + ", PARENTITEM = " + parentItem);
+ if (src instanceof Vector)
+ {
+ String elementName = null;
+ Vector selVector = (Vector)src;
+ ArrayList selItems = new ArrayList();
+ // our goal here is to turn the vector of names or remote objects into a collection of
+ // actual TreeItems we matched them on...
+ for (int idx=0; idx
+ */
+public interface ISystemContextMenuConstants
+{
+ /**
+ * Pop-up menu: name of group for goto actions (value
+ * // simply sets partitions in the menu, into which actions can be directed.
+ * // Each partition can be delimited by a separator (new Separator) or not (new GroupMarker).
+ * menu.add(new Separator(ISystemContextMenuConstants.GROUP_NEW)); // new->
+ * menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_GOTO)); // goto into, go->
+ * menu.add(new Separator(ISystemContextMenuConstants.GROUP_EXPANDTO)); // expand to->
+ * menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_EXPAND)); // expand, collapse
+ * menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_OPEN)); // open xxx
+ * menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_OPENWITH)); // open with->
+ * menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_BROWSEWITH)); // open with->
+ * menu.add(new Separator(ISystemContextMenuConstants.GROUP_WORKWITH)); // work with->
+ * menu.add(new Separator(ISystemContextMenuConstants.GROUP_BUILD)); // build, rebuild, refresh
+ * menu.add(new Separator(ISystemContextMenuConstants.GROUP_CHANGE)); // update, change
+ * menu.add(new Separator(ISystemContextMenuConstants.GROUP_REORGANIZE)); // rename,move,copy,delete,bookmark,refactoring
+ * menu.add(new Separator(ISystemContextMenuConstants.GROUP_REORDER)); // move up, move down
+ * menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_GENERATE)); // getters/setters, etc. Typically in editor
+ * menu.add(new Separator(ISystemContextMenuConstants.GROUP_SEARCH)); // search
+ * menu.add(new Separator(ISystemContextMenuConstants.GROUP_CONNECTION)); // connection-related actions
+ * menu.add(new Separator(ISystemContextMenuConstants.GROUP_IMPORTEXPORT)); // get or put actions
+ * menu.add(new Separator(ISystemContextMenuConstants.GROUP_ADAPTERS)); // actions queried from adapters
+ * menu.add(new Separator(ISystemContextMenuConstants.GROUP_ADDITIONS)); // user or BP/ISV additions
+ * menu.add(new Separator(ISystemContextMenuConstants.GROUP_TEAM)); // Team
+ * menu.add(new Separator(ISystemContextMenuConstants.GROUP_PROPERTIES)); // Properties
+ *
"group.goto"
).
+ *
+ *
+ * "group.openwith"
).
+ *
+ *
+ * "group.expand"
).
+ */
+ public static final String GROUP_EXPAND = "group.expand";
+
+ /**
+ * Pop-up menu: name of group for expand-to cascading actions (value "group.expandto"
).
+ */
+ public static final String GROUP_EXPANDTO= "group.expandto";
+ /**
+ * ID of the submenu for "Expand to->"
+ */
+ public static final String MENU_EXPANDTO= "menu.expandto";
+
+ /**
+ * Pop-up menu: name of group for open-to actions (value "group.opento"
).
+ *
+ *
+ * "group.workwith"
).
+ *
+ *
+ *
"group.open"
).
+ * + * Examples for open actions are: + *
"group.show"
).
+ * + * Examples for show actions are: + *
"group.new"
).
+ * This is a cascading group.
+ * + * Examples for new actions are: + *
"group.new.noncascade"
).
+ * This is a non-cascading group.
+ * + * This is used in the Team view + *
+ */ + public static final String GROUP_NEW_NONCASCADING="group.new.noncascade"; + + /** + * Pop-up menu: name of group for build actions (value"group.build"
).
+ */
+ public static final String GROUP_BUILD= "group.build";
+
+ /**
+ * Pop-up menu: name of group for reorganize actions (value "group.reorganize"
).
+ */
+ public static final String GROUP_REORGANIZE= "group.reorganize";
+ /**
+ * Pop-up menu: name of group for reorder actions like move up/down(value "group.reorder"
).
+ */
+ public static final String GROUP_REORDER= "group.reorder";
+ /**
+ * Pop-up menu: name of group for CHANGE actions. (value "group.change"
).
+ * + * Examples for change actions are: + *
"group.generate"
).
+ */
+ public static final String GROUP_GENERATE= "group.generate";
+
+ /**
+ * Pop-up menu: name of group for search actions (value "group.search"
).
+ */
+ public static final String GROUP_SEARCH= "group.search";
+
+ /**
+ * Pop-up menu: name of group for additional actions (value "group.additions"
).
+ */
+ public static final String GROUP_ADDITIONS= IWorkbenchActionConstants.MB_ADDITIONS; //"additions";
+
+ /**
+ * Pop-up menu: name of group for viewer setup actions (value "group.viewerSetup"
).
+ */
+ public static final String GROUP_VIEWER_SETUP= "group.viewerSetup";
+
+ /**
+ * Pop-up menu: name of group for properties actions (value "group.properties"
).
+ */
+ public static final String GROUP_PROPERTIES= "group.properties";
+ /**
+ * Pop-up menu: name of group for actions contributed by the adaptors for the selected object, which
+ * are related to the live connection.
+ */
+ public static final String GROUP_CONNECTION= "group.connection";
+ /**
+ * Pop-up menu: name of group for actions related to getting and putting the selected object.
+ */
+ public static final String GROUP_IMPORTEXPORT= "group.importexport";
+ /**
+ * Pop-up menu: name of group for actions contributed by the adaptors for the selected object
+ */
+ public static final String GROUP_ADAPTERS= "group.adapters";
+ /**
+ * Pop-up menu: name of group for team actions
+ */
+ public static final String GROUP_TEAM= "group.team";
+
+
+ /**
+ * ID of the submenu for "Compile->"
+ */
+ public static final String MENU_COMPILE= "menu.compile";
+ /**
+ * ID of the submenu for "User Actions->"
+ */
+ public static final String MENU_USERACTIONS= "menu.useractions";
+
+ /**
+ * Group for "Start Server->"
+ */
+ public static final String GROUP_STARTSERVER= "group.remoteservers";
+ /**
+ * ID of the submenu for "Start Server->"
+ */
+ public static final String MENU_STARTSERVER= "menu.remoteservers";
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemDeleteTarget.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemDeleteTarget.java
new file mode 100644
index 00000000000..fa90538d5d6
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemDeleteTarget.java
@@ -0,0 +1,43 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.viewers.ISelectionProvider;
+
+
+/**
+ * Any UI part that supports global deletion can implement
+ * this to enable the Edit menu's delete item.
+ */
+public interface ISystemDeleteTarget extends ISelectionProvider
+{
+ /**
+ * Return true if delete should even be shown in the popup menu
+ */
+ public boolean showDelete();
+ /**
+ * Return true if delete should be enabled based on your current selection.
+ */
+ public boolean canDelete();
+ /**
+ * Actually do the delete of currently selected items.
+ * Return true if it worked. Return false if it didn't (you display msg), or throw an exception (framework displays msg)
+ */
+ public boolean doDelete(IProgressMonitor monitor);
+
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemIconConstants.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemIconConstants.java
new file mode 100644
index 00000000000..0929a8d0b09
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemIconConstants.java
@@ -0,0 +1,447 @@
+/********************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui;
+
+/**
+ * Constants used throughout the System plugin.
+ */
+public interface ISystemIconConstants
+{
+ public static final String PLUGIN_ID ="org.eclipse.rse.ui";
+ public static final String PREFIX = PLUGIN_ID+".";
+
+ // Icons
+ public static final String ICON_DIR = "icons";
+ public static final String ICON_PATH = java.io.File.separator + ICON_DIR + java.io.File.separator;
+ public static final String ICON_SUFFIX = "Icon";
+ public static final String ICON_BANNER_SUFFIX = "BannerIcon";
+ public static final String ICON_EXT = ".gif";
+
+ // WIZARD ICONS...
+ public static final String ICON_WIZARD_DIR = java.io.File.separator + "full" + java.io.File.separator + "wizban" + java.io.File.separator + "";
+ public static final String ICON_SYSTEM_NEWPROFILEWIZARD_ROOT = "newprofile_wiz";
+ public static final String ICON_SYSTEM_NEWPROFILEWIZARD = ICON_WIZARD_DIR + ICON_SYSTEM_NEWPROFILEWIZARD_ROOT + ICON_EXT;
+ public static final String ICON_SYSTEM_NEWPROFILEWIZARD_ID = PREFIX + ICON_SYSTEM_NEWPROFILEWIZARD_ROOT + ICON_BANNER_SUFFIX;
+
+ public static final String ICON_SYSTEM_NEWCONNECTIONWIZARD_ROOT = "newconnection_wiz";
+ public static final String ICON_SYSTEM_NEWCONNECTIONWIZARD = ICON_WIZARD_DIR + ICON_SYSTEM_NEWCONNECTIONWIZARD_ROOT + ICON_EXT;
+ public static final String ICON_SYSTEM_NEWCONNECTIONWIZARD_ID = PREFIX + ICON_SYSTEM_NEWCONNECTIONWIZARD_ROOT + ICON_BANNER_SUFFIX;
+
+ public static final String ICON_SYSTEM_NEWFILTERWIZARD_ROOT = "newfilter_wiz";
+ public static final String ICON_SYSTEM_NEWFILTERWIZARD = ICON_WIZARD_DIR + ICON_SYSTEM_NEWFILTERWIZARD_ROOT + ICON_EXT;
+ public static final String ICON_SYSTEM_NEWFILTERWIZARD_ID = PREFIX + ICON_SYSTEM_NEWFILTERWIZARD_ROOT + ICON_BANNER_SUFFIX;
+
+ public static final String ICON_SYSTEM_NEWFILTERPOOLWIZARD_ROOT = "newfilterpool_wiz";
+ public static final String ICON_SYSTEM_NEWFILTERPOOLWIZARD = ICON_WIZARD_DIR + ICON_SYSTEM_NEWFILTERPOOLWIZARD_ROOT + ICON_EXT;
+ public static final String ICON_SYSTEM_NEWFILTERPOOLWIZARD_ID = PREFIX + ICON_SYSTEM_NEWFILTERPOOLWIZARD_ROOT + ICON_BANNER_SUFFIX;
+
+ public static final String ICON_SYSTEM_NEWFILEWIZARD_ROOT = "newfile_wiz";
+ public static final String ICON_SYSTEM_NEWFILEWIZARD = ICON_WIZARD_DIR + ICON_SYSTEM_NEWFILEWIZARD_ROOT + ICON_EXT;
+ public static final String ICON_SYSTEM_NEWFILEWIZARD_ID = PREFIX + ICON_SYSTEM_NEWFILEWIZARD_ROOT + ICON_BANNER_SUFFIX;
+
+ public static final String ICON_SYSTEM_NEWFOLDERWIZARD_ROOT = "newfolder_wiz";
+ public static final String ICON_SYSTEM_NEWFOLDERWIZARD = ICON_WIZARD_DIR + ICON_SYSTEM_NEWFOLDERWIZARD_ROOT + ICON_EXT;
+ public static final String ICON_SYSTEM_NEWFOLDERWIZARD_ID = PREFIX + ICON_SYSTEM_NEWFOLDERWIZARD_ROOT + ICON_BANNER_SUFFIX;
+
+
+ // THING ICONS...
+ public static final String ICON_MODEL_DIR = java.io.File.separator + "full" + java.io.File.separator + "obj16" + java.io.File.separator + "";
+
+ public static final String ICON_SYSTEM_USERACTION_NEW_ROOT = "user_action_new_obj";
+ public static final String ICON_SYSTEM_USERACTION_NEW = ICON_MODEL_DIR + ICON_SYSTEM_USERACTION_NEW_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_USERACTION_NEW_ID = PREFIX+ICON_SYSTEM_USERACTION_NEW_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_USERACTION_USR_ROOT = "user_action_obj";
+ public static final String ICON_SYSTEM_USERACTION_USR = ICON_MODEL_DIR + ICON_SYSTEM_USERACTION_USR_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_USERACTION_USR_ID = PREFIX+ICON_SYSTEM_USERACTION_USR_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_USERACTION_IBM_ROOT = "user_action_ibm_obj";
+ public static final String ICON_SYSTEM_USERACTION_IBM = ICON_MODEL_DIR + ICON_SYSTEM_USERACTION_IBM_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_USERACTION_IBM_ID = PREFIX+ICON_SYSTEM_USERACTION_IBM_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_USERACTION_IBMUSR_ROOT = "user_action_ibm_user_obj";
+ public static final String ICON_SYSTEM_USERACTION_IBMUSR = ICON_MODEL_DIR + ICON_SYSTEM_USERACTION_IBMUSR_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_USERACTION_IBMUSR_ID = PREFIX+ICON_SYSTEM_USERACTION_IBMUSR_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_USERTYPE_NEW_ROOT = "user_type_new_obj";
+ public static final String ICON_SYSTEM_USERTYPE_NEW = ICON_MODEL_DIR + ICON_SYSTEM_USERTYPE_NEW_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_USERTYPE_NEW_ID = PREFIX+ICON_SYSTEM_USERTYPE_NEW_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_USERTYPE_USR_ROOT = "user_type_obj";
+ public static final String ICON_SYSTEM_USERTYPE_USR = ICON_MODEL_DIR + ICON_SYSTEM_USERTYPE_USR_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_USERTYPE_USR_ID = PREFIX+ICON_SYSTEM_USERTYPE_USR_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_USERTYPE_IBM_ROOT = "user_type_ibm_obj";
+ public static final String ICON_SYSTEM_USERTYPE_IBM = ICON_MODEL_DIR + ICON_SYSTEM_USERTYPE_IBM_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_USERTYPE_IBM_ID = PREFIX+ICON_SYSTEM_USERTYPE_IBM_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_USERTYPE_IBMUSR_ROOT = "user_type_ibm_user_obj";
+ public static final String ICON_SYSTEM_USERTYPE_IBMUSR = ICON_MODEL_DIR + ICON_SYSTEM_USERTYPE_IBMUSR_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_USERTYPE_IBMUSR_ID = PREFIX+ICON_SYSTEM_USERTYPE_IBMUSR_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_COMPILE_NEW_ROOT = "compcmd_new_obj";
+ public static final String ICON_SYSTEM_COMPILE_NEW = ICON_MODEL_DIR + ICON_SYSTEM_COMPILE_NEW_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_COMPILE_NEW_ID = PREFIX+ICON_SYSTEM_COMPILE_NEW_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_COMPILE_USR_ROOT = "compcmd_user_obj";
+ public static final String ICON_SYSTEM_COMPILE_USR = ICON_MODEL_DIR + ICON_SYSTEM_COMPILE_USR_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_COMPILE_USR_ID = PREFIX+ICON_SYSTEM_COMPILE_USR_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_COMPILE_IBM_ROOT = "compcmd_ibm_obj";
+ public static final String ICON_SYSTEM_COMPILE_IBM = ICON_MODEL_DIR + ICON_SYSTEM_COMPILE_IBM_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_COMPILE_IBM_ID = PREFIX+ICON_SYSTEM_COMPILE_IBM_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_COMPILE_IBMUSR_ROOT = "compcmd_ibmuser_obj";
+ public static final String ICON_SYSTEM_COMPILE_IBMUSR = ICON_MODEL_DIR + ICON_SYSTEM_COMPILE_IBMUSR_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_COMPILE_IBMUSR_ID = PREFIX+ICON_SYSTEM_COMPILE_IBMUSR_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_PROFILE_ROOT = "systemprofile";
+ public static final String ICON_SYSTEM_PROFILE = ICON_MODEL_DIR + ICON_SYSTEM_PROFILE_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_PROFILE_ID = PREFIX+ICON_SYSTEM_PROFILE_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_PROFILE_ACTIVE_ROOT = "systemprofile_active";
+ public static final String ICON_SYSTEM_PROFILE_ACTIVE = ICON_MODEL_DIR + ICON_SYSTEM_PROFILE_ACTIVE_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_PROFILE_ACTIVE_ID = PREFIX+ICON_SYSTEM_PROFILE_ACTIVE_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_CONNECTION_ROOT = "systemconnection";
+ public static final String ICON_SYSTEM_CONNECTION = ICON_MODEL_DIR + ICON_SYSTEM_CONNECTION_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_CONNECTION_ID = PREFIX+ICON_SYSTEM_CONNECTION_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_CONNECTIONLIVE_ROOT = "systemconnectionlive"; // not currently used
+ public static final String ICON_SYSTEM_CONNECTIONLIVE = ICON_MODEL_DIR + ICON_SYSTEM_CONNECTIONLIVE_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_CONNECTIONLIVE_ID = PREFIX+ICON_SYSTEM_CONNECTIONLIVE_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_FILTERPOOL_ROOT = "systemfilterpool";
+ public static final String ICON_SYSTEM_FILTERPOOL = ICON_MODEL_DIR + ICON_SYSTEM_FILTERPOOL_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_FILTERPOOL_ID = PREFIX+ICON_SYSTEM_FILTERPOOL_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_FILTER_ROOT = "systemfilter";
+ public static final String ICON_SYSTEM_FILTER_ID = PREFIX + ICON_SYSTEM_FILTER_ROOT + ICON_SUFFIX;
+ public static final String ICON_SYSTEM_FILTER = ICON_MODEL_DIR + ICON_SYSTEM_FILTER_ROOT + ICON_EXT;
+
+ public static final String ICON_SYSTEM_FILTERSTRING_ROOT = "systemfilterstring";
+ public static final String ICON_SYSTEM_FILTERSTRING_ID = PREFIX + ICON_SYSTEM_FILTERSTRING_ROOT + ICON_SUFFIX;
+ public static final String ICON_SYSTEM_FILTERSTRING = ICON_MODEL_DIR + ICON_SYSTEM_FILTERSTRING_ROOT + ICON_EXT;
+
+ public static final String ICON_SYSTEM_ROOTDRIVE_ROOT = "systemrootdrive";
+ public static final String ICON_SYSTEM_ROOTDRIVE = ICON_MODEL_DIR + ICON_SYSTEM_ROOTDRIVE_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_ROOTDRIVE_ID = PREFIX+ICON_SYSTEM_ROOTDRIVE_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_ROOTDRIVEOPEN_ROOT = "systemrootdriveopen";
+ public static final String ICON_SYSTEM_ROOTDRIVEOPEN = ICON_MODEL_DIR + ICON_SYSTEM_ROOTDRIVEOPEN_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_ROOTDRIVEOPEN_ID = PREFIX+ICON_SYSTEM_ROOTDRIVEOPEN_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_FOLDER_ROOT = "systemfolder";
+ public static final String ICON_SYSTEM_FOLDER = ICON_MODEL_DIR + ICON_SYSTEM_FOLDER_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_FOLDER_ID = PREFIX+ICON_SYSTEM_FOLDER_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_ENVVAR_ROOT = "systemenvvar";
+ public static final String ICON_SYSTEM_ENVVAR = ICON_MODEL_DIR + ICON_SYSTEM_ENVVAR_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_ENVVAR_ID = PREFIX+ICON_SYSTEM_ENVVAR+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_ENVVAR_LIBPATH_ROOT = "systemenvvarlibpath";
+ public static final String ICON_SYSTEM_ENVVAR_LIBPATH = ICON_MODEL_DIR + ICON_SYSTEM_ENVVAR_LIBPATH_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_ENVVAR_LIBPATH_ID = PREFIX+ICON_SYSTEM_ENVVAR_LIBPATH+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_ENVVAR_PATH_ROOT = "systemenvvarpath";
+ public static final String ICON_SYSTEM_ENVVAR_PATH = ICON_MODEL_DIR + ICON_SYSTEM_ENVVAR_PATH_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_ENVVAR_PATH_ID = PREFIX+ICON_SYSTEM_ENVVAR_PATH+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_PROCESS_ROOT = "systemprocess";
+ public static final String ICON_SYSTEM_PROCESS = ICON_MODEL_DIR + ICON_SYSTEM_PROCESS_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_PROCESS_ID = PREFIX+ICON_SYSTEM_PROCESS+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_TARGET_ROOT = "systemTarget";
+ public static final String ICON_SYSTEM_TARGET = ICON_MODEL_DIR + ICON_SYSTEM_TARGET_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_TARGET_ID = PREFIX+ICON_SYSTEM_TARGET_ROOT+ICON_SUFFIX;
+
+ // NEW ACTION ICONS...
+ public static final String ICON_NEWACTIONS_DIR = java.io.File.separator + "full" + java.io.File.separator + "ctool16" + java.io.File.separator + "";
+
+ public static final String ICON_SYSTEM_NEW_ROOT = "new";
+ public static final String ICON_SYSTEM_NEW = ICON_NEWACTIONS_DIR + ICON_SYSTEM_NEW_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_NEW_ID = PREFIX+ICON_SYSTEM_NEW_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_NEWPROFILE_ROOT = "newprofile_wiz";
+ public static final String ICON_SYSTEM_NEWPROFILE = ICON_NEWACTIONS_DIR + ICON_SYSTEM_NEWPROFILE_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_NEWPROFILE_ID = PREFIX+ICON_SYSTEM_NEWPROFILE_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_NEWCONNECTION_ROOT = "newconnection_wiz";
+ public static final String ICON_SYSTEM_NEWCONNECTION = ICON_NEWACTIONS_DIR + ICON_SYSTEM_NEWCONNECTION_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_NEWCONNECTION_ID = PREFIX+ICON_SYSTEM_NEWCONNECTION_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_NEWFILTERPOOL_ROOT = "newfilterpool_wiz";
+ public static final String ICON_SYSTEM_NEWFILTERPOOL = ICON_NEWACTIONS_DIR + ICON_SYSTEM_NEWFILTERPOOL_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_NEWFILTERPOOL_ID = PREFIX+ICON_SYSTEM_NEWFILTERPOOL_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_NEWFILTERPOOLREF_ROOT = "newfilterpoolref_wiz";
+ public static final String ICON_SYSTEM_NEWFILTERPOOLREF = ICON_NEWACTIONS_DIR + ICON_SYSTEM_NEWFILTERPOOLREF_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_NEWFILTERPOOLREF_ID = PREFIX+ICON_SYSTEM_NEWFILTERPOOLREF_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_NEWFILTER_ROOT = "newfilter_wiz";
+ public static final String ICON_SYSTEM_NEWFILTER = ICON_NEWACTIONS_DIR + ICON_SYSTEM_NEWFILTER_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_NEWFILTER_ID = PREFIX+ICON_SYSTEM_NEWFILTER_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_NEWFILE_ROOT = "newfile_wiz";
+ public static final String ICON_SYSTEM_NEWFILE = ICON_NEWACTIONS_DIR + ICON_SYSTEM_NEWFILE_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_NEWFILE_ID = PREFIX+ICON_SYSTEM_NEWFILE_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_NEWFOLDER_ROOT = "newfolder_wiz";
+ public static final String ICON_SYSTEM_NEWFOLDER = ICON_NEWACTIONS_DIR + ICON_SYSTEM_NEWFOLDER_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_NEWFOLDER_ID = PREFIX+ICON_SYSTEM_NEWFOLDER_ROOT+ICON_SUFFIX;
+
+
+ // OTHER ACTION ICONS...
+ public static final String ICON_ACTIONS_DIR = java.io.File.separator + "full" + java.io.File.separator + "elcl16" + java.io.File.separator + "";
+
+ public static final String ICON_SYSTEM_COMPILE_ROOT = "compile";
+ public static final String ICON_SYSTEM_COMPILE = ICON_ACTIONS_DIR + ICON_SYSTEM_COMPILE_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_COMPILE_ID = PREFIX+ICON_SYSTEM_COMPILE_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_LOCK_ROOT = "lock";
+ public static final String ICON_SYSTEM_LOCK = ICON_ACTIONS_DIR + ICON_SYSTEM_LOCK_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_LOCK_ID = PREFIX+ICON_SYSTEM_LOCK_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_MOVEUP_ROOT = "up";
+ public static final String ICON_SYSTEM_MOVEUP = ICON_ACTIONS_DIR + ICON_SYSTEM_MOVEUP_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_MOVEUP_ID = PREFIX+ICON_SYSTEM_MOVEUP_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_MOVEDOWN_ROOT = "down";
+ public static final String ICON_SYSTEM_MOVEDOWN = ICON_ACTIONS_DIR + ICON_SYSTEM_MOVEDOWN_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_MOVEDOWN_ID = PREFIX+ICON_SYSTEM_MOVEDOWN_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_MOVE_ROOT = "move";
+ public static final String ICON_SYSTEM_MOVE = ICON_ACTIONS_DIR + ICON_SYSTEM_MOVE_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_MOVE_ID = PREFIX+ICON_SYSTEM_MOVE_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_CLEAR_ROOT = "clear";
+ public static final String ICON_SYSTEM_CLEAR = ICON_ACTIONS_DIR + ICON_SYSTEM_CLEAR_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_CLEAR_ID = PREFIX+ICON_SYSTEM_CLEAR_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_CLEAR_ALL_ROOT = "clearall";
+ public static final String ICON_SYSTEM_CLEAR_ALL = ICON_ACTIONS_DIR + ICON_SYSTEM_CLEAR_ALL_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_CLEAR_ALL_ID = PREFIX+ICON_SYSTEM_CLEAR_ALL_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_CLEAR_SELECTED_ROOT = "clearselected";
+ public static final String ICON_SYSTEM_CLEAR_SELECTED = ICON_ACTIONS_DIR + ICON_SYSTEM_CLEAR_SELECTED_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_CLEAR_SELECTED_ID = PREFIX+ICON_SYSTEM_CLEAR_SELECTED_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_DELETEREF_ROOT = "deletereference";
+ public static final String ICON_SYSTEM_DELETEREF = ICON_ACTIONS_DIR + ICON_SYSTEM_DELETEREF_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_DELETEREF_ID = PREFIX+ICON_SYSTEM_DELETEREF_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_RUN_ROOT = "run";
+ public static final String ICON_SYSTEM_RUN = ICON_ACTIONS_DIR + ICON_SYSTEM_RUN_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_RUN_ID = PREFIX+ICON_SYSTEM_RUN_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_STOP_ROOT = "stop";
+ public static final String ICON_SYSTEM_STOP = ICON_ACTIONS_DIR + ICON_SYSTEM_STOP_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_STOP_ID = PREFIX+ICON_SYSTEM_STOP_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_RENAME_ROOT = "rename";
+ public static final String ICON_SYSTEM_RENAME = ICON_ACTIONS_DIR + ICON_SYSTEM_RENAME_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_RENAME_ID = PREFIX+ICON_SYSTEM_RENAME_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_IDE_REFRESH_ID = "elcl16/refresh_nav.gif";
+ public static final String ICON_IDE_COLLAPSEALL_ID = "elcl16/collapseall.gif";
+ public static final String ICON_IDE_LINKTOEDITOR_ID = "elcl16/synced.gif";
+ public static final String ICON_IDE_FILTER_ID = "elcl16/filter_ps.gif";
+
+ public static final String ICON_SYSTEM_MAKEPROFILEACTIVE_ROOT = "makeProfileActive";
+ public static final String ICON_SYSTEM_MAKEPROFILEACTIVE = ICON_ACTIONS_DIR + ICON_SYSTEM_MAKEPROFILEACTIVE_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_MAKEPROFILEACTIVE_ID = PREFIX+ICON_SYSTEM_MAKEPROFILEACTIVE_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_MAKEPROFILEINACTIVE_ROOT = "makeProfileInActive";
+ public static final String ICON_SYSTEM_MAKEPROFILEINACTIVE = ICON_ACTIONS_DIR + ICON_SYSTEM_MAKEPROFILEINACTIVE_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_MAKEPROFILEINACTIVE_ID = PREFIX+ICON_SYSTEM_MAKEPROFILEINACTIVE_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_CHANGEFILTER_ROOT = "editfilter";
+ public static final String ICON_SYSTEM_CHANGEFILTER = ICON_ACTIONS_DIR + ICON_SYSTEM_CHANGEFILTER_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_CHANGEFILTER_ID = PREFIX+ICON_SYSTEM_CHANGEFILTER_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_SELECTPROFILE_ROOT = "selectprofile";
+ public static final String ICON_SYSTEM_SELECTPROFILE = ICON_ACTIONS_DIR + ICON_SYSTEM_SELECTPROFILE_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_SELECTPROFILE_ID = PREFIX+ICON_SYSTEM_SELECTPROFILE_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_SELECTFILTERPOOLS_ROOT = "selectpool";
+ public static final String ICON_SYSTEM_SELECTFILTERPOOLS = ICON_ACTIONS_DIR + ICON_SYSTEM_SELECTFILTERPOOLS_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_SELECTFILTERPOOLS_ID = PREFIX+ICON_SYSTEM_SELECTFILTERPOOLS_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_WORKWITHFILTERPOOLS_ROOT = "workwithfilterpools";
+ public static final String ICON_SYSTEM_WORKWITHFILTERPOOLS = ICON_ACTIONS_DIR + ICON_SYSTEM_WORKWITHFILTERPOOLS_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_WORKWITHFILTERPOOLS_ID = PREFIX+ICON_SYSTEM_WORKWITHFILTERPOOLS_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_WORKWITHUSERACTIONS_ROOT = "workwithuseractions";
+ public static final String ICON_SYSTEM_WORKWITHUSERACTIONS = ICON_ACTIONS_DIR + ICON_SYSTEM_WORKWITHUSERACTIONS_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_WORKWITHUSERACTIONS_ID = PREFIX+ICON_SYSTEM_WORKWITHUSERACTIONS_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_WORKWITHNAMEDTYPES_ROOT = "workwithnamedtypes";
+ public static final String ICON_SYSTEM_WORKWITHNAMEDTYPES = ICON_ACTIONS_DIR + ICON_SYSTEM_WORKWITHNAMEDTYPES_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_WORKWITHNAMEDTYPES_ID = PREFIX+ICON_SYSTEM_WORKWITHNAMEDTYPES_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_WORKWITHCOMPILECMDS_ROOT = "workwithcompilecmds";
+ public static final String ICON_SYSTEM_WORKWITHCOMPILECMDS = ICON_ACTIONS_DIR + ICON_SYSTEM_WORKWITHCOMPILECMDS_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_WORKWITHCOMPILECMDS_ID = PREFIX+ICON_SYSTEM_WORKWITHCOMPILECMDS_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_REMOVE_SHELL_ROOT = "removeshell";
+ public static final String ICON_SYSTEM_REMOVE_SHELL_ID = PREFIX + ICON_SYSTEM_REMOVE_SHELL_ROOT + ICON_SUFFIX;
+ public static final String ICON_SYSTEM_REMOVE_SHELL = ICON_ACTIONS_DIR + ICON_SYSTEM_REMOVE_SHELL_ROOT + ICON_EXT;
+
+ public static final String ICON_SYSTEM_CANCEL_SHELL_ROOT = "cancelshell";
+ public static final String ICON_SYSTEM_CANCEL_SHELL_ID = PREFIX + ICON_SYSTEM_CANCEL_SHELL_ROOT + ICON_SUFFIX;
+ public static final String ICON_SYSTEM_CANCEL_SHELL = ICON_ACTIONS_DIR + ICON_SYSTEM_CANCEL_SHELL_ROOT + ICON_EXT;
+
+ public static final String ICON_SYSTEM_EXTRACT_ROOT = "xtrctarchv_tsk";
+ public static final String ICON_SYSTEM_EXTRACT = ICON_ACTIONS_DIR + ICON_SYSTEM_EXTRACT_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_EXTRACT_ID = PREFIX+ICON_SYSTEM_EXTRACT_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_EXTRACTTO_ROOT = "xtrctarchvto_tsk";
+ public static final String ICON_SYSTEM_EXTRACTTO = ICON_ACTIONS_DIR + ICON_SYSTEM_EXTRACTTO_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_EXTRACTTO_ID = PREFIX+ICON_SYSTEM_EXTRACTTO_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_CONVERT_ROOT = "convertarchive_tsk";
+ public static final String ICON_SYSTEM_CONVERT = ICON_ACTIONS_DIR + ICON_SYSTEM_CONVERT_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_CONVERT_ID = PREFIX+ICON_SYSTEM_CONVERT_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_COMBINE_ROOT = "combine_tsk";
+ public static final String ICON_SYSTEM_COMBINE = ICON_ACTIONS_DIR + ICON_SYSTEM_COMBINE_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_COMBINE_ID = PREFIX+ICON_SYSTEM_COMBINE_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_SHOW_TABLE_ROOT = "systemshowintable";
+ public static final String ICON_SYSTEM_SHOW_TABLE = ICON_ACTIONS_DIR + ICON_SYSTEM_SHOW_TABLE_ROOT + ICON_EXT;
+ public static final String ICON_SYSTEM_SHOW_TABLE_ID = PREFIX + ICON_SYSTEM_SHOW_TABLE_ROOT + ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_SHOW_MONITOR_ROOT = "monitor_view";
+ public static final String ICON_SYSTEM_SHOW_MONITOR = ICON_ACTIONS_DIR + ICON_SYSTEM_SHOW_MONITOR_ROOT + ICON_EXT;
+ public static final String ICON_SYSTEM_SHOW_MONITOR_ID = PREFIX + ICON_SYSTEM_SHOW_MONITOR_ROOT + ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_SHOW_SHELL_ROOT = "systemshell";
+ public static final String ICON_SYSTEM_SHOW_SHELL = ICON_ACTIONS_DIR + ICON_SYSTEM_SHOW_SHELL_ROOT + ICON_EXT;
+ public static final String ICON_SYSTEM_SHOW_SHELL_ID = PREFIX + ICON_SYSTEM_SHOW_SHELL_ROOT + ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_EXPORT_SHELL_OUTPUT_ROOT = "exportshelloutput";
+ public static final String ICON_SYSTEM_EXPORT_SHELL_OUTPUT = ICON_ACTIONS_DIR + ICON_SYSTEM_EXPORT_SHELL_OUTPUT_ROOT + ICON_EXT;
+ public static final String ICON_SYSTEM_EXPORT_SHELL_OUTPUT_ID = PREFIX + ICON_SYSTEM_EXPORT_SHELL_OUTPUT_ROOT + ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_EXPORT_SHELL_HISTORY_ROOT = "exportshellhistory";
+ public static final String ICON_SYSTEM_EXPORT_SHELL_HISTORY = ICON_ACTIONS_DIR + ICON_SYSTEM_EXPORT_SHELL_HISTORY_ROOT + ICON_EXT;
+ public static final String ICON_SYSTEM_EXPORT_SHELL_HISTORY_ID = PREFIX + ICON_SYSTEM_EXPORT_SHELL_HISTORY_ROOT + ICON_SUFFIX;
+
+ // SPECIAL MODEL OBJECT ICONS...
+ public static final String ICON_OBJS_DIR = java.io.File.separator + "full" + java.io.File.separator + "obj16" + java.io.File.separator;
+ public static final String ICON_SYSTEM_ERROR_ROOT = "error";
+ public static final String ICON_SYSTEM_ERROR_ID = PREFIX + ICON_SYSTEM_ERROR_ROOT + ICON_SUFFIX;
+ public static final String ICON_SYSTEM_ERROR = ICON_OBJS_DIR + ICON_SYSTEM_ERROR_ROOT + ICON_EXT;
+
+ // info is to be used in dialogs
+ public static final String ICON_SYSTEM_INFO_ROOT = "info";
+ public static final String ICON_SYSTEM_INFO_ID = PREFIX + ICON_SYSTEM_INFO_ROOT + ICON_SUFFIX;
+ public static final String ICON_SYSTEM_INFO = ICON_OBJS_DIR + ICON_SYSTEM_INFO_ROOT + ICON_EXT;
+
+ // systeminfo is to be used in tree view
+ public static final String ICON_SYSTEM_INFO_TREE_ROOT = "systeminfo";
+ public static final String ICON_SYSTEM_INFO_TREE_ID = PREFIX + ICON_SYSTEM_INFO_TREE_ROOT + ICON_SUFFIX;
+ public static final String ICON_SYSTEM_INFO_TREE = ICON_OBJS_DIR + ICON_SYSTEM_INFO_TREE_ROOT + ICON_EXT;
+
+ public static final String ICON_SYSTEM_HELP_ROOT = "systemhelp";
+ public static final String ICON_SYSTEM_HELP_ID = PREFIX + ICON_SYSTEM_HELP_ROOT + ICON_SUFFIX;
+ public static final String ICON_SYSTEM_HELP = ICON_OBJS_DIR + ICON_SYSTEM_HELP_ROOT + ICON_EXT;
+
+ public static final String ICON_SYSTEM_CANCEL_ROOT = "systemcancel";
+ public static final String ICON_SYSTEM_CANCEL_ID = PREFIX + ICON_SYSTEM_CANCEL_ROOT + ICON_SUFFIX;
+ public static final String ICON_SYSTEM_CANCEL = ICON_OBJS_DIR + ICON_SYSTEM_CANCEL_ROOT + ICON_EXT;
+
+ public static final String ICON_SYSTEM_EMPTY_ROOT = "systemempty";
+ public static final String ICON_SYSTEM_EMPTY_ID = PREFIX + ICON_SYSTEM_EMPTY_ROOT + ICON_SUFFIX;
+ public static final String ICON_SYSTEM_EMPTY = ICON_OBJS_DIR + ICON_SYSTEM_EMPTY_ROOT + ICON_EXT;
+
+ public static final String ICON_SYSTEM_OK_ROOT = "systemok";
+ public static final String ICON_SYSTEM_OK_ID = PREFIX + ICON_SYSTEM_OK_ROOT + ICON_SUFFIX;
+ public static final String ICON_SYSTEM_OK = ICON_OBJS_DIR + ICON_SYSTEM_OK_ROOT + ICON_EXT;
+
+ public static final String ICON_SYSTEM_WARNING_ROOT = "warning";
+ public static final String ICON_SYSTEM_WARNING_ID = PREFIX + ICON_SYSTEM_WARNING_ROOT + ICON_SUFFIX;
+ public static final String ICON_SYSTEM_WARNING = ICON_OBJS_DIR + ICON_SYSTEM_WARNING_ROOT + ICON_EXT;
+
+ public static final String ICON_SYSTEM_FAILED_ROOT = "systemfailed"; // not used yet
+ public static final String ICON_SYSTEM_FAILED_ID = PREFIX + ICON_SYSTEM_FAILED_ROOT + ICON_SUFFIX;
+ public static final String ICON_SYSTEM_FAILED = ICON_OBJS_DIR + ICON_SYSTEM_FAILED_ROOT + ICON_EXT;
+
+ public static final String ICON_SYSTEM_BLANK_ROOT = "systemblank"; // not used yet
+ public static final String ICON_SYSTEM_BLANK_ID = PREFIX + ICON_SYSTEM_BLANK_ROOT + ICON_SUFFIX;
+ public static final String ICON_SYSTEM_BLANK = ICON_OBJS_DIR + ICON_SYSTEM_BLANK_ROOT + ICON_EXT;
+
+ public static final String ICON_SYSTEM_SEARCH_ROOT = "system_search";
+ public static final String ICON_SYSTEM_SEARCH_ID = PREFIX + ICON_SYSTEM_SEARCH_ROOT + ICON_SUFFIX;
+ public static final String ICON_SYSTEM_SEARCH = ICON_OBJS_DIR + ICON_SYSTEM_SEARCH_ROOT + ICON_EXT;
+
+ public static final String ICON_SYSTEM_SEARCH_RESULT_ROOT = "systemsearchresult";
+ public static final String ICON_SYSTEM_SEARCH_RESULT_ID = PREFIX + ICON_SYSTEM_SEARCH_RESULT_ROOT + ICON_SUFFIX;
+ public static final String ICON_SYSTEM_SEARCH_RESULT = ICON_OBJS_DIR + ICON_SYSTEM_SEARCH_RESULT_ROOT + ICON_EXT;
+
+ public static final String ICON_SYSTEM_SHELL_ROOT = "systemshell"; // not used yet
+ public static final String ICON_SYSTEM_SHELL_ID = PREFIX + ICON_SYSTEM_SHELL_ROOT + ICON_SUFFIX;
+ public static final String ICON_SYSTEM_SHELL = ICON_OBJS_DIR + ICON_SYSTEM_SHELL_ROOT + ICON_EXT;
+
+ public static final String ICON_SYSTEM_SHELLLIVE_ROOT = "systemshelllive"; // not used yet
+ public static final String ICON_SYSTEM_SHELLLIVE_ID = PREFIX + ICON_SYSTEM_SHELLLIVE_ROOT + ICON_SUFFIX;
+ public static final String ICON_SYSTEM_SHELLLIVE = ICON_OBJS_DIR + ICON_SYSTEM_SHELLLIVE_ROOT + ICON_EXT;
+
+ public static final String ICON_SYSTEM_PERSPECTIVE_ROOT ="system_persp";
+ public static final String ICON_SYSTEM_PERSPECTIVE_ID = PREFIX + ICON_SYSTEM_PERSPECTIVE_ROOT + ICON_SUFFIX;
+ public static final String ICON_SYSTEM_PERSPECTIVE = ICON_OBJS_DIR + ICON_SYSTEM_PERSPECTIVE_ROOT + ICON_EXT;
+
+
+
+ public static final String ICON_SYSTEM_ARROW_UP_ROOT = "arrowup_obj";
+ public static final String ICON_SYSTEM_ARROW_UP = ICON_OBJS_DIR + ICON_SYSTEM_ARROW_UP_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_ARROW_UP_ID = PREFIX+ICON_SYSTEM_ARROW_UP_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_ARROW_DOWN_ROOT = "arrowdown_obj";
+ public static final String ICON_SYSTEM_ARROW_DOWN = ICON_OBJS_DIR + ICON_SYSTEM_ARROW_DOWN_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_ARROW_DOWN_ID = PREFIX+ICON_SYSTEM_ARROW_DOWN_ROOT+ICON_SUFFIX;
+
+
+ public static final String ICON_SYSTEM_CONNECTOR_SERVICE_ROOT = "connectorservice_obj";
+ public static final String ICON_SYSTEM_CONNECTOR_SERVICE = ICON_OBJS_DIR + ICON_SYSTEM_CONNECTOR_SERVICE_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_CONNECTOR_SERVICE_ID = PREFIX+ICON_SYSTEM_CONNECTOR_SERVICE_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_SERVICE_ROOT = "service_obj";
+ public static final String ICON_SYSTEM_SERVICE = ICON_OBJS_DIR + ICON_SYSTEM_SERVICE_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_SERVICE_ID = PREFIX+ICON_SYSTEM_SERVICE_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_LAUNCHER_CONFIGURATION_ROOT = "launcher_config_obj";
+ public static final String ICON_SYSTEM_LAUNCHER_CONFIGURATION = ICON_OBJS_DIR + ICON_SYSTEM_LAUNCHER_CONFIGURATION_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_LAUNCHER_CONFIGURATION_ID = PREFIX+ICON_SYSTEM_LAUNCHER_CONFIGURATION_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SYSTEM_PROPERTIES_ROOT = "properties_obj";
+ public static final String ICON_SYSTEM_PROPERTIES = ICON_OBJS_DIR + ICON_SYSTEM_PROPERTIES_ROOT+ICON_EXT;
+ public static final String ICON_SYSTEM_PROPERTIES_ID = PREFIX+ICON_SYSTEM_PROPERTIES_ROOT+ICON_SUFFIX;
+
+ public static final String ICON_SEARCH_REMOVE_SELECTED_MATCHES_ROOT = "searchremoveselected";
+ public static final String ICON_SEARCH_REMOVE_SELECTED_MATCHES = ICON_ACTIONS_DIR + ICON_SEARCH_REMOVE_SELECTED_MATCHES_ROOT + ICON_EXT;
+ public static final String ICON_SEARCH_REMOVE_SELECTED_MATCHES_ID = PREFIX + ICON_SEARCH_REMOVE_SELECTED_MATCHES_ROOT + ICON_SUFFIX;
+
+ public static final String ICON_SEARCH_REMOVE_ALL_MATCHES_ROOT = "searchremoveall";
+ public static final String ICON_SEARCH_REMOVE_ALL_MATCHES = ICON_ACTIONS_DIR + ICON_SEARCH_REMOVE_ALL_MATCHES_ROOT + ICON_EXT;
+ public static final String ICON_SEARCH_REMOVE_ALL_MATCHES_ID = PREFIX + ICON_SEARCH_REMOVE_ALL_MATCHES_ROOT + ICON_SUFFIX;
+
+ // we reuse the Remove all matches action icon
+ public static final String ICON_SEARCH_CLEAR_HISTORY_ROOT = ICON_SEARCH_REMOVE_ALL_MATCHES_ROOT;
+ public static final String ICON_SEARCH_CLEAR_HISTORY = ICON_ACTIONS_DIR + ICON_SEARCH_CLEAR_HISTORY_ROOT + ICON_EXT;
+ public static final String ICON_SEARCH_CLEAR_HISTORY_ID = PREFIX + ICON_SEARCH_CLEAR_HISTORY_ROOT + ICON_SUFFIX;
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemMassager.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemMassager.java
new file mode 100644
index 00000000000..354ee1eaabe
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemMassager.java
@@ -0,0 +1,38 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui;
+//import org.eclipse.jface.dialogs.*;
+//import org.eclipse.jface.viewers.*;
+
+/**
+ * This interface is used to identify objects whose job is to massage user-entered
+ * text before saving it to a model. Eg, the text, while valid, may need to be folded
+ * to uppercase or trimmed of blanks, or resolved if it has a substitution variable.
+ * + * This interface, like IInputValidator, allows this work to be abstracted such that one + * object that does it can be used in various dialogs or wizards or property sheets. + */ +public interface ISystemMassager +{ + + + /** + * Given the user-entered input, return the massaged version of it. + * If no massaging required, return the input as is. + */ + public String massage(String text); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemMessages.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemMessages.java new file mode 100644 index 00000000000..14ddc5ee3b7 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemMessages.java @@ -0,0 +1,454 @@ +/******************************************************************************** + * Copyright (c) 2000, 2006 IBM Corporation. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Initial Contributors: + * The following IBM employees contributed to the Remote System Explorer + * component that contains this file: David McKnight, Kushal Munir, + * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, + * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. + * + * Contributors: + * {Name} (company) - description of contribution. + ********************************************************************************/ + +package org.eclipse.rse.ui; + +/** + * Message IDs + */ +public interface ISystemMessages +{ + + public static final String PLUGIN_ID ="org.eclipse.rse.ui"; + public static final String PREFIX = PLUGIN_ID+"."; + // Resource Bundle ids + public static final String RESID_PREFIX = PREFIX+"ui."; + // Messages + public static final String MSG_PREFIX = RESID_PREFIX+"msg."; + //public static final String MSG_TITLE = MSG_PREFIX + "Title"; + //public static final String MSG_TITLEWARNING = MSG_PREFIX + "TitleWarning"; + //public static final String MSG_TITLEINFORMATION = MSG_PREFIX + "TitleInformation"; + //public static final String MSG_TITLECONFIRMATION = MSG_PREFIX + "TitleConfirmation"; + + //public static final String MSG_CREATE_PROJECT_ERROR = "RSEG1002"; //MSG_PREFIX + "CreateProjectFailed"; + + //public static final String MSG_VALIDATE_PREFIX = MSG_PREFIX + "Validate."; + public static final String MSG_UNDERCONSTRUCTION = "RSEG1001"; + + public static final String MSG_CONFIRM_RELOADRSE = "RSEG1002"; + + public static final String MSG_CONFIRM_ENABLE_CLASSIC_HELP = "RSEG1400"; + public static final String MSG_ERROR_ENABLE_CLASSIC_HELP = "RSEG1401"; + + public static final String MSG_VALIDATE_NAME_EMPTY = "RSEG1006"; + public static final String MSG_VALIDATE_NAME_NOTUNIQUE= "RSEG1007"; + public static final String MSG_VALIDATE_NAME_NOTVALID = "RSEG1008"; + + public static final String MSG_VALIDATE_RENAME_EMPTY = "RSEG1012"; //MSG_VALIDATE_PREFIX + "ReName.Required"; + public static final String MSG_VALIDATE_RENAME_NOTUNIQUE= "RSEG1010"; //MSG_VALIDATE_PREFIX + "ReName.NotUnique"; + public static final String MSG_VALIDATE_RENAME_NOTVALID = "RSEG1011"; //MSG_VALIDATE_PREFIX + "ReName.NotValid"; + public static final String MSG_VALIDATE_RENAME_OLDEQUALSNEW = "RSEG1009"; //MSG_VALIDATE_PREFIX+"ReName.OldEqualsNew"; + + public static final String MSG_VALIDATE_PROFILENAME_EMPTY = "RSEG1014"; + public static final String MSG_VALIDATE_PROFILENAME_NOTUNIQUE= "RSEG1015"; + public static final String MSG_VALIDATE_PROFILENAME_NOTVALID = "RSEG1016"; + public static final String MSG_VALIDATE_PROFILENAME_RESERVED = "RSEG1040"; + + public static final String MSG_VALIDATE_PATH_EMPTY = "RSEG1032"; + public static final String MSG_VALIDATE_PATH_NOTUNIQUE= "RSEG1033"; + public static final String MSG_VALIDATE_PATH_NOTVALID = "RSEG1034"; + + public static final String MSG_VALIDATE_NOT_NUMERIC = "RSEG1017"; + public static final String MSG_VALIDATE_PORT_EMPTY = "RSEG1027"; + public static final String MSG_VALIDATE_PORT_NOTVALID = "RSEG1028"; + public static final String MSG_VALIDATE_FOLDERNAME_NOTVALID = "RSEG1018"; + public static final String MSG_VALIDATE_FILENAME_NOTVALID = "RSEG1019"; + + public static final String MSG_VALIDATE_CONNECTIONNAME_EMPTY= "RSEG1021"; + public static final String MSG_VALIDATE_CONNECTIONNAME_NOTUNIQUE = "RSEG1022"; + public static final String MSG_VALIDATE_CONNECTIONNAME_NOTUNIQUE_OTHERPROFILE = "RSEG1041"; + public static final String MSG_VALIDATE_CONNECTIONNAME_NOTVALID = "RSEG1023"; + + public static final String MSG_VALIDATE_HOSTNAME_EMPTY= "RSEG1024"; //MSG_VALIDATE_PREFIX + "HostNameRequired"; + public static final String MSG_VALIDATE_USERID_EMPTY = "RSEG1025"; + public static final String MSG_VALIDATE_USERID_NOTVALID = "RSEG1026"; + + public static final String MSG_VALIDATE_ENTRY_EMPTY = "RSEG1029"; + public static final String MSG_VALIDATE_ENTRY_NOTUNIQUE= "RSEG1030"; + public static final String MSG_VALIDATE_ENTRY_NOTVALID = "RSEG1031"; + + public static final String MSG_VALIDATE_FILTERPOOLNAME_EMPTY = "RSEG1037"; + public static final String MSG_VALIDATE_FILTERPOOLNAME_NOTUNIQUE= "RSEG1038"; + public static final String MSG_VALIDATE_FILTERPOOLNAME_NOTVALID = "RSEG1039"; + + public static final String MSG_VALIDATE_FILTERNAME_EMPTY = "RSEG1042"; + public static final String MSG_VALIDATE_FILTERNAME_NOTUNIQUE= "RSEG1043"; + public static final String MSG_VALIDATE_FILTERNAME_NOTVALID = "RSEG1044"; + + public static final String MSG_VALIDATE_PASSWORD_EMPTY = "RSEG1035"; //MSG_VALIDATE_PREFIX + "PasswordRequired"; + public static final String MSG_VALIDATE_PASSWORD_EXPIRED = "RSEG1036"; //MSG_VALIDATE_PREFIX + "PasswordExpired"; + public static final String MSG_VALIDATE_FILTERSTRING_EMPTY = "RSEG1045"; + public static final String MSG_VALIDATE_FILTERSTRING_NOTUNIQUE= "RSEG1046"; + public static final String MSG_VALIDATE_FILTERSTRING_NOTVALID = "RSEG1047"; + public static final String MSG_VALIDATE_FILTERSTRING_DUPLICATES = "RSEG1048"; + public static final String MSG_VALIDATE_FILTERSTRING_ALREADYEXISTS = "RSEG1049"; + public static final String MSG_VALIDATE_NUMBER_EMPTY = "RSEG1170"; + public static final String MSG_VALIDATE_NUMBER_NOTVALID = "RSEG1171"; + public static final String MSG_VALIDATE_NUMBER_OUTOFRANGE= "RSEG1172"; + + public static final String MSG_CONFIRM_DELETE = "RSEG1052"; + public static final String MSG_CONFIRM_DELETEREMOTE = "RSEG1130"; + public static final String MSG_CONFIRM_DELETEPROFILE = "RSEG1053"; + public static final String MSG_CONFIRM_CHANGES = "RSEG1201"; + public static final String MSG_CONFIRM_CHANGES_CANCELABLE = "RSEG1202"; + + //public static final String MSG_CONNECT_PREFIX = MSG_PREFIX + "Connect."; + public static final String MSG_CONNECT_PROGRESS = "RSEG1054"; //MSG_CONNECT_PREFIX + "Connecting"; + public static final String MSG_CONNECTWITHPORT_PROGRESS = "RSEG1055"; //MSG_CONNECT_PREFIX + "ConnectingWithPort"; + public static final String MSG_CONNECT_FAILED = "RSEG1056"; //MSG_CONNECT_PREFIX + "Failed"; + public static final String MSG_CONNECT_UNKNOWNHOST = "RSEG1057"; //MSG_CONNECT_PREFIX + "UnknownHost"; + public static final String MSG_CONNECT_CANCELLED = "RSEG1058"; //MSG_CONNECT_PREFIX + "Cancelled"; + + + public static final String MSG_CONNECT_DAEMON_FAILED = "RSEG1242"; //MSG_CONNECT_PREFIX + "Failed"; + public static final String MSG_CONNECT_DAEMON_FAILED_EXCEPTION = "RSEG1243"; //MSG_CONNECT_PREFIX + "Failed"; + public static final String MSG_CONNECT_SSL_EXCEPTION = "RSEC2307"; //MSG_CONNECT_PREFIX + "Failed"; + + public static final String MSG_STARTING_SERVER_VIA_REXEC = "RSEC2310"; + public static final String MSG_STARTING_SERVER_VIA_DAEMON = "RSEC2311"; + public static final String MSG_CONNECTING_TO_SERVER= "RSEC2312"; + public static final String MSG_INITIALIZING_SERVER= "RSEC2313"; + + //public static final String MSG_DISCONNECT_PREFIX = MSG_PREFIX + "Disconnect."; + public static final String MSG_DISCONNECT_PROGRESS = "RSEG1059"; //MSG_DISCONNECT_PREFIX + "Disconnecting"; + public static final String MSG_DISCONNECTWITHPORT_PROGRESS = "RSEG1060"; //MSG_DISCONNECT_PREFIX + "DisconnectingWithPort"; + public static final String MSG_DISCONNECT_FAILED = "RSEG1061"; // MSG_DISCONNECT_PREFIX + "Failed"; + public static final String MSG_DISCONNECT_CANCELLED = "RSEG1062"; //MSG_DISCONNECT_PREFIX + "Cancelled"; + + //public static final String MSG_SAVE_PREFIX = MSG_PREFIX + "Save."; + public static final String MSG_SAVE_FAILED = "RSEG1050"; //MSG_SAVE_PREFIX + "Failed"; + public static final String MSG_RESTORE_FAILED = "RSEG1051"; + public static final String MSG_SAVE_CHANGES_PENDING = "RSEG1201"; + + //public static final String MSG_EXCEPTION_PREFIX = MSG_PREFIX + "Exception."; + public static final String MSG_EXCEPTION_OCCURRED = "RSEG1003"; + public static final String MSG_EXCEPTION_DELETING = "RSEG1063"; //""RSEG1004"; + public static final String MSG_EXCEPTION_RENAMING = "RSEG1064"; //"RSEG1005"; //MSG_EXCEPTION_PREFIX + "Renaming"; + public static final String MSG_EXCEPTION_MOVING = "RSEG1065"; //MSG_EXCEPTION_PREFIX + "Moving"; + + //public static final String MSG_RESOLVE_PREFIX = MSG_PREFIX + "Resolve."; + public static final String MSG_RESOLVE_PROGRESS = "RSEG1070"; + + //public static final String MSG_QUERY_PREFIX = MSG_PREFIX + "Query."; + public static final String MSG_QUERY_PROGRESS = "RSEG1095"; + public static final String MSG_QUERY_PROPERTIES_PROGRESS = "RSEG1096"; + + //public static final String MSG_SET_PREFIX = MSG_PREFIX + "Set."; + public static final String MSG_SET_PROGRESS = "RSEG1093"; + public static final String MSG_SET_PROPERTIES_PROGRESS = "RSEG1094"; + + //public static final String MSG_RUN_PREFIX = MSG_PREFIX + "Run."; + public static final String MSG_RUN_PROGRESS = "RSEG1071"; + + //public static final String MSG_COPY_PREFIX = MSG_PREFIX + "Copy."; + public static final String MSG_COPY_PROGRESS = "RSEG1072"; + public static final String MSG_COPYCONNECTION_PROGRESS = "RSEG1073"; + public static final String MSG_COPYCONNECTIONS_PROGRESS = "RSEG1074"; + public static final String MSG_COPYFILTERPOOLS_PROGRESS = "RSEG1075"; + public static final String MSG_COPYFILTERPOOL_PROGRESS = "RSEG1076"; + public static final String MSG_COPYFILTERS_PROGRESS = "RSEG1077"; + public static final String MSG_COPYFILTER_PROGRESS = "RSEG1078"; + public static final String MSG_COPYFILTERSTRINGS_PROGRESS="RSEG1079"; + public static final String MSG_COPYFILTERSTRING_PROGRESS ="RSEG1080"; + public static final String MSG_COPYSUBSYSTEMS_PROGRESS = "RSEG1081"; + + public static final String MSG_DOWNLOAD_PROGRESS = "RSEG1280"; + public static final String MSG_UPLOAD_PROGRESS = "RSEG1281"; + public static final String MSG_SYNCHRONIZE_PROGRESS = "RSEG1282"; + public static final String MSG_EXTRACT_PROGRESS = "RSEG1285"; + public static final String MSG_PERCENT_DONE = "RSEG1290"; + public static final String MSG_DOWNLOADING_PROGRESS = "RSEG1295"; + public static final String MSG_UPLOADING_PROGRESS = "RSEG1296"; + + public static final String MSG_COPYFILTERPOOL_COMPLETE = "RSEG1082"; + + //public static final String MSG_MOVE_PREFIX = MSG_PREFIX + "Move."; + public static final String MSG_MOVE_PROGRESS = "RSEG1083"; // "moving %1 to %2" + public static final String MSG_MOVECONNECTION_PROGRESS = "RSEG1084"; + public static final String MSG_MOVECONNECTIONS_PROGRESS = "RSEG1085"; + public static final String MSG_MOVEFILTERPOOLS_PROGRESS = "RSEG1086"; + public static final String MSG_MOVEFILTERPOOL_PROGRESS = "RSEG1087"; + public static final String MSG_MOVEFILTERS_PROGRESS = "RSEG1088"; + public static final String MSG_MOVEFILTER_PROGRESS = "RSEG1089"; + public static final String MSG_MOVEFILTERSTRINGS_PROGRESS="RSEG1090"; + public static final String MSG_MOVEFILTERSTRING_PROGRESS ="RSEG1091"; + public static final String MSG_MOVEFILTERPOOL_COMPLETE = "RSEG1092"; + + public static final String MSG_COPYGENERIC_PROGRESS = "RSEG1115"; + public static final String MSG_MOVEGENERIC_PROGRESS = "RSEG1116"; + public static final String MSG_COPYTHINGGENERIC_PROGRESS = "RSEG1117"; + public static final String MSG_MOVETHINGGENERIC_PROGRESS = "RSEG1118"; + + public static final String MSG_SAVING_PROGRESS = "RSEG1119"; + + public static final String MSG_VALIDATE_UDANAME_EMPTY = "RSEG1180"; + public static final String MSG_VALIDATE_UDANAME_NOTUNIQUE= "RSEG1181"; + public static final String MSG_VALIDATE_UDANAME_NOTVALID = "RSEG1182"; + + public static final String MSG_VALIDATE_UDACMT_EMPTY = "RSEG1183"; + public static final String MSG_VALIDATE_UDACMT_NOTVALID = "RSEG1184"; + + public static final String MSG_VALIDATE_UDACMD_EMPTY = "RSEG1185"; + public static final String MSG_VALIDATE_UDACMD_NOTVALID = "RSEG1186"; + + public static final String MSG_VALIDATE_UDTNAME_EMPTY = "RSEG1187"; + public static final String MSG_VALIDATE_UDTNAME_NOTUNIQUE= "RSEG1188"; + public static final String MSG_VALIDATE_UDTNAME_NOTVALID = "RSEG1189"; + + public static final String MSG_VALIDATE_UDTTYPES_EMPTY = "RSEG1190"; + public static final String MSG_VALIDATE_UDTTYPES_NOTVALID = "RSEG1191"; + + public static final String MSG_VALIDATE_SRCTYPE_EMPTY = "RSEG1192"; + public static final String MSG_VALIDATE_SRCTYPE_NOTVALID = "RSEG1193"; + public static final String MSG_VALIDATE_SRCTYPE_NOTUNIQUE= "RSEG1194"; + + public static final String MSG_VALIDATE_COMPILELABEL_EMPTY = "RSEG1195"; + public static final String MSG_VALIDATE_COMPILELABEL_NOTUNIQUE= "RSEG1196"; + public static final String MSG_VALIDATE_COMPILELABEL_NOTVALID = "RSEG1197"; + public static final String MSG_VALIDATE_COMPILESTRING_EMPTY = "RSEG1198"; + public static final String MSG_VALIDATE_COMPILESTRING_NOTVALID = "RSEG1199"; + + public static final String MSG_VALIDATE_ARCHIVE_NAME = "RSEG1120"; + public static final String MSG_COMBINETO_VIRTUAL_DEST = "RSEG1121"; + public static final String MSG_CONVERTTO_VIRTUAL_DEST = "RSEG1127"; + public static final String MSG_ADDTO_VIRTUAL_DEST = "RSEG1128"; + public static final String MSG_DEST_NOT_IN_SOURCE = "RSEG1129"; + public static final String MSG_DEST_TARGET_READONLY = "RSEF1313"; + + public static final String FILEMSG_ARCHIVE_CORRUPTED = "RSEG1122"; + public static final String MSG_FOLDER_INUSE = "RSEG1150"; // defect 42138 + public static final String MSG_FILE_INUSE = "RSEG1151"; // defect 42332 + + public static final String MSG_FILTERPOOL_CREATED = "RSEG1160"; // defect 42503 + public static final String MSG_UPDATEFILTER_FAILED = "RSEG1161"; + public static final String MSG_RENAMEFILTER_FAILED = "RSEG1162"; + + //public static final String MSG_OPERATION_PREFIX = MSG_PREFIX + "Operation."; + public static final String MSG_OPERATION_FAILED = "RSEG1066"; + public static final String MSG_OPERATION_CANCELLED = "RSEG1067"; + + + //public static final String MSG_LOADING_PREFIX = MSG_PREFIX + "Loading."; + public static final String MSG_LOADING_PROFILE_SHOULDBE_ACTIVATED = "RSEG1068"; + public static final String MSG_LOADING_PROFILE_SHOULDNOTBE_DEACTIVATED = "RSEG1069"; + + public static final String MSG_UDA_LOAD_ERROR = "RSEG1140"; + public static final String MSG_UDA_ROOTTAG_ERROR = "RSEG1141"; + + public static final String MSG_HOSTNAME_NOTFOUND = "RSEG1220"; + public static final String MSG_HOSTNAME_VERIFYING = "RSEG1221"; + + public static final String MSG_CONFIRM_DELETE_USERACTION = "RSEG1230"; + public static final String MSG_CONFIRM_DELETE_USERTYPE = "RSEG1231"; + + public static final String MSG_WIZARD_PAGE_ERROR = "RSEG1240"; + + // universal find files + public static final String MSG_UFF_PATTERN_EMPTY = "RSEG1250"; + public static final String MSG_UFF_PATTERN_INVALID_REGEX = "RSEG1251"; + + // universal commands + public static final String MSG_UCMD_INVOCATION_EMPTY = "RSEG1260"; + + // operation status + public static final String MSG_OPERATION_RUNNING = "RSEG1255"; + public static final String MSG_OPERATION_FINISHED = "RSEG1256"; + public static final String MSG_OPERTION_STOPPED = "RSEG1257"; + public static final String MSG_OPERATION_DISCONNECTED = "RSEG1258"; + + + + // -------------------------- + // UNIVERSAL FILE MESSAGES... + // -------------------------- + public static final String FILEMSG_VALIDATE_FILEFILTERSTRING_EMPTY = "RSEF1011"; + public static final String FILEMSG_VALIDATE_FILEFILTERSTRING_NOTUNIQUE= "RSEF1007"; + public static final String FILEMSG_VALIDATE_FILEFILTERSTRING_NOTVALID = "RSEF1008"; + public static final String FILEMSG_VALIDATE_FILEFILTERSTRING_NOINCLUDES = "RSEF1009"; + public static final String FILEMSG_DELETE_FILE_FAILED = "RSEF1300"; + public static final String FILEMSG_RENAME_FILE_FAILED = "RSEF1301"; + public static final String FILEMSG_CREATE_FILE_FAILED = "RSEF1302"; + public static final String FILEMSG_CREATE_FILE_FAILED_EXIST = "RSEF1303"; + public static final String FILEMSG_CREATE_FOLDER_FAILED = "RSEF1304"; + public static final String FILEMSG_CREATE_FOLDER_FAILED_EXIST = "RSEF1309"; + public static final String FILEMSG_CREATE_RESOURCE_NOTVISIBLE = "RSEF1310"; + public static final String FILEMSG_RENAME_RESOURCE_NOTVISIBLE = "RSEF1311"; + public static final String FILEMSG_ERROR_NOFILETYPES = "RSEF1010"; + public static final String FILEMSG_COPY_FILE_FAILED = "RSEF1306"; + public static final String FILEMSG_MOVE_FILE_FAILED = "RSEF1307"; + public static final String FILEMSG_MOVE_TARGET_EQUALS_SOURCE = "RSEF1308"; + public static final String FILEMSG_MOVE_TARGET_DESCENDS_FROM_SOUCE = "RSEF1312"; + public static final String FILEMSG_DELETING = "RSEF1315"; + + // ------------------------- + // IMPORT/EXPORT MESSAGES... + // ------------------------- + public static final String FILEMSG_COPY_ROOT = "RSEF8050"; + public static final String FILEMSG_IMPORT_ERROR = "RSEF8052"; + public static final String FILEMSG_IMPORT_PROBLEMS = "RSEF8054"; + public static final String FILEMSG_IMPORT_SELF = "RSEF8056"; + public static final String FILEMSG_EXPORT_ERROR = "RSEF8057"; + public static final String FILEMSG_EXPORT_PROBLEMS = "RSEF8058"; + public static final String FILEMSG_NOT_WRITABLE = "RSEF8059"; + + public static final String FILEMSG_TARGET_EXISTS = "RSEF8060"; + public static final String FILEMSG_FOLDER_IS_FILE = "RSEF8061"; + public static final String FILEMSG_DESTINATION_CONFLICTING = "RSEF8062"; + public static final String FILEMSG_SOURCE_IS_FILE = "RSEF8063"; + public static final String FILEMSG_SOURCE_EMPTY = "RSEF8066"; + public static final String FILEMSG_EXPORT_FAILED = "RSEF8067"; + public static final String FILEMSG_EXPORT_NONE_SELECTED = "RSEF8068"; + public static final String FILEMSG_DESTINATION_EMPTY = "RSEF8069"; + public static final String FILEMSG_IMPORT_FAILED = "RSEF8070"; + public static final String FILEMSG_IMPORT_NONE_SELECTED = "RSEF8071"; + public static final String FILEMSG_IMPORT_FILTERING = "RSEF8072"; + + // -------------------------------- + // INFO-POPS FOR UNIVERSAL FILE + // ------------------------------- + + public static final String NEW_FILE_WIZARD = "ufwf0000"; + public static final String NEW_FOLDER_WIZARD = "ufwr0000"; + public static final String NEW_FILE_ACTION = "ufaf0000"; + public static final String NEW_FOLDER_ACTION = "ufar0000"; + + + // Remote File Exception Messages + public static final String FILEMSG_SECURITY_ERROR = "RSEF1001"; + public static final String FILEMSG_IO_ERROR = "RSEF1002"; + + public static final String FILEMSG_FOLDER_NOTEMPTY = "RSEF1003"; + public static final String FILEMSG_FOLDER_NOTFOUND = "RSEF1004"; + public static final String FILEMSG_FOLDER_NOTFOUND_WANTTOCREATE = "RSEF1005"; + public static final String FILEMSG_FILE_NOTFOUND = "RSEF1006"; + + // -------------------------- + // SYSTEM VIEW MESSAGES... + // -------------------------- + public static final String MSG_EXPAND_PREFIX = MSG_PREFIX + "Expand."; + public static final String MSG_EXPAND_FAILED = "RSEG1098"; //MSG_EXPAND_PREFIX + "Failed"; + public static final String MSG_EXPAND_CANCELLED = "RSEG1067"; //MSG_EXPAND_PREFIX + "Cancelled"; + // Message vetoed by UCD + //public static final String MSG_EXPAND_CANCELLED = "RSEG1099"; //MSG_EXPAND_PREFIX + "Cancelled"; + public static final String MSG_EXPAND_EMPTY = "RSEG1100"; //MSG_EXPAND_PREFIX + "Empty"; + public static final String MSG_EXPAND_FILTERCREATED = "RSEG1102"; //MSG_EXPAND_PREFIX + "FilterCreated"; + public static final String MSG_EXPAND_CONNECTIONCREATED = "RSEG1108"; //MSG_EXPAND_PREFIX + "ConnectionCreated"; + + public static final String MSG_LIST_PREFIX = MSG_PREFIX + "List."; + public static final String MSG_LIST_CANCELLED = "RSEG1101"; //MSG_LIST_PREFIX + "Cancelled"; + + // ---------------------------------- + // GENERIC ERROR CHECKING MESSAGES... + // ---------------------------------- + public static final String MSG_ERROR_CONNECTION_NOTFOUND = "RSEG1103"; + public static final String MSG_ERROR_PROFILE_NOTFOUND = "RSEG1104"; + public static final String MSG_ERROR_FOLDER_NOTFOUND = "RSEG1105"; + public static final String MSG_ERROR_FILE_NOTFOUND = "RSEG1106"; + public static final String MSG_ERROR_FOLDERORFILE_NOTFOUND = "RSEG1107"; + public static final String MSG_ERROR_ARCHIVEMANAGEMENT_NOTSUPPORTED = "RSEG1304"; + + // -------------------------- + // Generic messages, must substitute in values... + // -------------------------- + public static final String MSG_GENERIC_I = "RSEO1010"; + public static final String MSG_GENERIC_W = "RSEO1011"; + public static final String MSG_GENERIC_E = "RSEO1012"; + public static final String MSG_GENERIC_U = "RSEO1013"; + public static final String MSG_GENERIC_Q = "RSEO1014"; + public static final String MSG_GENERIC_I_HELP = "RSEO1000"; + public static final String MSG_GENERIC_W_HELP = "RSEO1001"; + public static final String MSG_GENERIC_E_HELP = "RSEO1002"; + public static final String MSG_GENERIC_U_HELP = "RSEO1003"; + public static final String MSG_GENERIC_Q_HELP = "RSEO1004"; + public static final String MSG_GENERIC_I_TWOPARMS_HELP = "RSEO1005"; + public static final String MSG_GENERIC_W_TWOPARMS_HELP = "RSEO1006"; + public static final String MSG_GENERIC_E_TWOPARMS_HELP = "RSEO1007"; + public static final String MSG_GENERIC_U_TWOPARMS_HELP = "RSEO1008"; + public static final String MSG_GENERIC_Q_TWOPARMS_HELP = "RSEO1009"; + + // ---------------------------------- + // COMMUNICATIONS ERROR CHECKING MESSAGES... + // ---------------------------------- + public static final String MSG_COMM_CONNECT_FAILED = "RSEC1001"; + public static final String MSG_COMM_AUTH_FAILED = "RSEC1002"; + public static final String MSG_COMM_PWD_INVALID = "RSEC1004"; + + public static final String MSG_COMM_PWD_EXISTS = "RSEC2101"; + public static final String MSG_COMM_PWD_MISMATCH = "RSEC2102"; + public static final String MSG_COMM_PWD_BLANKFIELD = "RSEC2103"; + + public static final String MSG_COMM_ENVVAR_DUPLICATE = "RSEC2001"; + public static final String MSG_COMM_ENVVAR_NONAME = "RSEC2002"; + public static final String MSG_COMM_ENVVAR_INVALIDCHAR = "RSEC2004"; + + public static final String MSG_COMM_DAEMON_NOTSTARTED = "RSEC2201"; + + public static final String MSG_COMM_SERVER_NOTSTARTED = "RSEC2301"; + public static final String MSG_COMM_INVALID_LOGIN = "RSEC2302"; + + public static final String MSG_COMM_INCOMPATIBLE_PROTOCOL = "RSEC2303"; + public static final String MSG_COMM_INCOMPATIBLE_UPDATE = "RSEC2304"; + + + public static final String MSG_COMM_REXEC_NOTSTARTED = "RSEC2305"; + + public static final String MSG_COMM_PORT_WARNING = "RSEC2306"; + + public static final String MSG_COMM_SERVER_OLDER_WARNING = "RSEC2308"; + public static final String MSG_COMM_CLIENT_OLDER_WARNING = "RSEC2309"; + + // Unexpected error message + public static final String MSG_ERROR_UNEXPECTED = "RSEF8002"; + + // Connection doesn't exist + public static final String MSG_CONNECTION_DELETED = "RSEF5011"; + + // Remote editing messages + public static final String MSG_DOWNLOAD_NO_WRITE = "RSEF5002"; + public static final String MSG_DOWNLOAD_ALREADY_OPEN_IN_EDITOR = "RSEF5009"; + public static final String MSG_UPLOAD_FILE_EXISTS = "RSEF5012"; + + // General error message + public static final String MSG_ERROR_GENERAL = "RSEO1002"; + + // file transfer message + public static final String MSG_TRANSFER_INVALID = "RSEG1270"; + + + // remote error list title message + public static final String MSG_ERROR_LIST_TITLE = "RSEG1500"; + + // name validation + public static final String MSG_ERROR_EXTENSION_EMPTY = "RSEF6001"; + public static final String MSG_ERROR_FILENAME_INVALID = "RSEF6002"; + + // cache preferences + public static final String MSG_CACHE_UPLOAD_BEFORE_DELETE = "RSEF6101"; + public static final String MSG_CACHE_UNABLE_TO_SYNCH = "RSEF6102"; + + // remote search messages + public static final String MSG_REMOTE_SEARCH_INVALID_REGEX = "RSEG1601"; + + // yantzi: artemis 6.0, offline messages + public static final String MSG_OFFLINE_CANT_CONNECT = "RSEC3001"; + + // file import/export messages + public static final String MSG_IMPORT_EXPORT_UNABLE_TO_USE_CONNECTION = "RSEF5101"; + public static final String MSG_IMPORT_EXPORT_UNEXPECTED_EXCEPTION = "RSEF5102"; + + // jar export messages + public static final String MSG_REMOTE_JAR_EXPORT_OVERWRITE_FILE = "RSEF5103"; +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemPageCompleteListener.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemPageCompleteListener.java new file mode 100644 index 00000000000..3d996dedcfa --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemPageCompleteListener.java @@ -0,0 +1,34 @@ +/******************************************************************************** + * Copyright (c) 2003, 2006 IBM Corporation. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Initial Contributors: + * The following IBM employees contributed to the Remote System Explorer + * component that contains this file: David McKnight, Kushal Munir, + * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, + * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. + * + * Contributors: + * {Name} (company) - description of contribution. + ********************************************************************************/ + +package org.eclipse.rse.ui; +/** + * This is used in forms that are used within dialogs and pages, and + * specifically with {@link org.eclipse.rse.ui.SystemBaseForm}. + * It allows the dialog or page to be called back when the form code calls + * setPageComplete, a method within the form class. This way the diaog or + * page can themselves call their own setPageComplete method. + */ +public interface ISystemPageCompleteListener +{ + /** + * The callback method. + * This is called whenever setPageComplete is called by the form code. + * @see {@link SystemBaseForm#addPageCompleteListener(ISystemPageCompleteListener)} + */ + public void setPageComplete(boolean complete); + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemPreferencesConstants.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemPreferencesConstants.java new file mode 100644 index 00000000000..663d5a7f4ab --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemPreferencesConstants.java @@ -0,0 +1,93 @@ +/******************************************************************************** + * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Initial Contributors: + * The following IBM employees contributed to the Remote System Explorer + * component that contains this file: David McKnight, Kushal Munir, + * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, + * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. + * + * Contributors: + * {Name} (company) - description of contribution. + ********************************************************************************/ + +package org.eclipse.rse.ui; +/** + * Keys into preferences bundle. + */ +public interface ISystemPreferencesConstants +{ + + // root + public static final String ROOT = "org.eclipse.rse.preferences."; + + // keys + public static final String SYSTEMTYPE = ROOT + "systemtype"; + public static final String SYSTEMTYPE_VALUES = ROOT + "systemtype.info"; + public static final String USERIDPERKEY = ROOT + "useridperkey"; + public static final String USERIDKEYS = ROOT + "userid.keys"; + public static final String SHOWFILTERPOOLS = ROOT + "filterpools.show"; + public static final String ACTIVEUSERPROFILES = ROOT + "activeuserprofiles"; + public static final String QUALIFY_CONNECTION_NAMES= ROOT + "qualifyconnectionnames"; + public static final String ORDER_CONNECTIONS = ROOT + "order.connections"; + public static final String HISTORY_FOLDER = ROOT + "history.folder"; + public static final String HISTORY_QUALIFIED_FOLDER= ROOT + "history.qualified.folder"; + public static final String SHOWHIDDEN = ROOT + "showhidden"; + public static final String SHOWNEWCONNECTIONPROMPT = ROOT + "shownewconnection"; + public static final String REMEMBER_STATE = ROOT + "rememberState"; + public static final String USE_DEFERRED_QUERIES = ROOT + "useDeferredQueries"; + public static final String RESTORE_STATE_FROM_CACHE = ROOT + "restoreStateFromCache"; + public static final String CASCADE_UDAS_BYPROFILE = ROOT + "uda.cascade"; + public static final String FILETRANSFERMODEDEFAULT = ROOT + "filetransfermodedefault"; + public static final String DAEMON_AUTOSTART = ROOT + "daemon.autostart"; + public static final String DAEMON_PORT = ROOT + "daemon.port"; + + public static final String LIMIT_CACHE = ROOT + "limit.cache"; + public static final String MAX_CACHE_SIZE = ROOT + "max.cache.size"; + + public static final String DOSUPERTRANSFER = ROOT + "dosupertransfer"; + public static final String SUPERTRANSFER_ARC_TYPE = ROOT + "supertransfer.archivetype"; + + public static final String DOWNLOAD_BUFFER_SIZE = ROOT + "download.buffer.size"; + public static final String UPLOAD_BUFFER_SIZE = ROOT + "upload.buffer.size"; + + public static final String VERIFY_CONNECTION = ROOT + "verify.connection"; + + // DEFAULTS + public static final boolean DEFAULT_SHOWFILTERPOOLS = false; + public static final boolean DEFAULT_QUALIFY_CONNECTION_NAMES = false; + public static final String DEFAULT_SYSTEMTYPE = ""; + public static final String DEFAULT_USERID = ""; + //DKM public static final String DEFAULT_ACTIVEUSERPROFILES = "Team;Private"; + public static final String DEFAULT_ACTIVEUSERPROFILES = "Team"; + + public static final String DEFAULT_ORDER_CONNECTIONS = ""; + public static final String DEFAULT_HISTORY_FOLDER = ""; + public static final boolean DEFAULT_SHOW_HIDDEN = true; + public static final boolean DEFAULT_SHOWNEWCONNECTIONPROMPT = true; + public static final boolean DEFAULT_REMEMBER_STATE = true; // changed in R2. Phil + public static final boolean DEFAULT_RESTORE_STATE_FROM_CACHE = true; // yantzi: artemis 6.0 + public static final boolean DEFAULT_CASCADE_UDAS_BYPROFILE = false; + public static final int DEFAULT_FILETRANSFERMODE = 0; + + public static final String DEFAULT_TEAMPROFILE = "Team"; + + public static final int FILETRANSFERMODE_BINARY = 0; + public static final int FILETRANSFERMODE_TEXT = 1; + + public static final boolean DEFAULT_DAEMON_AUTOSTART = false; + public static final int DEFAULT_DAEMON_PORT = 4300; + + public static final boolean DEFAULT_LIMIT_CACHE = false; + public static final String DEFAULT_MAX_CACHE_SIZE = "512"; + + public static final String DEFAULT_SUPERTRANSFER_ARCHIVE_TYPE = "zip"; + public static final boolean DEFAULT_DOSUPERTRANSFER = true; + + public static final int DEFAULT_DOWNLOAD_BUFFER_SIZE = 4; + + public static final boolean DEFAULT_VERIFY_CONNECTION = true; +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemRenameTarget.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemRenameTarget.java new file mode 100644 index 00000000000..f02c0eb561a --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemRenameTarget.java @@ -0,0 +1,41 @@ +/******************************************************************************** + * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Initial Contributors: + * The following IBM employees contributed to the Remote System Explorer + * component that contains this file: David McKnight, Kushal Munir, + * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, + * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. + * + * Contributors: + * {Name} (company) - description of contribution. + ********************************************************************************/ + +package org.eclipse.rse.ui; +import org.eclipse.jface.viewers.ISelectionProvider; + + +/** + * Any UI part that supports the common rename action can implement + * this to enable the rename popup menu action, supplied by the system explorer view. + */ +public interface ISystemRenameTarget extends ISelectionProvider +{ + /** + * Return true if rename should even be shown in the popup menu + */ + public boolean showRename(); + /** + * Return true if rename should be enabled based on your current selection. + */ + public boolean canRename(); + /** + * Actually do the rename of currently selected items. + * The array of new names matches the currently selected items. + * Return true if it worked. Return false if it didn't (you display msg), or throw an exception (framework displays msg) + */ + public boolean doRename(String[] newNames); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemStringsInputAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemStringsInputAction.java new file mode 100644 index 00000000000..4137d69160e --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemStringsInputAction.java @@ -0,0 +1,28 @@ +/******************************************************************************** + * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Initial Contributors: + * The following IBM employees contributed to the Remote System Explorer + * component that contains this file: David McKnight, Kushal Munir, + * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, + * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. + * + * Contributors: + * {Name} (company) - description of contribution. + ********************************************************************************/ + +package org.eclipse.rse.ui; +/** + * + */ +public interface ISystemStringsInputAction +{ + /** + * Set the list of existing filter strings to help with validation. + * Called when launched from WorkWithList widget + */ + public void setExistingStrings(String[] existingStrings, boolean caseSensitive); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemThemeConstants.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemThemeConstants.java new file mode 100644 index 00000000000..54afdfa3fc3 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemThemeConstants.java @@ -0,0 +1,37 @@ +/******************************************************************************** + * Copyright (c) 2006 IBM Corporation. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Initial Contributors: + * The following IBM employees contributed to the Remote System Explorer + * component that contains this file: David McKnight, Kushal Munir, + * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, + * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. + * + * Contributors: + * {Name} (company) - description of contribution. + ********************************************************************************/ + +package org.eclipse.rse.ui; + +/** + * This interface should be used to maintain all constants related to colors and fonts + * that are settable by the user through preferences + */ +public interface ISystemThemeConstants { + + // color constants used for messages + public static final String MESSAGE_ERROR_COLOR = "MESSAGE_ERROR_COLOR"; + public static final String MESSAGE_WARNING_COLOR = "MESSAGE_WARNING_COLOR" ; + public static final String MESSAGE_INFORMATION_COLOR = "MESSAGE_INFORMATION_COLOR"; + + // color constants used by Remote Commnds view + public static final String REMOTE_COMMANDS_VIEW_BG_COLOR = "REMOTE_COMMANDS_VIEW_BG_COLOR"; + public static final String REMOTE_COMMANDS_VIEW_FG_COLOR = "REMOTE_COMMANDS_VIEW_FG_COLOR"; + public static final String REMOTE_COMMANDS_VIEW_PROMPT_COLOR = "REMOTE_COMMANDS_VIEW_PROMPT_COLOR"; + + // font constant used by Remote Commands view + public static final String REMOTE_COMMANDS_VIEW_FONT = "REMOTE_COMMANDS_VIEW_FONT"; +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemVerifyListener.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemVerifyListener.java new file mode 100644 index 00000000000..e5d2363a249 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemVerifyListener.java @@ -0,0 +1,33 @@ +/******************************************************************************** + * Copyright (c) 2005, 2006 IBM Corporation. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Initial Contributors: + * The following IBM employees contributed to the Remote System Explorer + * component that contains this file: David McKnight, Kushal Munir, + * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, + * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. + * + * Contributors: + * {Name} (company) - description of contribution. + ********************************************************************************/ + +package org.eclipse.rse.ui; +/** + * @author mjberger + * This is used in forms that are used within dialogs and pages, and + * specifically with {@link org.eclipse.rse.ui.IBMBaseServerLauncherForm}. + * It allows the dialog or page to be called back when the form code calls + * verify, a method within the form class. This way the diaog or + * page can update their error messages if there are any. + */ +public interface ISystemVerifyListener +{ + /** + * The callback method. + * This is called whenever verify is called by the form code. + */ + public void handleVerifyComplete(); +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/MassagerAddQuotes.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/MassagerAddQuotes.java new file mode 100644 index 00000000000..93006be85c3 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/MassagerAddQuotes.java @@ -0,0 +1,86 @@ +/******************************************************************************** + * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Initial Contributors: + * The following IBM employees contributed to the Remote System Explorer + * component that contains this file: David McKnight, Kushal Munir, + * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, + * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. + * + * Contributors: + * {Name} (company) - description of contribution. + ********************************************************************************/ + +package org.eclipse.rse.ui; + +/** + * This massager will take a string an add quotes to it by + * wrapping the string in the quote character and doubling + * any interior instances of the quote character. + */ +public class MassagerAddQuotes implements ISystemMassager { + + + + private char quote = '\''; + + /** + * Construct a new instance of the massager. This instance + * assumes the quote character is the apostrophe '\''. + */ + public MassagerAddQuotes() { + super(); + } + + /** + * Construct a new instance of the massager. This instance + * uses the supplied character as the quoting character. + * + * @param quote the quote character to use in quoting strings + */ + public MassagerAddQuotes(char quote) { + this.quote = quote; + } + + /** + * Quotes the string by surround the original string with + * the quote character and doubling any internal occurences of + * the character. + * + * @param text the string to be quoted + * @return the quoted string + * @see org.eclipse.rse.ui.ISystemMassager#massage(String) + */ + public String massage(String text) { + + char[] chars = text.toCharArray(); + + /* determine the number of extra quotes needed */ + int n = 0; + for (int i = 0; i < chars.length; i++) { + if (chars[i] == quote) { + n++; + } + } + n += 2; + + /* Allocate and move the characters into the buffer */ + StringBuffer buf = new StringBuffer(chars.length + n); + buf.append(quote); + for (int i = 0; i < chars.length; i++) { + if (chars[i] == quote) { + buf.append(quote); + } + buf.append(chars[i]); + } + buf.append(quote); + + return buf.toString(); + } + + + +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/MassagerFoldCase.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/MassagerFoldCase.java new file mode 100644 index 00000000000..761b4ad2544 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/MassagerFoldCase.java @@ -0,0 +1,110 @@ +/******************************************************************************** + * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Initial Contributors: + * The following IBM employees contributed to the Remote System Explorer + * component that contains this file: David McKnight, Kushal Munir, + * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, + * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. + * + * Contributors: + * {Name} (company) - description of contribution. + ********************************************************************************/ + +package org.eclipse.rse.ui; +/** + * This massager folds the input text into either uppercase or lowercase, + * depending on the value pass to the constructor or setter. + *
+ * Note by default this also trims the + */ +public class MassagerFoldCase implements ISystemMassager +{ + + private boolean uppercase; + private boolean trim; + + /** + * Constructor using uppercase as the case direction + */ + public MassagerFoldCase() + { + this(true); + } + /** + * Constructor using given case direction + * @param foldToUpperCase - whether to fold to uppercase (true) or lowercase (false). + */ + public MassagerFoldCase(boolean foldToUpperCase) + { + super(); + setFoldToUpperCase(foldToUpperCase); + setTrimBlanks(true); + } + + /** + * Toggle whether to fold to uppercase or lowercase + * @param foldToUpperCase - whether to fold to uppercase (true) or lowercase (false). + */ + public void setFoldToUpperCase(boolean foldToUpperCase) + { + this.uppercase = foldToUpperCase; + } + /** + * Toggle whether to trim blanks for not + * @param trimBlanks - whether to trim blanks (true) or leave them (false). + */ + public void setTrimBlanks(boolean trimBlanks) + { + this.trim = trimBlanks; + } + + /** + * Return property about whether to fold to uppercase or lowercase + * @return true if folder to uppercase, false if folded to lowercaese + */ + public boolean getFoldToUpperCase() + { + return uppercase; + } + /** + * Return property about whether to trim blanks for not + * @return true if blanks are trimmed + */ + public boolean getTrimBlanks() + { + return trim; + } + /** + * @see org.eclipse.rse.ui.ISystemMassager#massage(String) + */ + public String massage(String text) + { + if (text == null) + return null; + if (trim) + text = text.trim(); + if (uppercase) + return toUpperCase(text); + else + return toLowerCase(text); + } + + /** + * Overrridable method that actually does the uppercasing + */ + protected String toUpperCase(String input) + { + return input.toUpperCase(); + } + /** + * Overrridable method that actually does the lowercasing + */ + protected String toLowerCase(String input) + { + return input.toLowerCase(); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/MassagerFoldCaseOutsideQuotes.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/MassagerFoldCaseOutsideQuotes.java new file mode 100644 index 00000000000..f87d2773b40 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/MassagerFoldCaseOutsideQuotes.java @@ -0,0 +1,197 @@ +/******************************************************************************** + * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Initial Contributors: + * The following IBM employees contributed to the Remote System Explorer + * component that contains this file: David McKnight, Kushal Munir, + * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, + * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. + * + * Contributors: + * {Name} (company) - description of contribution. + ********************************************************************************/ + +package org.eclipse.rse.ui; +/** + * This massager folds the input text into either uppercase or lowercase, + * but ONLY for those portions of the string that are not inside delimiters. + *
+ * The default delimiter characters checked for are single or double quote characters, but this + * can be changed by a setter method. When any of the delimiter characters are + * first found we enter delimited (non-folding) mode, until the same + * non-escaped delimiter character is found. + *
+ * This massager assumes an imbedded delimiter is denoted by a doubled up + * delimiter. If this is not the case, a setter can be used for the escape + * character. + *
+ * This massager takes more time than the MassageFoldCaseUnlessQuoted massager,
+ * as that one just checks if the entire string is delimited, while this one
+ * attempts to check for ranges of delimiting.
+ */
+public class MassagerFoldCaseOutsideQuotes extends MassagerFoldCase
+{
+
+ private static final char[] DEFAULT_DELIMITERS = {'\"', '\''};
+ private char[] delimiters;
+ private char escape = ' ';
+
+ /**
+ * Constructor using uppercase and using single and double quotes as delimiters
+ */
+ public MassagerFoldCaseOutsideQuotes()
+ {
+ this(true, DEFAULT_DELIMITERS);
+ }
+ /**
+ * Constructor using given case direction, using single and double quotes as delimiters
+ * @param foldToUpperCase - whether to fold to uppercase (true) or lowercase (false).
+ */
+ public MassagerFoldCaseOutsideQuotes(boolean foldToUpperCase)
+ {
+ this(foldToUpperCase, DEFAULT_DELIMITERS);
+ }
+ /**
+ * Constructor using given case direction, using given delimiters
+ * @param foldToUpperCase - whether to fold to uppercase (true) or lowercase (false).
+ * @param delimiters - chars to trigger delimited mode. Delimited sections are not folded.
+ */
+ public MassagerFoldCaseOutsideQuotes(boolean foldToUpperCase, char[] delimiters)
+ {
+ super(foldToUpperCase);
+ setDelimiters(delimiters);
+ }
+
+ /**
+ * Set the delimiter characters
+ * @param delimiters - chars to trigger delimited mode. Delimited sections are not folded.
+ */
+ public void setDelimiters(char[] delimiters)
+ {
+ this.delimiters = delimiters;
+ }
+ /**
+ * Set the escape character used for denoted an imbedded delimiter. By default, it is assumed
+ * a doubled up delimiter is used for this.
+ * @param escapeChar - char that escapes the delimiter. Eg '\'
+ */
+ public void setEscapeCharacter(char escapeChar)
+ {
+ this.escape = escapeChar;
+ }
+
+ /**
+ * Get the delimiter characters
+ */
+ public char[] getDelimiters()
+ {
+ return delimiters;
+ }
+ /**
+ * Get the escape character
+ */
+ public char getEscapeCharacter()
+ {
+ return escape;
+ }
+
+ /**
+ * Overrridable method that actually does the uppercasing
+ */
+ protected String toUpperCase(String input)
+ {
+ if ((input==null) || (input.length() == 0))
+ return input;
+ else if (!hasAnyDelimiters(input)) // no delimit characters?
+ return input.toUpperCase(); // fold it all!
+ else
+ return doFolding(input, true);
+ }
+ /**
+ * Overrridable method that actually does the lowercasing
+ */
+ protected String toLowerCase(String input)
+ {
+ if ((input==null) || (input.length() == 0))
+ return input;
+ else if (!hasAnyDelimiters(input)) // no delimit characters?
+ return input.toLowerCase(); // fold it all!
+ else
+ return doFolding(input, false);
+ }
+ /**
+ * Check for existence of any delimiters
+ */
+ protected boolean hasAnyDelimiters(String input)
+ {
+ boolean hasAny = false;
+ for (int idx=0; !hasAny && (idx
+ * Also, since while we are at it, this overloaded method also sets a given ArmListener
+ * to each menu item, perhaps for the purpose of displaying tooltip text.
+ * It makes sense to do this when doing mnemonics because both must be done for every menu item
+ * with text and must be done exactly once for each.
+ *
+ * Call this after populating the menu.
+ */
+ public void setMnemonicsAndArmListener(Menu menu, ArmListener listener)
+ {
+ MenuItem[] children = menu.getItems();
+ if ((children != null) && (children.length>0))
+ {
+ MenuItem currChild = null;
+ for (int idx=0; idx < children.length; idx++)
+ {
+ currChild = children[idx];
+ String text = currChild.getText();
+ if ((text!=null)&&(text.length()>0))
+ {
+ int mnemonicIndex = text.indexOf(MNEMONIC_CHAR);
+ if (mnemonicIndex < 0) // bad things happen when setting mnemonics twice!
+ {
+ Image image = currChild.getImage();
+ currChild.setText(setUniqueMnemonic(text));
+ if (image != null)
+ currChild.setImage(image);
+ currChild.addArmListener(listener);
+ }
+ else
+ // hmm, already has a mnemonic char. Either it is an Eclipse/BP-supplied action, or we have been here before.
+ // The distinction is important as want to add an Arm listener, but only once!
+ {
+ // for now we do the brute force ugly thing...
+ Image image = currChild.getImage();
+
+ // need to adjust any action that already has this mnemonic
+ char c = text.charAt(mnemonicIndex + 1);
+
+ // anything already have this?
+ if (!isUniqueMnemonic(c))
+ {
+ // if so, we need to adjust existing action
+ for (int n = 0; n < idx; n++)
+ {
+ MenuItem oChild = children[n];
+ String oText = oChild.getText();
+ char oldN = getMnemonic(oText);
+ if (oldN == c)
+ {
+ // this one now needs to change
+ String cleanText = removeMnemonic(oText);
+ oChild.setText(setUniqueMnemonic(cleanText));
+ }
+ }
+ }
+
+ text = removeAndFreeMnemonic(text);
+ currChild.setText(setUniqueMnemonic(text));
+ if (image != null)
+ currChild.setImage(image);
+ currChild.removeArmListener(listener); // just in case
+ currChild.addArmListener(listener);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Set if the mnemonics are for a preference page
+ * Preference pages already have a few buttons with mnemonics set by Eclipse
+ * We have to make sure we do not use the ones they use
+ */
+ public Mnemonics setOnPreferencePage(boolean page)
+ {
+ this.onPrefPage = page;
+ return this;
+ }
+
+ /**
+ * Set if the mnemonics are for a wizard page
+ * Wizard pages already have a few buttons with mnemonics set by Eclipse
+ * We have to make sure we do not use the ones they use
+ */
+ public Mnemonics setOnWizardPage(boolean page)
+ {
+ this.onWizardPage = page;
+ return this;
+ }
+
+ /**
+ * Set whether to apply mnemonics to labels preceding text fields, combos and inheritable entry fields.
+ * This is for consistency with Eclipse. Only set to
+ * May be used to populate a dialog or a wizard page or properties page.
+ * Often we need to support multiple ways to edit the same thing, and we need to
+ * abstract out the client area. This base class puts some structure around these
+ * abstractions. Note we don't extend Composite. Rather the subclass will create
+ * and return the composite in createContents(). This offers us more flexibility
+ * in how/where this is used.
+ *
+ * For error checking, subclasses should simply call setPageComplete whenever they
+ * do error checking (such as in response to an event). This will then call any
+ * interested listeners who have registered via {@link #addPageCompleteListener(ISystemPageCompleteListener)}.
+ * Error messages should be set via {@link #showErrorMessage(SystemMessage)}.
+ */
+
+public abstract class SystemBaseForm
+ implements Listener, ISystemConnectionWizardErrorUpdater //, ISystemMessages
+{
+
+ private ISystemMessageLine msgLine;
+ private Shell shell;
+ private Object inputObject, outputObject;
+ private Vector pageCompleteListeners;
+ private boolean complete;
+ protected Vector verifyListeners;
+ protected boolean alreadyNotified;
+
+ /**
+ * Constructor.
+ * @deprecated You should now use the constructor that takes a shell.
+ * @param msgLine A GUI widget capable of writing error messages to.
+ */
+ public SystemBaseForm(ISystemMessageLine msgLine)
+ {
+ this.msgLine = msgLine;
+ }
+ /**
+ * Constructor.
+ * @param shell The parent shell.
+ * @param msgLine A GUI widget capable of writing error messages to.
+ */
+ public SystemBaseForm(Shell shell, ISystemMessageLine msgLine)
+ {
+ this.msgLine = msgLine;
+ this.shell = shell;
+ }
+
+ /**
+ * Often the message line is null at the time of instantiation, so we have to call this after
+ * it is created.
+ */
+ public void setMessageLine(ISystemMessageLine msgLine)
+ {
+ this.msgLine = msgLine;
+ }
+ /**
+ * Return the message line as set via setMessageLine
+ */
+ public ISystemMessageLine getMessageLine()
+ {
+ return msgLine;
+ }
+ /**
+ * Occassionally we don't know the shell at constructor time, so we need to be able to set it later
+ */
+ public void setShell(Shell shell)
+ {
+ this.shell = shell;
+ }
+ /**
+ * Return the shell as set via setShell(Shell)
+ */
+ public Shell getShell()
+ {
+ return shell;
+ }
+ /**
+ * Set the input object. This is usually set to the current selection, from where
+ * the dialog/page is launched. This matches similar inputObject support in the
+ * RSE classes for dialogs and wizards.
+ * Intercepted so we can direct appends to certain groups into appropriate cascading submenus.
+ *
+ * @param groupName group to append to. See {@link org.eclipse.rse.ui.ISystemContextMenuConstants}.
+ * @param action action to append.
+ */
+ public void appendToGroup(String groupName, IAction action)
+ {
+ if (!checkForSpecialGroup(groupName, action, true))
+ if (groupName != null)
+ mgr.appendToGroup(groupName, action);
+ else
+ mgr.add(action);
+ }
+ /**
+ * Method declared on IContributionManager.
+ * Append a submenu to the menu.
+ *
+ * Intercepted so we can direct appends to certain groups into appropriate cascading submenus.
+ *
+ * @param groupName group to append to. See {@link org.eclipse.rse.ui.ISystemContextMenuConstants}.
+ * @param submenu submenu to append.
+ */
+ public void appendToGroup(String groupName, IContributionItem menuOrSeparator)
+ {
+ if (!checkForSpecialGroup(groupName, menuOrSeparator, true))
+ if (groupName != null)
+ mgr.appendToGroup(groupName, menuOrSeparator);
+ else
+ mgr.add(menuOrSeparator);
+ }
+
+ /**
+ * Method declared on IContributionManager.
+ * Prepend an action to the menu.
+ *
+ * Intercepted so we can direct appends to certain groups into appropriate cascading submenus.
+ *
+ * @param groupName group to append to. See {@link org.eclipse.rse.ui.ISystemContextMenuConstants}.
+ * @param action action to prepend.
+ */
+ public void prependToGroup(String groupName, IAction action)
+ {
+ if (!checkForSpecialGroup(groupName, action, false))
+ mgr.prependToGroup(groupName, action);
+ }
+ /**
+ * Method declared on IContributionManager.
+ * Prepend a submenu to the menu.
+ *
+ * Intercepted so we can direct appends to certain groups into appropriate cascading submenus.
+ *
+ * @param groupName group to append to. See {@link org.eclipse.rse.ui.ISystemContextMenuConstants}.
+ * @param submenu submenu to append.
+ */
+ public void prependToGroup(String groupName, IContributionItem subMenu)
+ {
+ if (!checkForSpecialGroup(groupName, subMenu, true))
+ mgr.prependToGroup(groupName, subMenu);
+ }
+
+ /**
+ * Add a separator.
+ * HOPEFULLY THIS IS NEVER CALLED. RATHER, BY USING GROUPS AND DECIDING PER GROUP IF THERE
+ * SHOULD BE SEPARATORS, WE AVOID HARDCODING SEPARATORS LIKE THIS.
+ */
+ public void addSeparator()
+ {
+ mgr.add(new Separator());
+ }
+
+ /**
+ * Special helper that intelligently adds system framework actions
+ * @param menuGroup default menuGroup to add to, if action doesn't contain an explicit location
+ * @param action action to add to the menu
+ */
+ public void add(String menuGroup, IAction action)
+ {
+ if (action instanceof SystemBaseSubMenuAction)
+ appendToGroup(getMenuGroup(action,menuGroup),
+ ((SystemBaseSubMenuAction)action).getSubMenu());
+ else if (!(action instanceof SystemSeparatorAction))
+ appendToGroup(getMenuGroup(action,menuGroup),action);
+ else // hopefully we don't have these!
+ appendToGroup(menuGroup, new Separator()); // add a separator, which is an IContributionItem
+ }
+
+ private String getMenuGroup(IAction action, String defaultGroup)
+ {
+ if ( (action instanceof ISystemAction) &&
+ (((ISystemAction)action).getContextMenuGroup()!=null) )
+ return ((ISystemAction)action).getContextMenuGroup();
+ else
+ return defaultGroup;
+ }
+
+ private boolean checkForSpecialGroup(String groupName, IAction action, boolean add)
+ {
+ boolean takenCareOf = false;
+ IMenuManager subMenu = getSpecialSubMenu(groupName);
+ if (subMenu != null)
+ {
+ takenCareOf = true;
+ if (action instanceof SystemSeparatorAction)
+ {
+ subMenu.add(new Separator());
+ if (((SystemSeparatorAction)action).isRealAction())
+ subMenu.add(action);
+ }
+ else
+ subMenu.add(action);
+ }
+
+ return takenCareOf;
+ }
+
+ private boolean checkForSpecialGroup(String groupName, IContributionItem contribution, boolean add)
+ {
+ boolean takenCareOf = false;
+ IMenuManager subMenu = getSpecialSubMenu(groupName);
+ if (subMenu != null)
+ {
+ takenCareOf = true;
+ subMenu.add(contribution);
+ }
+ return takenCareOf;
+ }
+
+ private IMenuManager getSpecialSubMenu(String groupName)
+ {
+ IMenuManager subMenu = null;
+ menuCreated = false;
+ if (groupName!=null)
+ {
+ if (groupName.equals(GROUP_NEW))
+ {
+ if (newSubMenu == null)
+ {
+ newSubMenu = (new SystemCascadingNewAction()).getSubMenu();
+ mgr.appendToGroup(GROUP_NEW, newSubMenu);
+ menuCreated = true;
+ }
+ subMenu = newSubMenu;
+ }
+ /*
+ else if (groupName.equals(GROUP_GOTO))
+ {
+ if (gotoSubMenu == null)
+ {
+ gotoSubMenu = (new SystemCascadingGoToAction()).getSubMenu();
+ mgr.appendToGroup(GROUP_GOTO, gotoSubMenu);
+ menuCreated = true;
+ }
+ subMenu = gotoSubMenu;
+ }
+ */
+ else if (groupName.equals(GROUP_EXPANDTO))
+ {
+ if (expandtoSubMenu == null)
+ {
+ expandtoSubMenu = (new SystemCascadingExpandToAction()).getSubMenu();
+ mgr.appendToGroup(GROUP_EXPANDTO, expandtoSubMenu);
+ menuCreated = true;
+ }
+ subMenu = expandtoSubMenu;
+ }
+ else if (groupName.equals(GROUP_OPENWITH))
+ {
+ if (openwithSubMenu == null)
+ {
+ openwithSubMenu = (new SystemCascadingOpenWithAction()).getSubMenu();
+ mgr.appendToGroup(GROUP_OPENWITH, openwithSubMenu);
+ menuCreated = true;
+ }
+ subMenu = openwithSubMenu;
+ }
+ else if (groupName.equals(GROUP_BROWSEWITH))
+ {
+ if (browsewithSubMenu == null)
+ {
+ browsewithSubMenu = (new SystemCascadingBrowseWithAction()).getSubMenu();
+ mgr.appendToGroup(GROUP_BROWSEWITH, browsewithSubMenu);
+ menuCreated = true;
+ }
+ subMenu = browsewithSubMenu;
+ }
+ else if (groupName.equals(GROUP_COMPAREWITH))
+ {
+ if (comparewithSubMenu == null)
+ {
+ comparewithSubMenu = (new SystemCascadingCompareWithAction()).getSubMenu();
+ mgr.appendToGroup(GROUP_COMPAREWITH, comparewithSubMenu);
+ menuCreated = true;
+ }
+ subMenu = comparewithSubMenu;
+ }
+ else if (groupName.equals(GROUP_REPLACEWITH))
+ {
+ if (replacewithSubMenu == null)
+ {
+ replacewithSubMenu = (new SystemCascadingReplaceWithAction()).getSubMenu();
+ mgr.appendToGroup(GROUP_REPLACEWITH, replacewithSubMenu);
+ menuCreated = true;
+ }
+ subMenu = replacewithSubMenu;
+ }
+ else if (groupName.equals(GROUP_WORKWITH))
+ {
+ if (workwithSubMenu == null)
+ {
+ workwithSubMenu = (new SystemCascadingWorkWithAction()).getSubMenu();
+ mgr.appendToGroup(GROUP_WORKWITH, workwithSubMenu);
+ menuCreated = true;
+ }
+ subMenu = workwithSubMenu;
+ }
+ else if (groupName.equals(GROUP_VIEWER_SETUP))
+ {
+ if (viewSubMenu == null)
+ {
+ viewSubMenu = (new SystemCascadingViewAction()).getSubMenu();
+ mgr.appendToGroup(GROUP_VIEWER_SETUP, viewSubMenu);
+ menuCreated = true;
+ }
+ subMenu = viewSubMenu;
+ }
+ else if (groupName.equals(GROUP_STARTSERVER))
+ {
+ if (serverSubMenu == null)
+ {
+ serverSubMenu = (new SystemCascadingRemoteServersAction()).getSubMenu();
+ mgr.appendToGroup(GROUP_STARTSERVER, serverSubMenu);
+ menuCreated = true;
+ }
+ subMenu = serverSubMenu;
+ }
+ }
+ return subMenu;
+ }
+
+ public IMenuManager getSpecialSubMenuByMenuID(String menuID)
+ {
+ IMenuManager subMenu = null;
+ String groupName = null;
+ menuCreated = false;
+ if (menuID!=null)
+ {
+ if (menuID.equals(MENU_NEW))
+ groupName = GROUP_NEW;
+ else if (menuID.equals(MENU_GOTO))
+ groupName = GROUP_GOTO;
+ else if (menuID.equals(MENU_EXPANDTO))
+ groupName = GROUP_EXPANDTO;
+ else if (menuID.equals(MENU_OPENWITH))
+ groupName = GROUP_OPENWITH;
+ else if (menuID.equals(MENU_BROWSEWITH))
+ groupName = GROUP_BROWSEWITH;
+ else if (menuID.equals(MENU_COMPAREWITH))
+ groupName = GROUP_COMPAREWITH;
+ else if (menuID.equals(MENU_REPLACEWITH))
+ groupName = GROUP_REPLACEWITH;
+ else if (menuID.equals(MENU_WORKWITH))
+ groupName = GROUP_WORKWITH;
+ else if (menuID.equals(MENU_STARTSERVER))
+ groupName = GROUP_STARTSERVER;
+
+ if (groupName != null)
+ subMenu = getSpecialSubMenu(groupName);
+ }
+ return subMenu;
+ }
+
+ public boolean wasMenuCreated()
+ {
+ return menuCreated;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemProfileForm.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemProfileForm.java
new file mode 100644
index 00000000000..60074902fa7
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemProfileForm.java
@@ -0,0 +1,263 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.model.ISystemProfile;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
+import org.eclipse.rse.ui.messages.ISystemMessageLine;
+import org.eclipse.rse.ui.validators.ISystemValidator;
+import org.eclipse.rse.ui.validators.ValidatorProfileName;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+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.Listener;
+import org.eclipse.swt.widgets.Text;
+
+
+/**
+ * A reusable form for prompting for profile information,
+ * in new or update mode.
+ *
+ * May be used to populate a dialog or a wizard page.
+ */
+
+public class SystemProfileForm
+ implements Listener, ISystemMessages
+{
+
+ // GUI widgets
+ protected Label profileLabel;
+ protected Control verbage;
+ //protected Combo profileCombo;
+ protected Text profileName;
+ protected ISystemMessageLine msgLine;
+ // validators
+ protected ISystemValidator nameValidator;
+ protected Object caller;
+ protected boolean callerInstanceOfWizardPage, callerInstanceOfSystemPromptDialog;
+
+ // max lengths
+ protected static final int profileNameLength = ValidatorProfileName.MAX_PROFILENAME_LENGTH;
+ // state
+ protected ISystemProfile profile;
+ private boolean showVerbage = true;
+ private SystemMessage errorMessage = null;
+
+ /**
+ * Constructor.
+ * @param msgLine A GUI widget capable of writing error messages to.
+ * @param caller. The wizardpage or dialog hosting this form.
+ * @param profile. The existing profile being updated, or null for New action.
+ * @param showVerbage. Specify true to show first-time-user verbage.
+ */
+ public SystemProfileForm(ISystemMessageLine msgLine, Object caller, ISystemProfile profile, boolean showVerbage)
+ {
+ this.msgLine = msgLine;
+ this.caller = caller;
+ this.profile = profile;
+ this.showVerbage = showVerbage;
+ callerInstanceOfWizardPage = (caller instanceof WizardPage);
+ callerInstanceOfSystemPromptDialog = (caller instanceof SystemPromptDialog);
+ nameValidator = SystemPlugin.getTheSystemRegistry().getSystemProfileManager().getProfileNameValidator(profile);
+ }
+
+ /**
+ * Often the message line is null at the time of instantiation, so we have to call this after
+ * it is created.
+ */
+ public void setMessageLine(ISystemMessageLine msgLine)
+ {
+ this.msgLine = msgLine;
+ }
+
+ /**
+ * Call this to specify a validator for the profile name. It will be called per keystroke.
+ * If not specified, a default is used.
+ */
+ public void setNameValidators(ISystemValidator v)
+ {
+ nameValidator = v;
+ }
+ /**
+ * Call to initialize the profile name in create mode. Must be called after createContents
+ */
+ public void setProfileName(String name)
+ {
+ if ((name != null) && (profileName != null))
+ profileName.setText(name);
+ }
+
+ /**
+ * CreateContents is the one method that must be overridden from the parent class.
+ * In this method, we populate an SWT container with widgets and return the container
+ * to the caller (JFace). This is used as the contents of this page.
+ * @param parent The parent composite
+ */
+ public Control createContents(Composite parent)
+ {
+ // Inner composite
+ int nbrColumns = 2;
+ Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns);
+
+ // VERBAGE LABEL
+ if (showVerbage)
+ {
+ verbage = SystemWidgetHelpers.createVerbage(
+ composite_prompts, SystemResources.RESID_PROFILE_PROFILENAME_VERBAGE, nbrColumns, false, 200);
+ SystemWidgetHelpers.createLabel(composite_prompts, "", nbrColumns); // dummy line for spacing
+ }
+
+ // NAME PROMPT
+ String temp = SystemWidgetHelpers.appendColon(SystemResources.RESID_PROFILE_PROFILENAME_LABEL);
+ profileLabel = SystemWidgetHelpers.createLabel(composite_prompts, temp);
+ profileName = SystemWidgetHelpers.createTextField(
+ composite_prompts,this,
+ SystemResources.RESID_PROFILE_PROFILENAME_TIP);
+ profileName.setTextLimit(profileNameLength);
+
+ if (profile != null)
+ profileName.setText(profile.getName());
+
+ profileName.setFocus();
+
+
+ // add keystroke listeners...
+ profileName.addModifyListener(
+ new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ validateNameInput();
+ }
+ }
+ );
+ return composite_prompts;
+ }
+
+ /**
+ * Return control to recieve initial focus
+ */
+ public Control getInitialFocusControl()
+ {
+ return profileName;
+ }
+
+ /**
+ * Default implementation to satisfy Listener interface. Does nothing.
+ */
+ public void handleEvent(Event evt) {}
+
+ /**
+ * Verifies all input.
+ * @return true if there are no errors in the user input
+ */
+ public boolean verify()
+ {
+ SystemMessage errMsg = null;
+ Control controlInError = null;
+ if (msgLine != null)
+ msgLine.clearErrorMessage();
+ errMsg = validateNameInput();
+ if (errMsg != null)
+ controlInError = profileName;
+ else
+ {
+ }
+ if (errMsg != null)
+ {
+ controlInError.setFocus();
+ showErrorMessage(errMsg);
+ }
+ return (errMsg == null);
+ }
+
+ // --------------------------------- //
+ // METHODS FOR EXTRACTING USER DATA ...
+ // --------------------------------- //
+ /**
+ * Return user-entered profile Name.
+ * Call this after finish ends successfully.
+ */
+ public String getProfileName()
+ {
+ return profileName.getText().trim();
+ }
+ /**
+ * Display error message or clear error message
+ */
+ private void showErrorMessage(SystemMessage msg)
+ {
+ if (msgLine != null)
+ if (msg != null)
+ msgLine.setErrorMessage(msg);
+ else
+ msgLine.clearErrorMessage();
+ else
+ System.out.println("MSGLINE NULL. TRYING TO WRITE MSG " + msg);
+ }
+
+ // ---------------------------------------------
+ // METHODS FOR VERIFYING INPUT PER KEYSTROKE ...
+ // ---------------------------------------------
+ /**
+ * This hook method is called whenever the text changes in the input field.
+ * The default implementation delegates the request to an
+ * To help with initial sizing, the widthHint of the second is set to 100.
+ *
+ * If you need a handle to the prompting label, immediately call {@link #getLastLabel()}
+ *
+ * @param parent composite to put the fields into. Will be added sequentially
+ * @param label
+ * @param tooltip
+ * @param wantBorder true if a border is desired around the second label (the value vs the prompt)
+ * @return the second label created. Use setText to place the value in it.
+ */
+ public static Label createLabeledLabel(Composite parent, String label, String tooltip, boolean wantBorder) {
+ previousLabel = createLabel(parent, label);
+ String text = previousLabel.getText();
+ previousLabel.setText(appendColon(text));
+ ((GridData) previousLabel.getLayoutData()).grabExcessHorizontalSpace = false;
+ Label label2 = createLabel(parent, "", 1, wantBorder);
+ ((GridData) label2.getLayoutData()).grabExcessHorizontalSpace = true;
+ ((GridData) label2.getLayoutData()).widthHint = 100;
+ setToolTipText(label2, tooltip);
+ return label2;
+ }
+
+ /**
+ * Return the prompting label from the last call to createLabeledXXXX.
+ * These methods only return the second control, but we sometimes need access to the label.
+ */
+ public static Label getLastLabel() {
+ return previousLabel;
+ }
+
+ /**
+ * Create a spacer line. No widget returned so we have the freedom to change it over time
+ */
+ public static void createSpacerLine(Composite parent, int columnSpan, boolean wantBorder) {
+ int style = SWT.LEFT; // | SWT.SEPARATOR;
+ if (wantBorder)
+ style |= SWT.BORDER | SWT.LINE_SOLID;
+ if (columnSpan > 1)
+ style |= SWT.WRAP;
+ Label label = new Label(parent, style);
+ //label.setText(text);
+ GridData data = new GridData();
+ data.horizontalSpan = columnSpan;
+ data.horizontalAlignment = GridData.FILL;
+ //data.grabExcessHorizontalSpace = true;
+ label.setLayoutData(data);
+ }
+
+
+
+ /**
+ * Creates a widget for displaying text verbage that spans multiple lines. Takes resolved text vs resource bundle id.
+ * The returned widget is not typed so we can easily change it in the future if we decide on a better widget.
+ * @param parent Composite to put the field into.
+ * @param text String is the verbage text to display
+ * @param span Horizontal span
+ * @param border true if you want a border around the verbage
+ * @param widthHint number of pixels to limit width to before wrapping. 200 is a reasonable number
+ * @return the Label widget, in case you want to tweak it
+ */
+ public static Label createVerbage(Composite parent, String text, int span, boolean border, int widthHint) {
+ Label widget = new Label(parent, border ? (SWT.LEFT | SWT.WRAP | SWT.BORDER) : (SWT.LEFT | SWT.WRAP));
+ widget.setText(text);
+ GridData data = new GridData();
+ data.horizontalSpan = span;
+ data.horizontalAlignment = GridData.FILL;
+ data.widthHint = widthHint;
+ data.grabExcessHorizontalSpace = true;
+ widget.setLayoutData(data);
+ return widget;
+ }
+
+ /**
+ * Create a labeled verbage (wrappable label) field and insert it into a GridLayout, and assign tooltip text.
+ * After calling this, you must call setText on the result to set its contents.
+ *
+ * If you need a handle to the prompting label, immediately call {@link #getLastLabel()}
+ *
+ * @param parent composite to put the field into.
+ * @param labelText
+ * @param tooltip
+ * @param span Horizontal span
+ * @param border true if you want a border around the verbage
+ * @param widthHint number of pixels to limit width to before wrapping. 200 is a reasonable number
+ * @return Label created.
+ */
+ public static Label createLabeledVerbage(Composite parent, String labelText, String tooltip, int span, boolean border, int widthHint) {
+ previousLabel = createLabel(parent, appendColon(labelText));
+ Label verbage = createVerbage(parent, labelText, span, border, widthHint);
+ setToolTipText(previousLabel, tooltip);
+ setToolTipText(verbage, tooltip);
+ return verbage;
+ }
+
+ /**
+ * Create a label to show a command string as it is being built-up in a dialog
+ * This version uses a default height of 3 normal lines.
+ */
+ public static Label createCommandStatusLine(Composite parent, int horizontalSpan) {
+ return createCommandStatusLine(parent, horizontalSpan, 3);
+ }
+
+ /**
+ * Create a label to show a command string as it is being built-up in a dialog.
+ * This version allows you specify how tall to make it, in terms of normal line height.
+ */
+ public static Label createCommandStatusLine(Composite parent, int horizontalSpan, int heightInLines) {
+ Label commandSoFar = new Label(parent, SWT.LEFT | SWT.WRAP);
+ int dx = commandSoFar.getBounds().height;
+ //System.out.println("Default label height = " + dx); ALWAYS 0!
+ if (dx == 0)
+ //dx = 12; // what else?
+ dx = 15; // d47377
+ GridData data = new GridData();
+ data.horizontalSpan = horizontalSpan;
+ data.horizontalAlignment = GridData.FILL;
+ //data.widthHint = 300;
+ data.heightHint = heightInLines * dx;
+ data.verticalAlignment = GridData.VERTICAL_ALIGN_BEGINNING;
+ //data.grabExcessVerticalSpace = true;
+ commandSoFar.setLayoutData(data);
+ return commandSoFar;
+ }
+
+ /**
+ * Create a text field and insert it into a GridLayout.
+ * Assign the listener to the passed in implementer of Listener.
+ * @param GridLayout composite to put the field into.
+ * @param Listener object to listen for events. Can be null.
+ */
+ public static Text createTextField(Composite parent, Listener listener) {
+ Text text = new Text(parent, SWT.SINGLE | SWT.BORDER);
+ if (listener != null)
+ text.addListener(SWT.Modify, listener);
+ GridData data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ data.grabExcessHorizontalSpace = true;
+ data.widthHint = 150;
+ data.verticalAlignment = GridData.CENTER;
+ data.grabExcessVerticalSpace = false;
+ text.setLayoutData(data);
+ return text;
+ }
+
+ /**
+ * Create a text field and insert it into a GridLayout, and assign tooltip text.
+ * Assign the listener to the passed in implementer of Listener.
+ * @param parent composite to put the field into.
+ * @param listener object to listen for events. Can be null.
+ * @param tooltip tooltip text
+ */
+ public static Text createTextField(Composite parent, Listener listener, String toolTip) {
+ Text text = createTextField(parent, listener);
+ setToolTipText(text, toolTip);
+ return text;
+ }
+
+ /**
+ * Create a labeled text field and insert it into a GridLayout, and assign tooltip text.
+ * Assign the listener to the passed in implementer of Listener.
+ *
+ * If you need a handle to the prompting label, immediately call {@link #getLastLabel()}
+ *
+ * @param parent composite to put the field into.
+ * @param listener object to listen for events. Can be null.
+ * @param labelText the label
+ * @param tooltip the tooltip
+ * @return TextField created.
+ */
+ public static Text createLabeledTextField(Composite parent, Listener listener, String labelText, String tooltip) {
+ previousLabel = createLabel(parent, appendColon(labelText));
+ Text entry = createTextField(parent, listener, tooltip);
+ setToolTipText(previousLabel, tooltip);
+ return entry;
+ }
+
+ /**
+ * Create a readonly text field and insert it into a GridLayout.
+ * @param GridLayout composite to put the field into.
+ */
+ public static Text createReadonlyTextField(Composite parent) {
+ Text text = new Text(parent, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
+ text.setEnabled(false);
+ GridData data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ data.grabExcessHorizontalSpace = true;
+ data.widthHint = 150; // defect 45789
+ data.verticalAlignment = GridData.CENTER;
+ data.grabExcessVerticalSpace = false;
+ text.setLayoutData(data);
+ return text;
+ }
+
+ /**
+ * Create a readonly text field and insert it into a GridLayout,
+ * and assign tooltip text.
+ * @param parent composite to put the field into.
+ * @param tooltip
+ */
+ public static Text createReadonlyTextField(Composite parent, String toolTip)
+ {
+ Text text = createReadonlyTextField(parent);
+ setToolTipText(text, toolTip);
+ return text;
+ }
+
+ /**
+ * Create a labeled readonly text field and insert it into a GridLayout, and assign tooltip text.
+ * Assign the listener to the passed in implementer of Listener.
+ *
+ * If you need a handle to the prompting label, immediately call {@link #getLastLabel()}
+ *
+ * @param parent composite to put the field into.
+ * @param text the label
+ * @param tooltip the tooltip
+ * @return TextField created.
+ */
+ public static Text createLabeledReadonlyTextField(Composite parent, String text, String tooltip) {
+ previousLabel = createLabel(parent, appendColon(text));
+ Text entry = createReadonlyTextField(parent, tooltip);
+ setToolTipText(previousLabel, tooltip);
+ return entry;
+ }
+
+ /**
+ * Create a multiline text field and insert it into a GridLayout.
+ * Assign the listener to the passed in implementer of Listener.
+ * @param GridLayout composite to put the field into.
+ * @param Listener object to listen for events. Can be null.
+ */
+ public static Text createMultiLineTextField(Composite parent, Listener listener, int heightHint) {
+ Text text = new Text(parent, SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL);
+
+ if (listener != null)
+ text.addListener(SWT.Modify, listener);
+
+ GridData data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ data.grabExcessHorizontalSpace = true;
+ data.heightHint = heightHint;
+ data.verticalAlignment = GridData.CENTER;
+ data.grabExcessVerticalSpace = false;
+ text.setLayoutData(data);
+ return text;
+ } // end createMultiLineTextField()
+
+ /**
+ * Create a multiline labeled text field and insert it into a GridLayout, and assign tooltip text.
+ * Assign the listener to the passed in implementer of Listener.
+ * @param parent composite to put the field into.
+ * @param listener object to listen for events. Can be null.
+ * @param labelString the label
+ * @param tooltip the tooltip
+ * @return TextField created.
+ */
+ public static Text createMultiLineLabeledTextField(Composite parent, Listener listener, String labelString, String tooltip, int heightHint) {
+ Label label = createLabel(parent, appendColon(labelString));
+ Text text = createMultiLineTextField(parent, listener, heightHint);
+ setToolTipText(label, tooltip);
+ return text;
+ } // end createMultiLineLabeledTextField()
+
+ /**
+ * Creates a new checkbox instance and sets the default
+ * layout data. Spans 1 column horizontally.
+ * Assign the listener to the passed in implementer of Listener.
+ * @param group composite to put the checkbox into.
+ * @param label to display in the checkbox.
+ * @param listener object to listen for events. Can be null.
+ */
+ public static Button createCheckBox(Composite group, String label, Listener listener) {
+ return createCheckBox(group, 1, label, listener);
+ }
+
+ /**
+ * Creates a new checkbox instance with the given horizontal span and sets the default
+ * layout data.
+ * Assign the listener to the passed in implementer of Listener.
+ * @param group composite to put the checkbox into.
+ * @param horizontalSpan number of columns this checkbox is to span.
+ * @param label to display in the checkbox.
+ * @param listener object to listen for events. Can be null.
+ */
+ public static Button createCheckBox(Composite group, int horizontalSpan, String label, Listener listener) {
+ Button button = new Button(group, SWT.CHECK | SWT.LEFT);
+ button.setText(label);
+ if (listener != null)
+ button.addListener(SWT.Selection, listener);
+ GridData data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ data.grabExcessHorizontalSpace = true;
+ data.horizontalSpan = horizontalSpan;
+ button.setLayoutData(data);
+ return button;
+ }
+
+ /**
+ * Creates a new checkbox instance and sets the default
+ * layout data, and sets the tooltip text.
+ * Assign the listener to the passed in implementer of Listener.
+ * @param group composite to put the checkbox into.
+ * @param listener object to listen for events. Can be null.
+ * @param label the label
+ * @param tooltip the tooltip
+ */
+ public static Button createCheckBox(Composite group, Listener listener, String label, String tooltip)
+ {
+ Button button = createCheckBox(group, label, listener);
+ setToolTipText(button, tooltip);
+ return button;
+ }
+
+ /**
+ * Creates a new checkbox instance with the given horizontal span and sets the default
+ * layout data, and sets the tooltip text.
+ * Assign the listener to the passed in implementer of Listener.
+ * @param group composite to put the checkbox into.
+ * @param horizontalSpan number of columns to span.
+ * @param listener object to listen for events. Can be null.
+ * @param label the label
+ * @param tooltip the tooltip
+ */
+ public static Button createCheckBox(Composite group, int horizontalSpan, Listener listener, String label, String tooltip)
+ {
+ Button button = createCheckBox(group, horizontalSpan, label, listener);
+ setToolTipText(button, tooltip);
+ return button;
+ }
+
+ /**
+ * Creates a new radiobutton instance and sets the default
+ * layout data.
+ * Assign the listener to the passed in implementer of Listener.
+ * @param group composite to put the button into.
+ * @param label to display in the button
+ * @param listener object to listen for events. Can be null.
+ */
+ public static Button createRadioButton(Composite group, String label, Listener listener) {
+ Button button = new Button(group, SWT.RADIO | SWT.LEFT);
+ button.setText(label);
+ if (listener != null)
+ button.addListener(SWT.Selection, listener);
+ GridData data = new GridData();
+ // following 2 lines added in R2 by Phil, to be consistent with checkboxes
+ data.horizontalAlignment = GridData.FILL;
+ data.grabExcessHorizontalSpace = true;
+ button.setLayoutData(data);
+ return button;
+ }
+
+ /**
+ * Creates a new radiobutton instance and sets the default
+ * layout data, and assigns tooltip text.
+ * Assign the listener to the passed in implementer of Listener.
+ * @param group composite to put the button into.
+ * @param listener object to listen for events. Can be null.
+ * @param label the label
+ * @param tooltip the tooltip
+ */
+ public static Button createRadioButton(Composite group, Listener listener, String label, String tooltip)
+ {
+ Button button = createRadioButton(group, label, listener);
+ setToolTipText(button, tooltip);
+ return button;
+ }
+
+ /**
+ * Creates a new radiobutton instance and sets the default
+ * layout data, and assigns tooltip text.
+ * Assign the listener to the passed in implementer of Listener.
+ * @param group composite to put the button into.
+ * @param listener object to listen for events. Can be null.
+ * @param label the label
+ */
+ public static Button createRadioButton(Composite group, Listener listener, String label)
+ {
+ Button button = createRadioButton(group, label, listener);
+ return button;
+ }
+
+ /**
+ * Creates a new pushbutton instance with an image, vs text.
+ * SWT does not allow both image and text on a button.
+ * Assign the listener to the passed in implementer of Listener.
+ * @param group The composite to put the button into.
+ * @param image The image to display in the button
+ * @param listener The object to listen for events. Can be null.
+ */
+ public static Button createImageButton(Composite group, Image image, Listener listener) {
+ Button button = new Button(group, SWT.PUSH);
+ button.setImage(image);
+ if (listener != null)
+ button.addListener(SWT.Selection, listener);
+ GridData data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ data.grabExcessHorizontalSpace = true;
+ button.setLayoutData(data);
+ return button;
+ }
+
+ /**
+ * Creates a new pushbutton instance and sets the default
+ * layout data.
+ * Assign the listener to the passed in implementer of Listener.
+ * @param group composite to put the button into.
+ * @param label to display in the button
+ * @param listener object to listen for events. Can be null.
+ */
+ public static Button createPushButton(Composite group, String label, Listener listener) {
+ Button button = new Button(group, SWT.PUSH);
+ button.setText(label);
+ if (listener != null)
+ button.addListener(SWT.Selection, listener);
+ GridData data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ data.grabExcessHorizontalSpace = true;
+ button.setLayoutData(data);
+ return button;
+ }
+
+ /**
+ * Creates a new pushbutton instance and sets the default
+ * layout data, and assign tooltip text
+ * Assign the listener to the passed in implementer of Listener.
+ * @param group composite to put the button into.
+ * @param label to display in the button
+ * @param listener object to listen for events. Can be null.
+ * @param tooltip the tooltip
+ */
+ public static Button createPushButton(Composite group, String label, Listener listener, String tooltip) {
+ Button button = createPushButton(group, label, listener);
+ setToolTipText(button, tooltip);
+ return button;
+ }
+
+ /**
+ * This one takes the resource bundle key and appends "label" and "tooltip" to it to
+ * get the label and tooltip text.
+ * @param group composite to put the button into.
+ * @param listener object to listen for events. Can be null.
+ * @param label the label
+ * @param tooltip the tooltip
+ */
+ public static Button createPushButton(Composite group, Listener listener, String label, String tooltip)
+ {
+ Button button = createPushButton(group, label, listener);
+ setToolTipText(button, tooltip);
+ return button;
+ }
+
+ /**
+ * Creates a new "Browse..." pushbutton instance and sets the default
+ * layout data.
+ * Assign the listener to the passed in implementer of Listener.
+ * @param group composite to put the button into.
+ * @param listener object to listen for events. Can be null.
+ */
+ public static Button createBrowseButton(Composite group, Listener listener)
+ {
+ String label = SystemResources.BUTTON_BROWSE;
+ return createPushButton(group, label, listener);
+ }
+ /**
+ * Creates a new "Browse..." pushbutton instance and sets the default
+ * layout data, with tooltip text.
+ * Assign the listener to the passed in implementer of Listener.
+ * @param group composite to put the button into.
+ * @param listener object to listen for events. Can be null.
+ * @param bundle ResourceBundle of tooltip text
+ * @param id bundle key for tooltip text
+ * @deprecated
+ */
+ public static Button createBrowseButton(Composite group, Listener listener, String tooltip) {
+ String label = SystemResources.BUTTON_BROWSE;
+ return createPushButton(group, label, listener, tooltip);
+ }
+
+ /**
+ * Creates a new listbox instance and sets the default
+ * layout data.
+ * Assign the listener to the passed in implementer of Listener.
+ * @param group composite to put the button into.
+ * @param label to display above the list box (can be null).
+ * @param listener object to listen for events. Can be null.
+ * @param multiSelect true if this is to be a multiple selection list. False for single selection.
+ */
+ public static List createListBox(Composite group, String label, Listener listener, boolean multiSelect) {
+ return createListBox(group, label, listener, multiSelect, 1);
+ }
+
+ /**
+ * Creates a new listbox instance and sets the default
+ * layout data.
+ * Assign the listener to the passed in implementer of Listener.
+ * @param group composite to put the button into.
+ * @param label to display above the list box (can be null).
+ * @param listener object to listen for events. Can be null.
+ * @param multiSelect true if this is to be a multiple selection list. False for single selection.
+ * @param columnSpan number of columns this should span
+ */
+ public static List createListBox(Composite group, String label, Listener listener, boolean multiSelect, int columnSpan) {
+ Composite composite_list = null;
+ if (label != null) {
+ composite_list = createComposite(group, 1);
+ ((GridLayout) composite_list.getLayout()).marginWidth = 0;
+ GridData data = new GridData();
+ data.horizontalSpan = columnSpan;
+ data.grabExcessVerticalSpace = true;
+ data.verticalAlignment = GridData.FILL;
+ data.grabExcessHorizontalSpace = true;
+ data.horizontalAlignment = GridData.FILL;
+ composite_list.setLayoutData(data);
+ previousLabel = createLabel(composite_list, label);
+ }
+ int styles = SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER;
+ List list = new List((composite_list != null) ? composite_list : group, multiSelect ? (SWT.MULTI | styles) : (SWT.SINGLE | styles));
+ if (listener != null)
+ list.addListener(SWT.Selection, listener);
+ GridData data = new GridData();
+ data.widthHint = 100;
+ data.heightHint = 150;
+ data.grabExcessHorizontalSpace = true;
+ data.horizontalAlignment = GridData.FILL;
+ data.grabExcessVerticalSpace = true;
+ data.verticalAlignment = GridData.FILL;
+ list.setLayoutData(data);
+ return list;
+ }
+
+ /**
+ * Creates a new listbox instance and sets the default
+ * layout data.
+ * Assign the listener to the passed in implementer of Listener.
+ * @param group composite to put the button into.
+ * @param label to display above the list box (can be null).
+ * @param listener object to listen for events. Can be null.
+ * @param multiSelect true if this is to be a multiple selection list. False for single selection.
+ * @param tooltip the tooltip
+ */
+ public static List createListBox(Composite group, String label, Listener listener, boolean multiSelect, String tooltip) {
+ List list = createListBox(group, label, listener, multiSelect);
+ setToolTipText(list, tooltip);
+ return list;
+ }
+
+ /**
+ * Creates a new listbox instance and sets the default
+ * layout data.
+ * Assign the listener to the passed in implementer of Listener.
+ * @param group composite to put the button into.
+ * @param listener object to listen for events. Can be null.
+ * @param multiSelect true if this is to be a multiple selection list. False for single selection.
+ * @param label the label
+ * @param tooltip the tooltip
+ */
+ public static List createListBox(Composite group, Listener listener, boolean multiSelect, String label, String tooltip) {
+ List list = createListBox(group, label, listener, multiSelect);
+ setToolTipText(list, tooltip);
+ return list;
+ }
+
+ /**
+ * Creates a new combobox instance and sets the default
+ * layout data.
+ * Assign the listener to the passed in implementer of Listener.
+ * @param parent composite to put the button into.
+ * @param listener object to listen for selection events. Can be null.
+ * If you want to listen for modify events, call addListener(SWT.Modify,this) on your own.
+ */
+ public static Combo createCombo(Composite parent, Listener listener) {
+ Combo combo = createCombo(parent, SWT.DROP_DOWN);
+ if (listener != null)
+ combo.addListener(SWT.Selection, listener);
+ return combo;
+ }
+
+ /**
+ * private method for re-use
+ */
+ private static Combo createCombo(Composite parent, int style) {
+ Combo combo = new Combo(parent, style);
+ GridData data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ data.grabExcessHorizontalSpace = true;
+ data.widthHint = 150;
+ data.verticalAlignment = GridData.CENTER;
+ data.grabExcessVerticalSpace = false;
+ combo.setLayoutData(data);
+ return combo;
+ }
+
+ /**
+ * Creates a new combobox instance and sets the default
+ * layout data, with tooltip text.
+ * Assign the listener to the passed in implementer of Listener.
+ * @param parent composite to put the combo into.
+ * @param listener object to listen for selection events. Can be null.
+ * If you want to listen for modify events, call addListener(SWT.Modify,this) on your own.
+ * @param tooltip tooltip text
+ */
+ public static Combo createCombo(Composite parent, Listener listener, String toolTip)
+ {
+ Combo combo = createCombo(parent, listener);
+ setToolTipText(combo, toolTip);
+ return combo;
+ }
+
+ /**
+ * Create a labeled combo field and insert it into a GridLayout, and assign tooltip text.
+ * Assign the listener to the passed in implementer of Listener.
+ *
+ * If you need a handle to the prompting label, immediately call {@link #getLastLabel()}
+ *
+ * @param parent composite to put the field into.
+ * @param listener object to listen for selection events. Can be null.
+ * If you want to listen for modify events, call addListener(SWT.Modify,this) on your own.
+ * @param label the label text
+ * @param tooltip the tooltip for the combo field
+ * @return Combo created.
+ */
+ public static Combo createLabeledCombo(Composite parent, Listener listener, String label, String tooltip)
+ {
+ previousLabel = createLabel(parent, appendColon(label));
+ Combo entry = createCombo(parent, listener, tooltip);
+ setToolTipText(previousLabel, tooltip);
+ return entry;
+ }
+
+ /**
+ * Creates a new readonly combobox instance and sets the default
+ * layout data.
+ * Assign the listener to the passed in implementer of Listener.
+ * @param parent composite to put the button into.
+ * @param listener object to listen for selection events. Can be null.
+ * If you want to listen for modify events, call addListener(SWT.Modify,this) on your own.
+ */
+ public static Combo createReadonlyCombo(Composite parent, Listener listener) {
+ Combo combo = createCombo(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
+ if (listener != null)
+ combo.addListener(SWT.Selection, listener);
+ return combo;
+ }
+
+ /**
+ * Creates a new readonly combobox instance and sets the default
+ * layout data, with tooltip text.
+ * Assign the listener to the passed in implementer of Listener.
+ * @param parent composite to put the button into.
+ * @param listener object to listen for selection events. Can be null.
+ * If you want to listen for modify events, call addListener(SWT.Modify,this) on your own.
+ * @param tooltip
+ */
+ public static Combo createReadonlyCombo(Composite parent, Listener listener, String tooltip)
+ {
+ Combo combo = createReadonlyCombo(parent, listener);
+ setToolTipText(combo, tooltip);
+ return combo;
+ }
+
+ /**
+ * Create a labeled readonly combo field and insert it into a GridLayout, and assign tooltip text.
+ * Assign the listener to the passed in implementer of Listener.
+ *
+ * If you need a handle to the prompting label, immediately call {@link #getLastLabel()}
+ *
+ * @param parent composite to put the field into.
+ * @param listener object to listen for selection events. Can be null.
+ * If you want to listen for modify events, call addListener(SWT.Modify,this) on your own.
+ * @param labelText the label
+ * @param tooltip the tooltip
+ * @return Combo created.
+ */
+ public static Combo createLabeledReadonlyCombo(Composite parent, Listener listener, String labelText, String tooltip)
+ {
+ labelText = appendColon(labelText);
+ previousLabel = createLabel(parent, labelText);
+ Combo entry = createReadonlyCombo(parent, listener, tooltip);
+ setToolTipText(previousLabel, tooltip);
+ return entry;
+ }
+
+ /**
+ * Creates a new historical combobox instance and sets the default
+ * layout data, with tooltip text.
+ *
+ * Assign the listener to the passed in implementer of Listener.
+ *
+ * A historical combobox is one that persists its contents between sessions. The management
+ * of that persistence is handled for you!.
+ *
+ * @param parent composite to put the combo into.
+ * @param listener object to listen for selection events. Can be null.
+ * If you want to listen for modify events, call addListener(SWT.Modify,this) on your own.
+ * @param historykey the preferences key (any unique string) to use to persist this combo's history
+ * @param readonly true if this combo is to be readonly, forcing user to select from the history
+ * @param tooltip the tooltip
+ */
+ public static SystemHistoryCombo createHistoryCombo(Composite parent, SelectionListener listener, String historyKey, boolean readonly, String tooltip)
+ {
+ SystemHistoryCombo combo = new SystemHistoryCombo(parent, SWT.NULL, historyKey, readonly);
+ if (listener != null)
+ combo.addSelectionListener(listener);
+ boolean hasGridData = (combo.getLayoutData() != null) && (combo.getLayoutData() instanceof GridData);
+ //System.out.println("history combo griddata non-null? " + hasGridData);
+ int minwidth = 150;
+ if (!hasGridData) {
+ GridData data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ data.grabExcessHorizontalSpace = true;
+ data.widthHint = minwidth;
+ data.verticalAlignment = GridData.CENTER;
+ data.grabExcessVerticalSpace = false;
+ combo.setLayoutData(data);
+ } else {
+ ((GridData) combo.getLayoutData()).horizontalAlignment = GridData.FILL;
+ ((GridData) combo.getLayoutData()).grabExcessHorizontalSpace = true;
+ ((GridData) combo.getLayoutData()).widthHint = minwidth;
+ }
+ setToolTipText(combo, tooltip);
+ return combo;
+ }
+
+
+
+
+ /**
+ * Creates a new remote system connection combobox instance and sets the default
+ * layout data, with tooltip text.
+ *
+ * Assign the listener to the passed in implementer of Listener.
+ *
+ * A remote system connection combobox is one that allows users to select a connection. The connection
+ * list can be subsetted by system type, subsystem factory or subsystem factory category.
+ * It has a "Connection:" prompt in front of it and optionally a "New..." button beside it.
+ *
+ * @param parent composite to put the combo into.
+ * @param listener object to listen for selection events. Can be null.
+ * If you want to listen for modify events, call addSelectionListener(...) on your own.
+ * @param systemTypes array of system types to subset connection list by. Specify a single entry of '*' for
+ * all system types. Specify this OR specify factory OR specify factoryCategory
+ * OR specify factory Id
+ * @param factory the subsystem factory to subset connection list by. Only connections with a subsystem
+ * owned by this factory are listed. Specify this OR specify systemTypes OR specify factoryCategory
+ * OR specify factory Id
+ * @param factoryId the subsystem factory id to subset connection list by. Only connections with a
+ * subsystem owned by this factory are listed, where id is a string specified in the
+ * plugin.xml file for the subsystem factory extension point definition.
+ * Specify this OR specify factory OR specify systemTypes OR specify factory category
+ * @param factoryCategory the subsystem factory category to subset connection list by. Only connections with a
+ * subsystem owned by a factory of this category are listed, where category is a string specified in the
+ * plugin.xml file for the subsystem factory extension point definition.
+ * Specify this OR specify factory OR specify factory Id OR specify systemTypes
+ * @param defaultConnection the connection to pre-select. Can be null.
+ * @param horizontalSpan number of columns this should span
+ * @param newButton true if the combo is to have a "New..." button beside it
+ */
+ public static SystemHostCombo createConnectionCombo(Composite parent, SelectionListener listener, String[] systemTypes, ISubSystemConfiguration factory, String factoryId, String factoryCategory, IHost defaultConnection, int horizontalSpan, boolean newButton) {
+ SystemHostCombo combo = null;
+ if (systemTypes != null)
+ combo = new SystemHostCombo(parent, SWT.NULL, systemTypes, defaultConnection, newButton);
+ else if (factory != null)
+ combo = new SystemHostCombo(parent, SWT.NULL, factory, defaultConnection, newButton);
+ else if (factoryId != null)
+ combo = new SystemHostCombo(parent, SWT.NULL, defaultConnection, factoryId, newButton);
+ else if (factoryCategory != null)
+ combo = new SystemHostCombo(parent, SWT.NULL, defaultConnection, newButton, factoryCategory);
+ if (listener != null)
+ combo.addSelectionListener(listener);
+ boolean hasGridData = (combo.getLayoutData() != null) && (combo.getLayoutData() instanceof GridData);
+ //System.out.println("history directory griddata non-null? " + hasGridData);
+ int minwidth = 250; // todo: tweak this?
+ if (!hasGridData) {
+ GridData data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ data.grabExcessHorizontalSpace = true;
+ data.widthHint = minwidth;
+ data.verticalAlignment = GridData.CENTER;
+ data.grabExcessVerticalSpace = false;
+ data.horizontalSpan = horizontalSpan;
+ combo.setLayoutData(data);
+ } else {
+ ((GridData) combo.getLayoutData()).horizontalSpan = horizontalSpan;
+ ((GridData) combo.getLayoutData()).horizontalAlignment = GridData.FILL;
+ ((GridData) combo.getLayoutData()).grabExcessHorizontalSpace = true;
+ ((GridData) combo.getLayoutData()).widthHint = minwidth;
+ }
+ return combo;
+ }
+
+ /**
+ * Creates a readonly system type combination box.
+ * Does NOT create the leading prompt or anything except the combo.
+ */
+ public static Combo createSystemTypeCombo(Composite parent, Listener listener) {
+ return createSystemTypeCombo(parent, listener, null);
+ }
+
+ /**
+ * Creates a readonly system type combination box with the given system types.
+ * Does NOT create the leading prompt or anything except the combo.
+ */
+ public static Combo createSystemTypeCombo(Composite parent, Listener listener, String[] systemTypes) {
+ Combo combo = createReadonlyCombo(parent, listener, SystemResources.RESID_CONNECTION_SYSTEMTYPE_TIP);
+ String[] typeItems = ((systemTypes == null) ? SystemPlugin.getDefault().getSystemTypeNames(true) : // true ==> include "local"
+ systemTypes);
+ combo.setItems(typeItems);
+ combo.select(0);
+ return combo;
+ }
+
+ /**
+ * Creates a hostname combination box. It if prefilled with all previously specified hostnames
+ * for the given system type.
+ *
+ * Does NOT create the leading prompt or anything except the combo.
+ */
+ public static Combo createHostNameCombo(Composite parent, Listener listener, String systemType) {
+ //System.out.println("TipId: " + ISystemConstants.RESID_HOSTNAME_TIP);
+ Combo combo = createCombo(parent, listener, SystemResources.RESID_CONNECTION_HOSTNAME_TIP);
+ //System.out.println("Tip : " + combo.getToolTipText());
+ combo.setItems(SystemPlugin.getTheSystemRegistry().getHostNames(systemType));
+ combo.select(0);
+ return combo;
+ }
+
+
+
+
+
+ /**
+ * Create an entry field controlled by an inherit/override switch button
+ *
+ * After creating the widget, call setLocal to set initial state, and setInheritedText/setLocalText to set inherited/local text
+ * @param parent composite to put the button into.
+ * @param tooltip text for the toggle. Can be null
+ * @param tooltip text for the entry field. Can be null
+ * @return The text field widget
+ */
+ public static InheritableEntryField createInheritableTextField(Composite parent, String toggleToolTip, String entryToolTip)
+ {
+ InheritableEntryField entryField = new InheritableEntryField(parent, SWT.NULL);
+ if (toggleToolTip != null)
+ entryField.setToggleToolTipText(toggleToolTip);
+ if (entryToolTip != null)
+ entryField.setTextFieldToolTipText(entryToolTip);
+ return entryField;
+ }
+
+ /**
+ * Helper method to line up the leading prompts in a composite, taking
+ * into account composite prompts nested within.
+ */
+ public static void lineUpPrompts(Composite composite) {
+ //System.out.println("Inside lineUpPrompts:");
+ composite.layout(true);
+ // FIND SIZE OF FIRST LABEL IN FIRST COLUMN (WILL ALL BE SAME SIZE)...
+ Label firstLabel = getFirstColumnOneLabel(composite);
+ // FIND MAX SIZE OF FIRST LABEL IN ALL NESTED COMPOSITES (WILL ALL BE DIFFERENT SIZES)...
+ //System.out.println("Scanning nested composites:");
+ int nbrColumns = ((GridLayout) composite.getLayout()).numColumns;
+ Control[] childControls = composite.getChildren();
+ int maxNestedLabelWidth = 0;
+ int currColumn = 0;
+ if ((childControls != null) && (childControls.length > 0)) {
+ for (int idx = 0;(idx < childControls.length); idx++) {
+ int rem = currColumn % nbrColumns;
+ //System.out.println("...1.rem = " + rem);
+ if ((currColumn == 0) || (rem == 0)) {
+ if (childControls[idx] instanceof Composite) {
+ Label firstNestedLabel = getFirstColumnOneLabel((Composite) childControls[idx]);
+ if (firstNestedLabel != null) {
+ if (firstNestedLabel.getSize().x > maxNestedLabelWidth)
+ maxNestedLabelWidth = firstNestedLabel.getSize().x;
+ }
+ }
+ }
+ currColumn += ((GridData) childControls[idx].getLayoutData()).horizontalSpan;
+ }
+ //System.out.println("Max nested label size = " + maxNestedLabelWidth);
+ }
+
+ // DECIDE WHAT MAXIMUM WIDTH IS
+ int columnOneWidth = 0;
+ if (firstLabel != null)
+ columnOneWidth = firstLabel.getSize().x;
+ if (maxNestedLabelWidth > columnOneWidth)
+ columnOneWidth = maxNestedLabelWidth;
+ //System.out.println("Calculated column one width = " + columnOneWidth);
+ // APPLY NEW WIDTH TO FIRST COLUMN ONE LABEL
+ if (firstLabel != null)
+ ((GridData) firstLabel.getLayoutData()).widthHint = columnOneWidth;
+ // APPLY NEW WIDTH TO FIRST COLUMN ONE LABEL OF ALL NESTED COMPOSITES...
+ currColumn = 0;
+ if ((childControls != null) && (childControls.length > 0)) {
+ for (int idx = 0;(idx < childControls.length); idx++) {
+ int rem = currColumn % nbrColumns;
+ if ((currColumn == 0) || (rem == 0)) {
+ if (childControls[idx] instanceof Composite) {
+ Label firstNestedLabel = getFirstColumnOneLabel((Composite) childControls[idx]);
+ if (firstNestedLabel != null)
+ ((GridData) firstNestedLabel.getLayoutData()).widthHint = columnOneWidth;
+ }
+ }
+ currColumn += ((GridData) childControls[idx].getLayoutData()).horizontalSpan;
+ }
+ }
+ composite.layout(true);
+ }
+
+ /**
+ * Given a composite that has been layed out, return the first label found in the first column.
+ */
+ public static Label getFirstColumnOneLabel(Composite composite) {
+ //System.out.println("...Inside getFirstColumnOneLabel:");
+ int nbrColumns = ((GridLayout) composite.getLayout()).numColumns;
+ Control[] childControls = composite.getChildren();
+ Label firstLabel = null;
+ int currColumn = 0;
+ if ((childControls != null) && (childControls.length > 0)) {
+ for (int idx = 0;(firstLabel == null) && (idx < childControls.length); idx++) {
+ int rem = currColumn % nbrColumns;
+ //System.out.println("......0.rem = " + rem);
+ if ((currColumn == 0) || (rem == 0)) {
+ if (childControls[idx] instanceof Label) {
+ firstLabel = (Label) childControls[idx];
+ if (firstLabel.getText().trim().length() == 0)
+ firstLabel = null; // skip it. Only a filler.
+ }
+ }
+ currColumn += ((GridData) childControls[idx].getLayoutData()).horizontalSpan;
+ }
+ }
+ //if (firstLabel != null)
+ // System.out.println("...returning first label of '"+firstLabel.getText()+"', width = " + firstLabel.getSize().x);
+ //else
+ // System.out.println("...no first label found");
+ return firstLabel;
+ }
+
+ /**
+ * Given a Composite, this method walks all the children recursively and
+ * and sets the mnemonics uniquely for each child control where a
+ * mnemonic makes sense (eg, buttons).
+ * The letter/digit chosen for the mnemonic is unique for this Composite,
+ * so you should call this on as high a level of a composite as possible
+ * per Window.
+ * Call this after populating your controls.
+ * @return mnemonics object used for recording used-mnemonics. Use this
+ * as input to subsequent calls to setMnemonics for the same window/dialog.
+ */
+ public static Mnemonics setMnemonics(Composite parent) {
+ Mnemonics mnemonics = new Mnemonics(); // instance of this class to get unique mnemonics for composite and nested composites
+ mnemonics.setMnemonics(parent);
+ return mnemonics;
+ }
+
+ /**
+ * Same as above but also whether to apply mnemonics to labels preceding text fields, combos and inheritable entry fields.
+ */
+ public static Mnemonics setMnemonics(Composite parent, boolean applyToPrecedingLabels) {
+ Mnemonics mnemonics = new Mnemonics(); // instance of this class to get unique mnemonics for composite and nested composites
+ mnemonics.setApplyMnemonicsToPrecedingLabels(applyToPrecedingLabels);
+ mnemonics.setMnemonics(parent);
+ return mnemonics;
+ }
+
+ /**
+ * Same as above but specifically for wizard pages
+ */
+ public static Mnemonics setWizardPageMnemonics(Composite parent) {
+ Mnemonics mnemonics = new Mnemonics(); // instance of this class to get unique mnemonics for composite and nested composites
+ mnemonics.setOnWizardPage(true);
+ mnemonics.setMnemonics(parent);
+ return mnemonics;
+ }
+
+ /**
+ * Same as above but also whether to apply mnemonics to labels preceding text fields, combos and inheritable entry fields.
+ */
+ public static Mnemonics setWizardPageMnemonics(Composite parent, boolean applyToPrecedingLabels) {
+ Mnemonics mnemonics = new Mnemonics(); // instance of this class to get unique mnemonics for composite and nested composites
+ mnemonics.setOnWizardPage(true);
+ mnemonics.setApplyMnemonicsToPrecedingLabels(applyToPrecedingLabels);
+ mnemonics.setMnemonics(parent);
+ return mnemonics;
+ }
+
+ /**
+ * Same as above but specifically for preference pages
+ */
+ public static Mnemonics setPreferencePageMnemonics(Composite parent) {
+ Mnemonics mnemonics = new Mnemonics(); // instance of this class to get unique mnemonics for composite and nested composites
+ mnemonics.setOnPreferencePage(true);
+ mnemonics.setMnemonics(parent);
+ return mnemonics;
+ }
+
+ /**
+ * Same as above but also whether to apply mnemonics to labels preceding text fields, combos and inheritable entry fields.
+ */
+ public static Mnemonics setPreferencePageMnemonics(Composite parent, boolean applyToPrecedingLabels) {
+ Mnemonics mnemonics = new Mnemonics(); // instance of this class to get unique mnemonics for composite and nested composites
+ mnemonics.setOnPreferencePage(true);
+ mnemonics.setApplyMnemonicsToPrecedingLabels(applyToPrecedingLabels);
+ mnemonics.setMnemonics(parent);
+ return mnemonics;
+ }
+
+ /**
+ * Same as above but takes as input a previously populated mnemonics object,
+ * which records already-used mnemonics for whatever scope you want (a dialog usually).
+ */
+ public static Mnemonics setMnemonics(Mnemonics mnemonics, Composite parent) {
+ mnemonics.setMnemonics(parent);
+ return mnemonics;
+ }
+ /**
+ * Given an SWT Menu, "walk it" and automatically assign unique
+ * mnemonics for every menu item in it, and then for each
+ * submenu, do so for it too.
+ * @param the menubar to add mnemonics for
+ */
+ public static void setMnemonics(Menu menu) {
+ Mnemonics mnemonics = new Mnemonics(); // instance of this class to get unique mnemonics FOR THIS MENU ONLY
+ // walk the menu bar getting each menu...
+ MenuItem menuItems[] = menu.getItems();
+ for (int idx = 0; idx < menuItems.length; idx++) {
+ MenuItem currMenuItem = menuItems[idx];
+ // assign unique mnemonic from characters in menu text...
+ currMenuItem.setText(mnemonics.setUniqueMnemonic(currMenuItem.getText()));
+ // for a cascade or popup, this menuitem is itself a menu
+ Menu nestedMenu = currMenuItem.getMenu();
+ if (nestedMenu != null)
+ setMnemonics(nestedMenu);
+ } // end for all menus loop
+ } // end addMnemonicsForMenuBar
+
+ /**
+ * Given a Composite, this method walks all the children recursively and
+ * and sets the infopop help id for each child control where help
+ * makes sense (eg, buttons, combos, entry fields, lists, trees).
+ *
+ * Call this after populating your controls.
+ */
+ public static void setCompositeHelp(Composite parent, String helpID) {
+ //setCompositeHelp(parent, helpID, (Hashtable)null);
+ setHelp(parent, helpID);
+ }
+
+ /**
+ * Set the context id for a control on a view part
+ * @deprecated
+ */
+ public static void setHelp(Control c, IViewPart view, Object id) {
+ //ViewContextComputer comp = new ViewContextComputer(view, id);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(c, id.toString());
+ if (traceHelpIDs)
+ SystemBasePlugin.logInfo("Setting help id: " + id);
+ }
+
+ /**
+ * Set the context id for a control
+ */
+ public static void setHelp(Control c, String id) {
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(c, id);
+ }
+
+ /**
+ * Set the context id for an action
+ */
+ public static void setHelp(IAction c, String id) {
+ String[] ids = new String[1];
+ ids[0] = id;
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(c, id);
+ }
+
+ /**
+ * Set the context id for a menu item
+ */
+ public static void setHelp(MenuItem c, String id) {
+ String[] ids = new String[1];
+ ids[0] = id;
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(c, id);
+ //setHelp(c, ids);
+ }
+
+ private static char STANDARD_COLON = ':';
+ private static char WIDE_COLON = '\uFF1A';
+ /**
+ * Appends a colon to a label, if the label doesn't already end in a colon of the proper size.
+ * If the wrong size colon is already there, it strips it first.
+ * @param label
+ * @return the label ending with a colon of the appropriate size
+ */
+ public static String appendColon(String label) {
+ /* Added for Defect 47275 */
+ String result = label;
+ boolean append = false;
+ boolean strip = false;
+ Locale currentLocale = Locale.getDefault();
+ String language = currentLocale.getLanguage();
+ boolean cjk = language.equals("zh") || language.equals("ja") || language.equals("ko");
+ int n = result.length();
+ if (n > 0) {
+ char lastCharacter = label.charAt(n - 1);
+ if (cjk) {
+ strip = (lastCharacter == STANDARD_COLON);
+ append = (lastCharacter != WIDE_COLON);
+ } else {
+ strip = (lastCharacter == WIDE_COLON);
+ append = (lastCharacter != STANDARD_COLON);
+ }
+ } else {
+ strip = false;
+ append = true;
+ }
+ if (strip) {
+ result = result.substring(0, n - 1);
+ }
+ if (append) {
+ result += (cjk ? WIDE_COLON : STANDARD_COLON);
+ }
+ return result;
+ }
+
+
+
+
+ /**
+ * Set tooltip text
+ * If key does not end in "tooltip", then this is appended to it
+ */
+ private static void setToolTipText(Control widget, String tooltip) {
+ if (tooltip != null)
+ widget.setToolTipText(tooltip);
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/DisplayDialogAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/DisplayDialogAction.java
new file mode 100644
index 00000000000..6aecd17dd74
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/DisplayDialogAction.java
@@ -0,0 +1,60 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * DisplayDialogAction can be used to display a JFace Dialog when
+ * not running on the UI thread and no shell is availble. For example:
+ *
+ * The only method you must implement is {@link #run()}.
+ * You may optionally override {@link #getEnabled(Object[])}
+ *
+ * Convenience methods are:
+ *
+ * What this offers beyond the basic Action class:
+ * To use this dialog, subclass it and override the following methods In addition to the methods you must override, you can optionally call various methods to configure
+ * this action: Further, the code you write can use the properties captured by this action and retrievable by the getter methods
+ * supplied by this class.
+ * The default implementation of this method:
+ *
+ * The default is to return true if the selected element has no children. This is sufficient for most cases. However,
+ * in some cases it is not, such as for filter strings where we want to only enable OK if a filter is selected. It is
+ * possible that filter pools have no filters, so the default algorithm is not sufficient. In these cases the child class
+ * can override this method.
+ */
+ public boolean isValidTargetParent(SystemSimpleContentElement selectedElement)
+ {
+ return !selectedElement.hasChildren();
+ }
+
+
+ /**
+ * Required by parent. We use it to actually do the work.
+ */
+ protected Object getDialogValue(Dialog dlg)
+ {
+ targetContainer = getTargetContainer(dlg);
+ if (targetContainer != null)
+ {
+ boolean okToProceed = preCheckForCollision();
+ if (!okToProceed)
+ return null;
+ IRunnableContext runnableContext = getRunnableContext();
+ try
+ {
+ runnableContext.run(false,false,this); // inthread, cancellable, IRunnableWithProgress
+ if (copiedOk)
+ {
+ SystemMessage completeMsg = getCompletionMessage(targetContainer, oldNames, newNames);
+ if (completeMsg != null)
+ {
+ SystemMessageDialog msgDlg = new SystemMessageDialog(getShell(),completeMsg);
+ msgDlg.open();
+ }
+ }
+ }
+ catch (java.lang.reflect.InvocationTargetException exc) // unexpected error
+ {
+ showOperationMessage((Exception)exc.getTargetException(), getShell());
+ //throw (Exception) exc.getTargetException();
+ }
+ catch (Exception exc)
+ {
+ showOperationMessage(exc, getShell());
+ //throw exc;
+ }
+ }
+ return null;
+ }
+ /**
+ * Get an IRunnable context to show progress in. If there is currently a dialog or wizard up with
+ * a progress monitor in it, we will use this, else we will create a progress monitor dialog.
+ */
+ protected IRunnableContext getRunnableContext()
+ {
+ ISystemRegistry sr = SystemPlugin.getTheSystemRegistry();
+ IRunnableContext irc = sr.getRunnableContext();
+ if (irc == null)
+ irc = new ProgressMonitorDialog(getShell());
+ return irc;
+ }
+ /**
+ * Override this method if you supply your own copy/move target dialog.
+ * Return the user-selected target or null if cancelled
+ */
+ protected Object getTargetContainer(Dialog dlg)
+ {
+ SystemSimpleCopyDialog cpyDlg = (SystemSimpleCopyDialog)dlg;
+ Object targetContainer = null;
+ if (!cpyDlg.wasCancelled())
+ targetContainer = cpyDlg.getTargetContainer();
+ return targetContainer;
+ }
+
+ /**
+ * Do a pre-check for a collision situation.
+ * This really is only a problem for filter strings, when a name collision is fatal verus
+ * recoverable via a new-name prompt.
+ */
+ protected boolean preCheckForCollision()
+ {
+ boolean ok = true;
+ oldNames = getOldNames();
+ oldObjects = getOldObjects();
+ int steps = oldObjects.length;
+
+ String oldName = null;
+ Object oldObject = null;
+ for (int idx=0; ok && (idx
+ * @return true if there is no problem, false if there is a fatal collision
+ */
+ protected boolean preCheckForCollision(Shell shell, Object targetContainer,
+ Object oldObject, String oldName)
+ {
+ return true;
+ }
+
+ /**
+ * Called after all the copy/move operations end, be it successfully or not.
+ * Your opportunity to display completion or do post-copy selections/refreshes
+ */
+ public void copyComplete() {}
+
+ // ----------------------------------
+ // INTERNAL METHODS...
+ // ----------------------------------
+ /**
+ * Method required by IRunnableWithProgress interface.
+ * Allows execution of a long-running operation modally by via a thread.
+ * In our case, it runs the copy operation with a visible progress monitor
+ */
+ public void run(IProgressMonitor monitor)
+ throws java.lang.reflect.InvocationTargetException,
+ java.lang.InterruptedException
+ {
+ SystemMessage msg = getCopyingMessage();
+ runException = null;
+
+ try
+ {
+ //oldNames = getOldNames();
+ //oldObjects = getOldObjects();
+ int steps = oldObjects.length;
+ monitor.beginTask(msg.getLevelOneText(), steps);
+ copiedOk = true;
+ String oldName = null;
+ String newName = null;
+ Object oldObject = null;
+ newNames = new String[oldNames.length];
+ for (int idx=0; copiedOk && (idx This subclass of SystemBaseAction implements the run() method in a way optimized for the processing
+ * of dialogs: it calls an abstract method to create the dialog, then sets the input from the action's
+ * value (if set) or selection (otherwise) and opens the dialog. After, it calls an abstract method to
+ * extract the dialog's output object which is used to set this action's value, for the benefit of the
+ * caller.
+ * To use this dialog, subclass it and override the following methods In addition to the methods you must override, you can optionally call various methods to configure
+ * this action. In addition to those in the parent class, this class offers these configuration methods:
+ * Use this when the dialog itself will process all selected items at once.
+ *
+ * The default is false.
+ */
+ public void setProcessAllSelections(boolean all)
+ {
+ this.processAll = all;
+ }
+
+ // -----------------------------------------------------------
+ // OVERRIDABLE METHODS...
+ // -----------------------------------------------------------
+
+ /**
+ * This is the method called by the system when the user
+ * selects this action. This is a default implementation
+ * which:
+ *
+ * Please note that if NO ITEMS are selected, we will still call createDialog
+ * but not call setInput.
+ *
+ * To use this default implementation you must implement
+ * the createDialog method. Note we will also call
+ * dlg.setBlockOnOpen(true) on the returned dialog to
+ * force it to be modal.
+ */
+ public void run()
+ {
+ Shell shell = getShell();
+ if (shell == null)
+ SystemBasePlugin.logDebugMessage(this.getClass().getName(),"Warning: shell is null!");
+ Object currentSelection = null;
+ if (!getProcessAllSelections())
+ currentSelection = getFirstSelection();
+ else
+ currentSelection = getSelection();
+ boolean cancelled = false;
+
+ do
+ {
+ Dialog dlg = createDialog(getShell());
+ if (dlg == null)
+ return;
+ dlg.setBlockOnOpen(true);
+ Object dialogInputValue = currentSelection;
+ if (getValue() != null)
+ dialogInputValue = getValue();
+ if ((dialogInputValue != null) && (dlg instanceof ISystemPromptDialog))
+ {
+ ((ISystemPromptDialog)dlg).setInputObject(dialogInputValue);
+ }
+ if (dlgHelpId!=null)
+ {
+ if (dlg instanceof SystemPromptDialog)
+ ((SystemPromptDialog)dlg).setHelp(dlgHelpId);
+ else if (dlg instanceof SystemWizardDialog)
+ ((SystemWizardDialog)dlg).setHelp(dlgHelpId);
+ }
+ if (dlg instanceof SystemPromptDialog)
+ {
+ if (needsProgressMonitorSet)
+ ((SystemPromptDialog)dlg).setNeedsProgressMonitor(needsProgressMonitor);
+ }
+
+ int rc = dlg.open();
+
+ // if (rc != 0) NOT RELIABLE!
+ if (dlg instanceof SystemWizardDialog)
+ {
+ if (((SystemWizardDialog)dlg).wasCancelled())
+ cancelled = true;
+ //System.out.println("Testing cancelled state of SystemWizardDialog: " + cancelled);
+ }
+ else if (dlg instanceof SystemPromptDialog)
+ {
+ if (((SystemPromptDialog)dlg).wasCancelled())
+ cancelled = true;
+ //System.out.println("Testing cancelled state of SystemPromptDialog: " + cancelled);
+ }
+
+ if (!cancelled)
+ {
+ setValue(getDialogValue(dlg));
+
+ if ((currentSelection != null) && !getProcessAllSelections())
+ currentSelection = getNextSelection();
+ else if (currentSelection != null)
+ currentSelection = null;
+ }
+ else
+ setValue(null);
+ } while (!cancelled && (currentSelection != null));
+ }
+
+ // -----------------------------------------------------------
+ // ABSTRACT METHODS...
+ // -----------------------------------------------------------
+ /**
+ * If you decide to use the supplied run method as is,
+ * then you must override this method to create and return
+ * the dialog that is displayed by the default run method
+ * implementation.
+ *
+ * If you override actionPerformed with your own, then
+ * simply implement this to return null as it won't be used.
+ * @see #run()
+ */
+ protected abstract Dialog createDialog(Shell parent);
+ /**
+ * If you decide to use the supplied run method as is,
+ * then you must override this method to retrieve the data
+ * from the dialog. For SystemPromptDialog dialogs, this is simply
+ * a matter of returning dlg.getOutputObject();
+ *
+ * This is called by the run method after the dialog returns, and
+ * wasCancelled() is false. Callers of this object can subsequently
+ * retrieve this returned value by calling getValue. If you don't need
+ * to pass a value back to the caller of this action, simply return null
+ * from this method.
+ *
+ * @param dlg The dialog object, after it has returned from open.
+ */
+ protected abstract Object getDialogValue(Dialog dlg);
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemBaseDummyAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemBaseDummyAction.java
new file mode 100644
index 00000000000..d5099bff64d
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemBaseDummyAction.java
@@ -0,0 +1,31 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+
+/**
+ * A dummy "placeholder" action for submenus that will be dynamically populated
+ */
+public class SystemBaseDummyAction extends SystemBaseAction
+{
+
+
+ public SystemBaseDummyAction()
+ {
+ super("dummy", null);
+ setSelectionSensitive(false);
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemBaseSubMenuAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemBaseSubMenuAction.java
new file mode 100644
index 00000000000..cde645c72e5
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemBaseSubMenuAction.java
@@ -0,0 +1,475 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+import java.util.ResourceBundle;
+import java.util.Vector;
+
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.rse.ui.view.SystemViewMenuListener;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * Our framework is designed to allow actions to be added to popup menus.
+ * Sometimes, we want an expandable or cascading menu item for an action.
+ * That is what this class is designed for. It represents a populated submenu.
+ */
+public abstract class SystemBaseSubMenuAction
+ extends SystemBaseAction
+
+{
+
+ protected SystemSubMenuManager subMenu = null;
+ protected String actionLabel;
+ protected String menuID;
+ protected boolean createMenuEachTime = true;
+ protected boolean populateMenuEachTime = true;
+ private boolean dontCascade = false;
+ private boolean test;
+ private static final IAction[] EMPTY_ACTION_ARRAY = new IAction[0];
+
+ /**
+ * Constructor for SystemBaseSubMenuAction when there is an image
+ * @param label
+ * @param tooltip
+ * @param image The image to display for this action
+ * @param shell The owning shell. If you pass null now, be sure to call setShell later
+ *
+ * @deprecated use fields from resource class directly now instead of via ResourceBundle
+ */
+ protected SystemBaseSubMenuAction(ResourceBundle rb, String label, String tooltip,ImageDescriptor image,Shell shell)
+ {
+ super(label, tooltip, image, shell);
+ actionLabel = label;
+ //setTracing(true);
+ }
+
+
+ /**
+ * Constructor for SystemBaseSubMenuAction when there is just a string
+ * @param label The label to display
+ * @param parent The owning shell. If you pass null now, be sure to call setShell later
+ */
+ protected SystemBaseSubMenuAction(String label, Shell shell)
+ {
+ super(label, shell);
+ actionLabel = label;
+ //setTracing(true);
+ }
+ /**
+ * Constructor for SystemBaseSubMenuAction when there is just a string
+ * @param label The label to display
+ * @param tooltip The tooltip to display
+ * @param parent The owning shell. If you pass null now, be sure to call setShell later
+ */
+ protected SystemBaseSubMenuAction(String label, String tooltip, Shell shell)
+ {
+ super(label, tooltip, shell);
+ actionLabel = label;
+ //setTracing(true);
+ }
+ /**
+ * Constructor for SystemBaseSubMenuAction when there is just a string and image
+ * @param label The label to display
+ * @param parent The owning shell. If you pass null now, be sure to call setShell later
+ */
+ protected SystemBaseSubMenuAction(String label, ImageDescriptor image, Shell shell)
+ {
+ super(label, image, shell);
+ actionLabel = label;
+ //setTracing(true);
+ }
+
+ /**
+ * Constructor for SystemBaseSubMenuAction when there is just a string and image
+ * @param label The label to display
+ * @param tooltip the tooltip to display
+ * @param parent The owning shell. If you pass null now, be sure to call setShell later
+ */
+ protected SystemBaseSubMenuAction(String label, String tooltip, ImageDescriptor image, Shell shell)
+ {
+ super(label, tooltip, image, shell);
+ actionLabel = label;
+ //setTracing(true);
+ }
+
+ /**
+ * Set the menu ID. This is important to allow action contributions via the popupMenus extension point.
+ */
+ public void setMenuID(String Id)
+ {
+ this.menuID = Id;
+ }
+
+ /**
+ * Call this if the submenu should be created on-the-fly every time, versus creating and populating it
+ * only on the first usage.
+ */
+ public void setCreateMenuEachTime(boolean eachTime)
+ {
+ this.createMenuEachTime = eachTime;
+ }
+ /**
+ * Call this if the submenu should be populated on-the-fly every time, versus populating it
+ * only on the first usage. This only makes sense to be true if setCreateMenuEachTime is false.
+ */
+ public void setPopulateMenuEachTime(boolean eachTime)
+ {
+ this.populateMenuEachTime = eachTime;
+ }
+
+ /**
+ * Set test mode on
+ */
+ public void setTest(boolean testMode)
+ {
+ this.test = testMode;
+ }
+
+
+ /**
+ * Must be overridden
+ * Example of this:
+ *
+ * This is not used by default, but can be queried via getPageTitle() when constructing
+ * pages.
+ */
+ public void setWizardPageTitle(String pageTitle)
+ {
+ this.pageTitle = pageTitle;
+ }
+ /**
+ * Return the page title as set via setWizardPageTitle
+ */
+ public String getWizardPageTitle()
+ {
+ return pageTitle;
+ }
+ /**
+ * Call this method to set the wizard's dimensions without having to subclass the wizard.
+ * If you pass zero for either value, then the default will be used for that.
+ */
+ public void setMinimumPageSize(int width, int height)
+ {
+ //if (width <= 0)
+ // width = 300; // found this number in WizardDialog code
+ //if (height<= 0)
+ // height = 225; // found this number in WizardDialog code
+ this.minPageWidth = width;
+ this.minPageHeight = height;
+ }
+ /**
+ * Override of parent's method. Does the following:
+ *
+ * We intercept to ensure at least one selected item is collapsable
+ *
+ * @see SystemBaseAction#updateSelection(IStructuredSelection)
+ */
+ public boolean updateSelection(IStructuredSelection selection)
+ {
+ boolean enable = false;
+ if ((viewer != null) && (viewer instanceof ISystemTree))
+ {
+ return ((ISystemTree)viewer).areAnySelectedItemsExpanded();
+ }
+ Iterator e= ((IStructuredSelection) selection).iterator();
+ ISystemViewElementAdapter adapter = null;
+ while (!enable && e.hasNext())
+ {
+ Object selectedObject = e.next();
+ adapter = getAdapter(selectedObject);
+ if (adapter != null)
+ {
+ if (adapter.hasChildren(selectedObject))
+ enable = true;
+ }
+ }
+ return enable;
+ }
+
+ /**
+ * This is the method called when the user selects this action.
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ public void run()
+ {
+ //System.out.println("Inside run of SystemRefreshAction");
+ ISystemRegistry sr = SystemPlugin.getTheSystemRegistry();
+ if ((viewer != null) && (viewer instanceof ISystemResourceChangeListener))
+ {
+ sr.fireEvent((ISystemResourceChangeListener)viewer,
+ new SystemResourceChangeEvent("dummy",
+ ISystemResourceChangeEvents.EVENT_COLLAPSE_SELECTED, null));
+ }
+ else
+ sr.fireEvent(new SystemResourceChangeEvent("dummy", ISystemResourceChangeEvents.EVENT_COLLAPSE_SELECTED, null));
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCollapseAllAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCollapseAllAction.java
new file mode 100644
index 00000000000..b8d634f48e9
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCollapseAllAction.java
@@ -0,0 +1,81 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.model.ISystemRegistry;
+import org.eclipse.rse.model.ISystemResourceChangeEvents;
+import org.eclipse.rse.model.ISystemResourceChangeListener;
+import org.eclipse.rse.model.SystemResourceChangeEvent;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * The action allows users to collapse the entire Remote Systems Explorer tree view.
+ */
+public class SystemCollapseAllAction extends SystemBaseAction
+ //
+{
+
+ // See defect 41203
+
+ /**
+ * Constructor
+ */
+ public SystemCollapseAllAction(Shell parent)
+ {
+ super(SystemResources.ACTION_COLLAPSE_ALL_LABEL, SystemResources.ACTION_COLLAPSE_ALL_TOOLTIP,
+ SystemPlugin.getDefault().getImageDescriptorFromIDE(ISystemIconConstants.ICON_IDE_COLLAPSEALL_ID), // D54577
+ parent);
+ setHoverImageDescriptor(SystemPlugin.getDefault().getImageDescriptorFromIDE("elcl16/collapseall.gif")); //$NON-NLS-1$
+ allowOnMultipleSelection(true);
+ setContextMenuGroup(ISystemContextMenuConstants.GROUP_EXPAND); // should never be used
+ setSelectionSensitive(false);
+
+ setHelp(SystemPlugin.HELPPREFIX+"actn0023");
+ setAccelerator(SWT.CTRL | '-');
+ }
+
+ /**
+ * @see SystemBaseAction#updateSelection(IStructuredSelection)
+ */
+ public boolean updateSelection(IStructuredSelection selection)
+ {
+ return true;
+ }
+
+ /**
+ * This is the method called when the user selects this action.
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ public void run()
+ {
+ ISystemRegistry sr = SystemPlugin.getTheSystemRegistry();
+ if ((viewer != null) && (viewer instanceof ISystemResourceChangeListener))
+ {
+ sr.fireEvent((ISystemResourceChangeListener)viewer,
+ new SystemResourceChangeEvent("false",
+ ISystemResourceChangeEvents.EVENT_COLLAPSE_ALL, null));
+ }
+ else
+ sr.fireEvent(new SystemResourceChangeEvent("false", ISystemResourceChangeEvents.EVENT_COLLAPSE_ALL, null));
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCommonDeleteAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCommonDeleteAction.java
new file mode 100644
index 00000000000..0e9cad94a01
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCommonDeleteAction.java
@@ -0,0 +1,205 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableContext;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.core.SystemAdapterHelpers;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.ISystemDeleteTarget;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.dialogs.SystemDeleteDialog;
+import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+
+
+/**
+ * The action that displays the Delete confirmation dialog.There are two ways to use this action:
+ *
+ * If the input objects do not adapt to {@link org.eclipse.rse.ui.view.ISystemRemoteElementAdapter} or
+ * {@link org.eclipse.rse.ui.view.ISystemViewElementAdapter}, then you
+ * should call {@link #setNameValidator(org.eclipse.rse.core.ui.validators.ISystemValidator)} to
+ * specify a validator that is called to verify the typed new name is valid. Further, to show the type value
+ * of the input objects, they should implement {@link org.eclipse.rse.ui.dialogs.ISystemTypedObject}.
+ *
+ * @see org.eclipse.rse.ui.dialogs.SystemDeleteDialog
+ */
+public class SystemCommonDeleteAction
+ extends SystemBaseDialogAction
+ implements ISystemIconConstants
+{
+ private String promptLabel;
+
+ /**
+ * Constructor for SystemDeleteAction when using a delete target
+ * @param parent The Shell of the parent UI for this dialog
+ * @param deleteTarget The UI part that has selectable and deletable parts.
+ */
+ public SystemCommonDeleteAction(Shell parent, ISystemDeleteTarget deleteTarget)
+ {
+ super(SystemResources.ACTION_DELETE_LABEL, SystemResources.ACTION_DELETE_TOOLTIP,
+ PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_DELETE)
+ , parent);
+ setSelectionProvider(deleteTarget);
+ allowOnMultipleSelection(true);
+ setProcessAllSelections(true);
+ setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORGANIZE);
+ setHelp(SystemPlugin.HELPPREFIX+"actn0021");
+ }
+
+ /**
+ * Constructor for SystemDeleteAction when not using a delete target
+ * @param parent The Shell of the parent UI for this dialog
+ */
+ public SystemCommonDeleteAction(Shell parent)
+ {
+ this(parent, null);
+ }
+
+ /**
+ * Specify the text to show for the label prompt. The default is
+ * "Delete selected resources?"
+ */
+ public void setPromptLabel(String text)
+ {
+ this.promptLabel = text;
+ }
+
+ private ISystemDeleteTarget getDeleteTarget()
+ {
+ return (ISystemDeleteTarget)getSelectionProvider();
+ }
+
+ /**
+ * Called by SystemBaseAction when selection is set.
+ * Our opportunity to verify we are allowed for this selected type.
+ */
+ public boolean updateSelection(IStructuredSelection selection)
+ {
+ ISystemDeleteTarget deleteTarget = getDeleteTarget();
+ if (deleteTarget == null)
+ return true;
+ else
+ return deleteTarget.showDelete() && getDeleteTarget().canDelete();
+ }
+
+ /**
+ * If you decide to use the supplied run method as is,
+ * then you must override this method to create and return
+ * the dialog that is displayed by the default run method
+ * implementation.
+ *
+ * If you override run with your own, then
+ * simply implement this to return null as it won't be used.
+ * @see #run()
+ */
+ protected Dialog createDialog(Shell shell)
+ {
+ SystemDeleteDialog dlg = new SystemDeleteDialog(shell);
+ if (promptLabel != null)
+ dlg.setPromptLabel(promptLabel);
+ Object firstSelection = getFirstSelection();
+ if (getRemoteAdapter(firstSelection) != null)
+ {
+ String warningMsg = null;
+ String warningTip = null;
+
+ warningMsg = SystemResources.RESID_DELETE_WARNING_LABEL;
+ warningTip = SystemResources.RESID_DELETE_WARNING_TOOLTIP;
+ dlg.setWarningMessage(warningMsg,warningTip);
+ }
+ return dlg;
+ }
+
+ public class DeleteRunnable implements IRunnableWithProgress
+ {
+ private ISystemDeleteTarget _target;
+ public DeleteRunnable(ISystemDeleteTarget target)
+ {
+ _target = target;
+ }
+
+ public void run(IProgressMonitor monitor)
+ {
+ _target.doDelete(monitor); // deletes all the currently selected items
+ }
+ }
+
+ /**
+ * Required by parent.
+ * In our case, we overload it to also perform the deletion, but only if using a delete target,
+ * else it is up to the caller to call wasCancelled() and if not true, do their own deletion.
+ */
+ protected Object getDialogValue(Dialog dlg)
+ {
+ if (!((SystemDeleteDialog)dlg).wasCancelled() && (getDeleteTarget() != null))
+ {
+ ISystemDeleteTarget target = getDeleteTarget();
+ DeleteRunnable delRunnable = new DeleteRunnable(target);
+ IRunnableContext runnableContext = getRunnableContext(dlg.getShell());
+ try
+ {
+ runnableContext.run(false, true, delRunnable);
+ }
+ catch (Exception e)
+ {
+ }
+ SystemPlugin.getTheSystemRegistry().clearRunnableContext();
+ setEnabled(target.canDelete());
+ }
+ return null;
+ }
+
+ protected IRunnableContext getRunnableContext(Shell shell)
+ {
+ IRunnableContext irc = SystemPlugin.getTheSystemRegistry().getRunnableContext();
+ if (irc != null)
+ {
+ return irc;
+ }
+ else
+ {
+ irc = new ProgressMonitorDialog(shell);
+ SystemPlugin.getTheSystemRegistry().setRunnableContext(shell, irc);
+ return irc;
+ }
+ }
+
+ /**
+ * Returns the implementation of ISystemRemoteElement for the given
+ * object. Returns null if this object does not adaptable to this.
+ */
+ protected ISystemRemoteElementAdapter getRemoteAdapter(Object o)
+ {
+ return SystemAdapterHelpers.getRemoteAdapter(o);
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCommonRenameAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCommonRenameAction.java
new file mode 100644
index 00000000000..c97ad22bff0
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCommonRenameAction.java
@@ -0,0 +1,236 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.ISystemRenameTarget;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.dialogs.SystemRenameDialog;
+import org.eclipse.rse.ui.dialogs.SystemRenameSingleDialog;
+import org.eclipse.rse.ui.validators.ISystemValidator;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * The action that displays the Rename dialog. There are two ways to use this action:
+ *
+ * If the input objects do not adapt to {@link org.eclipse.rse.ui.view.ISystemRemoteElementAdapter} or
+ * {@link org.eclipse.rse.ui.view.ISystemViewElementAdapter}, then you
+ * should call {@link #setNameValidator(org.eclipse.rse.ui.validators.ISystemValidator)} to
+ * specify a validator that is called to verify the typed new name is valid. Further, to show the type value
+ * of the input objects, they should implement {@link org.eclipse.rse.ui.dialogs.ISystemTypedObject}.
+ *
+ * @see org.eclipse.rse.ui.dialogs.SystemRenameDialog
+ * @see org.eclipse.rse.ui.dialogs.SystemRenameSingleDialog
+ */
+public class SystemCommonRenameAction extends SystemBaseDialogAction
+
+{
+ private ISystemRenameTarget renameTarget;
+ private boolean copyCollisionMode = false;
+ private String newNames[];
+ private ISystemValidator nameValidator;
+ private String singleSelectionHelp, multiSelectionHelp, promptLabel, promptTip, verbage;
+
+ /**
+ * Constructor when using a rename target
+ * @param parent The Shell of the parent UI for this dialog
+ * @param target The UI part that has selectable and renamable parts.
+ */
+ public SystemCommonRenameAction(Shell parent, ISystemRenameTarget target)
+ {
+ super(SystemResources.ACTION_RENAME_LABEL, SystemResources.ACTION_RENAME_TOOLTIP,
+ SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_RENAME_ID), parent);
+ allowOnMultipleSelection(true);
+ setProcessAllSelections(true);
+ renameTarget = target;
+ setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORGANIZE);
+ setHelp(SystemPlugin.HELPPREFIX+"actn0018");
+ }
+
+ /**
+ * Constructor when not using a rename target
+ * @param parent The Shell of the parent UI for this dialog
+ */
+ public SystemCommonRenameAction(Shell parent)
+ {
+ this(parent, null);
+ }
+ /**
+ * Set the help to use in the dialog when there is a single selection
+ */
+ public void setDialogSingleSelectionHelp(String helpID)
+ {
+ this.singleSelectionHelp = helpID;
+ }
+ /**
+ * Set the help to use in the dialog when there are multiple selections
+ */
+ public void setDialogMultiSelectionHelp(String helpID)
+ {
+ this.multiSelectionHelp = helpID;
+ }
+ /**
+ * Set the label and tooltip of the prompt, used when only one thing is selected. The default is "New name:"
+ */
+ public void setSingleSelectPromptLabel(String label, String tooltip)
+ {
+ this.promptLabel = label;
+ this.promptTip = tooltip;
+ }
+ /**
+ * Set the verbage to show at the top of the table, used when multi things are selected. The default is "Enter a new name for each resource"
+ */
+ public void setMultiSelectVerbage(String verbage)
+ {
+ this.verbage = verbage;
+ }
+
+ /**
+ * Set the validator for the new name,as supplied by the adaptor for name checking.
+ * Overrides the default which is to query it from the object's adapter.
+ */
+ public void setNameValidator(ISystemValidator nameValidator)
+ {
+ this.nameValidator = nameValidator;
+ }
+
+ /**
+ * Indicate this dialog is the result of a copy/move name collision.
+ * Affects the title, verbage at the top of the dialog, and context help.
+ */
+ public void setCopyCollisionMode(boolean copyCollisionMode)
+ {
+ this.copyCollisionMode = copyCollisionMode;
+ }
+ /**
+ * Query if this dialog is the result of a copy/move name collision.
+ * Affects the title, verbage at the top of the dialog, and context help.
+ */
+ public boolean getCopyCollisionMode()
+ {
+ return copyCollisionMode;
+ }
+
+ /**
+ * Called by SystemBaseAction when selection is set.
+ * Our opportunity to verify we are allowed for this selected type.
+ * We overload it to call canRename() in the SystemView class.
+ */
+ public boolean updateSelection(IStructuredSelection selection)
+ {
+ if (renameTarget == null)
+ return true;
+ else
+ return renameTarget.canRename();
+ }
+
+ /**
+ * If you decide to use the supplied run method as is,
+ * then you must override this method to create and return
+ * the dialog that is displayed by the default run method
+ * implementation.
+ *
+ * If you override run with your own, then
+ * simply implement this to return null as it won't be used.
+ * @see #run()
+ */
+ protected Dialog createDialog(Shell parent)
+ {
+ // multi-select
+ if (getSelection().size() > 1)
+ {
+ SystemRenameDialog dlg = new SystemRenameDialog(parent);
+ if (nameValidator != null)
+ dlg.setNameValidator(nameValidator);
+ if (multiSelectionHelp != null)
+ dlg.setHelp(multiSelectionHelp);
+ if (verbage != null)
+ dlg.setVerbage(verbage);
+ return dlg;
+ }
+ // single-select
+ else
+ {
+ SystemRenameSingleDialog dlg = new SystemRenameSingleDialog(parent);
+ if (copyCollisionMode)
+ dlg.setCopyCollisionMode(copyCollisionMode);
+ if (nameValidator != null)
+ dlg.setNameValidator(nameValidator);
+ if (singleSelectionHelp != null)
+ dlg.setHelp(singleSelectionHelp);
+ if ((promptLabel != null) || (promptTip != null))
+ dlg.setPromptLabel(promptLabel, promptTip);
+ return dlg;
+ }
+ }
+
+ /**
+ * Required by parent. We use it to actually do the rename by calling doRename
+ * in the supplied ISystemRenameTarget, if we are in that mode.
+ * As a result, we return null from here.
+ * @see #getNewNames()
+ */
+ protected Object getDialogValue(Dialog dlg)
+ {
+ newNames = null;
+ if (dlg instanceof SystemRenameDialog)
+ {
+ SystemRenameDialog rnmDlg = (SystemRenameDialog)dlg;
+ if (!rnmDlg.wasCancelled())
+ {
+ newNames = rnmDlg.getNewNames();
+ if (renameTarget != null)
+ renameTarget.doRename(newNames); // perform the actual renames.
+ }
+ }
+ else
+ {
+ SystemRenameSingleDialog rnmDlg = (SystemRenameSingleDialog)dlg;
+ if (!rnmDlg.wasCancelled())
+ {
+ String name = rnmDlg.getNewName();
+ newNames = new String[1];
+ newNames[0] = name;
+ if (renameTarget != null)
+ renameTarget.doRename(newNames); // perform the actual renames.
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Return the new names entered by the user. You only need to call this when you don't supply a
+ * rename target. In this case, it is your responsibility to do the actual renames.
+ * @return - array of new names, with the order matching the order of the input selection. Null if dialog cancelled.
+ */
+ public String[] getNewNames()
+ {
+ return newNames;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCommonSelectAllAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCommonSelectAllAction.java
new file mode 100644
index 00000000000..579bfce945a
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCommonSelectAllAction.java
@@ -0,0 +1,72 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.view.ISystemSelectAllTarget;
+import org.eclipse.swt.widgets.Shell;
+
+
+
+/**
+ * The global action that enables select all.
+ * For the RSE tree view, we interpret select all to mean select all the
+ * children of the currently selected parent, if applicable.
+ */
+public class SystemCommonSelectAllAction
+ extends SystemBaseAction
+
+{
+ private ISystemSelectAllTarget target;
+
+ /**
+ * Constructor
+ * @param parent The Shell of the parent UI for this dialog
+ * @param selProvider The viewer that provides the selections
+ * @param target The viewer that is running this action
+ */
+ public SystemCommonSelectAllAction(Shell parent, ISelectionProvider selProvider, ISystemSelectAllTarget target)
+ {
+ //super(SystemPlugin.getResourceBundle(), ISystemConstants.ACTION_SELECTALL, null, parent); TODO: XLATE!
+ super("Select All", (ImageDescriptor)null, parent);
+ setSelectionProvider(selProvider);
+ this.target = target;
+ allowOnMultipleSelection(false);
+ setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORGANIZE);
+ //setHelp(SystemPlugin.HELPPREFIX+"actn0021"); // TODO: ADD HELP!
+ }
+
+ /**
+ * Called by SystemBaseAction when selection is set.
+ * Our opportunity to verify we are allowed for this selected type.
+ */
+ public boolean updateSelection(IStructuredSelection selection)
+ {
+ return target.enableSelectAll(selection);
+ }
+
+ /**
+ * This is the method called when the user selects this action.
+ */
+ public void run()
+ {
+ target.doSelectAll(getSelection());
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemConnectAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemConnectAction.java
new file mode 100644
index 00000000000..f1a315daf33
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemConnectAction.java
@@ -0,0 +1,75 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+
+import org.eclipse.rse.core.ISystemTypes;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.swt.widgets.Shell;
+
+//import org.eclipse.rse.core.ui.SystemMessage;
+
+
+/**
+ * This is the action for connecting to the remote subsystem
+ */
+public class SystemConnectAction extends SystemBaseAction
+ implements ISystemMessages
+{
+ /**
+ * Constructor.
+ * @param shell Shell of parent window, used as the parent for the dialog.
+ * Can be null, but be sure to call setParent before the action is used (ie, run).
+ */
+ public SystemConnectAction(Shell shell)
+ {
+ super(SystemResources.ACTION_CONNECT_LABEL,SystemResources.ACTION_CONNECT_TOOLTIP, shell);
+ allowOnMultipleSelection(false);
+ setContextMenuGroup(ISystemContextMenuConstants.GROUP_CONNECTION);
+ setHelp(SystemPlugin.HELPPREFIX+"actn0047");
+ }
+ /**
+ * Override of parent. Called when testing if action should be enabled base on current
+ * selection. We check the selected object is one of our subsystems, and we are not
+ * already connected.
+ */
+ public boolean checkObjectType(Object obj)
+ {
+ if ( !(obj instanceof ISubSystem) ||
+ ((ISubSystem)obj).getConnectorService().isConnected() )
+ return false;
+ else
+ return true;
+ }
+
+ /**
+ * Called when this action is selection from the popup menu.
+ */
+ public void run()
+ {
+ ISubSystem ss = (ISubSystem)getFirstSelection();
+ try {
+ if (ss.getHost().getSystemType().equals(ISystemTypes.SYSTEMTYPE_WINDOWS))
+ ss.connect(getShell());
+ else
+ ss.connect(getShell(), true);
+ } catch (Exception exc) {} // msg already shown
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemConnectAllSubSystemsAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemConnectAllSubSystemsAction.java
new file mode 100644
index 00000000000..b4d779bb9a8
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemConnectAllSubSystemsAction.java
@@ -0,0 +1,112 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.subsystems.IConnectorService;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.model.IHost;
+import org.eclipse.rse.model.ISystemRegistry;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.swt.widgets.Shell;
+
+
+//import com.ibm.etools.systems.*;
+/**
+ * This is the action for connecting all subsystems for a given connection.
+ */
+public class SystemConnectAllSubSystemsAction extends SystemBaseAction
+ implements ISystemMessages
+{
+
+ private ISystemRegistry sr = null;
+ /**
+ * Constructor.
+ * @param shell Shell of parent window, used as the parent for the dialog.
+ * Can be null, but be sure to call setParent before the action is used (ie, run).
+ */
+ public SystemConnectAllSubSystemsAction(Shell shell)
+ {
+ super(SystemResources.ACTION_CONNECT_ALL_LABEL,SystemResources.ACTION_CONNECT_ALL_TOOLTIP, shell);
+ allowOnMultipleSelection(false);
+ setContextMenuGroup(ISystemContextMenuConstants.GROUP_CONNECTION);
+ sr = SystemPlugin.getTheSystemRegistry();
+ //setHelp(SystemPlugin.HELPPREFIX+"actn0022");
+ }
+ /**
+ * Override of parent. Called when testing if action should be enabled base on current
+ * selection. We check the selected object is one of our subsystems, and if we are
+ * currently connected.
+ */
+ public boolean checkObjectType(Object obj)
+ {
+ if ((obj instanceof IHost) &&
+ !sr.areAllSubSystemsConnected((IHost)obj))
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ /**
+ * Called when this action is selection from the popup menu.
+ */
+ public void run()
+ {
+ List failedSystems = new ArrayList();
+ IHost conn = (IHost)getFirstSelection();
+ try
+ {
+ Shell shell = getShell();
+ ISubSystem[] subsystems = conn.getSubSystems();
+ for (int i = 0; i < subsystems.length; i++)
+ {
+ ISubSystem subsystem = subsystems[i];
+ IConnectorService system = subsystem.getConnectorService();
+ if (!subsystem.isConnected() && !failedSystems.contains(system))
+ {
+ try
+ {
+ subsystem.connect(shell, false);
+ }
+ catch (Exception e)
+ {
+ failedSystems.add(system);
+
+ // if the user was prompted for password and cancelled
+ // or if the connect was interrupted for some other reason
+ // we don't attempt to connect the other subsystems
+ if (e instanceof InterruptedException) {
+ break;
+ }
+ }// msg already shown
+ }
+ }
+ }
+ catch (Exception exc)
+ {
+ } // msg already shown
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCopyConnectionAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCopyConnectionAction.java
new file mode 100644
index 00000000000..b11670ea5ed
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCopyConnectionAction.java
@@ -0,0 +1,248 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+import java.util.Iterator;
+import java.util.Vector;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.model.IHost;
+import org.eclipse.rse.model.ISystemProfile;
+import org.eclipse.rse.model.ISystemRegistry;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.dialogs.SystemRenameSingleDialog;
+import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * Copy a connection action.
+ */
+public class SystemCopyConnectionAction extends SystemBaseCopyAction
+ implements ISystemMessages
+{
+ private ISystemRegistry sr = null;
+ private SystemSimpleContentElement initialSelectionElement = null;
+ /**
+ * Constructor for SystemCopyConnectionAction
+ */
+ public SystemCopyConnectionAction(Shell parent)
+ {
+ super(parent, SystemResources.ACTION_COPY_CONNECTION_LABEL, MODE_COPY);
+ sr = SystemPlugin.getTheSystemRegistry();
+ setHelp(SystemPlugin.HELPPREFIX+"actn0019");
+ setDialogHelp(SystemPlugin.HELPPREFIX+"dccn0000");
+ }
+
+ /**
+ * We override from parent to do unique checking...
+ *
+ * We intercept to ensure only connections from the same profile are selected.
+ *
+ * @see SystemBaseAction#updateSelection(IStructuredSelection)
+ */
+ public boolean updateSelection(IStructuredSelection selection)
+ {
+ boolean enable = true;
+ ISystemRegistry sr = SystemPlugin.getDefault().getSystemRegistry();
+ ISystemProfile prevProfile = null;
+ Iterator e= ((IStructuredSelection) selection).iterator();
+ while (enable && e.hasNext())
+ {
+ Object selectedObject = e.next();
+ if (selectedObject instanceof IHost)
+ {
+ IHost conn = (IHost)selectedObject;
+ if (prevProfile == null)
+ prevProfile = conn.getSystemProfile();
+ else
+ enable = (prevProfile == conn.getSystemProfile());
+ if (enable)
+ prevProfile = conn.getSystemProfile();
+ }
+ else
+ enable = false;
+ }
+ return enable;
+ }
+
+ // --------------------------
+ // PARENT METHOD OVERRIDES...
+ // --------------------------
+
+ /**
+ * @see SystemBaseCopyAction#checkForCollision(Shell, IProgressMonitor, Object, Object, String)
+ */
+ protected String checkForCollision(Shell shell, IProgressMonitor monitor,
+ Object targetContainer, Object oldObject, String oldName)
+ {
+ ISystemProfile profile = (ISystemProfile)targetContainer;
+ String newName = oldName;
+ IHost match = sr.getHost(profile, oldName);
+ if (match != null)
+ {
+ //monitor.setVisible(false); wish we could!
+ //ValidatorConnectionName validator = new ValidatorConnectionName(sr.getConnectionAliasNames(profile));
+ //SystemCollisionRenameDialog dlg = new SystemCollisionRenameDialog(shell, validator, oldName);
+ SystemRenameSingleDialog dlg = new SystemRenameSingleDialog(shell, true, match, null); // true => copy-collision-mode
+ dlg.open();
+ if (!dlg.wasCancelled())
+ newName = dlg.getNewName();
+ else
+ newName = null;
+ }
+ return newName;
+ }
+ /**
+ * @see SystemBaseCopyAction#doCopy(IProgressMonitor, Object, Object, String)
+ */
+ protected boolean doCopy(IProgressMonitor monitor, Object targetContainer, Object oldObject, String newName)
+ throws Exception
+ {
+ IHost oldConnection = (IHost)oldObject;
+ String oldName = oldConnection.getAliasName();
+ //SystemPlugin.logDebugMessage(this.getClass().getName(),"starting to copy "+oldName+" to "+newName);
+ ISystemProfile targetProfile = (ISystemProfile)targetContainer;
+ IHost newConn = sr.copyHost(monitor, oldConnection, targetProfile, newName);
+ return (newConn != null);
+ }
+
+ /**
+ * @see SystemBaseCopyAction#getTreeModel()
+ */
+ protected SystemSimpleContentElement getTreeModel()
+ {
+ return getProfileTreeModel(getFirstSelectedConnection().getSystemProfile());
+ }
+ /**
+ * @see SystemBaseCopyAction#getTreeInitialSelection()
+ */
+ protected SystemSimpleContentElement getTreeInitialSelection()
+ {
+ return initialSelectionElement;
+ }
+
+ /**
+ * @see SystemBaseCopyAction#getPromptString()
+ */
+ protected String getPromptString()
+ {
+ return SystemResources.RESID_COPY_TARGET_PROFILE_PROMPT;
+ }
+ /**
+ * @see SystemBaseCopyAction#getCopyingMessage()
+ */
+ protected SystemMessage getCopyingMessage()
+ {
+ return SystemPlugin.getPluginMessage(MSG_COPYCONNECTIONS_PROGRESS);
+ }
+ /**
+ * @see SystemBaseCopyAction#getCopyingMessage( String)
+ */
+ protected SystemMessage getCopyingMessage(String oldName)
+ {
+ return SystemPlugin.getPluginMessage(MSG_COPYCONNECTION_PROGRESS).makeSubstitution(oldName);
+ }
+
+ /**
+ * @see SystemBaseCopyAction#getOldObjects()
+ */
+ protected Object[] getOldObjects()
+ {
+ return getSelectedConnections();
+ }
+
+ /**
+ * @see SystemBaseCopyAction#getOldNames()
+ */
+ protected String[] getOldNames()
+ {
+ IHost[] conns = getSelectedConnections();
+ String[] names = new String[conns.length];
+ for (int idx=0; idx
+ * We simply ensure every selected object has a system view element adapter.
+ *
+ * @see SystemBaseAction#updateSelection(IStructuredSelection)
+ */
+ public boolean updateSelection(IStructuredSelection selection)
+ {
+ boolean enable = true;
+ Iterator e = ((IStructuredSelection) selection).iterator();
+ while (enable && e.hasNext())
+ {
+ Object selectedObject = e.next();
+ if (selectedObject instanceof IAdaptable)
+ {
+ IAdaptable adaptable = (IAdaptable) selectedObject;
+ ISystemViewElementAdapter va = (ISystemViewElementAdapter) (adaptable.getAdapter(ISystemViewElementAdapter.class));
+ if (va != null)
+ {
+ enable = va.canDrag(selectedObject);
+ }
+ else
+ {
+ enable = false;
+ }
+ }
+ else
+ {
+ enable = false;
+ }
+ }
+
+ if (enable)
+ {
+ _selection = selection;
+ }
+ return enable;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemDisconnectAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemDisconnectAction.java
new file mode 100644
index 00000000000..7286e4ddc70
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemDisconnectAction.java
@@ -0,0 +1,71 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.swt.widgets.Shell;
+
+
+
+/**
+ * This is the action for disconnecting from a remote subsystem.
+ */
+public class SystemDisconnectAction extends SystemBaseAction
+ implements ISystemMessages
+{
+
+ /**
+ * Constructor.
+ * @param shell Shell of parent window, used as the parent for the dialog.
+ * Can be null, but be sure to call setParent before the action is used (ie, run).
+ */
+ public SystemDisconnectAction(Shell shell)
+ {
+ super(SystemResources.ACTION_DISCONNECT_LABEL, SystemResources.ACTION_DISCONNECT_TOOLTIP, shell);
+ allowOnMultipleSelection(false);
+ setContextMenuGroup(ISystemContextMenuConstants.GROUP_CONNECTION);
+ setHelp(SystemPlugin.HELPPREFIX+"actn0048");
+ }
+ /**
+ * Override of parent. Called when testing if action should be enabled based on current
+ * selection. We check the selected object is one of our subsystems, and if we are
+ * currently connected.
+ */
+ public boolean checkObjectType(Object obj)
+ {
+ if ( !(obj instanceof ISubSystem) ||
+ !((ISubSystem)obj).getConnectorService().isConnected() )
+ return false;
+ else
+ return true;
+ }
+
+ /**
+ * Called when this action is selection from the popup menu.
+ */
+ public void run()
+ {
+ ISubSystem ss = (ISubSystem)getFirstSelection();
+ try {
+ ss.disconnect(getShell());
+ } catch (Exception exc) {} // msg already shown
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemDisconnectAllSubSystemsAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemDisconnectAllSubSystemsAction.java
new file mode 100644
index 00000000000..ba5bd778b3b
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemDisconnectAllSubSystemsAction.java
@@ -0,0 +1,75 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.model.IHost;
+import org.eclipse.rse.model.ISystemRegistry;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.swt.widgets.Shell;
+
+
+//import com.ibm.etools.systems.*;
+/**
+ * This is the action forconnecting all subsystems for a given connection.
+ */
+public class SystemDisconnectAllSubSystemsAction extends SystemBaseAction
+ implements ISystemMessages
+{
+
+ private ISystemRegistry sr = null;
+ /**
+ * Constructor.
+ * @param shell Shell of parent window, used as the parent for the dialog.
+ * Can be null, but be sure to call setParent before the action is used (ie, run).
+ */
+ public SystemDisconnectAllSubSystemsAction(Shell shell)
+ {
+ super(SystemResources.ACTION_DISCONNECTALLSUBSYSTEMS_LABEL, SystemResources.ACTION_DISCONNECTALLSUBSYSTEMS_TOOLTIP, shell);
+ allowOnMultipleSelection(false);
+ setContextMenuGroup(ISystemContextMenuConstants.GROUP_CONNECTION);
+ sr = SystemPlugin.getTheSystemRegistry();
+ // TODO help for connect all
+ //setHelp(SystemPlugin.HELPPREFIX+"actn0022");
+ }
+ /**
+ * Override of parent. Called when testing if action should be enabled base on current
+ * selection. We check the selected object is one of our subsystems, and if we are
+ * currently connected.
+ */
+ public boolean checkObjectType(Object obj)
+ {
+ if ( !(obj instanceof IHost) ||
+ !(sr.isAnySubSystemConnected((IHost)obj) ))
+ return false;
+ else
+ return true;
+ }
+
+ /**
+ * Called when this action is selection from the popup menu.
+ */
+ public void run()
+ {
+ IHost conn = (IHost)getFirstSelection();
+ try {
+ sr.disconnectAllSubSystems(conn);
+ } catch (Exception exc) {} // msg already shown
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemDynamicPopupMenuExtensionManager.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemDynamicPopupMenuExtensionManager.java
new file mode 100644
index 00000000000..20f17b7c066
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemDynamicPopupMenuExtensionManager.java
@@ -0,0 +1,73 @@
+/********************************************************************************
+ * Copyright (c) 2005, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ *
+ * Singleton class for managing adapter menu extensions.
+ * View adapters that support this feature, should call populateMenu to allow for
+ * extended menu contributions.
+ */
+public class SystemDynamicPopupMenuExtensionManager implements
+ ISystemDynamicPopupMenuExtensionManager
+{
+ private static SystemDynamicPopupMenuExtensionManager _instance = new SystemDynamicPopupMenuExtensionManager();
+
+ private List _extensions;
+
+ private SystemDynamicPopupMenuExtensionManager()
+ {
+ _extensions= new ArrayList();
+ }
+
+ public static SystemDynamicPopupMenuExtensionManager getInstance()
+ {
+ return _instance;
+ }
+
+ public void registerMenuExtension(ISystemDynamicPopupMenuExtension ext)
+ {
+ _extensions.add(ext);
+ }
+
+ /**
+ * Actions are added to a contribution menu.
+ * @param shell the shell
+ * @param menu the menu to contribute to
+ * @param selection(s) are processed to determine the resource source file
+ * @param menuGroup the default menu group to add actions to
+ * @return the menu is populated with actions
+ */
+ public void populateMenu(Shell shell, IMenuManager menu,IStructuredSelection selection, String menuGroup)
+ {
+ for (int i = 0; i <_extensions.size(); i++)
+ {
+ ISystemDynamicPopupMenuExtension extension = (ISystemDynamicPopupMenuExtension)_extensions.get(i);
+ if (extension.supportsSelection(selection))
+ {
+ extension.populateMenu(shell, menu,selection, menuGroup);
+ }
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemExpandAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemExpandAction.java
new file mode 100644
index 00000000000..283a9bd042a
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemExpandAction.java
@@ -0,0 +1,101 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+import java.util.Iterator;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.model.ISystemRegistry;
+import org.eclipse.rse.model.ISystemResourceChangeEvents;
+import org.eclipse.rse.model.ISystemResourceChangeListener;
+import org.eclipse.rse.model.SystemResourceChangeEvent;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.view.ISystemTree;
+import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * The action allows users to expand the selected nodes in the Remote Systems Explorer tree view
+ */
+public class SystemExpandAction extends SystemBaseAction
+
+{
+
+ // see defect 41203
+
+ /**
+ * Constructor
+ */
+ public SystemExpandAction(Shell parent)
+ {
+ super(SystemResources.ACTION_EXPAND_SELECTED_LABEL,SystemResources.ACTION_EXPAND_SELECTED_TOOLTIP,
+ parent);
+ allowOnMultipleSelection(true);
+ setContextMenuGroup(ISystemContextMenuConstants.GROUP_EXPAND);
+ setAccelerator('+');
+ setHelp(SystemPlugin.HELPPREFIX+"actn0025");
+ setAvailableOffline(true);
+}
+
+ /**
+ *
+ * We intercept to ensure at least one selected item is expandable
+ *
+ * @see SystemBaseAction#updateSelection(IStructuredSelection)
+ */
+ public boolean updateSelection(IStructuredSelection selection)
+ {
+ boolean enable = false;
+ if ((viewer != null) && (viewer instanceof ISystemTree))
+ {
+ return ((ISystemTree)viewer).areAnySelectedItemsExpandable();
+ }
+ Iterator e= ((IStructuredSelection) selection).iterator();
+ ISystemViewElementAdapter adapter = null;
+ while (!enable && e.hasNext())
+ {
+ Object selectedObject = e.next();
+ adapter = getAdapter(selectedObject);
+ if (adapter != null)
+ {
+ if (adapter.hasChildren(selectedObject))
+ enable = true;
+ }
+ }
+ return enable;
+ }
+
+ /**
+ * This is the method called when the user selects this action.
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ public void run()
+ {
+ //System.out.println("Inside run of SystemRefreshAction");
+ ISystemRegistry sr = SystemPlugin.getTheSystemRegistry();
+ if ((viewer != null) && (viewer instanceof ISystemResourceChangeListener))
+ {
+ sr.fireEvent((ISystemResourceChangeListener)viewer,
+ new SystemResourceChangeEvent("dummy",
+ ISystemResourceChangeEvents.EVENT_EXPAND_SELECTED, null));
+ }
+ else
+ sr.fireEvent(new SystemResourceChangeEvent("dummy", ISystemResourceChangeEvents.EVENT_EXPAND_SELECTED, null));
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemMoveConnectionAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemMoveConnectionAction.java
new file mode 100644
index 00000000000..4ad5d3d6ef3
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemMoveConnectionAction.java
@@ -0,0 +1,256 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+import java.util.Iterator;
+import java.util.Vector;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.model.IHost;
+import org.eclipse.rse.model.ISystemProfile;
+import org.eclipse.rse.model.ISystemRegistry;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.dialogs.SystemRenameSingleDialog;
+import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * Move a connection action.
+ */
+public class SystemMoveConnectionAction extends SystemBaseCopyAction
+ implements ISystemMessages
+{
+
+ private ISystemRegistry sr = null;
+ private SystemSimpleContentElement initialSelectionElement = null;
+
+ /**
+ * Constructor
+ */
+ public SystemMoveConnectionAction(Shell parent)
+ {
+ super(parent, SystemResources.ACTION_MOVE_CONNECTION_LABEL, MODE_MOVE);
+ //allowOnMultipleSelection(false); // too hard to handle, for now!
+ sr = SystemPlugin.getTheSystemRegistry();
+ setHelp(SystemPlugin.HELPPREFIX+"actn0020");
+ setDialogHelp(SystemPlugin.HELPPREFIX+"dmcn0000");
+ }
+
+ /**
+ * We override from parent to do unique checking...
+ *
+ * We intercept to ensure only connections from the same profile are selected.
+ *
+ * @see SystemBaseAction#updateSelection(IStructuredSelection)
+ */
+ public boolean updateSelection(IStructuredSelection selection)
+ {
+ if (sr.getActiveSystemProfiles().length <= 1)
+ return false;
+ boolean enable = true;
+ ISystemProfile prevProfile = null;
+ Iterator e= ((IStructuredSelection) selection).iterator();
+ while (enable && e.hasNext())
+ {
+ Object selectedObject = e.next();
+ if (selectedObject instanceof IHost)
+ {
+ IHost conn = (IHost)selectedObject;
+ if (prevProfile == null)
+ prevProfile = conn.getSystemProfile();
+ else
+ enable = (prevProfile == conn.getSystemProfile());
+ if (enable)
+ prevProfile = conn.getSystemProfile();
+ }
+ else
+ enable = false;
+ }
+ return enable;
+ }
+
+ // --------------------------
+ // PARENT METHOD OVERRIDES...
+ // --------------------------
+
+ /**
+ * @see SystemBaseCopyAction#checkForCollision(Shell, IProgressMonitor, Object, Object, String)
+ */
+ protected String checkForCollision(Shell shell, IProgressMonitor monitor,
+ Object targetContainer, Object oldObject, String oldName)
+ {
+ ISystemProfile profile = (ISystemProfile)targetContainer;
+ String newName = oldName;
+ IHost match = sr.getHost(profile, oldName);
+ if (match != null)
+ {
+ //monitor.setVisible(false); wish we could!
+ //ValidatorConnectionName validator = new ValidatorConnectionName(sr.getConnectionAliasNames(profile));
+ //SystemCollisionRenameDialog dlg = new SystemCollisionRenameDialog(shell, validator, oldName);
+ SystemRenameSingleDialog dlg = new SystemRenameSingleDialog(shell, true, match, null); // true => copy-collision-mode
+ dlg.open();
+ if (!dlg.wasCancelled())
+ newName = dlg.getNewName();
+ else
+ newName = null;
+ }
+ return newName;
+ }
+ /**
+ * @see SystemBaseCopyAction#doCopy(IProgressMonitor, Object, Object, String)
+ */
+ protected boolean doCopy(IProgressMonitor monitor, Object targetContainer, Object oldObject, String newName)
+ throws Exception
+ {
+ IHost oldConnection = (IHost)oldObject;
+ String oldName = oldConnection.getAliasName();
+ //SystemPlugin.logDebugMessage(this.getClass().getName(),"starting to copy "+oldName+" to "+newName);
+ ISystemProfile targetProfile = (ISystemProfile)targetContainer;
+ IHost newConn = sr.moveHost(monitor, oldConnection, targetProfile, newName);
+ return (newConn != null);
+ }
+
+ /**
+ * @see SystemBaseCopyAction#getTreeModel()
+ */
+ protected SystemSimpleContentElement getTreeModel()
+ {
+ return getProfileTreeModel(getFirstSelectedConnection().getSystemProfile());
+ }
+ /**
+ * @see SystemBaseCopyAction#getTreeInitialSelection()
+ */
+ protected SystemSimpleContentElement getTreeInitialSelection()
+ {
+ return initialSelectionElement;
+ }
+
+ /**
+ * @see SystemBaseCopyAction#getPromptString()
+ */
+ protected String getPromptString()
+ {
+ return SystemResources.RESID_MOVE_TARGET_PROFILE_PROMPT;
+ }
+ /**
+ * @see SystemBaseCopyAction#getCopyingMessage()
+ */
+ protected SystemMessage getCopyingMessage()
+ {
+ return SystemPlugin.getPluginMessage(MSG_MOVECONNECTIONS_PROGRESS);
+ }
+ /**
+ * @see SystemBaseCopyAction#getCopyingMessage( String)
+ */
+ protected SystemMessage getCopyingMessage(String oldName)
+ {
+ return SystemPlugin.getPluginMessage(MSG_MOVECONNECTION_PROGRESS).makeSubstitution(oldName);
+ }
+
+ /**
+ * @see SystemBaseCopyAction#getOldObjects()
+ */
+ protected Object[] getOldObjects()
+ {
+ return getSelectedConnections();
+ }
+
+ /**
+ * @see SystemBaseCopyAction#getOldNames()
+ */
+ protected String[] getOldNames()
+ {
+ IHost[] conns = getSelectedConnections();
+ String[] names = new String[conns.length];
+ for (int idx=0; idx
+ * @see SystemBaseAction#updateSelection(IStructuredSelection)
+ */
+ public boolean updateSelection(IStructuredSelection selection)
+ {
+ boolean enable = true;
+ ISystemRegistry sr = SystemPlugin.getDefault().getSystemRegistry();
+ prevProfile = null;
+ Iterator e= ((IStructuredSelection) selection).iterator();
+ while (enable && e.hasNext())
+ {
+ Object selectedObject = e.next();
+ if (selectedObject instanceof IHost)
+ {
+ IHost conn = (IHost)selectedObject;
+ int connCount = sr.getHostCountWithinProfile(conn)-1;
+ if (prevProfile == null)
+ prevProfile = conn.getSystemProfile();
+ else
+ enable = (prevProfile == conn.getSystemProfile());
+ if (enable)
+ {
+ enable = (sr.getHostPosition(conn) < connCount);
+ prevProfile = conn.getSystemProfile();
+ }
+ }
+ else
+ enable = false;
+ }
+ return enable;
+ }
+
+ /**
+ * This is the method called when the user selects this action.
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ public void run()
+ {
+ ISystemRegistry sr = SystemPlugin.getDefault().getSystemRegistry();
+ SystemSortableSelection[] sortableArray = SystemSortableSelection.makeSortableArray(getSelection());
+ IHost conn = null;
+ for (int idx=0; idx
+ * @see SystemBaseAction#updateSelection(IStructuredSelection)
+ */
+ public boolean updateSelection(IStructuredSelection selection)
+ {
+ boolean enable = true;
+ ISystemRegistry sr = SystemPlugin.getDefault().getSystemRegistry();
+ prevProfile = null;
+ Iterator e= ((IStructuredSelection) selection).iterator();
+ while (enable && e.hasNext())
+ {
+ Object selectedObject = e.next();
+ if (selectedObject instanceof IHost)
+ {
+ IHost conn = (IHost)selectedObject;
+ if (prevProfile == null)
+ prevProfile = conn.getSystemProfile();
+ else
+ enable = (prevProfile == conn.getSystemProfile());
+ if (enable)
+ {
+ enable = (sr.getHostPosition(conn) > 0);
+ prevProfile = conn.getSystemProfile();
+ }
+ }
+ else
+ enable = false;
+ }
+ return enable;
+ }
+
+ /**
+ * This is the method called when the user selects this action.
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ public void run()
+ {
+ ISystemRegistry sr = SystemPlugin.getDefault().getSystemRegistry();
+
+ SystemSortableSelection[] sortableArray = SystemSortableSelection.makeSortableArray(getSelection());
+ IHost conn = null;
+ for (int idx=0; idx
+ * Our default implementation is to call SystemNewProfileWizard.
+ */
+ protected IWizard createWizard()
+ {
+ return new SystemNewProfileWizard();
+ }
+
+ /**
+ * Typically, the wizard's performFinish method does the work required by
+ * a successful finish of the wizard. However, often we also want to be
+ * able to extract user-entered data from the wizard, by calling getters
+ * in this action. To enable this, override this method to populate your
+ * output instance variables from the completed wizard, which is passed
+ * as a parameter. This is only called after successful completion of the
+ * wizard.
+ */
+ protected void postProcessWizard(IWizard wizard)
+ {
+ if (getViewer() instanceof SystemTeamView)
+ {
+ getViewer().refresh();
+ }
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemOpenExplorerPerspectiveAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemOpenExplorerPerspectiveAction.java
new file mode 100644
index 00000000000..b38427b8713
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemOpenExplorerPerspectiveAction.java
@@ -0,0 +1,130 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.filters.ISystemFilterReference;
+import org.eclipse.rse.model.ISystemPromptableObject;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.view.SystemPerspectiveLayout;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IPerspectiveDescriptor;
+import org.eclipse.ui.IPerspectiveRegistry;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.OpenInNewWindowAction;
+
+
+/**
+ * The action allows users to open a new Remote Systems Explorer perspective, anchored
+ * by the currently selected resource.
+ */
+public class SystemOpenExplorerPerspectiveAction
+ extends SystemBaseAction
+
+{
+ //private boolean replaceEnabled = true;
+ private IWorkbenchWindow window;
+ private IPerspectiveRegistry reg;
+ private IPerspectiveDescriptor desc = null;
+
+ /**
+ * Constructor
+ */
+ public SystemOpenExplorerPerspectiveAction(Shell parent, IWorkbenchWindow currentWorkbenchWindow)
+ {
+ super(SystemResources.ACTION_OPENEXPLORER_DIFFPERSP2_LABEL, SystemResources.ACTION_OPENEXPLORER_DIFFPERSP2_TOOLTIP,
+ SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_PERSPECTIVE_ID),
+ parent);
+ this.window = currentWorkbenchWindow;
+ this.reg = PlatformUI.getWorkbench().getPerspectiveRegistry();
+ this.desc = reg.findPerspectiveWithId(SystemPerspectiveLayout.ID);
+
+ allowOnMultipleSelection(false);
+ setContextMenuGroup(ISystemContextMenuConstants.GROUP_OPEN);
+ setHelp(SystemPlugin.HELPPREFIX+"actn0016");
+ }
+
+ /**
+ * We override from parent to do unique checking...
+ *
+ * We intercept to ensure only connections from the same profile are selected.
+ *
+ * @see SystemBaseAction#updateSelection(IStructuredSelection)
+ */
+ public boolean updateSelection(IStructuredSelection selection)
+ {
+ boolean enable = true;
+ Object selected = selection.getFirstElement();
+ if (selected instanceof ISystemFilterReference)
+ {
+ if ( ((ISystemFilterReference)selected).getReferencedFilter().isPromptable() )
+ enable = false;
+ }
+ else if (selected instanceof ISystemPromptableObject)
+ enable = false;
+ return enable;
+ }
+
+ /**
+ * This is the method called when the user selects this action.
+ * @see Action#run()
+ */
+ public void run()
+ {
+ /* OLD RELEASE 1 CODE
+ IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
+ String perspectiveSetting =
+ store.getString(IWorkbenchPreferenceConstants.OPEN_NEW_PERSPECTIVE);
+ runWithPerspectiveValue(desc, perspectiveSetting);
+ */
+ OpenInNewWindowAction workbenchOpenAction = // NEW FOR RELEASE 2
+ new OpenInNewWindowAction(window,getPageInput());
+ workbenchOpenAction.run();
+ }
+
+ /**
+ * Sets the page input.
+ *
+ * @param input the page input
+ */
+ public void setPageInput(IAdaptable input)
+ {
+ }
+ /**
+ * Get the page input.
+ * Will use explicitly set input if given, else deduces from selection
+ */
+ public IAdaptable getPageInput()
+ {
+ //if (pageInput != null) safer to always recalculate!
+ // return pageInput;
+ //else
+ {
+ Object firstSel = getFirstSelection();
+ if ((firstSel != null) && (firstSel instanceof IAdaptable))
+ return (IAdaptable)firstSel;
+ else
+ return null;
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemOpenRSEPerspectiveAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemOpenRSEPerspectiveAction.java
new file mode 100644
index 00000000000..b402d077d44
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemOpenRSEPerspectiveAction.java
@@ -0,0 +1,42 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.rse.core.SystemPerspectiveHelpers;
+
+
+/**
+ * Open the RSE perspective (used in welcome.xml)
+ */
+public class SystemOpenRSEPerspectiveAction extends Action {
+
+
+ public SystemOpenRSEPerspectiveAction()
+ {
+ super();
+ }
+
+ /**
+ * @see Action#run()
+ */
+ public void run()
+ {
+ SystemPerspectiveHelpers.openRSEPerspective();
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPasteFromClipboardAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPasteFromClipboardAction.java
new file mode 100644
index 00000000000..bfb0c22eac5
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPasteFromClipboardAction.java
@@ -0,0 +1,350 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.core.runtime.jobs.MultiRule;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableContext;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.model.IHost;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.validators.IValidatorRemoteSelection;
+import org.eclipse.rse.ui.view.ISystemDragDropAdapter;
+import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
+import org.eclipse.rse.ui.view.SystemDNDTransferRunnable;
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.swt.dnd.FileTransfer;
+import org.eclipse.swt.dnd.TextTransfer;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.PluginTransfer;
+import org.eclipse.ui.part.PluginTransferData;
+import org.eclipse.ui.part.ResourceTransfer;
+
+
+/**
+ * Paste resources in system clipboard to the selected resource action.
+ */
+public class SystemPasteFromClipboardAction extends SystemBaseAction implements ISystemMessages, IValidatorRemoteSelection
+{
+
+
+ private int _srcType;
+ private Object _selection;
+ private Clipboard _clipboard;
+ /**
+ * Constructor
+ */
+ public SystemPasteFromClipboardAction(Shell shell, Clipboard clipboard)
+ {
+ super(SystemResources.ACTION_PASTE_LABEL,
+ PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_PASTE),
+ //SystemPlugin.getDefault().getImageDescriptor(ISystemConstants.ICON_SYSTEM_PASTE_ID),
+ shell);
+ _clipboard = clipboard;
+ _srcType = SystemDNDTransferRunnable.SRC_TYPE_RSE_RESOURCE;
+ setEnabled(false);
+
+ allowOnMultipleSelection(false);
+ setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORGANIZE);
+ setHelp(SystemPlugin.HELPPREFIX + "actn0117");
+ }
+
+ public void run()
+ {
+ if (_selection != null)
+ {
+ pasteClipboardToSelection(_selection);
+ }
+ }
+
+
+ private void pasteClipboardToSelection(Object target)
+ {
+ List srcObjects = SystemPlugin.getTheSystemRegistry().getSystemClipboardObjects(_srcType);
+ if (srcObjects.size() > 0)
+ {
+ // do the transfer
+ SystemDNDTransferRunnable runnable = new SystemDNDTransferRunnable(target, (ArrayList)srcObjects, getViewer(), _srcType);
+ if (target instanceof IAdaptable)
+ {
+ ISystemDragDropAdapter targetAdapter = (ISystemDragDropAdapter) ((IAdaptable) target).getAdapter(ISystemDragDropAdapter.class);
+
+ if (targetAdapter != null)
+ {
+ ISubSystem targetSubSystem = targetAdapter.getSubSystem(target);
+ List rulesList = new ArrayList();
+ int j = 0;
+ for (int i = 0; i < srcObjects.size(); i++)
+ {
+ if (srcObjects.get(i) instanceof ISchedulingRule)
+ {
+ rulesList.add(srcObjects.get(i));
+ j++;
+ }
+ /** FIXME - IREmoteFile is systems.core independent now
+ else if (srcObjects.get(i) instanceof IRemoteFile)
+ {
+ rulesList.add(new RemoteFileSchedulingRule((IRemoteFile)srcObjects.get(i)));
+ j++;
+ }
+ **/
+ }
+ if (target instanceof ISchedulingRule)
+ {
+ rulesList.add(target);
+ }
+ /** FIXME - IREmoteFile is systems.core independent now
+ else if (target instanceof IRemoteFile)
+ {
+ rulesList.add(new RemoteFileSchedulingRule((IRemoteFile)target));
+ }
+ */
+ else
+ {
+ rulesList.add(targetSubSystem);
+ }
+
+ ISchedulingRule[] rules = (ISchedulingRule[])rulesList.toArray(new ISchedulingRule[rulesList.size()]);
+ MultiRule rule = new MultiRule(rules);
+ //runnable.setRule(rule);
+ }
+ }
+ runnable.schedule();
+ SystemPlugin.getTheSystemRegistry().clearRunnableContext();
+ }
+ // clear clipboard
+ // _clipboard.setContents(new Object[] { null }, new Transfer[] { PluginTransfer.getInstance()});
+ // setEnabled(false);
+ }
+
+
+ /**
+ * The user has selected a remote object. Return null if OK is to be enabled, or a SystemMessage
+ * if it is not to be enabled. The message will be displayed on the message line.
+ *
+ * This is overridden in SystemMoveRemoteFileAction
+ */
+ public SystemMessage isValid(IHost selectedConnection, Object[] selectedObjects, ISystemRemoteElementAdapter[] remoteAdaptersForSelectedObjects)
+ {
+ return null;
+ }
+
+ public boolean hasSource()
+ {
+ synchronized (_clipboard)
+ {
+ try
+ {
+ Object object = _clipboard.getContents(PluginTransfer.getInstance());
+ if (object != null)
+ {
+ if (object instanceof PluginTransferData)
+ {
+ PluginTransferData data = (PluginTransferData) object;
+ byte[] result = data.getData();
+ if (result != null)
+ {
+ _srcType = SystemDNDTransferRunnable.SRC_TYPE_RSE_RESOURCE;
+ return true;
+ }
+ }
+ }
+ else
+ {
+ // clipboard must have resources or files
+ ResourceTransfer resTransfer = ResourceTransfer.getInstance();
+ object = _clipboard.getContents(resTransfer);
+ if (object != null)
+ {
+ IResource[] resourceData = (IResource[]) object;
+ if (resourceData.length > 0)
+ {
+ _srcType = SystemDNDTransferRunnable.SRC_TYPE_ECLIPSE_RESOURCE;
+ return true;
+ }
+ }
+ else
+ {
+ FileTransfer fileTransfer = FileTransfer.getInstance();
+ object = _clipboard.getContents(fileTransfer);
+
+ if (object != null)
+ {
+ String[] fileData = (String[]) object;
+ if (fileData.length > 0)
+ {
+ _srcType = SystemDNDTransferRunnable.SRC_TYPE_OS_RESOURCE;
+ return true;
+ }
+ }
+ else
+ {
+ TextTransfer textTransfer = TextTransfer.getInstance();
+ object = _clipboard.getContents(textTransfer);
+
+ if (object != null)
+ {
+ //String textData = (String) object;
+ _srcType = SystemDNDTransferRunnable.SRC_TYPE_TEXT;
+ return true;
+ }
+ }
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ }
+ }
+ return false;
+ }
+
+ /**
+ * We override from parent to do unique checking...
+ *
+ * We simply ensure every selected object is an IRemoteFile
+ *
+ * @see SystemBaseAction#updateSelection(IStructuredSelection)
+ */
+ public boolean updateSelection(IStructuredSelection selection)
+ {
+ if (hasSource())
+ {
+ boolean enable = true;
+ Iterator e = ((IStructuredSelection) selection).iterator();
+ while (enable && e.hasNext())
+ {
+ Object selectedObject = e.next();
+ if (selectedObject instanceof IAdaptable)
+ {
+ IAdaptable adaptable = (IAdaptable) selectedObject;
+ ISystemDragDropAdapter va = (ISystemDragDropAdapter) (adaptable.getAdapter(ISystemDragDropAdapter.class));
+ if (va != null)
+ {
+ enable = va.canDrop(selectedObject);
+ /* to allow disable of paste
+ * not sure if this is a performance hit or not
+ if (enable)
+ {
+ SubSystem tgtSS = va.getSubSystem(selectedObject);
+ List srcObjects = getClipboardObjects();
+ if (_srcType == SystemDNDTransferRunnable.SRC_TYPE_RSE_RESOURCE)
+ {
+
+ for (int i = 0; i < srcObjects.size() && enable; i++)
+ {
+ Object srcObject = srcObjects.get(i);
+ ISystemDragDropAdapter srcAdapter = (ISystemDragDropAdapter)((IAdaptable)srcObject).getAdapter(ISystemDragDropAdapter.class);
+ SubSystem srcSS = srcAdapter.getSubSystem(srcObject);
+ boolean sameSystem = (srcSS == tgtSS);
+ enable = va.validateDrop(srcObject, selectedObject, sameSystem);
+ }
+ }
+ else if (_srcType == SystemDNDTransferRunnable.SRC_TYPE_ECLIPSE_RESOURCE)
+ {
+ for (int i = 0; i < srcObjects.size() && enable; i++)
+ {
+ Object srcObject = srcObjects.get(i);
+ boolean sameSystem = false;
+ enable = va.validateDrop(srcObject, selectedObject, sameSystem);
+ }
+ }
+ else if (_srcType == SystemDNDTransferRunnable.SRC_TYPE_OS_RESOURCE)
+ {
+ for (int i = 0; i < srcObjects.size() && enable; i++)
+ {
+ Object srcObject = srcObjects.get(i);
+ boolean sameSystem = false;
+ enable = va.validateDrop(srcObject, selectedObject, sameSystem);
+ }
+ }
+
+ }
+ */
+ }
+ else
+ {
+ enable = false;
+ }
+ }
+ else
+ {
+ enable = false;
+ }
+ }
+ if (enable)
+ {
+ _selection = selection.getFirstElement();
+ }
+ return enable;
+ }
+ else
+ {
+ return false;
+ }
+
+ }
+
+ protected IRunnableContext getRunnableContext(Shell shell)
+ {
+ IRunnableContext irc = SystemPlugin.getTheSystemRegistry().getRunnableContext();
+ if (irc != null)
+ {
+ return irc;
+ }
+ else
+ {
+ /*
+ // for other cases, use statusbar
+ IWorkbenchWindow win = SystemPlugin.getActiveWorkbenchWindow();
+ if (win != null)
+ {
+ Shell winShell = SystemPlugin.getActiveWorkbenchShell();
+ if (winShell != null && !winShell.isDisposed() && winShell.isVisible())
+ {
+ SystemPlugin.logInfo("Using active workbench window as runnable context");
+ shell = winShell;
+ return win;
+ }
+ else
+ {
+ win = null;
+ }
+ }
+ */
+
+ irc = new ProgressMonitorDialog(shell);
+ SystemPlugin.getTheSystemRegistry().setRunnableContext(shell, irc);
+ return irc;
+ }
+ }
+
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPreferenceQualifyConnectionNamesAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPreferenceQualifyConnectionNamesAction.java
new file mode 100644
index 00000000000..2b023ae3066
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPreferenceQualifyConnectionNamesAction.java
@@ -0,0 +1,73 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.internal.model.SystemPreferenceChangeEvent;
+import org.eclipse.rse.model.ISystemPreferenceChangeEvents;
+import org.eclipse.rse.model.ISystemRegistry;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * The action is a shortcut to the preferences setting for showing connection names
+ * qualified by profile name.
+ */
+public class SystemPreferenceQualifyConnectionNamesAction extends SystemBaseAction
+
+{
+
+ private ISystemRegistry sr = null;
+ /**
+ * Constructor
+ */
+ public SystemPreferenceQualifyConnectionNamesAction(Shell parent)
+ {
+ super(SystemResources.ACTION_QUALIFY_CONNECTION_NAMES_LABEL,SystemResources.ACTION_QUALIFY_CONNECTION_NAMES_TOOLTIP,
+ parent);
+ setSelectionSensitive(false);
+ allowOnMultipleSelection(true);
+ sr = SystemPlugin.getTheSystemRegistry();
+ setChecked(sr.getQualifiedHostNames());
+
+ setHelp(SystemPlugin.HELPPREFIX+"actn0008");
+ }
+
+ /**
+ * This is the method called when the user selects this action.
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ public void run()
+ {
+ boolean newState = isChecked();
+ sr.setQualifiedHostNames(newState);
+ firePreferenceChangeEvent(ISystemPreferenceChangeEvents.EVENT_QUALIFYCONNECTIONNAMES,
+ !newState,newState); // defect 41794
+ }
+
+ /**
+ * Fire a preference change event
+ */
+ private void firePreferenceChangeEvent(int type, boolean oldValue, boolean newValue)
+ {
+ SystemPlugin.getDefault().getSystemRegistry().fireEvent(
+ new SystemPreferenceChangeEvent(type,
+ oldValue ? Boolean.TRUE : Boolean.FALSE,
+ newValue ? Boolean.TRUE : Boolean.FALSE));
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPreferenceRestoreStateAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPreferenceRestoreStateAction.java
new file mode 100644
index 00000000000..dd81600c206
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPreferenceRestoreStateAction.java
@@ -0,0 +1,72 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.SystemPreferencesManager;
+import org.eclipse.rse.internal.model.SystemPreferenceChangeEvent;
+import org.eclipse.rse.model.ISystemPreferenceChangeEvents;
+import org.eclipse.rse.model.ISystemRegistry;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * The action is a shortcut to the preferences setting for restoring the RSE to its
+ * previous state.
+ */
+public class SystemPreferenceRestoreStateAction extends SystemBaseAction
+
+{
+
+ private ISystemRegistry sr = null;
+ /**
+ * Constructor
+ */
+ public SystemPreferenceRestoreStateAction(Shell parent)
+ {
+ super(SystemResources.ACTION_RESTORE_STATE_PREFERENCE_LABEL,SystemResources.ACTION_RESTORE_STATE_PREFERENCE_TOOLTIP, parent);
+ setSelectionSensitive(false);
+ allowOnMultipleSelection(true);
+ sr = SystemPlugin.getTheSystemRegistry();
+ setChecked(SystemPreferencesManager.getPreferencesManager().getRememberState());
+
+ setHelp(SystemPlugin.HELPPREFIX+"aprefres");
+ }
+
+ /**
+ * This is the method called when the user selects this action.
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ public void run()
+ {
+ boolean newState = isChecked();
+ SystemPreferencesManager.getPreferencesManager().setRememberState(newState);
+ firePreferenceChangeEvent(ISystemPreferenceChangeEvents.EVENT_RESTORESTATE,
+ !newState,newState);
+ }
+
+ /**
+ * Fire a preference change event
+ */
+ private void firePreferenceChangeEvent(int type, boolean oldValue, boolean newValue)
+ {
+ SystemPlugin.getDefault().getSystemRegistry().fireEvent(
+ new SystemPreferenceChangeEvent(type,
+ oldValue ? Boolean.TRUE : Boolean.FALSE,
+ newValue ? Boolean.TRUE : Boolean.FALSE));
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPreferenceShowFilterPoolsAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPreferenceShowFilterPoolsAction.java
new file mode 100644
index 00000000000..d2fda542ee9
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPreferenceShowFilterPoolsAction.java
@@ -0,0 +1,72 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.SystemPreferencesManager;
+import org.eclipse.rse.internal.model.SystemPreferenceChangeEvent;
+import org.eclipse.rse.model.ISystemPreferenceChangeEvents;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * The action allows users to decide whether or not to show filter pools in the remote systems explorer.
+ * It is a fastpath/convenience method for this option in the preferences page.
+ */
+public class SystemPreferenceShowFilterPoolsAction extends SystemBaseAction
+
+{
+
+ //private SystemRegistry sr = null;
+ /**
+ * Constructor
+ */
+ public SystemPreferenceShowFilterPoolsAction(Shell parent)
+ {
+ super(SystemResources.ACTION_PREFERENCE_SHOW_FILTERPOOLS_LABEL,SystemResources.ACTION_PREFERENCE_SHOW_FILTERPOOLS_TOOLTIP,
+ parent);
+ allowOnMultipleSelection(true);
+ setChecked(SystemPreferencesManager.getPreferencesManager().getShowFilterPools());
+ setSelectionSensitive(false);
+
+ setHelp(SystemPlugin.HELPPREFIX+"actn0011");
+ }
+
+ /**
+ * This is the method called when the user selects this action.
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ public void run()
+ {
+ boolean newState = isChecked();
+ SystemPreferencesManager.getPreferencesManager().setShowFilterPools(newState);
+ firePreferenceChangeEvent(ISystemPreferenceChangeEvents.EVENT_SHOWFILTERPOOLS,
+ !newState,newState); // defect 41794
+ }
+
+ /**
+ * Fire a preference change event
+ */
+ private void firePreferenceChangeEvent(int type, boolean oldValue, boolean newValue)
+ {
+ SystemPlugin.getDefault().getSystemRegistry().fireEvent(
+ new SystemPreferenceChangeEvent(type,
+ oldValue ? Boolean.TRUE : Boolean.FALSE,
+ newValue ? Boolean.TRUE : Boolean.FALSE));
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPreferenceUserIdPerSystemTypeAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPreferenceUserIdPerSystemTypeAction.java
new file mode 100644
index 00000000000..bfb71676b94
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPreferenceUserIdPerSystemTypeAction.java
@@ -0,0 +1,83 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.SystemPreferencesManager;
+import org.eclipse.rse.core.SystemType;
+import org.eclipse.rse.model.ISystemResourceChangeEvents;
+import org.eclipse.rse.ui.dialogs.SystemUserIdPerSystemTypeDialog;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * A selectable system type overall default userId action.
+ */
+public class SystemPreferenceUserIdPerSystemTypeAction extends SystemBaseDialogAction
+
+{
+
+ private SystemType systemType;
+
+ /**
+ * Constructor
+ */
+ public SystemPreferenceUserIdPerSystemTypeAction(Shell parent, SystemType systemType)
+ {
+ super(systemType.getName()+"...",null,parent);
+ this.systemType = systemType;
+ setSelectionSensitive(false);
+
+ setHelp(SystemPlugin.HELPPREFIX+"actn0010");
+ }
+
+ /**
+ * @see SystemBaseAction#updateSelection(IStructuredSelection)
+ */
+ public boolean updateSelection(IStructuredSelection selection)
+ {
+ boolean enable = true;
+ return enable;
+ }
+
+ /*
+ * Override of parent
+ * @see #run()
+ */
+ protected Dialog createDialog(Shell parent)
+ {
+ return new SystemUserIdPerSystemTypeDialog(parent, systemType);
+ }
+
+ /**
+ * Required by parent. We use it to return the userId. Note the actual update is done!
+ */
+ protected Object getDialogValue(Dialog dlg)
+ {
+ String userId = null;
+ SystemUserIdPerSystemTypeDialog uidDlg = (SystemUserIdPerSystemTypeDialog)dlg;
+ if (!uidDlg.wasCancelled())
+ {
+ userId = uidDlg.getUserId();
+ SystemPreferencesManager.getPreferencesManager().setDefaultUserId(systemType.getName(), userId);
+ SystemPlugin.getTheSystemRegistry().fireEvent(ISystemResourceChangeEvents.PROPERTYSHEET_UPDATE_EVENT);
+ }
+ return userId;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemProfileNameCopyAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemProfileNameCopyAction.java
new file mode 100644
index 00000000000..f5b1b462140
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemProfileNameCopyAction.java
@@ -0,0 +1,224 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableContext;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.rse.core.SystemBasePlugin;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.internal.model.SystemProfileManager;
+import org.eclipse.rse.model.IHost;
+import org.eclipse.rse.model.ISystemProfile;
+import org.eclipse.rse.model.ISystemProfileManager;
+import org.eclipse.rse.model.ISystemRegistry;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.dialogs.SystemCopyProfileDialog;
+import org.eclipse.rse.ui.messages.SystemMessageDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+
+
+
+
+
+
+/**
+ * A copy profile action. Will copy the profile, and all connections for the profile.
+ * We must first prompt user for a new name for the copied profile.
+ */
+public class SystemProfileNameCopyAction extends SystemBaseDialogAction
+ implements ISystemMessages, IRunnableWithProgress
+{
+ private ISystemProfile profile, newProfile;
+ private ISystemProfileManager mgr;
+ private ISystemRegistry sr;
+ private String oldName,newName;
+ private boolean makeActive;
+ private Exception runException = null;
+
+ /**
+ * Constructor for selection-sensitive popup menu for profiles in Team view.
+ */
+ public SystemProfileNameCopyAction(Shell shell)
+ {
+ super(SystemResources.ACTION_PROFILE_COPY_LABEL, SystemResources.ACTION_PROFILE_COPY_TOOLTIP,
+ PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_COPY),
+ shell);
+ mgr = SystemProfileManager.getSystemProfileManager();
+ sr = SystemPlugin.getTheSystemRegistry();
+ setSelectionSensitive(true);
+ allowOnMultipleSelection(false);
+ setHelp(SystemPlugin.HELPPREFIX+"actndupr");
+ }
+
+ /**
+ * Set the profile
+ */
+ public void setProfile(ISystemProfile profile)
+ {
+ this.profile = profile;
+ }
+
+ /**
+ * Override of parent
+ * @see #run()
+ */
+ protected Dialog createDialog(Shell parent)
+ {
+ return new SystemCopyProfileDialog(parent, profile);
+ }
+
+ /**
+ * Required by parent. We use it to return the new name
+ */
+ protected Object getDialogValue(Dialog dlg)
+ {
+ newName = null;
+ SystemCopyProfileDialog rnmDlg = (SystemCopyProfileDialog)dlg;
+ if (!rnmDlg.wasCancelled())
+ {
+ oldName = profile.getName();
+ newName = rnmDlg.getNewName();
+ makeActive = rnmDlg.getMakeActive();
+ IRunnableContext runnableContext = getRunnableContext();
+ try
+ {
+ runnableContext.run(false,false,this); // inthread, cancellable, IRunnableWithProgress
+ if (makeActive && (newProfile!=null))
+ sr.setSystemProfileActive(newProfile, true);
+ }
+ catch (java.lang.reflect.InvocationTargetException exc) // unexpected error
+ {
+ showOperationMessage(exc, getShell());
+ //throw (Exception) exc.getTargetException();
+ }
+ catch (Exception exc)
+ {
+ showOperationMessage(exc, getShell());
+ //throw exc;
+ }
+ }
+ return newName;
+ }
+ /**
+ * Get an IRunnable context to show progress in. If there is currently a dialog or wizard up with
+ * a progress monitor in it, we will use this, else we will create a progress monitor dialog.
+ */
+ protected IRunnableContext getRunnableContext()
+ {
+ ISystemRegistry sr = SystemPlugin.getTheSystemRegistry();
+ IRunnableContext irc = sr.getRunnableContext();
+ if (irc == null)
+ irc = new ProgressMonitorDialog(getShell());
+ return irc;
+ }
+
+
+ // ----------------------------------
+ // INTERNAL METHODS...
+ // ----------------------------------
+ /**
+ * Method required by IRunnableWithProgress interface.
+ * Allows execution of a long-running operation modally by via a thread.
+ * In our case, it runs the copy operation with a visible progress monitor
+ */
+ public void run(IProgressMonitor monitor)
+ throws java.lang.reflect.InvocationTargetException,
+ java.lang.InterruptedException
+ {
+ String msg = getCopyingMessage(oldName,newName);
+ runException = null;
+
+ try
+ {
+ int steps = 0;
+ IHost[] conns = sr.getHostsByProfile(profile);
+ if ((conns != null) && (conns.length > 0))
+ steps = conns.length;
+ steps += 2; // for filterpools and subsystems
+ monitor.beginTask(msg, steps);
+ newProfile = sr.copySystemProfile(monitor, profile,newName,makeActive);
+ monitor.done();
+ }
+ catch(java.lang.InterruptedException exc)
+ {
+ monitor.done();
+ runException = exc;
+ throw (java.lang.InterruptedException)runException;
+ }
+ catch(Exception exc)
+ {
+ monitor.done();
+ runException = new java.lang.reflect.InvocationTargetException(exc);
+ throw (java.lang.reflect.InvocationTargetException)runException;
+ }
+
+ }
+
+
+ /**
+ * Helper method to return the message "Copying &1 to &2..."
+ */
+ public static String getCopyingMessage(String oldName, String newName)
+ {
+ SystemMessage msg = SystemPlugin.getPluginMessage(MSG_COPY_PROGRESS);
+ msg.makeSubstitution(oldName,newName);
+ return msg.getLevelOneText();
+ }
+
+ /**
+ * Helper method to show an error message resulting from the attempted operation.
+ */
+ protected void showOperationMessage(Exception exc, Shell shell)
+ {
+ if (exc instanceof java.lang.InterruptedException)
+ showOperationCancelledMessage(shell);
+ else if (exc instanceof java.lang.reflect.InvocationTargetException)
+ showOperationErrorMessage(shell, ((java.lang.reflect.InvocationTargetException)exc).getTargetException());
+ else
+ showOperationErrorMessage(shell, exc);
+ }
+
+ /**
+ * Show an error message when the operation fails.
+ * Shows a common message by default.
+ * Overridable.
+ */
+ protected void showOperationErrorMessage(Shell shell, Throwable exc)
+ {
+ SystemMessageDialog msgDlg = new SystemMessageDialog(shell, SystemPlugin.getPluginMessage(MSG_OPERATION_FAILED).makeSubstitution(exc.getMessage()));
+ msgDlg.open();
+ SystemBasePlugin.logError("Copy profile operation failed",exc);
+ }
+ /**
+ * Show an error message when the user cancels the operation.
+ * Shows a common message by default.
+ * Overridable.
+ */
+ protected void showOperationCancelledMessage(Shell shell)
+ {
+ SystemMessageDialog msgDlg = new SystemMessageDialog(shell, SystemPlugin.getPluginMessage(MSG_OPERATION_CANCELLED));
+ msgDlg.open();
+ }
+
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemProfileNameSelectAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemProfileNameSelectAction.java
new file mode 100644
index 00000000000..0689c23cfc0
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemProfileNameSelectAction.java
@@ -0,0 +1,59 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.internal.model.SystemProfileManager;
+import org.eclipse.rse.model.ISystemProfile;
+import org.eclipse.rse.model.ISystemProfileManager;
+import org.eclipse.rse.model.ISystemRegistry;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * A selectable profile name action.
+ */
+public class SystemProfileNameSelectAction extends SystemBaseAction
+
+{
+
+ private ISystemProfile profile;
+
+ /**
+ * Constructor
+ */
+ public SystemProfileNameSelectAction(Shell parent, ISystemProfile profile)
+ {
+ super(profile.getName(),parent);
+ this.profile = profile;
+ ISystemProfileManager mgr = SystemProfileManager.getSystemProfileManager();
+ setChecked(mgr.isSystemProfileActive(profile.getName()));
+ setSelectionSensitive(false);
+
+ setHelp(SystemPlugin.HELPPREFIX+"actn0004");
+ }
+
+
+ /**
+ * This is the method called when the user selects this action.
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ public void run()
+ {
+ ISystemRegistry sr = SystemPlugin.getTheSystemRegistry();
+ sr.setSystemProfileActive(profile, isChecked());
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRefreshAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRefreshAction.java
new file mode 100644
index 00000000000..d7239eeeba4
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRefreshAction.java
@@ -0,0 +1,98 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+import java.util.Iterator;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.model.ISystemContainer;
+import org.eclipse.rse.model.ISystemRegistry;
+import org.eclipse.rse.model.ISystemResourceChangeEvents;
+import org.eclipse.rse.model.ISystemResourceChangeListener;
+import org.eclipse.rse.model.SystemResourceChangeEvent;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * The action allows users to refresh the selected node in the Remote Systems Explorer tree view
+ */
+public class SystemRefreshAction extends SystemBaseAction
+ //
+{
+ private IStructuredSelection _selection = null;
+
+ /**
+ * Constructor
+ */
+ public SystemRefreshAction(Shell parent)
+ {
+ super(SystemResources.ACTION_REFRESH_LABEL, SystemResources.ACTION_REFRESH_TOOLTIP,
+ SystemPlugin.getDefault().getImageDescriptorFromIDE(ISystemIconConstants.ICON_IDE_REFRESH_ID), // D54577
+ parent);
+ allowOnMultipleSelection(true);
+ setContextMenuGroup(ISystemContextMenuConstants.GROUP_BUILD);
+ setHelp(SystemPlugin.HELPPREFIX+"actn0017");
+ setAvailableOffline(true);
+ }
+
+ /**
+ * @see SystemBaseAction#updateSelection(IStructuredSelection)
+ */
+ public boolean updateSelection(IStructuredSelection selection)
+ {
+ boolean enable = true;
+ _selection = selection;
+ return enable;
+ }
+
+ /**
+ * This is the method called when the user selects this action.
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ public void run()
+ {
+ ISystemRegistry sr = SystemPlugin.getTheSystemRegistry();
+ if (_selection != null)
+ {
+ Iterator iter = _selection.iterator();
+ while(iter.hasNext())
+ {
+ Object obj = iter.next();
+
+ if (obj instanceof ISystemContainer)
+ {
+ ((ISystemContainer)obj).markStale(true);
+ }
+ sr.fireEvent(new SystemResourceChangeEvent(obj, ISystemResourceChangeEvents.EVENT_REFRESH, obj));
+ }
+ }
+ else
+ {
+ if ((viewer != null) && (viewer instanceof ISystemResourceChangeListener))
+ {
+ sr.fireEvent((ISystemResourceChangeListener)viewer,
+ new SystemResourceChangeEvent(sr,
+ ISystemResourceChangeEvents.EVENT_REFRESH_SELECTED, null));
+ }
+ else
+ sr.fireEvent(new SystemResourceChangeEvent(sr, ISystemResourceChangeEvents.EVENT_REFRESH_SELECTED, null));
+ }
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRefreshAllAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRefreshAllAction.java
new file mode 100644
index 00000000000..549bce06e49
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRefreshAllAction.java
@@ -0,0 +1,102 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+import java.util.Iterator;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.model.ISystemContainer;
+import org.eclipse.rse.model.ISystemRegistry;
+import org.eclipse.rse.model.ISystemResourceChangeEvents;
+import org.eclipse.rse.model.SystemResourceChangeEvent;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * The action allows users to refresh the entire Remote Systems Explorer tree view
+ */
+public class SystemRefreshAllAction extends SystemBaseAction
+
+{
+
+ //private SystemProfile prevProfile = null;
+ private IStructuredSelection _selection = null;
+ private Object _rootObject = null;
+
+ /**
+ * Constructor for SystemRefreshAllAction
+ */
+ public SystemRefreshAllAction(Shell parent)
+ {
+ super(SystemResources.ACTION_REFRESH_ALL_LABEL,SystemResources.ACTION_REFRESH_ALL_TOOLTIP,
+ parent);
+ allowOnMultipleSelection(true);
+ setContextMenuGroup(ISystemContextMenuConstants.GROUP_BUILD);
+ //setSelectionSensitive(false);
+ setSelectionSensitive(true);// use selection to decide what to invalidate
+
+ setHelp(SystemPlugin.HELPPREFIX+"actn0009");
+ }
+
+ public void setRootObject(Object object)
+ {
+ _rootObject = object;
+ }
+
+ /**
+ * @see SystemBaseAction#updateSelection(IStructuredSelection)
+ */
+ public boolean updateSelection(IStructuredSelection selection)
+ {
+ boolean enable = true;
+ _selection = selection;
+ return enable;
+ }
+
+ /**
+ * This is the method called when the user selects this action.
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ public void run()
+ {
+ if (_selection != null)
+ {
+ // mark all selected objects as stale if applicable
+ Iterator iter = _selection.iterator();
+ while(iter.hasNext())
+ {
+ Object obj = iter.next();
+
+ if (obj instanceof ISystemContainer)
+ {
+ ((ISystemContainer)obj).markStale(true);
+ }
+ }
+ }
+ if (_rootObject != null)
+ {
+ if (_rootObject instanceof ISystemContainer)
+ {
+ ((ISystemContainer)_rootObject).markStale(true);
+ }
+ }
+ ISystemRegistry sr = SystemPlugin.getTheSystemRegistry();
+ sr.fireEvent(new SystemResourceChangeEvent(sr, ISystemResourceChangeEvents.EVENT_REFRESH, null));
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRemotePropertiesAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRemotePropertiesAction.java
new file mode 100644
index 00000000000..37f144056c8
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRemotePropertiesAction.java
@@ -0,0 +1,162 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+import java.text.MessageFormat;
+import java.util.Iterator;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.preference.PreferenceManager;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.core.SystemPropertyPageExtensionManager;
+import org.eclipse.rse.ui.GenericMessages;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.internal.dialogs.PropertyDialog;
+import org.eclipse.ui.internal.dialogs.PropertyPageManager;
+
+
+/**
+ * The action shows properties for remote objects
+ */
+public class SystemRemotePropertiesAction
+ extends SystemBaseAction
+
+{
+
+ /**
+ * Constructor
+ */
+ public SystemRemotePropertiesAction(Shell shell)
+ {
+ super(SystemResources.ACTION_REMOTE_PROPERTIES_LABEL, SystemResources.ACTION_REMOTE_PROPERTIES_TOOLTIP,shell);
+ allowOnMultipleSelection(false);
+ setContextMenuGroup(ISystemContextMenuConstants.GROUP_PROPERTIES);
+ }
+
+ /**
+ * We override from parent to do unique checking...
+ *
+ * It is too expense to check for registered property pages at popup time, so we just return true.
+ *
+ * @see SystemBaseAction#updateSelection(IStructuredSelection)
+ */
+ public boolean updateSelection(IStructuredSelection selection)
+ {
+ boolean enable = true;
+ return enable;
+ }
+
+ /**
+ * Returns the name of the given element.
+ * @param element the element
+ * @return the name of the element
+ */
+ private String getName(Object element)
+ {
+ return getAdapter(element).getName(element);
+ }
+ /**
+ * Returns whether the provided object has pages registered in the property page
+ * manager.
+ */
+ public boolean hasPropertyPagesFor(Object object)
+ {
+ //PropertyPageContributorManager manager = PropertyPageContributorManager.getManager();
+ return getOurPropertyPageManager().hasContributorsFor(getRemoteAdapter(object), object);
+ }
+ /**
+ * Get the remote property page extension manager
+ */
+ private SystemPropertyPageExtensionManager getOurPropertyPageManager()
+ {
+ return SystemPropertyPageExtensionManager.getManager();
+ }
+ /**
+ * Returns whether this action is actually applicable to the current selection.
+ * Returns true if there are any registered property pages applicable for the
+ * given input object.
+ *
+ * This method is generally too expensive to use when updating the enabled state
+ * of the action.
+ *
+ * If you override run with your own, then
+ * simply implement this to return null as it won't be used.
+ * @see #run()
+ */
+ protected Dialog createDialog(Shell shell)
+ {
+ dlg = new SystemResolveFilterStringDialog(shell, subsystem, filterString);
+
+ return dlg;
+ } // end createDialog()
+
+ /**
+ * Return selected object. If multiple objects are selected,
+ * returns the first selected object.
+ */
+ public Object getSelectedObject()
+ {
+ return getValue();
+ }
+
+} // end class SystemResolveFilterStringAction
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRunAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRunAction.java
new file mode 100644
index 00000000000..5616d8ca22d
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRunAction.java
@@ -0,0 +1,94 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.view.ISystemViewRunnableObject;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * The action is for any object that wants a "Run" action in their popup menu.
+ * The object must support the ISystemViewRunnableObject interface.
+ */
+public class SystemRunAction extends SystemBaseAction
+
+{
+
+ /**
+ * Constructor.
+ */
+ public SystemRunAction(Shell shell)
+ {
+ this(SystemResources.ACTION_RUN_LABEL, SystemResources.ACTION_RUN_TOOLTIP,
+ SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_RUN_ID),
+ shell);
+ }
+
+
+ /**
+ * Constructor.
+ * @param label
+ * @param tooltip
+ * @param image the image.
+ * @param shell the parent shell.
+ */
+ public SystemRunAction(String label, String tooltip, ImageDescriptor image, Shell shell)
+ {
+ super(label, tooltip, image, shell);
+ init();
+ }
+
+ /**
+ * Initialize.
+ */
+ protected void init() {
+ allowOnMultipleSelection(false);
+ setContextMenuGroup(ISystemContextMenuConstants.GROUP_OPEN);
+ setHelp(SystemPlugin.HELPPREFIX+"actn0100");
+ }
+
+
+ /**
+ * @see SystemBaseAction#updateSelection(IStructuredSelection)
+ */
+ public boolean updateSelection(IStructuredSelection selection)
+ {
+ boolean enable = true;
+ Object selectedObject = getFirstSelection();
+ if ((selectedObject == null) || !(selectedObject instanceof ISystemViewRunnableObject))
+ enable = false;
+ return enable;
+ }
+
+ /**
+ * This is the method called when the user selects this action.
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ public void run()
+ {
+ Object selectedObject = getFirstSelection();
+ if ((selectedObject == null) || !(selectedObject instanceof ISystemViewRunnableObject))
+ return;
+ ISystemViewRunnableObject runnable = (ISystemViewRunnableObject)selectedObject;
+ runnable.run(getShell());
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemSelectConnectionAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemSelectConnectionAction.java
new file mode 100644
index 00000000000..6ef2efb2cc4
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemSelectConnectionAction.java
@@ -0,0 +1,187 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.rse.model.IHost;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.dialogs.SystemSelectConnectionDialog;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * Use this action to put up a dialog allowing users to select one or
+ * more connections.
+ */
+public class SystemSelectConnectionAction extends SystemBaseDialogAction
+{
+ private boolean multiSelect;
+ private boolean showPropertySheetInitialState;
+ private boolean showPropertySheet;
+ private String message;
+ private boolean showNewConnectionPrompt = true;
+ private String[] systemTypes;
+ private String systemType;
+ private IHost defaultConn;
+ private Object result;
+
+ /**
+ * Constructor
+ */
+ public SystemSelectConnectionAction(Shell shell)
+ {
+ super(SystemResources.ACTION_SELECTCONNECTION_LABEL, SystemResources.ACTION_SELECTCONNECTION_TOOLTIP,null, shell);
+ }
+
+ /**
+ * Set the connection to default the selection to
+ */
+ public void setDefaultConnection(IHost conn)
+ {
+ this.defaultConn = conn;
+ }
+ /**
+ * Restrict to certain system types
+ * @param systemTypes the system types to restrict what connections are shown and what types of connections
+ * the user can create
+ * @see org.eclipse.rse.core.ISystemTypes
+ */
+ public void setSystemTypes(String[] systemTypes)
+ {
+ this.systemTypes = systemTypes;
+ }
+ /**
+ * Restrict to a certain system type
+ * @param systemType the system type to restrict what connections are shown and what types of connections
+ * the user can create
+ * @see org.eclipse.rse.core.ISystemTypes
+ */
+ public void setSystemType(String systemType)
+ {
+ this.systemType = systemType;
+ }
+ /**
+ * Set to true/false if a "New Connection..." special connection is to be shown for creating new connections.
+ * Defaault is true.
+ */
+ public void setShowNewConnectionPrompt(boolean show)
+ {
+ this.showNewConnectionPrompt = show;
+ }
+ /**
+ * Set the label text shown at the top of the dialog
+ */
+ public void setInstructionLabel(String message)
+ {
+ this.message = message;
+ }
+
+ /**
+ * Show the property sheet on the right hand side, to show the properties of the
+ * selected object.
+ *
+ * This overload always shows the property sheet
+ *
+ * Default is false
+ */
+ public void setShowPropertySheet(boolean show)
+ {
+ this.showPropertySheet = show;
+ }
+ /**
+ * Show the property sheet on the right hand side, to show the properties of the
+ * selected object.
+ *
+ * This overload shows a Details>>> button so the user can decide if they want to see the
+ * property sheet.
+ *
+ * @param show True if show the property sheet within the dialog
+ * @param initialState True if the property is to be initially displayed, false if it is not
+ * to be displayed until the user presses the Details button.
+ */
+ public void setShowPropertySheet(boolean show, boolean initialState)
+ {
+ this.showPropertySheet = show;
+ this.showPropertySheetInitialState = initialState;
+ }
+
+ /**
+ * Set multiple selection mode. Default is single selection mode
+ *
+ * If you turn on multiple selection mode, you must use the getSelectedObjects()
+ * method to retrieve the list of selected objects.
+ *
+ * Further, if you turn this on, it has the side effect of allowing the user
+ * to select any remote object. The assumption being if you are prompting for
+ * files, you also want to allow the user to select a folder, with the meaning
+ * being that all files within the folder are implicitly selected.
+ *
+ * @see #getSelectedObjects()
+ */
+ public void setMultipleSelectionMode(boolean multiple)
+ {
+ this.multiSelect = multiple;
+ }
+
+ /**
+ * Return the selected connection in single select mode
+ */
+ public IHost getSystemConnection()
+ {
+ if (result instanceof IHost)
+ return (IHost)result;
+ else if (result instanceof IHost[])
+ return ((IHost[])result)[0];
+ else
+ return null;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.core.ui.actions.SystemBaseDialogAction#createDialog(org.eclipse.swt.widgets.Shell)
+ */
+ protected Dialog createDialog(Shell shell)
+ {
+ SystemSelectConnectionDialog selectDlg = new SystemSelectConnectionDialog(shell);
+ if (defaultConn != null)
+ selectDlg.setDefaultConnection(defaultConn);
+ if (systemTypes != null)
+ selectDlg.setSystemTypes(systemTypes);
+ else if (systemType != null)
+ selectDlg.setSystemType(systemType);
+ selectDlg.setShowNewConnectionPrompt(showNewConnectionPrompt);
+ if (message != null)
+ selectDlg.setInstructionLabel(message);
+ if (showPropertySheet)
+ selectDlg.setShowPropertySheet(showPropertySheet,showPropertySheetInitialState);
+ selectDlg.setMultipleSelectionMode(multiSelect);
+ return selectDlg;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.core.ui.actions.SystemBaseDialogAction#getDialogValue(org.eclipse.jface.dialogs.Dialog)
+ */
+ protected Object getDialogValue(Dialog dlg)
+ {
+ SystemSelectConnectionDialog selectDlg = (SystemSelectConnectionDialog)dlg;
+ result = selectDlg.getOutputObject();
+ return result;
+ }
+
+
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemSeparatorAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemSeparatorAction.java
new file mode 100644
index 00000000000..77221c3243e
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemSeparatorAction.java
@@ -0,0 +1,58 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.widgets.Shell;
+/**
+ * Dummy action representing a separator in menus.
+ */
+public class SystemSeparatorAction extends SystemBaseAction
+{
+ private boolean realAction;
+
+ /**
+ * Constructor for SystemSeparatorAction when you intend to subclass
+ */
+ public SystemSeparatorAction(Shell parent)
+ {
+ super("_separator_",(ImageDescriptor)null,parent);
+ realAction = true;
+ }
+ /**
+ * Constructor for SystemSeparatorAction when you just want the separator
+ */
+ public SystemSeparatorAction()
+ {
+ super("_separator_",(ImageDescriptor)null,null);
+ realAction = false;
+ }
+
+ public Separator getSeparator()
+ {
+ return new Separator();
+ }
+
+ /**
+ * Return true if this is both a separator and a real action, false if this is only
+ * a separator
+ */
+ public boolean isRealAction()
+ {
+ return realAction;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemShowInMonitorAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemShowInMonitorAction.java
new file mode 100644
index 00000000000..cc94dfe5fc4
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemShowInMonitorAction.java
@@ -0,0 +1,103 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+
+import java.util.Iterator;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
+import org.eclipse.rse.ui.view.monitor.SystemMonitorUI;
+import org.eclipse.rse.ui.view.monitor.SystemMonitorViewPart;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+
+
+/**
+ * This is the default action for showing a remote object in a table
+ */
+public class SystemShowInMonitorAction extends SystemBaseAction
+{
+ private Object _selected;
+
+ /**
+ * Constructor.
+ * @param shell Shell of parent window, used as the parent for the dialog.
+ * Can be null, but be sure to call setParent before the action is used (ie, run).
+ */
+ public SystemShowInMonitorAction(Shell parent)
+ {
+ super(SystemResources.ACTION_MONITOR_LABEL,
+ SystemResources.ACTION_MONITOR_TOOLTIP,
+ SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_SHOW_MONITOR_ID),
+ parent);
+ setAvailableOffline(true);
+ }
+
+ /**
+ * Called when this action is selected from the popup menu.
+ */
+ public void run()
+ {
+ SystemMonitorViewPart viewPart = null;
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ try
+ {
+ viewPart = (SystemMonitorViewPart) page.showView(SystemMonitorUI.MONITOR_VIEW_ID, null, IWorkbenchPage.VIEW_CREATE);
+ }
+ catch (PartInitException e)
+ {
+ return;
+ }
+ catch (Exception e)
+ {
+ return;
+ }
+
+ viewPart.addItemToMonitor((IAdaptable) _selected);
+ page.activate(viewPart);
+
+ }
+
+ /**
+ * Called when the selection changes. The selection is checked to
+ * make sure this action can be performed on the selected object.
+ */
+ public boolean updateSelection(IStructuredSelection selection)
+ {
+ boolean enable = false;
+ Iterator e = ((IStructuredSelection) selection).iterator();
+ Object selected = e.next();
+
+ if (selected != null && selected instanceof IAdaptable)
+ {
+ ISystemViewElementAdapter va = (ISystemViewElementAdapter) ((IAdaptable) selected).getAdapter(ISystemViewElementAdapter.class);
+ if (va.hasChildren(selected))
+ {
+ _selected = selected;
+ enable = true;
+ }
+ }
+
+ return enable;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemShowInTableAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemShowInTableAction.java
new file mode 100644
index 00000000000..0061a4d88d9
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemShowInTableAction.java
@@ -0,0 +1,102 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+
+import java.util.Iterator;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
+import org.eclipse.rse.ui.view.SystemTableViewPart;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+
+
+/**
+ * This is the default action for showing a remote object in a table
+ */
+public class SystemShowInTableAction extends SystemBaseAction
+{
+ private Object _selected;
+
+ /**
+ * Constructor.
+ * @param shell Shell of parent window, used as the parent for the dialog.
+ * Can be null, but be sure to call setParent before the action is used (ie, run).
+ */
+ public SystemShowInTableAction(Shell parent)
+ {
+ super(SystemResources.ACTION_TABLE_LABEL,
+ SystemResources.ACTION_TABLE_TOOLTIP,
+ SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_SHOW_TABLE_ID),
+ parent);
+ setAvailableOffline(true);
+ }
+
+ /**
+ * Called when this action is selected from the popup menu.
+ */
+ public void run()
+ {
+ SystemTableViewPart viewPart = null;
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ try
+ {
+ viewPart = (SystemTableViewPart) page.showView("org.eclipse.rse.ui.view.systemTableView", null, IWorkbenchPage.VIEW_CREATE);
+ }
+ catch (PartInitException e)
+ {
+ return;
+ }
+ catch (Exception e)
+ {
+ return;
+ }
+
+ viewPart.setInput((IAdaptable) _selected);
+ page.activate(viewPart);
+
+ }
+
+ /**
+ * Called when the selection changes. The selection is checked to
+ * make sure this action can be performed on the selected object.
+ */
+ public boolean updateSelection(IStructuredSelection selection)
+ {
+ boolean enable = false;
+ Iterator e = ((IStructuredSelection) selection).iterator();
+ Object selected = e.next();
+
+ if (selected != null && selected instanceof IAdaptable)
+ {
+ ISystemViewElementAdapter va = (ISystemViewElementAdapter) ((IAdaptable) selected).getAdapter(ISystemViewElementAdapter.class);
+ if (va.hasChildren(selected))
+ {
+ _selected = selected;
+ enable = true;
+ }
+ }
+
+ return enable;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemShowPreferencesPageAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemShowPreferencesPageAction.java
new file mode 100644
index 00000000000..40784f1b33e
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemShowPreferencesPageAction.java
@@ -0,0 +1,217 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+//import com.ibm.etools.systems.model.*;
+//import com.ibm.etools.systems.model.impl.*;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.preference.IPreferenceNode;
+import org.eclipse.jface.preference.PreferenceDialog;
+import org.eclipse.jface.preference.PreferenceManager;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.ui.IActionDelegate;
+import org.eclipse.ui.IViewActionDelegate;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.internal.dialogs.WorkbenchPreferenceDialog;
+
+
+
+/**
+ * This action will launch the Prefences dialog, but only rooted at a given
+ * preference page (it will include its children underneath), including the
+ * child pages registered under that page ("category").
+ *
+ * This is used by the org.eclipse.rse.core.remoteSystemsViewPreferencesActions
+ * extension point.
+ * @see org.eclipse.rse.ui.actions.SystemCascadingPreferencesAction
+ */
+public class SystemShowPreferencesPageAction extends SystemBaseAction implements IViewActionDelegate
+{
+
+ private PreferenceManager preferenceManager;
+ private String[] preferencePageIDs;
+ private String preferencePageCategory;
+
+ /**
+ * Constructor. We are instantiated inside {@link SystemPlugin#getPreferencePageActionPlugins()}
+ * for each extension of our extension point
+ * The state-setting methods including setShell, setSelection and setValue.
+ */
+public class SystemSubMenuManager
+ extends MenuManager
+ //implements ISelectionChangedListener
+ //implements ISystemAction
+{
+ protected String toolTipText;
+ protected ImageDescriptor image = null;
+ protected Shell shell = null;
+ protected Viewer viewer = null;
+ protected boolean deferPopulation;
+ protected boolean traceSelections = false;
+ protected String traceTarget;
+ protected ISelection selection;
+ protected String label;
+ protected SystemBaseSubMenuAction parentCascadingAction;
+
+ /**
+ * Constructor for SystemSubMenuManager
+ */
+ public SystemSubMenuManager(SystemBaseSubMenuAction parentAction)
+ {
+ super();
+ this.parentCascadingAction = parentAction;
+ }
+ /**
+ * Constructor for SystemSubMenuManager
+ */
+ public SystemSubMenuManager(SystemBaseSubMenuAction parentAction, String text)
+ {
+ super(text);
+ this.label = text;
+ this.parentCascadingAction = parentAction;
+ }
+ /**
+ * Constructor for SystemSubMenuManager
+ */
+ public SystemSubMenuManager(SystemBaseSubMenuAction parentAction, String text, String id)
+ {
+ super(text, id);
+ this.label = text;
+ this.parentCascadingAction = parentAction;
+ }
+ /**
+ * Constructor for SystemSubMenuManager
+ */
+ public SystemSubMenuManager(SystemBaseSubMenuAction parentAction, String text, String id, ImageDescriptor image)
+ {
+ super(text, id);
+ this.label = text;
+ this.image = image;
+ this.parentCascadingAction = parentAction;
+ }
+
+ /**
+ * Return the parent cascading menu action that created this.
+ */
+ public SystemBaseSubMenuAction getParentCascadingAction()
+ {
+ return parentCascadingAction;
+ }
+
+ /**
+ * Set the tooltip text when this is used for in a cascading menu.
+ * @see org.eclipse.rse.ui.actions.SystemBaseSubMenuAction
+ */
+ public void setToolTipText(String tip)
+ {
+ this.toolTipText = tip;
+ }
+ /**
+ * Get the tooltip text when this is used for in a cascading menu
+ */
+ public String getToolTipText()
+ {
+ return toolTipText;
+ }
+
+ /**
+ * Return the label for this submenu
+ */
+ public String getLabel()
+ {
+ return label;
+ }
+
+ // ------------------------
+ // ISYSTEMACTION METHODS...
+ // ------------------------
+ /**
+ * An optimization for performance reasons that allows all inputs to be set in one call.
+ * This is called by SystemView's fillContextMenu method.
+ */
+ public void setInputs(Shell shell, Viewer v, ISelection selection)
+ {
+ if (traceSelections)
+ issueTraceMessage(" INSIDE SETINPUTS FOR SUBMENUMGR FOR '"+label+"'");
+ this.shell = shell;
+ this.viewer = v;
+ this.selection = selection;
+ if (parentCascadingAction != null)
+ parentCascadingAction.setInputsFromSubMenuManager(shell, v, selection);
+ cascadeAllInputs();
+ }
+
+
+ /**
+ * Sets the parent shell for this action. Usually context dependent.
+ * We cascade this down to all of the actions added to this submenu.
+ */
+ public void setShell(Shell shell)
+ {
+ this.shell = shell;
+ IContributionItem[] items = getItems();
+ for (int idx=0; idx < items.length; idx++)
+ {
+ if ((items[idx] instanceof ActionContributionItem) &&
+ (((ActionContributionItem)items[idx]).getAction() instanceof ISystemAction))
+ {
+ ISystemAction item = (ISystemAction) ( ((ActionContributionItem)items[idx]).getAction() );
+ item.setShell(shell);
+ }
+ else if (items[idx] instanceof SystemSubMenuManager)
+ {
+ SystemSubMenuManager item = (SystemSubMenuManager)items[idx];
+ item.setShell(shell);
+ }
+ }
+ if (traceSelections)
+ {
+ issueTraceMessage("*** INSIDE SETSHELL FOR SUBMENUMGR "+label+". #ITEMS = "+items.length);
+ }
+
+ }
+
+ /**
+ * This is called by the framework to set the selection input, just prior to showing the popup menu.
+ * We cascade this down to all of the actions added to this submenu.
+ */
+ public void setSelection(ISelection selection)
+ {
+ this.selection = selection;
+ IContributionItem[] items = getItems();
+ for (int idx=0; idx < items.length; idx++)
+ {
+ if ((items[idx] instanceof ActionContributionItem) &&
+ (((ActionContributionItem)items[idx]).getAction() instanceof ISystemAction))
+ {
+ ISystemAction item = (ISystemAction) ( ((ActionContributionItem)items[idx]).getAction() );
+ item.setSelection(selection);
+ }
+ else if (items[idx] instanceof SystemSubMenuManager)
+ {
+ SystemSubMenuManager item = (SystemSubMenuManager)items[idx];
+ item.setSelection(selection);
+ }
+ }
+ if (traceSelections)
+ {
+ issueTraceMessage("*** INSIDE SETSELECTION FOR SUBMENUMGR"+label+". #ITEMS = "+items.length);
+ }
+
+ }
+ /**
+ * Set the Viewer that called this action. It is good practice for viewers to call this
+ * so actions can directly access them if needed.
+ */
+ public void setViewer(Viewer v)
+ {
+ this.viewer = v;
+ IContributionItem[] items = getItems();
+ for (int idx=0; idx < items.length; idx++)
+ {
+ if ((items[idx] instanceof ActionContributionItem) &&
+ (((ActionContributionItem)items[idx]).getAction() instanceof ISystemAction))
+ {
+ ISystemAction item = (ISystemAction) ( ((ActionContributionItem)items[idx]).getAction() );
+ item.setViewer(viewer);
+ }
+ else if (items[idx] instanceof SystemSubMenuManager)
+ {
+ SystemSubMenuManager item = (SystemSubMenuManager)items[idx];
+ item.setViewer(viewer);
+ }
+ }
+ }
+
+ /**
+ * Get the Viewer that called this action. Not guaranteed to be set,
+ * depends if that viewer called setViewer or not. SystemView does.
+ */
+ public Viewer getViewer()
+ {
+ return viewer;
+ }
+ /**
+ * Get the Shell that hosts this action. Not guaranteed to be set,
+ */
+ public Shell getShell()
+ {
+ return shell;
+ }
+ /**
+ * Get the Selection
+ */
+ public IStructuredSelection getSelection()
+ {
+ return (IStructuredSelection)selection;
+ }
+
+ /**
+ * @see ContributionManager#add(IAction)
+ */
+
+ // add(): solve problem that cascaded menu items were not receiving their
+ // setSelection() call, due to them only being constructed on the
+ // cascade's MenuAboutToShow(), after the setSelections have run.
+
+ // THE QUESTION IS, IF WE DO THIS HERE WHEN ITEMS ARE ADDED TO THIS SUBMENU,
+ // IS IT REDUNDANT TO ALSO DO IT WHEN SETINPUTS IS CALLED?
+
+ /**
+ * Intercept so we can cascade the selection, viewer and shell down
+ */
+ public void appendToGroup(String groupName, IAction action)
+ {
+ super.appendToGroup(groupName, action);
+ if (action instanceof ISystemAction)
+ cascadeAllInputs((ISystemAction)action);
+ }
+ /**
+ * Intercept so we can cascade the selection, viewer and shell down
+ */
+ public void appendToGroup(String groupName, IContributionItem item)
+ {
+ super.appendToGroup(groupName, item);
+ if (item instanceof SystemSubMenuManager)
+ cascadeAllInputs((SystemSubMenuManager)item);
+ }
+ /**
+ * Intercept so we can cascade the selection, viewer and shell down
+ * THIS WAS ONLY CATCHING ACTIONS, NOT NESTED SUBMENUS. THE SUPER OF THIS
+ * METHOD CALLS ADD(new ActionContributionItem(action)) SO WE NOW INTERCEPT
+ * THERE INSTEAD, AS THAT IS WHAT IS CALLED FOR MULTI-CASCADING MENUS
+ public void add(IAction action)
+ {
+ super.add(action);
+ if (action instanceof ISystemAction)
+ cascadeAllInputs((ISystemAction)action);
+ }*/
+ /**
+ * Intercept so we can cascade the selection, viewer and shell down
+ */
+ public void add(IContributionItem item)
+ {
+ super.add(item);
+ if (item instanceof ActionContributionItem)
+ {
+ IAction action = ((ActionContributionItem)item).getAction();
+ if (action instanceof ISystemAction)
+ cascadeAllInputs((ISystemAction)action);
+ }
+ else if (item instanceof SystemSubMenuManager)
+ cascadeAllInputs((SystemSubMenuManager)item);
+ }
+
+ /**
+ * Cascade in one shot all input state inputs to all actions
+ */
+ protected void cascadeAllInputs()
+ {
+ //super.menuAboutToShow(ourSubMenu);
+ IContributionItem[] items = getItems();
+ if (traceSelections)
+ {
+ issueTraceMessage("INSIDE CASCADEALLINPUTS FOR SUBMENUMGR FOR "+label+". NBR ITEMS = "+items.length);
+ }
+
+ for (int idx=0; idx < items.length; idx++)
+ {
+ if ((items[idx] instanceof ActionContributionItem) &&
+ (((ActionContributionItem)items[idx]).getAction() instanceof ISystemAction))
+ {
+ ISystemAction item = (ISystemAction) ( ((ActionContributionItem)items[idx]).getAction() );
+ if (!item.isDummy())
+ cascadeAllInputs(item);
+ }
+ else if (items[idx] instanceof SystemSubMenuManager)
+ {
+ SystemSubMenuManager item = (SystemSubMenuManager)items[idx];
+ cascadeAllInputs(item);
+ }
+ }
+
+ }
+ /**
+ * Cascade in one shot all input state inputs to one action
+ */
+ protected void cascadeAllInputs(ISystemAction action)
+ {
+ if (action.isDummy())
+ return; // waste of time
+ if (shell != null)
+ action.setShell(shell);
+ if (viewer != null)
+ action.setViewer(viewer);
+ if (selection != null)
+ action.setSelection(selection);
+ }
+ /**
+ * Cascade in one shot all input state inputs to one submenu
+ */
+ protected void cascadeAllInputs(SystemSubMenuManager submenu)
+ {
+ if (shell != null)
+ submenu.setShell(shell);
+ if (viewer != null)
+ submenu.setViewer(viewer);
+ if (selection != null)
+ submenu.setSelection(selection);
+ }
+ // ------------------------
+ // HELPER METHODS...
+ // ------------------------
+ /**
+ * Turn on tracing for selections, shell and viewer to watch as it is set
+ */
+ public void setTracing(boolean tracing)
+ {
+ traceSelections = tracing;
+ }
+ /**
+ * Turn on tracing for selections, shell and viewer to watch as it is set,
+ * scoped to a particular class name (will use indexOf('xxx') to match).
+ */
+ public void setTracing(String tracingClassTarget)
+ {
+ traceSelections = (tracingClassTarget != null);
+ traceTarget = tracingClassTarget;
+ }
+ /**
+ * Turn on tracing for selections, shell and viewer to watch as it is set,
+ * scoped to a particular class name (will use indexOf('xxx') to match).
+ */
+ public void setTracing(boolean tracing, String tracingClassTarget)
+ {
+ traceSelections = tracing;
+ traceTarget = tracingClassTarget;
+ }
+
+ /**
+ * Issue trace message
+ */
+ protected void issueTraceMessage(String msg)
+ {
+ if (traceSelections)
+ {
+ String className = this.getClass().getName();
+ if ((traceTarget==null) || (className.indexOf(traceTarget)>=0))
+ {
+ className = className.substring(className.lastIndexOf('.'));
+ SystemBasePlugin.logInfo(className+": "+msg);
+ }
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemSubMenuManagerForTesting.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemSubMenuManagerForTesting.java
new file mode 100644
index 00000000000..888a8071560
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemSubMenuManagerForTesting.java
@@ -0,0 +1,180 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * For cascading menus, we need our own menu subclass so we can intercept
+ * the state-setting methods our frameworks, and foreword those onto the
+ * sub-menu actions.
+ *
+ * The state-setting methods including setShell, setSelection and setValue.
+ *
+ * We often have trouble tracking down when the shell, selection and viewer is
+ * not properly set for cascading actions. For these cases, we can use this
+ * override of the SystemSubMenuManager to trace what happens.
+ */
+public class SystemSubMenuManagerForTesting
+ extends SystemSubMenuManager
+ //implements ISelectionChangedListener
+ //implements ISystemAction
+{
+ private String prefix = "";
+
+ /**
+ * Constructor
+ */
+ public SystemSubMenuManagerForTesting(SystemBaseSubMenuAction parentAction)
+ {
+ super(parentAction);
+ }
+ /**
+ * Constructor
+ */
+ public SystemSubMenuManagerForTesting(SystemBaseSubMenuAction parentAction, String text)
+ {
+ super(parentAction, text);
+ System.out.println("SUBMENUMGR CTOR " + text);
+ }
+ /**
+ * Constructor
+ */
+ public SystemSubMenuManagerForTesting(SystemBaseSubMenuAction parentAction, String text, String id)
+ {
+ super(parentAction, text, id);
+ System.out.println("SUBMENUMGR CTOR " + text);
+ }
+ /**
+ * Constructor
+ */
+ public SystemSubMenuManagerForTesting(SystemBaseSubMenuAction parentAction, String text, String id, ImageDescriptor image)
+ {
+ super(parentAction, text, id, image);
+ }
+
+
+ /**
+ * Override of parent so we can trace it....
+ */
+ public void setInputs(Shell shell, Viewer v, ISelection selection)
+ {
+ System.out.println(" INSIDE SETINPUTS FOR SUBMENUMGR '"+label+"': selection = "+selection);
+ super.setInputs(shell, v, selection);
+ }
+
+
+
+
+ // add(): solve problem that cascaded menu items were not receiving their
+ // setSelection() call, due to them only being constructed on the
+ // cascade's MenuAboutToShow(), after the setSelections have run.
+
+ // THE QUESTION IS, IF WE DO THIS HERE WHEN ITEMS ARE ADDED TO THIS SUBMENU,
+ // IS IT REDUNDANT TO ALSO DO IT WHEN SETINPUTS IS CALLED?
+
+ /**
+ * Intercept so we can cascade the selection, viewer and shell down
+ */
+ public void appendToGroup(String groupName, IAction action)
+ {
+ System.out.println("INSIDE APPENDTOGROUP OF ISYSTEMACTION FOR SUBMENUMGR FOR '"+label+"'");
+ prefix = " ";
+ super.appendToGroup(groupName, action);
+ prefix = "";
+ }
+ /**
+ * Intercept so we can cascade the selection, viewer and shell down
+ */
+ public void appendToGroup(String groupName, IContributionItem item)
+ {
+ System.out.println("INSIDE APPENDTOGROUP OF SYSTEMSUBMENUMGR FOR SUBMENUMGR FOR '"+label+"'");
+ prefix = " ";
+ super.appendToGroup(groupName, item);
+ prefix = "";
+ }
+ /**
+ * Intercept so we can cascade the selection, viewer and shell down
+ * THIS WAS ONLY CATCHING ACTIONS, NOT NESTED SUBMENUS. THE SUPER OF THIS
+ * METHOD CALLS ADD(new ActionContributionItem(action)) SO WE NOW INTERCEPT
+ * THERE INSTEAD, AS THAT IS WHAT IS CALLED FOR MULTI-CASCADING MENUS
+ public void add(IAction action)
+ {
+ super.add(action);
+ if (action instanceof ISystemAction)
+ cascadeAllInputs((ISystemAction)action);
+ }*/
+ /**
+ * Intercept so we can cascade the selection, viewer and shell down
+ */
+ public void add(IContributionItem item)
+ {
+ prefix = " ";
+ if (item instanceof ActionContributionItem)
+ {
+ IAction action = ((ActionContributionItem)item).getAction();
+ if (action instanceof ISystemAction)
+ System.out.println("INSIDE ADD OF ISYSTEMACTION(action="+action.getText()+") FOR THIS MNUMGR: "+label);
+ }
+ else if (item instanceof SystemSubMenuManager)
+ {
+ SystemSubMenuManager submenu = (SystemSubMenuManager)item;
+ System.out.println("INSIDE ADD OF SUBMENUMGR(submenu="+submenu.getLabel()+") FOR THIS MNUMGR: "+label);
+ }
+ super.add(item);
+ prefix = "";
+ }
+
+ /**
+ * Cascade in one shot all input state inputs to all actions
+ */
+ protected void cascadeAllInputs()
+ {
+ //super.menuAboutToShow(ourSubMenu);
+ IContributionItem[] items = getItems();
+ System.out.println(prefix+"INSIDE CASCADEALLINPUTS TO ALL ITEMS FOR SUBMENUMGR FOR "+label+". NBR ITEMS = "+items.length);
+ System.out.println(prefix+"...shell = "+shell+", viewer = "+viewer+", selection = "+selection);
+ String oldPrefix = prefix;
+ prefix += " ";
+ super.cascadeAllInputs();
+ prefix = oldPrefix;
+ }
+ /**
+ * Cascade in one shot all input state inputs to one action
+ */
+ protected void cascadeAllInputs(ISystemAction action)
+ {
+ System.out.println(prefix+"INSIDE CASCADEALLINPUTS TO ISYSTEMACTION(action="+action.getText()+") FOR THIS MNUMGR: "+label);
+ System.out.println(prefix+"...shell = "+shell+", viewer = "+viewer+", selection = "+selection);
+ super.cascadeAllInputs(action);
+ }
+ /**
+ * Cascade in one shot all input state inputs to one submenu
+ */
+ protected void cascadeAllInputs(SystemSubMenuManager submenu)
+ {
+ System.out.println("INSIDE CASCADEALLINPUTS TO SUBMENUMGR(submenu="+submenu.getLabel()+") FOR THIS MNUMGR: "+label);
+ System.out.println("...shell = "+shell+", viewer = "+viewer+", selection = "+selection);
+ super.cascadeAllInputs(submenu);
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemTablePrintAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemTablePrintAction.java
new file mode 100644
index 00000000000..89ec5bd12ae
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemTablePrintAction.java
@@ -0,0 +1,523 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+
+import java.text.DateFormat;
+import java.util.Date;
+
+import org.eclipse.rse.ui.SystemPropertyResources;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.view.SystemTableView;
+import org.eclipse.rse.ui.view.SystemTableViewProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.printing.PrintDialog;
+import org.eclipse.swt.printing.Printer;
+import org.eclipse.swt.printing.PrinterData;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+
+
+
+/**
+ * This is the action for printing the contents of the table view
+ */
+public class SystemTablePrintAction extends SystemBaseAction
+{
+
+ private int[] _columnWidths = null;
+ private int[] _columnAlignments = null;
+
+ private boolean bPrintSelection;
+ private boolean bPageRange;
+
+ private int endLine;
+ private int bottomMargin = 100;
+ private int leftMargin = 100;
+ private int rightMargin = 100;
+ private int topMargin = 100;
+
+ private String sPrintOutputName = null;
+ private String sPageTitle = null;
+ private String sTableTitle = null;
+ private String sColumnHeader = null;
+ private String sUnderLine = null;
+ private String sEndOfListing = null;
+
+ private int pageNumber = 1;
+ private boolean startedPage = false;
+ int startPage;
+ int endPage;
+
+ private int pageHeight;
+ private int pageWidth;
+ private int x;
+ private int y = 0;
+ private int w;
+ private int textHeight;
+
+ private Printer printer;
+ private boolean bPrintPage;
+ private GC g;
+
+ private SystemTableView _viewer = null;
+ private String _title = null;
+ private boolean _hasColumns = false;
+
+ /**
+ * Constructor.
+ * @param title the title for the print document
+ * @param viewer the viewer to print the contents of
+ */
+ public SystemTablePrintAction(String title, SystemTableView viewer)
+ {
+ super(SystemResources.ACTION_PRINTLIST_LABEL, null);
+ setToolTipText(SystemResources.ACTION_PRINTLIST_TOOLTIP);
+ setTableView(title, viewer);
+ }
+
+ /**
+ * Sets the title for the print document and the table view to print from
+ * @param title the title for the print document
+ * @param viewer the viewer to print the contents of
+ */
+ public void setTableView(String title, SystemTableView viewer)
+ {
+ _title = title;
+ _viewer = viewer;
+ }
+
+ /**
+ * Called to check whether this action should be enabled.
+ */
+ public void checkEnabledState()
+ {
+ if (_viewer != null && _viewer.getInput() != null)
+ {
+ setEnabled(true);
+ }
+ else
+ {
+ setEnabled(false);
+ }
+ }
+
+ /**
+ * Called when the user chooses to print
+ */
+ public void run()
+ {
+ // page format info
+ DateFormat dateFormatter = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
+ String sCurrentDate = dateFormatter.format(new Date());
+
+ sPrintOutputName = SystemResources.RESID_TABLE_PRINTLIST_TITLE;
+ sPageTitle = sPrintOutputName;
+ sPageTitle = sPageTitle + sCurrentDate;
+
+ // Table title
+ sTableTitle = _title;
+
+ /*============================*/
+ /* Present the print dialog */
+ /*============================*/
+ PrintDialog printDialog = new PrintDialog(_viewer.getShell());
+
+ PrinterData printerData = printDialog.open();
+ if (printerData == null) // user cancelled the print job?
+ {
+ return;
+ }
+ // get updated settings from the print dialog
+ bPrintSelection = (printerData.scope & PrinterData.SELECTION) != 0;
+ bPageRange = printerData.scope == PrinterData.PAGE_RANGE;
+
+ Table table = _viewer.getTable();
+
+ TableItem[] printItems = table.getItems();
+ if (bPrintSelection)
+ {
+ printItems = table.getSelection();
+ endLine = printItems.length;
+ if (endLine == 0)
+ return; // nothing to print
+ }
+ else if (bPageRange)
+ {
+ endLine = printItems.length;
+ startPage = printerData.startPage;
+ endPage = printerData.endPage;
+ if (endPage < startPage)
+ return; // nothing to print
+ }
+
+ /*===================*/
+ /* do the printing */
+ /*===================*/
+ // start print job
+ printer = new Printer(printerData);
+
+ if (!printer.startJob(sPrintOutputName))
+ {
+ printer.dispose();
+ return;
+ }
+
+ Rectangle clientArea = printer.getClientArea();
+
+ pageHeight = clientArea.height;
+ pageWidth = clientArea.width;
+ g = new GC(printer);
+
+ textHeight = g.getFontMetrics().getHeight();
+
+ /*----------------------------------------*/
+ /* go through all the lines to print... */
+ /*----------------------------------------*/
+ pageNumber = 1;
+ startedPage = false;
+
+ // scale factor
+ int scaleFactor = 1;
+ Rectangle tableClientArea = table.getClientArea();
+ int tableWidth = tableClientArea.width - 5;
+ if (tableWidth > pageWidth)
+ {
+ scaleFactor = tableWidth / pageWidth;
+ }
+
+ int columnCount = table.getColumnCount();
+ if (columnCount > 1)
+ {
+ _hasColumns = true;
+ }
+ else
+ {
+ _hasColumns = false;
+ }
+
+ // header info
+
+ getColumnInfo(scaleFactor);
+ sColumnHeader = getColumnHeader();
+ sUnderLine = getHeaderSeparator();
+
+ sEndOfListing = getTableFooter();
+
+ for (int i = 0; i < printItems.length; i++)
+ {
+ TableItem item = printItems[i];
+ Object data = item.getData();
+
+ String line = getLine(data, columnCount);
+
+ printLine(line);
+ }
+
+ printLine(" ");
+ printLine(sEndOfListing);
+
+ /*=======================*/
+ /* finish up print job */
+ /*=======================*/
+ g.dispose();
+
+ printer.endJob();
+ printer.dispose();
+
+ System.gc();
+ return;
+ }
+
+ /*
+ * Print one line
+ */
+ private void printLine(String text)
+ {
+ do // until the text of one line is printed
+ {
+ // start a new page
+ if (!startedPage)
+ {
+ if (bPageRange)
+ {
+ if (pageNumber >= startPage && pageNumber <= endPage)
+ bPrintPage = true;
+ else
+ bPrintPage = false;
+ }
+ else
+ bPrintPage = true;
+
+ startedPage = true;
+ x = leftMargin;
+ y = topMargin;
+ if (bPrintPage)
+ {
+ printer.startPage();
+ g.drawString(sPageTitle + pageNumber, x, y);
+
+ y += textHeight * 2;
+
+ g.drawString(sTableTitle, x, y);
+ y += textHeight * 2;
+
+ g.drawString(sColumnHeader, x, y);
+ y += textHeight;
+
+ g.drawString(sUnderLine, x, y);
+ y += textHeight;
+ }
+ else
+ {
+ y = topMargin + textHeight * 6;
+ }
+ pageNumber++;
+ }
+ // start at beginning of the line
+ x = leftMargin;
+
+ if (text != null)
+ {
+ int l = text.length();
+ while (l > 0)
+ {
+ w = g.stringExtent(text.substring(0, l)).x;
+ if (x + w <= pageWidth - rightMargin)
+ {
+ break;
+ }
+ l--;
+ }
+ String remainingText = null; // text spillin' to next print line
+ if (l > 0 && l < text.length())
+ {
+ remainingText = text.substring(l);
+ text = text.substring(0, l);
+ }
+ if (bPrintPage)
+ g.drawString(text, x, y);
+ text = remainingText; // still to print text spillin' over edge
+ }
+ // finished a print line, go to next
+ y += textHeight;
+ // done with this page (a new line height doesn't fit)?
+ if (y + textHeight > pageHeight - bottomMargin)
+ {
+ if (bPrintPage)
+ printer.endPage();
+ startedPage = false;
+ }
+ }
+ while (text != null); //end do
+ }
+
+ private void getColumnInfo(int scaleFactor)
+ {
+ // scale widths
+ Table table = _viewer.getTable();
+ if (table.getColumnCount() > 1)
+ {
+ _hasColumns = true;
+ }
+ else
+ {
+ _hasColumns = false;
+ }
+
+ if (_hasColumns)
+ {
+ _columnWidths = new int[table.getColumnCount()];
+ _columnAlignments = new int[table.getColumnCount()];
+
+ for (int i = 0; i < table.getColumnCount(); i++)
+ {
+ TableColumn column = table.getColumn(i);
+ int width = column.getWidth();
+ _columnWidths[i] = width / 9;
+ _columnAlignments[i] = column.getAlignment();
+ }
+ }
+ }
+
+ private String getColumnHeader()
+ {
+ StringBuffer sbColumnHeader = new StringBuffer("");
+ sbColumnHeader.append(getBlankLine());
+
+ if (_hasColumns)
+ {
+ IPropertyDescriptor[] descriptors = _viewer.getVisibleDescriptors(_viewer.getInput());
+ sbColumnHeader.insert(0, SystemPropertyResources.RESID_PROPERTY_NAME_LABEL);
+
+ int offset = _columnWidths[0];
+ sbColumnHeader.insert(offset, " ");
+ offset++;
+
+ for (int i = 0; i < descriptors.length; i++)
+ {
+ String label = descriptors[i].getDisplayName();
+ int columnWidth = _columnWidths[i + 1];
+ int labelWidth = label.length();
+
+ if (_columnAlignments[i + 1] == SWT.LEFT)
+ {
+ if (labelWidth > columnWidth)
+ {
+ label = label.substring(0, columnWidth - 3);
+ label += "...";
+ }
+ sbColumnHeader.insert(offset, label);
+ }
+ else
+ {
+
+ int rightOffset = offset + (columnWidth - labelWidth) - 1;
+
+ if (rightOffset < offset)
+ {
+ int delta = (offset - rightOffset) - 3;
+ label = label.substring(0, delta);
+ label += "...";
+ rightOffset = offset;
+ }
+
+ sbColumnHeader.insert(rightOffset, label);
+ }
+
+ offset += columnWidth;
+ sbColumnHeader.insert(offset, " ");
+ offset++;
+ }
+ }
+ return sbColumnHeader.toString();
+ }
+
+ private String getHeaderSeparator()
+ {
+ StringBuffer separator = new StringBuffer("");
+ if (_hasColumns)
+ {
+ for (int i = 0; i < _columnWidths.length; i++)
+ {
+ int width = _columnWidths[i];
+ for (int t = 0; t < width; t++)
+ {
+ separator.append("-");
+ }
+
+ separator.append(" ");
+ }
+ }
+
+ return separator.toString();
+ }
+
+ private String getTableFooter()
+ {
+ String footer = " * * * * * E N D O F L I S T I N G * * * * *";
+ return footer;
+ }
+
+ private int getTotalWidth()
+ {
+ int totalWidth = 0;
+ if (_hasColumns)
+ {
+ for (int i = 0; i < _columnWidths.length; i++)
+ {
+ totalWidth += _columnWidths[i];
+ }
+ }
+ else
+ {
+ totalWidth = pageWidth;
+ }
+
+ return totalWidth;
+ }
+
+ private String getBlankLine()
+ {
+ StringBuffer blankLine = new StringBuffer();
+
+ int totalWidth = getTotalWidth();
+ for (int b = 0; b < totalWidth; b++)
+ {
+ blankLine.append(" ");
+ }
+
+ return blankLine.toString();
+ }
+
+ private String getLine(Object object, int numColumns)
+ {
+ StringBuffer line = new StringBuffer("");
+
+ SystemTableViewProvider lprovider = (SystemTableViewProvider) _viewer.getLabelProvider();
+ if (_hasColumns)
+ {
+ line.append(getBlankLine());
+ int offset = 0;
+ for (int column = 0; column < numColumns; column++)
+ {
+ String columnText = lprovider.getColumnText(object, column);
+ int labelWidth = columnText.length();
+
+ int columnWidth = _columnWidths[column];
+ if (_columnAlignments[column] == SWT.LEFT)
+ {
+ if (labelWidth > columnWidth)
+ {
+ columnText = columnText.substring(0, columnWidth - 3);
+ columnText += "...";
+ }
+
+ line.insert(offset, columnText);
+
+ }
+ else
+ {
+ int rightOffset = offset + (columnWidth - labelWidth) - 1;
+ if (rightOffset < offset)
+ {
+ int delta = (offset - rightOffset) + 3;
+ columnText = columnText.substring(0, labelWidth - delta);
+ columnText += "...";
+ rightOffset = offset;
+ }
+
+ line.insert(rightOffset, columnText);
+ }
+
+ offset += columnWidth;
+ line.insert(offset, " ");
+ offset++;
+ }
+ }
+ else
+ {
+ String columnText = lprovider.getColumnText(object, 0);
+ line.append(columnText);
+ }
+
+ return line.toString();
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemTeamReloadAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemTeamReloadAction.java
new file mode 100644
index 00000000000..6d0b30470b3
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemTeamReloadAction.java
@@ -0,0 +1,76 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.SystemResourceListener;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.messages.SystemMessageDialog;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * The action allows users to refresh the entire Remote Systems Explorer tree view,
+ * by reloading it from disk. This is to be done after the user does a synchronization
+ * with the repository.
+ */
+public class SystemTeamReloadAction extends SystemBaseAction
+
+{
+
+ //private SystemProfile prevProfile = null;
+
+ /**
+ * Constructor
+ */
+ public SystemTeamReloadAction(Shell parent)
+ {
+ super(SystemResources.ACTION_TEAM_RELOAD_LABEL,SystemResources.ACTION_TEAM_RELOAD_TOOLTIP,
+ parent);
+ allowOnMultipleSelection(false);
+ setContextMenuGroup(ISystemContextMenuConstants.GROUP_BUILD);
+ //setSelectionSensitive(false);
+ setHelp(SystemPlugin.HELPPREFIX+"actn0009");
+ }
+
+ /**
+ * Selection has been changed. Decide to enable or not.
+ */
+ public boolean updateSelection(IStructuredSelection selection)
+ {
+ boolean enable = SystemResourceListener.changesPending();
+ return enable;
+ }
+
+ /**
+ * This is the method called when the user selects this action to run.
+ */
+ public void run()
+ {
+ //SystemRegistry sr = SystemPlugin.getTheSystemRegistry();
+ SystemMessage confirmMsg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_CONFIRM_RELOADRSE);
+ SystemMessageDialog msgDlg = new SystemMessageDialog(getShell(), confirmMsg);
+ boolean ok = msgDlg.openQuestionNoException();
+ if (ok)
+ {
+ SystemResourceListener.reloadRSE();
+ }
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemTestFilterStringAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemTestFilterStringAction.java
new file mode 100644
index 00000000000..d72f482a348
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemTestFilterStringAction.java
@@ -0,0 +1,102 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.dialogs.SystemTestFilterStringDialog;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * The action for testing a given filter string by resolving it and showing the resolve results
+ */
+public class SystemTestFilterStringAction extends SystemBaseDialogAction
+
+{
+
+ protected ISubSystem subsystem;
+ protected String filterString;
+ protected SystemTestFilterStringDialog dlg;
+
+
+ /**
+ * Constructor when input subsystem and filter string are known already
+ */
+ public SystemTestFilterStringAction(Shell shell, ISubSystem subsystem, String filterString)
+ {
+ super(SystemResources.ACTION_TESTFILTERSTRING_LABEL, SystemResources.ACTION_TESTFILTERSTRING_TOOLTIP, null,
+ shell);
+ allowOnMultipleSelection(false);
+ setSubSystem(subsystem);
+ setFilterString(filterString);
+ }
+ /**
+ * Constructor when input subsystem and filter string are not known already.
+ * @see #setSubSystem(ISubSystem)
+ * @see #setFilterString(String)
+ */
+ public SystemTestFilterStringAction(Shell shell)
+ {
+ this(shell, null, null);
+ }
+
+ /**
+ * Set the subsystem within the context of which this filter string is to be tested.
+ */
+ public void setSubSystem(ISubSystem subsystem)
+ {
+ this.subsystem = subsystem;
+ }
+
+ /**
+ * Set the filter string to test
+ */
+ public void setFilterString(String filterString)
+ {
+ this.filterString = filterString;
+ }
+
+ /**
+ * If you decide to use the supplied run method as is,
+ * then you must override this method to create and return
+ * the dialog that is displayed by the default run method
+ * implementation.
+ *
+ * If you override run with your own, then
+ * simply implement this to return null as it won't be used.
+ * @see #run()
+ */
+ protected Dialog createDialog(Shell shell)
+ {
+ //if (dlg == null) // I hoped to reduce memory requirements by re-using but doesn't work. Phil
+ dlg = new SystemTestFilterStringDialog(shell, subsystem, filterString);
+ //else
+ //{
+ //dlg.reset(subsystem, filterString);
+ //}
+ return dlg;
+ }
+
+ /**
+ * Required by parent. We just return null.
+ */
+ protected Object getDialogValue(Dialog dlg)
+ {
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemUpdateConnectionAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemUpdateConnectionAction.java
new file mode 100644
index 00000000000..41f61415d4e
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemUpdateConnectionAction.java
@@ -0,0 +1,75 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.rse.model.IHost;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.dialogs.SystemUpdateConnectionDialog;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * The action that displays the Change Connection dialog
+ * THIS DIALOG AND ITS ACTION ARE NO LONGER USED. THEY ARE REPLACED WITH A PROPERTIES DIALOG.
+ */
+public class SystemUpdateConnectionAction extends SystemBaseDialogAction
+
+{
+
+ /**
+ * Constructor for SystemUpdateConnectionAction
+ */
+ public SystemUpdateConnectionAction(Shell parent)
+ {
+ super(SystemResources.ACTION_UPDATECONN_LABEL, SystemResources.ACTION_UPDATECONN_TOOLTIP, null, parent);
+ allowOnMultipleSelection(false);
+ setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORGANIZE);
+ }
+
+ /**
+ * Called by SystemBaseAction when selection is set.
+ * Our opportunity to verify we are allowed for this selected type.
+ */
+ public boolean checkObjectType(Object selectedObject)
+ {
+ return (selectedObject instanceof IHost);
+ }
+
+ /**
+ * If you decide to use the supplied run method as is,
+ * then you must override this method to create and return
+ * the dialog that is displayed by the default run method
+ * implementation.
+ *
+ * If you override run with your own, then
+ * simply implement this to return null as it won't be used.
+ * @see #run()
+ */
+ protected Dialog createDialog(Shell parent)
+ {
+ return new SystemUpdateConnectionDialog(parent);
+ }
+
+ /**
+ * Required by parent but we do not use it so return null;
+ */
+ protected Object getDialogValue(Dialog dlg)
+ {
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemViewExpandToAllAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemViewExpandToAllAction.java
new file mode 100644
index 00000000000..12d56f9c718
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemViewExpandToAllAction.java
@@ -0,0 +1,52 @@
+/********************************************************************************
+ * Copyright (c) 2003, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * When we support Expand-To menu items to expand a remote item via subsetting criteria,
+ * we should also support an Expand-To->All action. This is it.
+ */
+public class SystemViewExpandToAllAction extends SystemViewExpandToBaseAction
+{
+
+
+
+ /**
+ * Constructor for SystemViewExpandToAllAction.
+ * @param rb
+ * @param prefix
+ * @param image
+ * @param parent
+ */
+ public SystemViewExpandToAllAction(Shell parent)
+ {
+ super(SystemResources.ACTION_EXPAND_ALL_LABEL, SystemResources.ACTION_EXPAND_ALL_TOOLTIP,null, parent);
+ }
+
+ /**
+ * @see org.eclipse.rse.ui.actions.SystemViewExpandToBaseAction#getFilterString(Object)
+ */
+ protected String getFilterString(Object selectedObject)
+ {
+ return null;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemViewExpandToBaseAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemViewExpandToBaseAction.java
new file mode 100644
index 00000000000..635156636bb
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemViewExpandToBaseAction.java
@@ -0,0 +1,99 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.rse.ui.view.ISystemTree;
+import org.eclipse.rse.ui.view.SystemView;
+import org.eclipse.swt.widgets.Shell;
+
+
+//import com.ibm.etools.systems.subsystems.*;
+
+/**
+ * Base class for Expand To actions on a container
+ */
+public abstract class SystemViewExpandToBaseAction extends SystemBaseAction
+{
+
+
+
+ /**
+ * Constructor.
+ */
+ public SystemViewExpandToBaseAction(String label, String tooltip, ImageDescriptor image, Shell parent)
+ {
+ super(label, tooltip, image, parent);
+ allowOnMultipleSelection(false);
+ setContextMenuGroup(org.eclipse.rse.ui.ISystemContextMenuConstants.GROUP_EXPANDTO);
+ setChecked(false); // will reset once we know the selection.
+ }
+
+ /**
+ * Second and easiest opportunity to decide if the action should be enabled or not based
+ * on the current selection. Called by default implementation of updateSelection, once for
+ * each item in the selection. If any call to this returns false, the action is disabled.
+ * The default implementation returns true.
+ */
+ public boolean checkObjectType(Object selectedObject)
+ {
+ SystemView sv = getSystemView();
+ if (sv == null)
+ return false;
+ String currentFilter = sv.getExpandToFilter(selectedObject);
+ String thisFilter = getFilterString(selectedObject);
+ if (currentFilter != null)
+ {
+ if ((thisFilter!=null) && currentFilter.equals(thisFilter))
+ setChecked(true);
+ }
+ else if (thisFilter == null) // I assume this is only the case for Expand To->All.
+ setChecked(true);
+ return true;
+ }
+
+ /**
+ * Actually do the work
+ */
+ public void run()
+ {
+ Object element = getFirstSelection();
+ if (element != null)
+ {
+ SystemView view = (SystemView)getCurrentTreeView();
+ view.expandTo(getFilterString(element));
+ }
+ }
+
+ /**
+ * Overridable extension point to get the fully resolved filter string at the time
+ * action is run.
+ */
+ protected abstract String getFilterString(Object selectedObject);
+
+ /**
+ * Return the current SystemView or null if the current viewer is not a system view
+ */
+ protected SystemView getSystemView()
+ {
+ ISystemTree tree = getCurrentTreeView();
+ if ((tree instanceof SystemView) && (((SystemView)tree).getSystemViewPart() != null))
+ return (SystemView)tree;
+ else
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemWorkOfflineAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemWorkOfflineAction.java
new file mode 100644
index 00000000000..ad24aae6447
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemWorkOfflineAction.java
@@ -0,0 +1,129 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.core.ISystemTypes;
+import org.eclipse.rse.core.SystemBasePlugin;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.model.IHost;
+import org.eclipse.rse.model.ISystemRegistry;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * Action for switching RSE Connections offline
+ *
+ * @author yantzi
+ * @since Artemis 6.0
+ */
+public class SystemWorkOfflineAction extends SystemBaseAction
+{
+ /**
+ * Constructor
+ *
+ * @param shell
+ */
+ public SystemWorkOfflineAction(Shell shell) {
+ super(SystemResources.RESID_OFFLINE_WORKOFFLINE_LABEL, SystemResources.RESID_OFFLINE_WORKOFFLINE_TOOLTIP, shell);
+ allowOnMultipleSelection(false);
+ setContextMenuGroup(ISystemContextMenuConstants.GROUP_CONNECTION);
+ setHelp(SystemPlugin.HELPPREFIX+"wofa0000");
+ }
+
+ /**
+ * Override of parent. Called when testing if action should be enabled base on current
+ * selection. We check the selected object is one of our subsystems, and if we are
+ * currently connected.
+ */
+ public boolean checkObjectType(Object obj)
+ {
+ if (obj instanceof IHost)
+ return true;
+ else
+ return false;
+ }
+
+ /**
+ * Called when this action is selection from the popup menu.
+ */
+ public void run()
+ {
+ IHost conn = (IHost)getFirstSelection();
+ ISystemRegistry sr = SystemPlugin.getTheSystemRegistry();
+
+ if (conn.isOffline())
+ {
+ // offline going online
+ setChecked(false);
+ sr.setHostOffline(conn, false);
+ }
+ else
+ {
+ // these need to be set before calling disconnect so the iSeires subsystems know not
+ // to collapse
+ sr.setHostOffline(conn, true);
+ setChecked(true);
+
+ // online going offline, disconnect all subsystems
+ ISubSystem[] subsystems = sr.getSubSystems(conn);
+ if (subsystems != null)
+ {
+ boolean cancelled = false;
+ for (int i = 0; i < subsystems.length && !cancelled; i++)
+ {
+ try
+ {
+ subsystems[i].disconnect(getShell(), false);
+ } catch (InterruptedException e) {
+ // user cancelled disconnect
+ cancelled = true;
+ } catch (Exception e) {
+ SystemBasePlugin.logError("SystemWorkOfflineAction.run", e);
+ }
+ }
+ }
+
+ // check that everything was disconnedted okay and this is not the local connection
+ if(sr.isAnySubSystemConnected(conn) && !ISystemTypes.SYSTEMTYPE_LOCAL.equals(conn.getSystemType()))
+ {
+ // backout changes, likely because user cancelled the disconnect
+ setChecked(false);
+ sr.setHostOffline(conn, false);
+ }
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.core.ui.actions.SystemBaseAction#updateSelection(org.eclipse.jface.viewers.IStructuredSelection)
+ */
+ public boolean updateSelection(IStructuredSelection selection) {
+ if (super.updateSelection(selection))
+ {
+ setChecked(((IHost) selection.getFirstElement()).isOffline());
+ return true;
+ }
+
+ return false;
+ }
+
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemWorkWithProfilesAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemWorkWithProfilesAction.java
new file mode 100644
index 00000000000..15d6a5580cd
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemWorkWithProfilesAction.java
@@ -0,0 +1,56 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+import org.eclipse.rse.core.SystemPerspectiveHelpers;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.model.ISystemRegistry;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.view.team.SystemTeamViewPart;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * The action shows in the local toolbar of the Remote Systems View, and
+ * users can select it to give the Team view focus.
+ */
+public class SystemWorkWithProfilesAction extends SystemBaseAction
+
+{
+
+ private ISystemRegistry sr = null;
+ /**
+ * Constructor
+ */
+ public SystemWorkWithProfilesAction(Shell parent)
+ {
+ super(SystemResources.ACTION_WORKWITH_PROFILES_LABEL, SystemResources.ACTION_WORKWITH_PROFILES_TOOLTIP, parent);
+ setSelectionSensitive(false);
+ allowOnMultipleSelection(true);
+ sr = SystemPlugin.getTheSystemRegistry();
+ setHelp(SystemPlugin.HELPPREFIX+"actnwwpr");
+ }
+
+ /**
+ * This is the method called when the user selects this action.
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ public void run()
+ {
+ SystemPerspectiveHelpers.showView(SystemTeamViewPart.ID);
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/TestPopupMenuAction1.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/TestPopupMenuAction1.java
new file mode 100644
index 00000000000..bdee9f2fc6b
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/TestPopupMenuAction1.java
@@ -0,0 +1,43 @@
+/********************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+/**
+ * This is just a test action to ensure the popupMenus extension point works
+ * for adding popup menu actions to remote objects
+ */
+public class TestPopupMenuAction1 extends SystemAbstractPopupMenuExtensionAction
+{
+
+
+
+ /**
+ * Constructor for TestPopupMenuAction1
+ */
+ public TestPopupMenuAction1()
+ {
+ super();
+ }
+
+ /**
+ * Called when the user selects this action
+ */
+ public void run()
+ {
+ printTest();
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/EnvironmentVariablesPromptDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/EnvironmentVariablesPromptDialog.java
new file mode 100644
index 00000000000..c0e4fbc4675
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/EnvironmentVariablesPromptDialog.java
@@ -0,0 +1,248 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.dialogs;
+
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.SystemWidgetHelpers;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+
+/**
+ * Dialog for prompting the user to add / change an environment variable.
+ */
+public class EnvironmentVariablesPromptDialog extends SystemPromptDialog implements ModifyListener {
+
+
+ private Text nameTextField, valueTextField;
+ private String name, value, systemType, invalidNameChars;
+ private boolean change; // Is this dialog for add or change
+ private String[] existingNames;
+
+ /**
+ * Constructor for EnvironmentVariablesPromptDialog.
+ * @param shell
+ * @param title
+ */
+ public EnvironmentVariablesPromptDialog(Shell shell, String title, String systemType, String invalidNameChars, String[] existingNames, boolean change) {
+ super(shell, title);
+ this.change = change;
+ this.systemType = systemType;
+ this.invalidNameChars = invalidNameChars;
+ this.existingNames = existingNames;
+ }
+
+ /**
+ * Constructor for EnvironmentVariablesPromptDialog.
+ * @param shell
+ * @param title
+ * @param inputObject
+ */
+ public EnvironmentVariablesPromptDialog(Shell shell, String title, Object inputObject, String invalidNameChars, String[] existingNames, boolean change) {
+ super(shell, title, inputObject);
+ this.change = change;
+ this.invalidNameChars = invalidNameChars;
+ this.existingNames = existingNames;
+ }
+
+ /**
+ * @see org.eclipse.rse.ui.dialogs.SystemPromptDialog#createInner(Composite)
+ */
+ protected Control createInner(Composite parent) {
+
+ Composite page = SystemWidgetHelpers.createComposite(parent, 2);
+
+ // Prompt for name
+ SystemWidgetHelpers.createLabel(page, SystemResources.RESID_SUBSYSTEM_ENVVAR_NAME_LABEL);
+ nameTextField = SystemWidgetHelpers.createTextField(page, null);
+ nameTextField.setToolTipText(SystemResources.RESID_SUBSYSTEM_ENVVAR_NAME_TOOLTIP);
+ if (name != null && !name.trim().equals(""))
+ {
+ nameTextField.setText(name);
+ setInitialOKButtonEnabledState(true);
+ }
+ else
+ {
+ setInitialOKButtonEnabledState(false);
+ }
+ nameTextField.addModifyListener(this);
+
+ // Prompt for value
+ SystemWidgetHelpers.createLabel(page, SystemResources.RESID_SUBSYSTEM_ENVVAR_VALUE_LABEL);
+ valueTextField = SystemWidgetHelpers.createTextField(page, null);
+ valueTextField.setToolTipText(SystemResources.RESID_SUBSYSTEM_ENVVAR_VALUE_TOOLTIP);
+ if (value != null)
+ {
+ valueTextField.setText(value);
+ }
+
+ if (!change)
+ SystemWidgetHelpers.setCompositeHelp(parent, SystemPlugin.HELPPREFIX + "envv0001");
+ else
+ SystemWidgetHelpers.setCompositeHelp(parent, SystemPlugin.HELPPREFIX + "envv0002");
+
+
+ // Set name and value limits for known system types
+ if (systemType != null)
+ {
+ if (systemType.equals("iSeries"))
+ {
+ nameTextField.setTextLimit(128);
+ valueTextField.setTextLimit(1024);
+ }
+ else if (systemType.equals("Windows"))
+ {
+ nameTextField.setTextLimit(300);
+ valueTextField.setTextLimit(1024);
+ }
+ else if (systemType.equals("Local"))
+ {
+ if (System.getProperty("os.name").toLowerCase().indexOf("win") != -1)
+ {
+ nameTextField.setTextLimit(300);
+ valueTextField.setTextLimit(1024);
+ }
+ }
+ }
+
+ return parent;
+ }
+
+ /**
+ * @see org.eclipse.rse.ui.dialogs.SystemPromptDialog#getInitialFocusControl()
+ */
+ protected Control getInitialFocusControl() {
+ return nameTextField;
+ }
+
+ /**
+ * Get the environment varaible name entered in the dialog.
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Get the environment varaible value entered in the dialog.
+ */
+ public String getValue()
+ {
+ return value;
+ }
+
+ /**
+ * Preset the name for the environment variable
+ */
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * Preset the value for the environment variable
+ */
+ public void setValue(String value)
+ {
+ this.value = value;
+ }
+
+ /**
+ * @see org.eclipse.rse.ui.dialogs.SystemPromptDialog#processOK()
+ */
+ protected boolean processOK() {
+ if (nameTextField.getText() != null && !nameTextField.getText().trim().equals(""))
+ {
+ String nameStr;
+ if (invalidNameChars != null && invalidNameChars.indexOf(' ') != -1)
+ {
+ nameStr = nameTextField.getText().trim();
+ }
+ else
+ {
+ nameStr = nameTextField.getText();
+ }
+
+ // dy: Change to use a String of invalid charactes supplied by the subsystem
+ //if (nameStr.indexOf('=') > 0 || nameStr.indexOf(' ') > 0)
+ if (invalidNameChars != null)
+ {
+ for (int i = 0; i < invalidNameChars.length(); i++)
+ {
+ if (nameStr.indexOf(invalidNameChars.charAt(i)) != -1)
+ {
+ setErrorMessage(SystemPlugin.getPluginMessage(ISystemMessages.MSG_COMM_ENVVAR_INVALIDCHAR));
+ nameTextField.setFocus();
+ return false;
+ }
+ }
+ }
+
+ if (existingNames != null)
+ {
+ // Check if this one already exists
+ for (int i = 0; i < existingNames.length; i++)
+ {
+ if (nameStr.equals(existingNames[i]))
+ {
+ if (!change || !nameStr.equals(name))
+ {
+ SystemMessage msg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_COMM_ENVVAR_DUPLICATE);
+ msg.makeSubstitution(nameStr);
+ setErrorMessage(msg);
+ nameTextField.setFocus();
+ return false;
+ }
+ }
+ }
+ }
+
+ name = nameStr;
+ value = valueTextField.getText();
+ return true;
+ }
+ else
+ {
+ setErrorMessage(SystemPlugin.getPluginMessage(ISystemMessages.MSG_COMM_ENVVAR_NONAME));
+ nameTextField.setFocus();
+ return false;
+ }
+ }
+
+ /**
+ * @see org.eclipse.swt.events.ModifyListener#modifyText(ModifyEvent)
+ */
+ public void modifyText(ModifyEvent e) {
+ if (nameTextField.getText().trim().equals(""))
+ {
+ enableOkButton(false);
+ }
+ else
+ {
+ enableOkButton(true);
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/ISignonValidator.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/ISignonValidator.java
new file mode 100644
index 00000000000..54c1a915118
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/ISignonValidator.java
@@ -0,0 +1,48 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.dialogs;
+
+import org.eclipse.rse.model.SystemSignonInformation;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * Interace for providing a signon validator to the password prompt dialog.
+ */
+public interface ISignonValidator
+{
+
+ /**
+ * Used by ISystemPasswordPromptDialog to verify if the password entered by the user
+ * is correct.
+ *
+ * @return null if the password is valid, otherwise a SystemMessage is returned that can
+ * be displayed to the end user.
+ */
+ public SystemMessage isValid(ISystemPasswordPromptDialog dialog, String userid, String password);
+
+ /**
+ * Verify if persisted userid and password are still valid
+ *
+ * @param Shell, if null the validator will run headless, if not null then the validator
+ * may use the shell to prompt the user (for example, if the password has expired.)
+ *
+ * @return true if signonInfo contains a valid signon, false otherwise.
+ */
+ public boolean isValid(Shell shell, SystemSignonInformation signonInfo);
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/ISystemPasswordPromptDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/ISystemPasswordPromptDialog.java
new file mode 100644
index 00000000000..cdcb64ab730
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/ISystemPasswordPromptDialog.java
@@ -0,0 +1,100 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.dialogs;
+import org.eclipse.rse.core.subsystems.IConnectorService;
+import org.eclipse.rse.ui.validators.ISystemValidator;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * Suggested interface for a dialog used to prompt user for a password.
+ */
+public interface ISystemPasswordPromptDialog
+{
+ /**
+ * Set modal vs modeless
+ */
+ public void setBlockOnOpen(boolean block);
+ /**
+ * Open the dialog
+ */
+ public int open();
+ /**
+ * Set the input System object in which the user is attempting to do a connect action.
+ * This is used to query the system type, host name and userId to display to the user for
+ * contextual information.
+ *
+ * This must be called right after instantiating this dialog.
+ */
+ public void setSystemInput(IConnectorService systemObject);
+ /**
+ * Allow caller to determine if window was cancelled or not.
+ */
+ public boolean wasCancelled();
+ /**
+ * Call this to specify a validator for the userId. It will be called per keystroke.
+ */
+ public void setUserIdValidator(ISystemValidator v);
+ /**
+ * Call this to specify a validator for the password. It will be called per keystroke.
+ */
+ public void setPasswordValidator(ISystemValidator v);
+ /**
+ * Call this to specify a validator for the signon. It will be called when the OK button is pressed.
+ */
+ public void setSignonValidator(ISignonValidator v);
+ /**
+ * Call this to force the userId and password to uppercase
+ */
+ public void setForceToUpperCase(boolean force);
+ /**
+ * Call this to query the force-to-uppercase setting
+ */
+ public boolean getForceToUpperCase();
+ /**
+ * Return the userId entered by user
+ */
+ public String getUserId();
+ /**
+ * Return the password entered by user
+ */
+ public String getPassword();
+ /**
+ * Sets the password
+ */
+ public void setPassword(String password);
+ /**
+ * Preselect the save password checkbox. Default value is to not
+ * select the save password checkbox.
+ */
+ public void setSavePassword(boolean save);
+ /**
+ * Return true if the user changed the user id
+ */
+ public boolean getIsUserIdChanged();
+ /**
+ * Return true if the user elected to make the changed user Id a permanent change.
+ */
+ public boolean getIsUserIdChangePermanent();
+ /**
+ * Return true if the user elected to save the password
+ */
+ public boolean getIsSavePassword();
+ /**
+ * Return the shell for this dialog
+ */
+ public Shell getShell();
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/ISystemPromptDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/ISystemPromptDialog.java
new file mode 100644
index 00000000000..7c204f143a6
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/ISystemPromptDialog.java
@@ -0,0 +1,57 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.dialogs;
+
+
+/**
+ * Suggested interface for dialogs used in actions in remote system framework.
+ */
+public interface ISystemPromptDialog
+{
+ /**
+ * For explicitly setting input object
+ */
+ public void setInputObject(Object inputObject);
+
+ /**
+ * For explicitly getting input object
+ */
+ public Object getInputObject();
+
+ /**
+ * For explicitly getting output object after dialog is dismissed. Set by the
+ * dialog's processOK method.
+ */
+ public Object getOutputObject();
+
+ /**
+ * Allow caller to determine if window was cancelled or not.
+ */
+ public boolean wasCancelled();
+
+ /**
+ * Expose inherited protected method convertWidthInCharsToPixels as a publicly
+ * excessible method
+ */
+ public int publicConvertWidthInCharsToPixels(int chars);
+ /**
+ * Expose inherited protected method convertHeightInCharsToPixels as a publicly
+ * excessible method
+ */
+ public int publicConvertHeightInCharsToPixels(int chars);
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/ISystemTypedObject.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/ISystemTypedObject.java
new file mode 100644
index 00000000000..8a86b0cb2d5
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/ISystemTypedObject.java
@@ -0,0 +1,42 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.dialogs;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+
+/**
+ * The re-usable rename and delete dialogs in RSE require the objects to be adaptable to
+ * ISystemViewElementAdapter, in order to show the object's type in the dialog. If you
+ * want to re-use these dialogs for inputs that do not adapt to ISystemViewElementAdapter,
+ * then ensure your input objects implement this interface.
+ */
+public interface ISystemTypedObject
+{
+ /**
+ * Return the name of the object.
+ */
+ public String getName();
+ /**
+ * Return the type of the object. This is a displayable string, used to tell the user
+ * what type of resource this is.
+ */
+ public String getType();
+ /**
+ * Returns an image descriptor for the image to represent this object. More efficient than getting the image.
+ */
+ public ImageDescriptor getImageDescriptor();
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemControlEnableState.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemControlEnableState.java
new file mode 100644
index 00000000000..23b35feb392
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemControlEnableState.java
@@ -0,0 +1,155 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.dialogs;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.rse.ui.view.SystemPropertySheetForm;
+import org.eclipse.rse.ui.view.SystemViewForm;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+
+/**
+ * Helper class to save the enable/disable state of a control
+ * including all its descendent controls.
+ */
+public class SystemControlEnableState
+{
+
+
+
+ /**
+ * List of exception controls (element type:
+ * This is a re-usable dialog that you can use directly, or via the {@link org.eclipse.rse.ui.actions.SystemCommonDeleteAction}
+ * action. It asks the user to confirm the deletion of the input selection.
+ * If the input objects do not adapt to {@link org.eclipse.rse.ui.view.ISystemViewElementAdapter} or
+ * {@link org.eclipse.rse.ui.view.ISystemRemoteElementAdapter}, then they should implement the
+ * interface {@link org.eclipse.rse.ui.dialogs.ISystemTypedObject} so that their type can be
+ * displayed in this delete confirmation dialog.
+ *
+ * @see org.eclipse.rse.ui.actions.SystemCommonDeleteAction
+ */
+public class SystemDeleteDialog extends SystemPromptDialog
+ implements ISystemMessages, ISystemPropertyConstants,
+ ISelectionChangedListener
+{
+ private String warningMessage, warningTip;
+ private String promptLabel;
+ private SystemDeleteTableProvider sdtp;
+ private Label prompt;
+ private Table table;
+ private TableViewer tableViewer;
+ private GridData tableData;
+
+ // column headers
+ private String columnHeaders[] = {
+ "",
+ SystemResources.RESID_DELETE_COLHDG_OLDNAME,
+ SystemResources.RESID_DELETE_COLHDG_TYPE
+ };
+
+ // column layout
+ private ColumnLayoutData columnLayouts[] =
+ {
+ new ColumnPixelData(19, false),
+ new ColumnWeightData(150,150,true),
+ new ColumnWeightData(120,120,true)
+ };
+
+ // give each column a property value to identify it
+ private static String[] tableColumnProperties =
+ {
+ ISystemPropertyConstants.P_OK,
+ IBasicPropertyConstants.P_TEXT,
+ ISystemPropertyConstants.P_TYPE,
+ };
+
+ /**
+ * Constructor for SystemUpdateConnectionDialog
+ */
+ public SystemDeleteDialog(Shell shell)
+ {
+ super(shell, SystemResources.RESID_DELETE_TITLE);
+ super.setOkButtonLabel(SystemResources.RESID_DELETE_BUTTON);
+ setHelp(SystemPlugin.HELPPREFIX+"ddlt0000");
+ }
+
+ /**
+ * Create message line. Intercept so we can set msg line of form.
+ */
+ protected ISystemMessageLine createMessageLine(Composite c)
+ {
+ ISystemMessageLine msgLine = super.createMessageLine(c);
+ return fMessageLine;
+ }
+
+ /**
+ * Specify a warning message to show at the top of the dialog
+ */
+ public void setWarningMessage(String msg, String tip)
+ {
+ this.warningMessage = msg;
+ this.warningTip = tip;
+ }
+
+ /**
+ * Specify the text to show for the label prompt. The default is
+ * "Delete selected resources?"
+ */
+ public void setPromptLabel(String text)
+ {
+ this.promptLabel = text;
+ }
+
+ /**
+ * @see SystemPromptDialog#getInitialFocusControl()
+ */
+ protected Control getInitialFocusControl()
+ {
+ return tableViewer.getControl();
+ }
+
+ /**
+ * @see SystemPromptDialog#createInner(Composite)
+ */
+ protected Control createInner(Composite parent)
+ {
+ // Inner composite
+ int nbrColumns = 2;
+ Composite composite = SystemWidgetHelpers.createComposite(parent, nbrColumns);
+
+ // PROMPT
+ if (promptLabel == null) {
+ Object input = getInputObject();
+
+ if (input != null && input instanceof IStructuredSelection) {
+ int size = ((IStructuredSelection)input).size();
+
+ if (size > 1) {
+ prompt = SystemWidgetHelpers.createLabel(composite, SystemResources.RESID_DELETE_PROMPT, nbrColumns);
+ }
+ else {
+ prompt = SystemWidgetHelpers.createLabel(composite, SystemResources.RESID_DELETE_PROMPT_SINGLE, nbrColumns);
+ }
+ }
+ // should never get here
+ else {
+ prompt = SystemWidgetHelpers.createLabel(composite, SystemResources.RESID_DELETE_PROMPT, nbrColumns);
+ }
+ }
+ else {
+ prompt = (Label)SystemWidgetHelpers.createVerbage(composite, promptLabel, nbrColumns, false, 200);
+ }
+
+ // WARNING
+ if (warningMessage != null)
+ {
+ // filler line
+ SystemWidgetHelpers.createLabel(composite, "", nbrColumns);
+ // create image
+ Image image = getShell().getDisplay().getSystemImage(SWT.ICON_WARNING);
+ Label imageLabel = null;
+ if (image != null)
+ {
+ imageLabel = new Label(composite, 0);
+ image.setBackground(imageLabel.getBackground());
+ imageLabel.setImage(image);
+ imageLabel.setLayoutData(new GridData(
+ GridData.HORIZONTAL_ALIGN_CENTER |
+ GridData.VERTICAL_ALIGN_BEGINNING));
+ }
+ Label warningLabel = SystemWidgetHelpers.createLabel(composite, warningMessage);
+ if (warningTip != null)
+ {
+ warningLabel.setToolTipText(warningTip);
+ imageLabel.setToolTipText(warningTip);
+ }
+ // filler line
+ SystemWidgetHelpers.createLabel(composite, "", nbrColumns);
+ }
+
+ // TABLE
+ tableViewer = createTableViewer(composite, nbrColumns);
+ createColumns();
+ tableViewer.setColumnProperties(tableColumnProperties);
+
+ sdtp = new SystemDeleteTableProvider();
+
+ int width = tableData.widthHint;
+ int nbrRows = Math.min(getRows().length,8);
+ int rowHeight = table.getItemHeight() + table.getGridLineWidth();
+ int sbHeight = table.getHorizontalBar().getSize().y;
+ int height = (nbrRows * rowHeight) + sbHeight;
+
+ tableData.heightHint = height;
+ table.setLayoutData(tableData);
+ table.setSize(width, height);
+
+ tableViewer.setLabelProvider(sdtp);
+ tableViewer.setContentProvider(sdtp);
+
+ Object input = getInputObject();
+ tableViewer.setInput(input);
+
+ return composite;
+ }
+
+ private TableViewer createTableViewer(Composite parent, int nbrColumns)
+ {
+ table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.HIDE_SELECTION);
+ table.setLinesVisible(true);
+ tableViewer = new TableViewer(table);
+ tableData = new GridData();
+ tableData.horizontalAlignment = GridData.FILL;
+ tableData.grabExcessHorizontalSpace = true;
+ tableData.widthHint = 350;
+ tableData.heightHint = 30;
+ tableData.verticalAlignment = GridData.CENTER;
+ tableData.grabExcessVerticalSpace = true;
+ tableData.horizontalSpan = nbrColumns;
+ table.setLayoutData(tableData);
+ return tableViewer;
+ }
+
+ private void createColumns()
+ {
+ TableLayout layout = new TableLayout();
+ table.setLayout(layout);
+ table.setHeaderVisible(true);
+ for (int i = 0; i < columnHeaders.length; i++)
+ {
+ layout.addColumnData(columnLayouts[i]);
+ TableColumn tc = new TableColumn(table, SWT.NONE,i);
+ tc.setResizable(columnLayouts[i].resizable);
+ tc.setText(columnHeaders[i]);
+ }
+ }
+
+ public void selectionChanged(SelectionChangedEvent event)
+ {
+ }
+
+ /**
+ * Override of parent. Must pass selected object onto the form for initializing fields.
+ * Called by SystemDialogAction's default run() method after dialog instantiated.
+ */
+ public void setInputObject(Object inputObject)
+ {
+ super.setInputObject(inputObject);
+ }
+
+ /**
+ * Called when user presses OK button.
+ * Return true to close dialog.
+ * Return false to not close dialog.
+ */
+ protected boolean processOK()
+ {
+ return true;
+ }
+
+ /**
+ * Returns the rows of deletable items.
+ */
+ public SystemDeleteTableRow[] getRows()
+ {
+ return (SystemDeleteTableRow[])sdtp.getElements(getInputObject());
+ }
+
+ /**
+ * Returns the implementation of ISystemViewElement for the given
+ * object. Returns null if the adapter is not defined or the
+ * object is not adaptable.
+ */
+ protected ISystemViewElementAdapter getAdapter(Object o)
+ {
+ return SystemAdapterHelpers.getAdapter(o);
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemDeleteTableProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemDeleteTableProvider.java
new file mode 100644
index 00000000000..26c7948548c
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemDeleteTableProvider.java
@@ -0,0 +1,173 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.dialogs;
+import java.util.Collection;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IBaseLabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.graphics.Image;
+/**
+ * This class is the table provider class for the delete dialog
+ */
+public class SystemDeleteTableProvider implements ITableLabelProvider, IStructuredContentProvider
+{
+
+ static final int COLUMN_IMAGE = 0;
+ static final int COLUMN_NAME = 1;
+ static final int COLUMN_TYPE = 2;
+ protected Map imageTable = new Hashtable(20);
+ protected Object[] children = null;
+
+ /**
+ * Constructor for SystemDeleteTableProvider
+ */
+ public SystemDeleteTableProvider()
+ {
+ super();
+ }
+
+ private SystemDeleteTableRow getTableRow(Object element)
+ {
+ return (SystemDeleteTableRow)element;
+ }
+
+ private Image getImageFromDescriptor(ImageDescriptor descriptor)
+ {
+ if (descriptor == null)
+ return null;
+ //obtain the cached image corresponding to the descriptor
+ Image image = (Image) imageTable.get(descriptor);
+ if (image == null)
+ {
+ image = descriptor.createImage();
+ imageTable.put(descriptor, image);
+ }
+ //System.out.println("...image = " + image);
+ return image;
+ }
+
+ /**
+ * @see ITableLabelProvider#getColumnImage(java.lang.Object, int)
+ */
+ public Image getColumnImage(Object element, int column)
+ {
+ if (column == COLUMN_IMAGE)
+ return getImageFromDescriptor(getTableRow(element).getImageDescriptor());
+ else
+ return null;
+ }
+
+ /**
+ * @see ITableLabelProvider#getColumnText(java.lang.Object, int)
+ */
+ public String getColumnText(Object element, int column)
+ {
+ String text = "";
+ if (column == COLUMN_NAME)
+ text = getTableRow(element).getName();
+ else if (column == COLUMN_TYPE)
+ text = getTableRow(element).getType();
+ //System.out.println("INSIDE GETCOLUMNTEXT: " + column + ", " + text + ", " + getTableRow(element));
+ return text;
+ }
+
+ /**
+ * @see IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
+ */
+ public void addListener(ILabelProviderListener listener)
+ {
+ }
+
+ /**
+ * @see IBaseLabelProvider#dispose()
+ */
+ public void dispose()
+ {
+ // The following we got from WorkbenchLabelProvider
+ if (imageTable != null)
+ {
+ Collection imageValues = imageTable.values();
+ if (imageValues!=null)
+ {
+ Iterator images = imageValues.iterator();
+ if (images!=null)
+ while (images.hasNext())
+ ((Image)images.next()).dispose();
+ imageTable = null;
+ }
+ }
+ }
+
+ /**
+ * @see IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
+ */
+ public boolean isLabelProperty(Object element, String property)
+ {
+ return true;
+ }
+
+ /**
+ * @see IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
+ */
+ public void removeListener(ILabelProviderListener listener)
+ {
+ }
+
+ /**
+ * Return rows. Input must be an IStructuredSelection.
+ */
+ public Object[] getElements(Object inputElement)
+ {
+ if (children == null)
+ {
+ IStructuredSelection iss = (IStructuredSelection)inputElement;
+ children = new SystemDeleteTableRow[iss.size()];
+ Iterator i = iss.iterator();
+ int idx = 0;
+ while (i.hasNext())
+ {
+ children[idx] = new SystemDeleteTableRow(i.next(), idx);
+ idx++;
+ }
+ }
+ return children;
+ }
+
+ /**
+ * Return the 0-based row number of the given element.
+ */
+ public int getRowNumber(SystemDeleteTableRow row)
+ {
+ return row.getRowNumber();
+ }
+
+ /**
+ *
+ */
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
+ {
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemDeleteTableRow.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemDeleteTableRow.java
new file mode 100644
index 00000000000..65a7c7d9905
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemDeleteTableRow.java
@@ -0,0 +1,202 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.dialogs;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.rse.core.SystemAdapterHelpers;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.filters.ISystemFilterPoolReference;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
+import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
+import org.eclipse.rse.ui.view.SystemViewResources;
+
+
+/**
+ * Represents one row in the table in the SystemDeleteDialog dialog.
+ */
+public class SystemDeleteTableRow
+{
+
+ private Object element;
+ private String name;
+ private String type;
+ private ImageDescriptor imageDescriptor;
+ private ISystemViewElementAdapter adapter;
+ private ISystemRemoteElementAdapter remoteAdapter;
+ private int rowNbr = 0;
+
+ public SystemDeleteTableRow(Object element, int rowNbr)
+ {
+ if (element instanceof SystemSimpleContentElement)
+ element = ((SystemSimpleContentElement)element).getData();
+ this.element = element;
+ this.adapter = getAdapter(element);
+ this.remoteAdapter = getRemoteAdapter(element);
+ this.rowNbr = rowNbr;
+ //this.oldName = getAdapter(element).getText(element);
+ if (adapter != null)
+ this.name = adapter.getName(element);
+ else
+ {
+ if (element instanceof ISystemTypedObject)
+ this.name = ((ISystemTypedObject)element).getName();
+ else if (element instanceof IResource)
+ this.name = ((IResource)element).getName();
+ }
+ ISystemViewElementAdapter typeAdapter = adapter;
+ Object typeElement = element;
+ if (typeElement instanceof ISystemFilterPoolReference)
+ {
+ typeElement = ((ISystemFilterPoolReference)typeElement).getReferencedFilterPool();
+ typeAdapter = getAdapter(typeElement);
+ }
+ if (typeAdapter != null)
+ this.type = typeAdapter.getType(typeElement);
+ else
+ {
+ if (element instanceof ISystemTypedObject)
+ this.type = ((ISystemTypedObject)element).getType();
+ else if (element instanceof IResource)
+ {
+ if ((element instanceof IFolder) || (element instanceof IProject))
+ this.type = SystemViewResources.RESID_PROPERTY_FILE_TYPE_FOLDER_VALUE;
+ else
+ this.type = SystemViewResources.RESID_PROPERTY_FILE_TYPE_FILE_VALUE;
+ }
+ else
+ this.type = element.getClass().getName();
+ }
+ if (adapter != null)
+ this.imageDescriptor = adapter.getImageDescriptor(element);
+ else if (element instanceof ISystemTypedObject)
+ this.imageDescriptor = ((ISystemTypedObject)element).getImageDescriptor();
+ else if (element instanceof IFolder)
+ this.imageDescriptor = //PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJ_FOLDER);
+ SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_FOLDER_ID);
+ else if (element instanceof IFile)
+ this.imageDescriptor = SystemPlugin.getDefault().getWorkbench().getEditorRegistry().getImageDescriptor(name);
+ }
+
+ /**
+ * Return the name of the item to be deleted
+ * @return display name of the item.
+ */
+ public String getName()
+ {
+ return name;
+ }
+ /**
+ * Return the resource type of the item to be deleted
+ * @return resource type of the item
+ */
+ public String getType()
+ {
+ return type;
+ }
+ /**
+ * Return the 0-based row number of this item
+ * @return 0-based row number
+ */
+ public int getRowNumber()
+ {
+ return rowNbr;
+ }
+
+ /**
+ * Returns an image descriptor for the image. More efficient than getting the image.
+ */
+ public ImageDescriptor getImageDescriptor()
+ {
+ return imageDescriptor;
+ }
+
+ /**
+ * Get the input object this row represents
+ */
+ public Object getElement()
+ {
+ return element;
+ }
+ /**
+ * Get the input object adapter for the input object this row represents
+ */
+ public ISystemViewElementAdapter getAdapter()
+ {
+ return adapter;
+ }
+ /**
+ * Get the input object remote adapter for the input object this row represents
+ */
+ public ISystemRemoteElementAdapter getRemoteAdapter()
+ {
+ return remoteAdapter;
+ }
+ /**
+ * Return true if this is a remote object
+ */
+ public boolean isRemote()
+ {
+ return (remoteAdapter != null);
+ }
+
+ /**
+ * Returns the implementation of ISystemViewElement for the given
+ * object. Returns null if the adapter is not defined or the
+ * object is not adaptable.
+ */
+ protected ISystemViewElementAdapter getAdapter(Object o)
+ {
+ return SystemAdapterHelpers.getAdapter(o);
+ }
+
+ /**
+ * Returns the implementation of ISystemRemoteElement for the given
+ * object. Returns null if this object does not adaptable to this.
+ */
+ protected ISystemRemoteElementAdapter getRemoteAdapter(Object o)
+ {
+ return SystemAdapterHelpers.getRemoteAdapter(o);
+ }
+
+ public String toString()
+ {
+ return name;
+ }
+
+
+ /* THESE CAUSE GRIEF IF TWO OBJECTS WITH SAME NAME ARE SHOWN
+ public boolean equals(Object o)
+ {
+ if (o instanceof SystemRenameTableRow)
+ return ((SystemRenameTableRow)o).getOldName().equalsIgnoreCase(getOldName());
+ else if (o instanceof SystemDeleteTableRow)
+ return ((SystemDeleteTableRow)o).getOldName().equalsIgnoreCase(getOldName());
+ else if (o instanceof String)
+ return ((String)o).equalsIgnoreCase(getOldName());
+ else
+ return super.equals(o);
+ }
+ public int hashCode()
+ {
+ return getOldName().hashCode();
+ }
+ */
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemFilterTableDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemFilterTableDialog.java
new file mode 100644
index 00000000000..dff540ed61f
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemFilterTableDialog.java
@@ -0,0 +1,417 @@
+/********************************************************************************
+ * Copyright (c) 2004, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.dialogs;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TableLayout;
+import org.eclipse.jface.window.Window;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.services.clientserver.StringComparePatternMatcher;
+import org.eclipse.rse.ui.SystemPropertyResources;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.SystemWidgetHelpers;
+import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
+import org.eclipse.rse.ui.view.SystemTableView;
+import org.eclipse.rse.ui.view.SystemTableViewProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Widget;
+
+
+/**
+ * @author dmcknigh
+ */
+public class SystemFilterTableDialog extends SystemPromptDialog implements KeyListener, IDoubleClickListener
+{
+ class InitialInputRunnable implements Runnable
+ {
+ public void run()
+ {
+ initInput();
+ }
+ }
+
+ private SystemTableView _viewer;
+ private Table table;
+ private List _inputs;
+ private IAdaptable _currentInput;
+ private String _lastFilter;
+ private String _lastType;
+
+ private String[] _viewFilterStrings;
+ private String[] _typeFilterStrings;
+
+ private ISubSystem _subSystem;
+
+ private Combo _inputText;
+ private Button _browseButton;
+
+ private Combo _typeCombo;
+ private Combo _filterCombo;
+
+ private String selected = null;
+ private boolean _allowInputChange = true;
+
+
+ public SystemFilterTableDialog(Shell shell, String title, ISubSystem subSystem, String input, String[] viewFilterStrings, String[] typeFilterStrings, boolean allowInputChange)
+ {
+ super(shell, title);
+ _subSystem = subSystem;
+ setNeedsProgressMonitor(true);
+ _inputs = new ArrayList();
+ _inputs.add(input);
+ _viewFilterStrings = viewFilterStrings;
+ _typeFilterStrings = typeFilterStrings;
+ _allowInputChange = allowInputChange;
+ }
+
+
+ public SystemFilterTableDialog(Shell shell, String title, ISubSystem subSystem, List inputs, String[] viewFilterStrings, String[] typeFilterStrings, boolean allowInputChange)
+ {
+ super(shell, title);
+ _subSystem = subSystem;
+ setNeedsProgressMonitor(true);
+ _inputs = inputs;
+
+ _viewFilterStrings = viewFilterStrings;
+ _typeFilterStrings = typeFilterStrings;
+ _allowInputChange = allowInputChange;
+ }
+
+
+ protected ISystemViewElementAdapter getAdatperFor(IAdaptable obj)
+ {
+ return (ISystemViewElementAdapter)obj.getAdapter(ISystemViewElementAdapter.class);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.core.ui.dialogs.SystemPromptDialog#createInner(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createInner(Composite parent)
+ {
+ Composite c = new Composite(parent, SWT.NONE);
+
+ GridLayout layout = new GridLayout();
+ c.setLayout(layout);
+ layout.numColumns =1;
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ c.setLayoutData(gd);
+
+ Composite inputC = new Composite(c, SWT.NONE);
+ GridLayout ilayout = new GridLayout();
+ inputC.setLayout(ilayout);
+
+ if (_allowInputChange)
+ {
+ ilayout.numColumns =4;
+ }
+ else
+ {
+ ilayout.numColumns = 3;
+ }
+
+ GridData igd = new GridData(GridData.FILL_BOTH);
+ inputC.setLayoutData(igd);
+
+ // input
+ Label objFilterLabel= SystemWidgetHelpers.createLabel(inputC, "Input");
+ _inputText = new Combo(inputC, SWT.DROP_DOWN | SWT.READ_ONLY);
+ _inputText.addListener(SWT.Selection, this);
+
+
+ for (int i = 0; i < _inputs.size(); i++)
+ {
+ String input = (String)_inputs.get(i);
+ if (input != null)
+ {
+ _inputText.add(input);
+ }
+ }
+ _inputText.select(0);
+
+ if (_allowInputChange)
+ {
+ _browseButton = SystemWidgetHelpers.createPushButton(inputC, SystemResources.BUTTON_BROWSE, this);
+ }
+
+ Composite filterC = new Composite(c, SWT.NONE);
+ GridLayout flayout = new GridLayout();
+ filterC.setLayout(flayout);
+ flayout.numColumns =4;
+
+ GridData fgd = new GridData(GridData.FILL_BOTH);
+ filterC.setLayoutData(fgd);
+
+ // type filter strings
+ Label typeFilterLabel= SystemWidgetHelpers.createLabel(filterC, SystemPropertyResources.RESID_PROPERTY_TYPE_LABEL);
+ _typeCombo = new Combo(filterC, SWT.DROP_DOWN | SWT.READ_ONLY);
+ for (int i = 0; i < _typeFilterStrings.length; i++)
+ {
+ if (null != _typeFilterStrings[i])
+ {
+ _typeCombo.add(_typeFilterStrings[i]);
+ }
+ }
+ _typeCombo.select(0);
+ _typeCombo.addKeyListener(this);
+ _typeCombo.addListener(SWT.Selection, this);
+
+ // view filter strings
+ Label viewFilterLabel= SystemWidgetHelpers.createLabel(filterC, SystemResources.RESID_FILTERSTRING_STRING_LABEL);
+ _filterCombo = SystemWidgetHelpers.createCombo(filterC, this);
+ _filterCombo.setText(_viewFilterStrings[0]);
+ for (int i = 0; i < _viewFilterStrings.length; i++)
+ {
+ if (null != _viewFilterStrings[i])
+ {
+ _filterCombo.add(_viewFilterStrings[i]);
+ }
+ }
+ _filterCombo.addKeyListener(this);
+
+ // table
+ table = new Table(c, SWT.BORDER);
+ _viewer = new SystemTableView(table, this);
+ _viewer.showColumns(false);
+ _viewer.addDoubleClickListener(this);
+
+ TableLayout tlayout = new TableLayout();
+ table.setLayout(tlayout);
+ table.setHeaderVisible(false);
+ table.setLinesVisible(false);
+
+ GridData gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
+ gridData.heightHint = 200;
+ gridData.widthHint = 200;
+ table.setLayoutData(gridData);
+
+
+
+
+ enableOkButton(false);
+
+ return c;
+ }
+
+
+ protected void initInput()
+ {
+ if (_currentInput == null)
+ {
+ String input = (String)_inputs.get(0);
+ try
+ {
+ _currentInput = (IAdaptable)_subSystem.getObjectWithAbsoluteName(input);
+
+ ISystemViewElementAdapter adapter = getAdatperFor(_currentInput);
+ if (adapter != null)
+ {
+ applyViewFilter(false);
+ _viewer.setInput(_currentInput);
+ _viewer.refresh();
+ }
+ }
+ catch (Exception e)
+ {
+
+ }
+ }
+ }
+
+ protected void applyViewFilter(boolean refresh)
+ {
+ String[] vfilters = new String[1];
+
+ String typeFilter = _typeCombo.getText().toUpperCase();
+
+ vfilters[0] = _filterCombo.getText().toUpperCase();
+ if (!vfilters[0].endsWith("*"))
+ vfilters[0] += "*";
+
+ if (_lastFilter != vfilters[0])
+ {
+ StringComparePatternMatcher matcher = new StringComparePatternMatcher(_lastFilter != null ?_lastFilter.toUpperCase() : null);
+ if (_lastFilter == null || !matcher.stringMatches(vfilters[0]))
+ {
+ _lastFilter = vfilters[0];
+ _lastType = typeFilter;
+ if (_currentInput != null)
+ {
+ getAdatperFor(_currentInput).setFilterString(_lastFilter);
+ }
+
+ }
+ else
+ {
+ _lastFilter = vfilters[0];
+ _lastType = typeFilter;
+ }
+ ((SystemTableViewProvider)_viewer.getContentProvider()).flushCache();
+ String[] tfilters = new String[1];
+ tfilters[0] = _lastFilter + typeFilter;
+ _viewer.setViewFilters(tfilters);
+ }
+ else if (_lastType != typeFilter)
+ {
+ _lastType = typeFilter;
+ String[] tfilters = new String[1];
+ tfilters[0] = _lastFilter + typeFilter;
+ _viewer.setViewFilters(tfilters);
+ }
+
+ }
+
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.core.ui.dialogs.SystemPromptDialog#getInitialFocusControl()
+ */
+ protected Control getInitialFocusControl()
+ {
+ Display.getCurrent().asyncExec(new InitialInputRunnable());
+ //initInput();
+ return _filterCombo;
+ }
+
+ public void handleEvent(Event e)
+ {
+ Widget source = e.widget;
+
+ if (source == _typeCombo)
+ {
+ applyViewFilter(true);
+ }
+ else if (source == _filterCombo)
+ {
+ if (_lastFilter == null || !_lastFilter.equals(_filterCombo.getText() + "*"))
+ {
+ applyViewFilter(true);
+ }
+ }
+ else if (source == _browseButton)
+ {
+ SystemSelectAnythingDialog dlg = new SystemSelectAnythingDialog(getShell(), SystemResources.ACTION_SELECT_INPUT_DLG);
+ dlg.setInputObject(_currentInput);
+ if (dlg.open() == Window.OK)
+ {
+ _currentInput = (IAdaptable)dlg.getSelectedObject();
+ ISystemViewElementAdapter adapter = getAdatperFor(_currentInput);
+ String objName = adapter.getAbsoluteName(_currentInput);
+ if (!_inputs.contains(objName))
+ {
+ _inputs.add(0, objName);
+ }
+
+ _inputText.setText(objName);
+ applyViewFilter(false);
+ _viewer.setInput(_currentInput);
+ _viewer.refresh();
+ }
+ }
+ else if (source == _inputText)
+ {
+ int selected = _inputText.getSelectionIndex();
+ String inputStr = (String)_inputs.get(selected);
+ try
+ {
+ IAdaptable input = (IAdaptable)_subSystem.getObjectWithAbsoluteName(inputStr);
+ if (input != _currentInput)
+ {
+ _currentInput = input;
+ ISystemViewElementAdapter adapter = getAdatperFor(_currentInput);
+ _inputText.setText(inputStr);
+ applyViewFilter(false);
+ _viewer.setInput(_currentInput);
+ _viewer.refresh();
+ }
+ }
+ catch (Exception e2)
+ {
+ }
+ }
+ }
+
+ public void keyPressed(KeyEvent e)
+ {
+ }
+
+ public void keyReleased(KeyEvent e)
+ {
+ if (e.widget == _filterCombo)
+ {
+ String vfilter = _filterCombo.getText();
+ if (!vfilter.endsWith("*"))
+ vfilter += "*";
+ if (_lastFilter == null || !_lastFilter.equals(vfilter))
+ {
+ //System.out.println("handling event");
+ // System.out.println("\tchar ="+e.character);
+ applyViewFilter(true);
+ _filterCombo.clearSelection();
+ _filterCombo.setFocus();
+ }
+ }
+ }
+ public void doubleClick(DoubleClickEvent event)
+ {
+ IStructuredSelection s = (IStructuredSelection) event.getSelection();
+ Object element = s.getFirstElement();
+ if (element == null)
+ return;
+ processOK();
+ close();
+ }
+
+
+ protected boolean processOK()
+ {
+ TableItem[] thisRow = table.getSelection();
+ if (null != thisRow && thisRow.length == 1)
+ {
+ selected = thisRow[0].getText(0);
+ }
+ return true;
+ }
+
+ public String getSelected()
+ {
+ return selected;
+ }
+
+
+
+
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemPasswordPersistancePrompt.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemPasswordPersistancePrompt.java
new file mode 100644
index 00000000000..77703884d92
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemPasswordPersistancePrompt.java
@@ -0,0 +1,338 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.dialogs;
+
+import java.util.List;
+
+import org.eclipse.rse.core.PasswordPersistenceManager;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.model.SystemSignonInformation;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.SystemWidgetHelpers;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+
+/**
+ * SystemPasswordPersistancePrompt is used with the save password preference page
+ * to prompt the user to add or change password information.
+ */
+public final class SystemPasswordPersistancePrompt extends SystemPromptDialog implements ModifyListener
+{
+
+
+
+ private Text hostname, userid, password, passwordVerify;
+ private Combo systemType;
+ private SystemSignonInformation signonInfo;
+ private boolean change;
+ private String originalHostname, originalUserid, originalSystemType;
+
+ private List existingEntries;
+
+ /**
+ * Constructor for SystemPasswordPersistancePrompt.
+ * @param shell
+ * @param title
+ */
+ public SystemPasswordPersistancePrompt(Shell shell, String title, List existingEntries, boolean change) {
+ super(shell, title);
+ this.change = change;
+ this.existingEntries = existingEntries;
+ setInitialOKButtonEnabledState(false);
+ }
+
+
+ /**
+ * @see org.eclipse.rse.ui.dialogs.SystemPromptDialog#createInner(Composite)
+ */
+ protected Control createInner(Composite parent) {
+
+ Composite page = SystemWidgetHelpers.createComposite(parent, 2);
+
+ // Hostname prompt
+ SystemWidgetHelpers.createLabel(page, SystemResources.RESID_PREF_SIGNON_HOSTNAME_LABEL);
+ hostname = SystemWidgetHelpers.createTextField(page, null, SystemResources.RESID_PREF_SIGNON_HOSTNAME_TOOLTIP);
+ if (originalHostname != null)
+ hostname.setText(originalHostname);
+ hostname.addModifyListener(this);
+
+ // System type prompt
+ SystemWidgetHelpers.createLabel(page, SystemResources.RESID_PREF_SIGNON_SYSTYPE_LABEL, SystemResources.RESID_PREF_SIGNON_SYSTYPE_TOOLTIP);
+ systemType = SystemWidgetHelpers.createReadonlyCombo(page, null);
+ systemType.setItems(PasswordPersistenceManager.getInstance().getRegisteredSystemTypes());
+ if (originalSystemType != null)
+ systemType.setText(originalSystemType);
+ systemType.addModifyListener(this);
+
+ // User ID prompt
+ SystemWidgetHelpers.createLabel(page, SystemResources.RESID_PREF_SIGNON_USERID_LABEL);
+ userid = SystemWidgetHelpers.createTextField(page, null, SystemResources.RESID_PREF_SIGNON_USERID_TOOLTIP);
+ if (originalUserid != null)
+ userid.setText(originalUserid);
+ userid.addModifyListener(this);
+
+ // Password prompt
+ SystemWidgetHelpers.createLabel(page, SystemResources.RESID_PREF_SIGNON_PASSWORD_LABEL);
+ password = SystemWidgetHelpers.createTextField(page, null, SystemResources.RESID_PREF_SIGNON_PASSWORD_TOOLTIP);
+ password.setEchoChar('*');
+ password.addModifyListener(this);
+
+ // Confirm password prompt
+ SystemWidgetHelpers.createLabel(page, SystemResources.RESID_PREF_SIGNON_PASSWORD_VERIFY_LABEL);
+ passwordVerify = SystemWidgetHelpers.createTextField(page, null,SystemResources.RESID_PREF_SIGNON_PASSWORD_TOOLTIP);
+ passwordVerify.setEchoChar('*');
+ passwordVerify.addModifyListener(this);
+
+ return page;
+ }
+
+ /**
+ * @see org.eclipse.rse.ui.dialogs.SystemPromptDialog#getInitialFocusControl()
+ */
+ protected Control getInitialFocusControl() {
+ return hostname;
+ }
+
+ public SystemSignonInformation getSignonInformation() {
+ return signonInfo;
+ }
+
+ /**
+ * @see org.eclipse.rse.ui.dialogs.SystemPromptDialog#processOK()
+ */
+ protected boolean processOK() {
+ // Check for blank fields
+ String sHostName = hostname.getText();
+ if (sHostName == null || sHostName.trim().equals(""))
+ {
+ setErrorMessage(SystemPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PWD_BLANKFIELD));
+ okButton.setEnabled(false);
+ hostname.setFocus();
+ return false;
+ }
+
+ String sSystemType = systemType.getText();
+ if (sSystemType == null || sSystemType.trim().equals(""))
+ {
+ setErrorMessage(SystemPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PWD_BLANKFIELD));
+ okButton.setEnabled(false);
+ systemType.setFocus();
+ return false;
+ }
+
+ String sUserID = userid.getText();
+ if (sUserID == null || sUserID.trim().equals(""))
+ {
+ setErrorMessage(SystemPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PWD_BLANKFIELD));
+ okButton.setEnabled(false);
+ userid.setFocus();
+ return false;
+ }
+
+ String sPwd1 = password.getText();
+ if (sPwd1 == null || sPwd1.trim().equals(""))
+ {
+ setErrorMessage(SystemPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PWD_BLANKFIELD));
+ okButton.setEnabled(false);
+ password.setFocus();
+ return false;
+ }
+
+ String sPwd2 = passwordVerify.getText();
+ if (sPwd2 == null || sPwd2.trim().equals(""))
+ {
+ setErrorMessage(SystemPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PWD_BLANKFIELD));
+ okButton.setEnabled(false);
+ passwordVerify.setFocus();
+ return false;
+ }
+
+ // Check if new and verify passwords match
+ if (!sPwd1.equals(sPwd2))
+ {
+ setErrorMessage(SystemPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PWD_MISMATCH));
+ okButton.setEnabled(false);
+ password.setFocus();
+ password.setSelection(0, sPwd1.length());
+ return false;
+ }
+
+ signonInfo = new SystemSignonInformation(hostname.getText(), userid.getText(), password.getText(), systemType.getText());
+
+ if (change)
+ {
+ if (exists(signonInfo.getHostname(), signonInfo.getUserid(), signonInfo.getSystemType()))
+ {
+ if (!signonInfo.getSystemType().equals(originalSystemType) ||
+ !signonInfo.getHostname().equalsIgnoreCase(originalHostname) ||
+ //!signonInfo.getHostname().equalsIgnoreCase(SystemPlugin.getQualifiedHostName(originalHostname)) ||
+ !signonInfo.getUserid().equals(originalUserid))
+ {
+ // User changed hostname, systemtype or userid and the change conflicts with an existing entry
+ SystemMessage msg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PWD_EXISTS);
+ msg.makeSubstitution(sUserID, sHostName);
+ setErrorMessage(msg);
+ okButton.setEnabled(false);
+ hostname.setFocus();
+ return false;
+ }
+ }
+ }
+ else
+ {
+ // Adding a new entry, make sure it doesn't already exist
+ if (exists(signonInfo.getHostname(), signonInfo.getUserid(), signonInfo.getSystemType()))
+ {
+ SystemMessage msg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PWD_EXISTS);
+ msg.makeSubstitution(sUserID, sHostName);
+ setErrorMessage(msg);
+ okButton.setEnabled(false);
+ hostname.setFocus();
+ return false;
+ }
+ }
+
+ return super.processOK();
+ }
+
+ /**
+ * Check if a password is already saved for the given hostname, user ID and system type
+ */
+ private boolean exists(String hostname, String userID, String systemType)
+ {
+ SystemSignonInformation info;
+ PasswordPersistenceManager manager = PasswordPersistenceManager.getInstance();
+ boolean found = false;
+
+ for (int i = 0; !found && i < existingEntries.size(); i++)
+ {
+ info = (SystemSignonInformation) existingEntries.get(i);
+ if (hostname.equalsIgnoreCase(info.getHostname()) &&
+ systemType.equals(info.getSystemType()))
+ {
+ if (!manager.isUserIDCaseSensitive(info.getSystemType()))
+ {
+ found = userID.equalsIgnoreCase(info.getUserid());
+ }
+ else
+ {
+ found = userID.equals(info.getUserid());
+ }
+ }
+ }
+
+ return found;
+ }
+
+ /**
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(Composite)
+ */
+ public void createControl(Composite parent) {
+ super.createControl(parent);
+ if (change)
+ {
+ SystemWidgetHelpers.setCompositeHelp(parent, SystemPlugin.HELPPREFIX + "pwdi0002");
+ password.setFocus();
+ }
+ else
+ {
+ SystemWidgetHelpers.setCompositeHelp(parent, SystemPlugin.HELPPREFIX + "pwdi0001");
+ hostname.setFocus();
+ }
+ }
+
+ /**
+ * Set the input data to prepopulate the change dialog
+ */
+ public void setInputData(String systemtype, String hostname, String userid)
+ {
+ originalSystemType = systemtype;
+ originalHostname = hostname;
+ originalUserid = userid;
+ }
+ /**
+ * @see org.eclipse.swt.events.ModifyListener#modifyText(ModifyEvent)
+ */
+ public void modifyText(ModifyEvent e) {
+ if (e.getSource() == hostname && hostname.getText().trim().equals(""))
+ {
+ setErrorMessage(SystemPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PWD_BLANKFIELD));
+ hostname.setFocus();
+ okButton.setEnabled(false);
+ }
+ else if (e.getSource() == userid && userid.getText().trim().equals(""))
+ {
+ setErrorMessage(SystemPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PWD_BLANKFIELD));
+ userid.setFocus();
+ okButton.setEnabled(false);
+ }
+ else if (e.getSource() == systemType && systemType.getText().trim().equals(""))
+ {
+ setErrorMessage(SystemPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PWD_BLANKFIELD));
+ systemType.setFocus();
+ okButton.setEnabled(false);
+ }
+ else if (e.getSource() == password && password.getText().trim().equals(""))
+ {
+ setErrorMessage(SystemPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PWD_BLANKFIELD));
+ password.setFocus();
+ okButton.setEnabled(false);
+ }
+ else if (e.getSource() == passwordVerify && passwordVerify.getText().trim().equals(""))
+ {
+ setErrorMessage(SystemPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PWD_BLANKFIELD));
+ passwordVerify.setFocus();
+ okButton.setEnabled(false);
+ }
+ else
+ {
+ clearErrorMessage();
+
+ if (hostname.getText().trim().equals("") ||
+ userid.getText().trim().equals("") ||
+ systemType.getText().trim().equals("") ||
+ password.getText().trim().equals("") ||
+ passwordVerify.getText().trim().equals(""))
+ {
+ // clear error messages but button stays disabled
+ okButton.setEnabled(false);
+ }
+ else
+ {
+ okButton.setEnabled(true);
+ }
+ }
+
+ }
+
+ /**
+ * @see org.eclipse.jface.window.Window#open()
+ */
+ public int open()
+ {
+ return super.open();
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemPasswordPromptDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemPasswordPromptDialog.java
new file mode 100644
index 00000000000..0c8c0207c88
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemPasswordPromptDialog.java
@@ -0,0 +1,524 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.dialogs;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.SystemPreferencesManager;
+import org.eclipse.rse.core.subsystems.IConnectorService;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.SystemWidgetHelpers;
+import org.eclipse.rse.ui.validators.ISystemValidator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+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.Shell;
+import org.eclipse.swt.widgets.Text;
+
+
+
+/**
+ * Prompt user for password.
+ * This class is final due to the sensitive nature of the information being prompted for.
+ */
+public final class SystemPasswordPromptDialog
+ extends SystemPromptDialog
+ implements ISystemMessages, ISystemPasswordPromptDialog
+{
+
+ // lables are not as big as text fields so we need to set the height for the system type
+ // and hostname labels so they are equally spaced with the user ID and password entry fields
+ private static final int LABEL_HEIGHT = 17;
+
+ protected Text textPassword;
+
+ // yantzi: artemis 6.0, at request of zOS team I am changing the system type and hostname
+ // to labels so they are clearer to read then non-editable entry fields
+ //protected Text textSystemType, textHostName, textUserId;
+ protected Text textUserId;
+
+ protected Button userIdPermanentCB, savePasswordCB;
+ //protected String userId,password;
+ protected String originalUserId;
+ protected String userId, password;
+ protected boolean userIdPermanent = false;
+ protected boolean savePassword = false;
+ protected boolean forceToUpperCase;
+ protected boolean userIdChanged = false;
+ protected boolean userIdOK = true;
+ protected boolean passwordOK = false;
+ protected boolean noValidate = false;
+ protected ISystemValidator userIdValidator, passwordValidator;
+ protected ISignonValidator signonValidator;
+ protected SystemMessage errorMessage = null;
+
+ /**
+ * Constructor for SystemPasswordPromptDialog
+ */
+ public SystemPasswordPromptDialog(Shell shell)
+ {
+ super(shell, SystemResources.RESID_PASSWORD_TITLE);
+ //pack();
+ setHelp(SystemPlugin.HELPPREFIX+"pwdp0000");
+ }
+ /**
+ * Set the input System object in which the user is attempting to do a connect action.
+ * This is used to query the system type, host name and userId to display to the user for
+ * contextual information.
+ *
+ * This must be called right after instantiating this dialog.
+ */
+ public void setSystemInput(IConnectorService systemObject)
+ {
+ setInputObject(systemObject);
+ }
+ /**
+ * Call this to specify a validator for the userId. It will be called per keystroke.
+ */
+ public void setUserIdValidator(ISystemValidator v)
+ {
+ userIdValidator = v;
+ }
+ /**
+ * Call this to specify a validator for the password. It will be called per keystroke.
+ */
+ public void setPasswordValidator(ISystemValidator v)
+ {
+ passwordValidator = v;
+ }
+ /**
+ * Call this to specify a validator for the signon. It will be called when the user presses OK.
+ */
+ public void setSignonValidator(ISignonValidator v)
+ {
+ signonValidator = v;
+ }
+ /**
+ * Call this to force the userId and password to uppercase
+ */
+ public void setForceToUpperCase(boolean force)
+ {
+ this.forceToUpperCase = force;
+ }
+ /**
+ * Call this to query the force-to-uppercase setting
+ */
+ public boolean getForceToUpperCase()
+ {
+ return forceToUpperCase;
+ }
+ /**
+ * @see SystemPromptDialog#getInitialFocusControl()
+ */
+ protected Control getInitialFocusControl()
+ {
+ okButton.setEnabled(false);
+
+
+ if (textUserId.getText().length()==0)
+ return textUserId;
+ else
+ {
+ if (password != null)
+ {
+ validatePasswordInput();
+ textPassword.selectAll();
+ }
+ return textPassword;
+ }
+ }
+
+
+ /**
+ * @see SystemPromptDialog#createInner(Composite)
+ */
+ protected Control createInner(Composite parent)
+ {
+ // top level composite
+ Composite composite = new Composite(parent,SWT.NONE);
+ composite.setLayout(new GridLayout());
+ composite.setLayoutData(new GridData(
+ GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
+
+ // Inner composite
+ Composite composite_prompts = SystemWidgetHelpers.createComposite(
+ composite, 2);
+
+ IConnectorService systemObject = (IConnectorService)getInputObject();
+
+ // System type
+ //textSystemType = SystemWidgetHelpers.createLabeledReadonlyTextField(
+ // composite_prompts,rb,RESID_CONNECTION_SYSTEMTYPE_READONLY_ROOT);
+ String text = SystemWidgetHelpers.appendColon(SystemResources.RESID_CONNECTION_SYSTEMTYPE_READONLY_LABEL);
+ Label label = SystemWidgetHelpers.createLabel(composite_prompts, text);
+ GridData gd = new GridData();
+ gd.heightHint = LABEL_HEIGHT;
+ label.setLayoutData(gd);
+
+ label = SystemWidgetHelpers.createLabel(composite_prompts, systemObject.getHostType());
+ gd = new GridData();
+ gd.heightHint = LABEL_HEIGHT;
+ label.setLayoutData(gd);
+
+ // Host name
+ //textHostName = SystemWidgetHelpers.createLabeledReadonlyTextField(
+ // composite_prompts, rb, ISystemConstants.RESID_CONNECTION_HOSTNAME_READONLY_ROOT);
+ text = SystemWidgetHelpers.appendColon(SystemResources.RESID_CONNECTION_HOSTNAME_READONLY_LABEL);
+ label = SystemWidgetHelpers.createLabel(composite_prompts, text);
+ gd = new GridData();
+ gd.heightHint = LABEL_HEIGHT;
+ label.setLayoutData(gd);
+ label = SystemWidgetHelpers.createLabel(composite_prompts, systemObject.getHostName());
+ gd = new GridData();
+ gd.heightHint = LABEL_HEIGHT;
+ label.setLayoutData(gd);
+
+ // UserId
+ textUserId = SystemWidgetHelpers.createLabeledTextField(
+ composite_prompts,this,SystemResources.RESID_CONNECTION_USERID_LABEL, SystemResources.RESID_CONNECTION_USERID_TIP);
+
+ // Password prompt
+ textPassword = SystemWidgetHelpers.createLabeledTextField(
+ composite_prompts,this,SystemResources.RESID_PASSWORD_LABEL, SystemResources.RESID_PASSWORD_TIP);
+ textPassword.setEchoChar('*');
+
+ // UserId_make_permanent checkbox
+ // DY: align user ID checkbox with entry fields
+ // yantzi:5.1 move checkboxes to be below entry fields
+ SystemWidgetHelpers.createLabel(composite_prompts, "");
+ userIdPermanentCB = SystemWidgetHelpers.createCheckBox(
+ composite_prompts, 1, this, SystemResources.RESID_PASSWORD_USERID_ISPERMANENT_LABEL, SystemResources.RESID_PASSWORD_USERID_ISPERMANENT_TIP );
+ userIdPermanentCB.setEnabled(false);
+
+ // Save signon information checkbox
+ // DY: align password checkbox with entry fields
+ SystemWidgetHelpers.createLabel(composite_prompts, "");
+ savePasswordCB = SystemWidgetHelpers.createCheckBox(
+ composite_prompts, 1, this, SystemResources.RESID_PASSWORD_SAVE_LABEL, SystemResources.RESID_PASSWORD_SAVE_TOOLTIP);
+ savePasswordCB.setSelection(savePassword);
+ // disable until the user enters something for consistency with the save user ID checkbox
+ savePasswordCB.setEnabled(false);
+
+ initializeInput();
+
+ // add keystroke listeners...
+ textUserId.addModifyListener(
+ new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ validateUserIdInput();
+ }
+ }
+ );
+ textPassword.addModifyListener(
+ new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ validatePasswordInput();
+ }
+ }
+ );
+
+
+ //SystemWidgetHelpers.setHelp(composite, SystemPlugin.HELPPREFIX+"pwdp0000");
+ return composite;
+ }
+
+// yantzi: artemis 6.0 not required, the Window class handles ESC processing
+// /**
+// * @see SystemPromptDialog#createContents(Composite)
+// */
+// protected Control createContents(Composite parent)
+// {
+// //System.out.println("INSIDE CREATECONTENTS");
+// Control c = super.createContents(parent);
+// // Listen for ESC keypress, simulate the user pressing
+// // the cancel button
+//
+// KeyListener keyListener = new KeyAdapter() {
+// public void keyPressed(KeyEvent e) {
+// if (e.character == SWT.ESC) {
+// buttonPressed(CANCEL_ID);
+// }
+// }
+// };
+//
+// textUserId.addKeyListener(keyListener);
+// textPassword.addKeyListener(keyListener);
+// userIdPermanentCB.addKeyListener(keyListener);
+// okButton.addKeyListener(keyListener);
+// cancelButton.addKeyListener(keyListener);
+//
+// return c;
+// }
+
+
+ /**
+ * Init values using input data
+ */
+ protected void initializeInput()
+ {
+ IConnectorService systemObject = (IConnectorService)getInputObject();
+ //textSystemType.setText(systemObject.getSystemType());
+ //textHostName.setText(systemObject.getHostName());
+ originalUserId = systemObject.getUserId();
+ if ((originalUserId != null) && (originalUserId.length()>0))
+ {
+ //textUserId.setEditable(false);
+ //textUserId.setEnabled(false);
+ textUserId.setText(originalUserId);
+ }
+ else
+ {
+ // added by phil: if we don't prompt for userId at new connection time,
+ // then we should default here to the preferences setting for the user id,
+ // by SystemType...
+ String preferencesUserId = SystemPreferencesManager.getPreferencesManager().getDefaultUserId(systemObject.getHostType());
+ if (preferencesUserId != null)
+ textUserId.setText(preferencesUserId);
+ originalUserId = "";
+ }
+
+ if (password != null)
+ {
+ textPassword.setText(password);
+ }
+
+ }
+ /**
+ * Return the userId entered by user
+ */
+ private String internalGetUserId()
+ {
+ userId = textUserId.getText().trim();
+ return userId;
+ }
+
+ /**
+ * Return the password entered by user
+ */
+ private String internalGetPassword()
+ {
+ password = textPassword.getText().trim();
+ return password;
+ }
+ /**
+ * Return true if the user elected to make the changed user Id a permanent change.
+ */
+ private boolean internalGetIsUserIdChangePermanent()
+ {
+ userIdPermanent = userIdPermanentCB.getSelection();
+ return userIdPermanent;
+ }
+ /**
+ * Return true if the user elected to save the password
+ */
+ private boolean internalGetIsSavePassword()
+ {
+ savePassword = savePasswordCB.getSelection();
+ return savePassword;
+ }
+
+
+ /**
+ * This hook method is called whenever the text changes in the user Id input field.
+ * The default implementation delegates the request to an
+ * By default we configure the dialog as modal. If you do not want this,
+ * call setBlockOnOpen(false) after instantiating.
+ *
+ * This base class offers the following ease-of-use features:
+ * To use this class: For error checking, add modify listeners to entry fields and if needed selection listeners to buttons, then in your event handler Support is patterned after WizardDialog in JFace.
+ */
+ public void setNeedsProgressMonitor(boolean needs)
+ {
+ this.needsProgressMonitor = needs;
+ }
+
+ /**
+ * For setting the default overall help for the dialog.
+ * This can be overridden per control by calling {@link #setHelp(Control, String)}.
+ */
+ public void setHelp(String helpId)
+ {
+ if (parentComposite != null)
+ {
+ SystemWidgetHelpers.setHelp(parentComposite, helpId);
+ SystemWidgetHelpers.setHelp(buttonsComposite, helpId);
+ //SystemWidgetHelpers.setCompositeHelp(parentComposite, helpId, helpIdPerControl);
+ //SystemWidgetHelpers.setCompositeHelp(buttonsComposite, helpId, helpIdPerControl);
+ }
+ this.helpId = helpId;
+ }
+ /**
+ * For retrieving the help Id
+ */
+ public String getHelpContextId()
+ {
+ return helpId;
+ }
+ /**
+ * For setting control-specific help for a control on the wizard page.
+ *
+ * This overrides the default set in the call to {@link #setHelp(String)}.
+ */
+ public void setHelp(Control c, String helpId)
+ {
+ SystemWidgetHelpers.setHelp(c, helpId);
+ //if (helpIdPerControl == null)
+ // helpIdPerControl = new Hashtable();
+ //helpIdPerControl.put(c, helpId);
+ }
+
+ /**
+ * For explicitly setting input object. Called by SystemDialogAction
+ */
+ public void setInputObject(Object inputObject)
+ {
+ this.inputObject = inputObject;
+ }
+ /**
+ * For explicitly getting input object
+ */
+ public Object getInputObject()
+ {
+ return inputObject;
+ }
+
+ /**
+ * For explicitly getting output object after dialog is dismissed. Set by the
+ * dialog's processOK method.
+ */
+ public Object getOutputObject()
+ {
+ return outputObject;
+ }
+
+ /**
+ * Allow caller to determine if window was cancelled or not.
+ */
+ public boolean wasCancelled()
+ {
+ return !okPressed;
+ }
+
+ /**
+ * If validation of the output object is desired, set the validator here.
+ * It will be used when the child class calls setOutputObject().
+ */
+ public void setOutputObjectValidator(ISystemValidator outputObjectValidator)
+ {
+ this.outputObjectValidator = outputObjectValidator;
+ }
+
+ /**
+ * Return the output object validator
+ */
+ public ICellEditorValidator getOutputObjectValidator()
+ {
+ return outputObjectValidator;
+ }
+
+ /**
+ * Get the ISystemMessageLine control reference.
+ */
+ public ISystemMessageLine getMessageLine()
+ {
+ return fMessageLine;
+ }
+
+ /**
+ * For explicitly setting output object. Call this in your processOK method.
+ * If an output object validator has been set via setOutputObjectValidator, then
+ * this will call its isValid method on the outputObject and will return the error
+ * message if any that it issues. A return of null always means no errors and
+ * hence it is ok to dismiss the dialog.
+ */
+ protected SystemMessage setOutputObject(Object outputObject)
+ {
+ this.outputObject = outputObject;
+ if ((outputObjectValidator != null) && (outputObject instanceof String))
+ return outputObjectValidator.validate((String)outputObject);
+ else
+ return null;
+ }
+
+ /**
+ * Set the cursor to the wait cursor (true) or restores it to the normal cursor (false).
+ */
+ public void setBusyCursor(boolean setBusy)
+ {
+ if (setBusy)
+ {
+ // Set the busy cursor to all shells.
+ Display d = getShell().getDisplay();
+ waitCursor = new Cursor(d, SWT.CURSOR_WAIT);
+ setDisplayCursor(waitCursor);
+ }
+ else
+ {
+ setDisplayCursor(null);
+ if (waitCursor != null)
+ waitCursor.dispose();
+ waitCursor = null;
+ }
+ }
+
+ // --------------------------
+ // OK BUTTON CONFIGURATION...
+ // --------------------------
+ /**
+ * Disable showing of Ok button
+ */
+ public void setShowOkButton(boolean showOk)
+ {
+ this.showOkButton = showOk;
+ }
+ /**
+ * For explicitly setting ok button label
+ */
+ public void setOkButtonLabel(String label)
+ {
+ this.labelOk = label;
+ }
+ /**
+ * For explicitly setting ok button tooltip text
+ */
+ public void setOkButtonToolTipText(String tip)
+ {
+ this.tipOk = tip;
+ }
+ /**
+ * For explicitly enabling/disabling ok button.
+ */
+ public void enableOkButton(boolean enable)
+ {
+ if (okButton != null)
+ okButton.setEnabled(enable);
+ }
+ /**
+ * Return ok button widget
+ */
+ public Button getOkButton()
+ {
+ return okButton;
+ }
+ /**
+ * Set initial enabled state of ok button.
+ * Call this from createContents, which is called before the ok button is created.
+ */
+ public void setInitialOKButtonEnabledState(boolean enabled)
+ {
+ initialOKButtonEnabledState = enabled;
+ }
+ /**
+ * To be overridden by children.
+ * Called when user presses OK button.
+ * Child dialog class should set output object.
+ * Return true to close dialog.
+ * Return false to not close dialog.
+ */
+ protected boolean processOK()
+ {
+ return true;
+ }
+
+ // ------------------------------
+ // CANCEL BUTTON CONFIGURATION...
+ // ------------------------------
+ /**
+ * For explicitly setting cancel button label
+ */
+ public void setCancelButtonLabel(String label)
+ {
+ this.labelCancel = label;
+ }
+ /**
+ * For explicitly setting cancel button tooltip text
+ */
+ public void setCancelButtonToolTipText(String tip)
+ {
+ this.tipCancel = tip;
+ }
+ /**
+ * For explicitly enabling/disabling cancel button.
+ */
+ public void enableCancelButton(boolean enable)
+ {
+ if (cancelButton != null)
+ cancelButton.setEnabled(enable);
+ }
+ /**
+ * Return cancel button widget.
+ * Be careful not to call the deprecated inherited method getCancelButton()!
+ */
+ public Button getCancelOrCloseButton()
+ {
+ return cancelButton;
+ }
+ /**
+ * To be overridden by children.
+ * Called when user presses CANCEL button.
+ * Return true to close dialog.
+ * Return false to not close dialog.
+ */
+ protected boolean processCancel()
+ {
+ return true;
+ }
+
+ // ------------------------------
+ // BROWSE BUTTON CONFIGURATION...
+ // ------------------------------
+ /**
+ * Explicitly specify if Browse Button to be shown
+ */
+ public void setShowBrowseButton(boolean show)
+ {
+ this.showBrowseButton = show;
+ }
+ /**
+ * For explicitly setting browse button label
+ */
+ public void setBrowseButtonLabel(String label)
+ {
+ this.labelBrowse = label;
+ }
+ /**
+ * For explicitly setting Browse button tooltip text
+ */
+ public void setBrowseButtonToolTipText(String tip)
+ {
+ this.tipBrowse = tip;
+ }
+ /**
+ * For explicitly enabling/disabling Browse button.
+ */
+ public void enableBrowseButton(boolean enable)
+ {
+ if (browseButton != null)
+ browseButton.setEnabled(enable);
+ }
+ /**
+ * Return browse button widget
+ */
+ public Button getBrowseButton()
+ {
+ return browseButton;
+ }
+ /**
+ * To be overridden by children.
+ * Called when user presses BROWSE button.
+ * Return false always!
+ */
+ protected boolean processBrowse()
+ {
+ return false;
+ }
+
+ // ------------------------------
+ // TEST BUTTON CONFIGURATION...
+ // ------------------------------
+ /**
+ * Explicitly specify if Test Button to be shown
+ */
+ public void setShowTestButton(boolean show)
+ {
+ this.showTestButton = show;
+ }
+ /**
+ * For explicitly setting test button label
+ */
+ public void setTestButtonLabel(String label)
+ {
+ this.labelTest = label;
+ }
+ /**
+ * For explicitly setting Test button tooltip text
+ */
+ public void setTestButtonToolTipText(String tip)
+ {
+ this.tipTest = tip;
+ }
+ /**
+ * For explicitly enabling/disabling Test button.
+ */
+ public void enableTestButton(boolean enable)
+ {
+ if (testButton != null)
+ testButton.setEnabled(enable);
+ }
+ /**
+ * Return test button widget
+ */
+ public Button getTestButton()
+ {
+ return testButton;
+ }
+ /**
+ * To be overridden by children.
+ * Called when user presses TEST button.
+ * Return false always!
+ */
+ protected boolean processTest()
+ {
+ return false;
+ }
+
+ // ------------------------------
+ // ADD BUTTON CONFIGURATION...
+ // ------------------------------
+ /**
+ * Explicitly specify if Add Button to be shown
+ */
+ public void setShowAddButton(boolean show)
+ {
+ this.showAddButton = show;
+ }
+ /**
+ * For explicitly setting Add button label
+ */
+ public void setAddButtonLabel(String label)
+ {
+ this.labelAdd = label;
+ }
+ /**
+ * For explicitly setting Add button tooltip text
+ */
+ public void setAddButtonToolTipText(String tip)
+ {
+ this.tipAdd = tip;
+ }
+ /**
+ * For explicitly enabling/disabling Add button.
+ */
+ public void enableAddButton(boolean enable)
+ {
+ if (addButton != null)
+ addButton.setEnabled(enable);
+ else
+ initialAddButtonEnabledState = enable;
+ }
+ /**
+ * Return Add button widget
+ */
+ public Button getAddButton()
+ {
+ return addButton;
+ }
+ /**
+ * To be overridden by children.
+ * Called when user presses ADD button.
+ * Return false always!
+ */
+ protected boolean processAdd()
+ {
+ return false;
+ }
+
+ // ------------------------------
+ // DETAILS BUTTON CONFIGURATION...
+ // ------------------------------
+ /**
+ * Explicitly specify if Details Button to be shown.
+ * There is support to automatically toggle the text.
+ * @param true if the Details button is to be shown
+ * @param true if the button should initially be in "hide mode" versus "hide mode"
+ */
+ public void setShowDetailsButton(boolean show, boolean hideMode)
+ {
+ this.showDetailsButton = show;
+ this.detailsButtonHideMode = hideMode;
+ }
+ /**
+ * For explicitly setting Details button label
+ */
+ public void setDetailsButtonLabel(String showLabel, String hideLabel)
+ {
+ this.labelDetailsShow = showLabel;
+ this.labelDetailsHide = hideLabel;
+ }
+ /**
+ * For explicitly setting Details button tooltip text
+ */
+ public void setDetailsButtonToolTipText(String showTip, String hideTip)
+ {
+ this.tipDetailsShow = showTip;
+ this.tipDetailsHide = hideTip;
+ }
+ /**
+ * For explicitly enabling/disabling Details button.
+ */
+ public void enableDetailsButton(boolean enable)
+ {
+ if (detailsButton != null)
+ detailsButton.setEnabled(enable);
+ else
+ initialDetailsButtonEnabledState = enable;
+ }
+ /**
+ * Return Details button widget
+ */
+ public Button getDetailsButton()
+ {
+ return detailsButton;
+ }
+ /**
+ * To be overridden by children.
+ * Called when user presses DETAILS button.
+ *
+ * Note the text is automatically toggled for you! You need only
+ * do whatever the functionality is that you desire
+ *
+ * @param hideMode the current state of the details toggle, prior to this request. If you return true from
+ * this method, this state and the button text will be toggled.
+ *
+ * @return true if the details state toggle was successful, false if it failed.
+ */
+ protected boolean processDetails(boolean hideMode)
+ {
+ return true;
+ }
+
+
+
+ /**
+ * Get the list of all unique mnemonics used by buttons on this dialog. This is only
+ * set at the time createButtonBar is called by the parent, and this is after the createContents
+ * method call. It will return null until then. So, it is not available for you at constructor time.
+ * Use setUniqueMnemonic(Button) on the returned object if you want to add a mnemonic to
+ * button after the fact.
+ */
+ public Mnemonics getDialogMnemonics()
+ {
+ return dialogMnemonics;
+ }
+
+ /**
+ * Create message line.
+ */
+ protected ISystemMessageLine createMessageLine(Composite c)
+ {
+ //System.out.println("INSIDE CREATEMESSAGELINE");
+ fMessageLine= new SystemMessageLine(c);
+ fMessageLine.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
+ Display.getCurrent().asyncExec(this);
+ return fMessageLine;
+ }
+ /**
+ * For asynch exec we defer some operations until other pending events are processed.
+ * For now, this is used to display pending error messages
+ */
+ public void run()
+ {
+ if (pendingErrorMessage != null)
+ setErrorMessage(pendingErrorMessage);
+ else if (pendingMessage != null)
+ setMessage(pendingMessage);
+ pendingErrorMessage = pendingMessage = null;
+ }
+
+ /**
+ * Handles events generated by controls on this page.
+ * Should be overridden by child.
+ * Only public because of interface requirement!
+ */
+ public void handleEvent(Event e)
+ {
+ //Widget source = e.widget;
+ }
+
+ /**
+ * Swing-like method to auto-set the size of this dialog by
+ * looking at the preferred sizes of all constituents.
+ * @deprecated
+ */
+ protected void pack()
+ {
+ // pack = true; // defer until controls are all created.
+ }
+
+ /**
+ * Called by createContents method.
+ * Create this dialog's widgets inside a composite.
+ * Child classes must override this.
+ */
+ protected abstract Control createInner(Composite parent);
+
+ /**
+ * Return the Control to be given initial focus.
+ * Child classes must override this, but can return null.
+ */
+ protected abstract Control getInitialFocusControl();
+
+
+
+ /**
+ * Override of parent method.
+ * Called by IDE when button is pressed.
+ */
+ protected void buttonPressed(int buttonId)
+ {
+ okPressed = false;
+ if (buttonId == OK_ID)
+ {
+ //setReturnId(buttonId);
+ setReturnCode(OK);
+ if (processOK())
+ {
+ okPressed = true;
+ close();
+ }
+ }
+ /* Now handled by the cancelListener
+ else if (buttonId == CANCEL_ID)
+ {
+ if (processCancel())
+ super.buttonPressed(buttonId);
+ }*/
+ else if (buttonId == BROWSE_ID)
+ {
+ processBrowse();
+ }
+ else if (buttonId == TEST_ID)
+ {
+ processTest();
+ }
+ else if (buttonId == ADD_ID)
+ {
+ processAdd();
+ }
+ else if (buttonId == DETAILS_ID)
+ {
+ if (processDetails(detailsButtonHideMode))
+ {
+ detailsButtonHideMode = !detailsButtonHideMode;
+ detailsButton.setText(detailsButtonHideMode ? detailsShowLabel : detailsHideLabel);
+ if (detailsButtonHideMode && (tipDetailsShow != null))
+ detailsButton.setToolTipText(tipDetailsShow);
+ else if (!detailsButtonHideMode && (tipDetailsHide != null))
+ detailsButton.setToolTipText(tipDetailsHide);
+ }
+ }
+
+ }
+
+ /**
+ * Intercept of parent, so we can create the msg line above the button bar.
+ */
+ protected Control createButtonBar(Composite parent)
+ {
+ createMessageLine(parent);
+ return super.createButtonBar(parent);
+ }
+
+ /**
+ * Adjust the width hint of a button to account for the presumed addition of a mnemonic.
+ * @param button the button whose width is to be adjusted.
+ */
+ protected void adjustButtonWidth(Button button) {
+ String text = button.getText();
+ // adjust the width hint to allow for a mnemonic to be added.
+ if (text != null) {
+ if (text.indexOf('&') < 0) {
+ Object layoutData = button.getLayoutData();
+ if (layoutData instanceof GridData) {
+ GridData gd = (GridData) layoutData;
+ if (gd.widthHint != SWT.DEFAULT) {
+ gd.widthHint += convertWidthInCharsToPixels(3);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Add buttons to the dialog's button bar.
+ *
+ * Subclasses may override.
+ *
+ * @param parent the button bar composite
+ */
+ protected void createButtonsForButtonBar(Composite parent)
+ {
+ //System.out.println("Inside createButtonsForButtonBar");
+ //System.out.println("Vertical spacing="+((GridLayout)parent.getLayout()).verticalSpacing);
+ //System.out.println("Margin height="+((GridLayout)parent.getLayout()).marginHeight);
+ ((GridLayout)parent.getLayout()).verticalSpacing = verticalSpacing;
+ //((GridLayout)parent.getLayout()).horizontalSpacing = horizontalSpacing;
+ ((GridLayout)parent.getLayout()).marginWidth = marginWidth;
+ ((GridLayout)parent.getLayout()).marginHeight = marginHeight;
+ //System.out.println("INSIDE CREATEBUTTONSFORBUTTONBAR");
+
+ // create requested buttons...
+
+ if (showOkButton)
+ {
+ String okLabel = (labelOk!=null)?labelOk: IDialogConstants.OK_LABEL;
+ okButton = createButton(parent, IDialogConstants.OK_ID, okLabel, true);
+ okButton.setEnabled(initialOKButtonEnabledState);
+ if (tipOk != null)
+ okButton.setToolTipText(tipOk);
+ }
+ if (showBrowseButton)
+ {
+ String browseLabel = (labelBrowse!=null)?labelBrowse: SystemResources.BUTTON_BROWSE;
+ browseButton = createButton(parent, BROWSE_ID, browseLabel, false);
+ if (tipBrowse != null)
+ browseButton.setToolTipText(tipBrowse);
+ }
+ if (showTestButton)
+ {
+ String testLabel = (labelTest!=null)?labelTest: SystemResources.BUTTON_TEST;
+ testButton = createButton(parent, TEST_ID, testLabel, false);
+ if (tipTest != null)
+ testButton.setToolTipText(tipTest);
+ }
+ if (showAddButton)
+ {
+ String addLabel = (labelAdd!=null)?labelAdd: SystemResources.BUTTON_ADD;
+ addButton = createButton(parent, ADD_ID, addLabel, !showOkButton);
+ if (tipAdd != null)
+ addButton.setToolTipText(tipAdd);
+ addButton.setEnabled(initialAddButtonEnabledState);
+ }
+ if (showDetailsButton)
+ {
+ detailsShowLabel = Mnemonics.removeMnemonic((labelDetailsShow!=null)?labelDetailsShow: IDialogConstants.SHOW_DETAILS_LABEL);
+ detailsHideLabel = Mnemonics.removeMnemonic((labelDetailsHide!=null)?labelDetailsHide: IDialogConstants.HIDE_DETAILS_LABEL);
+ String detailsLabel = detailsButtonHideMode ? detailsShowLabel : detailsHideLabel;
+ detailsButton = createButton(parent, DETAILS_ID, detailsLabel, false);
+ adjustButtonWidth(detailsButton);
+ if (detailsButtonHideMode && (tipDetailsShow != null))
+ detailsButton.setToolTipText(tipDetailsShow);
+ else if (!detailsButtonHideMode && (tipDetailsHide != null))
+ detailsButton.setToolTipText(tipDetailsHide);
+ detailsButton.setEnabled(initialDetailsButtonEnabledState);
+ }
+
+ String cancelLabel = (labelCancel!=null)?labelCancel: IDialogConstants.CANCEL_LABEL;
+ cancelButton = createButton(parent, IDialogConstants.CANCEL_ID, cancelLabel, false);
+ if (tipCancel != null)
+ cancelButton.setToolTipText(tipCancel);
+ cancelListener= new SelectionAdapter()
+ {
+ public void widgetSelected(SelectionEvent e)
+ {
+ if (activeRunningOperations <= 0)
+ {
+ if (processCancel())
+ doCancel();
+ }
+ else
+ cancelButton.setEnabled(false);
+ }
+ };
+ cancelButton.addSelectionListener(cancelListener);
+
+ buttonsComposite = parent;
+ if (helpId != null)
+ SystemWidgetHelpers.setHelp(buttonsComposite, helpId);
+ //SystemWidgetHelpers.setCompositeHelp(buttonsComposite, helpId);
+ }
+
+ private void doCancel()
+ {
+ super.buttonPressed(CANCEL_ID);
+ }
+
+ /**
+ * Set minimum width and height for this dialog.
+ * Pass zero for either to not affect it.
+ */
+ public void setMinimumSize(int width, int height)
+ {
+ minWidth = width;
+ minHeight = height;
+ }
+ /**
+ * Override of parent.
+ */
+ protected Control createContents(Composite parent)
+ {
+ //System.out.println("INSIDE SYSTEMPROMPTDIALOG#CREATECONTENTS");
+
+ Control c = super.createContents(parent);
+
+ this.parentComposite = (Composite)c;
+ if (helpId != null)
+ SystemWidgetHelpers.setHelp(parentComposite, helpId);
+ //SystemWidgetHelpers.setCompositeHelp(parentComposite, helpId, helpIdPerControl);
+
+ // OK, parent method created dialog area and button bar.
+ // Time now to do our thing...
+
+ // Insert a progress monitor if requested
+ if (needsProgressMonitor)
+ {
+
+ boolean showSeparators = false;
+ // Build the first separator line
+ Label separator = null;
+ if (showSeparators)
+ {
+ separator= new Label(parentComposite, SWT.HORIZONTAL | SWT.SEPARATOR);
+ separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ }
+ GridLayout pmlayout= new GridLayout();
+ pmlayout.numColumns= 1;
+
+ progressMonitorPart= new ProgressMonitorPart(parentComposite, pmlayout, SWT.DEFAULT);
+ progressMonitorPart.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ progressMonitorPart.setVisible(false);
+
+ // Build the second separator line
+ if (showSeparators)
+ {
+ separator= new Label(parentComposite, SWT.HORIZONTAL | SWT.SEPARATOR);
+ separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ }
+ if (SystemPlugin.isTheSystemRegistryActive())
+ {
+ SystemPlugin.getTheSystemRegistry().setRunnableContext(getShell(),this);
+ // add a dispose listener for the shell
+ getShell().addDisposeListener(new DisposeListener()
+ {
+ public void widgetDisposed(DisposeEvent e)
+ {
+ //System.out.println("Inside dispose for SystemPromptDialog");
+ SystemPlugin.getTheSystemRegistry().clearRunnableContext();
+ }
+ });
+ }
+ }
+
+ //createMessageLine((Composite)c); now done before buttons are created. d54501
+
+ Control initialFocusControl = getInitialFocusControl();
+ if (initialFocusControl != null)
+ initialFocusControl.setFocus();
+
+ //buttonsComposite = buttons; // remember the buttons part of the dialog so we can add mnemonics
+ /*
+ * OK now is a good time to add the mnemonics!
+ * This is because both the contents and buttons have been created.
+ */
+ dialogMnemonics = SystemWidgetHelpers.setMnemonics((Composite)getButtonBar());
+ applyMnemonics(dialogMnemonics, (Composite)getDialogArea());
+
+ /*
+ * OK, now that mnemonics for the buttons are set, query the mnemonic for the details button and its
+ * two states... defect 42904
+ */
+ if (showDetailsButton)
+ {
+ if (detailsButtonHideMode)
+ {
+ detailsShowLabel = detailsButton.getText();
+ char m = Mnemonics.getMnemonic(detailsShowLabel);
+ detailsHideLabel = Mnemonics.applyMnemonic(detailsHideLabel, m);
+ }
+ else
+ {
+ detailsHideLabel = detailsButton.getText();
+ char m = Mnemonics.getMnemonic(detailsHideLabel);
+ detailsShowLabel = Mnemonics.applyMnemonic(detailsShowLabel, m);
+ }
+ }
+ if (labelCancel != null)
+ labelCancel = cancelButton.getText(); // reset to include the mnemonic, in case we need to restore it
+
+ if (pack)
+ {
+ Shell shell = getShell();
+ shell.setSize(shell.computeSize(SWT.DEFAULT, SWT.DEFAULT, true));
+ }
+ // return composite created by call to parent's method
+ return c;
+ }
+
+ /**
+ * Apply mnemonic to the composite.
+ * @param c the composite.
+ */
+ protected void applyMnemonics(Mnemonics mnemonics, Composite c) {
+ SystemWidgetHelpers.setMnemonics(mnemonics, c);
+ }
+
+ /**
+ * Called by parent.
+ * Create overall dialog page layout.
+ */
+ protected Control createDialogArea(Composite parent)
+ {
+ //System.out.println("INSIDE CREATEDIALOGAREA");
+ Composite c = new Composite(parent, SWT.NONE);
+ this.dialogAreaComposite = c;
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ layout.marginHeight= marginWidth;
+ layout.marginWidth = marginHeight;
+ layout.verticalSpacing = verticalSpacing;
+ layout.horizontalSpacing= horizontalSpacing;
+ c.setLayout(layout);
+ c.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ Control inner = createInner(c); // allows for child classes to override.
+
+ /*
+ * And now is the time to auto-size if so requested...
+ */
+ if (minWidth > 0)
+ {
+ boolean newData = false;
+ GridData data = (GridData)inner.getLayoutData();
+ if (data == null)
+ {
+ newData = true;
+ data = new GridData();
+ }
+ data.widthHint = minWidth;
+ data.grabExcessHorizontalSpace = true;
+ data.horizontalAlignment = GridData.FILL;
+ if (newData)
+ inner.setLayoutData(data);
+ }
+ if (minHeight > 0)
+ {
+ boolean newData = false;
+ GridData data = (GridData)inner.getLayoutData();
+ if (data == null)
+ {
+ newData = true;
+ data = new GridData();
+ }
+ data.heightHint = minHeight;
+ data.grabExcessVerticalSpace = true;
+ data.verticalAlignment = GridData.FILL;
+ if (newData)
+ inner.setLayoutData(data);
+ }
+ //this.parent = c;
+ //contentsComposite = c; // remember the contents part of the dialog so we can add mnemonics
+ return c;
+ }
+
+ /**
+ * Call this to disable the Apply button if the input is not complete or not valid.
+ */
+ public void setPageComplete(boolean complete)
+ {
+ if (okButton != null)
+ okButton.setEnabled(complete);
+ else
+ initialOKButtonEnabledState = complete;
+ }
+
+ // -----------------
+ // HELPER METHODS...
+ // -----------------
+ /**
+ * Add a separator line. This is a physically visible line.
+ */
+ protected Label addSeparatorLine(Composite parent, int nbrColumns)
+ {
+ Label separator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
+ GridData data = new GridData();
+ data.horizontalSpan = nbrColumns;
+ data.horizontalAlignment = GridData.FILL;
+ separator.setLayoutData(data);
+ return separator;
+ }
+ /**
+ * Add a spacer line
+ */
+ protected Label addFillerLine(Composite parent, int nbrColumns)
+ {
+ Label filler = new Label(parent, SWT.LEFT);
+ GridData data = new GridData();
+ data.horizontalSpan = nbrColumns;
+ data.horizontalAlignment = GridData.FILL;
+ filler.setLayoutData(data);
+ return filler;
+ }
+ /**
+ * Add a spacer line that grows in height to absorb extra space
+ */
+ protected Label addGrowableFillerLine(Composite parent, int nbrColumns)
+ {
+ Label filler = new Label(parent, SWT.LEFT);
+ GridData data = new GridData();
+ data.horizontalSpan = nbrColumns;
+ data.horizontalAlignment = GridData.FILL;
+ data.verticalAlignment = GridData.FILL;
+ data.grabExcessVerticalSpace = true;
+ filler.setLayoutData(data);
+ return filler;
+ }
+
+ /**
+ * Expose inherited protected method convertWidthInCharsToPixels as a publicly
+ * excessible method
+ */
+ public int publicConvertWidthInCharsToPixels(int chars)
+ {
+ return convertWidthInCharsToPixels(chars);
+ }
+ /**
+ * Expose inherited protected method convertHeightInCharsToPixels as a publicly
+ * excessible method
+ */
+ public int publicConvertHeightInCharsToPixels(int chars)
+ {
+ return convertHeightInCharsToPixels(chars);
+ }
+
+ // -----------------------------
+ // ISystemMessageLine METHODS...
+ // -----------------------------
+ /**
+ * Clears the currently displayed error message and redisplayes
+ * the message which was active before the error message was set.
+ */
+ public void clearErrorMessage()
+ {
+ if (fMessageLine != null)
+ fMessageLine.clearErrorMessage();
+ }
+ /**
+ * Clears the currently displayed message.
+ */
+ public void clearMessage()
+ {
+ if (fMessageLine != null)
+ fMessageLine.clearMessage();
+ }
+ /**
+ * Get the currently displayed error text.
+ * @return The error message. If no error message is displayed
+ * If you turn on multiple selection mode, you must use the getSelectedObjects()
+ * method to retrieve the list of selected objects.
+ *
+ * Further, if you turn this on, it has the side effect of allowing the user
+ * to select any remote object. The assumption being if you are prompting for
+ * files, you also want to allow the user to select a folder, with the meaning
+ * being that all files within the folder are implicitly selected.
+ *
+ * @see #getSelectedObjects()
+ */
+ public void setMultipleSelectionMode(boolean multiple)
+ {
+ _multipleSelectionMode = multiple;
+
+ }
+
+ /**
+ * Set the message shown at the top of the form
+ */
+ public void setMessage(String message)
+ {
+ _form.setMessage(message);
+ }
+ /**
+ * Set the tooltip text for the remote systems tree from which an item is selected.
+ */
+ public void setSelectionTreeToolTipText(String tip)
+ {
+ _form.setSelectionTreeToolTipText(tip);
+ }
+
+ /**
+ * Show the property sheet on the right hand side, to show the properties of the
+ * selected object.
+ *
+ * This overload always shows the property sheet
+ *
+ * Default is false
+ */
+ public void setShowPropertySheet(boolean show)
+ {
+ _showPropertySheet = show;
+ }
+ /**
+ * Show the property sheet on the right hand side, to show the properties of the
+ * selected object.
+ *
+ * This overload shows a Details>>> button so the user can decide if they want to see the
+ * property sheet.
+ *
+ * @param show True if show the property sheet within the dialog
+ * @param initialState True if the property is to be initially displayed, false if it is not
+ * to be displayed until the user presses the Details button.
+ */
+ public void setShowPropertySheet(boolean show, boolean initialState)
+ {
+ if (show)
+ {
+ _showPropertySheet = initialState;
+ setShowDetailsButton(true, !initialState);
+ }
+ }
+
+ /**
+ * Return selected file or folder
+ */
+ public Object getSelectedObject()
+ {
+ if (getOutputObject() instanceof Object[])
+ return ((Object[])getOutputObject())[0];
+ else
+ return getOutputObject();
+ }
+ /**
+ * Return all selected objects. This method will return an array of one
+ * unless you have called setMultipleSelectionMode(true)!
+ * @see #setMultipleSelectionMode(boolean)
+ */
+ public Object[] getSelectedObjects()
+ {
+ if (getOutputObject() instanceof Object[])
+ return (Object[])getOutputObject();
+ else if (getOutputObject() instanceof Object)
+ return new Object[] {getOutputObject()};
+ else
+ return null;
+ }
+
+ public IHost getSelectedConnection()
+ {
+ return _form.getSelectedConnection();
+ }
+
+ /**
+ * Private method.
+ *
+ * Called when user presses OK button.
+ * Return true to close dialog.
+ * Return false to not close dialog.
+ */
+ protected boolean processOK()
+ {
+ boolean closeDialog = _form.verify();
+ if (closeDialog)
+ {
+ _outputConnection = _form.getSelectedConnection();
+ if (_multipleSelectionMode)
+ setOutputObject(_form.getSelectedObjects());
+ else
+ setOutputObject(_form.getSelectedObject());
+ }
+ else
+ setOutputObject(null);
+ return closeDialog;
+ }
+ /**
+ * Private method.
+ *
+ * Called when user presses DETAILS button.
+ *
+ * Note the text is automatically toggled for us! We need only
+ * do whatever the functionality is that we desire
+ *
+ * @param hideMode the current state of the details toggle, prior to this request. If we return true from
+ * this method, this state and the button text will be toggled.
+ *
+ * @return true if the details state toggle was successful, false if it failed.
+ */
+ protected boolean processDetails(boolean hideMode)
+ {
+ _form.toggleShowPropertySheet(getShell(), getContents());
+ return true;
+ }
+
+ public abstract SystemActionViewerFilter getViewerFilter();
+ public abstract String getVerbage();
+ public abstract String getTreeTip();
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemRenameDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemRenameDialog.java
new file mode 100644
index 00000000000..fa97e9d849c
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemRenameDialog.java
@@ -0,0 +1,688 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.dialogs;
+import java.util.Hashtable;
+import java.util.Vector;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ColumnLayoutData;
+import org.eclipse.jface.viewers.ColumnPixelData;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.IBasicPropertyConstants;
+import org.eclipse.jface.viewers.ICellEditorListener;
+import org.eclipse.jface.viewers.ICellModifier;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableLayout;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.rse.core.SystemBasePlugin;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.model.IHost;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.SystemWidgetHelpers;
+import org.eclipse.rse.ui.messages.ISystemMessageLine;
+import org.eclipse.rse.ui.validators.ISystemValidator;
+import org.eclipse.rse.ui.validators.ISystemValidatorUniqueString;
+import org.eclipse.rse.ui.validators.ValidatorConnectionName;
+import org.eclipse.rse.ui.validators.ValidatorUniqueString;
+import org.eclipse.rse.ui.view.ISystemPropertyConstants;
+import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.FocusListener;
+import org.eclipse.swt.events.TraverseEvent;
+import org.eclipse.swt.events.TraverseListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
+
+
+/**
+ * Dialog for renaming multiple resources.
+ *
+ * This is a re-usable dialog that you can use directly, or via the {@link org.eclipse.rse.ui.actions.SystemCommonRenameAction}
+ * action.
+ *
+ * To use this dialog, you must call setInputObject with a StructuredSelection of the objects to be renamed.
+ * If those objects adapt to {@link org.eclipse.rse.ui.view.ISystemRemoteElementAdapter} or
+ * {@link org.eclipse.rse.ui.view.ISystemRemoteElementAdapter}, the dialog will offer built-in error checking.
+ *
+ * If the input objects do not adapt to org.eclipse.rse.ui.view.ISystemRemoteElementAdapter or ISystemViewElementAdapter, then you
+ * should call {@link #setNameValidator(org.eclipse.rse.ui.validators.ISystemValidator)} to
+ * specify a validator that is called to verify the typed new name is valid. Further, to show the type value
+ * of the input objects, they should implement {@link org.eclipse.rse.ui.dialogs.ISystemTypedObject}.
+ *
+ * This dialog does not do the actual renames. Rather, it will return an array of the user-typed new names. These
+ * are queriable via {@link #getNewNames()}, after testing that {@link #wasCancelled()} is false. The array entries
+ * will match the input order.
+ *
+ * @see org.eclipse.rse.ui.actions.SystemCommonRenameAction
+ */
+public class SystemRenameDialog extends SystemPromptDialog
+ implements ISystemMessages, ISystemPropertyConstants,
+ ISelectionChangedListener,
+ TraverseListener,
+ ICellEditorListener, Runnable, FocusListener
+{
+
+ private SystemMessage errorMessage;
+ private TextCellEditor cellEditor;
+ private int currRow = 0;
+ private GridData tableData = null;
+ private boolean ignoreSelection = false;
+ private Hashtable uniqueNameValidatorPerParent = new Hashtable();
+
+ private String verbage;
+
+ private SystemRenameTableProvider srtp;
+ private Table table;
+ private TableViewer tableViewer;
+ private static final int COLUMN_NEWNAME = SystemRenameTableProvider.COLUMN_NEWNAME;
+ private String columnHeaders[] = {
+ "",SystemResources.RESID_RENAME_COLHDG_OLDNAME,
+ SystemResources.RESID_RENAME_COLHDG_NEWNAME,
+ SystemResources.RESID_RENAME_COLHDG_TYPE
+ };
+ private ColumnLayoutData columnLayouts[] =
+ {
+ new ColumnPixelData(19, false),
+ new ColumnWeightData(125,125,true),
+ new ColumnWeightData(150,150,true),
+ new ColumnWeightData(120,120,true)
+ };
+ // give each column a property value to identify it
+ private static String[] tableColumnProperties =
+ {
+ ISystemPropertyConstants.P_ERROR,
+ IBasicPropertyConstants.P_TEXT,
+ ISystemPropertyConstants.P_NEWNAME,
+ ISystemPropertyConstants.P_TYPE,
+ };
+ // inner class to support cell editing
+ private ICellModifier cellModifier = new ICellModifier()
+ {
+ public Object getValue(Object element, String property)
+ {
+ SystemRenameTableRow row = (SystemRenameTableRow)element;
+ String value = "";
+ if (property.equals(P_TEXT))
+ value = row.getName();
+ else
+ value = row.getNewName();
+ //System.out.println("inside getvalue: " + row + "; " + property + " = " + value);
+ return value;
+ }
+
+ public boolean canModify(Object element, String property)
+ {
+ boolean modifiable = property.equals(P_NEWNAME);
+ if ((cellEditor != null) && (cellEditor.getControl() != null))
+ {
+ SystemRenameTableRow row = (SystemRenameTableRow)element;
+ int limit = row.getNameLengthLimit();
+ if (limit == -1)
+ limit = 1000;
+ ((Text)cellEditor.getControl()).setTextLimit(limit);
+ }
+ return modifiable;
+ }
+ /**
+ * Modifies a marker as a result of a successfully completed direct editing.
+ */
+ public void modify(Object element, String property, Object value)
+ {
+ SystemRenameTableRow row = (SystemRenameTableRow)(((TableItem)element).getData());
+ //System.out.println("inside modify: " + row+"; "+property+", "+value);
+ if (property.equals(P_NEWNAME))
+ {
+ row.setNewName((String)value);
+ tableViewer.update(row, null);
+ }
+ }
+ };
+
+
+ /**
+ * Constructor for SystemRenameDialog
+ */
+ public SystemRenameDialog(Shell shell)
+ {
+ this(shell, SystemResources.RESID_RENAME_TITLE);
+ }
+ /**
+ * Constructor when you have your own title
+ */
+ public SystemRenameDialog(Shell shell, String title)
+ {
+ super(shell, title);
+
+ //pack();
+ setHelp(SystemPlugin.HELPPREFIX+"drnm0000");
+ }
+ /**
+ * Set the verbage to show above the table. The default is "Enter new name for each resource"
+ */
+ public void setVerbage(String verbage)
+ {
+ this.verbage = verbage;
+ }
+ /**
+ * Set the validator for the new name,as supplied by the adaptor for name checking.
+ * Overrides the default which is to query it from the object's adapter.
+ */
+ public void setNameValidator(ISystemValidator nameValidator)
+ {
+ }
+
+ /**
+ * Create message line. Intercept so we can set msg line of form.
+ */
+ protected ISystemMessageLine createMessageLine(Composite c)
+ {
+ ISystemMessageLine msgLine = super.createMessageLine(c);
+ return fMessageLine;
+ }
+
+
+ /**
+ * @see SystemPromptDialog#getInitialFocusControl()
+ */
+ protected Control getInitialFocusControl()
+ {
+ SystemRenameTableRow[] rows = getRows();
+ tableViewer.setSelection(new StructuredSelection(rows[0]),true);
+ tableViewer.editElement(rows[0], COLUMN_NEWNAME);
+ return null;
+ }
+
+ /**
+ * @see SystemPromptDialog#createInner(Composite)
+ */
+ protected Control createInner(Composite parent)
+ {
+ // Inner composite
+ int nbrColumns = 1;
+ Composite composite = SystemWidgetHelpers.createComposite(parent, nbrColumns);
+
+ if (verbage != null)
+ SystemWidgetHelpers.createVerbage(composite, verbage, nbrColumns, false, 200);
+ else
+ SystemWidgetHelpers.createVerbage(composite, SystemResources.RESID_RENAME_VERBAGE, nbrColumns, false, 200);
+
+ table = createTable(composite);
+ tableViewer = new TableViewer(table);
+ createColumns();
+ tableViewer.setColumnProperties(tableColumnProperties);
+ tableViewer.setCellModifier(cellModifier);
+ CellEditor editors[] = new CellEditor[columnHeaders.length];
+ cellEditor = new TextCellEditor(table);
+ cellEditor.addListener(this);
+ editors[COLUMN_NEWNAME] = cellEditor;
+ tableViewer.setCellEditors(editors);
+ cellEditor.getControl().addTraverseListener(this);
+ //System.out.println("CELL EDITOR CONTROL: " + cellEditor.getControl());
+
+ srtp = new SystemRenameTableProvider();
+ int width = tableData.widthHint;
+ int nbrRows = Math.min(getRows().length,8);
+ int rowHeight = table.getItemHeight() + table.getGridLineWidth();
+ int sbHeight = table.getHorizontalBar().getSize().y;
+ int height = (nbrRows * rowHeight) + sbHeight;
+ //System.out.println("#rows = "+nbrRows+", sbHeight = " + sbHeight+", totalHeight="+height);
+ tableData.heightHint = height;
+ table.setLayoutData(tableData);
+ table.setSize(width, height);
+ tableViewer.setLabelProvider(srtp);
+ tableViewer.setContentProvider(srtp);
+ //System.out.println("Input Object: "+getInputObject());
+ tableViewer.setInput(getInputObject());
+
+ tableViewer.addSelectionChangedListener(this);
+ tableViewer.getTable().addFocusListener(this);
+
+ // test if we need a unique name validator
+ Shell shell = getShell();
+ Display display = shell.getDisplay();
+ if (display != null)
+ display.asyncExec(this);
+ else
+ run();
+
+ return composite;
+ }
+
+
+ private Table createTable(Composite parent)
+ {
+ //table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.BORDER);
+ table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION | SWT.HIDE_SELECTION);
+ table.setLinesVisible(true);
+ tableData = new GridData();
+ tableData.horizontalAlignment = GridData.FILL;
+ tableData.grabExcessHorizontalSpace = true;
+ tableData.widthHint = 450;
+ tableData.heightHint= 30;
+ tableData.verticalAlignment = GridData.CENTER;
+ tableData.grabExcessVerticalSpace = true;
+ table.setLayoutData(tableData);
+
+ //table.addTraverseListener(this);
+ //getShell().addTraverseListener(this);
+
+
+ return table;
+ }
+ private void createColumns()
+ {
+ TableLayout layout = new TableLayout();
+ table.setLayout(layout);
+ table.setHeaderVisible(true);
+ for (int i = 0; i < columnHeaders.length; i++)
+ {
+ layout.addColumnData(columnLayouts[i]);
+ TableColumn tc = new TableColumn(table, SWT.NONE,i);
+ tc.setResizable(columnLayouts[i].resizable);
+ tc.setText(columnHeaders[i]);
+ //tc.addSelectionListener(headerListener);
+ }
+ }
+ public void selectionChanged(SelectionChangedEvent event)
+ {
+ //System.out.println("Selection changed. ignoreSelection? "+ignoreSelection);
+ if (ignoreSelection)
+ return;
+ IStructuredSelection selection = (IStructuredSelection) event.getSelection();
+ if (selection.isEmpty())
+ {
+ currRow = -1;
+ return;
+ }
+ SystemRenameTableRow selectedRow = (SystemRenameTableRow)selection.getFirstElement();
+ int rowIdx = srtp.getRowNumber(selectedRow);
+ if (rowIdx == currRow)
+ return;
+ currRow = rowIdx;
+ tableViewer.editElement(getRows()[rowIdx], COLUMN_NEWNAME);
+ }
+ /**
+ * Override of parent. Must pass selected object onto the form for initializing fields.
+ * Called by SystemDialogAction's default run() method after dialog instantiated.
+ */
+ public void setInputObject(Object inputObject)
+ {
+ //System.out.println("INSIDE SETINPUTOBJECT: " + inputObject);
+ super.setInputObject(inputObject);
+ }
+
+ /**
+ * Called when user presses OK button.
+ * This does not do the actual renames, but rather updates the new name array.
+ * You need to query this via {@link #getNewNames()}, after ensuring the dialog was not
+ * cancelled by calling {@link #wasCancelled()}.
+ */
+ protected boolean processOK()
+ {
+ // the following is for defect 41565 where the changed name is not used when enter pressed after typing
+ if ((currRow >=0) && (currRow <= (getRows().length - 1)))
+ {
+ String newName = ((Text)cellEditor.getControl()).getText();
+ //System.out.println("Testing. newName = "+newName);
+ getRows()[currRow].setNewName(newName);
+ }
+ //else
+ // System.out.println("currRow = "+currRow);
+
+ boolean closeDialog = verify();
+ if (closeDialog)
+ {
+ }
+ return closeDialog;
+ }
+ /**
+ * Verifies all input.
+ * @return true if there are no errors in the user input
+ */
+ public boolean verify()
+ {
+ SystemMessage errMsg = null;
+ SystemMessage firstErrMsg = null;
+ SystemRenameTableRow firstErrRow = null;
+ clearErrorMessage();
+ SystemRenameTableRow[] rows = getRows();
+ Vector newNames = new Vector();
+ // first, clear pending errors...
+ for (int idx=0; (idx
+ * To use this dialog, you must call setInputObject with a StructuredSelection of the objects to be renamed.
+ * If those objects adapt to {@link org.eclipse.rse.ui.view.ISystemRemoteElementAdapter} or
+ * {@link org.eclipse.rse.ui.view.ISystemRemoteElementAdapter}, the dialog will offer built-in error checking.
+ *
+ * If the input object does not adapt to org.eclipse.rse.ui.view.ISystemRemoteElementAdapter or ISystemViewElementAdapter, then you
+ * should call {@link #setNameValidator(org.eclipse.rse.ui.validators.ISystemValidator)} to
+ * specify a validator that is called to verify the user-typed new name is valid. Further, to show the type value
+ * of the input object, it should implement {@link org.eclipse.rse.ui.dialogs.ISystemTypedObject}.
+ *
+ * This dialog does not do the actual renames. Rather, it will return the user-typed new name. This is
+ * queriable via {@link #getNewName()}, after testing that {@link #wasCancelled()} is false.
+ *
+ * @see org.eclipse.rse.ui.actions.SystemCommonRenameAction
+ */
+public class SystemRenameSingleDialog extends SystemPromptDialog
+ implements ISystemMessages, ISystemPropertyConstants,
+ Runnable
+{
+
+ public static final boolean COLLISION_MODE = true;
+
+ private Button overwriteRadio, renameRadio;
+ private boolean overwriteMode = true;
+
+ private Composite renameGroup;
+
+ private Text newName;
+ private String promptLabel, promptTip;
+ private String newNameString;
+ private String inputName = "";
+ private Label resourceTypePrompt, resourceTypeValue, verbageLabel, renameLabel;
+ private SystemMessage errorMessage;
+ private ISystemValidator nameValidator;
+ private ValidatorUniqueString uniqueNameValidator;
+ private boolean initialized = false;
+ private boolean copyCollisionMode = false;
+ private boolean isRemote = true;
+ private ISystemViewElementAdapter adapter = null;
+ private Object inputElement = null;
+ private String description = null;
+
+ /**
+ * Constructor
+ */
+ public SystemRenameSingleDialog(Shell shell)
+ {
+ this(shell, SystemResources.RESID_RENAME_TITLE);
+ String singleTitle = SystemResources.RESID_RENAME_SINGLE_TITLE;
+ if (!singleTitle.startsWith("Missing")) // TODO: remove test after next mri rev
+ setTitle(singleTitle);
+ }
+ /**
+ * Constructor with a title
+ */
+ public SystemRenameSingleDialog(Shell shell, String title)
+ {
+ super(shell, title);
+
+ //pack();
+ setBlockOnOpen(true);
+ setHelp(SystemPlugin.HELPPREFIX+"drns0000");
+ }
+
+ /**
+ * Constructor with an input object and validator
+ * This constructor is in copy/move dialogs when there is a collision
+ * @param shell The parent dialog
+ * @param copyCollisionMode true if this is being called because of a name collision on a copy or move operation
+ * @param inputObject The object that is being renamed, or on a copy/move the object in the target container which already exists. Used to get the old name and the name validator
+ * @param nameValidator The name validator to use. Can be null, in which case it is queried from the adapter of the input object
+ */
+ public SystemRenameSingleDialog(Shell shell, boolean copyCollisionMode, Object inputObject, ISystemValidator nameValidator)
+ {
+ this(shell);
+ setInputObject(inputObject);
+ setCopyCollisionMode(copyCollisionMode);
+ setNameValidator(nameValidator);
+
+ }
+
+ /**
+ * Set the label and tooltip of the prompt. The default is "New name:"
+ */
+ public void setPromptLabel(String label, String tooltip)
+ {
+ this.promptLabel = label;
+ this.promptTip = tooltip;
+ }
+
+ /**
+ * Indicate this dialog is the result of a copy/move name collision.
+ * Affects the title, verbage at the top of the dialog, and context help.
+ */
+ public void setCopyCollisionMode(boolean copyCollisionMode)
+ {
+ if (copyCollisionMode)
+ {
+ if (this.inputObject != null && this.inputObject instanceof IHost)
+ {
+ setHelp(SystemPlugin.HELPPREFIX+"dccc0000");
+ }
+ else
+ {
+ setHelp(SystemPlugin.HELPPREFIX+"drns0001");
+ }
+ setTitle(SystemResources.RESID_COLLISION_RENAME_TITLE);
+ }
+ else if (this.copyCollisionMode) // from true to false
+ {
+ setHelp(SystemPlugin.HELPPREFIX+"drns0000");
+ String singleTitle = SystemResources.RESID_RENAME_SINGLE_TITLE;
+ if (!singleTitle.startsWith("Missing")) // TODO: remove test after next mri rev
+ setTitle(singleTitle);
+ else
+ setTitle(SystemResources.RESID_RENAME_TITLE); // older string we know exists
+ }
+ this.copyCollisionMode = copyCollisionMode;
+ }
+ /**
+ * Query if this dialog is the result of a copy/move name collision.
+ * Affects the title, verbage at the top of the dialog, and context help.
+ */
+ public boolean getCopyCollisionMode()
+ {
+ return copyCollisionMode;
+ }
+
+
+ /**
+ * Set the validator for the new name,as supplied by the adaptor for name checking.
+ * Overrides the default which is to query it from the object's adapter.
+ */
+ public void setNameValidator(ISystemValidator nameValidator)
+ {
+ this.nameValidator = nameValidator;
+ }
+
+ /**
+ * Create message line. Intercept so we can set msg line of form.
+ */
+ protected ISystemMessageLine createMessageLine(Composite c)
+ {
+ ISystemMessageLine msgLine = super.createMessageLine(c);
+ //form.setMessageLine(msgLine);
+ return fMessageLine;
+ }
+
+
+ /**
+ * @see SystemPromptDialog#getInitialFocusControl()
+ */
+ protected Control getInitialFocusControl()
+ {
+ //uSystem.out.println("here! " + (newName == null));
+ return newName;
+ }
+
+ /**
+ * @see SystemPromptDialog#createInner(Composite)
+ */
+ protected Control createInner(Composite parent)
+ {
+ // Inner composite
+ int nbrColumns = 1;
+ Composite composite = SystemWidgetHelpers.createComposite(parent, nbrColumns);
+
+ Object inputObject = getInputObject();
+
+ if (copyCollisionMode)
+ {
+ // VERBAGE
+ verbageLabel = SystemWidgetHelpers.createLabel(composite, " ", nbrColumns);
+ Label filler = SystemWidgetHelpers.createLabel(composite, " ", nbrColumns);
+ }
+ else if (description != null)
+ {
+ // VERBAGE
+ verbageLabel = SystemWidgetHelpers.createLabel(composite, description, nbrColumns);
+ Label filler = SystemWidgetHelpers.createLabel(composite, " ", nbrColumns);
+ }
+
+ if (copyCollisionMode)
+ {
+ overwriteRadio = SystemWidgetHelpers.createRadioButton(composite, this, SystemResources.RESID_SIMPLE_RENAME_RADIO_OVERWRITE_LABEL, SystemResources.RESID_SIMPLE_RENAME_RADIO_OVERWRITE_TOOLTIP);
+ overwriteRadio.setSelection(true);
+
+ renameRadio = SystemWidgetHelpers.createRadioButton(composite, this, SystemResources.RESID_SIMPLE_RENAME_RADIO_RENAME_LABEL, SystemResources.RESID_SIMPLE_RENAME_RADIO_RENAME_TOOLTIP);
+ }
+
+ int nbrRenameColumns = 2;
+ // BEGIN RENAME
+ renameGroup = SystemWidgetHelpers.createComposite(composite, nbrRenameColumns);
+
+ // RESOURCE TYPE
+ resourceTypePrompt = SystemWidgetHelpers.createLabel(
+ renameGroup, SystemResources.RESID_SIMPLE_RENAME_RESOURCEPROMPT_LABEL);
+ resourceTypeValue = SystemWidgetHelpers.createLabel(renameGroup, "");
+ resourceTypeValue.setToolTipText(SystemResources.RESID_SIMPLE_RENAME_RESOURCEPROMPT_TOOLTIP);
+
+
+ // PROMPT
+ if (promptLabel == null)
+ {
+ String labelText = copyCollisionMode ? SystemResources.RESID_COLLISION_RENAME_LABEL : SystemResources.RESID_SIMPLE_RENAME_PROMPT_LABEL;
+ labelText = SystemWidgetHelpers.appendColon(labelText);
+ renameLabel = SystemWidgetHelpers.createLabel(renameGroup, labelText);
+ newName = SystemWidgetHelpers.createTextField(renameGroup, null);
+ }
+ else
+ {
+ renameLabel = SystemWidgetHelpers.createLabel(renameGroup, promptLabel);
+ newName = SystemWidgetHelpers.createTextField(renameGroup, null);
+ if (promptTip != null)
+ newName.setToolTipText(promptTip);
+ }
+
+ // END RENAME
+
+
+
+ if (inputObject != null)
+ {
+ initializeInput();
+ }
+
+ // init ok to disabled, until they type a new name
+ setPageComplete(false);
+
+ // add keystroke listeners...
+ newName.addModifyListener(
+ new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ validateNameInput();
+ }
+ }
+ );
+
+ if (copyCollisionMode)
+ {
+ enableRename(false);
+ }
+
+
+ return composite;
+ }
+
+
+ /**
+ * Override of parent. Must pass selected object onto the form for initializing fields.
+ * Called by SystemDialogAction's default run() method after dialog instantiated.
+ */
+ public void setInputObject(Object inputObject)
+ {
+ //System.out.println("INSIDE SETINPUTOBJECT: " + inputObject + ", "+inputObject.getClass().getName());
+ super.setInputObject(inputObject);
+ if (newName != null)
+ {
+ initializeInput();
+ }
+ }
+
+ private void initializeInput()
+ {
+ if (!initialized)
+ {
+ inputElement = getInputElement(inputObject);
+ adapter = getAdapter(inputElement);
+ if (adapter != null)
+ inputName = adapter.getName(inputElement);
+ else if (inputElement instanceof ISystemTypedObject)
+ inputName = ((ISystemTypedObject)inputElement).getName();
+ else if (inputElement instanceof IResource)
+ inputName = ((IResource)inputElement).getName();
+ else if (inputElement instanceof String)
+ inputName = (String)inputElement;
+ newName.setText(inputName);
+ newName.selectAll();
+ if (copyCollisionMode)
+ {
+ verbageLabel.setText(SystemMessage.sub(SystemResources.RESID_COLLISION_RENAME_VERBAGE, "&1", inputName));
+ }
+
+
+
+ if ((nameValidator == null) && (adapter != null))
+ nameValidator = adapter.getNameValidator(inputElement);
+ if ((nameValidator != null) && (nameValidator instanceof ISystemValidator))
+ {
+ int maxLen = ((ISystemValidator)nameValidator).getMaximumNameLength();
+ if (maxLen != -1)
+ newName.setTextLimit(maxLen);
+ }
+ // test if we need a unique name validator
+ Shell shell = getShell();
+ Display display = shell.getDisplay();
+ if (display != null)
+ display.asyncExec(this);
+ else
+ run();
+
+ // the rename action for system filter pool reference selections is really
+ // a rename of the actual pool, versus the reference...
+ if (inputElement instanceof ISystemFilterPoolReference)
+ {
+ inputElement = ((ISystemFilterPoolReference)inputElement).getReferencedFilterPool();
+ adapter = getAdapter(inputElement);
+ }
+
+ if (adapter != null)
+ resourceTypeValue.setText(adapter.getType(inputElement));
+ else if (inputElement instanceof ISystemTypedObject)
+ resourceTypeValue.setText(((ISystemTypedObject)inputElement).getType());
+ else if (inputElement instanceof IResource)
+ {
+ if ((inputElement instanceof IFolder) || (inputElement instanceof IProject))
+ resourceTypeValue.setText(SystemViewResources.RESID_PROPERTY_FILE_TYPE_FOLDER_VALUE);
+ else
+ resourceTypeValue.setText(SystemViewResources.RESID_PROPERTY_FILE_TYPE_FILE_VALUE);
+ }
+ initialized = true;
+ }
+ }
+
+ /**
+ * Runnable method
+ */
+ public void run()
+ {
+ uniqueNameValidator = getUniqueNameValidator(inputElement, nameValidator);
+ }
+
+ /**
+ * Given an input element and externally-suppplied name validator for it, determine if we
+ * need to augment that validator with one that will check for uniqueness, and if so
+ * create and return that uniqueness validator
+ */
+ protected ValidatorUniqueString getUniqueNameValidator(Object inputElement, ISystemValidator nameValidator)
+ {
+ ValidatorUniqueString uniqueNameValidator = null;
+ ISystemRemoteElementAdapter ra = getRemoteAdapter(inputElement);
+ if (ra != null)
+ {
+ isRemote = true;
+ String[] names = null;
+ boolean debug = false;
+ boolean caseSensitive = ra.getSubSystem(inputElement).getSubSystemConfiguration().isCaseSensitive();
+ boolean needUniqueNameValidator = !(nameValidator instanceof ISystemValidatorUniqueString);
+ if (!needUniqueNameValidator)
+ {
+ String[] existingNames = ((ISystemValidatorUniqueString)nameValidator).getExistingNamesList();
+ needUniqueNameValidator = ((existingNames == null) || (existingNames.length==0));
+ }
+ if (needUniqueNameValidator)
+ {
+ // Set the busy cursor to all shells.
+ super.setBusyCursor(true);
+ try {
+ Shell shell = getShell();
+ IRunnableContext irc = SystemPlugin.getTheSystemRegistry().getRunnableContext();
+ SystemPlugin.getTheSystemRegistry().clearRunnableContext();
+ names = ra.getRemoteParentNamesInUse(shell, inputElement);
+ SystemPlugin.getTheSystemRegistry().setRunnableContext(shell, irc);
+ } catch (Exception exc) {SystemBasePlugin.logError("Exception getting parent's child names in rename dialog",exc);}
+ if ((names != null) && (names.length>0))
+ {
+ uniqueNameValidator = new ValidatorUniqueString(names,caseSensitive);
+ uniqueNameValidator.setErrorMessages(SystemPlugin.getPluginMessage(MSG_VALIDATE_NAME_EMPTY),
+ SystemPlugin.getPluginMessage(MSG_VALIDATE_NAME_NOTUNIQUE));
+ if (debug)
+ {
+ System.out.println("Name validator set. Names = ");
+ for (int idx=0; idx
+ * Defers to the object's adapter
+ */
+ public String getCanonicalNewName()
+ {
+ // this is all for defect 42145
+ Object element = super.getElement();
+ ISystemViewElementAdapter adapter = super.getAdapter();
+ String cName = newName;
+ if (adapter != null)
+ cName = adapter.getCanonicalNewName(element, newName);
+ else
+ cName = newName;
+ //System.out.println("Inside getCanonicalNewName: newName: " + newName + ", canonical: " + cName);
+ return cName;
+ }
+ /**
+ * Compares the given new name to this row's current name, taking into consideration case if appropriate.
+ * Defers to the object's adapter
+ */
+ public boolean newNameEqualsOldName()
+ {
+ Object element = super.getElement();
+ ISystemViewElementAdapter adapter = super.getAdapter();
+ if (adapter != null)
+ return adapter.namesAreEqual(element, newName);
+ else
+ return getName().equals(newName);
+ }
+
+ /**
+ * Return the name length limit, if available via the name validator supplied by the adapter.
+ * Returns -1 if not available.
+ */
+ public int getNameLengthLimit()
+ {
+ return nameLengthLimit;
+ }
+
+ /**
+ * Set the validator for the new name,as supplied by the adaptor for name checking.
+ * Overrides the default which is to query it from the object's adapter.
+ */
+ public void setNameValidator(ISystemValidator nameValidator)
+ {
+ inputValidator = nameValidator;
+ }
+
+ /**
+ * Set the uniqueness validator for the new name,as supplied by the remote adaptor.
+ */
+ public void setUniqueNameValidator(ValidatorUniqueString uniqueNameValidator)
+ {
+ inputUniqueNameValidator = uniqueNameValidator;
+ }
+
+ /**
+ * Return the validator for the new name,as supplied by the adaptor for
+ * this element type.
+ *
+ * By default queries it from the object's adapter, unless setNameValidator has been
+ * called.
+ */
+ public ISystemValidator getNameValidator()
+ {
+ return inputValidator;
+ }
+
+ /**
+ * Return the uniqueness validator for the new name,as supplied by the call to setUniqueNameValidator
+ */
+ public ValidatorUniqueString getUniqueNameValidator()
+ {
+ return inputUniqueNameValidator;
+ }
+
+ /**
+ * Return true if this row is currently in error
+ */
+ public boolean getError()
+ {
+ return errorMsg != null;
+ }
+ /**
+ * Return text of error if this row is currently in error
+ */
+ public SystemMessage getErrorMessage()
+ {
+ return errorMsg;
+ }
+ /**
+ * Set error message for this row.
+ * Pass null to clear it.
+ */
+ public void setErrorMessage(SystemMessage errorMsg)
+ {
+ this.errorMsg = errorMsg;
+ }
+
+ public String toString()
+ {
+ return getNewName();
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemResolveFilterStringDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemResolveFilterStringDialog.java
new file mode 100644
index 00000000000..299d9d411e4
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemResolveFilterStringDialog.java
@@ -0,0 +1,111 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.dialogs;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.SystemWidgetHelpers;
+import org.eclipse.rse.ui.view.SystemResolveFilterStringAPIProviderImpl;
+import org.eclipse.rse.ui.view.SystemViewForm;
+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.Shell;
+
+
+
+/**
+ * Dialog for testing a filter string. Typically called from a create/update filter string dialog.
+ *
+ * Caller must supply the subsystem which owns this existing or potential filter string.
+ *
+ * This dialog contains a dropdown for selecting connections to use in the test. Only connections which
+ * contain subsystems with the same parent factory as the given subsystem factory are shown.
+ *
+ */
+public class SystemResolveFilterStringDialog extends SystemTestFilterStringDialog
+{
+
+ /**
+ * Constructor
+ * @param shell The shell to hang the dialog off of
+ * @param subsystem The contextual subsystem that owns this filter string
+ * @param filterString The filter string that is to be tested.
+ */
+ public SystemResolveFilterStringDialog(Shell shell, ISubSystem subsystem, String filterString)
+ {
+ super(shell, subsystem, filterString);
+ setShowOkButton(true);
+ }
+
+ /**
+ * Constructor when unique title desired
+ * @param shell The shell to hang the dialog off of
+ * @param title The title to give the dialog
+ * @param subsystem The contextual subsystem that owns this filter string
+ * @param filterString The filter string that is to be tested.
+ */
+ public SystemResolveFilterStringDialog(Shell shell, String title, ISubSystem subsystem, String filterString)
+ {
+ super(shell, title, subsystem, filterString);
+ setShowOkButton(true);
+ }
+
+
+ /**
+ * @see SystemPromptDialog#createInner(Composite)
+ */
+ protected Control createInner(Composite parent)
+ {
+ // Inner composite
+ int gridColumns = 2;
+ Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, gridColumns);
+
+ // connection selection combo
+ connectionCombo = SystemWidgetHelpers.createConnectionCombo(composite_prompts, null, null, subsystem.getSubSystemConfiguration(),
+ null, null, subsystem.getHost(), gridColumns, false);
+
+ // Composite promptComposite = composite_prompts;
+ Composite promptComposite = connectionCombo;
+ prompt = SystemWidgetHelpers.createLabel(promptComposite, SystemResources.RESID_TESTFILTERSTRING_PROMPT_LABEL, SystemResources.RESID_TESTFILTERSTRING_PROMPT_TOOLTIP);
+ promptValue = SystemWidgetHelpers.createLabel(promptComposite, SystemResources.RESID_TESTFILTERSTRING_PROMPT_LABEL, SystemResources.RESID_TESTFILTERSTRING_PROMPT_TOOLTIP);
+
+ promptValue.setToolTipText(filterString); // Since the dialog is not resizable, this is the way to show the whole string
+
+ String label = filterString;
+
+ if ( label.length() > 30)
+ label = label.substring(0,30) + " ..."; // Use ... to show that not entire string is displayed
+ promptValue.setText(label);
+
+ GridData data = new GridData();
+ data.widthHint = 200;
+ promptValue.setLayoutData(data);
+
+ // Tree viewer
+ inputProvider = new SystemResolveFilterStringAPIProviderImpl(subsystem, filterString);
+ tree = new SystemViewForm(getShell(), composite_prompts, SWT.NULL, inputProvider, true, getMessageLine(), gridColumns, 1);
+
+ // add selection listeners
+ //tree.addSelectionChangedListener(this);
+ connectionCombo.addSelectionListener(this);
+
+ return composite_prompts;
+ } // end createInner()
+
+
+} // end class SystemResolveFilterStringDialog
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSelectAnythingDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSelectAnythingDialog.java
new file mode 100644
index 00000000000..06807be2c8c
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSelectAnythingDialog.java
@@ -0,0 +1,91 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.dialogs;
+
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.ui.view.ISystemPropertyConstants;
+import org.eclipse.rse.ui.view.ISystemViewInputProvider;
+import org.eclipse.rse.ui.view.SystemViewForm;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+
+
+public class SystemSelectAnythingDialog extends SystemPromptDialog
+ implements ISystemPropertyConstants, ISelectionChangedListener
+{
+ private SystemViewForm _view = null;
+ private Object _selected = null;
+ public SystemSelectAnythingDialog(Shell shell, String title)
+ {
+ super(shell, title);
+ }
+
+ public Control createInner(Composite parent)
+ {
+
+ _view = new SystemViewForm(getShell(), parent, SWT.NONE, getInputProvider(), true, this);
+ _view.getSystemView().addSelectionChangedListener(this);
+ //_view.getSystemView().ref
+
+ return _view.getTreeControl();
+ }
+
+ public boolean close()
+ {
+ _view.removeSelectionChangedListener(this);
+ _view.dispose();
+ return super.close();
+ }
+
+ /**
+ * Returns the initial input provider for the viewer.
+ * Tries to deduce the appropriate input provider based on current input.
+ */
+ protected ISystemViewInputProvider getInputProvider()
+ {
+ ISystemViewInputProvider inputProvider = SystemPlugin.getTheSystemRegistry();
+
+ return inputProvider;
+ }
+
+ public Control getInitialFocusControl()
+ {
+ return _view.getTreeControl();
+ }
+
+ public Object getSelectedObject()
+ {
+ //IStructuredSelection selection = (IStructuredSelection)_view.getSelection();
+ //return selection.getFirstElement();
+ return _selected;
+ }
+
+ public void selectionChanged(SelectionChangedEvent e)
+ {
+ IStructuredSelection selection = (IStructuredSelection)e.getSelection();
+
+ _selected = selection.getFirstElement();
+
+
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSelectConnectionDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSelectConnectionDialog.java
new file mode 100644
index 00000000000..ab9dce9e0cd
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSelectConnectionDialog.java
@@ -0,0 +1,365 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.dialogs;
+
+
+import org.eclipse.rse.model.IHost;
+import org.eclipse.rse.ui.ISystemPageCompleteListener;
+import org.eclipse.rse.ui.SystemBaseForm;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.messages.ISystemMessageLine;
+import org.eclipse.rse.ui.validators.IValidatorRemoteSelection;
+import org.eclipse.rse.ui.widgets.SystemSelectConnectionForm;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * Dialog for allowing users to select an existing connection, or optionally create a new one.
+ * There are a number of methods to configure the dialog so only connections of a particular system type,
+ * or containing subsystems from a particular subsystem factory or class of subsystem factories, are shown.
+ *
+ * Call these methods to configure the functionality of the dialog
+ *
+ * Call these methods to configure the text on the dialog
+ *
+ * After running, call these methods to get the output:
+ *
+ * This overload always shows the property sheet
+ *
+ * Default is false
+ */
+ public void setShowPropertySheet(boolean show)
+ {
+ form.setShowPropertySheet(show);
+ }
+ /**
+ * Show the property sheet on the right hand side, to show the properties of the
+ * selected object.
+ *
+ * This overload shows a Details>>> button so the user can decide if they want to see the
+ * property sheet.
+ *
+ * Default is true, false
+ *
+ * @param show True if show the property sheet within the dialog
+ * @param initialState True if the property is to be initially displayed, false if it is not
+ * to be displayed until the user presses the Details button.
+ */
+ public void setShowPropertySheet(boolean show, boolean initialState)
+ {
+ if (show)
+ {
+ form.setShowPropertySheet(initialState);
+ setShowDetailsButton(true, !initialState);
+ }
+ }
+
+ /**
+ * Set multiple selection mode. Default is single selection mode
+ *
+ * If you turn on multiple selection mode, you must use the getSelectedObjects()
+ * method to retrieve the list of selected objects.
+ *
+ * Further, if you turn this on, it has the side effect of allowing the user
+ * to select any remote object. The assumption being if you are prompting for
+ * files, you also want to allow the user to select a folder, with the meaning
+ * being that all files within the folder are implicitly selected.
+ *
+ * @see #getSelectedObjects()
+ */
+ public void setMultipleSelectionMode(boolean multiple)
+ {
+ form.setMultipleSelectionMode(multiple);
+ }
+
+ // ------------------
+ // OUTPUT METHODS...
+ // ------------------
+
+ /**
+ * Return selected file or folder
+ */
+ public Object getSelectedObject()
+ {
+ if (getOutputObject() instanceof Object[])
+ return ((Object[])getOutputObject())[0];
+ else
+ return getOutputObject();
+ }
+ /**
+ * Return all selected objects. This method will return an array of one
+ * unless you have called setMultipleSelectionMode(true)!
+ * @see #setMultipleSelectionMode(boolean)
+ */
+ public Object[] getSelectedObjects()
+ {
+ if (getOutputObject() instanceof Object[])
+ return (Object[])getOutputObject();
+ else if (getOutputObject() instanceof Object)
+ return new Object[] {getOutputObject()};
+ else
+ return null;
+ }
+
+ /**
+ * Return selected connection
+ */
+ public IHost getSelectedConnection()
+ {
+ return form.getSelectedConnection();
+ }
+ /**
+ * Return selected connections in multiple selection mode
+ */
+ public IHost[] getSelectedConnections()
+ {
+ return form.getSelectedConnections();
+ }
+
+ /**
+ * Return the multiple selection mode as set by setMultipleSelectionMode(boolean)
+ */
+ public boolean getMultipleSelectionMode()
+ {
+ return form.getMultipleSelectionMode();
+ }
+
+ // ------------------
+ // PRIVATE METHODS...
+ // ------------------
+ /**
+ * Private method.
+ * @see SystemPromptDialog#getInitialFocusControl()
+ */
+ protected Control getInitialFocusControl()
+ {
+ return form.getInitialFocusControl();
+ }
+
+ /**
+ * Private method.
+ * @see SystemPromptDialog#createInner(Composite)
+ */
+ protected Control createInner(Composite parent)
+ {
+ return form.createContents(parent);
+ }
+
+ /**
+ * Private method.
+ * Get the contents.
+ */
+ protected SystemSelectConnectionForm getForm(Shell shell)
+ {
+ //System.out.println("INSIDE GETFORM");
+ //if (form == null)
+ //{
+ form = new SystemSelectConnectionForm(shell,getMessageLine());
+ form.addPageCompleteListener(this);
+ // reset output variables just to be safe
+ setOutputObject(null);
+ //}
+ return form;
+ }
+
+ /**
+ * Create message line. Intercept so we can set msg line of form.
+ */
+ protected ISystemMessageLine createMessageLine(Composite c)
+ {
+ ISystemMessageLine msgLine = super.createMessageLine(c);
+ if (form != null)
+ form.setMessageLine(msgLine);
+ return msgLine;
+ }
+
+
+ /**
+ * Private method.
+ *
+ * Called when user presses OK button.
+ * Return true to close dialog.
+ * Return false to not close dialog.
+ */
+ protected boolean processOK()
+ {
+ boolean closeDialog = form.verify();
+ if (closeDialog)
+ {
+ if (getMultipleSelectionMode())
+ setOutputObject(form.getSelectedConnections());
+ else
+ setOutputObject(form.getSelectedConnection());
+ }
+ else
+ setOutputObject(null);
+ return closeDialog;
+ }
+
+ /**
+ * Private method.
+ *
+ * Called when user presses DETAILS button.
+ *
+ * Note the text is automatically toggled for us! We need only
+ * do whatever the functionality is that we desire
+ *
+ * @param hideMode the current state of the details toggle, prior to this request. If we return true from
+ * this method, this state and the button text will be toggled.
+ *
+ * @return true if the details state toggle was successful, false if it failed.
+ */
+ protected boolean processDetails(boolean hideMode)
+ {
+ form.toggleShowPropertySheet(getShell(), getContents());
+ return true;
+ }
+
+
+ /**
+ * We have to override close to ensure that we reset the form to null
+ */
+ public boolean close()
+ {
+ if (super.close())
+ {
+ if (form != null)
+ {
+ form.dispose();
+ }
+ form = null;
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * The callback method.
+ * This is called whenever setPageComplete is called by the form code.
+ * @see {@link SystemBaseForm#addPageCompleteListener(ISystemPageCompleteListener)}
+ */
+ public void setPageComplete(boolean complete)
+ {
+ super.setPageComplete(complete);
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSelectFileTypesDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSelectFileTypesDialog.java
new file mode 100644
index 00000000000..ef49ae04099
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSelectFileTypesDialog.java
@@ -0,0 +1,468 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.dialogs;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.StringTokenizer;
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.rse.ui.GenericMessages;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.messages.ISystemMessageLine;
+import org.eclipse.swt.SWT;
+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.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IFileEditorMapping;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.FileEditorMappingContentProvider;
+import org.eclipse.ui.dialogs.FileEditorMappingLabelProvider;
+
+
+/**
+ * A public implementation of the eclipse Select Types dialog.
+ *
+ * File types are extension names without the dot.
+ * For example "java" and "class".
+ *
+ * Call getResult() to get the array of selected types.
+ */
+public class SystemSelectFileTypesDialog
+ extends SystemPromptDialog
+ //extends TypeFilteringDialog
+ implements ISystemMessageLine
+{
+
+ protected Collection initialSelections;
+
+ // instruction to show user
+ protected String instruction;
+
+ // the final collection of selected elements, or null if this dialog was canceled
+ protected Object[] result;
+
+ // the visual selection widget group
+ protected CheckboxTableViewer listViewer;
+
+ // sizing constants
+ protected final static int SIZING_SELECTION_WIDGET_HEIGHT = 250;
+ protected final static int SIZING_SELECTION_WIDGET_WIDTH = 300;
+
+ // TODO: Cannot use WorkbenchMessages -- it's internal
+ protected final static String TYPE_DELIMITER = GenericMessages.TypesFiltering_typeDelimiter;
+ protected Text userDefinedText;
+
+ protected IFileEditorMapping[] currentInput;
+
+ /**
+ * Constructor when there are no existing types
+ * @param shell The window hosting this dialog
+ */
+ public SystemSelectFileTypesDialog(Shell shell)
+ {
+ this(shell, new ArrayList());
+ }
+
+ /**
+ * Constructor when there are existing types.
+ * @param shell The window hosting this dialog
+ * @param currentTypes The current types as a java.util.Collection. Typically ArrayList is used
+ */
+ public SystemSelectFileTypesDialog(Shell shell, Collection currentTypes)
+ {
+ // TODO: Cannot use WorkbenchMessages -- it's internal
+ super(shell, GenericMessages.TypesFiltering_title);
+ this.initialSelections = currentTypes;
+ // TODO: Cannot use WorkbenchMessages -- it's internal
+ setInstruction(GenericMessages.TypesFiltering_message);
+
+ // TODO - hack to make this work in 3.1
+ String id = PlatformUI.PLUGIN_ID + ".type_filtering_dialog_context";
+ setHelp(id);
+ }
+
+ /**
+ * Constructor when there are existing types.
+ * @param shell The window hosting this dialog
+ * @param currentTypes The current types as an array of Strings
+ */
+ public SystemSelectFileTypesDialog(Shell shell, String[] currentTypes)
+ {
+ this(shell, Arrays.asList(currentTypes));
+ }
+
+ /**
+ * Method declared on Dialog.
+ */
+ protected Control createInner(Composite parent)
+ {
+ // page group
+ Composite composite = (Composite)createInnerComposite(parent);
+ createInstructionArea(composite);
+
+ listViewer = CheckboxTableViewer.newCheckList(composite, SWT.BORDER);
+ GridData data = new GridData(GridData.FILL_BOTH);
+ data.heightHint = SIZING_SELECTION_WIDGET_HEIGHT;
+ data.widthHint = SIZING_SELECTION_WIDGET_WIDTH;
+ listViewer.getTable().setLayoutData(data);
+
+ listViewer.setLabelProvider(FileEditorMappingLabelProvider.INSTANCE);
+ listViewer.setContentProvider(FileEditorMappingContentProvider.INSTANCE);
+
+ addSelectionButtons(composite);
+ createUserEntryGroup(composite);
+ initializeViewer();
+
+ // initialize page
+ if (this.initialSelections != null && !this.initialSelections.isEmpty())
+ checkInitialSelections();
+
+ return composite;
+ }
+ /**
+ * Return the Control to be given initial focus.
+ * Child classes must override this, but can return null.
+ */
+ protected Control getInitialFocusControl()
+ {
+ return listViewer.getControl();
+ }
+
+ private Control createInnerComposite(Composite parent)
+ {
+ // create a composite with standard margins and spacing
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
+ layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
+ layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
+ layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ composite.setFont(parent.getFont());
+ return composite;
+ }
+
+ /**
+ * Sets the instruction text for this dialog.
+ *
+ * @param instr the instruction text
+ */
+ public void setInstruction(String instr)
+ {
+ this.instruction = instr;
+ }
+ /**
+ * Creates the message area for this dialog.
+ *
+ * This method is provided to allow subclasses to decide where the message
+ * will appear on the screen.
+ *
+ * Works in concert with {@link org.eclipse.rse.ui.dialogs.SystemSimpleContentProvider}
+ * @see org.eclipse.rse.ui.dialogs.SystemSimpleContentElement
+ * @see org.eclipse.rse.ui.dialogs.SystemSimpleSelectDialog
+ */
+public class SystemSimpleContentElement
+{
+ private String name;
+ private Object data;
+ private SystemSimpleContentElement parent;
+ private SystemSimpleContentElement[] children;
+ private ImageDescriptor imageDescriptor;
+ private boolean selected = false;
+ private boolean isDeletable = true;
+ private boolean isRenamable = true;
+ private boolean isReadonly = false;
+
+ /**
+ * Constructor when given children as an array.
+ * @param name - the display name to show for this element
+ * @param data - the real object which is to be contained by this element
+ * @param parent - the parent element of this element. Pass null for the root.
+ * @param children - an array of SystemSimpleContentElement objects that are to be the children of this element. Can be null.
+ */
+ public SystemSimpleContentElement(String name, Object data,
+ SystemSimpleContentElement parent, SystemSimpleContentElement[] children)
+ {
+ setName(name);
+ setData(data);
+ setParent(parent);
+ setChildren(children);
+ }
+ /**
+ * Constructor when given children as a vector.
+ * @param name - the display name to show for this element
+ * @param data - the real object which is to be contained by this element
+ * @param parent - the parent element of this element. Pass null for the root.
+ * @param children - a vector of SystemSimpleContentElement objects that are to be the children of this element. Can be null.
+ */
+ public SystemSimpleContentElement(String name, Object data,
+ SystemSimpleContentElement parent, Vector children)
+ {
+ setName(name);
+ setData(data);
+ setParent(parent);
+ setChildren(children);
+ }
+
+ /**
+ * Return the display name for this element
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Set the display name for this element
+ */
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * Return the real object which this element wraps or represents
+ */
+ public Object getData()
+ {
+ return data;
+ }
+
+ /**
+ * Set the real object which this element wraps or represents
+ */
+ public void setData(Object data)
+ {
+ this.data = data;
+ }
+
+ /**
+ * Get the parent element
+ */
+ public SystemSimpleContentElement getParent()
+ {
+ return parent;
+ }
+
+ /**
+ * Set the parent element
+ */
+ public void setParent(SystemSimpleContentElement parent)
+ {
+ this.parent = parent;
+ }
+
+ /**
+ * Walk up the parent tree until we find the root
+ */
+ public SystemSimpleContentElement getRoot()
+ {
+ SystemSimpleContentElement currParent = parent;
+ while (currParent.getParent() != null)
+ currParent = currParent.getParent();
+ return currParent;
+ }
+
+ /**
+ * Return the child elements, or null if no children
+ */
+ public SystemSimpleContentElement[] getChildren()
+ {
+ return children;
+ }
+
+ /**
+ * Return true if this element has children
+ */
+ public boolean hasChildren()
+ {
+ return ((children!=null) && (children.length>0));
+ }
+
+ /**
+ * Set the child elements of this element, as an array of SystemSimpleContentElement elements
+ */
+ public void setChildren(SystemSimpleContentElement[] children)
+ {
+ this.children = children;
+ }
+
+ /**
+ * Set the child elements of this element, as a vector of SystemSimpleContentElement elements
+ */
+ public void setChildren(Vector childrenVector)
+ {
+ if (childrenVector != null)
+ {
+ children = new SystemSimpleContentElement[childrenVector.size()];
+ for (int idx=0; idx
+ * The {@link #setInputObject} method is used to populate the selection tree:
+ *
+ * The trick to using this is to first populate a hierarchy of SystemSimpleContentElement elements,
+ * each one wrapping one of your own model objects, and then passing to this constructor the root
+ * element.
+ *
+ * Upon successful completion of this dialog (wasCancelled() returns false), the model is
+ * updated to reflect the selections. Call getUpdatedContent() to return the root node, if need be,
+ * and then walk the nodes. The selected items are those that return true
+ * to {@link org.eclipse.rse.ui.dialogs.SystemSimpleContentElement#isSelected()}.
+ *
+ * @see org.eclipse.rse.ui.dialogs.SystemSimpleContentElement
+ * @see org.eclipse.rse.ui.dialogs.SystemSimpleContentProvider
+ */
+public class SystemSimpleSelectDialog extends SystemPromptDialog
+ implements ISystemPropertyConstants,
+ ICheckStateListener
+{
+ private String promptString;
+ private Label prompt;
+ private CheckboxTreeViewer tree;
+ private SystemSimpleContentProvider provider = new SystemSimpleContentProvider();
+ private SystemSimpleContentElement preSelectedRoot = null;
+ private boolean initialized = false;
+
+ /**
+ * Constructor
+ */
+ public SystemSimpleSelectDialog(Shell shell, String title, String prompt)
+ {
+ super(shell, title);
+ promptString = prompt;
+ //pack();
+ }
+
+ /**
+ * Set the root to preselect
+ */
+ public void setRootToPreselect(SystemSimpleContentElement preSelectedRoot)
+ {
+ this.preSelectedRoot = preSelectedRoot;
+ }
+
+ /**
+ * Create message line. Intercept so we can set msg line of form.
+ */
+ protected ISystemMessageLine createMessageLine(Composite c)
+ {
+ ISystemMessageLine msgLine = super.createMessageLine(c);
+ //form.setMessageLine(msgLine);
+ return fMessageLine;
+ }
+
+ /**
+ * @see SystemPromptDialog#getInitialFocusControl()
+ */
+ protected Control getInitialFocusControl()
+ {
+ //checkNewTreeElements(provider.getElements(getInputObject()));
+ //select the first element in the list
+ //Object[] elements = (provider.getElements(getInputObject());
+ //Object primary= elements.length > 0 ? elements[0] : null;
+ //if (primary != null)
+ // tree.setSelection(new StructuredSelection(primary));
+
+ return tree.getControl();
+ }
+
+ /**
+ * @see SystemPromptDialog#createInner(Composite)
+ */
+ protected Control createInner(Composite parent)
+ {
+ // Inner composite
+ int nbrColumns = 1;
+ Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns);
+
+ // PROMPT
+ prompt = SystemWidgetHelpers.createLabel(composite_prompts, promptString);
+
+ // CHECKBOX SELECT TREE
+ tree = new CheckboxTreeViewer(new Tree(composite_prompts, SWT.CHECK | SWT.BORDER));
+ GridData treeData = new GridData();
+ treeData.horizontalAlignment = GridData.FILL;
+ treeData.grabExcessHorizontalSpace = true;
+ treeData.widthHint = 300;
+ treeData.heightHint= 300;
+ treeData.verticalAlignment = GridData.FILL;
+ treeData.grabExcessVerticalSpace = true;
+ tree.getTree().setLayoutData(treeData);
+
+ tree.setContentProvider(provider);
+ tree.setLabelProvider(provider);
+
+ // populate tree
+ Object inputObject = getInputObject();
+ if (inputObject != null)
+ initializeInput((SystemSimpleContentElement)inputObject);
+
+ // expand and pre-check
+ tree.expandAll();
+ tree.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS);
+
+ if (preSelectedRoot != null)
+ tree.reveal(preSelectedRoot);
+
+ // add selection listener to tree
+ tree.addCheckStateListener(this);
+
+ return composite_prompts;
+ }
+
+ /**
+ * ICheckStateChangedListener method. Called when user changes selection in tree
+ */
+ public void checkStateChanged(CheckStateChangedEvent event)
+ {
+ SystemSimpleContentElement element = (SystemSimpleContentElement)event.getElement();
+
+ if (element.isReadOnly())
+ {
+ tree.setChecked(element, element.isSelected());
+ return;
+ }
+
+ boolean checked = event.getChecked();
+ element.setSelected(checked);
+
+ SystemSimpleContentElement parent = element.getParent();
+ if (parent != null)
+ {
+ boolean gray = getShouldBeGrayed(parent);
+ boolean check= getShouldBeChecked(parent);
+ tree.setChecked(parent, check);
+ tree.setGrayed(parent, gray);
+ //System.out.println("...setting parent grayed, checked to " + gray + ", " + check);
+ }
+
+
+ // On check, check all children
+ if (checked)
+ {
+ tree.setSubtreeChecked(element, true);
+ checkSubtreeModel(element, true);
+ //System.out.println("...setting setSubtreeChecked true for " + element);
+ return;
+ }
+ // On uncheck & gray, remain check but ungray
+ // and check all its children
+ if (tree.getGrayed(element))
+ {
+ tree.setChecked(element, true);
+ tree.setGrayed(element, false);
+ tree.setSubtreeChecked(element, true);
+ checkSubtreeModel(element, true);
+ //System.out.println("...setting setChecked(true), setGrayed(false) for " + element);
+ //System.out.println("...setting setSubtreeChecked true for " + element);
+ return;
+ }
+ // On uncheck & not gray, uncheck all its children
+ tree.setSubtreeChecked(element, false);
+ checkSubtreeModel(element, false);
+ //System.out.println("...setting setSubtreeChecked false for " + element);
+ }
+
+ private void checkSubtreeModel(SystemSimpleContentElement parent, boolean check)
+ {
+ parent.setSelected(check);
+ SystemSimpleContentElement[] childElements = parent.getChildren();
+ if (childElements != null)
+ {
+ for (int idx=0; idx
+ * This dialog contains a dropdown for selecting connections to use in the test. Only connections which
+ * contain subsystems with the same parent factory as the given subsystem factory are shown.
+ *
+ */
+public class SystemTestFilterStringDialog
+ extends SystemPromptDialog
+ implements ISelectionChangedListener, SelectionListener
+{
+ protected ISubSystem subsystem = null;
+ protected ISystemRegistry sr = null;
+ protected String subsystemFactoryId = null;
+ protected String filterString = null;
+ protected SystemTestFilterStringAPIProviderImpl inputProvider = null;
+ // GUI widgets
+ protected Label prompt, promptValue;
+ protected SystemViewForm tree;
+ protected SystemHostCombo connectionCombo;
+
+ /**
+ * Constructor
+ * @param shell The shell to hang the dialog off of
+ * @param subsystem The contextual subsystem that owns this filter string
+ * @param filterString The filter string that is to be tested.
+ */
+ public SystemTestFilterStringDialog(Shell shell, ISubSystem subsystem, String filterString)
+ {
+ this(shell, SystemResources.RESID_TESTFILTERSTRING_TITLE, subsystem, filterString);
+ }
+ /**
+ * Constructor when unique title desired
+ * @param shell The shell to hang the dialog off of
+ * @param title The title to give the dialog
+ * @param subsystem The contextual subsystem that owns this filter string
+ * @param filterString The filter string that is to be tested.
+ */
+ public SystemTestFilterStringDialog(Shell shell, String title, ISubSystem subsystem, String filterString)
+ {
+ super(shell, title);
+ setCancelButtonLabel(SystemResources.BUTTON_CLOSE);
+ setShowOkButton(false);
+ setBlockOnOpen(true); // always modal
+ this.subsystem = subsystem;
+ this.filterString = filterString;
+ this.subsystemFactoryId = subsystem.getSubSystemConfiguration().getId();
+ sr = SystemPlugin.getTheSystemRegistry();
+ setNeedsProgressMonitor(true);
+ //pack();
+ }
+
+ // ------------------
+ // PUBLIC METHODS...
+ // ------------------
+ // ------------------
+ // PRIVATE METHODS...
+ // ------------------
+ /**
+ * Private method.
+ * @see SystemPromptDialog#getInitialFocusControl()
+ */
+ protected Control getInitialFocusControl()
+ {
+ //return tree.getTreeControl();
+ return connectionCombo.getCombo();
+ }
+
+ /**
+ * Private method.
+ * @see SystemPromptDialog#createInner(Composite)
+ */
+ protected Control createInner(Composite parent)
+ {
+ // Inner composite
+ int gridColumns = 2;
+ Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, gridColumns);
+
+ // connection selection combo
+ connectionCombo = SystemWidgetHelpers.createConnectionCombo(composite_prompts, null, null, subsystem.getSubSystemConfiguration(),
+ null, null, subsystem.getHost(), gridColumns, false);
+
+ // filter string prompt
+ // Composite promptComposite = composite_prompts;
+ Composite promptComposite = connectionCombo;
+ prompt = SystemWidgetHelpers.createLabel(promptComposite, SystemResources.RESID_TESTFILTERSTRING_PROMPT_LABEL, SystemResources.RESID_TESTFILTERSTRING_PROMPT_TOOLTIP);
+ promptValue = SystemWidgetHelpers.createLabel(promptComposite, SystemResources.RESID_TESTFILTERSTRING_PROMPT_LABEL, SystemResources.RESID_TESTFILTERSTRING_PROMPT_TOOLTIP);
+
+ promptValue.setToolTipText(filterString); // Since the dialog is not resizable, this is the way to show the whole string
+
+ // Make sure the label width is not longer than the window width
+ // Otherwise the combo box dropdown arrow above it will be pushed beyond the window and invisible
+ //promptValue.setText(filterString);
+
+ String label = filterString;
+
+ if ( label.length() > 30)
+ label = label.substring(0,30) + " ..."; // Use ... to show that not entire string is displayed
+ promptValue.setText( label);
+
+ //Point point = promptValue.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ //GridData data = new GridData();
+ //data.widthHint = point.x < 230 ? point.x : 230;
+ GridData data = new GridData();
+ data.widthHint = 200;
+ promptValue.setLayoutData(data);
+
+ // TREE
+ inputProvider = new SystemTestFilterStringAPIProviderImpl(subsystem, filterString);
+ tree = new SystemViewForm(getShell(), composite_prompts, SWT.NULL, inputProvider, false, getMessageLine(), gridColumns, 1);
+
+ // add selection listeners
+ //tree.addSelectionChangedListener(this);
+ connectionCombo.addSelectionListener(this);
+
+ return composite_prompts;
+ }
+
+ /**
+ * Override of parent. Must pass selected object onto the form for initializing fields.
+ * Called by SystemDialogAction's default run() method after dialog instantiated.
+ */
+ public void setInputObject(Object inputObject)
+ {
+ super.setInputObject(inputObject);
+ }
+
+ /**
+ * When re-using this dialog between runs, call this to reset its contents.
+ * Assumption: original input subsystem factory Id doesn't change between runs
+ */
+ public void reset(ISubSystem subsystem, String filterString)
+ {
+ this.subsystem = subsystem;
+ this.filterString = filterString;
+ //this.subsystemFactoryId = subsystem.getParentSubSystemFactory().getId();
+ inputProvider.setSubSystem(subsystem);
+ inputProvider.setFilterString(filterString);
+ tree.reset(inputProvider);
+ }
+
+ /**
+ * ISelectionChangedListener interface method
+ */
+ public void selectionChanged(SelectionChangedEvent event)
+ {
+ }
+ public void widgetDefaultSelected(SelectionEvent event)
+ {
+ }
+ public void widgetSelected(SelectionEvent event)
+ {
+ Object src = event.getSource();
+ //if (src == connectionCombo.getCombo())
+ {
+ //System.out.println("connection changed");
+ IHost newConnection = connectionCombo.getHost();
+ ISubSystem[] newSubSystems = sr.getSubSystems(subsystemFactoryId, newConnection);
+ ISubSystem newSubSystem = null;
+ if ((newSubSystems != null) && (newSubSystems.length>0))
+ {
+ newSubSystem = newSubSystems[0];
+ subsystemFactoryId = subsystem.getSubSystemConfiguration().getId();
+ }
+ inputProvider.setSubSystem(newSubSystem);
+ tree.reset(inputProvider);
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemUpdateConnectionDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemUpdateConnectionDialog.java
new file mode 100644
index 00000000000..a34891a4d0a
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemUpdateConnectionDialog.java
@@ -0,0 +1,141 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.dialogs;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.model.IHost;
+import org.eclipse.rse.model.ISystemRegistry;
+import org.eclipse.rse.ui.ISystemConnectionFormCaller;
+import org.eclipse.rse.ui.SystemConnectionForm;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.messages.ISystemMessageLine;
+import org.eclipse.rse.ui.validators.ISystemValidator;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+
+
+/**
+ * Dialog for updating a connection.
+ * THIS DIALOG AND ITS ACTION ARE NO LONGER USED. THEY ARE REPLACED WITH A PROPERTIES DIALOG.
+ */
+public class SystemUpdateConnectionDialog extends SystemPromptDialog implements ISystemConnectionFormCaller
+{
+ protected SystemConnectionForm form;
+ protected String parentHelpId;
+
+ /**
+ * Constructor for SystemUpdateConnectionDialog
+ */
+ public SystemUpdateConnectionDialog(Shell shell)
+ {
+ super(shell, SystemResources.RESID_CHGCONN_TITLE);
+ parentHelpId = SystemPlugin.HELPPREFIX + "dcon0000";
+ getForm();
+ //pack();
+ }
+
+ /**
+ * Overrride this if you want to supply your own form. This may be called
+ * multiple times so please only instantatiate if the form instance variable
+ * is null, and then return the form instance variable.
+ * @see org.eclipse.rse.ui.SystemConnectionForm
+ */
+ public SystemConnectionForm getForm()
+ {
+ //System.out.println("INSIDE GETFORM");
+ if (form == null)
+ {
+ form = new SystemConnectionForm(getMessageLine(),this);
+ }
+ return form;
+ }
+
+ /**
+ * Create message line. Intercept so we can set msg line of form.
+ */
+ protected ISystemMessageLine createMessageLine(Composite c)
+ {
+ ISystemMessageLine msgLine = super.createMessageLine(c);
+ form.setMessageLine(msgLine);
+ return fMessageLine;
+ }
+
+
+ /**
+ * @see SystemPromptDialog#getInitialFocusControl()
+ */
+ protected Control getInitialFocusControl()
+ {
+ Control control = form.getInitialFocusControl();
+ return control;
+ }
+
+ /**
+ * @see SystemPromptDialog#createInner(Composite)
+ */
+ protected Control createInner(Composite parent)
+ {
+ Control c = form.createContents(parent, SystemConnectionForm.UPDATE_MODE, parentHelpId);
+ return c;
+ }
+
+ /**
+ * Override of parent. Must pass selected object onto the form for initializing fields.
+ * Called by SystemDialogAction's default run() method after dialog instantiated.
+ */
+ public void setInputObject(Object inputObject)
+ {
+ super.setInputObject(inputObject);
+ form.initializeInputFields((IHost)inputObject);
+
+ IHost conn = (IHost)inputObject;
+ ISystemValidator connectionNameValidators[] = new ISystemValidator[1];
+ connectionNameValidators[0] = SystemConnectionForm.getConnectionNameValidator(conn);
+ form.setConnectionNameValidators(connectionNameValidators);
+ }
+
+ /**
+ * Called when user presses OK button.
+ * Return true to close dialog.
+ * Return false to not close dialog.
+ */
+ protected boolean processOK()
+ {
+ boolean closeDialog = form.verify(true);
+ if (closeDialog)
+ {
+ IHost conn = (IHost)getInputObject();
+ ISystemRegistry sr = SystemPlugin.getDefault().getSystemRegistry();
+ sr.updateHost( getShell(),conn,conn.getSystemType(),form.getConnectionName(),
+ form.getHostName(), form.getConnectionDescription(),
+ form.getDefaultUserId(), form.getUserIdLocation() );
+ }
+ return closeDialog;
+ }
+
+ // ----------------------------------------
+ // CALLBACKS FROM SYSTEM CONNECTION FORM...
+ // ----------------------------------------
+ /**
+ * Event: the user has selected a system type.
+ */
+ public void systemTypeSelected(String systemType, boolean duringInitialization)
+ {
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemUserIdPerSystemTypeDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemUserIdPerSystemTypeDialog.java
new file mode 100644
index 00000000000..c03522b788d
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemUserIdPerSystemTypeDialog.java
@@ -0,0 +1,243 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.dialogs;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.SystemPreferencesManager;
+import org.eclipse.rse.core.SystemType;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.SystemWidgetHelpers;
+import org.eclipse.rse.ui.messages.ISystemMessageLine;
+import org.eclipse.rse.ui.validators.ISystemValidator;
+import org.eclipse.rse.ui.validators.ValidatorUserId;
+import org.eclipse.rse.ui.view.ISystemPropertyConstants;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * Dialog for renaming a system profile.
+ */
+public class SystemUserIdPerSystemTypeDialog extends SystemPromptDialog
+ implements ISystemMessages, ISystemPropertyConstants,
+ ISystemIconConstants
+{
+ private Text userId;
+ private Label systemTypePromptLabel, systemTypeLabel;
+ private String userIdString, inputUserId;
+ private SystemMessage errorMessage;
+ private ISystemValidator userIdValidator;
+ private boolean initialized = false;
+ private SystemType systemType;
+
+ /**
+ * Constructor
+ */
+ public SystemUserIdPerSystemTypeDialog(Shell shell, SystemType systemType)
+ {
+ super(shell, SystemResources.RESID_USERID_PER_SYSTEMTYPE_TITLE);
+ this.systemType = systemType;
+ if (systemType != null)
+ {
+ setInputObject(systemType);
+ }
+ userIdValidator = new ValidatorUserId(false); // false => allow empty? No.
+ //pack();
+ setHelp(SystemPlugin.HELPPREFIX + "ddid0000");
+ }
+ /**
+ * Create message line. Intercept so we can set msg line of form.
+ */
+ protected ISystemMessageLine createMessageLine(Composite c)
+ {
+ ISystemMessageLine msgLine = super.createMessageLine(c);
+ //form.setMessageLine(msgLine);
+ return fMessageLine;
+ }
+
+
+ /**
+ * @see SystemPromptDialog#getInitialFocusControl()
+ */
+ protected Control getInitialFocusControl()
+ {
+ return userId;
+ }
+
+ /**
+ * Set the UserId validator.
+ * By default, we use ValidatorUserId
+ */
+ public void setUserIdValidator(ISystemValidator uiv)
+ {
+ userIdValidator = uiv;
+ }
+
+ /**
+ * @see SystemPromptDialog#createInner(Composite)
+ */
+ protected Control createInner(Composite parent)
+ {
+ // Inner composite
+ Composite composite_prompts = SystemWidgetHelpers.createComposite(
+ parent, 2);
+
+ // SYSTEM TYPE
+ systemTypePromptLabel = SystemWidgetHelpers.createLabel(composite_prompts,SystemResources.RESID_USERID_PER_SYSTEMTYPE_SYSTEMTYPE_LABEL);
+ //systemTypePromptLabel.setToolTipText(SystemPlugin.getString(RESID_USERID_PER_SYSTEMTYPE_SYSTEMTYPE_ROOT+"tooltip"));
+
+ systemTypeLabel = SystemWidgetHelpers.createLabel(composite_prompts,"");
+ systemTypeLabel.setToolTipText(SystemResources.RESID_USERID_PER_SYSTEMTYPE_TOOLTIP);
+ systemTypeLabel.setText(systemType.getName());
+
+
+ // ENTRY FIELD
+ userId = SystemWidgetHelpers.createLabeledTextField(composite_prompts,null,
+ SystemResources.RESID_USERID_PER_SYSTEMTYPE_LABEL,
+ SystemResources.RESID_USERID_PER_SYSTEMTYPE_TOOLTIP);
+ initialize();
+
+ // add keystroke listeners...
+ userId.addModifyListener(
+ new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ validateUserIdInput();
+ }
+ }
+ );
+
+ return composite_prompts;
+ }
+
+
+ /**
+ * Override of parent. Must pass selected object onto the form for initializing fields.
+ * Called by SystemDialogAction's default run() method after dialog instantiated.
+ * INPUT OBJECT MUST BE OF TYPE SYSTEMTYPE.
+ */
+ public void setInputObject(Object inputObject)
+ {
+ //System.out.println("INSIDE SETINPUTOBJECT: " + inputObject + ", "+inputObject.getClass().getName());
+ super.setInputObject(inputObject);
+ if (inputObject instanceof SystemType)
+ {
+ SystemType type = (SystemType)inputObject;
+ inputUserId = SystemPreferencesManager.getPreferencesManager().getDefaultUserId(type.getName());
+ }
+ initialize();
+ }
+
+ /**
+ * Initialize input fields from input
+ */
+ protected void initialize()
+ {
+ if (!initialized && (userId!=null) && (inputUserId!=null))
+ {
+ initialized = true;
+ userId.setText(inputUserId);
+ userId.selectAll();
+ }
+ setPageComplete(false); // well, should empty be valid!
+ }
+ /**
+ * Called when user presses OK button.
+ * Return true to close dialog.
+ * Return false to not close dialog.
+ */
+ protected boolean processOK()
+ {
+ userIdString = userId.getText().trim();
+ boolean closeDialog = verify();
+ if (closeDialog)
+ {
+ setOutputObject(userIdString);
+ }
+ return closeDialog;
+ }
+ /**
+ * Verifies all input.
+ * @return true if there are no errors in the user input
+ */
+ public boolean verify()
+ {
+ //clearErrorMessage();
+ SystemMessage errMsg = validateUserIdInput();
+ if (errMsg != null)
+ {
+ userId.setFocus();
+ }
+ return (errMsg == null);
+ }
+
+ /**
+ * Validate the userId as the user types it.
+ * @see #setUserIdValidator(ISystemValidator)
+ */
+ protected SystemMessage validateUserIdInput()
+ {
+ errorMessage = userIdValidator.validate(userId.getText().trim());
+ if (errorMessage != null)
+ setErrorMessage(errorMessage);
+ else
+ clearErrorMessage();
+ setPageComplete();
+ return errorMessage;
+ }
+
+
+ /**
+ * This method can be called by the dialog or wizard page host, to decide whether to enable
+ * or disable the next, final or ok buttons. It returns true if the minimal information is
+ * available and is correct.
+ */
+ public boolean isPageComplete()
+ {
+ boolean pageComplete = false;
+ if (errorMessage == null)
+ {
+ String theNewUserId = userId.getText().trim();
+ pageComplete = (theNewUserId.length() > 0);
+ //pageComplete = (theNewUserId.length() > 0) && !(theNewUserId.equalsIgnoreCase(inputUserId));
+ //pageComplete = true; // should empty be valid?
+ }
+ return pageComplete;
+ }
+
+ /**
+ * Inform caller of page-complete status of this form
+ */
+ public void setPageComplete()
+ {
+ setPageComplete(isPageComplete());
+ }
+
+ /**
+ * Returns the user-entered new user Id
+ */
+ public String getUserId()
+ {
+ return userIdString;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemWizardDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemWizardDialog.java
new file mode 100644
index 00000000000..1cfee6d301a
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemWizardDialog.java
@@ -0,0 +1,192 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.dialogs;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.ProgressMonitorPart;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.ui.wizards.ISystemWizard;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * Base wizard dialog class. Extends Eclipse WizardDialog class to add
+ * support for the ISystemPromptDialog interface methods. These make it
+ * easy to pass an input object to your wizard, if your wizard implements
+ * ISystemWizard.
+ * This class is most effective when used together with {@link org.eclipse.rse.ui.wizards.AbstractSystemWizard} and
+ * with {@link org.eclipse.rse.ui.actions.SystemBaseWizardAction}. Indeed,
+ * if you use SystemBaseWizardAction, this class is automatically used for the dialog. It supports
+ * propogation of information from the action, to the wizard, to the wizard dialog and to the wizard pages.
+ * The advantages to using this class versus the base JFace WizardDialog class is:
+ * To use this class, simply instantiate it, passing a wizard that implements {@link org.eclipse.rse.ui.wizards.ISystemWizard},
+ * which {@link org.eclipse.rse.ui.wizards.AbstractSystemWizard} does. If you use {@link org.eclipse.rse.ui.actions.SystemBaseWizardAction},
+ * then this is done for you.
+ *
+ * @see org.eclipse.rse.ui.wizards.AbstractSystemWizard
+ * @see org.eclipse.rse.ui.actions.SystemBaseWizardAction
+ */
+public class SystemWizardDialog
+ extends WizardDialog
+ implements ISystemPromptDialog
+{
+ protected ISystemWizard wizard;
+ protected String helpId;
+
+ /**
+ * Constructor
+ */
+ public SystemWizardDialog(Shell shell, ISystemWizard wizard)
+ {
+ super(shell, wizard);
+ this.wizard = wizard;
+ wizard.setSystemWizardDialog(this);
+ }
+ /**
+ * Constructor two. Use when you have an input object at instantiation time.
+ */
+ public SystemWizardDialog(Shell shell, ISystemWizard wizard, Object inputObject)
+ {
+ super(shell,wizard);
+ this.wizard = wizard;
+ setInputObject(inputObject);
+ wizard.setSystemWizardDialog(this);
+ }
+
+ /**
+ * For explicitly setting input object. Called by SystemDialogAction
+ */
+ public void setInputObject(Object inputObject)
+ {
+ wizard.setInputObject(inputObject);
+ }
+ /**
+ * For explicitly getting input object.
+ */
+ public Object getInputObject()
+ {
+ return wizard.getInputObject();
+ }
+
+ /**
+ * For explicitly getting output object after wizard is dismissed. Set by the
+ * dialog's processOK method.
+ */
+ public Object getOutputObject()
+ {
+
+ return wizard.getOutputObject();
+ }
+
+ /**
+ * Allow caller to determine if wizard was cancelled or not.
+ */
+ public boolean wasCancelled()
+ {
+ //System.out.println("Inside wasCancelled of SystemWizardDialog: " + wizard.wasCancelled());
+ return wizard.wasCancelled();
+ }
+
+ /**
+ * Set the help context id for this wizard dialog
+ */
+ public void setHelp(String id)
+ {
+ helpId = id;
+ if (wizard instanceof ISystemWizard)
+ ((ISystemWizard)wizard).setHelp(id);
+ }
+
+ /**
+ * Get the help context id for this wizard dialog, as set in setHelp
+ */
+ public String getHelpContextId()
+ {
+ return helpId;
+ }
+
+ /**
+ * Intercept of parent method so we can automatically register the wizard's progress monitor
+ * with the SystemRegistry for all framework progress monitor requests, if user has specified
+ * they need a progress monitor for this wizard.
+ */
+ protected Control createDialogArea(Composite parent)
+ {
+ boolean needsMonitor = wizard.needsProgressMonitor();
+ Control ctrl = super.createDialogArea(parent);
+ if (!needsMonitor)
+ {
+ IProgressMonitor pm = getProgressMonitor();
+ ((ProgressMonitorPart)pm).dispose();
+ }
+ if (needsMonitor && SystemPlugin.isTheSystemRegistryActive())
+ {
+ SystemPlugin.getTheSystemRegistry().setRunnableContext(getShell(), this);
+ // add a dispose listener
+ getShell().addDisposeListener(new DisposeListener()
+ {
+ public void widgetDisposed(DisposeEvent e)
+ {
+ SystemPlugin.getTheSystemRegistry().clearRunnableContext();
+ }
+ });
+ }
+ return ctrl;
+ }
+
+ /**
+ * Exposes this nice new 2.0 capability to the public.
+ */
+ public void updateSize(IWizardPage page)
+ {
+ super.updateSize(page);
+ }
+
+ /**
+ * Expose inherited protected method convertWidthInCharsToPixels as a publicly
+ * excessible method
+ */
+ public int publicConvertWidthInCharsToPixels(int chars)
+ {
+ return convertWidthInCharsToPixels(chars);
+ }
+ /**
+ * Expose inherited protected method convertHeightInCharsToPixels as a publicly
+ * excessible method
+ */
+ public int publicConvertHeightInCharsToPixels(int chars)
+ {
+ return convertHeightInCharsToPixels(chars);
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemWorkWithHistoryDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemWorkWithHistoryDialog.java
new file mode 100644
index 00000000000..52673949c01
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemWorkWithHistoryDialog.java
@@ -0,0 +1,346 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.dialogs;
+
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.SystemWidgetHelpers;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ArmEvent;
+import org.eclipse.swt.events.ArmListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.List;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Widget;
+
+
+
+/**
+ * A dialog that allows the user to manipulate the history associated with
+ * a widget.
+ *
+ * The history strings are shown in a simple list, and the user can delete
+ * items from the list or re-order items in the list.
+ */
+public class SystemWorkWithHistoryDialog extends SystemPromptDialog implements ISystemIconConstants, Listener, ArmListener
+{
+ private String[] historyInput;
+ private String[] historyOutput;
+ private String[] defaultHistory;
+ private Label verbage;
+ private List historyList;
+ private Button rmvButton, clearButton, mupButton, mdnButton;
+ private Group group;
+ protected Menu popupMenu;
+ protected MenuItem clearMI, rmvMI, mupMI, mdnMI;
+
+
+ /**
+ * Constructor for SystemWorkWithHistoryDialog
+ */
+ public SystemWorkWithHistoryDialog(Shell shell, String[] history)
+ {
+ super(shell, SystemResources.RESID_WORKWITHHISTORY_TITLE);
+ historyInput = history;
+
+ //pack();
+ setHelp(SystemPlugin.HELPPREFIX+"dwwh0000");
+ setInitialOKButtonEnabledState(false); //d41471
+ }
+
+ /**
+ * Set the items to default the history to. These are sacred and can't be
+ * deleted in this dialog.
+ */
+ public void setDefaultHistory(String[] items)
+ {
+ this.defaultHistory = items; // pc41439
+ }
+ /**
+ * Return true if the given string is among the default history items
+ */
+ private boolean inDefaultHistory(String toTest) // pc41439
+ {
+ boolean inDefault = false;
+ if (defaultHistory != null)
+ for (int idx=0; !inDefault && (idx
+ * This is passed into the filter and filter string wizards and dialogs in case it is needed
+ * for context.
+ */
+ public void setSystemFilterPoolReferenceManagerProvider(ISystemFilterPoolReferenceManagerProvider provider)
+ {
+ this.refProvider = provider;
+ }
+ /**
+ * Configuration method
+ * This is passed into the filter and filter string wizards and dialogs in case it is needed
+ * for context.
+ */
+ public void setSystemFilterPoolManagerProvider(ISystemFilterPoolManagerProvider provider)
+ {
+ this.provider = provider;
+ }
+
+ /**
+ * Configuration method
+ * Your validator should extend ValidatorFilterString to inherited the uniqueness error checking.
+ *
+ * Alternatively, if all you want is a unique error message for the case when duplicates are found,
+ * call setDuplicateFilterStringErrorMessage, and it will be used in the default validator.
+ */
+ public void setFilterStringValidator(ISystemValidator v)
+ {
+ filterStringValidator = v;
+ }
+ /**
+ * Return the result of {@link #setFilterStringValidator(ISystemValidator)}.
+ */
+ public ISystemValidator getFilterStringValidator()
+ {
+ return filterStringValidator;
+ }
+ /**
+ * Configuration method
+ * Will be non-null if the current selection is a reference to a
+ * filter pool or filter, or a reference manager provider.
+ *
+ * This is not used by default but made available for subclasses.
+ * @see #setSystemFilterPoolManagerProvider(ISystemFilterPoolManagerProvider)
+ */
+ public void setSystemFilterPoolReferenceManagerProvider(ISystemFilterPoolReferenceManagerProvider provider)
+ {
+ this.refProvider = provider;
+ }
+ /**
+ * Configuration method, called from Change Filter dialog and New Filter wizard. Do not override.
+ * Will be non-null if the current selection is a reference to a
+ * filter pool or filter, or a filter pool or filter, or a manager provider itself.
+ *
+ * This is not used by default but made available for subclasses.
+ * @see #setSystemFilterPoolReferenceManagerProvider(ISystemFilterPoolReferenceManagerProvider)
+ */
+ public void setSystemFilterPoolManagerProvider(ISystemFilterPoolManagerProvider provider)
+ {
+ this.provider = provider;
+ }
+
+ /**
+ * Getter method, for the use of subclasses. Do not override.
+ * This is not used by default but made available for subclasses.
+ */
+ public ISystemFilterPoolReferenceManagerProvider getSystemFilterPoolReferenceManagerProvider()
+ {
+ return refProvider;
+ }
+ /**
+ * Getter method, for the use of subclasses. Do not override.
+ * This is not used by default but made available for subclasses.
+ */
+ public ISystemFilterPoolManagerProvider getSystemFilterPoolManagerProvider()
+ {
+ return provider;
+ }
+
+ /**
+ * Helper method you do not need to ever override.
+ * This simply sets the type instance variable, so that subclassing code may
+ * access it if it needs to know what type of filter is being created. This method is
+ * called by the setType method in the SystemNewFilterWizard wizard.
+ */
+ public void setType(String type)
+ {
+ this.type = type;
+ }
+
+ /**
+ * Configuration method, called from Change Filter dialog. Do not override. This is the functional opposite of doInitializeFields, which tears apart the input string in update mode,
+ * to populate the GUIs. This method creates the filter string from the information in the GUI.
+ */
+ public String getFilterString()
+ {
+ if (textString != null)
+ return textString.getText().trim();
+ else
+ return inputFilterString;
+ }
+ /**
+ * Getter method. Do not override.
+ * This method gives subclasses the opportunity to specify unique values for this label.
+ * In addition to setting the text, the tooltip text should also be set.
+ *
+ * Defaults are supplied.
+ */
+ public void configureHeadingLabel(Label label)
+ {
+ if (label == null)
+ return;
+ if (!newMode)
+ {
+ label.setText(SystemResources.RESID_CHGFILTER_FILTERSTRING_LABEL);
+ label.setToolTipText(SystemResources.RESID_CHGFILTER_FILTERSTRING_TOOLTIP);
+ }
+ else
+ {
+ label.setText(SystemResources.RESID_CHGFILTER_NEWFILTERSTRING_LABEL);
+ label.setToolTipText(SystemResources.RESID_CHGFILTER_NEWFILTERSTRING_TOOLTIP);
+ }
+ }
+
+ // ------------------------------
+ // LIFECYCLE METHODS...
+ // ------------------------------
+
+ /**
+ * Overridable lifecycle method.
+ * This is called by the wizard page when first shown, to decide if the default information
+ * is complete enough to enable finish. It doesn't do validation, that will be done when
+ * finish is pressed.
+ */
+ public boolean isComplete()
+ {
+ boolean complete = true;
+ if (errorMessage != null) // pending errors?
+ complete = false; // clearly not complete.
+ else
+ complete = areFieldsComplete();
+ if (dlgTestButton != null)
+ dlgTestButton.setEnabled(complete);
+ return complete;
+ }
+ /**
+ * Overridable lifecycle method.
+ * This is called by the isComplete, to decide if the default information
+ * is complete enough to enable finish. It doesn't do validation, that will be done when
+ * finish is pressed.
+ */
+ protected boolean areFieldsComplete()
+ {
+ if (textString == null)
+ return false;
+ else
+ return (textString.getText().trim().length()>0);
+ }
+
+ /**
+ * Lifecycle method. Do not override.
+ * Because this is used to enable/disable the Next and Finish buttons it is important
+ * to call it when asked to do verification, even if nothing has changed.
+ *
+ * It is more efficient, however, to defer the event firing during a full verification
+ * until after the last widget has been verified. To enable this, set the protected
+ * variable "skipEventFiring" to true at the top of your verify event, then to "false"
+ * at the end. Then do fireChangeEvent(errorMessage);
+ */
+ protected void fireChangeEvent(SystemMessage error)
+ {
+ if (skipEventFiring)
+ return;
+ for (int idx=0; idx Default implementation calls {@link #validateStringInput()}.
+ *
+ * @return error message if there is one, else null if ok
+ */
+ public SystemMessage verify()
+ {
+ errorMessage = null;
+ Control controlInError = null;
+ errorMessage = validateStringInput();
+ if (errorMessage != null)
+ controlInError = textString;
+ if (errorMessage != null)
+ {
+ if (controlInError != null)
+ controlInError.setFocus();
+ }
+ //setPageComplete();
+ return errorMessage;
+ }
+
+ // ------------------
+ // EVENT LISTENERS...
+ // ------------------
+
+ /**
+ * Overridable lifecycle method.
+ * To achieve this, code which populates a context menu can implement this interface, and
+ * pass it to the new filter wizard action. That action will then call back to the caller
+ * via this interface, when the action is run.
+ */
+public interface ISystemNewFilterActionConfigurator
+{
+
+ /**
+ * The user has selected to run this action. Please configure it!
+ * @param newFilterAction - the action to be configured
+ * @param callerData - context data that you supplied when registering this callback
+ */
+ public void configureNewFilterAction(ISubSystemConfiguration factory, SystemNewFilterAction newFilterAction, Object callerData);
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterAction.java
new file mode 100644
index 00000000000..b9a7184e1a0
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterAction.java
@@ -0,0 +1,252 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.filters.actions;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.filters.ISystemFilter;
+import org.eclipse.rse.filters.ISystemFilterPool;
+import org.eclipse.rse.filters.ISystemFilterPoolManagerProvider;
+import org.eclipse.rse.filters.ISystemFilterPoolReference;
+import org.eclipse.rse.filters.ISystemFilterPoolReferenceManagerProvider;
+import org.eclipse.rse.filters.ISystemFilterReference;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.actions.SystemBaseDialogAction;
+import org.eclipse.rse.ui.filters.SystemFilterStringEditPane;
+import org.eclipse.rse.ui.filters.dialogs.SystemChangeFilterDialog;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * The action that displays the Change Filter dialog
+ */
+public class SystemChangeFilterAction extends SystemBaseDialogAction
+
+{
+
+ private SystemChangeFilterDialog dlg = null;
+ private String dlgTitle = null;
+ private SystemFilterStringEditPane editPane;
+
+ /**
+ * Constructor for default action label and image
+ */
+ public SystemChangeFilterAction(Shell parent)
+ {
+ this( parent, SystemResources.ACTION_UPDATEFILTER_LABEL, SystemResources.ACTION_UPDATEFILTER_TOOLTIP,
+ SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_CHANGEFILTER_ID));
+ }
+
+ public SystemChangeFilterAction(Shell parent, String label, String tooltip)
+ {
+ this(parent, label, tooltip, SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_CHANGEFILTER_ID));
+ }
+
+ public SystemChangeFilterAction(Shell parent, String label, String tooltip, ImageDescriptor image)
+ {
+ super(label, tooltip, image, parent);
+ allowOnMultipleSelection(false);
+ setContextMenuGroup(ISystemContextMenuConstants.GROUP_CHANGE);
+ setHelp(SystemPlugin.HELPPREFIX+"acfr0000");
+ }
+
+
+ /**
+ * Set the help context Id (infoPop) for this action. This must be fully qualified by
+ * plugin ID.
+ *
+ * Same as {@link org.eclipse.rse.ui.actions.SystemBaseAction #setHelp(String)}
+ * @see org.eclipse.rse.ui.actions.SystemBaseDialogAction #setDialogHelp(String)
+ * @see org.eclipse.rse.ui.actions.SystemBaseAction #getHelpContextId()
+ */
+ public void setHelpContextId(String id)
+ {
+ setHelp(id);
+ }
+ /**
+ * Set the title for the dialog that displays
+ */
+ public void setDialogTitle(String title)
+ {
+ this.dlgTitle = title;
+ }
+ /**
+ * Set the help id for the dialog that displays
+ */
+ public void setDialogHelpContextId(String id)
+ {
+ setDialogHelp(id);
+ }
+ /**
+ * Specify an edit pane that prompts the user for the contents of a filter string.
+ */
+ public void setFilterStringEditPane(SystemFilterStringEditPane editPane)
+ {
+ this.editPane = editPane;
+ }
+ /**
+ * Return the edit pane specified via {@link #setFilterStringEditPane(SystemFilterStringEditPane)}
+ */
+ public SystemFilterStringEditPane getFilterStringEditPane()
+ {
+ return editPane;
+ }
+
+ /**
+ * Called by SystemBaseAction when selection is set.
+ * Our opportunity to verify we are allowed for this selected type.
+ */
+ public boolean checkObjectType(Object selectedObject)
+ {
+ //System.out.println("checkObjectType: " + (selectedObject instanceof SystemFilterReference));
+ if (selectedObject instanceof ISystemFilter)
+ {
+ return !((ISystemFilter)selectedObject).isNonChangable();
+ }
+ else if (selectedObject instanceof ISystemFilterReference)
+ {
+ return !((ISystemFilterReference)selectedObject).getReferencedFilter().isNonChangable();
+ }
+ else
+ return false;
+ }
+
+ /**
+ * This method creates and configures the filter dialog. It defers to
+ * {@link #getFilterDialog(Shell)} to create it, and then configures it here.
+ * So, do not override this, but do feel free to override getFilterDialog.
+ */
+ public Dialog createDialog(Shell shell)
+ {
+ dlg = getFilterDialog(shell);
+ dlg.setSystemFilterPoolReferenceManagerProvider(getSystemFilterPoolReferenceManagerProvider());
+ dlg.setSystemFilterPoolManagerProvider(getSystemFilterPoolManagerProvider());
+ if (editPane != null)
+ dlg.setFilterStringEditPane(editPane);
+ configureFilterDialog(dlg);
+ ISystemFilter filter = getSelectedFilter();
+ if (filter != null)
+ if (filter.isSingleFilterStringOnly())
+ dlg.setSupportsMultipleStrings(false);
+ return (Dialog)dlg;
+ }
+
+ /**
+ * Overridable extension point to get our filter dialog. Only override this if you
+ * subclass SystemChangeFilterDialog. Else, override configureFilterDialog.
+ */
+ protected SystemChangeFilterDialog getFilterDialog(Shell shell)
+ {
+ if (dlgTitle == null)
+ return new SystemChangeFilterDialog(shell);
+ else
+ return new SystemChangeFilterDialog(shell, dlgTitle);
+ }
+
+ /**
+ * This method is called internally, but had to be made public. You can ignore it.
+ */
+ public void callConfigureFilterDialog(SystemChangeFilterDialog dlg)
+ {
+ configureFilterDialog(dlg);
+ }
+
+ /**
+ * Overridable extension point to configure the filter dialog. Typically you don't need
+ * to subclass our default dialog.
+ *
+ * Note since the dialog has not been opened yet, you cannot assume its shell is ready,
+ * so call getParentShell() versus getShell().
+ */
+ protected void configureFilterDialog(SystemChangeFilterDialog dlg)
+ {
+ Shell shell = dlg.getShell();
+ if (shell == null)
+ shell = dlg.getParentShell();
+ // code goes here...
+ }
+
+ /**
+ * Required by parent but we do not use it so return null;
+ */
+ protected Object getDialogValue(Dialog dlg)
+ {
+ return null;
+ }
+
+ /**
+ * Get the contextual system filter pool reference manager provider. Will return non-null if the
+ * current selection is not a reference to a filter pool or filter, or a reference manager
+ * provider.
+ */
+ public ISystemFilterPoolReferenceManagerProvider getSystemFilterPoolReferenceManagerProvider()
+ {
+ Object firstSelection = getFirstSelection();
+ if (firstSelection != null)
+ {
+ if (firstSelection instanceof ISystemFilterReference)
+ return ((ISystemFilterReference)firstSelection).getProvider();
+ else if (firstSelection instanceof ISystemFilterPoolReference)
+ return ((ISystemFilterPoolReference)firstSelection).getProvider();
+ else if (firstSelection instanceof ISystemFilterPoolReferenceManagerProvider)
+ return (ISystemFilterPoolReferenceManagerProvider)firstSelection;
+ }
+ return null;
+ }
+ /**
+ * Get the contextual system filter pool manager provider. Will return non-null if the
+ * current selection is not a reference to a filter pool or filter, or a reference manager
+ * provider, or a manager provider.
+ */
+ public ISystemFilterPoolManagerProvider getSystemFilterPoolManagerProvider()
+ {
+ Object firstSelection = getFirstSelection();
+ if (firstSelection != null)
+ {
+ if (firstSelection instanceof ISystemFilterReference)
+ return ((ISystemFilterReference)firstSelection).getReferencedFilter().getProvider();
+ else if (firstSelection instanceof ISystemFilter)
+ return ((ISystemFilter)firstSelection).getProvider();
+ else if (firstSelection instanceof ISystemFilterPoolReference)
+ return ((ISystemFilterPoolReference)firstSelection).getReferencedFilterPool().getProvider();
+ else if (firstSelection instanceof ISystemFilterPool)
+ return ((ISystemFilterPool)firstSelection).getProvider();
+ else if (firstSelection instanceof ISystemFilterPoolManagerProvider)
+ return (ISystemFilterPoolManagerProvider)firstSelection;
+ }
+ return null;
+ }
+
+ /**
+ * Get the selected filter
+ */
+ public ISystemFilter getSelectedFilter()
+ {
+ Object firstSelection = getFirstSelection();
+ if (firstSelection != null)
+ {
+ if (firstSelection instanceof ISystemFilterReference)
+ return ((ISystemFilterReference)firstSelection).getReferencedFilter();
+ else if (firstSelection instanceof ISystemFilter)
+ return ((ISystemFilter)firstSelection);
+ }
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterActionCopyString.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterActionCopyString.java
new file mode 100644
index 00000000000..c4f73ff45ea
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterActionCopyString.java
@@ -0,0 +1,68 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.filters.actions;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.actions.SystemBaseAction;
+import org.eclipse.rse.ui.filters.SystemChangeFilterPane;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+
+
+
+/**
+ * The action is used within the Change Filter dialog, in the context menu of the selected filter string.
+ * It is used to copy the selected filter string to the clipboard for subsequent paste.
+ */
+public class SystemChangeFilterActionCopyString extends SystemBaseAction
+
+{
+ private SystemChangeFilterPane parentDialog;
+
+ /**
+ * Constructor
+ */
+ public SystemChangeFilterActionCopyString(SystemChangeFilterPane parentDialog)
+ {
+ super(SystemResources.ACTION_COPY_FILTERSTRING_LABEL,SystemResources.ACTION_COPY_FILTERSTRING_TOOLTIP,
+ PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_COPY),
+ null);
+ allowOnMultipleSelection(false);
+ this.parentDialog = parentDialog;
+ setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORGANIZE);
+ setHelp(SystemPlugin.HELPPREFIX+"dufr2000");
+ }
+
+ /**
+ * We override from parent to do unique checking.
+ * We intercept to ensure this is isn't the "new" filter string
+ */
+ public boolean updateSelection(IStructuredSelection selection)
+ {
+ return parentDialog.canCopy();
+ }
+
+ /**
+ * This is the method called when the user selects this action.
+ */
+ public void run()
+ {
+ parentDialog.doCopy();
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterActionDeleteString.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterActionDeleteString.java
new file mode 100644
index 00000000000..0a54ccea851
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterActionDeleteString.java
@@ -0,0 +1,69 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.filters.actions;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.actions.SystemBaseAction;
+import org.eclipse.rse.ui.filters.SystemChangeFilterPane;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+
+
+/**
+ * The action is used within the Change Filter dialog, in the context menu of the selected filter string.
+ * It is used to delete the selected filter string
+ */
+public class SystemChangeFilterActionDeleteString extends SystemBaseAction
+
+{
+
+ private SystemChangeFilterPane parentDialog;
+
+ /**
+ * Constructor
+ */
+ public SystemChangeFilterActionDeleteString(SystemChangeFilterPane parentDialog)
+ {
+ super(SystemResources.ACTION_DELETE_LABEL,SystemResources.ACTION_DELETE_TOOLTIP,
+ PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_DELETE)
+ ,null);
+ allowOnMultipleSelection(false);
+ this.parentDialog = parentDialog;
+ setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORGANIZE);
+ setHelp(SystemPlugin.HELPPREFIX+"dufr1000");
+ }
+
+ /**
+ * We override from parent to do unique checking.
+ * We intercept to ensure this is isn't the "new" filter string
+ */
+ public boolean updateSelection(IStructuredSelection selection)
+ {
+ return parentDialog.canDelete();
+ }
+
+ /**
+ * This is the method called when the user selects this action.
+ */
+ public void run()
+ {
+ parentDialog.doDelete();
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterActionMoveStringDown.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterActionMoveStringDown.java
new file mode 100644
index 00000000000..b6d49889fac
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterActionMoveStringDown.java
@@ -0,0 +1,68 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.filters.actions;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.actions.SystemBaseAction;
+import org.eclipse.rse.ui.filters.SystemChangeFilterPane;
+
+
+/**
+ * The action is used within the Change Filter dialog, in the context menu of the selected filter string.
+ * It is used to move the selected filter string up by one in the list
+ */
+public class SystemChangeFilterActionMoveStringDown extends SystemBaseAction
+{
+
+ private SystemChangeFilterPane parentDialog;
+
+ /**
+ * Constructor
+ */
+ public SystemChangeFilterActionMoveStringDown(SystemChangeFilterPane parentDialog)
+ {
+ super(SystemResources.ACTION_MOVEDOWN_LABEL,SystemResources.ACTION_MOVEDOWN_TOOLTIP,
+ SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_MOVEDOWN_ID),
+ null);
+ allowOnMultipleSelection(false);
+ this.parentDialog = parentDialog;
+ setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORDER);
+ setHelp(SystemPlugin.HELPPREFIX+"dufr5000");
+ }
+
+ /**
+ * We override from parent to do unique checking.
+ * We intercept to ensure this is isn't the last filter string in the list
+ */
+ public boolean updateSelection(IStructuredSelection selection)
+ {
+ return parentDialog.canMoveDown();
+ }
+
+ /**
+ * This is the method called when the user selects this action.
+ */
+ public void run()
+ {
+ parentDialog.doMoveDown();
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterActionMoveStringUp.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterActionMoveStringUp.java
new file mode 100644
index 00000000000..7d45be5d20d
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterActionMoveStringUp.java
@@ -0,0 +1,68 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.filters.actions;
+
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.actions.SystemBaseAction;
+import org.eclipse.rse.ui.filters.SystemChangeFilterPane;
+
+
+/**
+ * The action is used within the Change Filter dialog, in the context menu of the selected filter string.
+ * It is used to move the selected filter string down by one in the list
+ */
+public class SystemChangeFilterActionMoveStringUp extends SystemBaseAction
+{
+
+ private SystemChangeFilterPane parentDialog;
+
+ /**
+ * Constructor
+ */
+ public SystemChangeFilterActionMoveStringUp(SystemChangeFilterPane parentDialog)
+ {
+ super(SystemResources.ACTION_MOVEUP_LABEL,SystemResources.ACTION_MOVEUP_TOOLTIP,
+ SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_MOVEUP_ID),
+ null);
+ allowOnMultipleSelection(false);
+ this.parentDialog = parentDialog;
+ setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORDER);
+ setHelp(SystemPlugin.HELPPREFIX+"dufr4000");
+ }
+
+ /**
+ * We override from parent to do unique checking.
+ * We intercept to ensure this is isn't the fist filter string
+ */
+ public boolean updateSelection(IStructuredSelection selection)
+ {
+ return parentDialog.canMoveUp();
+ }
+
+ /**
+ * This is the method called when the user selects this action.
+ */
+ public void run()
+ {
+ parentDialog.doMoveUp();
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterActionPasteString.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterActionPasteString.java
new file mode 100644
index 00000000000..c2e554afc5b
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterActionPasteString.java
@@ -0,0 +1,67 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.filters.actions;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.actions.SystemBaseAction;
+import org.eclipse.rse.ui.filters.SystemChangeFilterPane;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+
+
+/**
+ * The action is used within the Change Filter dialog, in the context menu of the selected filter string.
+ * It is used to paste the copied filter string from the clipboard to the list.
+ */
+public class SystemChangeFilterActionPasteString extends SystemBaseAction
+{
+ private SystemChangeFilterPane parentDialog;
+
+ /**
+ * Constructor
+ */
+ public SystemChangeFilterActionPasteString(SystemChangeFilterPane parentDialog)
+ {
+ super(SystemResources.ACTION_PASTE_LABEL,SystemResources.ACTION_PASTE_TOOLTIP,
+ PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_PASTE),
+ null);
+ allowOnMultipleSelection(false);
+ this.parentDialog = parentDialog;
+ setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORGANIZE);
+ setHelp(SystemPlugin.HELPPREFIX+"dufr3000");
+ }
+
+ /**
+ * We override from parent to do unique checking.
+ * We intercept to ensure there is something in the clipboard to copy
+ */
+ public boolean updateSelection(IStructuredSelection selection)
+ {
+ return parentDialog.canPaste();
+ }
+
+ /**
+ * This is the method called when the user selects this action.
+ */
+ public void run()
+ {
+ parentDialog.doPaste();
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterAbstractFilterAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterAbstractFilterAction.java
new file mode 100644
index 00000000000..c6fe913740a
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterAbstractFilterAction.java
@@ -0,0 +1,232 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.filters.actions;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.rse.ui.actions.SystemBaseDialogAction;
+import org.eclipse.rse.ui.filters.SystemFilterDialogInputs;
+import org.eclipse.rse.ui.filters.SystemFilterDialogInterface;
+import org.eclipse.swt.widgets.Shell;
+
+
+
+/**
+ * Base class capturing the attributes and operations common to dialog actions
+ * that work on system filters.
+ */
+public abstract class SystemFilterAbstractFilterAction
+ extends SystemBaseDialogAction
+
+{
+
+
+ protected SystemFilterDialogInputs dlgInputs;
+
+ /**
+ * Constructor when given the translated action label
+ */
+ public SystemFilterAbstractFilterAction(Shell parent, String title)
+ {
+ super(title, null, parent);
+ allowOnMultipleSelection(false);
+ init();
+ }
+
+ /**
+ * Constructor when given the translated action label and tooltip
+ */
+ public SystemFilterAbstractFilterAction(Shell parent, String title, String tooltip)
+ {
+ super(title, tooltip, null, parent);
+ allowOnMultipleSelection(false);
+ init();
+ }
+
+ /**
+ * Common initialization code
+ */
+ protected void init()
+ {
+ dlgInputs = new SystemFilterDialogInputs();
+ }
+
+ // ----------------------------
+ // HELP ID SETTINGS...
+ // ----------------------------
+
+ /**
+ * Set the help context Id (infoPop) for this action. This must be fully qualified by
+ * plugin ID.
+ *
+ * Same as {@link org.eclipse.rse.ui.actions.SystemBaseAction #setHelp(String)}
+ * @see org.eclipse.rse.ui.actions.SystemBaseAction #getHelpContextId()
+ */
+ public void setHelpContextId(String id)
+ {
+ setHelp(id);
+ }
+
+ // ----------------------------
+ // ATTRIBUTE GETTERS/SETTERS...
+ // ----------------------------
+
+ /**
+ * Set the dialog title.
+ * Either call this or override getDialogTitle()
+ */
+ public void setDialogTitle(String title)
+ {
+ dlgInputs.title = title;
+ }
+ /**
+ * Get the dialog title.
+ * By default, uses what was given in setDialogTitle, or an english default if nothing set.
+ */
+ public String getDialogTitle()
+ {
+ return dlgInputs.title;
+ }
+
+ /**
+ * Set the dialog prompt text.
+ * Either call this or override getDialogPrompt()
+ */
+ public void setDialogPrompt(String prompt)
+ {
+ dlgInputs.prompt = prompt;
+ }
+ /**
+ * Get the dialog prompt.
+ * By default, uses what was given in setDialogPrompt
+ */
+ public String getDialogPrompt()
+ {
+ return dlgInputs.prompt;
+ }
+
+ /**
+ * Set the dialog's filter name prompt text and tooltip
+ * Either call this or override getDialogFilterNamePrompt/Tip()
+ */
+ public void setDialogFilterNamePrompt(String prompt, String tip)
+ {
+ dlgInputs.filterNamePrompt = prompt;
+ dlgInputs.filterNameTip = tip;
+ }
+ /**
+ * Get the dialog's filter name prompt text.
+ * By default, uses what was given in setDialogFilterNamePrompt.
+ */
+ public String getDialogFilterFilterNamePrompt()
+ {
+ return dlgInputs.filterNamePrompt;
+ }
+ /**
+ * Get the dialog's filter name tooltip text.
+ * By default, uses what was given in setDialogFilterNamePrompt.
+ */
+ public String getDialogFilterNameTip()
+ {
+ return dlgInputs.filterNameTip;
+ }
+
+ /**
+ * Set the dialog's pre-select information.
+ * Either call this or override getDialogPreSelectInput()
+ */
+ public void setDialogPreSelectInput(Object selectData)
+ {
+ dlgInputs.preSelectObject = selectData;
+ }
+ /**
+ * Get the dialog's pre-select information.
+ * By default, uses what was given in setDialogPreSelectInput.
+ */
+ public Object getDialogPreSelectInput()
+ {
+ return dlgInputs.preSelectObject;
+ }
+
+
+ // -------------------------
+ // PARENT CLASS OVERRIDES...
+ // -------------------------
+
+ /**
+ * Called by SystemBaseAction when selection is set.
+ * Our opportunity to verify we are allowed for this selected type.
+ */
+ public boolean checkObjectType(Object selectedObject)
+ {
+ return true;
+ //return (selectedObject instanceof SystemFilterPoolReferenceManagerProvider); // override as appropriate
+ }
+
+ /**
+ * Extends run in parent class to call doOKprocessing if the result of calling
+ * getDialogValue() resulted in a non-null value.
+ */
+ public void run()
+ {
+ super.run();
+ if (getValue() != null)
+ doOKprocessing(getValue());
+ }
+
+
+ /**
+ * Overrides parent method to allow creating of a dialog meeting our interface,
+ * so we can pass instance of ourselves to it for callbacks to get our data.
+ *
+ * If your dialog does not implement our interface, override this method!
+ */
+ protected Dialog createDialog(Shell parent)
+ {
+ SystemFilterDialogInterface fDlg = createFilterDialog(parent);
+ fDlg.setFilterDialogActionCaller(this);
+ return (Dialog)fDlg;
+ }
+
+ /**
+ * Where you create the dialog meeting our interface. If you override
+ * createDialog, then override this to return null
+ */
+ public abstract SystemFilterDialogInterface createFilterDialog(Shell parent);
+
+ /**
+ * If you decide to use the supplied run method as is,
+ * then you must override this method to retrieve the data
+ * from the dialog. For InputDialog dialogs, this is simply
+ * a matter of return dlg.getValue();
+ *
+ * This is called by the run method after the dialog returns. Callers
+ * of this object can subsequently retrieve it by calling getValue.
+ *
+ * @param dlg The dialog object, after it has returned from open.
+ */
+ protected abstract Object getDialogValue(Dialog dlg);
+
+ /**
+ * Method called when ok pressed on dialog and after getDialogValue has set the
+ * value attribute appropriately.
+ *
+ * Only called if user pressed OK on dialog.
+ *
+ * @param dlgValue The output of getDialogValue().
+ */
+ public abstract void doOKprocessing(Object dlgValue);
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterAbstractFilterPoolAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterAbstractFilterPoolAction.java
new file mode 100644
index 00000000000..6d2aef0ae33
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterAbstractFilterPoolAction.java
@@ -0,0 +1,495 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.filters.actions;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.rse.filters.ISystemFilter;
+import org.eclipse.rse.filters.ISystemFilterPool;
+import org.eclipse.rse.filters.ISystemFilterPoolManager;
+import org.eclipse.rse.filters.ISystemFilterPoolManagerProvider;
+import org.eclipse.rse.filters.ISystemFilterPoolReference;
+import org.eclipse.rse.filters.ISystemFilterPoolReferenceManager;
+import org.eclipse.rse.filters.ISystemFilterPoolReferenceManagerProvider;
+import org.eclipse.rse.filters.ISystemFilterReference;
+import org.eclipse.rse.filters.ISystemFilterString;
+import org.eclipse.rse.filters.ISystemFilterStringReference;
+import org.eclipse.rse.ui.actions.SystemBaseDialogAction;
+import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
+import org.eclipse.rse.ui.filters.SystemFilterPoolDialogInputs;
+import org.eclipse.rse.ui.filters.SystemFilterPoolDialogInterface;
+import org.eclipse.swt.widgets.Shell;
+
+
+
+/**
+ * Base class capturing the attributes and operations common to dialog actions
+ * that work on system filter pools.
+ */
+public abstract class SystemFilterAbstractFilterPoolAction
+ extends SystemBaseDialogAction
+
+{
+
+
+ protected SystemFilterPoolDialogInputs dlgInputs;
+ protected String mgrNamePreselect;
+
+ /**
+ * Constructor when given the translated action label
+ */
+ public SystemFilterAbstractFilterPoolAction(Shell parent, String title)
+ {
+ super(title, null, parent);
+ allowOnMultipleSelection(false);
+ init();
+ }
+
+ /**
+ * Constructor when given the translated action label
+ */
+ public SystemFilterAbstractFilterPoolAction(Shell parent, String title, String tooltip)
+ {
+ super(title, tooltip, null, parent);
+ allowOnMultipleSelection(false);
+ init();
+ }
+
+
+
+ /**
+ * Constructor when given the resource bundle and key for the action label
+ */
+ public SystemFilterAbstractFilterPoolAction(Shell parent, ImageDescriptor image, String label, String tooltip)
+ {
+ super(label, tooltip, image, parent);
+ allowOnMultipleSelection(false);
+ init();
+ }
+
+ /**
+ * Common initialization code
+ */
+ protected void init()
+ {
+ dlgInputs = new SystemFilterPoolDialogInputs();
+ }
+
+ // ----------------------------
+ // HELP ID SETTINGS...
+ // ----------------------------
+
+ /**
+ * Set the help context Id (infoPop) for this action. This must be fully qualified by
+ * plugin ID.
+ *
+ * Same as {@link org.eclipse.rse.ui.actions.SystemBaseAction #setHelp(String)}
+ * @see org.eclipse.rse.ui.actions.SystemBaseAction #getHelpContextId()
+ */
+ public void setHelpContextId(String id)
+ {
+ setHelp(id);
+ }
+
+ // --------------------------------------
+ // SELECTION CHANGED INTERCEPT METHODS...
+ // --------------------------------------
+
+ /**
+ * This is called by the UI calling the action, if that UI is not a selection provider.
+ * That is, this is an alternative to calling selectionChanged when there is no SelectionChangedEvent.
+ * @see #selectionChanged(SelectionChangedEvent event)
+ */
+ public void setSelection(ISelection selection)
+ {
+ super.setSelection(selection);
+ Object firstSelection = getFirstSelection();
+ if (isEnabled() && (firstSelection != null))
+ {
+ if (firstSelection instanceof SystemSimpleContentElement)
+ firstSelection = ((SystemSimpleContentElement)firstSelection).getData();
+
+ if (firstSelection instanceof ISystemFilterPoolManagerProvider)
+ setFilterPoolManagerProvider((ISystemFilterPoolManagerProvider)firstSelection);
+ else if (firstSelection instanceof ISystemFilterPoolManager)
+ setFilterPoolManagerProvider(((ISystemFilterPoolManager)firstSelection).getProvider());
+ else if (firstSelection instanceof ISystemFilterPool)
+ setFilterPoolManagerProvider(((ISystemFilterPool)firstSelection).getProvider());
+ else if (firstSelection instanceof ISystemFilter)
+ setFilterPoolManagerProvider(((ISystemFilter)firstSelection).getProvider());
+ else if (firstSelection instanceof ISystemFilterString)
+ setFilterPoolManagerProvider(((ISystemFilterString)firstSelection).getProvider());
+
+ else if (firstSelection instanceof ISystemFilterPoolReferenceManagerProvider)
+ setFilterPoolReferenceManager(((ISystemFilterPoolReferenceManagerProvider)firstSelection).getSystemFilterPoolReferenceManager());
+ else if (firstSelection instanceof ISystemFilterPoolReferenceManager)
+ setFilterPoolReferenceManager((ISystemFilterPoolReferenceManager)firstSelection);
+ else if (firstSelection instanceof ISystemFilterPoolReference)
+ setFilterPoolReferenceManager(((ISystemFilterPoolReference)firstSelection).getFilterPoolReferenceManager());
+ else if (firstSelection instanceof ISystemFilterReference)
+ setFilterPoolReferenceManager(((ISystemFilterReference)firstSelection).getFilterPoolReferenceManager());
+ else if (firstSelection instanceof ISystemFilterStringReference)
+ setFilterPoolReferenceManager(((ISystemFilterStringReference)firstSelection).getFilterPoolReferenceManager());
+ }
+ }
+
+ // ----------------------------
+ // ATTRIBUTE GETTERS/SETTERS...
+ // ----------------------------
+
+ /**
+ * Set the input filter pool manager provider from which to get the list of filter pool managers.
+ * Either call this or call setFilterPoolManagers or override getFilterPoolManagerProvider().
+ */
+ public void setFilterPoolManagerProvider(ISystemFilterPoolManagerProvider provider)
+ {
+ dlgInputs.poolManagerProvider = provider;
+ //setFilterPoolManagers(provider.getSystemFilterPoolManagers());
+ }
+
+ /**
+ * Get the input filter pool manager provider from which to get the list of filter pool managers.
+ */
+ public ISystemFilterPoolManagerProvider getFilterPoolManagerProvider()
+ {
+ //if (dlgInputs.poolManagerProvider != null)
+ return dlgInputs.poolManagerProvider;
+ //else if ((dlgInputs.poolManagers != null) && (dlgInputs.poolManagers.length > 0))
+ //return dlgInputs.poolManagers[0].getProvider();
+ //else
+ //return null;
+ }
+
+ /**
+ * Set the input filter pool managers from which to allow selections of filter pools.
+ * Either call this or call setFilterPoolManagerProvider or override getFilterPoolManagers().
+ */
+ public void setFilterPoolManagers(ISystemFilterPoolManager[] managers)
+ {
+ dlgInputs.poolManagers = managers;
+ }
+
+ /**
+ * Returns the filter pool managers from which to show filter pools for selection.
+ *
+ * By default, tries the following in this order:
+ *
+ * If not set, then the subclass needs to override doOKprocessing.
+ */
+ public ISystemFilterPoolReferenceManager getFilterPoolReferenceManager()
+ {
+ return dlgInputs.refManager;
+ }
+
+ /**
+ * Set the dialog title.
+ * Either call this or override getDialogTitle()
+ */
+ public void setDialogTitle(String title)
+ {
+ dlgInputs.title = title;
+ }
+ /**
+ * Get the dialog title.
+ * By default, uses what was given in setDialogTitle, or an english default if nothing set.
+ */
+ public String getDialogTitle()
+ {
+ return dlgInputs.title;
+ }
+
+ /**
+ * Set the dialog prompt text.
+ * Either call this or override getDialogPrompt()
+ */
+ public void setDialogPrompt(String prompt)
+ {
+ dlgInputs.prompt = prompt;
+ }
+ /**
+ * Get the dialog prompt.
+ * By default, uses what was given in setDialogPrompt
+ */
+ public String getDialogPrompt()
+ {
+ return dlgInputs.prompt;
+ }
+
+ /**
+ * Set the dialog's filter pool name prompt text and tooltip
+ * Either call this or override getDialogFilterPoolNamePrompt/Tip()
+ */
+ public void setDialogFilterPoolNamePrompt(String prompt, String tip)
+ {
+ dlgInputs.poolNamePrompt = prompt;
+ dlgInputs.poolNameTip = tip;
+ }
+ /**
+ * Get the dialog's filter pool name prompt text.
+ * By default, uses what was given in setDialogFilterPoolNamePrompt.
+ */
+ public String getDialogFilterPoolNamePrompt()
+ {
+ return dlgInputs.poolNamePrompt;
+ }
+ /**
+ * Get the dialog's filter pool name tooltip text.
+ * By default, uses what was given in setDialogFilterPoolNamePrompt.
+ */
+ public String getDialogFilterPoolNameTip()
+ {
+ return dlgInputs.poolNameTip;
+ }
+
+ /**
+ * Set the dialog's filter pool manager name prompt text and tooltip
+ * Either call this or override getDialogFilterPoolManagerNamePrompt/Tip()
+ */
+ public void setDialogFilterPoolManagerNamePrompt(String prompt, String tip)
+ {
+ dlgInputs.poolMgrNamePrompt = prompt;
+ dlgInputs.poolMgrNameTip = tip;
+ }
+ /**
+ * Get the dialog's filter pool manager name prompt text.
+ * By default, uses what was given in setDialogFilterPoolManagerNamePrompt.
+ */
+ public String getDialogFilterPoolManagerNamePrompt()
+ {
+ return dlgInputs.poolMgrNamePrompt;
+ }
+ /**
+ * Get the dialog's filter pool manager name tooltip text.
+ * By default, uses what was given in setDialogFilterPoolManagerNamePrompt.
+ */
+ public String getDialogFilterPoolManagerNameTip()
+ {
+ return dlgInputs.poolMgrNameTip;
+ }
+
+ /**
+ * Set the dialog's pre-select information.
+ * Either call this or override getDialogPreSelectInput()
+ */
+ public void setDialogPreSelectInput(Object selectData)
+ {
+ dlgInputs.preSelectObject = selectData;
+ }
+ /**
+ * Get the dialog's pre-select information.
+ * By default, uses what was given in setDialogPreSelectInput.
+ */
+ public Object getDialogPreSelectInput()
+ {
+ return dlgInputs.preSelectObject;
+ }
+
+
+ // -------------------------
+ // PARENT CLASS OVERRIDES...
+ // -------------------------
+
+ /**
+ * Called by SystemBaseAction when selection is set.
+ * Our opportunity to verify we are allowed for this selected type.
+ */
+ public boolean checkObjectType(Object selectedObject)
+ {
+ return (selectedObject instanceof ISystemFilterPoolReferenceManagerProvider); // override as appropriate
+ }
+
+
+ /**
+ * Walk elements deciding pre-selection
+ */
+ protected void preSelect(SystemSimpleContentElement inputElement)
+ {
+ SystemSimpleContentElement[] mgrElements = inputElement.getChildren();
+ for (int idx=0; idx
+ * If your dialog does not implement our interface, override this method!
+ */
+ protected Dialog createDialog(Shell parent)
+ {
+ SystemFilterPoolDialogInterface fpDlg = createFilterPoolDialog(parent);
+ fpDlg.setFilterPoolDialogActionCaller(this);
+ return (Dialog)fpDlg;
+ }
+
+ /**
+ * Where you create the dialog meeting our interface. If you override
+ * createDialog, then override this to return null
+ */
+ public abstract SystemFilterPoolDialogInterface createFilterPoolDialog(Shell parent);
+
+ /**
+ * If you decide to use the supplied run method as is,
+ * then you must override this method to retrieve the data
+ * from the dialog. For InputDialog dialogs, this is simply
+ * a matter of returning dlg.getValue();
+ *
+ * This is called by the run method after the dialog returns. Callers
+ * of this object can subsequently retrieve it by calling getValue.
+ *
+ * @param dlg The dialog object, after it has returned from open.
+ */
+ protected abstract Object getDialogValue(Dialog dlg);
+
+ /**
+ * Method called when ok pressed on dialog and after getDialogValue has set the
+ * value attribute appropriately.
+ *
+ * Only called if user pressed OK on dialog.
+ *
+ * @param dlgValue The output of getDialogValue().
+ */
+ public abstract void doOKprocessing(Object dlgValue);
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterAbstractFilterPoolWizardAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterAbstractFilterPoolWizardAction.java
new file mode 100644
index 00000000000..8c25200ed58
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterAbstractFilterPoolWizardAction.java
@@ -0,0 +1,87 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.filters.actions;
+
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.filters.SystemFilterPoolDialogInterface;
+import org.eclipse.rse.ui.filters.dialogs.SystemFilterPoolWizardDialog;
+import org.eclipse.rse.ui.filters.dialogs.SystemFilterPoolWizardInterface;
+import org.eclipse.swt.widgets.Shell;
+
+
+public abstract class SystemFilterAbstractFilterPoolWizardAction
+ extends SystemFilterAbstractFilterPoolAction
+{
+
+
+
+ /**
+ * Constructor for SystemFilterAbstactFilterPoolWizardAction
+ */
+ public SystemFilterAbstractFilterPoolWizardAction(Shell parent, String title)
+ {
+ super(parent, title);
+ setContextMenuGroup(ISystemContextMenuConstants.GROUP_NEW);
+ }
+
+
+
+ /**
+ * Constructor for SystemFilterAbstactFilterPoolWizardAction
+ */
+ public SystemFilterAbstractFilterPoolWizardAction(Shell parent, ImageDescriptor image,
+ String label, String tooltip)
+ {
+ super(parent, image, label, tooltip);
+ setContextMenuGroup(ISystemContextMenuConstants.GROUP_NEW);
+ }
+
+ /**
+ * @see SystemFilterAbstractFilterPoolAction#doOKprocessing(Object)
+ */
+ public void doOKprocessing(Object dlgValue)
+ {
+ }
+
+ /**
+ * @see SystemFilterAbstractFilterPoolAction#getDialogValue(Dialog)
+ */
+ protected Object getDialogValue(Dialog dlg)
+ {
+ return null;
+ }
+
+ /**
+ * @see SystemFilterAbstractFilterPoolAction#createFilterPoolDialog(Shell)
+ */
+ public SystemFilterPoolDialogInterface createFilterPoolDialog(Shell parent)
+ {
+ SystemFilterPoolWizardInterface newWizard = getFilterPoolWizard();
+ SystemFilterPoolDialogInterface dialog =
+ new SystemFilterPoolWizardDialog(parent, newWizard);
+ return dialog;
+ }
+
+ /**
+ * Return the wizard so we can customize it prior to showing it.
+ */
+ public abstract SystemFilterPoolWizardInterface getFilterPoolWizard();
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterAbstractFilterWizardAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterAbstractFilterWizardAction.java
new file mode 100644
index 00000000000..7a6909fd32a
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterAbstractFilterWizardAction.java
@@ -0,0 +1,85 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.filters.actions;
+
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.filters.SystemFilterDialogInterface;
+import org.eclipse.rse.ui.filters.dialogs.ISystemFilterWizard;
+import org.eclipse.rse.ui.filters.dialogs.SystemFilterWizardDialog;
+import org.eclipse.swt.widgets.Shell;
+
+
+public abstract class SystemFilterAbstractFilterWizardAction
+ extends SystemFilterAbstractFilterAction
+{
+
+
+
+ /**
+ * Constructor for SystemFilterAbstactFilterWizardAction
+ */
+ public SystemFilterAbstractFilterWizardAction(Shell parent, String title)
+ {
+ super(parent, title);
+ setContextMenuGroup(ISystemContextMenuConstants.GROUP_NEW);
+ }
+
+ /**
+ * Constructor for SystemFilterAbstactFilterWizardAction
+ */
+ public SystemFilterAbstractFilterWizardAction(Shell parent, String label, String tooltip)
+ {
+ super(parent, label, tooltip);
+ setContextMenuGroup(ISystemContextMenuConstants.GROUP_NEW);
+ }
+
+ /**
+ * @see SystemFilterAbstractFilterAction#doOKprocessing(Object)
+ */
+ public void doOKprocessing(Object dlgValue)
+ {
+ }
+
+ /**
+ * @see SystemFilterAbstractFilterAction#getDialogValue(Dialog)
+ */
+ protected Object getDialogValue(Dialog dlg)
+ {
+ return null;
+ }
+
+ /**
+ * @see SystemFilterAbstractFilterAction#createFilterDialog(Shell)
+ */
+ public SystemFilterDialogInterface createFilterDialog(Shell parent)
+ {
+ ISystemFilterWizard newWizard = getFilterWizard();
+
+ SystemFilterDialogInterface dialog =
+ new SystemFilterWizardDialog(parent, newWizard);
+
+ return dialog;
+ }
+
+ /**
+ * Return the wizard so we can customize it prior to showing it.
+ */
+ public abstract ISystemFilterWizard getFilterWizard();
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterCascadingNewFilterPoolReferenceAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterCascadingNewFilterPoolReferenceAction.java
new file mode 100644
index 00000000000..d6a6fc5bd19
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterCascadingNewFilterPoolReferenceAction.java
@@ -0,0 +1,135 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.filters.actions;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.filters.ISystemFilterPoolManager;
+import org.eclipse.rse.filters.ISystemFilterPoolReferenceManager;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.actions.SystemBaseAction;
+import org.eclipse.rse.ui.actions.SystemBaseSubMenuAction;
+import org.eclipse.rse.ui.view.SystemViewMenuListener;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * A cascading menu action for "New Filter Pool Reference->"
+ */
+public class SystemFilterCascadingNewFilterPoolReferenceAction
+ extends SystemBaseSubMenuAction
+ implements IMenuListener
+{
+ private ISystemFilterPoolReferenceManager refMgr;
+
+ /**
+ * Constructor when reference mgr not available. Must call setSystemFilterPoolReferenceManager.
+ */
+ public SystemFilterCascadingNewFilterPoolReferenceAction(Shell shell)
+ {
+ this(shell, null);
+ }
+
+ /**
+ * Constructor when reference mgr is available. No need to call setSystemFilterPoolReferenceManager.
+ */
+ public SystemFilterCascadingNewFilterPoolReferenceAction(Shell shell, ISystemFilterPoolReferenceManager refMgr)
+ {
+ super(SystemResources.ACTION_CASCADING_FILTERPOOL_NEWREFERENCE_LABEL, SystemResources.ACTION_CASCADING_FILTERPOOL_NEWREFERENCE_TOOLTIP,
+ SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_NEWFILTERPOOLREF_ID),shell);
+ setCreateMenuEachTime(false);
+ setPopulateMenuEachTime(false);
+ setContextMenuGroup(ISystemContextMenuConstants.GROUP_NEW);
+ this.refMgr = refMgr;
+ }
+
+ /**
+ * Set the help context Id (infoPop) for this action. This must be fully qualified by
+ * plugin ID.
+ *
+ * Same as {@link org.eclipse.rse.ui.actions.SystemBaseAction #setHelp(String)}
+ * @see org.eclipse.rse.ui.actions.SystemBaseAction #getHelpContextId()
+ */
+ public void setHelpContextId(String id)
+ {
+ setHelp(id);
+ }
+
+ /**
+ * @see SystemBaseSubMenuAction#getSubMenu()
+ */
+ public IMenuManager populateSubMenu(IMenuManager menu)
+ {
+ menu.addMenuListener(this);
+ menu.setRemoveAllWhenShown(true);
+ //menu.setEnabled(true);
+ menu.add(new SystemBaseAction("dummy",null));
+ return menu;
+ }
+
+ /**
+ * Set the master filter pool reference manager from which the filter pools are to be selectable,
+ * and into which we will add the filter pool reference
+ */
+ public void setSystemFilterPoolReferenceManager(ISystemFilterPoolReferenceManager refMgr)
+ {
+ this.refMgr = refMgr;
+ }
+
+ /**
+ * Called when submenu is about to show
+ */
+ public void menuAboutToShow(IMenuManager ourSubMenu)
+ {
+ Shell shell = getShell();
+ ISystemFilterPoolManager[] mgrs = refMgr.getSystemFilterPoolManagers();
+ SystemFilterCascadingNewFilterPoolReferenceFPMgrAction action = null;
+ ISystemFilterPoolManager mgr = null;
+ ISystemFilterPoolManager defaultMgr = refMgr.getDefaultSystemFilterPoolManager();
+ String helpId = getHelpContextId();
+ if (defaultMgr != null)
+ {
+ action = new SystemFilterCascadingNewFilterPoolReferenceFPMgrAction(shell, defaultMgr, refMgr);
+ if (helpId != null)
+ action.setHelp(helpId);
+ ourSubMenu.add(action.getSubMenu());
+ }
+ for (int idx=0; idx
+ * Same as {@link org.eclipse.rse.ui.actions.SystemBaseAction #setHelp(String)}
+ * @see org.eclipse.rse.ui.actions.SystemBaseAction #getHelpContextId()
+ */
+ public void setHelpContextId(String id)
+ {
+ setHelp(id);
+ }
+
+ /**
+ * @see SystemBaseSubMenuAction#getSubMenu()
+ */
+ public IMenuManager populateSubMenu(IMenuManager menu)
+ {
+ menu.addMenuListener(this);
+ menu.setRemoveAllWhenShown(true);
+ //menu.setEnabled(true);
+ menu.add(new SystemBaseAction("dummy",null));
+ return menu;
+ }
+
+ /**
+ * Called when submenu is about to show
+ */
+ public void menuAboutToShow(IMenuManager ourSubMenu)
+ {
+ //System.out.println("inside menu about to show");
+ ISystemFilterPool[] pools = mgr.getSystemFilterPools();
+ SystemFilterPoolReferenceSelectAction action = null;
+ ISystemFilterPool pool = null;
+ Shell shell = getShell();
+ String helpId = getHelpContextId();
+ for (int idx=0; idx
+ * @see SystemBaseAction#updateSelection(IStructuredSelection)
+ */
+ public boolean updateSelection(IStructuredSelection selection)
+ {
+ boolean enable = true;
+ /* */
+ Iterator e= ((IStructuredSelection) selection).iterator();
+ while (enable && e.hasNext())
+ {
+ Object selectedObject = e.next();
+ if (selectedObject instanceof SystemSimpleContentElement)
+ selectedObject = ((SystemSimpleContentElement)selectedObject).getData();
+ if (!checkObjectType(selectedObject))
+ enable = false;
+ }
+ /* */
+ return enable;
+ }
+ /**
+ * Called by SystemBaseAction when selection is set.
+ * Our opportunity to verify we are allowed for this selected type.
+ */
+ public boolean checkObjectType(Object selectedObject)
+ {
+ if (selectedObject instanceof ISystemFilter)
+ {
+ ISystemFilter fs = (ISystemFilter)selectedObject;
+ return !fs.isNonChangable();
+ }
+ else if (selectedObject instanceof ISystemFilterReference)
+ {
+ ISystemFilter fs = ((ISystemFilterReference)selectedObject).getReferencedFilter();
+ return !fs.isNonChangable();
+ }
+ else
+ return false;
+ }
+
+ // --------------------------
+ // PARENT METHOD OVERRIDES...
+ // --------------------------
+ /**
+ * This method is a callback from the select-target-parent dialog, allowing us to decide whether the current selected
+ * object is a valid parent object. This affects the enabling of the OK button on that dialog.
+ */
+ public boolean isValidTargetParent(SystemSimpleContentElement selectedElement)
+ {
+ if (selectedElement == null)
+ return false;
+ Object data = selectedElement.getData();
+ return (data instanceof ISystemFilterPool);
+ }
+
+ /**
+ * @see SystemBaseCopyAction#checkForCollision(Shell, IProgressMonitor, Object, Object, String)
+ */
+ protected String checkForCollision(Shell shell, IProgressMonitor monitor,
+ Object targetContainer, Object oldObject, String oldName)
+ {
+ ISystemFilterPool newPool = (ISystemFilterPool)targetContainer;
+ ISystemFilterPoolManager newMgr = newPool.getSystemFilterPoolManager();
+ String newName = oldName;
+ ISystemFilter match = newPool.getSystemFilter(oldName);
+ if (match != null)
+ {
+ //monitor.setVisible(false); wish we could!
+ //ValidatorFilterName validator = new ValidatorFilterName(newPool.getSystemFilterNames());
+ //SystemCollisionRenameDialog dlg = new SystemCollisionRenameDialog(shell, validator, oldName);
+ SystemRenameSingleDialog dlg = new SystemRenameSingleDialog(shell, true, match, null); // true => copy-collision-mode
+ dlg.open();
+ if (!dlg.wasCancelled())
+ newName = dlg.getNewName();
+ else
+ newName = null;
+ }
+ return newName;
+ }
+ /**
+ * @see SystemBaseCopyAction#doCopy(IProgressMonitor, Object, Object, String)
+ */
+ protected boolean doCopy(IProgressMonitor monitor, Object targetContainer, Object oldObject, String newName)
+ throws Exception
+ {
+ ISystemFilter oldFilter = (ISystemFilter)oldObject;
+ ISystemFilterPool oldFilterPool = oldFilter.getParentFilterPool();
+ ISystemFilterPoolManager oldMgr = oldFilterPool.getSystemFilterPoolManager();
+ ISystemFilterPool newPool = (ISystemFilterPool)targetContainer;
+ ISystemFilterPoolManager newMgr = newPool.getSystemFilterPoolManager();
+
+ ISystemFilter newFilter = oldMgr.copySystemFilter(newPool, oldFilter, newName);
+
+ if ((root != null) && (newFilter!=null))
+ {
+ Object data = root.getData();
+ if ((data!=null) && (data instanceof TreeViewer))
+ ((TreeViewer)data).refresh();
+ }
+ return (newFilter != null);
+ }
+
+ /**
+ * @see SystemBaseCopyAction#getTreeModel()
+ */
+ protected SystemSimpleContentElement getTreeModel()
+ {
+ ISystemFilter firstFilter = getFirstSelectedFilter();
+ ISystemFilterPoolManagerProvider provider = firstFilter.getProvider();
+ return getPoolMgrTreeModel(provider, firstFilter.getSystemFilterPoolManager());
+ }
+ /**
+ * @see SystemBaseCopyAction#getTreeInitialSelection()
+ */
+ protected SystemSimpleContentElement getTreeInitialSelection()
+ {
+ return initialSelectionElement;
+ }
+
+ /**
+ * Set the prompt string that shows up at the top of the copy-destination dialog.
+ */
+ public void setPromptString(String promptString)
+ {
+ this.promptString = promptString;
+ }
+ /**
+ * @see SystemBaseCopyAction#getPromptString()
+ */
+ protected String getPromptString()
+ {
+ return promptString;
+ }
+ /**
+ * @see SystemBaseCopyAction#getCopyingMessage()
+ */
+ protected SystemMessage getCopyingMessage()
+ {
+ return SystemPlugin.getPluginMessage(MSG_COPYFILTERS_PROGRESS);
+ }
+ /**
+ * @see SystemBaseCopyAction#getCopyingMessage(String)
+ */
+ protected SystemMessage getCopyingMessage(String oldName)
+ {
+ return SystemPlugin.getPluginMessage(MSG_COPYFILTER_PROGRESS).makeSubstitution(oldName);
+ }
+
+ /**
+ * @see SystemBaseCopyAction#getOldObjects()
+ */
+ protected Object[] getOldObjects()
+ {
+ return getSelectedFilters();
+ }
+
+ /**
+ * @see SystemBaseCopyAction#getOldNames()
+ */
+ protected String[] getOldNames()
+ {
+ ISystemFilter[] filters = getSelectedFilters();
+ String[] names = new String[filters.length];
+ for (int idx=0; idx
+ * @see SystemBaseAction#updateSelection(IStructuredSelection)
+ */
+ public boolean updateSelection(IStructuredSelection selection)
+ {
+ boolean enable = true;
+ /* */
+ Iterator e= ((IStructuredSelection) selection).iterator();
+ while (enable && e.hasNext())
+ {
+ Object selectedObject = e.next();
+ if (selectedObject instanceof SystemSimpleContentElement)
+ selectedObject = ((SystemSimpleContentElement)selectedObject).getData();
+ if (!(selectedObject instanceof ISystemFilterPool) &&
+ !(selectedObject instanceof ISystemFilterPoolReference))
+ enable = false;
+ // disable if this is a connection-unique filter pool
+ else if (selectedObject instanceof ISystemFilterPool)
+ enable = ((ISystemFilterPool)selectedObject).getOwningParentName() == null;
+ // disable if this is a connection-unique filter pool
+ else if (selectedObject instanceof ISystemFilterPoolReference)
+ enable = ((ISystemFilterPoolReference)selectedObject).getReferencedFilterPool().getOwningParentName() == null;
+ }
+ /* */
+ return enable;
+ }
+
+ // --------------------------
+ // PARENT METHOD OVERRIDES...
+ // --------------------------
+ /**
+ * This method is a callback from the select-target-parent dialog, allowing us to decide whether the current selected
+ * object is a valid parent object. This affects the enabling of the OK button on that dialog.
+ */
+ public boolean isValidTargetParent(SystemSimpleContentElement selectedElement)
+ {
+ if (selectedElement == null)
+ return false;
+ Object data = selectedElement.getData();
+ return (data instanceof ISystemFilterPoolManager);
+ }
+
+ /**
+ * @see SystemBaseCopyAction#checkForCollision(Shell, IProgressMonitor, Object, Object, String)
+ */
+ protected String checkForCollision(Shell shell, IProgressMonitor monitor,
+ Object targetContainer, Object oldObject, String oldName)
+ {
+ ISystemFilterPoolManager newMgr = (ISystemFilterPoolManager)targetContainer;
+ String newName = oldName;
+ //SystemFilterPool oldFilterPool = (SystemFilterPool)oldObject;
+ ISystemFilterPool match = newMgr.getSystemFilterPool(oldName);
+ if (match != null)
+ {
+ //monitor.setVisible(false); wish we could!
+ //ValidatorFilterPoolName validator = new ValidatorFilterPoolName(newMgr.getSystemFilterPoolNames());
+ //SystemCollisionRenameDialog dlg = new SystemCollisionRenameDialog(shell, validator, oldName);
+ SystemRenameSingleDialog dlg = new SystemRenameSingleDialog(shell, true, match, null); // true => copy-collision-mode
+ dlg.open();
+ if (!dlg.wasCancelled())
+ newName = dlg.getNewName();
+ else
+ newName = null;
+ }
+ return newName;
+ }
+ /**
+ * @see SystemBaseCopyAction#doCopy(IProgressMonitor, Object, Object, String)
+ */
+ protected boolean doCopy(IProgressMonitor monitor, Object targetContainer, Object oldObject, String newName)
+ throws Exception
+ {
+ ISystemFilterPool oldFilterPool = (ISystemFilterPool)oldObject;
+ ISystemFilterPoolManager oldMgr = oldFilterPool.getSystemFilterPoolManager();
+ ISystemFilterPoolManager newMgr = (ISystemFilterPoolManager)targetContainer;
+ ISystemFilterPool newFilterPool = oldMgr.copySystemFilterPool(newMgr, oldFilterPool, newName);
+ if ((root != null) && (newFilterPool!=null))
+ {
+ Object data = root.getData();
+ if ((data!=null) && (data instanceof TreeViewer))
+ ((TreeViewer)data).refresh();
+ }
+ return (newFilterPool != null);
+ }
+
+ /**
+ * @see SystemBaseCopyAction#getTreeModel()
+ */
+ protected SystemSimpleContentElement getTreeModel()
+ {
+ ISystemFilterPool firstPool = getFirstSelectedFilterPool();
+ ISystemFilterPoolManagerProvider provider = firstPool.getProvider();
+ return getPoolMgrTreeModel(provider, firstPool.getSystemFilterPoolManager());
+ }
+ /**
+ * @see SystemBaseCopyAction#getTreeInitialSelection()
+ */
+ protected SystemSimpleContentElement getTreeInitialSelection()
+ {
+ return initialSelectionElement;
+ }
+
+ /**
+ * Set the prompt string that shows up at the top of the copy-destination dialog.
+ */
+ public void setPromptString(String promptString)
+ {
+ this.promptString = promptString;
+ }
+ /**
+ * @see SystemBaseCopyAction#getPromptString()
+ */
+ protected String getPromptString()
+ {
+ //return SystemResources.RESID_COPY_TARGET_PROFILE_PROMPT);
+ return promptString;
+ }
+ /**
+ * @see SystemBaseCopyAction#getCopyingMessage()
+ */
+ protected SystemMessage getCopyingMessage()
+ {
+ return SystemPlugin.getPluginMessage(MSG_COPYFILTERPOOLS_PROGRESS);
+ }
+ /**
+ * @see SystemBaseCopyAction#getCopyingMessage(String)
+ */
+ protected SystemMessage getCopyingMessage(String oldName)
+ {
+ return SystemPlugin.getPluginMessage(MSG_COPYFILTERPOOL_PROGRESS).makeSubstitution(oldName);
+ }
+ /**
+ * Return complete message
+ */
+ public SystemMessage getCompletionMessage(Object targetContainer, String[] oldNames, String[] newNames)
+ {
+ return SystemPlugin.getPluginMessage(MSG_COPYFILTERPOOL_COMPLETE).makeSubstitution(((ISystemFilterPoolManager)targetContainer).getName());
+ }
+
+ /**
+ * @see SystemBaseCopyAction#getOldObjects()
+ */
+ protected Object[] getOldObjects()
+ {
+ return getSelectedFilterPools();
+ }
+
+ /**
+ * @see SystemBaseCopyAction#getOldNames()
+ */
+ protected String[] getOldNames()
+ {
+ ISystemFilterPool[] filterPools = getSelectedFilterPools();
+ String[] names = new String[filterPools.length];
+ for (int idx=0; idx
+ * @see SystemBaseAction#updateSelection(IStructuredSelection)
+ */
+ public boolean updateSelection(IStructuredSelection selection)
+ {
+ boolean enable = true;
+ /* */
+ Iterator e= ((IStructuredSelection) selection).iterator();
+ while (enable && e.hasNext())
+ {
+ Object selectedObject = e.next();
+ if (selectedObject instanceof SystemSimpleContentElement)
+ selectedObject = ((SystemSimpleContentElement)selectedObject).getData();
+ if (!checkObjectType(selectedObject))
+ enable = false;
+ }
+ /* */
+ return enable;
+ }
+ /**
+ * Called by SystemBaseAction when selection is set.
+ * Our opportunity to verify we are allowed for this selected type.
+ */
+ public boolean checkObjectType(Object selectedObject)
+ {
+ if (selectedObject instanceof ISystemFilterString)
+ {
+ ISystemFilterString fs = (ISystemFilterString)selectedObject;
+ return fs.isChangable();
+ }
+ else if (selectedObject instanceof ISystemFilterStringReference)
+ {
+ ISystemFilterStringReference frs = (ISystemFilterStringReference)selectedObject;
+ return frs.getReferencedFilterString().isChangable();
+ }
+ else
+ return false;
+ }
+
+ // --------------------------
+ // PARENT METHOD OVERRIDES...
+ // --------------------------
+ /**
+ * This method is a callback from the select-target-parent dialog, allowing us to decide whether the current selected
+ * object is a valid parent object. This affects the enabling of the OK button on that dialog.
+ *
+ * The default is to return true if the selected element has no children. This is sufficient for most cases. However,
+ * in some cases it is not, such as for filter strings where we want to only enable OK if a filter is selected. It is
+ * possible that filter pools have no filters, so the default algorithm is not sufficient. In these cases the child class
+ * can override this method.
+ */
+ public boolean isValidTargetParent(SystemSimpleContentElement selectedElement)
+ {
+ Object data = selectedElement.getData();
+ if (data instanceof ISystemFilter)
+ return !((ISystemFilter)data).isPromptable();
+ else
+ return false;
+ }
+
+ /**
+ * Overridable entry point when you want to prevent any copies/moves if any of the
+ * selected objects have a name collision.
+ *
+ * If you decide to override this, it is your responsibility to issue the error
+ * message to the user and return false here.
+ *
+ * @return true if there is no problem, false if there is a fatal collision
+ */
+ protected boolean preCheckForCollision(Shell shell, Object targetContainer,
+ Object oldObject, String oldName)
+ {
+ ISystemFilter newFilter = (ISystemFilter)targetContainer;
+ if (supportsDuplicateFilterStrings(newFilter))
+ return true;
+ ISystemFilterString match = newFilter.getSystemFilterString(oldName);
+ if (match != null)
+ {
+ SystemMessage msg = SystemPlugin.getPluginMessage(MSG_VALIDATE_FILTERSTRING_ALREADYEXISTS);
+ msg.makeSubstitution(oldName, newFilter.getName());
+ SystemMessageDialog.displayErrorMessage(shell, msg);
+ }
+ return (match == null); // all is well iff such a filter string doesn't already exist.
+ }
+
+ /**
+ * SHOULD NEVER BE CALLED IF preCheckForCollision WORKS PROPERLY
+ * @see SystemBaseCopyAction#checkForCollision(Shell, IProgressMonitor, Object, Object, String)
+ */
+ protected String checkForCollision(Shell shell, IProgressMonitor monitor,
+ Object targetContainer, Object oldObject, String oldName)
+ {
+ ISystemFilter newFilter = (ISystemFilter)targetContainer;
+ if (supportsDuplicateFilterStrings(newFilter))
+ return oldName;
+ ISystemFilterPool newPool = newFilter.getParentFilterPool();
+ ISystemFilterPoolManager newMgr = newPool.getSystemFilterPoolManager();
+ String newName = oldName;
+ ISystemFilterString match = newFilter.getSystemFilterString(oldName);
+ if (match != null)
+ {
+ //monitor.setVisible(false); wish we could!
+ boolean caseSensitive = false;
+ ValidatorUniqueString validator = new ValidatorUniqueString(newFilter.getFilterStrings(),caseSensitive);
+ //SystemCollisionRenameDialog dlg = new SystemCollisionRenameDialog(shell, validator, oldName);
+ SystemRenameSingleDialog dlg = new SystemRenameSingleDialog(shell, true, match, validator); // true => copy-collision-mode
+ dlg.open();
+ if (!dlg.wasCancelled())
+ newName = dlg.getNewName();
+ else
+ newName = null;
+ }
+ return newName;
+ }
+ /**
+ * @see SystemBaseCopyAction#doCopy(IProgressMonitor, Object, Object, String)
+ */
+ protected boolean doCopy(IProgressMonitor monitor, Object targetContainer, Object oldObject, String newName)
+ throws Exception
+ {
+ ISystemFilterString oldFilterString = (ISystemFilterString)oldObject;
+ ISystemFilterPoolManager oldMgr = oldFilterString.getSystemFilterPoolManager();
+ ISystemFilter targetFilter = (ISystemFilter)targetContainer;
+ //SystemFilterPoolManager newMgr = targetFilter.getSystemFilterPoolManager();
+
+ ISystemFilterString newFilterString = oldMgr.copySystemFilterString(targetFilter, oldFilterString);
+
+ if ((root != null) && (newFilterString!=null))
+ {
+ Object data = root.getData();
+ if ((data!=null) && (data instanceof TreeViewer))
+ ((TreeViewer)data).refresh();
+ }
+ return (newFilterString != null);
+ }
+
+ /**
+ * @see SystemBaseCopyAction#getTreeModel()
+ */
+ protected SystemSimpleContentElement getTreeModel()
+ {
+ ISystemFilterString firstFilterString = getFirstSelectedFilterString();
+ ISystemFilterPoolManagerProvider provider = firstFilterString.getProvider();
+ return getPoolMgrTreeModel(provider, firstFilterString.getSystemFilterPoolManager(), getSelectedFilters());
+ }
+ /**
+ * @see SystemBaseCopyAction#getTreeInitialSelection()
+ */
+ protected SystemSimpleContentElement getTreeInitialSelection()
+ {
+ return initialSelectionElement;
+ }
+
+ /**
+ * Set the prompt string that shows up at the top of the copy-destination dialog.
+ */
+ public void setPromptString(String promptString)
+ {
+ this.promptString = promptString;
+ }
+ /**
+ * @see SystemBaseCopyAction#getPromptString()
+ */
+ protected String getPromptString()
+ {
+ return promptString;
+ }
+ /**
+ * @see SystemBaseCopyAction#getCopyingMessage()
+ */
+ protected SystemMessage getCopyingMessage()
+ {
+ return SystemPlugin.getPluginMessage(MSG_COPYFILTERSTRINGS_PROGRESS);
+ }
+ /**
+ * @see SystemBaseCopyAction#getCopyingMessage( String)
+ */
+ protected SystemMessage getCopyingMessage(String oldName)
+ {
+ return SystemPlugin.getPluginMessage(MSG_COPYFILTERSTRING_PROGRESS).makeSubstitution(oldName);
+ }
+
+ /**
+ * @see SystemBaseCopyAction#getOldObjects()
+ */
+ protected Object[] getOldObjects()
+ {
+ return getSelectedFilterStrings();
+ }
+
+ /**
+ * @see SystemBaseCopyAction#getOldNames()
+ */
+ protected String[] getOldNames()
+ {
+ strings = null; // clear previous history
+ ISystemFilterString[] strings = getSelectedFilterStrings();
+ String[] names = new String[strings.length];
+ for (int idx=0; idx
+ * Same as {@link org.eclipse.rse.ui.actions.SystemBaseAction #setHelp(String)}
+ * @see org.eclipse.rse.ui.actions.SystemBaseAction #getHelpContextId()
+ */
+ public void setHelpContextId(String id)
+ {
+ setHelp(id);
+ }
+
+ /**
+ * Intercept of parent method. We need to test that the filter pools
+ * come from the same parent
+ */
+ public boolean updateSelection(IStructuredSelection selection)
+ {
+ ISystemFilterPoolReferenceManager prevMgr = null;
+ boolean enable = true;
+ Iterator e= ((IStructuredSelection) selection).iterator();
+ while (enable && e.hasNext())
+ {
+ Object selectedObject = e.next();
+ ISystemFilterPoolReference filterPoolRef = (ISystemFilterPoolReference)selectedObject;
+ if (prevMgr != null)
+ {
+ if (prevMgr != filterPoolRef.getFilterPoolReferenceManager())
+ enable = false;
+ else
+ prevMgr = filterPoolRef.getFilterPoolReferenceManager();
+ }
+ else
+ prevMgr = filterPoolRef.getFilterPoolReferenceManager();
+ if (enable)
+ enable = checkObjectType(filterPoolRef);
+ }
+ return enable;
+ }
+
+ /**
+ * Called by SystemBaseAction when selection is set.
+ * Our opportunity to verify we are allowed for this selected type.
+ */
+ public boolean checkObjectType(Object selectedObject)
+ {
+ if (!(selectedObject instanceof ISystemFilterPoolReference))
+ return false;
+ ISystemFilterPoolReference filterPoolRef = (ISystemFilterPoolReference)selectedObject;
+ ISystemFilterPoolReferenceManager fprMgr = filterPoolRef.getFilterPoolReferenceManager();
+ int pos = fprMgr.getSystemFilterPoolReferencePosition(filterPoolRef);
+ return (pos < (fprMgr.getSystemFilterPoolReferenceCount()-1));
+ }
+
+ /**
+ * This is the method called when the user selects this action.
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ public void run()
+ {
+ IStructuredSelection selections = getSelection();
+ //SystemFilterPoolReference filterPoolRefs[] = new SystemFilterPoolReference[selections.size()];
+ //Iterator i = selections.iterator();
+ //int idx = 0;
+ //while (i.hasNext())
+ //filterPoolRefs[idx++] = (SystemFilterPoolReference)i.next();
+
+ SystemSortableSelection[] sortableArray = new SystemSortableSelection[selections.size()];
+ Iterator i = selections.iterator();
+ int idx = 0;
+ ISystemFilterPoolReference filterPoolRef = null;
+ ISystemFilterPoolReferenceManager fprMgr = null;
+ while (i.hasNext())
+ {
+ sortableArray[idx] = new SystemSortableSelection((ISystemFilterPoolReference)i.next());
+ filterPoolRef = (ISystemFilterPoolReference)sortableArray[idx].getSelectedObject();
+ fprMgr = filterPoolRef.getFilterPoolReferenceManager();
+ sortableArray[idx].setPosition(fprMgr.getSystemFilterPoolReferencePosition(filterPoolRef));
+ idx++;
+ }
+ SystemSortableSelection.sortArray(sortableArray);
+ ISystemFilterPoolReference[] filterPoolRefs = (ISystemFilterPoolReference[])SystemSortableSelection.getSortedObjects(sortableArray, new ISystemFilterPoolReference[sortableArray.length]);
+
+ if (idx>0)
+ {
+ fprMgr = filterPoolRefs[0].getFilterPoolReferenceManager();
+ fprMgr.moveSystemFilterPoolReferences(filterPoolRefs,1);
+ }
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterMoveFilterAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterMoveFilterAction.java
new file mode 100644
index 00000000000..08b6dcc6444
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterMoveFilterAction.java
@@ -0,0 +1,372 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.filters.actions;
+import java.util.Iterator;
+import java.util.Vector;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.subsystems.util.ISubsystemConfigurationAdapter;
+import org.eclipse.rse.filters.ISystemFilter;
+import org.eclipse.rse.filters.ISystemFilterPool;
+import org.eclipse.rse.filters.ISystemFilterPoolManager;
+import org.eclipse.rse.filters.ISystemFilterPoolManagerProvider;
+import org.eclipse.rse.filters.ISystemFilterReference;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.actions.SystemBaseAction;
+import org.eclipse.rse.ui.actions.SystemBaseCopyAction;
+import org.eclipse.rse.ui.dialogs.SystemRenameSingleDialog;
+import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
+import org.eclipse.rse.ui.filters.SystemFilterUIHelpers;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * Copy a filter action.
+ */
+public class SystemFilterMoveFilterAction extends SystemBaseCopyAction
+ implements ISystemMessages
+{
+ private String promptString = null;
+ private SystemSimpleContentElement initialSelectionElement = null;
+ private SystemSimpleContentElement root = null;
+
+ /**
+ * Constructor
+ */
+ public SystemFilterMoveFilterAction(Shell parent)
+ {
+ super(parent, SystemResources.ACTION_MOVE_FILTER_LABEL, MODE_MOVE);
+ promptString = SystemResources.RESID_MOVE_PROMPT;
+ }
+
+ /**
+ * Reset. This is a re-run of this action
+ */
+ protected void reset()
+ {
+ super.reset();
+ initialSelectionElement = null;
+ root = null;
+ }
+
+ /**
+ * Set the help context Id (infoPop) for this action. This must be fully qualified by
+ * plugin ID.
+ *
+ * Same as {@link org.eclipse.rse.ui.actions.SystemBaseAction #setHelp(String)}
+ * @see org.eclipse.rse.ui.actions.SystemBaseAction #getHelpContextId()
+ */
+ public void setHelpContextId(String id)
+ {
+ setHelp(id);
+ }
+
+ /**
+ * We override from parent to do unique checking...
+ *
+ * @see SystemBaseAction#updateSelection(IStructuredSelection)
+ */
+ public boolean updateSelection(IStructuredSelection selection)
+ {
+ boolean enable = true;
+ /* */
+ Iterator e= ((IStructuredSelection) selection).iterator();
+ while (enable && e.hasNext())
+ {
+ Object selectedObject = e.next();
+ if (selectedObject instanceof SystemSimpleContentElement)
+ selectedObject = ((SystemSimpleContentElement)selectedObject).getData();
+ if (!checkObjectType(selectedObject))
+ enable = false;
+ }
+ /* */
+ return enable;
+ }
+ /**
+ * Called by SystemBaseAction when selection is set.
+ * Our opportunity to verify we are allowed for this selected type.
+ */
+ public boolean checkObjectType(Object selectedObject)
+ {
+ if (selectedObject instanceof ISystemFilter)
+ {
+ ISystemFilter fs = (ISystemFilter)selectedObject;
+ return !fs.isNonChangable();
+ }
+ else if (selectedObject instanceof ISystemFilterReference)
+ {
+ ISystemFilter fs = ((ISystemFilterReference)selectedObject).getReferencedFilter();
+ return !fs.isNonChangable();
+ }
+ else
+ return false;
+ }
+
+
+ // --------------------------
+ // PARENT METHOD OVERRIDES...
+ // --------------------------
+ /**
+ * This method is a callback from the select-target-parent dialog, allowing us to decide whether the current selected
+ * object is a valid parent object. This affects the enabling of the OK button on that dialog.
+ */
+ public boolean isValidTargetParent(SystemSimpleContentElement selectedElement)
+ {
+ if (selectedElement == null)
+ return false;
+ Object data = selectedElement.getData();
+ return (data instanceof ISystemFilterPool);
+ }
+
+ /**
+ * @see SystemBaseCopyAction#checkForCollision(Shell, IProgressMonitor, Object, Object, String)
+ */
+ protected String checkForCollision(Shell shell, IProgressMonitor monitor,
+ Object targetContainer, Object oldObject, String oldName)
+ {
+ ISystemFilterPool newPool = (ISystemFilterPool)targetContainer;
+ ISystemFilterPoolManager newMgr = newPool.getSystemFilterPoolManager();
+ String newName = oldName;
+ ISystemFilter match = newPool.getSystemFilter(oldName);
+ if (match != null)
+ {
+ //monitor.setVisible(false); wish we could!
+ //ValidatorFilterName validator = new ValidatorFilterName(newPool.getSystemFilterNames());
+ //SystemCollisionRenameDialog dlg = new SystemCollisionRenameDialog(shell, validator, oldName);
+ SystemRenameSingleDialog dlg = new SystemRenameSingleDialog(shell, true, match, null); // true => copy-collision-mode
+ dlg.open();
+ if (!dlg.wasCancelled())
+ newName = dlg.getNewName();
+ else
+ newName = null;
+ }
+ return newName;
+ }
+ /**
+ * @see SystemBaseCopyAction#doCopy(IProgressMonitor, Object, Object, String)
+ */
+ protected boolean doCopy(IProgressMonitor monitor, Object targetContainer, Object oldObject, String newName)
+ throws Exception
+ {
+ ISystemFilter oldFilter = (ISystemFilter)oldObject;
+ ISystemFilterPool oldFilterPool = oldFilter.getParentFilterPool();
+ ISystemFilterPoolManager oldMgr = oldFilterPool.getSystemFilterPoolManager();
+ ISystemFilterPool newPool = (ISystemFilterPool)targetContainer;
+ ISystemFilterPoolManager newMgr = newPool.getSystemFilterPoolManager();
+
+ ISystemFilter newFilter = oldMgr.moveSystemFilter(newPool, oldFilter, newName);
+
+ if ((root != null) && (newFilter!=null))
+ {
+ Object data = root.getData();
+ if ((data!=null) && (data instanceof TreeViewer))
+ ((TreeViewer)data).refresh();
+ }
+ return (newFilter != null);
+ }
+
+ /**
+ * @see SystemBaseCopyAction#getTreeModel()
+ */
+ protected SystemSimpleContentElement getTreeModel()
+ {
+ ISystemFilter firstFilter = getFirstSelectedFilter();
+ ISystemFilterPoolManagerProvider provider = firstFilter.getProvider();
+ return getPoolMgrTreeModel(provider, firstFilter.getSystemFilterPoolManager(), firstFilter.getParentFilterPool());
+ }
+ /**
+ * @see SystemBaseCopyAction#getTreeInitialSelection()
+ */
+ protected SystemSimpleContentElement getTreeInitialSelection()
+ {
+ return initialSelectionElement;
+ }
+
+ /**
+ * Set the prompt string that shows up at the top of the copy-destination dialog.
+ */
+ public void setPromptString(String promptString)
+ {
+ this.promptString = promptString;
+ }
+ /**
+ * @see SystemBaseCopyAction#getPromptString()
+ */
+ protected String getPromptString()
+ {
+ return promptString;
+ }
+ /**
+ * @see SystemBaseCopyAction#getCopyingMessage()
+ */
+ protected SystemMessage getCopyingMessage()
+ {
+ return SystemPlugin.getPluginMessage(MSG_MOVEFILTERS_PROGRESS);
+ }
+ /**
+ * @see SystemBaseCopyAction#getCopyingMessage( String)
+ */
+ protected SystemMessage getCopyingMessage(String oldName)
+ {
+ return SystemPlugin.getPluginMessage(MSG_MOVEFILTER_PROGRESS).makeSubstitution(oldName);
+ }
+
+ /**
+ * @see SystemBaseCopyAction#getOldObjects()
+ */
+ protected Object[] getOldObjects()
+ {
+ return getSelectedFilters();
+ }
+
+ /**
+ * @see SystemBaseCopyAction#getOldNames()
+ */
+ protected String[] getOldNames()
+ {
+ ISystemFilter[] filters = getSelectedFilters();
+ String[] names = new String[filters.length];
+ for (int idx=0; idx
+ * We intercept to ensure only filterpools from the same filterpool manager are selected.
+ *
+ * @see SystemBaseAction#updateSelection(IStructuredSelection)
+ */
+ public boolean updateSelection(IStructuredSelection selection)
+ {
+ boolean enable = true;
+ /* */
+ Iterator e= ((IStructuredSelection) selection).iterator();
+ ISystemFilterPoolManager prevMgr = null;
+ ISystemFilterPoolManager currMgr = null;
+ ISystemFilterPool pool;
+ while (enable && e.hasNext())
+ {
+ Object selectedObject = e.next();
+ if (selectedObject instanceof SystemSimpleContentElement)
+ selectedObject = ((SystemSimpleContentElement)selectedObject).getData();
+ if (!(selectedObject instanceof ISystemFilterPool) &&
+ !(selectedObject instanceof ISystemFilterPoolReference))
+ enable = false;
+ // disable if this is a connection-unique filter pool
+ else if (selectedObject instanceof ISystemFilterPool)
+ enable = ((ISystemFilterPool)selectedObject).getOwningParentName() == null;
+ // disable if this is a connection-unique filter pool
+ else if (selectedObject instanceof ISystemFilterPoolReference)
+ enable = ((ISystemFilterPoolReference)selectedObject).getReferencedFilterPool().getOwningParentName() == null;
+
+ if (enable)
+ {
+ if (selectedObject instanceof ISystemFilterPool)
+ pool = (ISystemFilterPool)selectedObject;
+ else
+ pool = ((ISystemFilterPoolReference)selectedObject).getReferencedFilterPool();
+ currMgr = pool.getSystemFilterPoolManager();
+ if (prevMgr == null)
+ prevMgr = currMgr;
+ else
+ enable = (prevMgr == currMgr);
+ if (enable)
+ prevMgr = currMgr;
+ }
+ }
+ /* */
+ return enable;
+ }
+
+ // --------------------------
+ // PARENT METHOD OVERRIDES...
+ // --------------------------
+ /**
+ * This method is a callback from the select-target-parent dialog, allowing us to decide whether the current selected
+ * object is a valid parent object. This affects the enabling of the OK button on that dialog.
+ */
+ public boolean isValidTargetParent(SystemSimpleContentElement selectedElement)
+ {
+ if (selectedElement == null)
+ return false;
+ Object data = selectedElement.getData();
+ return (data instanceof ISystemFilterPoolManager);
+ }
+
+ /**
+ * @see SystemBaseCopyAction#checkForCollision(Shell, IProgressMonitor, Object, Object, String)
+ */
+ protected String checkForCollision(Shell shell, IProgressMonitor monitor,
+ Object targetContainer, Object oldObject, String oldName)
+ {
+ ISystemFilterPoolManager newMgr = (ISystemFilterPoolManager)targetContainer;
+ String newName = oldName;
+ ISystemFilterPool match = newMgr.getSystemFilterPool(oldName);
+ if (match != null)
+ {
+ //monitor.setVisible(false); wish we could!
+ //ValidatorFilterPoolName validator = new ValidatorFilterPoolName(newMgr.getSystemFilterPoolNames());
+ //SystemCollisionRenameDialog dlg = new SystemCollisionRenameDialog(shell, validator, oldName);
+ SystemRenameSingleDialog dlg = new SystemRenameSingleDialog(shell, true, match, null); // true => copy-collision-mode
+ dlg.open();
+ if (!dlg.wasCancelled())
+ newName = dlg.getNewName();
+ else
+ newName = null;
+ }
+ return newName;
+ }
+ /**
+ * @see SystemBaseCopyAction#doCopy(IProgressMonitor, Object, Object, String)
+ */
+ protected boolean doCopy(IProgressMonitor monitor, Object targetContainer, Object oldObject, String newName)
+ throws Exception
+ {
+ ISystemFilterPool oldFilterPool = (ISystemFilterPool)oldObject;
+ ISystemFilterPoolManager oldMgr = oldFilterPool.getSystemFilterPoolManager();
+ ISystemFilterPoolManager newMgr = (ISystemFilterPoolManager)targetContainer;
+ ISystemFilterPool newFilterPool = oldMgr.moveSystemFilterPool(newMgr, oldFilterPool, newName);
+ if ((root != null) && (newFilterPool!=null))
+ {
+ Object data = root.getData();
+ if ((data!=null) && (data instanceof TreeViewer))
+ ((TreeViewer)data).refresh();
+ }
+ return (newFilterPool != null);
+ }
+
+ /**
+ * @see SystemBaseCopyAction#getTreeModel()
+ */
+ protected SystemSimpleContentElement getTreeModel()
+ {
+ ISystemFilterPool firstPool = getFirstSelectedFilterPool();
+ ISystemFilterPoolManagerProvider provider = firstPool.getProvider();
+
+ return getPoolMgrTreeModel(provider, firstPool.getSystemFilterPoolManager());
+ }
+ /**
+ * @see SystemBaseCopyAction#getTreeInitialSelection()
+ */
+ protected SystemSimpleContentElement getTreeInitialSelection()
+ {
+ return initialSelectionElement;
+ }
+
+ /**
+ * Set the prompt string that shows up at the top of the copy-destination dialog.
+ */
+ public void setPromptString(String promptString)
+ {
+ this.promptString = promptString;
+ }
+ /**
+ * @see SystemBaseCopyAction#getPromptString()
+ */
+ protected String getPromptString()
+ {
+ return promptString;
+ }
+ /**
+ * @see SystemBaseCopyAction#getCopyingMessage()
+ */
+ protected SystemMessage getCopyingMessage()
+ {
+ return SystemPlugin.getPluginMessage(MSG_MOVEFILTERPOOLS_PROGRESS);
+ }
+ /**
+ * @see SystemBaseCopyAction#getCopyingMessage( String)
+ */
+ protected SystemMessage getCopyingMessage(String oldName)
+ {
+ return SystemPlugin.getPluginMessage(MSG_MOVEFILTERPOOL_PROGRESS).makeSubstitution(oldName);
+ }
+ /**
+ * Return complete message
+ */
+ public SystemMessage getCompletionMessage(Object targetContainer, String[] oldNames, String[] newNames)
+ {
+ return SystemPlugin.getPluginMessage(MSG_MOVEFILTERPOOL_COMPLETE).makeSubstitution(((ISystemFilterPoolManager)targetContainer).getName());
+ }
+
+ /**
+ * @see SystemBaseCopyAction#getOldObjects()
+ */
+ protected Object[] getOldObjects()
+ {
+ return getSelectedFilterPools();
+ }
+
+ /**
+ * @see SystemBaseCopyAction#getOldNames()
+ */
+ protected String[] getOldNames()
+ {
+ ISystemFilterPool[] filterPools = getSelectedFilterPools();
+ String[] names = new String[filterPools.length];
+ for (int idx=0; idx
+ * @see SystemBaseAction#updateSelection(IStructuredSelection)
+ */
+ public boolean updateSelection(IStructuredSelection selection)
+ {
+ boolean enable = true;
+ /* */
+ Iterator e= ((IStructuredSelection) selection).iterator();
+ while (enable && e.hasNext())
+ {
+ Object selectedObject = e.next();
+ if (selectedObject instanceof SystemSimpleContentElement)
+ selectedObject = ((SystemSimpleContentElement)selectedObject).getData();
+ if (!checkObjectType(selectedObject))
+ enable = false;
+ }
+ /* */
+ return enable;
+ }
+ /**
+ * Called by SystemBaseAction when selection is set.
+ * Our opportunity to verify we are allowed for this selected type.
+ */
+ public boolean checkObjectType(Object selectedObject)
+ {
+ if (selectedObject instanceof ISystemFilterString)
+ {
+ ISystemFilterString fs = (ISystemFilterString)selectedObject;
+ return fs.isChangable();
+ }
+ else if (selectedObject instanceof ISystemFilterStringReference)
+ {
+ ISystemFilterStringReference frs = (ISystemFilterStringReference)selectedObject;
+ return frs.getReferencedFilterString().isChangable();
+ }
+ else
+ return false;
+ }
+
+ // --------------------------
+ // PARENT METHOD OVERRIDES...
+ // --------------------------
+ /**
+ * This method is a callback from the select-target-parent dialog, allowing us to decide whether the current selected
+ * object is a valid parent object. This affects the enabling of the OK button on that dialog.
+ *
+ * The default is to return true if the selected element has no children. This is sufficient for most cases. However,
+ * in some cases it is not, such as for filter strings where we want to only enable OK if a filter is selected. It is
+ * possible that filter pools have no filters, so the default algorithm is not sufficient. In these cases the child class
+ * can override this method.
+ */
+ public boolean isValidTargetParent(SystemSimpleContentElement selectedElement)
+ {
+ Object data = selectedElement.getData();
+ if (data instanceof ISystemFilter)
+ return !((ISystemFilter)data).isPromptable();
+ else
+ return false;
+ }
+
+ /**
+ * Overridable entry point when you want to prevent any copies/moves if any of the
+ * selected objects have a name collision.
+ *
+ * If you decide to override this, it is your responsibility to issue the error
+ * message to the user and return false here.
+ *
+ * @return true if there is no problem, false if there is a fatal collision
+ */
+ protected boolean preCheckForCollision(Shell shell, Object targetContainer,
+ Object oldObject, String oldName)
+ {
+ ISystemFilter newFilter = (ISystemFilter)targetContainer;
+ if (supportsDuplicateFilterStrings(newFilter))
+ return true;
+ ISystemFilterString match = newFilter.getSystemFilterString(oldName);
+ if (match != null)
+ {
+ SystemMessage msg = SystemPlugin.getPluginMessage(MSG_VALIDATE_FILTERSTRING_ALREADYEXISTS);
+ msg.makeSubstitution(oldName, newFilter.getName());
+ SystemMessageDialog.displayErrorMessage(shell, msg);
+
+ }
+ return (match == null); // all is well iff such a filter string doesn't already exist.
+ }
+
+ /**
+ * SHOULD NEVER BE CALLED IF preCheckForCollision WORKS PROPERLY
+ * @see SystemBaseCopyAction#checkForCollision(Shell, IProgressMonitor, Object, Object, String)
+ */
+ protected String checkForCollision(Shell shell, IProgressMonitor monitor,
+ Object targetContainer, Object oldObject, String oldName)
+ {
+ ISystemFilter newFilter = (ISystemFilter)targetContainer;
+ if (supportsDuplicateFilterStrings(newFilter))
+ return oldName;
+ ISystemFilterPool newPool = newFilter.getParentFilterPool();
+ ISystemFilterPoolManager newMgr = newPool.getSystemFilterPoolManager();
+ String newName = oldName;
+ ISystemFilterString match = newFilter.getSystemFilterString(oldName);
+ if (match != null)
+ {
+ //monitor.setVisible(false); wish we could!
+ boolean caseSensitive = false;
+ ValidatorUniqueString validator = new ValidatorUniqueString(newFilter.getFilterStrings(),caseSensitive);
+ //SystemCollisionRenameDialog dlg = new SystemCollisionRenameDialog(shell, validator, oldName);
+ SystemRenameSingleDialog dlg = new SystemRenameSingleDialog(shell, true, match, validator); // true => copy-collision-mode
+ dlg.open();
+ if (!dlg.wasCancelled())
+ newName = dlg.getNewName();
+ else
+ newName = null;
+ }
+ return newName;
+ }
+ /**
+ * @see SystemBaseCopyAction#doCopy(IProgressMonitor, Object, Object, String)
+ */
+ protected boolean doCopy(IProgressMonitor monitor, Object targetContainer, Object oldObject, String newName)
+ throws Exception
+ {
+ ISystemFilterString oldFilterString = (ISystemFilterString)oldObject;
+ ISystemFilterPoolManager oldMgr = oldFilterString.getSystemFilterPoolManager();
+ ISystemFilter targetFilter = (ISystemFilter)targetContainer;
+ //SystemFilterPoolManager newMgr = targetFilter.getSystemFilterPoolManager();
+
+ ISystemFilterString newFilterString = oldMgr.moveSystemFilterString(targetFilter, oldFilterString);
+
+ if ((root != null) && (newFilterString!=null))
+ {
+ Object data = root.getData();
+ if ((data!=null) && (data instanceof TreeViewer))
+ ((TreeViewer)data).refresh();
+ }
+ return (newFilterString != null);
+ }
+
+ /**
+ * @see SystemBaseCopyAction#getTreeModel()
+ */
+ protected SystemSimpleContentElement getTreeModel()
+ {
+ ISystemFilterString firstFilterString = getFirstSelectedFilterString();
+ ISystemFilterPoolManagerProvider provider = firstFilterString.getProvider();
+ return getPoolMgrTreeModel(provider, firstFilterString.getSystemFilterPoolManager(), getSelectedFilters());
+ }
+ /**
+ * @see SystemBaseCopyAction#getTreeInitialSelection()
+ */
+ protected SystemSimpleContentElement getTreeInitialSelection()
+ {
+ return initialSelectionElement;
+ }
+
+ /**
+ * Set the prompt string that shows up at the top of the copy-destination dialog.
+ */
+ public void setPromptString(String promptString)
+ {
+ this.promptString = promptString;
+ }
+ /**
+ * @see SystemBaseCopyAction#getPromptString()
+ */
+ protected String getPromptString()
+ {
+ return promptString;
+ }
+ /**
+ * @see SystemBaseCopyAction#getCopyingMessage()
+ */
+ protected SystemMessage getCopyingMessage()
+ {
+ return SystemPlugin.getPluginMessage(MSG_MOVEFILTERSTRINGS_PROGRESS);
+ }
+ /**
+ * @see SystemBaseCopyAction#getCopyingMessage( String)
+ */
+ protected SystemMessage getCopyingMessage(String oldName)
+ {
+ return SystemPlugin.getPluginMessage(MSG_MOVEFILTERSTRING_PROGRESS).makeSubstitution(oldName);
+ }
+
+ /**
+ * @see SystemBaseCopyAction#getOldObjects()
+ */
+ protected Object[] getOldObjects()
+ {
+ return getSelectedFilterStrings();
+ }
+
+ /**
+ * @see SystemBaseCopyAction#getOldNames()
+ */
+ protected String[] getOldNames()
+ {
+ ISystemFilterString[] strings = getSelectedFilterStrings();
+ String[] names = new String[strings.length];
+ for (int idx=0; idx
+ * Same as {@link org.eclipse.rse.ui.actions.SystemBaseAction#setHelp(String)}
+ * @see org.eclipse.rse.ui.actions.SystemBaseAction#getHelpContextId()
+ */
+ public void setHelpContextId(String id)
+ {
+ setHelp(id);
+ }
+
+ /**
+ * Intercept of parent method. We need to test that the filter pools
+ * come from the same parent
+ */
+ public boolean updateSelection(IStructuredSelection selection)
+ {
+ ISystemFilterPoolReferenceManager prevMgr = null;
+ boolean enable = true;
+ Iterator e= ((IStructuredSelection) selection).iterator();
+ while (enable && e.hasNext())
+ {
+ Object selectedObject = e.next();
+ ISystemFilterPoolReference filterPoolRef = (ISystemFilterPoolReference)selectedObject;
+ if (prevMgr != null)
+ {
+ if (prevMgr != filterPoolRef.getFilterPoolReferenceManager())
+ enable = false;
+ else
+ prevMgr = filterPoolRef.getFilterPoolReferenceManager();
+ }
+ else
+ prevMgr = filterPoolRef.getFilterPoolReferenceManager();
+ if (enable)
+ enable = checkObjectType(filterPoolRef);
+ }
+ return enable;
+ }
+
+ /**
+ * Called by SystemBaseAction when selection is set.
+ * Our opportunity to verify we are allowed for this selected type.
+ */
+ public boolean checkObjectType(Object selectedObject)
+ {
+ if (!(selectedObject instanceof ISystemFilterPoolReference))
+ return false;
+ ISystemFilterPoolReference filterPoolRef = (ISystemFilterPoolReference)selectedObject;
+ ISystemFilterPoolReferenceManager fprMgr = filterPoolRef.getFilterPoolReferenceManager();
+ int pos = fprMgr.getSystemFilterPoolReferencePosition(filterPoolRef);
+ return (pos>0);
+ }
+
+ /**
+ * This is the method called when the user selects this action.
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ public void run()
+ {
+ IStructuredSelection selections = getSelection();
+ //SystemFilterPoolReference filterPoolRefs[] = new SystemFilterPoolReference[selections.size()];
+ //Iterator i = selections.iterator();
+ //int idx = 0;
+ //while (i.hasNext())
+ //filterPoolRefs[idx++] = (SystemFilterPoolReference)i.next();
+
+ SystemSortableSelection[] sortableArray = new SystemSortableSelection[selections.size()];
+ Iterator i = selections.iterator();
+ int idx = 0;
+ ISystemFilterPoolReference filterPoolRef = null;
+ ISystemFilterPoolReferenceManager fprMgr = null;
+ while (i.hasNext())
+ {
+ sortableArray[idx] = new SystemSortableSelection((ISystemFilterPoolReference)i.next());
+ filterPoolRef = (ISystemFilterPoolReference)sortableArray[idx].getSelectedObject();
+ fprMgr = filterPoolRef.getFilterPoolReferenceManager();
+ sortableArray[idx].setPosition(fprMgr.getSystemFilterPoolReferencePosition(filterPoolRef));
+ idx++;
+ }
+ SystemSortableSelection.sortArray(sortableArray);
+ ISystemFilterPoolReference[] filterPoolRefs = (ISystemFilterPoolReference[])SystemSortableSelection.getSortedObjects(sortableArray, new ISystemFilterPoolReference[sortableArray.length]);
+
+ if (idx > 0)
+ {
+ fprMgr = filterPoolRefs[0].getFilterPoolReferenceManager();
+ fprMgr.moveSystemFilterPoolReferences(filterPoolRefs,-1);
+ }
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterNewFilterPoolAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterNewFilterPoolAction.java
new file mode 100644
index 00000000000..c15acb6b15f
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterNewFilterPoolAction.java
@@ -0,0 +1,174 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.filters.actions;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.filters.ISystemFilterPool;
+import org.eclipse.rse.filters.ISystemFilterPoolManager;
+import org.eclipse.rse.filters.ISystemFilterPoolReferenceManager;
+import org.eclipse.rse.filters.ISystemFilterPoolReferenceManagerProvider;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.actions.ISystemWizardAction;
+import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
+import org.eclipse.rse.ui.filters.SystemFilterPoolDialogOutputs;
+import org.eclipse.rse.ui.filters.dialogs.SystemFilterNewFilterPoolWizard;
+import org.eclipse.rse.ui.filters.dialogs.SystemFilterPoolWizardDialog;
+import org.eclipse.rse.ui.filters.dialogs.SystemFilterPoolWizardInterface;
+import org.eclipse.rse.ui.filters.dialogs.SystemFilterWorkWithFilterPoolsDialog;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * The action that displays the New Filter Pool wizard
+ * @see #setHelpContextId(String)
+ */
+public class SystemFilterNewFilterPoolAction
+ extends SystemFilterAbstractFilterPoolWizardAction
+ implements ISystemWizardAction
+{
+
+ private SystemFilterWorkWithFilterPoolsDialog wwdialog = null;
+ //private SystemFilterNewFilterPoolWizard wizard = null;
+
+ /**
+ * Constructor for SystemNewFilterPoolAction when not called from work-with dialog.
+ */
+ public SystemFilterNewFilterPoolAction(Shell parent)
+ {
+ this(parent, null);
+ }
+
+ /**
+ * Constructor for SystemNewFilterPoolAction when called from work-with dialog.
+ */
+ public SystemFilterNewFilterPoolAction(Shell parent,
+ SystemFilterWorkWithFilterPoolsDialog wwdialog)
+ {
+ super(parent,
+ SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_NEWFILTERPOOL_ID),
+ SystemResources.ACTION_NEWFILTERPOOL_LABEL, SystemResources.ACTION_NEWFILTERPOOL_TOOLTIP);
+ this.wwdialog = wwdialog;
+ allowOnMultipleSelection(false);
+ setContextMenuGroup(ISystemContextMenuConstants.GROUP_NEW);
+ }
+
+ /**
+ * Override of init in parent
+ */
+ protected void init()
+ {
+ super.init();
+ dlgInputs.prompt = SystemResources.RESID_NEWFILTERPOOL_PAGE1_DESCRIPTION;
+ dlgInputs.title = SystemResources.RESID_NEWFILTERPOOL_PAGE1_TITLE;
+ dlgInputs.poolNamePrompt = SystemResources.RESID_FILTERPOOLNAME_LABEL;
+ dlgInputs.poolNameTip = SystemResources.RESID_FILTERPOOLNAME_TIP;
+ dlgInputs.poolMgrNamePrompt = SystemResources.RESID_FILTERPOOLMANAGERNAME_LABEL;
+ dlgInputs.poolMgrNameTip = SystemResources.RESID_FILTERPOOLMANAGERNAME_TIP;
+ }
+
+ /**
+ * Called by SystemBaseAction when selection is set.
+ * Our opportunity to verify we are allowed for this selected type.
+ */
+ public boolean checkObjectType(Object selectedObject)
+ {
+ if (selectedObject instanceof SystemSimpleContentElement)
+ selectedObject = ((SystemSimpleContentElement)selectedObject).getData();
+ boolean enable =
+ (selectedObject instanceof ISystemFilterPoolReferenceManagerProvider) ||
+ (selectedObject instanceof ISystemFilterPoolManager) ||
+ (selectedObject instanceof ISystemFilterPool);
+ return enable;
+ }
+
+
+ /**
+ * Return the wizard so we can customize it prior to showing it.
+ * Returns new SystemFilterNewFilterPoolWizard(). Override to replace with your own.
+ */
+ public SystemFilterPoolWizardInterface getFilterPoolWizard()
+ {
+ //if (wizard == null)
+ // wizard = new SystemFilterNewFilterPoolWizard();
+ //return wizard;
+ return new SystemFilterNewFilterPoolWizard();
+ }
+
+ /**
+ * Overrides parent. Called after dialog dismissed.
+ */
+ protected Object getDialogValue(Dialog dlg)
+ {
+ SystemFilterPoolWizardDialog wizardDlg = (SystemFilterPoolWizardDialog)dlg;
+ SystemFilterPoolDialogOutputs dlgOutput = wizardDlg.getFilterPoolDialogOutputs();
+ return dlgOutput;
+ }
+
+ /**
+ * Overrides parent. Called after dialog dismissed and getDialogValue called.
+ * The output of getDialogValue passed as input here.
+ */
+ public void doOKprocessing(Object dlgValue)
+ {
+ //System.out.println("In SystemFilterNewFIlterPoolAction.doOKProcessing");
+ SystemFilterPoolDialogOutputs dlgOutput = (SystemFilterPoolDialogOutputs)dlgValue;
+ // called from WorkWith dialog... we do not offer to create a reference...
+ if ((dlgOutput.newPool != null) && (wwdialog != null))
+ wwdialog.addNewFilterPool(getShell(), dlgOutput.newPool);
+ else if (dlgOutput.newPool != null)
+ {
+ ISystemFilterPoolReferenceManagerProvider sfprmp = getReferenceManagerProviderSelection();
+ // Action selected by user when a reference manager provider was selected.
+ // Seems obvious then that the user wishes to see the newly created pool, so
+ // we take the liberty of creating a reference object...
+ if (sfprmp != null)
+ {
+ ISystemFilterPoolReferenceManager sfprm = sfprmp.getSystemFilterPoolReferenceManager();
+ //System.out.println("...calling addREferenceToSystemFilterPool...");
+ sfprm.addReferenceToSystemFilterPool(dlgOutput.newPool);
+ //System.out.println("...back from addREferenceToSystemFilterPool");
+ }
+ }
+ }
+
+ /**
+ * Returns array of managers to show in combo box.
+ * Overrides parent to call back to wwdialog if not null.
+ */
+ public ISystemFilterPoolManager[] getFilterPoolManagers()
+ {
+ if (wwdialog != null)
+ return wwdialog.getFilterPoolManagers();
+ else
+ return super.getFilterPoolManagers();
+ }
+
+ /**
+ * Returns the zero-based index of the manager name to preselect.
+ * Overrides parent to call back to wwdialog if not null.
+ */
+ public int getFilterPoolManagerNameSelectionIndex()
+ {
+ if (wwdialog != null)
+ return wwdialog.getFilterPoolManagerSelection();
+ else
+ return super.getFilterPoolManagerNameSelectionIndex();
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterPoolReferenceSelectAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterPoolReferenceSelectAction.java
new file mode 100644
index 00000000000..00b1a287064
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterPoolReferenceSelectAction.java
@@ -0,0 +1,85 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.filters.actions;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.core.SystemBasePlugin;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.filters.ISystemFilterPool;
+import org.eclipse.rse.filters.ISystemFilterPoolReferenceManager;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.actions.SystemBaseAction;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * A selectable filter pool name action.
+ * This is typically used to allow users to select a filter pool for referencing
+ */
+public class SystemFilterPoolReferenceSelectAction extends SystemBaseAction
+
+{
+ private ISystemFilterPool pool;
+ private ISystemFilterPoolReferenceManager refMgr;
+
+ /**
+ * Constructor
+ */
+ public SystemFilterPoolReferenceSelectAction(Shell parent, ISystemFilterPool pool, ISystemFilterPoolReferenceManager refMgr)
+ {
+ super(pool.getName(), SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_NEWFILTERPOOLREF_ID), parent);
+ this.pool = pool;
+ this.refMgr = refMgr;
+ //setChecked(false);
+ }
+
+ /**
+ * Set the help context Id (infoPop) for this action. This must be fully qualified by
+ * plugin ID.
+ *
+ * Same as {@link org.eclipse.rse.ui.actions.SystemBaseAction #setHelp(String)}
+ * @see org.eclipse.rse.ui.actions.SystemBaseAction #getHelpContextId()
+ */
+ public void setHelpContextId(String id)
+ {
+ setHelp(id);
+ }
+
+ /**
+ * @see SystemBaseAction#updateSelection(IStructuredSelection)
+ */
+ public boolean updateSelection(IStructuredSelection selection)
+ {
+ boolean enable = true;
+ return enable;
+ }
+
+ /**
+ * This is the method called when the user selects this action.
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ public void run()
+ {
+ //System.out.println("Pretend to select");
+ try
+ {
+ refMgr.addReferenceToSystemFilterPool(pool);
+ } catch (Exception exc)
+ {
+ SystemBasePlugin.logError("Unexpected error adding filter pool reference",exc);
+ }
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterRemoveFilterPoolReferenceAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterRemoveFilterPoolReferenceAction.java
new file mode 100644
index 00000000000..fa132e15cf9
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterRemoveFilterPoolReferenceAction.java
@@ -0,0 +1,94 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.filters.actions;
+import java.util.Iterator;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.filters.ISystemFilterPoolReference;
+import org.eclipse.rse.filters.ISystemFilterPoolReferenceManager;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.actions.SystemBaseAction;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * The action allows users to remove a filter pool reference
+ */
+public class SystemFilterRemoveFilterPoolReferenceAction
+ extends SystemBaseAction
+
+{
+
+
+ /**
+ * Constructor
+ */
+ public SystemFilterRemoveFilterPoolReferenceAction(Shell parent)
+ {
+ super(SystemResources.ACTION_RMVFILTERPOOLREF_LABEL,SystemResources.ACTION_RMVFILTERPOOLREF_TOOLTIP,
+ SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_DELETEREF_ID),
+ parent);
+ allowOnMultipleSelection(true);
+ setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORGANIZE);
+ }
+
+ /**
+ * Set the help context Id (infoPop) for this action. This must be fully qualified by
+ * plugin ID.
+ *
+ * Same as {@link org.eclipse.rse.ui.actions.SystemBaseAction #setHelp(String)}
+ * @see org.eclipse.rse.ui.actions.SystemBaseAction #getHelpContextId()
+ */
+ public void setHelpContextId(String id)
+ {
+ setHelp(id);
+ }
+
+ /**
+ * Called by SystemBaseAction when selection is set.
+ * Our opportunity to verify we are allowed for this selected type.
+ */
+ public boolean checkObjectType(Object selectedObject)
+ {
+ if (!(selectedObject instanceof ISystemFilterPoolReference))
+ return false;
+ // disable if this is a connection-unique filter pool
+ else
+ return ((ISystemFilterPoolReference)selectedObject).getReferencedFilterPool().getOwningParentName() == null;
+ }
+
+ /**
+ * This is the method called when the user selects this action.
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ public void run()
+ {
+ IStructuredSelection selections = getSelection();
+ ISystemFilterPoolReference poolReferences[] = new ISystemFilterPoolReference[selections.size()];
+ Iterator i = selections.iterator();
+ ISystemFilterPoolReferenceManager fprMgr = null;
+ while (i.hasNext())
+ {
+ ISystemFilterPoolReference poolReference = (ISystemFilterPoolReference)i.next();
+ fprMgr = poolReference.getFilterPoolReferenceManager();
+ fprMgr.removeSystemFilterPoolReference(poolReference,true); // true means do dereference
+ }
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterSelectFilterPoolsAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterSelectFilterPoolsAction.java
new file mode 100644
index 00000000000..fc96b6413e2
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterSelectFilterPoolsAction.java
@@ -0,0 +1,268 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.filters.actions;
+import java.util.Vector;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.filters.ISystemFilterPool;
+import org.eclipse.rse.filters.ISystemFilterPoolManager;
+import org.eclipse.rse.filters.ISystemFilterPoolReferenceManager;
+import org.eclipse.rse.filters.ISystemFilterPoolReferenceManagerProvider;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
+import org.eclipse.rse.ui.dialogs.SystemSimpleSelectDialog;
+import org.eclipse.rse.ui.filters.SystemFilterPoolDialogInterface;
+import org.eclipse.rse.ui.filters.SystemFilterUIHelpers;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * The action that displays the Select Filter Pools dialog, and which returns
+ * an array of selected filter pools.
+ *
+ * Dialog will display a root node for each manager, and then the filter pools
+ * within each manager as children. User can select any pool from any of the
+ * given managers.
+ *
+ * Uses getName() on manager for display name of root nodes.
+ *
+ * Typically, such a dialog is used to allow the user to select a subset of pools
+ * that they will access in some context. There is framework support for such
+ * selections, via SystemFilterPoolReferences. Each of these are a reference to a
+ * filter pool, and the SystemFilterPoolReferenceManager class offers full support
+ * for manager a list of such references, optionally even saving and restoring such
+ * a list.
+ *
+ *
+ * You call the setFilterPoolManagers method to set the array of filter pool managers
+ * this dialog allows the user to select from.
+ *
+ * If you also call the optional method setFilterPoolReferenceManager, you need not
+ * subclass this action. It will handle everything for you!!
+ *
+ * Assumes setFilterPoolManagers has been called.
+ *
+ * Dialog will display a root node for each manager, and then the filter pools
+ * within each manager as children. User can select any pool from any of the
+ * given managers.
+ *
+ * Uses getName() on manager for display name of root nodes.
+ *
+ * @see org.eclipse.rse.ui.actions.SystemBaseDialogAction#run()
+ */
+ protected Dialog createDialog(Shell parent)
+ {
+ SystemSimpleSelectDialog dialog =
+ new SystemSimpleSelectDialog(parent, getDialogTitle(), getDialogPrompt());
+
+ ISystemFilterPoolManager[] mgrs = getFilterPoolManagers();
+ ISystemFilterPoolReferenceManagerProvider sprmp = getReferenceManagerProviderSelection();
+ ISystemFilterPoolManager[] additionalMgrs = null;
+ if (sprmp != null)
+ additionalMgrs = sprmp.getSystemFilterPoolReferenceManager().getAdditionalSystemFilterPoolManagers();
+ if (additionalMgrs != null)
+ {
+ ISystemFilterPoolManager[] allmgrs = new ISystemFilterPoolManager[mgrs.length+additionalMgrs.length];
+ int allidx = 0;
+ for (int idx=0; idx
+ * @param dlgOutput The array of SystemFilterPools selected by the user, as set in getDialogValue()
+ */
+ public void doOKprocessing(Object dlgOutput)
+ {
+ ISystemFilterPool[] selectedPools = (ISystemFilterPool[])dlgOutput;
+ ISystemFilterPoolReferenceManagerProvider sfprmp = getReferenceManagerProviderSelection();
+ if (sfprmp != null)
+ {
+ sfprmp.getSystemFilterPoolReferenceManager().setSystemFilterPoolReferences(selectedPools,true);
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterWorkWithFilterPoolsAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterWorkWithFilterPoolsAction.java
new file mode 100644
index 00000000000..b01b699d5c4
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterWorkWithFilterPoolsAction.java
@@ -0,0 +1,199 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.filters.actions;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.filters.ISystemFilterPoolManager;
+import org.eclipse.rse.filters.ISystemFilterPoolReferenceManagerProvider;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
+import org.eclipse.rse.ui.filters.SystemFilterPoolDialogInterface;
+import org.eclipse.rse.ui.filters.SystemFilterPoolManagerUIProvider;
+import org.eclipse.rse.ui.filters.SystemFilterUIHelpers;
+import org.eclipse.rse.ui.filters.dialogs.SystemFilterWorkWithFilterPoolsDialog;
+import org.eclipse.rse.ui.validators.ValidatorFilterPoolName;
+import org.eclipse.swt.widgets.Shell;
+
+
+
+/**
+ * The action that displays the Work With Filter Pools dialog
+ */
+public class SystemFilterWorkWithFilterPoolsAction
+ extends SystemFilterAbstractFilterPoolAction
+ implements SystemFilterPoolManagerUIProvider
+{
+
+ private ValidatorFilterPoolName poolNameValidator = null;
+
+ /**
+ * Constructor when default label desired.
+ */
+ public SystemFilterWorkWithFilterPoolsAction(Shell parent)
+ {
+ super(parent,
+ SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_WORKWITHFILTERPOOLS_ID),
+ SystemResources.ACTION_WORKWITH_FILTERPOOLS_LABEL, SystemResources.ACTION_WORKWITH_FILTERPOOLS_TOOLTIP);
+ setContextMenuGroup(ISystemContextMenuConstants.GROUP_WORKWITH);
+ allowOnMultipleSelection(false);
+ // set default action and dialog help
+ setHelp(SystemPlugin.HELPPREFIX + "actn0044");
+ setDialogHelp(SystemPlugin.HELPPREFIX + "dwfp0000");
+ }
+ /**
+ * Constructor when default label desired, and you want to choose between
+ * Work With -> Filter Pools and Work With Filter Pools.
+ */
+ public SystemFilterWorkWithFilterPoolsAction(Shell parent, boolean cascadingAction)
+ {
+ super(parent,
+ SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_WORKWITHFILTERPOOLS_ID),
+ cascadingAction ? SystemResources.ACTION_WORKWITH_FILTERPOOLS_LABEL : SystemResources.ACTION_WORKWITH_WWFILTERPOOLS_LABEL,
+ cascadingAction ? SystemResources.ACTION_WORKWITH_FILTERPOOLS_TOOLTIP : SystemResources.ACTION_WORKWITH_WWFILTERPOOLS_TOOLTIP
+ );
+ if (cascadingAction)
+ setContextMenuGroup(ISystemContextMenuConstants.GROUP_WORKWITH);
+ else
+ setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORGANIZE);
+ allowOnMultipleSelection(false);
+ // set default action and dialog help
+ setHelp(SystemPlugin.HELPPREFIX + "actn0044");
+ setDialogHelp(SystemPlugin.HELPPREFIX + "dwfp0000");
+ }
+ /**
+ * Constructor when given the translated action label
+ */
+ public SystemFilterWorkWithFilterPoolsAction(Shell parent, String title)
+ {
+ super(parent, title);
+ setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORGANIZE);
+ allowOnMultipleSelection(false);
+ // set default action and dialog help
+ setHelp(SystemPlugin.HELPPREFIX + "actn0044");
+ setDialogHelp(SystemPlugin.HELPPREFIX + "dwfp0000");
+ }
+
+
+ /**
+ * Override of init in parent
+ */
+ protected void init()
+ {
+ super.init();
+ dlgInputs.prompt = SystemResources.RESID_WORKWITHFILTERPOOLS_PROMPT;
+ dlgInputs.title = SystemResources.RESID_WORKWITHFILTERPOOLS_TITLE;
+ }
+
+ /**
+ * Reset between runs
+ */
+ public void reset()
+ {
+ }
+
+ /**
+ * Set the pool name validator for the rename action.
+ * The work-with dialog automatically calls setExistingNamesList on it for each selection.
+ */
+ public void setFilterPoolNameValidator(ValidatorFilterPoolName pnv)
+ {
+ this.poolNameValidator = pnv;
+ }
+
+ /**
+ * Called by SystemBaseAction when selection is set.
+ * Our opportunity to verify we are allowed for this selected type.
+ */
+ public boolean checkObjectType(Object selectedObject)
+ {
+ //return (selectedObject instanceof SystemFilterPoolReferenceManagerProvider); // override as appropriate
+ return true; // override as appropriate
+ }
+
+
+ /**
+ * Override of parent to create and return our specific filter pool dialog.
+ */
+ public SystemFilterPoolDialogInterface createFilterPoolDialog(Shell parent)
+ {
+ //SystemFilterPoolManager[] mgrs = getFilterPoolManagers();
+ //SystemSimpleContentElement input = getTreeModel();
+ //SystemFilterUIHelpers.getFilterPoolModel(getFilterPoolImageDescriptor(),mgrs);
+
+ SystemFilterWorkWithFilterPoolsDialog dialog =
+ new SystemFilterWorkWithFilterPoolsDialog(parent, getDialogTitle(), getDialogPrompt(), this);
+
+ if (poolNameValidator != null)
+ dialog.setFilterPoolNameValidator(poolNameValidator);
+
+ //SystemSimpleContentElement initialElementSelection = getTreeModelPreSelection(input);
+ //if (initialElementSelection != null)
+ //dialog.setRootToPreselect(initialElementSelection);
+
+ return dialog;
+ }
+
+ /**
+ * Callback for dialog to refresh its contents
+ */
+ public SystemSimpleContentElement getTreeModel()
+ {
+ ISystemFilterPoolManager[] mgrs = getFilterPoolManagers();
+ SystemSimpleContentElement input =
+ SystemFilterUIHelpers.getFilterPoolModel(getFilterPoolManagerProvider(), mgrs);
+ return input;
+ }
+ /**
+ * Callback for dialog to refresh its contents
+ */
+ public SystemSimpleContentElement getTreeModelPreSelection(SystemSimpleContentElement input)
+ {
+ ISystemFilterPoolReferenceManagerProvider sprmp = getReferenceManagerProviderSelection();
+ SystemSimpleContentElement initialElementSelection = null;
+ if (sprmp != null)
+ {
+ ISystemFilterPoolManager initialSelection = sprmp.getSystemFilterPoolReferenceManager().getDefaultSystemFilterPoolManager();
+ if (initialSelection != null)
+ {
+ initialElementSelection = SystemFilterUIHelpers.getDataElement(input, initialSelection);
+ //if (initialElementSelection != null)
+ //dialog.setRootToPreselect(initialElementSelection);
+ }
+ }
+ return initialElementSelection;
+ }
+
+ /**
+ * We are a special case of dialog, where we do not need to do anything
+ * upon return from the dialog, as the dialog itself does it all.
+ */
+ protected Object getDialogValue(Dialog dlg)
+ {
+ return null;
+ }
+
+ /**
+ * Because we return null from getDialogValue(Dialog dlg), this
+ * method will never be called.
+ */
+ public void doOKprocessing(Object dlgValue)
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterWorkWithFilterPoolsRefreshAllAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterWorkWithFilterPoolsRefreshAllAction.java
new file mode 100644
index 00000000000..e82b008a02f
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterWorkWithFilterPoolsRefreshAllAction.java
@@ -0,0 +1,82 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.filters.actions;
+//import com.ibm.etools.systems.model.*;
+//import com.ibm.etools.systems.model.impl.*;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.actions.SystemBaseAction;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * The action allows users to refresh the entire Remote Systems Explorer tree view
+ */
+public class SystemFilterWorkWithFilterPoolsRefreshAllAction extends SystemBaseAction
+
+{
+
+
+ private TreeViewer viewer = null;
+
+ /**
+ * Constructor
+ */
+ public SystemFilterWorkWithFilterPoolsRefreshAllAction(TreeViewer viewer, Shell parent)
+ {
+ super(SystemResources.ACTION_REFRESH_ALL_LABEL,SystemResources.ACTION_REFRESH_ALL_TOOLTIP,
+ SystemPlugin.getDefault().getImageDescriptorFromIDE(ISystemIconConstants.ICON_IDE_REFRESH_ID),
+ parent);
+ this.viewer = viewer;
+ allowOnMultipleSelection(true);
+ setContextMenuGroup(ISystemContextMenuConstants.GROUP_BUILD);
+ }
+
+ /**
+ * Set the help context Id (infoPop) for this action. This must be fully qualified by
+ * plugin ID.
+ *
+ * Same as {@link org.eclipse.rse.ui.actions.SystemBaseAction #setHelp(String)}
+ * @see org.eclipse.rse.ui.actions.SystemBaseAction #getHelpContextId()
+ */
+ public void setHelpContextId(String id)
+ {
+ setHelp(id);
+ }
+
+ /**
+ * @see SystemBaseAction#updateSelection(IStructuredSelection)
+ */
+ public boolean updateSelection(IStructuredSelection selection)
+ {
+ boolean enable = true;
+ return enable;
+ }
+
+ /**
+ * This is the method called when the user selects this action.
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ public void run()
+ {
+ viewer.refresh();
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemNewFilterAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemNewFilterAction.java
new file mode 100644
index 00000000000..697017fda8a
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemNewFilterAction.java
@@ -0,0 +1,492 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.filters.actions;
+import java.util.Vector;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.filters.ISystemFilter;
+import org.eclipse.rse.filters.ISystemFilterContainer;
+import org.eclipse.rse.filters.ISystemFilterContainerReference;
+import org.eclipse.rse.filters.ISystemFilterPool;
+import org.eclipse.rse.filters.ISystemFilterPoolReference;
+import org.eclipse.rse.filters.ISystemFilterPoolReferenceManagerProvider;
+import org.eclipse.rse.filters.ISystemFilterPoolSelectionValidator;
+import org.eclipse.rse.filters.ISystemFilterPoolWrapperInformation;
+import org.eclipse.rse.filters.ISystemFilterReference;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.actions.SystemBaseWizardAction;
+import org.eclipse.rse.ui.filters.SystemFilterStringEditPane;
+import org.eclipse.rse.ui.filters.dialogs.SystemNewFilterWizard;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * The action acts as a base class for all "New Filter" wizards so we can
+ * get some common functionality.
+ *
+ * An interesting capability of this action is to defer configuration, which might be
+ * time consuming, until the user selects to run it. That can be done by registering
+ * a callback object that implements ISystemNewFilterActionConfigurator.
+ */
+public class SystemNewFilterAction
+ extends SystemBaseWizardAction
+
+{
+ protected ISystemFilterPool parentPool;
+ protected ISystemFilterPool[] poolsToSelectFrom;
+ protected ISystemFilterPoolWrapperInformation poolWrapperInformation;
+ protected boolean nested = false;
+ protected boolean showFilterStrings = true;
+ protected boolean showNamePrompt = true;
+ protected boolean showInfoPage = true;
+ protected boolean fromRSE = false;
+ protected String[] defaultFilterStrings;
+ protected String type = null;
+ protected String verbage = null;
+ protected String page1Description;
+ protected String namePageHelp;
+ protected ISystemFilterPoolSelectionValidator filterPoolSelectionValidator;
+ protected ISystemNewFilterActionConfigurator callbackConfigurator;
+ protected boolean callbackConfiguratorCalled = true;
+ protected Object callbackData = null;
+ protected SystemFilterStringEditPane editPane;
+
+ /**
+ * Constructor for non-nested actions.
+ */
+ public SystemNewFilterAction(Shell shell, ISystemFilterPool parentPool,
+ String label, String tooltip, ImageDescriptor image)
+ {
+ this(shell, parentPool, label, tooltip, image, false);
+ }
+ /**
+ * Constructor allowing nested actions. Changes the title.
+ */
+ public SystemNewFilterAction(Shell shell, ISystemFilterPool parentPool,
+ String label, String tooltip, ImageDescriptor image,
+ boolean nested)
+ {
+ super(label, tooltip, image, shell);
+ setContextMenuGroup(ISystemContextMenuConstants.GROUP_NEW);
+ this.parentPool = parentPool;
+ this.nested = nested;
+ setAvailableOffline(true);
+ }
+ /**
+ * Constructor to use when you want to just use the default action name and image.
+ * Also defaults to nested filters not allowed.
+ */
+ public SystemNewFilterAction(Shell shell, ISystemFilterPool parentPool)
+ {
+ this(shell, parentPool, SystemResources.ACTION_NEWFILTER_LABEL, SystemResources.ACTION_NEWFILE_TOOLTIP,
+ SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_NEWFILTER_ID), false);
+ }
+
+ // ------------------------
+ // CONFIGURATION METHODS...
+ // ------------------------
+
+ /**
+ * Configuration method. Do not override.
+ * Same as {@link org.eclipse.rse.ui.actions.SystemBaseAction #setHelp(String)}
+ * @see org.eclipse.rse.ui.actions.SystemBaseAction #getHelpContextId()
+ */
+ public void setHelpContextId(String id)
+ {
+ setHelp(id);
+ }
+ /**
+ * Configuration method. Do not override.
+ * If you want to prompt the user for the parent filter pool to create this filter in,
+ * but want to not use the term "pool" say, you can use an array of euphamisms. That is,
+ * you can pass an array of objects that map to filter pools, but have a different
+ * display name that is shown in the dropdown.
+ *
+ * Of course, if you want to do this, then you will likely want to offer a different
+ * label and tooltip for the prompt, and different verbage above the prompt. The
+ * object this method accepts as a parameter encapsulates all that information, and
+ * there is a default class you can use for this.
+ */
+ public void setAllowFilterPoolSelection(ISystemFilterPoolWrapperInformation poolsToSelectFrom)
+ {
+ this.poolWrapperInformation = poolsToSelectFrom;
+ }
+
+ /**
+ * Configuration method. Do not override. This will also result in a call to setType(String) on the filter string edit pane, which
+ * sets the type instance variable in case your edit pane subclass needs to know.
+ */
+ public void setType(String type)
+ {
+ this.type = type;
+ }
+ /**
+ * Getter method. Do not override.
+ * This is used when creating temporary filters that won't be saved. In this case, on
+ * Finish a filter is not created! Instead, call getFilterStrings() to get the filter
+ * strings created by the user ... typically there is just one unless you also called
+ * setDefaultFilterStrings, in which case they will also be returned.
+ *
+ * For convenience, when this is called, setShowInfoPage(false) is called for you
+ */
+ public void setShowNamePrompt(boolean show)
+ {
+ showNamePrompt = show;
+ }
+ /**
+ * Configuration method. Do not override.
+ * This is set to true automatically by the subsystem factory base class in the RSE,
+ * else it defaults to false.
+ */
+ public void setFromRSE(boolean rse)
+ {
+ this.fromRSE = true;
+ }
+ /**
+ * Configuration method. Do not override.
+ * Note, at the point this is called, all the base configuration, based on the
+ * setters for this action, have been called. There really is nothing much that
+ * can't be done via setters. The reason you may want to subclass versus use the
+ * setters is defer expensive operations until the user actually selects the New Filter
+ * action. Using the setters means this is done at time the popup menu is being
+ * construction. Overriding this method allows you to defer the wizard configuration
+ * until the user selects the action and the wizard is actually created.
+ * By default, this does nothing.
+ */
+ protected void configureNewFilterWizard(SystemNewFilterWizard wizard)
+ {
+ }
+
+ /**
+ * Overridable configuration method. By default, this does nothing.
+ */
+ protected void configureNewFilter(ISystemFilter newFilter)
+ {
+ }
+
+ // --------------------
+ // LIFECYCLE METHODS...
+ // --------------------
+
+ /**
+ * Lifecyle method. Do not override. Instead override {@link #createNewFilterWizard(ISystemFilterPool)}.
+ * Note your own wizard must subclass {@link org.eclipse.rse.ui.filters.dialogs.SystemNewFilterWizard SystemNewFilterWizard}
+ */
+ protected IWizard createWizard()
+ {
+ if ((callbackConfigurator != null) && !callbackConfiguratorCalled)
+ {
+ callbackConfigurator.configureNewFilterAction(((ISubSystem)callbackData).getSubSystemConfiguration(), this, callbackData);
+ callbackConfiguratorCalled = true;
+ }
+ SystemNewFilterWizard wizard = createNewFilterWizard(parentPool);
+ if (poolsToSelectFrom != null)
+ wizard.setAllowFilterPoolSelection(poolsToSelectFrom);
+ else if (poolWrapperInformation != null)
+ wizard.setAllowFilterPoolSelection(poolWrapperInformation);
+ if (type != null)
+ wizard.setType(type);
+ if (defaultFilterStrings != null)
+ wizard.setDefaultFilterStrings(defaultFilterStrings);
+ if (namePageHelp != null)
+ wizard.setNamePageHelp(namePageHelp);
+ wizard.setShowFilterStrings(showFilterStrings);
+ wizard.setShowNamePrompt(showNamePrompt);
+ wizard.setShowInfoPage(showInfoPage);
+ wizard.setFromRSE(fromRSE);
+ if (verbage != null)
+ wizard.setVerbage(verbage);
+ if (page1Description != null)
+ wizard.setPage1Description(page1Description);
+ if (filterPoolSelectionValidator != null)
+ wizard.setFilterPoolSelectionValidator(filterPoolSelectionValidator);
+ if (editPane != null)
+ wizard.setFilterStringEditPane(editPane);
+ ISystemFilterPoolReferenceManagerProvider provider = getSystemFilterPoolReferenceManagerProvider();
+ //SystemPlugin.logDebugMessage(this.getClass().getName(),"Inside createWizard. null? " + (provider==null));
+ wizard.setSystemFilterPoolReferenceManagerProvider(provider);
+ configureNewFilterWizard(wizard);
+ return wizard;
+ }
+
+ /**
+ * Overridable lifecyle method.
+ * You can avoid creating your own wizard subclass by instead overriding
+ * {@link #configureNewFilterWizard(SystemNewFilterWizard)}
+ */
+ protected SystemNewFilterWizard createNewFilterWizard(ISystemFilterPool parentPool)
+ {
+ return new SystemNewFilterWizard(parentPool);
+ }
+ /**
+ * Lifecyle method. Do not override. Instead override {@link #configureNewFilter(ISystemFilter)}.
+ * Be sure to call wasCancelled() first before calling this.
+ */
+ public ISystemFilter getNewFilter()
+ {
+ Object output = getValue();
+ if (output instanceof ISystemFilter)
+ return (ISystemFilter)getValue();
+ else
+ return null;
+ }
+
+ /**
+ * Output method. Do not override.
+ * Be sure to call wasCancelled() first before calling this.
+ */
+ public String[] getFilterStrings()
+ {
+ Object output = getValue();
+ if (output == null)
+ return null;
+ else if (output instanceof Vector)
+ {
+ Vector v = (Vector)output;
+ String[] strings = new String[v.size()];
+ for (int idx=0; idx
+ * Your best option is to subclass {@link SystemNewFilterWizardConfigurator} and override just those
+ * things you want to change.
+ */
+public interface ISystemNewFilterWizardConfigurator
+{
+
+ /**
+ * Return the default page title to use for each page, unless overridden individually
+ */
+ public String getPageTitle();
+ /**
+ * Return the page title for page 1 (which prompts for the filter string)
+ */
+ public String getPage1Title();
+ /**
+ * Return the description for page 1 (which prompts for the filter string)
+ */
+ public String getPage1Description();
+
+ /**
+ * Return the page title for page 2 (which prompts for the name and filter pool)
+ */
+ public String getPage2Title();
+ /**
+ * Return the description for page 2 (which prompts for the name and filter pool)
+ */
+ public String getPage2Description();
+ /**
+ * Return the help ID for page 2
+ */
+ public String getPage2HelpID();
+ /**
+ * Return the verbage for the name prompt on page 2
+ */
+ public String getPage2NameVerbage();
+ /**
+ * Return the verbage for the pool prompt on page 3
+ */
+ public String getPage2PoolVerbage();
+ /**
+ * Return the verbage tooltip for the name prompt on page 2
+ */
+ public String getPage2PoolVerbageTip();
+ /**
+ * Return the label for the filter name
+ * prompt on page 2.
+ */
+ public String getPage2NamePromptLabel();
+
+ /**
+ * Return the tooltip for the filter name
+ * prompt on page 2.
+ */
+ public String getPage2NamePromptTooltip();
+
+ /**
+ * Return the label for the filter pool
+ * prompt on page 2.
+ */
+ public String getPage2PoolPromptLabel();
+
+ /**
+ * Return the label for the filter pool
+ * prompt on page 2.
+ */
+ public String getPage2PoolPromptTooltip();
+
+ /**
+ * Get the "Unique to this connection" checkbox label
+ */
+ public String getPage2UniqueToConnectionLabel();
+ /**
+ * Set the "Unique to this connection" checkbox tooltip
+ */
+ public String getPage2UniqueToConnectionToolTip();
+
+ /**
+ * Return the page title for page 3 (which shows 2 tips)
+ */
+ public String getPage3Title();
+ /**
+ * Return the description for page 3 (which shows 2 tips)
+ */
+ public String getPage3Description();
+ /**
+ * Return the first tip on page 3
+ */
+ public String getPage3Tip1();
+ /**
+ * Return the second tip on page 3
+ */
+ public String getPage3Tip2();
+
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemChangeFilterDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemChangeFilterDialog.java
new file mode 100644
index 00000000000..edad4280b59
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemChangeFilterDialog.java
@@ -0,0 +1,365 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.filters.dialogs;
+
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.filters.ISystemFilterPoolManagerProvider;
+import org.eclipse.rse.filters.ISystemFilterPoolReferenceManagerProvider;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemPageCompleteListener;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
+import org.eclipse.rse.ui.filters.ISystemChangeFilterPaneEditPaneSupplier;
+import org.eclipse.rse.ui.filters.SystemChangeFilterPane;
+import org.eclipse.rse.ui.filters.SystemFilterStringEditPane;
+import org.eclipse.rse.ui.validators.ISystemValidator;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * A dialog that allows the user to change a filter. It allows update of the filter strings.
+ * This is passed into the filter and filter string wizards and dialogs in case it is needed
+ * for context.
+ */
+ public void setSystemFilterPoolReferenceManagerProvider(ISystemFilterPoolReferenceManagerProvider provider)
+ {
+ changeFilterPane.setSystemFilterPoolReferenceManagerProvider(provider);
+ }
+ /**
+ * Configuration method
+ * This is passed into the filter and filter string wizards and dialogs in case it is needed
+ * for context.
+ */
+ public void setSystemFilterPoolManagerProvider(ISystemFilterPoolManagerProvider provider)
+ {
+ changeFilterPane.setSystemFilterPoolManagerProvider(provider);
+ }
+
+ /**
+ * Configuration method
+ * Your validator should extend ValidatorFilterString to inherited the uniqueness error checking.
+ *
+ * Alternatively, if all you want is a unique error message for the case when duplicates are found,
+ * call setDuplicateFilterStringErrorMessage, and it will be used in the default validator.
+ */
+ public void setFilterStringValidator(ISystemValidator v)
+ {
+ changeFilterPane.setFilterStringValidator(v);
+ }
+ /**
+ * Return the result of {@link #setFilterStringValidator(ISystemValidator)}.
+ */
+ public ISystemValidator getFilterStringValidator()
+ {
+ return changeFilterPane.getFilterStringValidator();
+ }
+ /**
+ * Configuration method
+ * While this class can be subclassed, you should find all attributes can be
+ * configured via setters.
+ */
+public class SystemNewFilterWizard
+ extends AbstractSystemWizard
+{
+ protected SystemNewFilterWizardMainPage mainPage;
+ protected SystemNewFilterWizardNamePage namePage;
+ protected SystemNewFilterWizardInfoPage infoPage;
+ protected ISystemFilterContainer filterContainer;
+ protected ISystemFilterPool parentPool;
+ protected ISystemFilterPool[] poolsToSelectFrom;
+ protected String type;
+ protected String[] defaultFilterStrings;
+ //protected String verbage;
+ //protected String page1Description;
+ protected boolean showFilterStrings = true;
+ protected boolean showNamePrompt = true;
+ protected boolean showInfoPage = true;
+ protected boolean fromRSE = false;
+ protected boolean page1DescriptionSet = false;
+ protected ISystemFilter newFilter = null;
+ protected SystemFilterStringEditPane editPane;
+ protected ISystemFilterPoolReferenceManagerProvider provider;
+ protected ISystemFilterPoolWrapperInformation poolWrapperInformation;
+ protected ISystemFilterPoolSelectionValidator filterPoolSelectionValidator;
+ protected ISystemNewFilterWizardConfigurator configurator;
+
+
+ /**
+ * Constructor when you want to supply your own title and image
+ * @param title - title to show for this wizard. This is used as the page title! The title is always "New"!
+ * @param wizardImage - title bar image for this wizard
+ * @param parentPool - the filter pool we are to create this filter in.
+ */
+ public SystemNewFilterWizard(String title, ImageDescriptor wizardImage, ISystemFilterPool parentPool)
+ {
+ this(new SystemNewFilterWizardConfigurator(title), wizardImage, parentPool);
+ }
+ /**
+ * Constructor when you want to use the default page title and image, or want to
+ * supply it via setWizardTitle and setWizardImage.
+ * @param parentPool - the filter pool we are to create this filter in.
+ */
+ public SystemNewFilterWizard(ISystemFilterPool parentPool)
+ {
+ this(new SystemNewFilterWizardConfigurator(),
+ SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_NEWFILTERWIZARD_ID),
+ parentPool);
+ }
+ /**
+ * Constructor when you want to supply all your own configuration data
+ * @param data - configuration data
+ * @param wizardImage - title bar image for this wizard
+ * @param parentPool - the filter pool we are to create this filter in.
+ */
+ public SystemNewFilterWizard(ISystemNewFilterWizardConfigurator data, ImageDescriptor wizardImage, ISystemFilterPool parentPool)
+ {
+ super(SystemResources.RESID_NEWFILTER_TITLE, wizardImage);
+ super.setWizardPageTitle(data.getPageTitle());
+ super.setForcePreviousAndNextButtons(true);
+ this.configurator = data;
+ this.parentPool = parentPool;
+ setOutputObject(null);
+ }
+
+ // -----------------------------------
+ // INPUT/CONFIGURATION METHODS...
+ // -----------------------------------
+
+ /**
+ * If you want to prompt the user for the parent filter pool to create this filter in,
+ * call this with the list of filter pools. In this case, the filter pool passed into
+ * the constructor will be used as the initial selection.
+ */
+ public void setAllowFilterPoolSelection(ISystemFilterPool[] poolsToSelectFrom)
+ {
+ this.poolsToSelectFrom = poolsToSelectFrom;
+ }
+ /**
+ * This is an alternative to {@link #setAllowFilterPoolSelection(ISystemFilterPool[])}
+ *
+ * If you want to prompt the user for the parent filter pool to create this filter in,
+ * but want to not use the term "pool" say, you can use an array of euphamisms. That is,
+ * you can pass an array of objects that map to filter pools, but have a different
+ * display name that is shown in the dropdown.
+ *
+ * Of course, if you want to do this, then you will likely want to offer a different
+ * label and tooltip for the prompt, and different verbage above the prompt. The
+ * object this method accepts as a parameter encapsulates all that information, and
+ * there is a default class you can use for this.
+ */
+ public void setAllowFilterPoolSelection(ISystemFilterPoolWrapperInformation poolsToSelectFrom)
+ {
+ this.poolWrapperInformation = poolsToSelectFrom;
+ }
+ /**
+ * Set the type of filter we are creating. Results in a call to setType on the new filter.
+ * Types are not used by the base filter framework but are a way for tools to create typed
+ * filters and have unique actions per filter type.
+ */
+ public void setType(String type)
+ {
+ this.type = type;
+ }
+ /**
+ * Get the type of filter as set by {@link #setType(String)}
+ */
+ public String getType()
+ {
+ return type;
+ }
+ /**
+ * Call in order to not have the first page, but instead the name-prompt page. Default is true.
+ * @see #setDefaultFilterStrings(String[])
+ */
+ public void setShowFilterStrings(boolean show)
+ {
+ showFilterStrings = show;
+ }
+ /**
+ * Call in order to not prompt the user for a filter name. This also implies we will not
+ * be prompting for a parent filter pool! Default is true.
+ *
+ * This is used when creating temporary filters that won't be saved. In this case, on
+ * Finish a filter is not created! Instead, call getFilterStrings() to get the filter
+ * strings created by the user ... typically there is just one unless you also called
+ * setDefaultFilterStrings, in which case they will also be returned.
+ *
+ * For convenience, when this is called, setShowInfoPage(false) is called for you
+ */
+ public void setShowNamePrompt(boolean show)
+ {
+ showNamePrompt = show;
+ if (!show)
+ setShowInfoPage(false);
+ }
+ /**
+ * Specify the help to show for the name page (page 2)
+ */
+ public void setNamePageHelp(String helpId)
+ {
+ if (configurator instanceof SystemNewFilterWizardConfigurator)
+ ((SystemNewFilterWizardConfigurator)configurator).setPage2HelpID(helpId);
+ }
+ /**
+ * Call in order to not show the final info-only page of the wizard. Default is true.
+ */
+ public void setShowInfoPage(boolean show)
+ {
+ showInfoPage = show;
+ }
+ /**
+ * Call this if you want the filter to auto-include some default filter strings.
+ */
+ public void setDefaultFilterStrings(String[] defaultFilterStrings)
+ {
+ this.defaultFilterStrings = defaultFilterStrings;
+ }
+ /**
+ * Set if we are creating a filter for use in the RSE or not. This affects the
+ * tips and help.
+ *
+ * This is set to true automatically by the subsystem factory base class in the RSE,
+ * else it defaults to false.
+ */
+ public void setFromRSE(boolean rse)
+ {
+ this.fromRSE = true;
+ }
+ /**
+ * Set the validator to call when the user selects a filter pool. Optional.
+ * Only valid in create mode.
+ */
+ public void setFilterPoolSelectionValidator(ISystemFilterPoolSelectionValidator validator)
+ {
+ this.filterPoolSelectionValidator = validator;
+ }
+
+ /**
+ * Set the contextual system filter pool reference manager provider. Eg, in the RSE, this
+ * will be the selected subsystem if the New Filter action is launched from there, or if
+ * launched from a filter pool reference under there.
+ *
+ * Will be non-null if the current selection is a reference to a filter pool or filter,
+ * or a reference manager provider.
+ *
+ * This is passed into the filter and filter string wizards and dialogs in case it is needed
+ * for context.
+ */
+ public void setSystemFilterPoolReferenceManagerProvider(ISystemFilterPoolReferenceManagerProvider provider)
+ {
+ this.provider = provider;
+ //SystemPlugin.logDebugMessage(this.getClass().getName(),"Inside setSystemFilterPoolReferenceManagerProvider. null? " + (provider==null));
+ }
+ /**
+ * Set the verbage to show on the final page. By default, it shows a tip about creating multiple
+ * filter strings via the Change action. Use this method to change that default.
+ */
+ public void setVerbage(String verbage)
+ {
+ if (configurator instanceof SystemNewFilterWizardConfigurator)
+ ((SystemNewFilterWizardConfigurator)configurator).setPage3Tip1(verbage);
+ }
+ /**
+ * Set the wizard page title. Using this makes it possible to avoid subclassing.
+ * The page title goes below the wizard title, and can be unique per page. However,
+ * typically the wizard page title is the same for all pages... eg "Filter".
+ *
+ * This is not used by default, but can be queried via getPageTitle() when constructing
+ * pages.
+ */
+ public void setWizardPageTitle(String pageTitle)
+ {
+ super.setWizardPageTitle(pageTitle);
+ if (configurator instanceof SystemNewFilterWizardConfigurator)
+ ((SystemNewFilterWizardConfigurator)configurator).setPageTitle(pageTitle);
+ }
+ /**
+ * Set the description to display on the first page of the wizard
+ */
+ public void setPage1Description(String description)
+ {
+ if (configurator instanceof SystemNewFilterWizardConfigurator)
+ ((SystemNewFilterWizardConfigurator)configurator).setPage1Description(description);
+ page1DescriptionSet = true;
+ }
+
+ /**
+ * Specify an edit pane that prompts the user for the contents of a filter string.
+ */
+ public void setFilterStringEditPane(SystemFilterStringEditPane editPane)
+ {
+ this.editPane = editPane;
+ }
+
+ // -----------------------------------
+ // INTERNAL BUT OVERRIDABLE METHODS...
+ // -----------------------------------
+ /**
+ * Extendable point for child classes. You don't need to override typically though... rather
+ * you can simply supply your own filter string edit pane.
+ *
+ * By default, this page uses the wizard page title as set in setWizardPageTitle(...) or the constructor.
+ * @return the primary page prompting for a single filter string.
+ */
+ protected SystemNewFilterWizardMainPage createMainPage()
+ {
+ mainPage = null;
+ if (editPane == null)
+ mainPage = new SystemNewFilterWizardMainPage(this, configurator);
+ else
+ mainPage = new SystemNewFilterWizardMainPage(this, editPane, configurator);
+ return mainPage;
+ }
+ /**
+ * Extendable point for child classes. You don't need to override typically though.
+ *
+ * By default, this page uses the wizard page title as set in setWizardPageTitle(...) or the constructor.
+ * @return the wizard page prompting for the filter name and parent filter pool
+ */
+ protected SystemNewFilterWizardNamePage createNamePage()
+ {
+ namePage = new SystemNewFilterWizardNamePage(this, parentPool, configurator);
+ return namePage;
+ }
+ /**
+ * Extendable point for child classes. You don't need to override typically though.
+ *
+ * By default, this page uses the wizard page title as set in setWizardPageTitle(...) or the constructor.
+ * @return the final wizard page with additional readonly information
+ */
+ protected SystemNewFilterWizardInfoPage createInfoPage()
+ {
+ boolean showFilterPoolsTip = ((poolsToSelectFrom != null) || (poolWrapperInformation != null));
+ infoPage = new SystemNewFilterWizardInfoPage(this, showFilterPoolsTip, configurator);
+ return infoPage;
+ }
+ /**
+ * Override of parent to do nothing
+ */
+ public void addPages() {}
+
+ /**
+ * Creates the wizard pages.
+ * This method is an override from the parent Wizard class.
+ */
+ public void createPageControls(Composite c)
+ {
+ try {
+ // MAIN PAGE...
+ mainPage = createMainPage();
+ mainPage.setSystemFilterPoolReferenceManagerProvider(provider);
+ mainPage.setType(type);
+ if (defaultFilterStrings != null)
+ mainPage.setDefaultFilterStrings(defaultFilterStrings);
+ if (showFilterStrings)
+ {
+ addPage((WizardPage)mainPage);
+ }
+
+ // NAME PAGE...
+ namePage = createNamePage();
+ if (showNamePrompt && (namePage!=null))
+ {
+ if (filterPoolSelectionValidator!=null)
+ namePage.setFilterPoolSelectionValidator(filterPoolSelectionValidator);
+ if (poolsToSelectFrom != null)
+ {
+ ISystemValidator[] validators = new ISystemValidator[poolsToSelectFrom.length];
+ for (int idx=0; idx
+ * Your best option is to subclass this and override just those things you want to change.
+ */
+public class SystemNewFilterWizardConfigurator
+ implements ISystemNewFilterWizardConfigurator, ISystemIconConstants
+{
+ // cached attrs
+ private String pageTitle;
+ private String page1Description, page2Help, page3Tip1, page3Tip2;
+
+ /**
+ * Constructor for SystemNewFilterWizardConfigurator.
+ */
+ protected SystemNewFilterWizardConfigurator()
+ {
+ this(SystemResources.RESID_NEWFILTER_PAGE_TITLE);
+ }
+ /**
+ * Constructor for SystemNewFilterWizardConfigurator when you want to change the page title
+ */
+ protected SystemNewFilterWizardConfigurator(String pageTitle)
+ {
+ super();
+ this.pageTitle = pageTitle;
+ this.page1Description = SystemResources.RESID_NEWFILTER_PAGE1_DESCRIPTION;
+ this.page3Tip1 = SystemResources.RESID_NEWFILTER_PAGE3_STRINGS_VERBAGE;
+ this.page3Tip2 = SystemResources.RESID_NEWFILTER_PAGE3_POOLS_VERBAGE;
+ this.page2Help = SystemPlugin.HELPPREFIX + "nfp20000";
+ }
+
+ /**
+ * Return the default page title to use for each page, unless overridden individually
+ */
+ public String getPageTitle()
+ {
+ return pageTitle;
+ }
+
+ /**
+ * Return the page title for page 1 (which prompts for the filter string)
+ */
+ public String getPage1Title()
+ {
+ return pageTitle;
+ }
+
+ /**
+ * Return the description for page 1 (which prompts for the filter string)
+ */
+ public String getPage1Description()
+ {
+ return page1Description;
+ }
+ /*page1 help of a wizard comes from the setDialogHelp of the wizard... so this is meaningless
+ * Return the help ID for page 1
+ *
+ public String getPage1HelpID()
+ {
+ return SystemPlugin.HELPPREFIX + "nfp10000";
+ }*/
+
+ /**
+ * Return the page title for page 2 (which prompts for the name and filter pool)
+ */
+ public String getPage2Title()
+ {
+ return pageTitle;
+ }
+ /**
+ * Return the description for page 2 (which prompts for the name and filter pool)
+ */
+ public String getPage2Description()
+ {
+ return SystemResources.RESID_NEWFILTER_PAGE2_DESCRIPTION;
+ }
+ /**
+ * Return the help ID for page 2
+ */
+ public String getPage2HelpID()
+ {
+ return page2Help;
+ }
+ /**
+ * Return the verbage for the name prompt on page 2
+ */
+ public String getPage2NameVerbage()
+ {
+ return SystemResources.RESID_NEWFILTER_PAGE2_NAME_VERBAGE;
+ }
+ /**
+ * Return the verbage for the name prompt on page 2
+ */
+ public String getPage2PoolVerbage()
+ {
+ return SystemResources.RESID_NEWFILTER_PAGE2_POOL_VERBAGE;
+ }
+ /**
+ * Return the verbage tooltip for the name prompt on page 2
+ */
+ public String getPage2PoolVerbageTip()
+ {
+ return SystemResources.RESID_NEWFILTER_PAGE2_POOL_VERBAGE_TIP;
+ }
+
+ public String getPage2NamePromptLabel()
+ {
+ return SystemResources.RESID_NEWFILTER_PAGE2_NAME_LABEL;
+ }
+
+ public String getPage2NamePromptTooltip()
+ {
+ return SystemResources.RESID_NEWFILTER_PAGE2_NAME_TOOLTIP;
+ }
+
+ public String getPage2PoolPromptLabel()
+ {
+ return SystemResources.RESID_NEWFILTER_PAGE2_POOL_LABEL;
+ }
+
+ public String getPage2PoolPromptTooltip()
+ {
+ return SystemResources.RESID_NEWFILTER_PAGE2_POOL_TOOLTIP;
+ }
+
+ /**
+ * Get the "Unique to this connection" checkbox label
+ */
+ public String getPage2UniqueToConnectionLabel()
+ {
+ return SystemResources.RESID_NEWFILTER_PAGE2_UNIQUE_LABEL;
+ }
+ /**
+ * Set the "Unique to this connection" checkbox tooltip
+ */
+ public String getPage2UniqueToConnectionToolTip()
+ {
+ return SystemResources.RESID_NEWFILTER_PAGE2_UNIQUE_TOOLTIP;
+ }
+
+ /**
+ * Return the page title for page 3 (which shows 2 tips)
+ */
+ public String getPage3Title()
+ {
+ return pageTitle;
+ }
+ /**
+ * Return the description for page 3 (which shows 2 tips)
+ */
+ public String getPage3Description()
+ {
+ return SystemResources.RESID_NEWFILTER_PAGE3_DESCRIPTION;
+ }
+ /**
+ * Return the description for page 3 (which shows 2 tips)
+ */
+ public String getPage3Tip1()
+ {
+ return page3Tip1;
+ }
+
+ /**
+ * Return the second tip on page 3
+ */
+ public String getPage3Tip2()
+ {
+ return page3Tip2;
+ }
+
+
+
+ // -------
+ // SETTERS
+ // -------
+ /**
+ * Set the default page title. Sometimes this is all you want to change and don't want to subclass.
+ */
+ public void setPageTitle(String pageTitle)
+ {
+ this.pageTitle = pageTitle;
+ }
+ /**
+ * Set the description for page 1
+ */
+ public void setPage1Description(String description)
+ {
+ this.page1Description = description;
+ }
+ /**
+ * Set the help ID for page 2
+ */
+ public void setPage2HelpID(String helpId)
+ {
+ this.page2Help = helpId;
+ }
+ /**
+ * Set the first tip to show for page 3
+ */
+ public void setPage3Tip1(String tip)
+ {
+ this.page3Tip1 = tip;
+ }
+ /**
+ * Set the second tip to show for page 3
+ */
+ public void setPage3Tip2(String tip)
+ {
+ this.page3Tip2 = tip;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemNewFilterWizardInfoPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemNewFilterWizardInfoPage.java
new file mode 100644
index 00000000000..ebc61c21eca
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemNewFilterWizardInfoPage.java
@@ -0,0 +1,116 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.filters.dialogs;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.SystemWidgetHelpers;
+import org.eclipse.rse.ui.wizards.AbstractSystemWizardPage;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+
+
+/**
+ * Third page of the New Filter wizard that simply shows information
+ */
+public class SystemNewFilterWizardInfoPage
+ extends AbstractSystemWizardPage
+ implements ISystemMessages
+{
+ private ISystemNewFilterWizardConfigurator configurator;
+
+ /**
+ * Constructor.
+ */
+ public SystemNewFilterWizardInfoPage(SystemNewFilterWizard wizard, boolean filterPoolsShowing, ISystemNewFilterWizardConfigurator data)
+ {
+ super(wizard, "NewFilterPage3", data.getPage3Title(), data.getPage3Description());
+ this.configurator = data;
+ //setHelp(data.getPage3HelpID());
+ }
+ // ---------------------------------
+ // LIFECYCLE METHODS...
+ // ---------------------------------
+
+ // ---------------------------------
+ // LIFECYCLE METHODS...
+ // ---------------------------------
+
+ /**
+ * Populate the dialog area with our widgets. Return the composite they are in.
+ */
+ public Control createContents(Composite parent)
+ {
+ int nbrColumns = 1;
+ Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns);
+
+ if (configurator.getPage3Tip1() != null)
+ {
+ SystemWidgetHelpers.createVerbage(composite_prompts, configurator.getPage3Tip1(), nbrColumns, false, 200);
+ addSeparatorLine(composite_prompts, nbrColumns);
+ addFillerLine(composite_prompts, nbrColumns);
+ }
+
+ if (((SystemNewFilterWizard)getWizard()).isFromRSE())
+ {
+ if (configurator.getPage3Tip2() != null)
+ SystemWidgetHelpers.createVerbage(composite_prompts, configurator.getPage3Tip2(), nbrColumns, false, 200);
+ }
+
+ return composite_prompts;
+ }
+
+ /**
+ * Return the Control to be given initial focus.
+ * Override from parent. Return control to be given initial focus.
+ */
+ protected Control getInitialFocusControl()
+ {
+ return null;
+ }
+
+ /**
+ * Completes processing of the wizard. If this
+ * method returns true, the wizard will close;
+ * otherwise, it will stay active.
+ * This method is an override from the parent Wizard class.
+ *
+ * @return true
+ */
+ public boolean performFinish()
+ {
+ return true;
+ }
+
+ /**
+ * Return true if the page is complete, so to enable Finish.
+ * Called by wizard framework.
+ * @return true
+ */
+ public boolean isPageComplete()
+ {
+ return true;
+ }
+
+ /**
+ * Inform wizard of page-complete status of this page
+ */
+ public void setPageComplete()
+ {
+ setPageComplete(isPageComplete());
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemNewFilterWizardMainPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemNewFilterWizardMainPage.java
new file mode 100644
index 00000000000..22cf3c76e63
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemNewFilterWizardMainPage.java
@@ -0,0 +1,259 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.filters.dialogs;
+
+import java.util.Vector;
+
+import org.eclipse.rse.filters.ISystemFilterPoolReferenceManagerProvider;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.filters.ISystemFilterStringEditPaneListener;
+import org.eclipse.rse.ui.filters.SystemFilterStringEditPane;
+import org.eclipse.rse.ui.wizards.AbstractSystemWizardPage;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * Main page of the abstract "New Filter" wizard.
+ * This page's content is supplyable in the form of an "edit pane" which
+ * essentially is reponsible for the content area of the wizard, and
+ * which implements necessary minimal methods for this wizard to
+ * interact with it.
+ *
+ * As per the design goals of the filter wizard, this page effectively
+ * only prompts to create a single new filter string. Thus, the
+ * edit pane needed is in fact the "new filter string" edit pane.
+ */
+
+public class SystemNewFilterWizardMainPage
+ extends AbstractSystemWizardPage
+ implements ISystemMessages, ISystemFilterStringEditPaneListener
+ //,SystemFilterNewFilterWizardMainPageInterface, ISystemMessageLine
+{
+ protected SystemFilterStringEditPane editPane;
+ protected String type;
+ protected String[] defaultFilterStrings;
+ protected boolean firstVisit = true;
+ private Control clientArea;
+ /**
+ * Constructor.
+ * Uses the wizard page title as set in the overall wizard.
+ * Uses a default wizard page description. Change later via setDescription if desired.
+ * @param wizard - the parent new filter wizard
+ * @param data - configurable mri data
+ */
+ public SystemNewFilterWizardMainPage(SystemNewFilterWizard wizard, ISystemNewFilterWizardConfigurator data)
+
+ {
+ super(wizard,"NewFilterPage1", data.getPage1Title(), data.getPage1Description());
+ editPane = getEditPane(wizard.getShell());
+ //setHelp(data.getPage1HelpID()); not used as it comes from wizard help
+ }
+ /**
+ * Constructor when unique edit pane supplied
+ * Uses the wizard page title as set in the overall wizard.
+ * Uses a default wizard page description. Change later via setDescription if desired.
+ * @param wizard - the parent new filter wizard
+ * @param editPane - the edit pane that prompts the user for a single filter string
+ * @param data - configurable mri data
+ */
+ public SystemNewFilterWizardMainPage(SystemNewFilterWizard wizard, SystemFilterStringEditPane editPane, ISystemNewFilterWizardConfigurator data)
+
+ {
+ super(wizard,"NewFilterPage1", data.getPage1Title(), data.getPage1Description());
+ this.editPane = editPane;
+ editPane.addChangeListener(this);
+ //setHelp(data.getPage1HelpID()); not used as it comes from wizard help
+ }
+ /**
+ * Set the contextual system filter pool reference manager provider. Ie, in the RSE this
+ * is the currently selected subsystem if this wizard was launched from a subsystem.
+ *
+ * Will be non-null if the current selection is a reference to a filter pool or filter,
+ * or a reference manager provider.
+ *
+ * This is not used by default but made available for subclasses.
+ */
+ public void setSystemFilterPoolReferenceManagerProvider(ISystemFilterPoolReferenceManagerProvider provider)
+ {
+ editPane.setSystemFilterPoolReferenceManagerProvider(provider);
+ }
+ /**
+ * Overrride this if you want to supply your own edit pane for the filter string.
+ */
+ protected SystemFilterStringEditPane getEditPane(Shell shell)
+ {
+ if (editPane == null)
+ editPane = new SystemFilterStringEditPane(shell);
+ return editPane;
+ }
+
+ /**
+ * CreateContents is the one method that must be overridden from the parent class.
+ * In this method, we populate an SWT container with widgets and return the container
+ * to the caller (JFace). This is used as the contents of this page.
+ */
+ public Control createContents(Composite parent)
+ {
+ clientArea = editPane.createContents(parent);
+ editPane.addChangeListener(this);
+ return clientArea;
+ }
+
+ /**
+ * Completes processing of the wizard. If this
+ * method returns true, the wizard will close;
+ * otherwise, it will stay active.
+ * This method is an override from the parent Wizard class.
+ *
+ * @return whether the wizard finished successfully
+ */
+ public boolean performFinish()
+ {
+ SystemMessage errorMessage = editPane.verify();
+ if (errorMessage != null)
+ setErrorMessage(errorMessage);
+ return (errorMessage == null);
+ }
+
+ /**
+ * Return the Control to be given initial focus.
+ * Override from parent. Return control to be given initial focus.
+ */
+ protected Control getInitialFocusControl()
+ {
+ return editPane.getInitialFocusControl();
+ }
+ // ------------------------------------
+ // METHODS FOR EXTRACTING USER DATA ...
+ // ------------------------------------
+ /**
+ * Return the user-specified filter strings
+ */
+ public Vector getFilterStrings()
+ {
+ Vector v = new Vector();
+
+ String userAddedString = editPane.getFilterString();
+ if ((userAddedString !=null) && (userAddedString.length()>0))
+ {
+ if (!v.contains(userAddedString))
+ v.add(userAddedString);
+ }
+ else if (defaultFilterStrings != null)
+ {
+ for (int idx=0; idx
+ * If you want to prompt the user for the parent filter pool to create this filter in,
+ * but want to not use the term "pool" say, you can use an array of euphamisms. That is,
+ * you can pass an array of objects that map to filter pools, but have a different
+ * display name that is shown in the dropdown.
+ *
+ * Of course, if you want to do this, then you will likely want to offer a different
+ * label and tooltip for the prompt, and different verbage above the prompt. The
+ * object this method accepts as a parameter encapsulates all that information, and
+ * there is a default class you can use for this.
+ */
+ public void setAllowFilterPoolSelection(ISystemFilterPoolWrapperInformation poolWrappersToSelectFrom,
+ ISystemValidator[] nameValidators)
+ {
+ this.poolWrapperInformation = poolWrappersToSelectFrom;
+ this.nameValidators = nameValidators;
+ if (parentPool == null)
+ parentPool = poolWrappersToSelectFrom.getPreSelectWrapper().getSystemFilterPool();
+ }
+ /**
+ * Set the validator to call when the user selects a filter pool. Optional.
+ */
+ public void setFilterPoolSelectionValidator(ISystemFilterPoolSelectionValidator validator)
+ {
+ filterPoolSelectionValidator = validator;
+ //System.out.println("Inside setFilterPoolSelectionValidator. Non null? " + (validator != null));
+ }
+
+ // ---------------------------------
+ // LIFECYCLE METHODS...
+ // ---------------------------------
+
+ /**
+ * Populate the dialog area with our widgets. Return the composite they are in.
+ */
+ public Control createContents(Composite parent)
+ {
+
+ int nbrColumns = 2;
+ Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns);
+
+ SystemWidgetHelpers.createVerbage(composite_prompts, configurator.getPage2NameVerbage(), nbrColumns, false, 200);
+ nameText = SystemWidgetHelpers.createLabeledTextField(composite_prompts, null, configurator.getPage2NamePromptLabel(), configurator.getPage2NamePromptTooltip());
+
+ addSeparatorLine(composite_prompts, nbrColumns);
+ addFillerLine(composite_prompts, nbrColumns);
+
+ // allow the user to create this filter uniquely for this connection, which means putting it in a
+ // special filter pool we will create, just for this connection. This option is not shown if we are
+ // already told which filter pool to create the filter in, such as in Show Filter Pools mode, when
+ // the user selects New Filter to create a filter in the selected pool. We assume in this case the
+ // will go in whatever filter is selected.
+ if ((poolsToSelectFrom!=null) || (poolWrapperInformation!=null))
+ {
+ uniqueCB = SystemWidgetHelpers.createCheckBox(composite_prompts, nbrColumns, configurator.getPage2UniqueToConnectionLabel(), null);
+ uniqueCB.setToolTipText(configurator.getPage2UniqueToConnectionToolTip());
+ uniqueCB.addSelectionListener(this);
+ }
+
+ addFillerLine(composite_prompts, nbrColumns);
+
+ if (poolsToSelectFrom != null)
+ {
+ poolVerbage = (Label)SystemWidgetHelpers.createVerbage(composite_prompts, configurator.getPage2PoolVerbage(), nbrColumns, false, 200);
+ poolVerbage.setToolTipText(configurator.getPage2PoolVerbageTip());
+ poolCombo = SystemWidgetHelpers.createLabeledReadonlyCombo(composite_prompts, null, configurator.getPage2PoolPromptLabel(), configurator.getPage2PoolPromptTooltip());
+ poolComboLabel = SystemWidgetHelpers.getLastLabel();
+ String[] poolNames = new String[poolsToSelectFrom.length];
+ int filterPoolSelectionIndex = 0;
+ for (int idx=0; idx
+ * Will be non-null if the current selection is a reference to a filter pool or filter,
+ * or a reference manager provider.
+ *
+ * This is passed into the filter and filter string wizards and dialogs in case it is needed
+ * for context.
+ */
+ public void setSystemFilterPoolReferenceManagerProvider(ISystemFilterPoolReferenceManagerProvider provider)
+ {
+ this.provider = provider;
+ //SystemPlugin.logDebugMessage(this.getClass().getName(),"Inside setSystemFilterPoolReferenceManagerProvider. null? " + (provider==null));
+ }
+ /**
+ * Specify an edit pane that prompts the user for the contents of a filter string.
+ */
+ public void setFilterStringEditPane(SystemFilterStringEditPane editPane)
+ {
+ this.editpane = editPane;
+ }
+
+ // -------------------
+ // OUTPUT
+ // -------------------
+ /**
+ * Return the string the user configured in this dialog.
+ * Will return null if the user cancelled the dialog, so test with wasCancelled().
+ */
+ public String getFilterString()
+ {
+ return outputFilterString;
+ }
+
+
+ // LIFECYCLE
+
+ /**
+ * @see SystemPromptDialog#getInitialFocusControl()
+ */
+ protected Control getInitialFocusControl()
+ {
+ return editpane.getInitialFocusControl();
+ }
+ /**
+ * @see SystemPromptDialog#createInner(Composite)
+ */
+ protected Control createInner(Composite parent)
+ {
+ editpane = getFilterStringEditPane(getShell());
+ editpane.setSystemFilterPoolReferenceManagerProvider(provider);
+
+ // Edit pane is our whole content area
+ Control composite = editpane.createContents(parent);
+
+ // add listeners
+ editpane.addChangeListener(this);
+
+ return composite;
+ }
+ /**
+ * Return our edit pane. Overriding this is an alternative to calling setEditPane.
+ * This is called in createContents
+ */
+ protected SystemFilterStringEditPane getFilterStringEditPane(Shell shell)
+ {
+ if (editpane == null)
+ editpane = new SystemFilterStringEditPane(shell);
+ return editpane;
+ }
+
+ /**
+ * Parent override.
+ * Called when user presses OK button.
+ * This is when we save all the changes the user made.
+ */
+ protected boolean processOK()
+ {
+ SystemMessage errorMessage = editpane.verify(); // should fire events back to us if there is an error
+ if (errorMessage != null)
+ return false;
+ outputFilterString = editpane.getFilterString();
+ return super.processOK();
+ }
+
+ /**
+ * Parent override.
+ * Called when user presses CLOSE button. We simply blow away all their changes!
+ */
+ protected boolean processCancel()
+ {
+ return super.processCancel();
+ }
+
+ /**
+ * Override of parent method so we can direct it to the Apply button versus the OK button
+ */
+ public void setPageComplete(boolean complete)
+ {
+ }
+
+ // ---------------
+ // HELPER METHODS
+ // ---------------
+
+
+
+ // ----------------------------------------------
+ // EDIT PANE CHANGE LISTENER INTERFACE METHODS...
+ // ----------------------------------------------
+ /**
+ * Callback method. The user has changed the filter string. It may or may not
+ * be valid. If not, the given message is non-null. If it is, and you want it,
+ * call getSystemFilterString() in the edit pane.
+ */
+ public void filterStringChanged(SystemMessage message)
+ {
+ if (message != null)
+ setErrorMessage(message);
+ else
+ clearErrorMessage();
+ setPageComplete(message == null);
+ }
+ /**
+ * Callback method. We are about to do a verify,the side effect of which is to
+ * change the current state of the dialog, which we don't want. This tells the
+ * dialog to back up that state so it can be restored.
+ */
+ public void backupChangedState()
+ {
+ }
+ /**
+ * Callback method. After backup and change events this is called to restore state
+ */
+ public void restoreChangedState()
+ {
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/ISystemMessageLine.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/ISystemMessageLine.java
new file mode 100644
index 00000000000..42d84997616
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/ISystemMessageLine.java
@@ -0,0 +1,90 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.messages;
+
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+
+/**
+ * A message line interface. It distinguishs between "normal" messages and errors, as does the
+ * DialogPage classes in eclipse.
+ *
+ * For each of those, however, we also support both simple string msgs and more robust SystemMessage
+ * messages. A dialog, wizard page or property page class that implements this interface will support
+ * these by using getLevelOneText() to get the string for the first level text, and support mouse
+ * clicking on the message to display the SystemMessageDialog class to show the 2nd level text.
+ *
+ * Setting an error message hides a currently displayed message until
+ * DO NOT USE THIS CLASS!
+ * This class attempts to wrap the message constructs of eclipse provided property
+ * and wizard pages with an ISystemMessageLine interface.
+ * It fails to do this properly and is extremely fragile since it depends on knowledge
+ * of the internal structure of eclipse provided windows.
+ * Use SystemMessageLine instead.
+ * @link org.eclipse.rse.core.ui.messages.SystemMessageLine
+ *
+ */
+public class SystemDialogPageMessageLine implements ISystemMessageLine, MouseListener {
+ // cached inputs
+ private Label msgTextLabel;
+ private Label msgIconLabel;
+ private CLabel msgIconCLabel;
+ private DialogPage dlgPage;
+ // state
+ private SystemMessage sysErrorMessage;
+ private SystemMessage sysMessage;
+ private boolean stringErrorMessageShowing = false;
+
+ /**
+ * Factory method for wizard pages.
+ * We only need to configure a single message line for all pages in a given wizard,
+ * so this method looks after ensuring there is only one such message line created.
+ * @param wizardPage - the wizard page we are configuring
+ */
+ public static SystemDialogPageMessageLine createWizardMsgLine(WizardPage wizardPage) {
+ SystemDialogPageMessageLine msgLine = null;
+ Composite pageContainer = wizardPage.getControl().getParent();
+ Object pageContainerData = null;
+ //Object pageContainerData = pageContainer.getData();
+ //System.out.println("pageContainerData = " + pageContainerData);
+ if (pageContainerData == null) {
+ // wizardPage.getControl() => returns the composite we created in createControl
+ // .getParent() => returns the page container composite created in createPageContainer in WizardDialog, that holds all pages
+ // .getParent() => returns the composite created in createDialogArea in TitleAreaDialog. The "dialog area" of the dialog below the top stuff, and above the button bar.
+ // .getParent() => returns the workarea composite created in createContents in TitleAreaDialog
+ // .getParent() => returns the parent composite passed to createContents in TitleAreaDialog
+ // .getChildren() => returns the children of this composite, which includes the stuff at the top, which is placed
+ // there by createTitleArea() in TitleAreaDialog, the parent of WizardDialog
+ // [0]=> dialog image Label
+ // [1]=> title Label
+ // [2]=> message image Label
+ // [3]=> message Label
+ // [4]=> filler Label
+ Composite dialogAreaComposite = pageContainer.getParent(); // see createDialogArea in WizardDialog
+ Composite workAreaComposite = dialogAreaComposite.getParent(); // see createContents in TitleAreaDialog
+ Composite mainComposite = workAreaComposite.getParent(); // whatever is passed into createContents in TitleAreaDialog
+ Control[] list = mainComposite.getChildren();
+ Label msgImageLabel = null;
+ Label msgLabel = null;
+ if (list[2] instanceof Label) {
+ msgImageLabel = (Label) list[2];
+ }
+ if (list[3] instanceof Label) {
+ msgLabel = (Label) list[3];
+ } else if (list[4] instanceof Label) {
+ msgLabel = (Label) list[4];
+ }
+ msgLine = new SystemDialogPageMessageLine(wizardPage, msgImageLabel, msgLabel);
+ pageContainer.setData(msgLine);
+ } else
+ msgLine = (SystemDialogPageMessageLine) pageContainerData;
+ return msgLine;
+ }
+
+ /**
+ * Factory method for property pages.
+ * We only need to configure a single message line for all pages in a properties dialog,
+ * so this method looks after ensuring there is only one such message line created.
+ * @param propertyPage - the property page we are configuring
+ */
+ public static SystemDialogPageMessageLine createPropertyPageMsgLine(PropertyPage propertyPage) {
+ SystemDialogPageMessageLine msgLine = null;
+ Composite pageContainer = propertyPage.getControl().getParent();
+ // propertyPage.getControl() => returns the composite we created in createControl
+ // .getParent() => returns the page container composite created in createPageContainer in PreferencesDialog, that holds all pages
+ // .getParent() => returns the composite created in createDialogArea in PreferencesDialog. This holds the tree, title area composite, page container composite and separator
+ // .getChildren()[1] => returns the title area parent composite, created in createDialogArea in PreferencesDialog
+ // .getChildren()[0] => returns the title area composite, created in createTitleArea in PreferencesDialog
+ // .getChildren() => returns the children of the title area composite
+ // [0]=> message CLabel
+ // [1]=> title image
+ Composite dialogAreaComposite = pageContainer.getParent(); // see createDialogArea in PreferencesDialog
+ Composite titleAreaParentComposite = (Composite) dialogAreaComposite.getChildren()[1];
+ Composite titleAreaComposite = (Composite) titleAreaParentComposite.getChildren()[0];
+ //Control[] list=titleAreaComposite.getChildren();
+ // DKM - trying to figure out this mess for 3.0
+ Composite listContainer = (Composite) titleAreaComposite.getChildren()[0];
+ Control[] list = listContainer.getChildren();
+ Label label1 = null;
+ Label label2 = null;
+ if (list.length > 0) {
+ label1 = (Label) list[0];
+ label2 = (Label) list[1];
+ }
+ msgLine = new SystemDialogPageMessageLine(propertyPage, /*(CLabel)list[0]*/label1, label2);
+ pageContainer.setData(msgLine);
+ return msgLine;
+ }
+
+ /**
+ * Private constructor.
+ */
+ private SystemDialogPageMessageLine(DialogPage dialogPage, Label msgIconLabel, Label msgTextLabel) {
+ this.msgIconLabel = msgIconLabel;
+ this.msgTextLabel = msgTextLabel;
+ this.dlgPage = dialogPage;
+ msgIconLabel.addMouseListener(this);
+ msgTextLabel.addMouseListener(this);
+ }
+
+ protected SystemMessage getSysErrorMessage() {
+ return sysErrorMessage;
+ }
+
+ protected SystemMessage getSysMessage() {
+ return sysMessage;
+ }
+
+ /**
+ * Get the currently displayed error text.
+ * @return The error message. If no error message is displayed
+ * The second button, would have an id of buttonId+1 etc.
+ */
+ public static final int BUTTON_ID=1000;
+
+ /**
+ * button pressed to dismiss the dialog
+ */
+ private int buttonIdPressed;
+
+ /**
+ * whether or not to open the dialog with the yes/no buttons
+ */
+ private boolean yesNoButtons=false;
+
+ /**
+ * whether or not to open the dialog with the yes/no/cancel buttons
+ */
+ private boolean yesNoCancelButtons=false;
+
+ /**
+ * Creates an error dialog.
+ * Note that the dialog will have no visual representation (no widgets)
+ * until it is told to open.
+ * @param parentShell the shell under which to create this dialog
+ * @param message the message to display in the dialog
+ */
+ public SystemMessageDialog(Shell parentShell, SystemMessage message)
+ {
+ this(parentShell,
+ message.getFullMessageID(),
+ message.getLevelOneText(),
+ (IStatus)(new MultiStatus(SystemBasePlugin.getBaseDefault().getSymbolicName(), IStatus.OK, "", new Exception(""))),
+ 0xFFFFF);
+ ((MultiStatus)this.status).add(new Status(IStatus.INFO, SystemBasePlugin.getBaseDefault().getSymbolicName(), IStatus.OK, message.getLevelTwoText(), new Exception("")));
+ statusList = Arrays.asList(status.getChildren());
+ this.message=message;
+ initImage(message);
+ }
+
+ private SystemMessageDialog(Shell parentShell, String dialogTitle, String message,
+ IStatus status, int displayMask)
+ {
+ super(parentShell, dialogTitle, message, status, displayMask);
+ this.title = (dialogTitle == null) ? JFaceResources.getString("Problem_Occurred"): //$NON-NLS-1$
+ dialogTitle;
+ this.status = status;
+ statusList = Arrays.asList(status.getChildren());
+ this.displayMask = displayMask;
+ setShellStyle(SWT.DIALOG_TRIM | SWT.RESIZE | SWT.APPLICATION_MODAL);
+ }
+
+ private void initImage(SystemMessage message)
+ {
+ // setup image
+ if (message.getIndicator()==SystemMessage.INFORMATION ||
+ message.getIndicator()==SystemMessage.COMPLETION)
+ //imageName=DLG_IMG_INFO;
+ imageId = SWT.ICON_INFORMATION;
+ else if (message.getIndicator()==SystemMessage.INQUIRY)
+ //imageName=DLG_IMG_QUESTION;
+ imageId = SWT.ICON_QUESTION;
+ else if (message.getIndicator()==SystemMessage.ERROR ||
+ message.getIndicator()==SystemMessage.UNEXPECTED)
+ //imageName=DLG_IMG_ERROR;
+ imageId = SWT.ICON_ERROR;
+ else if (message.getIndicator()==SystemMessage.WARNING)
+ //imageName=DLG_IMG_WARNING;
+ imageId = SWT.ICON_WARNING;
+ }
+
+
+ /* Handles the pressing of the Ok, Details or any button in this dialog.
+ * If the Ok button was pressed then close this dialog. If the Details
+ * button was pressed then toggle the displaying of the error details area.
+ */
+ protected void buttonPressed(int id)
+ {
+ if (id == IDialogConstants.DETAILS_ID) // was the details button pressed?
+ toggleDetailsArea();
+ else
+ {
+ super.buttonPressed(id);
+ close();
+ }
+ buttonIdPressed=id;
+ }
+
+ /*
+ * Creates the buttons for the button bar.
+ * If the message is an inquiry
+ * message or yes/no buttons are explicitly requested then Yes, No, and
+ * perhaps Cancel are the preferred buttons.
+ * Otherwise, if there are buttons supplied by the client use those.
+ * Otherwise if no buttons are supplied, just supply an OK button.
+ * A Details button is suppled if the message indicates that it has any
+ * significant details. In particular, test to see that the details length is
+ * greater than 2. This disqualifies using %2 and getting details for some
+ * reason.
+ * d58252 - re-ordered tests to make logic easier to read. Set initial focus
+ * on the default button since it would normally be on the message which is
+ * now read-only text.
+ */
+ protected void createButtonsForButtonBar(Composite parent) {
+ if ( yesNoButtons || yesNoCancelButtons || (message.getIndicator()==SystemMessage.INQUIRY) ) {
+ boolean yesDefault=(defaultIndex==0);
+ boolean noDefault=(defaultIndex==1);
+ boolean cancelDefault=(defaultIndex==2);
+ createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL, yesDefault);
+ createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL, noDefault);
+ if (yesNoCancelButtons) {
+ createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, cancelDefault);
+ }
+ if (yesDefault) {
+ getButton(IDialogConstants.YES_ID).setFocus();
+ } else if (noDefault) {
+ getButton(IDialogConstants.NO_ID).setFocus();
+ } else if (cancelDefault) {
+ getButton(IDialogConstants.CANCEL_ID).setFocus();
+ }
+ } else if (buttons!=null) {
+ for (int i=0; i
+ * The quick open dialog calls the
+ *
+ * @see org.eclipse.jface.dialogs.IDialogPage
+ * @see org.eclipse.jface.dialogs.DialogPage
+ */
+public interface ISystemQuickOpenPage extends IDialogPage {
+
+ /**
+ * Performs the action for this page.
+ * The quick open dialog calls this method when the Ok button is pressed.
+ * @return
+ * By default, no scheduling
+ * rule is obtained. Sublcasses can override to in order ot obtain a
+ * scheduling rule or can obtain schduling rules withing their operation
+ * if finer grained schduling is desired.
+ *
+ * @return the schduling rule to be obtained by this operation
+ * or
+ * Subclasses should override to do full error checking on all
+ * the widgets on the form.
+ */
+ public boolean verifyFormContents();
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/RemoteSystemsPreferencePage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/RemoteSystemsPreferencePage.java
new file mode 100644
index 00000000000..5b5ac719b17
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/RemoteSystemsPreferencePage.java
@@ -0,0 +1,681 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.propertypages;
+
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.StringTokenizer;
+
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.SystemType;
+import org.eclipse.rse.internal.model.SystemPreferenceChangeEvent;
+import org.eclipse.rse.model.ISystemPreferenceChangeEvents;
+import org.eclipse.rse.ui.ISystemPreferencesConstants;
+import org.eclipse.rse.ui.Mnemonics;
+import org.eclipse.rse.ui.SystemConnectionForm;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.SystemWidgetHelpers;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+
+/**
+ * Root preference page for Remote Systems Plugin
+ */
+public class RemoteSystemsPreferencePage
+ extends FieldEditorPreferencePage implements IWorkbenchPreferencePage,
+ ISystemPreferencesConstants
+{
+ private SystemBooleanFieldEditor showFilterPoolsEditor;
+ private SystemBooleanFieldEditor qualifyConnectionNamesEditor;
+ private SystemBooleanFieldEditor rememberStateEditor;
+ private SystemBooleanFieldEditor useDeferredQueryEditor;
+
+ // yantzi: artemis 60, restore from cache when available
+ private SystemBooleanFieldEditor restoreFromCache;
+ private Composite innerComposite;
+
+ private SystemTypeFieldEditor systemTypesEditor;
+ private SystemBooleanFieldEditor showNewConnectionPromptEditor;
+ private boolean lastShowFilterPoolsValue = false;
+ private boolean lastQualifyConnectionNamesValue = false;
+ private boolean lastRememberStateValue = true; // changed in R2 by Phil. Not sure about migration!
+ private boolean lastRestoreFromCacheValue = true; // yantzi: new in artemis 6.0
+ private boolean lastShowNewConnectionPromptValue = true;
+ private boolean lastUseDeferredQueryValue = false;
+
+ /**
+ * Constructor
+ */
+ public RemoteSystemsPreferencePage()
+ {
+ super(GRID);
+ setTitle(SystemResources.RESID_PREF_ROOT_PAGE);
+ setPreferenceStore(SystemPlugin.getDefault().getPreferenceStore());
+ setDescription(SystemResources.RESID_PREF_ROOT_TITLE);
+ }
+ /**
+ * We intercept to set the help
+ */
+ public void createControl(Composite parent)
+ {
+ super.createControl(parent);
+ }
+
+ /**
+ * GUI widgets for preferences page
+ */
+ protected void createFieldEditors()
+ {
+ // DEFAULT SYSTEM TYPE
+ SystemComboBoxFieldEditor systemTypeEditor = new SystemComboBoxFieldEditor(
+ ISystemPreferencesConstants.SYSTEMTYPE,
+ SystemResources.RESID_PREF_SYSTEMTYPE_PREFIX_LABEL,
+ SystemPlugin.getDefault().getSystemTypeNames(),
+ true, // readonly
+ getFieldEditorParent()
+ );
+ systemTypeEditor.setToolTipText(SystemResources.RESID_PREF_SYSTEMTYPE_PREFIX_TOOLTIP);
+ addField(systemTypeEditor);
+
+ // ENABLED STATE AND DEFAULT USERID PER SYSTEM TYPE
+ systemTypesEditor = new SystemTypeFieldEditor(
+ ISystemPreferencesConstants.SYSTEMTYPE_VALUES,
+ SystemResources.RESID_PREF_USERID_PERTYPE_PREFIX_LABEL,
+ getFieldEditorParent()
+ );
+ addField(systemTypesEditor);
+ systemTypesEditor.setToolTipText(SystemResources.RESID_PREF_USERID_PERTYPE_PREFIX_TOOLTIP);
+
+ // QUALIFY CONNECTION NAMES
+ qualifyConnectionNamesEditor = new SystemBooleanFieldEditor(
+ ISystemPreferencesConstants.QUALIFY_CONNECTION_NAMES,
+ SystemResources.RESID_PREF_QUALIFYCONNECTIONNAMES_PREFIX_LABEL,
+ getFieldEditorParent()
+ );
+ addField(qualifyConnectionNamesEditor);
+ qualifyConnectionNamesEditor.setToolTipText(SystemResources.RESID_PREF_QUALIFYCONNECTIONNAMES_PREFIX_TOOLTIP);
+ lastQualifyConnectionNamesValue = getPreferenceStore().getBoolean(qualifyConnectionNamesEditor.getPreferenceName());
+
+ // SHOW FILTER POOLS
+ showFilterPoolsEditor = new SystemBooleanFieldEditor(
+ ISystemPreferencesConstants.SHOWFILTERPOOLS,
+ SystemResources.RESID_PREF_SHOWFILTERPOOLS_PREFIX_LABEL,
+ getFieldEditorParent()
+ );
+ addField(showFilterPoolsEditor);
+ showFilterPoolsEditor.setToolTipText(SystemResources.RESID_PREF_SHOWFILTERPOOLS_PREFIX_TOOLTIP);
+ lastShowFilterPoolsValue = getPreferenceStore().getBoolean(showFilterPoolsEditor.getPreferenceName());
+
+ // SHOW "NEW CONNECTION..." PROMPT INSIDE REMOTE SYSTEMS VIEW
+ showNewConnectionPromptEditor = new SystemBooleanFieldEditor(
+ ISystemPreferencesConstants.SHOWNEWCONNECTIONPROMPT,
+ SystemResources.RESID_PREF_SHOWNEWCONNECTIONPROMPT_PREFIX_LABEL,
+ getFieldEditorParent()
+ );
+ addField(showNewConnectionPromptEditor);
+ showNewConnectionPromptEditor.setToolTipText(SystemResources.RESID_PREF_SHOWNEWCONNECTIONPROMPT_PREFIX_TOOLTIP);
+ lastShowNewConnectionPromptValue = getPreferenceStore().getBoolean(showNewConnectionPromptEditor.getPreferenceName());
+
+ // REMEMBER STATE
+ rememberStateEditor = new SystemBooleanFieldEditor(
+ ISystemPreferencesConstants.REMEMBER_STATE,
+ SystemResources.RESID_PREF_REMEMBERSTATE_PREFIX_LABEL,
+ getFieldEditorParent()
+ );
+ addField(rememberStateEditor);
+ rememberStateEditor.setToolTipText(SystemResources.RESID_PREF_REMEMBERSTATE_PREFIX_TOOLTIP);
+ lastRememberStateValue = getPreferenceStore().getBoolean(rememberStateEditor.getPreferenceName());
+
+ // Restore from cache
+ innerComposite = SystemWidgetHelpers.createComposite(getFieldEditorParent(), SWT.NULL);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalIndent = 20;
+ innerComposite.setLayoutData(gd);
+ restoreFromCache = new SystemBooleanFieldEditor(
+ ISystemPreferencesConstants.RESTORE_STATE_FROM_CACHE,
+ SystemResources.RESID_PREF_RESTOREFROMCACHE_PREFIX_LABEL,
+ innerComposite
+ );
+ restoreFromCache.setEnabled(lastRememberStateValue, innerComposite);
+ addField(restoreFromCache);
+ restoreFromCache.setToolTipText(SystemResources.RESID_PREF_RESTOREFROMCACHE_PREFIX_TOOLTIP);
+ lastRestoreFromCacheValue = getPreferenceStore().getBoolean(ISystemPreferencesConstants.RESTORE_STATE_FROM_CACHE);
+
+ // USE DEFERRED QUERY
+ useDeferredQueryEditor = new SystemBooleanFieldEditor(
+ ISystemPreferencesConstants.USE_DEFERRED_QUERIES,
+ SystemResources.RESID_PREF_USEDEFERREDQUERIES_PREFIX_LABEL,
+ getFieldEditorParent())
+ ;
+ addField(useDeferredQueryEditor);
+ useDeferredQueryEditor.setToolTipText(SystemResources.RESID_PREF_USEDEFERREDQUERIES_PREFIX_TOOLTIP);
+ lastUseDeferredQueryValue = getPreferenceStore().getBoolean(useDeferredQueryEditor.getPreferenceName());
+
+ /** FIXME - UDA should not be so coupled to core
+ * might need a new preference page for this
+ // CASCADE USER-DEFINED ACTIONS BY PROFILE
+ SystemBooleanFieldEditor cascadeUDAsEditor = new SystemBooleanFieldEditor(
+ ISystemPreferencesConstants.CASCADE_UDAS_BYPROFILE,
+ SystemUDAResources.RESID_PREF_UDAS_CASCADEBYPROFILE_LABEL,
+ getFieldEditorParent()
+ );
+ addField(cascadeUDAsEditor);
+ cascadeUDAsEditor.setToolTipText(SystemUDAResources.RESID_PREF_UDAS_CASCADEBYPROFILE_TOOLTIP);
+ lastCascadeUDAsValue = getPreferenceStore().getBoolean(cascadeUDAsEditor.getPreferenceName());
+ **/
+ // set mnemonics
+ (new Mnemonics()).setOnPreferencePage(true).setMnemonics(getFieldEditorParent());
+
+ // set help
+ SystemWidgetHelpers.setCompositeHelp(getFieldEditorParent(), SystemPlugin.HELPPREFIX+"rsep0000");
+ }
+
+ // ---------------------------------------------------------
+ // GETTERS/SETTERS FOR EACH OF THE USER PREFERENCE VALUES...
+ // ---------------------------------------------------------
+ /**
+ * Return the names of the profiles the user has elected to make "active".
+ */
+ public static String[] getActiveProfiles()
+ {
+ IPreferenceStore store = SystemPlugin.getDefault().getPreferenceStore();
+ return parseStrings(store.getString(ISystemPreferencesConstants.ACTIVEUSERPROFILES));
+ }
+
+ /**
+ * Set the names of the profiles the user has elected to make "active".
+ */
+ public static void setActiveProfiles(String[] newProfileNames)
+ {
+ IPreferenceStore store= SystemPlugin.getDefault().getPreferenceStore();
+ store.setValue(ISystemPreferencesConstants.ACTIVEUSERPROFILES, makeString(newProfileNames));
+ savePreferenceStore();
+ }
+
+ /**
+ * Return the ordered list of connection names. This is how user arranged his connections in the system view.
+ */
+ public static String[] getConnectionNamesOrder()
+ {
+ IPreferenceStore store= SystemPlugin.getDefault().getPreferenceStore();
+ return parseStrings(store.getString(ISystemPreferencesConstants.ORDER_CONNECTIONS));
+ }
+ /**
+ * Set the ordered list of connection names. This is how user arranged his connections in the system view.
+ */
+ public static void setConnectionNamesOrder(String[] newConnectionNamesOrder)
+ {
+ IPreferenceStore store= SystemPlugin.getDefault().getPreferenceStore();
+ store.setValue(ISystemPreferencesConstants.ORDER_CONNECTIONS, makeString(newConnectionNamesOrder));
+ savePreferenceStore();
+ }
+ /**
+ * Return true if the user has elected to show filter pools in the remote systems explorer view
+ */
+ public static boolean getShowFilterPoolsPreference()
+ {
+ IPreferenceStore store= SystemPlugin.getDefault().getPreferenceStore();
+ return store.getBoolean(ISystemPreferencesConstants.SHOWFILTERPOOLS);
+ }
+ /**
+ * Toggle whether to show filter pools in the remote systems explorer view
+ */
+ public static void setShowFilterPoolsPreference(boolean show)
+ {
+ IPreferenceStore store= SystemPlugin.getDefault().getPreferenceStore();
+ store.setValue(ISystemPreferencesConstants.SHOWFILTERPOOLS,show);
+ savePreferenceStore();
+ }
+
+ /**
+ * Return true if the user has elected to show the "New Connection..." prompt in the Remote Systems view
+ */
+ public static boolean getShowNewConnectionPromptPreference()
+ {
+ IPreferenceStore store= SystemPlugin.getDefault().getPreferenceStore();
+ boolean value = store.getBoolean(ISystemPreferencesConstants.SHOWNEWCONNECTIONPROMPT);
+ return value;
+ }
+ /**
+ * Toggle whether to show filter pools in the remote systems explorer view
+ */
+ public static void setShowNewConnectionPromptPreference(boolean show)
+ {
+ IPreferenceStore store= SystemPlugin.getDefault().getPreferenceStore();
+ store.setValue(ISystemPreferencesConstants.SHOWNEWCONNECTIONPROMPT,show);
+ savePreferenceStore();
+ }
+
+ /**
+ * Return true if the user has elected to show connection names qualified by profile
+ */
+ public static boolean getQualifyConnectionNamesPreference()
+ {
+ IPreferenceStore store= SystemPlugin.getDefault().getPreferenceStore();
+ return store.getBoolean(ISystemPreferencesConstants.QUALIFY_CONNECTION_NAMES);
+ }
+ /**
+ * Set if the user has elected to show connection names qualified by profile
+ */
+ public static void setQualifyConnectionNamesPreference(boolean set)
+ {
+ IPreferenceStore store= SystemPlugin.getDefault().getPreferenceStore();
+ store.setValue(ISystemPreferencesConstants.QUALIFY_CONNECTION_NAMES,set);
+ savePreferenceStore();
+ }
+
+ /**
+ * Return true if the user has elected to remember the state of the Remote Systems view
+ */
+ public static boolean getRememberStatePreference()
+ {
+ IPreferenceStore store= SystemPlugin.getDefault().getPreferenceStore();
+ return store.getBoolean(ISystemPreferencesConstants.REMEMBER_STATE);
+ }
+ /**
+ * Set if the user has elected to show connection names qualified by profile
+ */
+ public static void setRememberStatePreference(boolean set)
+ {
+ IPreferenceStore store= SystemPlugin.getDefault().getPreferenceStore();
+ store.setValue(ISystemPreferencesConstants.REMEMBER_STATE,set);
+ savePreferenceStore();
+ }
+
+ /**
+ * Return true if the user has elected to restore the state of the Remote Systems view from cached information
+ */
+ public static boolean getRestoreStateFromCachePreference()
+ {
+ IPreferenceStore store= SystemPlugin.getDefault().getPreferenceStore();
+ return store.getBoolean(ISystemPreferencesConstants.RESTORE_STATE_FROM_CACHE);
+ }
+
+ /**
+ * Set if the user has elected to restore the state of the Remote Systems view from cached information
+ */
+ public static void setRestoreStateFromCachePreference(boolean set)
+ {
+ IPreferenceStore store= SystemPlugin.getDefault().getPreferenceStore();
+ store.setValue(ISystemPreferencesConstants.RESTORE_STATE_FROM_CACHE, set);
+ savePreferenceStore();
+ }
+
+ /**
+ * Return true if the user has elected to show user defined actions cascaded by profile
+ */
+ public static boolean getCascadeUserActionsPreference()
+ {
+ IPreferenceStore store= SystemPlugin.getDefault().getPreferenceStore();
+ return store.getBoolean(ISystemPreferencesConstants.CASCADE_UDAS_BYPROFILE);
+ }
+ /**
+ * Set if the user has elected to show user defined actions cascaded by profile
+ */
+ public static void setCascadeUserActionsPreference(boolean set)
+ {
+ IPreferenceStore store= SystemPlugin.getDefault().getPreferenceStore();
+ store.setValue(ISystemPreferencesConstants.CASCADE_UDAS_BYPROFILE,set);
+ savePreferenceStore();
+ }
+ /**
+ * Return the userId to default to on the Create Connection wizard, per the given system type.
+ *
+ * @see SystemConnectionForm
+ */
+ public static String getUserIdPreference(String systemType)
+ {
+ if (systemType == null)
+ return null;
+ SystemType[] systemTypes = SystemPlugin.getDefault().getAllSystemTypes(false);
+ SystemType type = SystemType.getSystemType(systemTypes, systemType);
+ if (type != null)
+ return type.getDefaultUserID();
+ else
+ return null;
+ }
+
+ /**
+ * Set the default userId per the given system type.
+ */
+ public static void setUserIdPreference(String systemType, String userId)
+ {
+ SystemType[] systemTypes = SystemPlugin.getDefault().getAllSystemTypes(false);
+ SystemType type = SystemType.getSystemType(systemTypes, systemType);
+ if (type != null)
+ type.setDefaultUserID(userId);
+ else
+ return;
+ // following needs to stay in synch with modify() method in SystemTypeFieldEditor...
+ String value = SystemPlugin.getDefault().getPreferenceStore().getString(ISystemPreferencesConstants.SYSTEMTYPE_VALUES);
+ Hashtable keyValues = null;
+ if ((value == null) || (value.length()==0)) // not initialized yet?
+ {
+ keyValues = new Hashtable();
+ // nothing to do, as we have read from systemtype extension points already
+ }
+ else
+ {
+ keyValues = parseString(value);
+ }
+ keyValues.put(type.getName(),SystemType.getPreferenceStoreString(type));
+ String s = SystemTypeFieldEditor.createString(keyValues);
+
+ if (s != null)
+ SystemPlugin.getDefault().getPreferenceStore().setValue(ISystemPreferencesConstants.SYSTEMTYPE_VALUES, s);
+
+ savePreferenceStore();
+ }
+
+
+ /**
+ * Return the hashtable where the key is a string identifying a particular object, and
+ * the value is the user Id for that object.
+ */
+ public static Hashtable getUserIdsPerKey()
+ {
+ IPreferenceStore store= SystemPlugin.getDefault().getPreferenceStore();
+ Hashtable keyValues = null;
+ String value = store.getString(ISystemPreferencesConstants.USERIDPERKEY);
+ if (value != null)
+ keyValues = parseString(value);
+ else
+ {
+ keyValues = new Hashtable();
+ }
+ return keyValues;
+ }
+ /**
+ * Set/store the user ids that are saved keyed by some key.
+ */
+ public static void setUserIdsPerKey(Hashtable uidsPerKey)
+ {
+ IPreferenceStore store= SystemPlugin.getDefault().getPreferenceStore();
+ store.setValue(ISystemPreferencesConstants.USERIDPERKEY, makeString(uidsPerKey));
+ savePreferenceStore();
+ }
+
+ /**
+ * Return the System type to default to on the Create Connection wizard.
+ *
+ * @see SystemConnectionForm
+ */
+ public static String getSystemTypePreference()
+ {
+ IPreferenceStore store= SystemPlugin.getDefault().getPreferenceStore();
+ return store.getString(ISystemPreferencesConstants.SYSTEMTYPE);
+ }
+
+ /**
+ * Return the history for the folder combo box widget
+ */
+ public static String[] getFolderHistory()
+ {
+ return getWidgetHistory(ISystemPreferencesConstants.HISTORY_FOLDER);
+ }
+ /**
+ * Set the history for the folder combo box widget.
+ */
+ public static void setFolderHistory(String[] newHistory)
+ {
+ setWidgetHistory(ISystemPreferencesConstants.HISTORY_FOLDER, newHistory);
+ }
+ /**
+ * Return the history for a widget given an arbitrary key uniquely identifying it
+ */
+ public static String[] getWidgetHistory(String key)
+ {
+ IPreferenceStore store= SystemPlugin.getDefault().getPreferenceStore();
+ return parseStrings(store.getString(key));
+ }
+ /**
+ * Set the history for a widget given an arbitrary key uniquely identifying it.
+ */
+ public static void setWidgetHistory(String key, String[] newHistory)
+ {
+ IPreferenceStore store= SystemPlugin.getDefault().getPreferenceStore();
+ store.setValue(key, makeString(newHistory));
+ savePreferenceStore();
+ }
+
+
+ // -------------------------------------------------
+ // MISCELLANEOUS METHODS...
+ // -------------------------------------------------
+
+ /**
+ * Parse out list of key-value pairs into a hashtable
+ */
+ protected static Hashtable parseString(String allvalues)
+ {
+ StringTokenizer tokens = new StringTokenizer(allvalues, "=;");
+ Hashtable keyValues = new Hashtable(10);
+ int count = 0;
+ String token1=null;
+ String token2=null;
+ while (tokens.hasMoreTokens())
+ {
+ count++;
+ if ((count % 2) == 0) // even number
+ {
+ token2 = tokens.nextToken();
+ keyValues.put(token1, token2);
+ }
+ else
+ token1 = tokens.nextToken();
+ }
+ return keyValues;
+ }
+ /**
+ * Convert hashtable of key-value pairs into a single string
+ */
+ protected static String makeString(Hashtable keyValues)
+ {
+ Enumeration keys = keyValues.keys();
+ StringBuffer sb = new StringBuffer();
+ while (keys.hasMoreElements())
+ {
+ String key = (String)keys.nextElement();
+ String value = (String)keyValues.get(key);
+ if ((value != null) && (value.length()>0))
+ {
+ sb.append(key);
+ sb.append('=');
+ sb.append(value);
+ sb.append(';');
+ }
+ }
+ return sb.toString();
+ }
+
+ /**
+ * Parse out list of multiple values into a string array per value
+ */
+ protected static String[] parseStrings(String allvalues)
+ {
+ if (allvalues == null)
+ return new String[0];
+ //StringTokenizer tokens = new StringTokenizer(allvalues, ";");
+ String[] tokens = allvalues.split(";");
+ return tokens;
+ /*
+ Vector v = new Vector();
+ int idx=0;
+ while (tokens.hasMoreTokens())
+ v.addElement(tokens.nextToken());
+ String keyValues[] = new String[v.size()];
+ for (idx=0;idx
+ * This class extends {@link SystemBasePropertyPage} and so inherits the benefits of that class.
+ * The benefits of this class are:
+ * Subclasses should override to do full error checking on all the widgets on the page. Recommendation: To get these benefits you must override {@link #createContentArea(Composite)} instead of createContents.
+ * Our base implementation of createContents configures the message line and then calls
+ * createContentArea and then assigns mnemonics to the content area.
+ *
+ * We first test isValid() just like our parent implementation does,
+ * but since that only represents the valid state of the
+ * last control the user interacted with, we also call verifyPageContents.
+ *
+ * Subclasses must override {@link #verifyPageContents()} to do full error checking on all
+ * the widgets on the page.
+ */
+ public boolean okToLeave()
+ {
+ super.okToLeave();
+ boolean ok = isValid();
+ if (ok)
+ {
+ ok = verifyPageContents();
+ }
+ //System.out.println("Inside okToLeave. returning "+ok);
+ return ok;
+ }
+
+ /**
+ * Abstract. You must override. Return true if no input fields to check.
+ * Subclasses should override to do full error checking on all the widgets on the page. Recommendation:
+ * If you have your own change filter dialog (versus configuring ours) you must configure this
+ * pane yourself by overriding {@link SubSystemConfiguration#customizeChangeFilterPropertyPage(SystemChangeFilterPropertyPage, ISystemFilter, Shell)}
+ * and configuring the pane as described in that method's javadoc.
+ */
+public class SystemChangeFilterPropertyPage extends SystemBasePropertyPage
+ implements ISystemMessages, ISystemPageCompleteListener, ISystemChangeFilterPaneEditPaneSupplier
+{
+
+ protected String errorMessage;
+ protected boolean initDone = false;
+
+ protected SystemChangeFilterPane changeFilterPane;
+ protected SystemFilterStringEditPane editPane;
+
+ /**
+ * Constructor for SystemFilterPropertyPage
+ */
+ public SystemChangeFilterPropertyPage()
+ {
+ super();
+ SystemPlugin sp = SystemPlugin.getDefault();
+ changeFilterPane = new SystemChangeFilterPane(null, this, this);
+ changeFilterPane.addPageCompleteListener(this);
+ setHelp(SystemPlugin.HELPPREFIX+"dufr0000");
+ }
+
+ // INPUT/CONFIGURATION
+ /**
+ * Configuration method
+ * This is passed into the filter and filter string wizards and dialogs in case it is needed
+ * for context.
+ */
+ public void setSystemFilterPoolReferenceManagerProvider(ISystemFilterPoolReferenceManagerProvider provider)
+ {
+ changeFilterPane.setSystemFilterPoolReferenceManagerProvider(provider);
+ }
+ /**
+ * Configuration method
+ * This is passed into the filter and filter string wizards and dialogs in case it is needed
+ * for context.
+ */
+ public void setSystemFilterPoolManagerProvider(ISystemFilterPoolManagerProvider provider)
+ {
+ changeFilterPane.setSystemFilterPoolManagerProvider(provider);
+ }
+
+ /**
+ * Configuration method
+ * Your validator should extend ValidatorFilterString to inherited the uniqueness error checking.
+ *
+ * Alternatively, if all you want is a unique error message for the case when duplicates are found,
+ * call setDuplicateFilterStringErrorMessage, and it will be used in the default validator.
+ */
+ public void setFilterStringValidator(ISystemValidator v)
+ {
+ changeFilterPane.setFilterStringValidator(v);
+ }
+ /**
+ * Configuration method
+ * This hook is not called when the text is initialized
+ * (or reset to the default value) from the preference store.
+ *
+ * Subclasses should override to do full error checking on all
+ * the widgets on the page.
+ */
+ protected boolean verifyPageContents()
+ {
+ return form.verify(true);
+ }
+
+
+
+ // ----------------------------------------
+ // CALLBACKS FROM SYSTEM CONNECTION FORM...
+ // ----------------------------------------
+ /**
+ * Event: the user has selected a system type.
+ */
+ public void systemTypeSelected(String systemType, boolean duringInitialization)
+ {
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemConnectionSubSystemsPropertyPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemConnectionSubSystemsPropertyPage.java
new file mode 100644
index 00000000000..05e8916c103
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemConnectionSubSystemsPropertyPage.java
@@ -0,0 +1,391 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.propertypages;
+import java.util.ResourceBundle;
+import java.util.Vector;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.rse.core.SystemAdapterHelpers;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.model.IHost;
+import org.eclipse.rse.ui.ISystemConnectionFormCaller;
+import org.eclipse.rse.ui.SystemPropertyResources;
+import org.eclipse.rse.ui.SystemTabFolderLayout;
+import org.eclipse.rse.ui.SystemWidgetHelpers;
+import org.eclipse.rse.ui.messages.ISystemMessageLine;
+import org.eclipse.rse.ui.messages.ISystemMessageLineTarget;
+import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
+import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CTabFolder;
+import org.eclipse.swt.custom.CTabItem;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+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.ui.IWorkbenchPropertyPage;
+import org.eclipse.ui.dialogs.PropertyPage;
+
+
+/**
+ * The property page for subsystem properties when accessed from the connection property page.
+ * The plugin.xml file registers this for objects of class com.ibm.etools.systems.model.SystemConnection
+
+ * We cycle through all pages calling okToLeave().
+ */
+ public boolean okToLeave()
+ {
+ boolean ok = isValid();
+
+ if (ok && (pages!= null) && (pages.length > 0))
+ {
+ int currIdx = tabFolder.getSelectionIndex();
+
+ // if a page is selected
+ if (currIdx != -1)
+ {
+ PropertyPage currentPage = pages[currIdx];
+ ok = currentPage.okToLeave();
+ }
+
+ for (int idx = 0; ok && (idx < pages.length); idx++)
+ {
+ if (idx != currIdx)
+ {
+ PropertyPage page = pages[idx];
+ ok = page.okToLeave();
+
+ if (!ok)
+ {
+ tabFolder.setSelection(idx);
+ }
+ }
+ }
+ }
+
+ return ok;
+ }
+
+ /**
+ * Return true if this page is valid. Override of parent.
+ * Cycles through all tab pages calling isValid.
+ */
+ public boolean isValid()
+ {
+ boolean ok = super.isValid();
+ if (ok && (pages!=null) && (pages.length>0))
+ {
+ for (int idx=0; ok && (idx
+ * Subclasses should override to do full error checking on all
+ * the widgets on the page.
+ */
+ protected boolean verifyPageContents()
+ {
+ return true;
+ }
+
+ /**
+ * Returns the implementation of ISystemViewElement for the given
+ * object. Returns null if the adapter is not defined or the
+ * object is not adaptable.
+ */
+ protected ISystemViewElementAdapter getAdapter(Object o)
+ {
+ return SystemAdapterHelpers.getAdapter(o);
+ }
+ /**
+ * Returns the implementation of ISystemRemoteElement for the given
+ * object. Returns null if this object does not adaptable to this.
+ */
+ protected ISystemRemoteElementAdapter getRemoteAdapter(Object o)
+ {
+ return SystemAdapterHelpers.getRemoteAdapter(o);
+ }
+
+ // ----------------------------------------
+ // The following were for any aborted attempt to query registered subsystem property pages
+ // and use them. The problem with this is that for iSeries, all property pages for subsystems
+ // are shared and we ended up with redundancies.
+ // ----------------------------------------
+
+ // ----------------------------------------
+ // SelectionListener methods...
+ // ----------------------------------------
+ /**
+ * A tab item selected
+ */
+ public void widgetSelected(SelectionEvent event)
+ {
+ if (event.getSource() == tabFolder)
+ {
+ }
+ }
+ /**
+ * Not used
+ */
+ public void widgetDefaultSelected(SelectionEvent event)
+ {
+ }
+
+ // ----------------------------------------
+ // CALLBACKS FROM SYSTEM CONNECTION FORM...
+ // ----------------------------------------
+ /**
+ * Event: the user has selected a system type.
+ */
+ public void systemTypeSelected(String systemType, boolean duringInitialization)
+ {
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemConnectorServicesPropertyPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemConnectorServicesPropertyPage.java
new file mode 100644
index 00000000000..0f7cefc4304
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemConnectorServicesPropertyPage.java
@@ -0,0 +1,88 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.propertypages;
+
+import org.eclipse.rse.core.subsystems.IConnectorService;
+import org.eclipse.rse.model.IHost;
+import org.eclipse.rse.ui.widgets.services.ConnectorServiceElement;
+import org.eclipse.rse.ui.widgets.services.ConnectorServicesForm;
+import org.eclipse.rse.ui.widgets.services.RootServiceElement;
+import org.eclipse.rse.ui.widgets.services.ServiceElement;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+
+public class SystemConnectorServicesPropertyPage extends SystemBasePropertyPage
+{
+ private ConnectorServicesForm _form;
+ private ServiceElement _root;
+ public IHost getHost()
+ {
+ return (IHost)getElement();
+ }
+
+
+ protected Control createContentArea(Composite parent)
+ {
+ _form = new ConnectorServicesForm(getMessageLine());
+
+ Control control = _form.createContents(parent);
+ initForm();
+ return control;
+ }
+
+
+ protected void initForm()
+ {
+ _root = getRoot();
+ _form.init(_root);
+ }
+
+ protected ServiceElement getRoot()
+ {
+ RootServiceElement root = new RootServiceElement();
+ IHost host = getHost();
+ IConnectorService[] connectorServices = host.getConnectorServices();
+ ServiceElement[] elements = new ServiceElement[connectorServices.length];
+ for (int i = 0; i < connectorServices.length; i++)
+ {
+ elements[i] = new ConnectorServiceElement(host, root, connectorServices[i]);
+ }
+ root.setChildren(elements);
+ return root;
+ }
+
+ protected boolean verifyPageContents()
+ {
+ return true;
+ }
+
+
+ public boolean performCancel()
+ {
+ _root.revert();
+ return super.performCancel();
+ }
+
+
+ public boolean performOk()
+ {
+ _root.commit();
+ return super.performOk();
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemFilterPoolPropertyPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemFilterPoolPropertyPage.java
new file mode 100644
index 00000000000..cba40bae38c
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemFilterPoolPropertyPage.java
@@ -0,0 +1,126 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.propertypages;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
+import org.eclipse.rse.filters.ISystemFilterPool;
+import org.eclipse.rse.filters.ISystemFilterPoolReference;
+import org.eclipse.rse.ui.SystemPropertyResources;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.SystemWidgetHelpers;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+
+
+/**
+ * The property page for filter pool properties.
+ * This is an output-only page.
+ * The plugin.xml file registers this for objects of class com.ibm.etools.systems.filters.SystemFilterPool
+ */
+public class SystemFilterPoolPropertyPage extends SystemBasePropertyPage
+{
+
+ protected Label labelType, labelName, labelProfile, labelReferenceCount, labelRelatedConnection;
+ protected String errorMessage;
+ protected boolean initDone = false;
+
+ /**
+ * Constructor
+ */
+ public SystemFilterPoolPropertyPage()
+ {
+ super();
+ SystemPlugin sp = SystemPlugin.getDefault();
+ }
+ /**
+ * Create the page's GUI contents.
+ * @see org.eclipse.jface.preference.PreferencePage#createContents(Composite)
+ */
+ protected Control createContentArea(Composite parent)
+ {
+ // ensure the page has no special buttons
+ noDefaultAndApplyButton();
+
+ // Inner composite
+ Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, 2);
+
+ // Type display
+ labelType = createLabeledLabel(composite_prompts, SystemResources.RESID_PP_PROPERTIES_TYPE_LABEL, SystemResources.RESID_PP_PROPERTIES_TYPE_TOOLTIP);
+ labelType.setText(SystemResources.RESID_FILTERPOOL_TYPE_VALUE);
+
+ // Name display
+ labelName = createLabeledLabel(composite_prompts, SystemResources.RESID_FILTERPOOL_NAME_LABEL, SystemResources.RESID_FILTERPOOL_NAME_TOOLTIP);
+
+ // Profile display
+ labelProfile = createLabeledLabel(composite_prompts, SystemResources.RESID_FILTERPOOL_PROFILE_LABEL, SystemResources.RESID_FILTERPOOL_PROFILE_TOOLTIP);
+
+ // Reference count display
+ labelReferenceCount = createLabeledLabel(composite_prompts, SystemResources.RESID_FILTERPOOL_REFERENCECOUNT_LABEL, SystemResources.RESID_FILTERPOOL_REFERENCECOUNT_TOOLTIP);
+
+ // Related connection display
+ labelRelatedConnection = createLabeledLabel(composite_prompts, SystemResources.RESID_FILTERPOOL_RELATEDCONNECTION_LABEL, SystemResources.RESID_FILTERPOOL_RELATEDCONNECTION_TOOLTIP);
+
+ if (!initDone)
+ doInitializeFields();
+
+ return composite_prompts;
+ }
+ /**
+ * From parent: do full page validation
+ */
+ protected boolean verifyPageContents()
+ {
+ return true;
+ }
+
+ /**
+ * Get the input filterpool object
+ */
+ protected ISystemFilterPool getFilterPool()
+ {
+ Object element = getElement();
+ if (element instanceof ISystemFilterPool)
+ return (ISystemFilterPool)element;
+ else
+ return ((ISystemFilterPoolReference)element).getReferencedFilterPool();
+ }
+
+ /**
+ * Initialize values of input fields based on input
+ */
+ protected void doInitializeFields()
+ {
+ initDone = true;
+ ISystemFilterPool pool = getFilterPool();
+ // name
+ labelName.setText(pool.getName());
+ // profile
+ ISubSystemConfiguration ssFactory = (ISubSystemConfiguration)(pool.getProvider());
+ String profileName = ssFactory.getSystemProfile(pool).getName();
+ labelProfile.setText( profileName );
+ // reference count
+ labelReferenceCount.setText(Integer.toString(pool.getReferenceCount()));
+ // related connection
+ if (pool.getOwningParentName() == null)
+ labelRelatedConnection.setText(SystemPropertyResources.RESID_TERM_NOTAPPLICABLE);
+ else
+ labelRelatedConnection.setText(pool.getOwningParentName());
+ }
+
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemFilterPoolReferencePropertyPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemFilterPoolReferencePropertyPage.java
new file mode 100644
index 00000000000..61ef94958c5
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemFilterPoolReferencePropertyPage.java
@@ -0,0 +1,117 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.propertypages;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
+import org.eclipse.rse.filters.ISystemFilterPool;
+import org.eclipse.rse.filters.ISystemFilterPoolReference;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.SystemWidgetHelpers;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+
+
+/**
+ * The property page for filter pool properties.
+ * This is an output-only page.
+ * The plugin.xml file registers this for objects of class com.ibm.etools.systems.filters.SystemFilterPool
+ */
+public class SystemFilterPoolReferencePropertyPage extends SystemBasePropertyPage
+{
+
+ protected Label labelType, labelName, labelSubSystem, labelProfile, labelConnection; //, labelRelatedConnection;
+ protected String errorMessage;
+ protected boolean initDone = false;
+
+ /**
+ * Constructor
+ */
+ public SystemFilterPoolReferencePropertyPage()
+ {
+ super();
+ SystemPlugin sp = SystemPlugin.getDefault();
+ }
+ /**
+ * Create the page's GUI contents.
+ * @see org.eclipse.jface.preference.PreferencePage#createContents(Composite)
+ */
+ protected Control createContentArea(Composite parent)
+ {
+ // Inner composite
+ Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, 2);
+
+ // Type display
+ labelType = createLabeledLabel(composite_prompts, SystemResources.RESID_PP_PROPERTIES_TYPE_LABEL, SystemResources.RESID_PP_PROPERTIES_TYPE_TOOLTIP);
+ labelType.setText(SystemResources.RESID_FILTERPOOLREF_TYPE_VALUE);
+
+ // Name display
+ labelName = createLabeledLabel(composite_prompts, SystemResources.RESID_FILTERPOOLREF_NAME_LABEL, SystemResources.RESID_FILTERPOOLREF_NAME_TOOLTIP);
+
+ // SubSystem display
+ labelSubSystem = createLabeledLabel(composite_prompts, SystemResources.RESID_FILTERPOOLREF_SUBSYSTEM_LABEL, SystemResources.RESID_FILTERPOOLREF_SUBSYSTEM_TOOLTIP);
+
+ // Connection display
+ labelConnection = createLabeledLabel(composite_prompts, SystemResources.RESID_FILTERPOOLREF_CONNECTION_LABEL, SystemResources.RESID_FILTERPOOLREF_CONNECTION_TOOLTIP);
+
+ // Profile display
+ labelProfile = createLabeledLabel(composite_prompts, SystemResources.RESID_FILTERPOOLREF_PROFILE_LABEL, SystemResources.RESID_FILTERPOOLREF_PROFILE_TOOLTIP);
+
+ if (!initDone)
+ doInitializeFields();
+
+ return composite_prompts;
+ }
+ /**
+ * From parent: do full page validation
+ */
+ protected boolean verifyPageContents()
+ {
+ return true;
+ }
+
+ /**
+ * Get the input filterpoolreference object
+ */
+ protected ISystemFilterPoolReference getFilterPoolReference()
+ {
+ return ((ISystemFilterPoolReference)getElement());
+ }
+
+ /**
+ * Initialize values of input fields based on input
+ */
+ protected void doInitializeFields()
+ {
+ initDone = true;
+ ISystemFilterPoolReference poolRef = getFilterPoolReference();
+ ISystemFilterPool pool = poolRef.getReferencedFilterPool();
+ ISubSystem ss = (ISubSystem)poolRef.getProvider();
+ ISubSystemConfiguration ssFactory = ss.getSubSystemConfiguration();
+
+ // name
+ labelName.setText(pool.getName());
+ // subsystem
+ labelSubSystem.setText(ss.getName());
+ // connection
+ labelConnection.setText(ss.getHostAliasName());
+ // profile
+ labelProfile.setText(ss.getSystemProfileName());
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemFilterPropertyPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemFilterPropertyPage.java
new file mode 100644
index 00000000000..ab726376466
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemFilterPropertyPage.java
@@ -0,0 +1,135 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.propertypages;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
+import org.eclipse.rse.filters.ISystemFilter;
+import org.eclipse.rse.filters.ISystemFilterPool;
+import org.eclipse.rse.filters.ISystemFilterReference;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.SystemWidgetHelpers;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+
+
+/**
+ * The property page for filter properties.
+ * This is an output-only page.
+ * The plugin.xml file registers this for objects of class com.ibm.etools.systems.filters.SystemFilter
+ */
+public class SystemFilterPropertyPage extends SystemBasePropertyPage
+{
+
+ protected Label labelType, labelName, labelFilterPool, labelStringCount, labelIsConnectionPrivate, labelProfile;
+ protected String errorMessage;
+ protected boolean initDone = false;
+
+ /**
+ * Constructor
+ */
+ public SystemFilterPropertyPage()
+ {
+ super();
+ SystemPlugin sp = SystemPlugin.getDefault();
+ }
+ /**
+ * Create the page's GUI contents.
+ * @see org.eclipse.jface.preference.PreferencePage#createContents(Composite)
+ */
+ protected Control createContentArea(Composite parent)
+ {
+ // Inner composite
+ Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, 2);
+
+ // Type display
+ labelType = createLabeledLabel(composite_prompts, SystemResources.RESID_PP_PROPERTIES_TYPE_LABEL, SystemResources.RESID_PP_PROPERTIES_TYPE_TOOLTIP);
+ labelType.setText(SystemResources.RESID_PP_FILTER_TYPE_VALUE);
+
+ // Name display
+ labelName = createLabeledLabel(composite_prompts, SystemResources.RESID_PP_FILTER_NAME_LABEL, SystemResources.RESID_PP_FILTER_NAME_TOOLTIP);
+
+ // String count display
+ labelStringCount = createLabeledLabel(composite_prompts, SystemResources.RESID_PP_FILTER_STRINGCOUNT_LABEL, SystemResources.RESID_PP_FILTER_STRINGCOUNT_TOOLTIP);
+
+ // Is connection-private display
+ labelIsConnectionPrivate = createLabeledLabel(composite_prompts, SystemResources.RESID_PP_FILTER_ISCONNECTIONPRIVATE_LABEL, SystemResources.RESID_PP_FILTER_ISCONNECTIONPRIVATE_TOOLTIP);
+
+ // Parent Filter Pool display
+ labelFilterPool = createLabeledLabel(composite_prompts, SystemResources.RESID_PP_FILTER_FILTERPOOL_LABEL, SystemResources.RESID_PP_FILTER_FILTERPOOL_TOOLTIP);
+
+ // Parent Profile display
+ labelProfile = createLabeledLabel(composite_prompts, SystemResources.RESID_PP_FILTER_PROFILE_LABEL, SystemResources.RESID_PP_FILTER_PROFILE_TOOLTIP);
+
+ if (!initDone)
+ doInitializeFields();
+
+ return composite_prompts;
+ }
+ /**
+ * From parent: do full page validation
+ */
+ protected boolean verifyPageContents()
+ {
+ return true;
+ }
+
+ /**
+ * Get the input filter object
+ */
+ protected ISystemFilter getFilter()
+ {
+ Object element = getElement();
+ if (element instanceof ISystemFilter)
+ return (ISystemFilter)element;
+ else
+ return ((ISystemFilterReference)element).getReferencedFilter();
+ }
+
+ /**
+ * Initialize values of input fields based on input
+ */
+ protected void doInitializeFields()
+ {
+ initDone = true;
+ ISystemFilter filter = getFilter();
+ boolean isTransient = filter.isTransient();
+ // name
+ labelName.setText(filter.getName());
+ // type
+ if (filter.isPromptable())
+ labelType.setText(SystemResources.RESID_PP_FILTER_TYPE_PROMPTABLE_VALUE);
+ if (!isTransient)
+ {
+ // pool
+ ISystemFilterPool pool = filter.getParentFilterPool();
+ labelFilterPool.setText(pool.getName());
+ // profile
+ ISubSystemConfiguration ssFactory = (ISubSystemConfiguration)(pool.getProvider());
+ String profileName = ssFactory.getSystemProfile(pool).getName();
+ labelProfile.setText( profileName );
+ // string count
+ labelStringCount.setText(Integer.toString(filter.getFilterStringCount()));
+ // is connection-private
+ if (pool.getOwningParentName() == null)
+ labelIsConnectionPrivate.setText(SystemResources.TERM_NO);
+ else
+ labelIsConnectionPrivate.setText(SystemResources.TERM_YES);
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemFilterStringPropertyPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemFilterStringPropertyPage.java
new file mode 100644
index 00000000000..dac3af36cb8
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemFilterStringPropertyPage.java
@@ -0,0 +1,340 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.propertypages;
+import java.util.ResourceBundle;
+import java.util.Vector;
+
+import org.eclipse.rse.core.SystemBasePlugin;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
+import org.eclipse.rse.core.subsystems.util.ISubsystemConfigurationAdapter;
+import org.eclipse.rse.filters.ISystemFilter;
+import org.eclipse.rse.filters.ISystemFilterPool;
+import org.eclipse.rse.filters.ISystemFilterPoolManager;
+import org.eclipse.rse.filters.ISystemFilterPoolManagerProvider;
+import org.eclipse.rse.filters.ISystemFilterPoolReferenceManagerProvider;
+import org.eclipse.rse.filters.ISystemFilterString;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.SystemWidgetHelpers;
+import org.eclipse.rse.ui.filters.ISystemFilterStringEditPaneListener;
+import org.eclipse.rse.ui.filters.SystemFilterStringEditPane;
+import org.eclipse.rse.ui.messages.SystemMessageDialog;
+import org.eclipse.rse.ui.validators.ISystemValidator;
+import org.eclipse.rse.ui.validators.ValidatorFilterString;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * The property page for filter string properties.
+ * This is an output-only page.
+ * The plugin.xml file registers this for objects of class com.ibm.etools.systems.filters.SystemFilterString
+ */
+public class SystemFilterStringPropertyPage extends SystemBasePropertyPage implements ISystemFilterStringEditPaneListener
+{
+ //gui
+ protected Label labelType, labelFilter, labelFilterPool, labelProfile;
+ //protected Label labelString;
+ //input
+ protected SystemFilterStringEditPane editPane;
+ protected ISystemValidator filterStringValidator;
+ protected SystemMessage dupeFilterStringMessage;
+ protected boolean editable = true;
+ //state
+ protected Composite composite_prompts;
+ protected SystemMessage errorMessage;
+ protected ResourceBundle rb;
+ protected boolean initDone = false;
+
+ /**
+ * Constructor
+ */
+ public SystemFilterStringPropertyPage()
+ {
+ super();
+ SystemPlugin sp = SystemPlugin.getDefault();
+ }
+
+ // configuration methods, called by customizeFilterStringPropertyPage in SubSystemFactoryImpl...
+
+ /**
+ * Configuration method
+ * This is passed into the filter and filter string wizards and dialogs in case it is needed
+ * for context.
+ */
+ public void setSystemFilterPoolReferenceManagerProvider(ISystemFilterPoolReferenceManagerProvider provider)
+ {
+ editPane.setSystemFilterPoolReferenceManagerProvider(provider);
+ }
+ /**
+ * Configuration method
+ * This is passed into the filter and filter string wizards and dialogs in case it is needed
+ * for context.
+ */
+ public void setSystemFilterPoolManagerProvider(ISystemFilterPoolManagerProvider provider)
+ {
+ editPane.setSystemFilterPoolManagerProvider(provider);
+ }
+ /**
+ * Configuration method
+ * Your validator should extend ValidatorFilterString to inherited the uniqueness error checking.
+ *
+ * Alternatively, if all you want is a unique error message for the case when duplicates are found,
+ * call setDuplicateFilterStringErrorMessage, and it will be used in the default validator.
+ */
+ public void setFilterStringValidator(ISystemValidator v)
+ {
+ filterStringValidator = v;
+ }
+ /**
+ * Configuration method
+ * The control is created if it does not yet exist
+ *
+ * The control is created if it does not yet exist
+ *
+ * This hook is not called when the text is initialized
+ * (or reset to the default value) from the preference store.
+ *
+ * Subclasses should override to do full error checking on all
+ * the widgets on the page.
+ */
+ public boolean verifyPageContents()
+ {
+ return form.verifyFormContents();
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemSubSystemPropertyPageCoreForm.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemSubSystemPropertyPageCoreForm.java
new file mode 100644
index 00000000000..ebccdf54681
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemSubSystemPropertyPageCoreForm.java
@@ -0,0 +1,404 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.propertypages;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.SystemPropertyResources;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.SystemWidgetHelpers;
+import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
+import org.eclipse.rse.ui.messages.ISystemMessageLine;
+import org.eclipse.rse.ui.validators.ISystemValidator;
+import org.eclipse.rse.ui.widgets.InheritableEntryField;
+import org.eclipse.rse.ui.widgets.SystemPortPrompt;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.dialogs.PropertyPage;
+
+/**
+ * The form for the property page for core subsystem properties.
+ */
+public class SystemSubSystemPropertyPageCoreForm extends AbstractSystemSubSystemPropertyPageCoreForm
+{
+
+ protected SystemPortPrompt portPrompt;
+ protected Label labelUserId, labelUserIdPrompt;
+ protected InheritableEntryField textUserId;
+ protected boolean portEditable=true, portApplicable=true, userIdApplicable=true;
+ // validators
+ protected ISystemValidator portValidator;
+ protected ISystemValidator userIdValidator;
+
+ /**
+ * Constructor
+ */
+ public SystemSubSystemPropertyPageCoreForm(ISystemMessageLine msgLine, Object caller)
+ {
+ super(msgLine, caller);
+ }
+
+ /**
+ * Create the GUI contents.
+ */
+ public Control createInner(Composite composite_prompts, Object inputElement, Shell shell)
+ {
+ this.shell = shell;
+ this.inputElement = inputElement;
+
+
+ // Port prompt
+ // Composite portComposite = SystemWidgetHelpers.createComposite(composite_prompts, 2, 1, false, null, 0, 0);
+ // labelPortPrompt = SystemWidgetHelpers.createLabel(composite_prompts, rb.getString(RESID_SUBSYSTEM_PORT_LABEL)+": ");
+ portPrompt = new SystemPortPrompt(composite_prompts, msgLine, true, isPortEditable(), getSubSystem().getConnectorService().getPort(), getPortValidator());
+
+
+ // UserId Prompt
+ String temp = SystemWidgetHelpers.appendColon(SystemResources.RESID_SUBSYSTEM_USERID_LABEL);
+ labelUserIdPrompt = SystemWidgetHelpers.createLabel(composite_prompts, temp);
+ userIdApplicable = isUserIdApplicable();
+ if (userIdApplicable)
+ {
+ textUserId = SystemWidgetHelpers.createInheritableTextField(
+ composite_prompts,SystemResources.RESID_SUBSYSTEM_USERID_INHERITBUTTON_TIP,SystemResources.RESID_SUBSYSTEM_USERID_TIP);
+ textUserId.setFocus();
+ }
+ else
+ labelUserId = SystemWidgetHelpers.createLabel(composite_prompts, getTranslatedNotApplicable());
+
+ if (!initDone)
+ doInitializeFields();
+
+ if (textUserId != null)
+ textUserId.addModifyListener(
+ new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ validateUserIdInput();
+ }
+ }
+ );
+
+ return composite_prompts;
+ }
+
+ /**
+ * Return control to recieve initial focus
+ */
+ public Control getInitialFocusControl()
+ {
+ if (portPrompt.isEditable())
+ return portPrompt.getPortField();
+ else if (userIdApplicable)
+ return textUserId;
+ else
+ return null;
+ }
+
+ /**
+ * Return true if the port is editable for this subsystem
+ */
+ protected boolean isPortEditable()
+ {
+ return getSubSystem().getSubSystemConfiguration().isPortEditable();
+ }
+ /**
+ * Return true if the userId is applicable for this subsystem
+ */
+ protected boolean isUserIdApplicable()
+ {
+ return getSubSystem().getSubSystemConfiguration().supportsUserId();
+ }
+
+ private ISystemValidator getPortValidator()
+ {
+ if (portValidator == null)
+ {
+ portValidator = getSubSystem().getSubSystemConfiguration().getPortValidator();
+ }
+ return portValidator;
+ }
+ /**
+ * Initialize values of input fields based on input
+ */
+ protected void doInitializeFields()
+ {
+ initDone = true;
+ ISubSystem ss = getSubSystem();
+ ISubSystemConfiguration ssFactory = ss.getSubSystemConfiguration();
+ userIdValidator = ssFactory.getUserIdValidator();
+ //getPortValidator();
+ // vendor
+ labelVendor.setText(ssFactory.getVendor());
+ // name
+ labelName.setText(ss.getName());
+ // connection
+ labelConnection.setText(ss.getHostAliasName());
+ // profile
+ labelProfile.setText(ss.getSystemProfileName());
+ /*
+ // port
+ if (portEditable || portApplicable)
+ {
+ Integer port = ss.getPort();
+ String localPort = null;
+ if (port==null)
+ port = new Integer(0);
+ localPort = port.toString();
+ int iPort = port.intValue();
+ if (!portEditable)
+ labelPort.setText(localPort);
+ else
+ {
+ textPort.setLocalText(localPort);
+ textPort.setInheritedText("0 "+SystemResources.RESID_PORT_DYNAMICSELECT));
+ textPort.setLocal(iPort != 0);
+ }
+ }
+ */
+
+ // userId
+ if (userIdApplicable)
+ {
+ String localUserId = ss.getLocalUserId();
+ textUserId.setLocalText(localUserId);
+ String parentUserId = ss.getHost().getDefaultUserId();
+ textUserId.setInheritedText(parentUserId+" "+SystemPropertyResources.RESID_PROPERTY_INHERITED);
+ textUserId.setLocal((localUserId!=null)&&(localUserId.length()>0));
+ }
+ }
+
+ public void doInitializeInnerFields()
+ {
+ initDone = true;
+ ISubSystem ss = getSubSystem();
+ ISubSystemConfiguration ssFactory = ss.getSubSystemConfiguration();
+ userIdValidator = ssFactory.getUserIdValidator();
+
+ // userId
+ if (userIdApplicable)
+ {
+ String localUserId = ss.getLocalUserId();
+ textUserId.setLocalText(localUserId);
+ String parentUserId = ss.getHost().getDefaultUserId();
+ textUserId.setInheritedText(parentUserId+" "+SystemPropertyResources.RESID_PROPERTY_INHERITED);
+ textUserId.setLocal((localUserId!=null)&&(localUserId.length()>0));
+ }
+ }
+
+ /**
+ * Validate user id value per keystroke
+ */
+ protected SystemMessage validateUserIdInput()
+ {
+ errorMessage= null;
+ if (textUserId != null)
+ {
+ if (!textUserId.isLocal())
+ return null;
+ if (userIdValidator != null)
+ errorMessage= userIdValidator.validate(textUserId.getText());
+ else if (getUserId().equals(""))
+ errorMessage = SystemPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_USERID_EMPTY);
+ }
+ setErrorMessage(errorMessage);
+ //setPageComplete();
+ return errorMessage;
+ }
+
+ /*
+ * Validate port value per keystroke
+ *
+ protected SystemMessage validatePortInput()
+ {
+ errorMessage= null;
+ if (textPort!=null)
+ {
+ if (!textPort.isLocal())
+ return null;
+ if (portValidator != null)
+ errorMessage= portValidator.validate(textPort.getText());
+ else if (getPort().equals(""))
+ errorMessage = SystemPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_USERID_EMPTY);
+ }
+ setErrorMessage(errorMessage);
+ //setPageComplete();
+ return errorMessage;
+ }*/
+
+
+ /**
+ * Return user-entered User Id.
+ */
+ protected String getUserId()
+ {
+ return textUserId.getText().trim();
+ }
+ /*
+ * Return user-entered Port number.
+ *
+ protected String getPort()
+ {
+ return textPort.getText().trim();
+ }*/
+
+ /**
+ * This method can be called by the dialog or wizard page host, to decide whether to enable
+ * or disable the next, final or ok buttons. It returns true if the minimal information is
+ * available and is correct.
+ */
+ public boolean isPageComplete()
+ {
+ boolean pageComplete = false;
+ if (errorMessage == null)
+ pageComplete = (getUserId().length() > 0) && portPrompt.isComplete();
+ return pageComplete;
+ }
+ /**
+ * Inform caller of page-complete status of this form
+ */
+ public void setPageComplete()
+ {
+ boolean complete = isPageComplete();
+ if (callerInstanceOfWizardPage)
+ {
+ ((WizardPage)caller).setPageComplete(complete);
+ }
+ else if (callerInstanceOfSystemPromptDialog)
+ {
+ ((SystemPromptDialog)caller).setPageComplete(complete);
+ }
+ else if (callerInstanceOfPropertyPage)
+ {
+ ((PropertyPage)caller).setValid(complete);
+ }
+ }
+
+ /**
+ * Validate all the widgets on the form
+ */
+ public boolean verifyFormContents()
+ {
+ boolean ok = true;
+ SystemMessage errMsg = null;
+ Control controlInError = null;
+ clearErrorMessage();
+ errMsg = portPrompt.validatePortInput();
+ if (errMsg != null)
+ controlInError = portPrompt.getPortField(); //textPort.getTextField();
+ else
+ {
+ errMsg = validateUserIdInput();
+ if (errMsg != null)
+ controlInError = textUserId.getTextField();
+ }
+ if (errMsg != null)
+ {
+ ok = false;
+ controlInError.setFocus();
+ setErrorMessage(errMsg);
+ }
+ return ok;
+ }
+
+
+ /**
+ * Called by caller when user presses OK
+ */
+ public boolean performOk()
+ {
+ boolean ok = verifyFormContents();
+ if (ok)
+ {
+ ISubSystem ss = getSubSystem();
+ // PROCESS PORT...
+ if (portPrompt.isEditable())
+ updatePort(ss);
+
+ // PROCESS USER ID...
+ if (textUserId != null)
+ {
+ String userId = getUserId();
+ updateUserId(ss);
+ }
+ }
+ return ok;
+ }
+
+ /**
+ * Change the subsystem user Id value
+ */
+ private void updateUserId(ISubSystem subsys)
+ {
+ //int whereToUpdate = USERID_LOCATION_SUBSYSTEM;
+ String userId = textUserId.getLocalText(); // will be "" if !textuserid.getIsLocal(), which results in wiping out local override
+ ISubSystemConfiguration ssFactory = subsys.getSubSystemConfiguration();
+ // unlike with connection objects, we don't ever allow the user to change the parent's
+ // userId value, even if it is empty, when working with subsystems. There is too much
+ // ambiquity as the parent could be the connnection or the user preferences setting for this
+ // system type. Because of this decision, we don't need to tell updateSubSystem(...) where
+ // to update, as it always the local subsystem.
+ ssFactory.updateSubSystem(getShell(), subsys, true, userId, false, subsys.getConnectorService().getPort());
+ }
+ /**
+ * Change the subsystem port value
+ */
+ private void updatePort(ISubSystem subsys)
+ {
+ /*
+ String port = textPort.getLocalText(); // will be "" if !textPort.getIsLocal(), which results in wiping out local override
+ Integer portInteger = null;
+ if (textPort.isLocal() && (port.length()>0))
+ portInteger = new Integer(port);
+ else
+ portInteger = new Integer(0);
+ */
+ int portInteger = portPrompt.getPort();
+ ISubSystemConfiguration ssFactory = subsys.getSubSystemConfiguration();
+ ssFactory.updateSubSystem(getShell(), subsys, false, subsys.getLocalUserId(), true, portInteger);
+ }
+
+ /**
+ * Return "Not applicable" translated
+ */
+ private String getTranslatedNotApplicable()
+ {
+ if (xlatedNotApplicable == null)
+ xlatedNotApplicable = SystemPropertyResources.RESID_TERM_NOTAPPLICABLE;
+ return xlatedNotApplicable;
+ }
+
+ private void setErrorMessage(SystemMessage msg)
+ {
+ if (msgLine != null)
+ if (msg != null)
+ msgLine.setErrorMessage(msg);
+ else
+ msgLine.clearErrorMessage();
+ }
+ private void clearErrorMessage()
+ {
+ if (msgLine != null)
+ msgLine.clearErrorMessage();
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemTeamViewCategoryPropertyPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemTeamViewCategoryPropertyPage.java
new file mode 100644
index 00000000000..b0446a5122b
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemTeamViewCategoryPropertyPage.java
@@ -0,0 +1,110 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.propertypages;
+import org.eclipse.rse.ui.SystemPropertyResources;
+import org.eclipse.rse.ui.SystemWidgetHelpers;
+import org.eclipse.rse.ui.view.SystemViewResources;
+import org.eclipse.rse.ui.view.team.SystemTeamViewCategoryNode;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+
+
+/**
+ * The property page for category nodes in the Team view.
+ * This is an output-only page.
+ */
+public class SystemTeamViewCategoryPropertyPage extends SystemBasePropertyPage
+{
+
+ protected Label labelType, labelName, labelDescription;
+ protected String errorMessage;
+ protected boolean initDone = false;
+
+ /**
+ * Constructor for SystemFilterPropertyPage
+ */
+ public SystemTeamViewCategoryPropertyPage()
+ {
+ super();
+ }
+ /**
+ * Create the page's GUI contents.
+ * @see org.eclipse.jface.preference.PreferencePage#createContents(Composite)
+ */
+ protected Control createContentArea(Composite parent)
+ {
+ // Inner composite
+ int nbrColumns = 2;
+ Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns);
+
+ // Type prompt
+ String typeLabel = SystemPropertyResources.RESID_PROPERTY_TYPE_LABEL;
+ String typeTooltip = SystemPropertyResources.RESID_PROPERTY_TYPE_TOOLTIP;
+
+ labelType = createLabeledLabel(composite_prompts, typeLabel, typeTooltip);
+ labelType.setText(SystemViewResources.RESID_PROPERTY_TEAM_CATEGORY_TYPE_VALUE);
+
+ // Name prompt
+ String nameLabel = SystemPropertyResources.RESID_PROPERTY_NAME_LABEL;
+ String nameTooltip = SystemPropertyResources.RESID_PROPERTY_NAME_TOOLTIP;
+
+ labelName = createLabeledLabel(composite_prompts, nameLabel, nameTooltip);
+
+ // Description prompt
+ addFillerLine(composite_prompts, nbrColumns);
+ addSeparatorLine(composite_prompts, nbrColumns);
+ //key = ISystemConstants.RESID_PROPERTY_DESCRIPTION_ROOT;
+ //Label l = SystemWidgetHelpers.createLabel(composite_prompts, rb, key, nbrColumns, false);
+ //l.setText(l.getText() + ":");
+ labelDescription = (Label)SystemWidgetHelpers.createVerbage(composite_prompts, "", nbrColumns, false, 200);
+
+ if (!initDone)
+ doInitializeFields();
+
+ return composite_prompts;
+ }
+ /**
+ * From parent: do full page validation
+ */
+ protected boolean verifyPageContents()
+ {
+ return true;
+ }
+
+ /**
+ * Get the input team view category node
+ */
+ protected SystemTeamViewCategoryNode getCategoryNode()
+ {
+ Object element = getElement();
+ return ((SystemTeamViewCategoryNode)element);
+ }
+
+ /**
+ * Initialize values of input fields based on input
+ */
+ protected void doInitializeFields()
+ {
+ initDone = true;
+ SystemTeamViewCategoryNode node = getCategoryNode();
+ // populate GUI...
+ labelName.setText(node.getLabel());
+ labelDescription.setText(node.getDescription());
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemTeamViewProfilePropertyPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemTeamViewProfilePropertyPage.java
new file mode 100644
index 00000000000..16a093ab9c8
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemTeamViewProfilePropertyPage.java
@@ -0,0 +1,114 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.propertypages;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.model.ISystemProfile;
+import org.eclipse.rse.ui.SystemPropertyResources;
+import org.eclipse.rse.ui.SystemWidgetHelpers;
+import org.eclipse.rse.ui.view.SystemViewResources;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+
+
+/**
+ * The property page for profile nodes in the Team view.
+ * This is an output-only page.
+ */
+public class SystemTeamViewProfilePropertyPage extends SystemBasePropertyPage
+{
+
+ protected Label labelType, labelName, labelStatus;
+ protected String errorMessage;
+ protected boolean initDone = false;
+
+ /**
+ * Constructor for SystemFilterPropertyPage
+ */
+ public SystemTeamViewProfilePropertyPage()
+ {
+ super();
+ }
+ /**
+ * Create the page's GUI contents.
+ * @see org.eclipse.jface.preference.PreferencePage#createContents(Composite)
+ */
+ protected Control createContentArea(Composite parent)
+ {
+ // Inner composite
+ Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, 2);
+
+ // Type prompt
+ labelType = createLabeledLabel(composite_prompts, SystemPropertyResources.RESID_PROPERTY_TYPE_LABEL, SystemPropertyResources.RESID_PROPERTY_TYPE_TOOLTIP);
+ labelType.setText(SystemViewResources.RESID_PROPERTY_PROFILE_TYPE_VALUE);
+
+ // Name prompt
+ labelName = createLabeledLabel(composite_prompts, SystemPropertyResources.RESID_PROPERTY_NAME_LABEL, SystemPropertyResources.RESID_PROPERTY_NAME_TOOLTIP);
+
+ // Status prompt
+ labelStatus = createLabeledLabel(composite_prompts, SystemViewResources.RESID_PROPERTY_PROFILESTATUS_LABEL, SystemViewResources.RESID_PROPERTY_PROFILESTATUS_TOOLTIP);
+
+
+ if (!initDone)
+ doInitializeFields();
+
+ return composite_prompts;
+ }
+ /**
+ * From parent: do full page validation
+ */
+ protected boolean verifyPageContents()
+ {
+ return true;
+ }
+
+ /**
+ * Get the input team view category node
+ */
+ protected ISystemProfile getProfile()
+ {
+ Object element = getElement();
+ return ((ISystemProfile)element);
+ }
+
+ /**
+ * Initialize values of input fields based on input
+ */
+ protected void doInitializeFields()
+ {
+ initDone = true;
+ ISystemProfile profile = getProfile();
+ // populate GUI...
+ labelName.setText(profile.getName());
+ boolean active = SystemPlugin.getTheSystemRegistry().getSystemProfileManager().isSystemProfileActive(profile.getName());
+ if (active)
+ labelStatus.setText(SystemViewResources.RESID_PROPERTY_PROFILESTATUS_ACTIVE_LABEL);
+ else
+ labelStatus.setText(SystemViewResources.RESID_PROPERTY_PROFILESTATUS_NOTACTIVE_LABEL);
+
+ }
+
+ /**
+ * Called by parent when user presses OK
+ */
+ public boolean performOk()
+ {
+ boolean ok = true;
+ return ok;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemTeamViewSubSystemFactoryPropertyPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemTeamViewSubSystemFactoryPropertyPage.java
new file mode 100644
index 00000000000..8505bf21d06
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemTeamViewSubSystemFactoryPropertyPage.java
@@ -0,0 +1,145 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.propertypages;
+import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
+import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.SystemPropertyResources;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.SystemWidgetHelpers;
+import org.eclipse.rse.ui.view.SystemViewResources;
+import org.eclipse.rse.ui.view.team.SystemTeamViewSubSystemFactoryNode;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+
+
+/**
+ * The property page for subsystem factory nodes in the Team view.
+ * This is an output-only page.
+ */
+public class SystemTeamViewSubSystemFactoryPropertyPage extends SystemBasePropertyPage
+ implements ISystemMessages
+{
+
+ protected Label labelType, labelName, labelId, labelVendor, labelTypes;
+ protected String errorMessage;
+ protected boolean initDone = false;
+
+ /**
+ * Constructor for SystemFilterPropertyPage
+ */
+ public SystemTeamViewSubSystemFactoryPropertyPage()
+ {
+ super();
+ }
+ /**
+ * Create the page's GUI contents.
+ * @see org.eclipse.jface.preference.PreferencePage#createContents(Composite)
+ */
+ protected Control createContentArea(Composite parent)
+ {
+ // Inner composite
+ int nbrColumns = 2;
+ Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns);
+
+ // Type prompt
+ labelType = createLabeledLabel(composite_prompts, SystemPropertyResources.RESID_PROPERTY_TYPE_LABEL, SystemPropertyResources.RESID_PROPERTY_TYPE_TOOLTIP);
+ labelType.setText(SystemViewResources.RESID_PROPERTY_TEAM_SSFACTORY_TYPE_VALUE);
+
+ // Name prompt
+ labelName = createLabeledLabel(composite_prompts, SystemPropertyResources.RESID_PROPERTY_NAME_LABEL, SystemPropertyResources.RESID_PROPERTY_NAME_TOOLTIP);
+
+ // Id prompt
+ labelId = createLabeledLabel(composite_prompts, SystemResources.RESID_PP_SUBSYSFACTORY_ID_LABEL, SystemResources.RESID_PP_SUBSYSFACTORY_ID_TOOLTIP);
+
+ // Vendor prompt
+ labelVendor = createLabeledLabel(composite_prompts, SystemResources.RESID_PP_SUBSYSFACTORY_VENDOR_LABEL, SystemResources.RESID_PP_SUBSYSFACTORY_VENDOR_TOOLTIP);
+
+ // System Types prompt
+ labelTypes = createLabeledLabel(composite_prompts, SystemResources.RESID_PP_SUBSYSFACTORY_TYPES_LABEL, SystemResources.RESID_PP_SUBSYSFACTORY_TYPES_TOOLTIP);
+
+ // description
+ addFillerLine(composite_prompts, nbrColumns);
+ addSeparatorLine(composite_prompts, nbrColumns);
+ SystemWidgetHelpers.createVerbage(composite_prompts, SystemResources.RESID_PP_SUBSYSFACTORY_VERBAGE, nbrColumns, false, 200);
+
+ if (!initDone)
+ doInitializeFields();
+
+ return composite_prompts;
+ }
+
+ /**
+ * From parent: do full page validation
+ */
+ protected boolean verifyPageContents()
+ {
+ return true;
+ }
+
+ /**
+ * Get the input team view subsystem factory node
+ */
+ protected ISubSystemConfiguration getSubSystemFactory()
+ {
+ Object element = getElement();
+ SystemTeamViewSubSystemFactoryNode ssfNode = (SystemTeamViewSubSystemFactoryNode)element;
+ return ssfNode.getSubSystemFactory();
+ }
+
+ /**
+ * Initialize values of input fields based on input
+ */
+ protected void doInitializeFields()
+ {
+ initDone = true;
+ ISubSystemConfiguration ssf = getSubSystemFactory();
+ ISubSystemConfigurationProxy proxy = ssf.getSubSystemFactoryProxy();
+ // populate GUI...
+ labelName.setText(ssf.getName());
+ labelId.setText(proxy.getId());
+ labelVendor.setText(proxy.getVendor());
+ String systypes = "";
+ String[] types = ssf.getSystemTypes();
+ if (ssf.getSubSystemFactoryProxy().supportsAllSystemTypes())
+ {
+ systypes = SystemResources.TERM_ALL;
+ }
+ else
+ {
+ for (int idx=0; idx
+ * Will be null if isValid returned null.
+ */
+ public SystemMessage getSystemMessage();
+
+ /**
+ * For convenience, this is a shortcut to calling:
+ *
+ * Alternatively you can just subclass {@link org.eclipse.rse.ui.validators.ValidatorRemoteSelection}
+ */
+public interface IValidatorRemoteSelection
+{
+
+ /**
+ * The user has selected one or more remote objects. Return null if OK is to be enabled, or a SystemMessage
+ * if it is not to be enabled. The message will be displayed on the message line.
+ */
+ public SystemMessage isValid(IHost selectedConnection, Object[] selectedObjects, ISystemRemoteElementAdapter[] remoteAdaptersForSelectedObject);
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/SystemNumericVerifyListener.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/SystemNumericVerifyListener.java
new file mode 100644
index 00000000000..c255a680789
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/SystemNumericVerifyListener.java
@@ -0,0 +1,46 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.validators;
+
+import org.eclipse.swt.events.VerifyEvent;
+import org.eclipse.swt.events.VerifyListener;
+
+/**
+ * A class that only allows keys representing numeric values to be entered.
+ */
+public class SystemNumericVerifyListener implements VerifyListener {
+
+ /**
+ * @see org.eclipse.swt.events.VerifyListener#verifyText(org.eclipse.swt.events.VerifyEvent)
+ */
+ public void verifyText(VerifyEvent e) {
+
+ String text = e.text;
+ boolean doit = true;
+
+ for (int i = 0; i < text.length(); i++) {
+ char c = text.charAt(i);
+
+ if (!Character.isDigit(c)) {
+ doit = false;
+ break;
+ }
+ }
+
+ e.doit = doit;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorArchiveName.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorArchiveName.java
new file mode 100644
index 00000000000..c57af419946
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorArchiveName.java
@@ -0,0 +1,72 @@
+/********************************************************************************
+ * Copyright (c) 2003, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.validators;
+import java.util.Vector;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+
+
+/**
+ * @author mjberger
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class ValidatorArchiveName extends ValidatorFileName {
+
+ protected SystemMessage msg_NotRegisteredArchive;
+
+ public ValidatorArchiveName(Vector existingNameList) {
+ super(existingNameList);
+ }
+
+ public ValidatorArchiveName(String[] existingNameList) {
+ super(existingNameList);
+ }
+
+ public ValidatorArchiveName() {
+ super();
+ }
+
+ // ---------------------------
+ // Parent Overrides...
+ // ---------------------------
+ /**
+ * Validate each character.
+ * Override of parent method.
+ * Override yourself to refine the error checking.
+ * Also checks to see if its a valid archive name.
+ */
+ public SystemMessage isSyntaxOk(String newText)
+ {
+ msg_NotRegisteredArchive = SystemPlugin.getPluginMessage(MSG_VALIDATE_ARCHIVE_NAME);
+ msg_NotRegisteredArchive.makeSubstitution(newText);
+ IStatus rc = workspace.validateName(newText, IResource.FILE);
+ if (rc.getCode() != IStatus.OK)
+ return msg_Invalid;
+ else if ((getMaximumNameLength() > 0) && // defect 42507
+ (newText.length() > getMaximumNameLength()))
+ return msg_Invalid; // TODO: PHIL. MRI. better message.
+ else if (!ArchiveHandlerManager.getInstance().isRegisteredArchive(newText))
+ return msg_NotRegisteredArchive;
+ return checkForBadCharacters(newText) ? null: msg_Invalid;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorCompileCommandLabel.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorCompileCommandLabel.java
new file mode 100644
index 00000000000..4814d632315
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorCompileCommandLabel.java
@@ -0,0 +1,131 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.validators;
+import java.util.Vector;
+
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemMessages;
+
+
+/**
+ * This class is used to verify a user defined compile command's label
+ */
+public class ValidatorCompileCommandLabel extends ValidatorUniqueString
+ implements ISystemMessages, ISystemValidator
+{
+ public static final int MAX_CMDLABEL_LENGTH = 50; // max name for a compile command name
+
+ protected boolean fUnique;
+ protected SystemMessage msg_Invalid;
+ protected IWorkspace workspace = ResourcesPlugin.getWorkspace();
+
+ /**
+ * Use this constructor when you have a vector of existing labels.
+ */
+ public ValidatorCompileCommandLabel(Vector existingLabelList)
+ {
+ super(existingLabelList, CASE_INSENSITIVE); // case insensitive uniqueness
+ init();
+ }
+ /**
+ * Use this constructor when you have an array of existing labels.
+ */
+ public ValidatorCompileCommandLabel(String existingLabelList[])
+ {
+ super(existingLabelList, CASE_INSENSITIVE); // case insensitive uniqueness
+ init();
+ }
+
+ /**
+ * Use this constructor when the name need not be unique, and you just want
+ * the syntax checking. Or if you will call setExistingNamesList later.
+ */
+ public ValidatorCompileCommandLabel()
+ {
+ super(new String[0], CASE_INSENSITIVE);
+ init();
+ }
+
+ private void init()
+ {
+ super.setErrorMessages(SystemPlugin.getPluginMessage(MSG_VALIDATE_COMPILELABEL_EMPTY),
+ SystemPlugin.getPluginMessage(MSG_VALIDATE_COMPILELABEL_NOTUNIQUE));
+ fUnique = true;
+ msg_Invalid = SystemPlugin.getPluginMessage(MSG_VALIDATE_COMPILELABEL_NOTVALID);
+ }
+ /**
+ * Supply your own error message text. By default, messages from SystemPlugin resource bundle are used.
+ * @param error message when entry field is empty
+ * @param error message when value entered is not unique
+ * @param error message when syntax is not valid
+ */
+ public void setErrorMessages(SystemMessage msg_Empty, SystemMessage msg_NonUnique, SystemMessage msg_Invalid)
+ {
+ super.setErrorMessages(msg_Empty, msg_NonUnique);
+ this.msg_Invalid = msg_Invalid;
+ }
+
+ /**
+ * Overridable method for invalidate character check, beyond what this class offers
+ * @return true if valid, false if not
+ */
+ protected boolean checkForBadCharacters(String newText)
+ {
+ return ((newText.indexOf('&') == -1) && // causes problems in menu popup as its a mnemonic character.
+ (newText.indexOf('@') == -1)); // defect 43950
+ }
+
+ public String toString()
+ {
+ return getClass().getName();
+ }
+
+ // ---------------------------
+ // Parent Overrides...
+ // ---------------------------
+ /**
+ * Validate each character.
+ * Override of parent method.
+ * Override yourself to refine the error checking.
+ */
+ public SystemMessage isSyntaxOk(String newText)
+ {
+ if (newText.length() > getMaximumNameLength())
+ currentMessage = msg_Invalid;
+ else
+ currentMessage = checkForBadCharacters(newText) ? null: msg_Invalid;
+ return currentMessage;
+ }
+
+
+ // ---------------------------
+ // ISystemValidator methods...
+ // ---------------------------
+
+ /**
+ * Return the max length for compile commands: 50
+ */
+ public int getMaximumNameLength()
+ {
+ return MAX_CMDLABEL_LENGTH;
+ }
+
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorConnectionName.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorConnectionName.java
new file mode 100644
index 00000000000..e2a8b71aaf1
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorConnectionName.java
@@ -0,0 +1,97 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.validators;
+import java.util.Vector;
+
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.model.IHost;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.messages.SystemMessageDialog;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * This class is used in dialogs that prompt for a connection alias name.
+ * Relies on Eclipse supplied method to test for folder name validity.
+ *
+ * The IInputValidator interface is used by jface's
+ * InputDialog class and numerous other platform and system classes.
+ */
+public class ValidatorConnectionName extends ValidatorFolderName implements ISystemMessages, ISystemValidator
+{
+ public static final int MAX_CONNECTIONNAME_LENGTH = 100; // arbitrary restriction due to defects
+
+ /**
+ * Constructor.
+ * @param existingNameList Vector of existing names (strings) in owning profile. Can be null if not a rename operation.
+ */
+ public ValidatorConnectionName(Vector existingNameList)
+ {
+ super(existingNameList);
+ super.setErrorMessages(SystemPlugin.getPluginMessage(MSG_VALIDATE_CONNECTIONNAME_EMPTY),
+ SystemPlugin.getPluginMessage(MSG_VALIDATE_CONNECTIONNAME_NOTUNIQUE),
+ SystemPlugin.getPluginMessage(MSG_VALIDATE_CONNECTIONNAME_NOTVALID));
+ }
+
+ /**
+ * Validate the given connection name is not already used in any profile. This is too expensive
+ * to do per keystroke, so you should call this after as a final test. Note, this is a warning
+ * situation, not an error, as we assume we have already tested for the containing profile, and
+ * thus is a test for a match on a connection in a non-containing profile. This results in msg
+ * rseg1241 being presented to the user, and if he chooses No to not continue, we return false
+ * here. You should stop processing on false. Else, we return true meaning everything is ok.
+ */
+ public static boolean validateNameNotInUse(String proposedName, Shell shell)
+ {
+ SystemMessage msg = null;
+ Vector profileNames = SystemPlugin.getTheSystemProfileManager().getSystemProfileNamesVector();
+ String profileName = null;
+ for (int idx=0; (msg==null)&& (idx
+ * The IInputValidator interface is implemented by our parent and it
+ * is used by jface's InputDialog class and property sheet window.
+ */
+public class ValidatorFilterName
+ extends ValidatorFileName implements ISystemMessages, ISystemValidator
+{
+ public static final int MAX_FILTERNAME_LENGTH = 100;
+
+ //public static final boolean CASE_SENSITIVE = true;
+ //public static final boolean CASE_INSENSITIVE = false;
+
+ /**
+ * Constructor accepting a Vector.
+ * @param A vector containing list of existing filter names to compare against.
+ * Note that toString() is used to get the string from each item.
+ * @param true if comparisons are to be case sensitive, false if case insensitive.
+ */
+ public ValidatorFilterName(Vector existingList)
+ {
+ super(existingList);
+ init();
+ }
+ /**
+ * Constructor accepting an Array.
+ * @param An array containing list of existing strings to compare against.
+ * @param true if comparisons are to be case sensitive, false if case insensitive.
+ */
+ public ValidatorFilterName(String[] existingList)
+ {
+ super(existingList);
+ init();
+ }
+
+ private void init()
+ {
+ super.setErrorMessages(SystemPlugin.getPluginMessage(MSG_VALIDATE_FILTERNAME_EMPTY),
+ SystemPlugin.getPluginMessage(MSG_VALIDATE_FILTERNAME_NOTUNIQUE),
+ SystemPlugin.getPluginMessage(MSG_VALIDATE_FILTERNAME_NOTVALID));
+ }
+
+ public String toString()
+ {
+ return "FilterNameValidator class";
+ }
+
+ // ---------------------------
+ // Parent Overrides...
+ // ---------------------------
+
+ /**
+ * Overridable extension point to check for invalidate characters beyond what Eclipse checks for
+ * @return true if valid, false if not
+ */
+ protected boolean checkForBadCharacters(String newText)
+ {
+ if (newText.indexOf('#') >= 0)
+ return false;
+ else
+ return true;
+ }
+
+ // ---------------------------
+ // ISystemValidator methods...
+ // ---------------------------
+
+ /**
+ * Return the max length for filters: 100
+ */
+ public int getMaximumNameLength()
+ {
+ return MAX_FILTERNAME_LENGTH;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorFilterPoolName.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorFilterPoolName.java
new file mode 100644
index 00000000000..316391b1fdb
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorFilterPoolName.java
@@ -0,0 +1,98 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.validators;
+import java.util.Vector;
+
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.ui.ISystemMessages;
+
+
+/**
+ * This class is used in dialogs that prompt for filter name. Filter names
+ * have to be unique, and to enable saving per folder, must be a valid folder name.
+ *
+ * The IInputValidator interface is implemented by our parent and it
+ * is used by jface's InputDialog class and property sheet window.
+ */
+public class ValidatorFilterPoolName
+ extends ValidatorFolderName implements ISystemMessages, ISystemValidator
+{
+ public static final int MAX_FILTERPOOLNAME_LENGTH = 50;
+
+ /**
+ * Constructor accepting a Vector.
+ * @param A vector containing list of existing filter names to compare against.
+ * Note that toString() is used to get the string from each item.
+ * @param true if comparisons are to be case sensitive, false if case insensitive.
+ */
+ public ValidatorFilterPoolName(Vector existingList)
+ {
+ super(existingList);
+ init();
+ }
+ /**
+ * Constructor accepting an Array.
+ * @param An array containing list of existing strings to compare against.
+ * @param true if comparisons are to be case sensitive, false if case insensitive.
+ */
+ public ValidatorFilterPoolName(String[] existingList)
+ {
+ super(existingList);
+ init();
+ }
+
+ private void init()
+ {
+ super.setErrorMessages(SystemPlugin.getPluginMessage(MSG_VALIDATE_FILTERPOOLNAME_EMPTY),
+ SystemPlugin.getPluginMessage(MSG_VALIDATE_FILTERPOOLNAME_NOTUNIQUE),
+ SystemPlugin.getPluginMessage(MSG_VALIDATE_FILTERPOOLNAME_NOTVALID));
+ }
+
+
+ public String toString()
+ {
+ return "FilterNameValidator class";
+ }
+
+ // ---------------------------
+ // Parent Overrides...
+ // ---------------------------
+
+ /**
+ * Overridable extension point to check for invalidate characters beyond what Eclipse checks for
+ * @return true if valid, false if not
+ */
+ protected boolean checkForBadCharacters(String newText)
+ {
+ if (newText.indexOf('#') >= 0)
+ return false;
+ else
+ return true;
+ }
+
+ // ---------------------------
+ // ISystemValidator methods...
+ // ---------------------------
+
+ /**
+ * Return the max length for filter pools: 50
+ */
+ public int getMaximumNameLength()
+ {
+ return MAX_FILTERPOOLNAME_LENGTH;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorFilterString.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorFilterString.java
new file mode 100644
index 00000000000..0f5528c5ec0
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorFilterString.java
@@ -0,0 +1,155 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.validators;
+import java.util.Vector;
+
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.filters.ISystemFilterString;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemMessages;
+
+
+
+/**
+ * This class is used in dialogs that prompt for filter strings.
+ * This class typically needs to be overridden for a particular subsystem factory provider.
+ * By default, it simply checks for uniqueness.
+ */
+public class ValidatorFilterString
+ extends ValidatorUniqueString implements ISystemMessages, ISystemValidator
+{
+ public static final int MAX_FILTERSTRINGNAME_LENGTH = 1000;
+
+ //public static final boolean CASE_SENSITIVE = true;
+ //public static final boolean CASE_INSENSITIVE = false;
+ protected SystemMessage msg_Invalid;
+
+ /**
+ * Constructor accepting a Vector for the list of existing strings, as simple strings.
+ * @param existingList A vector of strings to compare against.
+ * @param caseSensitive true if comparisons are to be case sensitive, false if case insensitive.
+ */
+ public ValidatorFilterString(Vector existingList, boolean caseSensitive)
+ {
+ super(existingList, caseSensitive); // case sensitive uniqueness
+ init();
+ }
+ /**
+ * Constructor accepting an Array for the list of existing strings, as simple strings.
+ * @param existingList An array containing list of existing strings to compare against.
+ * @param caseSensitive true if comparisons are to be case sensitive, false if case insensitive.
+ */
+ public ValidatorFilterString(String[] existingList, boolean caseSensitive)
+ {
+ super(existingList, caseSensitive); // case sensitive uniqueness
+ init();
+ }
+ /**
+ * Constructor accepting an Array for the list of existing strings, as actual filter strings.
+ * @param existingList An array containing list of existing filter strings to compare against.
+ * @param caseSensitive true if comparisons are to be case sensitive, false if case insensitive.
+ */
+ public ValidatorFilterString(ISystemFilterString[] existingList, boolean caseSensitive)
+ {
+ super(convertFilterStringsToStrings(existingList), caseSensitive); // case sensitive uniqueness
+ init();
+ }
+
+ /**
+ * Use this constructor when the name need not be unique, and you just want
+ * the syntax checking.
+ */
+ public ValidatorFilterString(boolean caseSensitive)
+ {
+ super(new String[0], caseSensitive);
+ init();
+ }
+
+ /**
+ * Set the error message to issue when a duplicate filter string is found.
+ */
+ public void setDuplicateFilterStringErrorMessage(SystemMessage msg)
+ {
+ super.setErrorMessages(null, msg_NonUnique);
+ }
+
+ /**
+ * Converts an array of filter strings into an array of strings
+ */
+ protected static String[] convertFilterStringsToStrings(ISystemFilterString[] filterStrings)
+ {
+ if (filterStrings == null)
+ return new String[0];
+ String[] strings = new String[filterStrings.length];
+ for (int idx=0; idx
+ * The IInputValidator interface is used by jface's
+ * InputDialog class and numerous other platform and system classes.
+ */
+public class ValidatorProfileName
+ extends ValidatorFolderName implements ISystemMessages, ISystemValidator
+{
+ public static final int MAX_PROFILENAME_LENGTH = 100; // arbitrary restriction! Defect 41816
+ private SystemMessage reservedNameMsg;
+
+ /**
+ * Constructor. The list of existing names can be null if this is not a rename operation.
+ */
+ public ValidatorProfileName(Vector existingNameList)
+ {
+ super(existingNameList);
+ super.setErrorMessages(SystemPlugin.getPluginMessage(MSG_VALIDATE_PROFILENAME_EMPTY),
+ SystemPlugin.getPluginMessage(MSG_VALIDATE_PROFILENAME_NOTUNIQUE),
+ SystemPlugin.getPluginMessage(MSG_VALIDATE_PROFILENAME_NOTVALID));
+ }
+
+ /**
+ * Return the max length for profiles: 100
+ */
+ public int getMaximumNameLength()
+ {
+ return MAX_PROFILENAME_LENGTH;
+ }
+
+ /**
+ * Return the msg for reserved names
+ */
+ private SystemMessage getReservedNameMessage()
+ {
+ if (reservedNameMsg == null)
+ reservedNameMsg = SystemPlugin.getPluginMessage(MSG_VALIDATE_PROFILENAME_RESERVED);
+ return reservedNameMsg;
+ }
+
+ // ---------------------------
+ // Parent Overrides...
+ // ---------------------------
+ /**
+ * Parent intercept to ensure no reserved names are used.
+ */
+ public SystemMessage isSyntaxOk(String newText)
+ {
+ super.isSyntaxOk(newText);
+ if (currentMessage == null)
+ {
+ if (newText.equalsIgnoreCase("private")) {
+ currentMessage = getReservedNameMessage();
+ }
+ else if (newText.indexOf('.') != -1) {
+ currentMessage = msg_Invalid;
+ }
+
+ }
+ return currentMessage;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorRemoteSelection.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorRemoteSelection.java
new file mode 100644
index 00000000000..e73a5c71cc8
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorRemoteSelection.java
@@ -0,0 +1,39 @@
+/********************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.validators;
+import org.eclipse.rse.model.IHost;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
+
+/**
+ * On remote selection dialogs, you can pass an instance of this class to validate that
+ * it is ok to enable the OK button when the user selects a remote object. If you return
+ * a SystemMessage, ok will be disabled and the message will be shown on the message line.
+ * Return a SystemMessage with blank in the first level text to disable OK without showing
+ * an error message.
+ *
+ * This class must be subclassed.Alternatively you can just implement {@link IValidatorRemoteSelection}
+ */
+public abstract class ValidatorRemoteSelection implements IValidatorRemoteSelection
+{
+
+ /**
+ * The user has selected a remote object. Return null if OK is to be enabled, or a SystemMessage
+ * if it is not to be enabled. The message will be displayed on the message line.
+ */
+ public abstract SystemMessage isValid(IHost selectedConnection, Object[] selectedObjects, ISystemRemoteElementAdapter[] remoteAdaptersForSelectedObjects);
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorServerPortInput.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorServerPortInput.java
new file mode 100644
index 00000000000..018c0ea7e74
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorServerPortInput.java
@@ -0,0 +1,65 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+
+package org.eclipse.rse.ui.validators;
+
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.ui.ISystemMessages;
+
+
+
+public class ValidatorServerPortInput extends ValidatorPortInput
+{
+ /**
+ * @see org.eclipse.jface.viewers.ICellEditorValidator#isValid(java.lang.Object)
+ */
+ public String isValid(Object input)
+ {
+
+ String msg = super.isValid(input);
+ if (msg == null)
+ {
+ // check that it's not a used port
+ if (number == 4035)
+ {
+ currentMessage = SystemPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PORT_WARNING);
+ currentMessage.makeSubstitution("4035", "RSE daemon");
+ msg = currentMessage.getLevelOneText();
+ }
+ }
+ return msg;
+ }
+
+ public String isValid(String input)
+ {
+ // yantzi:2.1.2 need to override this method in addition to the same
+ // one that takes Object parametere otherwise we get the wrong error messages!
+ String msg = super.isValid(input);
+ if (msg == null)
+ {
+ // check that it's not a used port
+ if (number == 4035)
+ {
+ currentMessage = SystemPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PORT_WARNING);
+ currentMessage.makeSubstitution("4035", "RSE daemon");
+ msg = currentMessage.getLevelOneText();
+ }
+ }
+ return msg;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorSourceType.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorSourceType.java
new file mode 100644
index 00000000000..429952f8e17
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorSourceType.java
@@ -0,0 +1,110 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.validators;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemMessages;
+
+
+/**
+ * This class is used to verify a user-entered source type. This is typically
+ * subsystem-dependent, such as "*.cpp" for a universal file subsystem.
+ * However, this class is defined to be easily subclassed.
+ */
+public class ValidatorSourceType extends ValidatorUniqueString
+ implements ISystemMessages, ISystemValidator
+{
+ public static final int MAX_SRCTYPE_LENGTH = 50; // max name for a src type
+
+ protected SystemMessage msg_Invalid;
+
+ /**
+ * Constructor. You must specify if src types are case-sensitive or not.
+ * Typically, you will also call setExistingNames to set the list of existing src types
+ * for uniqueness-validation.
+ */
+ public ValidatorSourceType(boolean caseSensitive)
+ {
+ super(new String[0], caseSensitive);
+ init();
+ }
+
+ private void init()
+ {
+ super.setErrorMessages(SystemPlugin.getPluginMessage(MSG_VALIDATE_SRCTYPE_EMPTY),
+ SystemPlugin.getPluginMessage(MSG_VALIDATE_SRCTYPE_NOTUNIQUE));
+ msg_Invalid = SystemPlugin.getPluginMessage(MSG_VALIDATE_SRCTYPE_NOTVALID);
+ }
+
+ /**
+ * Supply your own error message text. By default, messages from SystemPlugin resource bundle are used.
+ * @param error message when entry field is empty
+ * @param error message when value entered is not unique
+ * @param error message when syntax is not valid
+ */
+ public void setErrorMessages(SystemMessage msg_Empty, SystemMessage msg_NonUnique, SystemMessage msg_Invalid)
+ {
+ super.setErrorMessages(msg_Empty, msg_NonUnique);
+ this.msg_Invalid = msg_Invalid;
+ }
+
+ /**
+ * Overridable method for invalidate character check, beyond what this class offers
+ * @return true if valid, false if not
+ */
+ protected boolean checkForBadCharacters(String newText)
+ {
+ return true;
+ }
+
+ public String toString()
+ {
+ return "ValidatorSourceType class";
+ }
+
+ // ---------------------------
+ // Parent Overrides...
+ // ---------------------------
+ /**
+ * Validate each character.
+ * Override of parent method.
+ * Override yourself to refine the error checking.
+ */
+ public SystemMessage isSyntaxOk(String newText)
+ {
+ if (newText.length() > getMaximumNameLength())
+ currentMessage = msg_Invalid;
+ else
+ currentMessage = checkForBadCharacters(newText) ? null: msg_Invalid;
+ return currentMessage;
+ }
+
+
+ // ---------------------------
+ // ISystemValidator methods...
+ // ---------------------------
+
+ /**
+ * Return the max length for folder names: 50
+ */
+ public int getMaximumNameLength()
+ {
+ return MAX_SRCTYPE_LENGTH;
+ }
+
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorSpecialChar.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorSpecialChar.java
new file mode 100644
index 00000000000..acccf2cff5b
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorSpecialChar.java
@@ -0,0 +1,206 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.validators;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemMessages;
+
+
+/**
+ * This class is used in dialogs that prompt for string, where the
+ * string is not allowed to content special characters, as supplied to this class.
+ *
+ * The IInputValidator interface is used by jface's
+ * InputDialog class and numerous other platform and system classes.
+ */
+public class ValidatorSpecialChar
+ implements ISystemMessages, ISystemValidator // IInputValidator, ICellEditorValidator
+{
+
+ public static final boolean EMPTY_ALLOWED_NO = false;
+ public static final boolean EMPTY_ALLOWED_YES= true;
+ private boolean isEmptyAllowed = true;
+ protected StringBuffer specialChars;
+ protected SystemMessage msg_Invalid;
+ protected SystemMessage msg_Empty;
+ protected SystemMessage currentMessage;
+ private int nbrSpecialChars;
+
+ /**
+ * Constructor
+ * @param specialChars String containing special characters to test for.
+ * @param isEmptyAllowed true if an empty string is valid
+ */
+ public ValidatorSpecialChar(String specialChars, boolean isEmptyAllowed)
+ {
+ this(specialChars, isEmptyAllowed, SystemPlugin.getPluginMessage(MSG_VALIDATE_ENTRY_NOTVALID), SystemPlugin.getPluginMessage(MSG_VALIDATE_ENTRY_EMPTY));
+ }
+ /**
+ * Constructor
+ * @param specialChars String containing special characters to test for.
+ * @param isEmptyAllowed true if an empty string is valid
+ * @param error message when invalid characters entered
+ */
+ public ValidatorSpecialChar(String specialChars, boolean isEmptyAllowed, SystemMessage msg_Invalid)
+ {
+ this(specialChars, isEmptyAllowed, msg_Invalid, SystemPlugin.getPluginMessage(MSG_VALIDATE_ENTRY_EMPTY));
+ }
+ /**
+ * Constructor
+ * @param specialChars String containing special characters to test for.
+ * @param isEmptyAllowed true if an empty string is valid
+ * @param error message when invalid characters entered
+ * @param error message when empty string
+ */
+ public ValidatorSpecialChar(String specialChars, boolean isEmptyAllowed, SystemMessage msg_Invalid, SystemMessage msg_Empty)
+ {
+ this.isEmptyAllowed = isEmptyAllowed;
+ this.specialChars = new StringBuffer(specialChars);
+ this.nbrSpecialChars = specialChars.length();
+ setErrorMessages(msg_Empty, msg_Invalid);
+ }
+ /**
+ * Supply your own error message text. By default, messages from SystemPlugin resource bundle are used.
+ * @param error message when entry field is empty or null if to keep the default
+ * @param error message when value entered is not valid, or null if to keep the default
+ */
+ public void setErrorMessages(SystemMessage msg_Empty, SystemMessage msg_Invalid)
+ {
+ if (msg_Empty != null)
+ this.msg_Empty = msg_Empty;
+ if (msg_Invalid != null)
+ this.msg_Invalid = msg_Invalid;
+ }
+
+ // --------------------------
+ // Internal helper methods...
+ // --------------------------
+
+ /**
+ * Helper method to substitute data into a message
+ */
+ protected String doMessageSubstitution(SystemMessage msg, String substitution)
+ {
+ currentMessage = msg;
+ if (msg.getNumSubstitutionVariables() > 0)
+ return msg.makeSubstitution(substitution).getLevelOneText();
+ else
+ return msg.getLevelOneText();
+ }
+
+ /**
+ * Helper method to set the current system message and return its level one text
+ */
+ protected String getSystemMessageText(SystemMessage msg)
+ {
+ currentMessage = msg;
+ if (msg != null)
+ return msg.getLevelOneText();
+ else
+ return null;
+ }
+
+ // ---------------------------
+ // ISystemValidator methods...
+ // ---------------------------
+
+ /**
+ * Validate each character.
+ */
+ public String isValid(String newText)
+ {
+ currentMessage = null;
+ if ((newText==null) || (newText.length() == 0))
+ {
+ if (isEmptyAllowed)
+ return null;
+ else
+ currentMessage = msg_Empty;
+ }
+ else if (containsSpecialCharacters(newText))
+ currentMessage = msg_Invalid;
+ else
+ currentMessage = isSyntaxOk(newText);
+ return (currentMessage == null) ? null : doMessageSubstitution(currentMessage, newText);
+ }
+
+ /**
+ * As required by ICellEditor
+ */
+ public String isValid(Object newValue)
+ {
+ if (newValue instanceof String)
+ return isValid((String)newValue);
+ else
+ return null;
+ }
+
+
+ protected boolean containsSpecialCharacters(String newText)
+ {
+ boolean contains = false;
+ int newLen = newText.length();
+ for (int idx=0; !contains && (idx
+ * To put your action into the given menu, use the menu's {@link org.eclipse.rse.ui.SystemMenuManager#add(String,IAction) add} method.
+ * If you don't care where it goes within the popup, just pass the given menuGroup location id,
+ * otherwise pass one of the GROUP_XXX values from {@link ISystemContextMenuConstants}. If you pass one that
+ * identifies a pre-defined cascading menu, such as GROUP_OPENWITH, your action will magically appear in that
+ * cascading menu, even if it was otherwise empty.
+ *
+ * For the actions themselves, you will probably use one of the base action classes:
+ *
+ * Called by common rename and delete actions, and used to populate property sheet.
+ * @see #getText(Object)
+ * @see #getAbsoluteName(Object)
+ */
+ public String getName(Object element)
+ {
+ return getText(element);
+ }
+ /**
+ * Abstract. Must be overridden.
+ * Override if want to include more properties in the property sheet, If you override this for readonly properties, you must also override: If you override this for editable properties, you must also override:
+ * If internalGetPropertyDescriptors() returns non-null, then returns that,
+ * else computes the difference.
+ *
+ * This is called by the table views like {@link org.eclipse.rse.ui.view.SystemTableView}.
+ */
+ public IPropertyDescriptor[] getUniquePropertyDescriptors()
+ {
+ //optimization by phil in 5.1.2:
+ IPropertyDescriptor[] internalDescriptors = internalGetPropertyDescriptors();
+ if (internalDescriptors != null)
+ return internalDescriptors;
+
+ IPropertyDescriptor[] allDescriptors = getPropertyDescriptors();
+ IPropertyDescriptor[] commonDescriptors = getDefaultDescriptors();
+
+ int totalSize = allDescriptors.length;
+ int commonSize = commonDescriptors.length;
+ int uniqueSize = totalSize - commonSize;
+
+ int uniqueIndex = 0;
+
+ IPropertyDescriptor[] uniqueDescriptors = new IPropertyDescriptor[uniqueSize];
+ for (int i = 0; i < totalSize; i++)
+ {
+ IPropertyDescriptor descriptor = allDescriptors[i];
+
+ boolean isUnique = true;
+ for (int j = 0; j < commonSize; j++)
+ {
+ IPropertyDescriptor commonDescriptor = commonDescriptors[j];
+ if (descriptor == commonDescriptor)
+ {
+ isUnique = false;
+ }
+ }
+
+ if (isUnique && uniqueSize > uniqueIndex)
+ {
+ uniqueDescriptors[uniqueIndex] = descriptor;
+ uniqueIndex++;
+ }
+ }
+
+ return uniqueDescriptors;
+ }
+
+ /**
+ * Overridable by subclasses, but usually is not.
+ * This is called by the table views in order to get values that can be sorted when the
+ * user clicks on the column heading. To support this for a numeric property say, return
+ * a Long/Integer object if false, versus returning string.
+ *
+ * @param property the name or key of the property as named by its property descriptor
+ * @param formatted indication of whether to return the value in formatted or raw form
+ * @return the current value of the given property
+ */
+ public Object getPropertyValue(Object key, boolean formatted)
+ {
+ return getPropertyValue(key);
+ }
+
+ /**
+ * Implemented. Do not override typically. See {@link #internalGetPropertyValue(Object)}. By default, returns true.
+ * @see #canDelete(Object)
+ * @see #doDelete(Shell,Object)
+ */
+ public boolean showDelete(Object element)
+ {
+ return true;
+ }
+ /**
+ * Overridable by subclasses, and usually is.
+ * By default, returns false. Override if your object is deletable.
+ * @see #showDelete(Object)
+ * @see #doDelete(Shell,Object)
+ */
+ public boolean canDelete(Object element)
+ {
+ return false;
+ }
+
+ /**
+ * Overridable by subclasses, and usually is. By default, returns true.
+ * @return true if we should show the rename action in the popup for the given element.
+ * @see #canRename(Object)
+ * @see #doRename(Shell,Object,String)
+ */
+ public boolean showRename(Object element)
+ {
+ return true;
+ }
+ /**
+ * Overridable by subclasses, and usually is.
+ * Used in the common rename dialogs, and only if you return true to {@link #canRename(Object)}.
+ *
+ * Suggest you use at least UniqueStringValidator or a subclass to ensure
+ * new name is at least unique.
+ * @see #canRename(Object)
+ */
+ public ISystemValidator getNameValidator(Object element)
+ {
+ return null;
+ }
+
+ /**
+ * Overridable by subclasses, and usually is iff canRename is.
+ * For example, two connections or filter pools can have the same name if they are
+ * in different profiles. Two iSeries QSYS objects can have the same name if their object types
+ * are different.
+ *
+ * Used in the common rename dialogs, and only if you return true to {@link #canRename(Object)}.
+ *
+ * This method returns a name that can be used for uniqueness checking because it is qualified
+ * sufficiently to make it unique.
+ *
+ * By default, this simply returns the given name. It is overridden by child classes when appropriate.
+ * @see #canRename(Object)
+ */
+ public String getCanonicalNewName(Object element, String newName)
+ {
+ // this is all for defect 42145. Phil
+ return newName;
+ }
+ /**
+ * Overridable by subclasses, but usually is not.
+ * Used in the common rename dialogs, and only if you return true to {@link #canRename(Object)}.
+ *
+ * By default does an equalsIgnoreCase comparison
+ * @see #canRename(Object)
+ */
+ public boolean namesAreEqual(Object element, String newName)
+ {
+ return getName(element).equalsIgnoreCase(newName);
+ }
+
+ // ------------------------------------------
+ // METHODS TO SUPPORT COMMON REFRESH ACTION...
+ // ------------------------------------------
+ /**
+ * Overridable by subclasses, and usually is.
+ * Default is true.
+ */
+ public boolean showRefresh(Object element)
+ {
+ return true;
+ }
+
+ // ------------------------------------------------------------
+ // METHODS TO SUPPORT COMMON OPEN-IN-NEW-PERSPECTIVE ACTIONS...
+ // ------------------------------------------------------------
+ /**
+ * Overridable by subclasses, and usually is NOT.
+ * Only applicable for non-remote resources. Remote always show Go To only.
+ */
+ public boolean showOpenViewActions(Object element)
+ {
+ return true;
+ }
+
+ /**
+ * Overridable by subclasses, and usually is NOT.
+ * Default is false unless element implements ISystemPromptable object. Override as appropriate.
+ */
+ public boolean isPromptable(Object element)
+ {
+ return (element instanceof ISystemPromptableObject);
+ }
+ /**
+ * Overridable by subclasses, but usually is not.
+ * If desired, override, and call super(), to support additional filter criteria for <filter>, <enablement> and <visibility>.
+ *
+ * @see org.eclipse.ui.IActionFilter#testAttribute(Object, String, String)
+ */
+ public boolean testAttribute(Object target, String name, String value)
+ {
+ //System.out.println("Inside testAttribute: name = " + name + ", value = " + value);
+ if (name.equalsIgnoreCase("name"))
+ {
+ if (value.endsWith("*"))
+ {
+ // we have a wild card test, and * is the last character in the value
+ if (getName(target).startsWith(value.substring(0, value.length() - 1)))
+ return true;
+ }
+ else
+ return value.equals(getName(target));
+ }
+ else if (name.equalsIgnoreCase("type"))
+ return value.equals(getType(target));
+ else if (name.equalsIgnoreCase("hasChildren"))
+ {
+ return hasChildren(target) ? value.equals("true") : value.equals("false");
+ }
+ else if (name.equalsIgnoreCase("connected"))
+ {
+ ISubSystem ss = getSubSystem(target);
+ if (ss != null)
+ return ss.isConnected() ? value.equals("true") : value.equals("false");
+ else
+ return false;
+ }
+ else if (name.equalsIgnoreCase("offline"))
+ {
+ ISubSystem ss = getSubSystem(target);
+ if (ss != null)
+ return ss.isOffline() ? value.equals("true") : value.equals("false");
+ else
+ return false;
+ }
+ else if (name.equalsIgnoreCase("systemType"))
+ {
+ ISubSystem ss = getSubSystem(target);
+ String[] values = tokenize(value);
+ if (ss == null)
+ {
+ if (!(target instanceof IHost))
+ return false;
+ String connSysType = ((IHost)target).getSystemType();
+ for (int idx=0; idx
+ * Returns null. Override if you want to supply a sub-sub-type for filtering in the popupMenus extension point.
+ */
+ public String getRemoteSubSubType(Object element)
+ {
+ return null; // Extremely fine grained. We don't use it.
+ }
+
+ /**
+ * Overridable by subclasses, but usually is not.
+ * Returns null. Override if the remote resource is compilable.
+ */
+ public String getRemoteSourceType(Object element)
+ {
+ return null;
+ }
+ /**
+ * Overridable by subclasses, and must be for editable objects. Just a convenient shortcut to {@link org.eclipse.rse.core.SystemAdapterHelpers#getAdapter(Object, Viewer)}
+ */
+ protected ISystemViewElementAdapter getAdapter(Object o)
+ {
+ return SystemAdapterHelpers.getAdapter(o, getViewer());
+ /*
+ ISystemViewElementAdapter adapter = null;
+ if (!(o instanceof IAdaptable))
+ adapter = (ISystemViewElementAdapter)Platform.getAdapterManager().getAdapter(o,ISystemViewElementAdapter.class);
+ else
+ adapter = (ISystemViewElementAdapter)((IAdaptable)o).getAdapter(ISystemViewElementAdapter.class);
+ if (adapter == null)
+ SystemPlugin.logDebugMessage(this.getClass().getName(), "ADAPTER IS NULL FOR ELEMENT : " + o);
+ else
+ {
+ adapter.setViewer(getViewer()); // added this in V5.0, just in case. Phil
+ }
+ return adapter;
+ */
+ }
+ /**
+ * Callable by subclasses. Just a convenient shortcut to {@link org.eclipse.rse.core.SystemAdapterHelpers#getRemoteAdapter(Object, Viewer)}
+ */
+ protected ISystemRemoteElementAdapter getRemoteAdapter(Object o)
+ {
+ // hmmm, any reason why we shouldn't do the following 2 lines of code for performance reasons?
+ //if (this instanceof ISystemRemoteElementAdapter)
+ // return (ISystemRemoteElementAdapter)this;
+ return SystemAdapterHelpers.getRemoteAdapter(o, getViewer());
+ /*
+ if (!(o instanceof IAdaptable))
+ adapter = (ISystemRemoteElementAdapter)Platform.getAdapterManager().getAdapter(o,ISystemRemoteElementAdapter.class);
+ adapter = (ISystemRemoteElementAdapter)((IAdaptable)o).getAdapter(ISystemRemoteElementAdapter.class);
+ if ((adapter != null) && (adapter instanceof ISystemViewElementAdapter))
+ {
+ ((ISystemViewElementAdapter)adapter).setViewer(getViewer()); // added this in V5.0, just in case. Phil
+ }
+ return adapter;
+ */
+ }
+
+ /**
+ * Callable by subclasses.
+ * This interface is designed to allow remote property pages to be registered
+ * against specific remote system objects of specific name, type or subtype.
+ */
+public interface ISystemRemoteElementAdapter extends IRemoteObjectIdentifier
+{
+ /**
+ * Return the name of this object, which may be different than the display text ({#link #getText(Object)}.
+ */
+ public String getName(Object element);
+ /**
+ * Return the fully qualified name of this remote object.
+ * Unlike getName, this should include the full path to the name.
+ * This should be enough information to uniquely identify this object within its subsystem.
+ */
+ public String getAbsoluteName(Object element);
+ /**
+ * Return fully qualified name that uniquely identifies this remote object's remote parent within its subsystem.
+ * This is used when deleting a remote resource for example, all occurrences of its parent are found and refreshed in the RSE views.
+ */
+ public String getAbsoluteParentName(Object element);
+ /**
+ * Return the subsystem that is responsible for getting this remote object.
+ * When used together with getAbsoluteName, allows for unique identification of this object.
+ */
+ public ISubSystem getSubSystem(Object element);
+ /**
+ * Return the subsystem factory id that owns this remote object
+ * The value must not be translated, so that property pages registered via xml can subset by it.
+ */
+ public String getSubSystemFactoryId(Object element);
+ /**
+ * Return a value for the type category property for this object
+ * The value must not be translated, so that property pages registered via xml can subset by it.
+ */
+ public String getRemoteTypeCategory(Object element);
+ /**
+ * Return a value for the type property for this object
+ * The value must not be translated, so that property pages registered via xml can subset by it.
+ */
+ public String getRemoteType(Object element);
+ /**
+ * Return a value for the subtype property for this object.
+ * Not all object types support a subtype, so returning null is ok.
+ * The value must not be translated, so that property pages registered via xml can subset by it.
+ */
+ public String getRemoteSubType(Object element);
+ /**
+ * Return a value for the sub-subtype property for this object.
+ * Not all object types support a sub-subtype, so returning null is ok.
+ * The value must not be translated, so that property pages registered via xml can subset by it.
+ */
+ public String getRemoteSubSubType(Object element);
+ /**
+ * Return the source type of the selected object. Typically, this only makes sense for compilable
+ * source members. For non-compilable remote objects, this typically just returns null.
+ */
+ public String getRemoteSourceType(Object element);
+ /**
+ * Short answer: treat this like clone(), and just copy any important instance variables
+ * Imagine the same remote resource is shown multiple times in the same tree view.... say
+ * because multiple filters resolve to it, or there are two connections to the same host.
+ * Typically it is a different object in memory within the tree, but it refers to the same
+ * remote resource.
+ * Some view has updated the name or properties of this remote object. As a result, the
+ * remote object's contents need to be refreshed. You are given the old remote object that has
+ * old data, and you are given the new remote object that has the new data. For example, on a
+ * rename the old object still has the old name attribute while the new object has the new
+ * new attribute. You can copy the new name into the old object. Similar for any properties
+ * you allow the user to edit via the property sheet.
+ *
+ * This is called by viewers like SystemView in response to rename and property change events.
+ *
+ * @param oldElement the element that was found in the tree
+ * @param newElement the updated element that was passed in the REFRESH_REMOTE event
+ * @return true if you want the viewer that called this to refresh the children of this object,
+ * such as is needed on a rename of a folder, say, if the child object cache the parent folder name
+ * or an absolute file name.
+ */
+ public boolean refreshRemoteObject(Object oldElement, Object newElement);
+
+
+ /**
+ * Return the remote edit wrapper for this object.
+ * @param object the object to edit
+ * @return the editor wrapper for this object
+ */
+ public ISystemEditableRemoteObject getEditableRemoteObject(Object object);
+
+ /**
+ * Indicates whether the specified object can be edited or not.
+ * @param object the object to edit
+ * @return true if the object can be edited.
+ */
+ public boolean canEdit(Object object);
+
+ /**
+ * Return a filter string that corresponds to this object.
+ * @param object the object to obtain a filter string for
+ * @return the corresponding filter string if applicable
+ */
+ public String getFilterStringFor(Object object);
+
+ /**
+ * Given a remote object, returns it remote parent object. Eg, given a file, return the folder
+ * it is contained in.
+ */
+ public Object getRemoteParent(Shell shell, Object element) throws Exception;
+ /**
+ * Given a remote object, return the unqualified names of the objects contained in that parent. This is
+ * used for testing for uniqueness on a rename operation, for example. Sometimes, it is not
+ * enough to just enumerate all the objects in the parent for this purpose, because duplicate
+ * names are allowed if the types are different, such as on iSeries. In this case return only
+ * the names which should be used to do name-uniqueness validation on a rename operation.
+ */
+ public String[] getRemoteParentNamesInUse(Shell shell, Object element) throws Exception;
+
+ /**
+ * Returns whether user defined actions should be shown for the object.
+ * @param object the object.
+ * @return
+ * Ultimately, these are methods that AbstractTreeViewer itself should have!
+ */
+public interface ISystemTree
+{
+
+
+ /**
+ * This is called to ensure all elements in a multiple-selection have the same parent in the
+ * tree viewer. If they don't we automatically disable all actions.
+ *
+ * Designed to be as fast as possible by going directly to the SWT widgets
+ */
+ public boolean sameParent();
+ /**
+ * Called to select an object within the tree, and optionally expand it
+ */
+ public void select(Object element, boolean expand);
+ /**
+ * Return the number of immediate children in the tree, for the given tree node
+ */
+ public int getChildCount(Object element);
+ /**
+ * This is called to accurately get the parent object for the current selection
+ * for this viewer.
+ *
+ * The getParent() method in the adapter is very unreliable... adapters can't be sure
+ * of the context which can change via filtering and view options.
+ */
+ public Object getSelectedParent();
+ /**
+ * This returns the element immediately before the first selected element in this tree level.
+ * Often needed for enablement decisions for move up actions.
+ */
+ public Object getPreviousElement();
+ /**
+ * This returns the element immediately after the last selected element in this tree level
+ * Often needed for enablement decisions for move down actions.
+ */
+ public Object getNextElement();
+ /**
+ * This is called to walk the tree back up to the roots and return the visible root
+ * node for the first selected object.
+ */
+ public Object getRootParent();
+ /**
+ * This returns an array containing each element in the tree, up to but not including the root.
+ * The array is in reverse order, starting at the leaf and going up.
+ */
+ public Object[] getElementNodes(Object element);
+ /**
+ * Helper method to determine if a given object is currently selected.
+ * Does consider if a child node of the given object is currently selected.
+ */
+ public boolean isSelectedOrChildSelected(Object parentElement);
+ /**
+ * Called when a property is updated and we need to inform the Property Sheet viewer.
+ * There is no formal mechanism for this so we simulate a selection changed event as
+ * this is the only event the property sheet listens for.
+ */
+ public void updatePropertySheet();
+ /**
+ * Returns the tree item of the first selected object. Used for setViewerItem in a resource
+ * change event.
+ */
+ public Item getViewerItem();
+
+ /**
+ * Returns true if any of the selected items are currently expanded
+ */
+ public boolean areAnySelectedItemsExpanded();
+ /**
+ * Returns true if any of the selected items are expandable but not yet expanded
+ */
+ public boolean areAnySelectedItemsExpandable();
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewActionFilter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewActionFilter.java
new file mode 100644
index 00000000000..aa5570fff25
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewActionFilter.java
@@ -0,0 +1,52 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+
+import org.eclipse.ui.IActionFilter;
+
+/**
+ * This interface is implemented by the adapters for every object shown in the
+ * Remote System Explorer. It enables complex filtering of action and popup menu
+ * extensions via the <filter> element, and action extensions
+ * via the <visibility> and <enablement>
+ * elements.
+ *
+ * The base adapter class used for all RSE objects supports the following properties
+ * by default:
+ *
+ * This interface supports a union of all the methods needed to support a TreeViewer
+ * content provider and label provider. The {@link org.eclipse.rse.ui.view.SystemViewLabelAndContentProvider}
+ * delegates to objects of this interface almost completely. It gets such an
+ * object by calling:
+ * This interface also supports IPropertySource via inheritance, so we can feed the
+ * PropertySheet.
+ * For remote resource objects, their adapter should also implement
+ * {@link org.eclipse.rse.ui.view.ISystemRemoteElementAdapter}
+ *
+ * To put your action into the given menu, use the menu's {@link org.eclipse.rse.ui.SystemMenuManager#add(String,IAction) add} method.
+ * If you don't care where it goes within the popup, just pass the given menuGroup location id,
+ * otherwise pass one of the GROUP_XXX values from {@link ISystemContextMenuConstants}. If you pass one that
+ * identifies a pre-defined cascading menu, such as GROUP_OPENWITH, your action will magically appear in that
+ * cascading menu, even if it was otherwise empty.
+ *
+ * For the actions themselves, you will probably use one of the base action classes:
+ *
+ * For example, two connections or filter pools can have the same name if they are
+ * in different profiles. Two iSeries QSYS objects can have the same name if their object types
+ * are different.
+ *
+ * This method returns a name that can be used for uniqueness checking because it is qualified
+ * sufficiently to make it unique.
+ */
+ public String getCanonicalNewName(Object element, String newName);
+ /**
+ * Compare the name of the given element to the given new name to decide if they are equal.
+ * Allows adapters to consider case and quotes as appropriate.
+ */
+ public boolean namesAreEqual(Object element, String newName);
+ // ------------------------------------------
+ // METHODS TO SUPPORT COMMON REFRESH ACTION...
+ // ------------------------------------------
+ /**
+ * Return true if we should show the refresh action in the popup for the given element.
+ */
+ public boolean showRefresh(Object element);
+
+ // ------------------------------------------------------------
+ // METHODS TO SUPPORT COMMON OPEN-IN-NEW-PERSPECTIVE ACTIONS...
+ // ------------------------------------------------------------
+ /**
+ * Return true if we should show the refresh action in the popup for the given element.
+ */
+ public boolean showOpenViewActions(Object element);
+
+ /**
+ * Return true if we should show the generic show in table action in the popup for the given element.
+ */
+ public boolean showGenericShowInTableAction(Object element);
+
+ // ------------------------------------------------------------
+ // METHODS FOR SAVING AND RESTORING EXPANSION STATE OF VIEWER...
+ // ------------------------------------------------------------
+ /**
+ * Return what to save to disk to identify this element in the persisted list of expanded elements.
+ * This just defaults to getName, but if that is not sufficient override it here.
+ */
+ public String getMementoHandle(Object element);
+ /**
+ * Return what to save to disk to identify this element when it is the input object to a secondary
+ * Remote Systems Explorer perspective.
+ */
+ public String getInputMementoHandle(Object element);
+ /**
+ * Return a short string to uniquely identify the type of resource. Eg "conn" for connection.
+ * This just defaults to getType, but if that is not sufficient override it here, since that is
+ * a translated string.
+ */
+ public String getMementoHandleKey(Object element);
+ /**
+ * Somtimes we don't want to remember an element's expansion state, such as for temporarily inserted
+ * messages. In these cases return false from this method. The default is true
+ */
+ public boolean saveExpansionState(Object element);
+ public void selectionChanged(Object element); // d40615
+
+ public void setFilterString(String filterString);
+ public String getFilterString();
+
+ /**
+ * Return whether deferred queries are supported. By default
+ * they are not supported. Subclasses must override this to
+ * return true if they are to support this.
+ * @return
+ * No need to override.
+ *
+ * @param menu The menu to contribute actions to
+ * @param selection The window's current selection.
+ * @param shell of viewer calling this. Most dialogs require a shell.
+ * @param menuGroup recommended menu group to add actions to. If added to another group, you must be sure to create that group first.
+ * @param subsystem the subsystem of the selection
+ */
+ public void addCommonRemoteActions(ISubSystemConfiguration factory, SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup, ISubSystem subsystem)
+ {
+ /** FIXME - UDAs should not be coupled to factory adapter
+ SystemCompileManager mgr = factory.getCompileManager();
+
+ if (factory.supportsCompileActions() && (mgr != null))
+ {
+ int size = selection.size();
+
+ // for single selections, we try to avoid iterator, to hopefully make it a bit faster
+ if (size == 1)
+ {
+ if (mgr.isCompilable(selection.getFirstElement()))
+ { // check that selection is compilable
+ mgr.addCompileActions(shell, selection, menu, menuGroup);
+ }
+ }
+ else if (size > 1)
+ {
+ Iterator iter = selection.iterator();
+
+ boolean allCompilable = true;
+
+ // check that all selections are compilable
+ while (iter.hasNext())
+ {
+ Object element = iter.next();
+ allCompilable = mgr.isCompilable(element);
+
+ if (!allCompilable)
+ {
+ break;
+ }
+ }
+
+ if (allCompilable)
+ {
+ mgr.addCompileActions(shell, selection, menu, menuGroup);
+ }
+ }
+ }
+
+ if (factory.supportsUserDefinedActions() && factory.supportsUserDefinedActions(selection))
+ {
+ addUserDefinedActions(factory, shell, selection, menu, menuGroup, getActionSubSystem(factory, subsystem));
+ }
+ **/
+ }
+
+ // -----------------------------------
+ // WIZARD PAGE CONTRIBUTION METHODS... (UCD defect 43194)
+ // -----------------------------------
+ /**
+ * Optionally return one or more wizard pages to append to the New Wizard connection if
+ * the user selects a system type that this subsystem factory supports.
+ *
+ * Some details:
+ *
+// * Called in the Work With User Actions and the User Actions cascading action.
+// *
+// * Do not override this, as the implementation is complete. However,
+// * you must override createActionSubSystem.
+// *
+// * @see #supportsUserDefinedActions()
+// * @see #createActionSubSystem()
+// */
+// public SystemUDActionSubsystem getActionSubSystem(ISubSystemFactory factory, ISubSystem subsystem)
+// {
+// if (udas == null)
+// udas = createActionSubSystem(factory);
+// if (udas != null)
+// {
+// udas.setSubsystem(subsystem);
+// udas.setSubSystemFactory(factory);
+// }
+// return udas;
+// }
+//
+// /**
+// * Overridable method to instantiate the SystemUDActionSubsystem.
+// * You must override this if you return true to supportsUserActions.
+// *
+// * @see #supportsUserDefinedActions()
+// * @see #getActionSubSystem(ISubSystem)
+// */
+// protected SystemUDActionSubsystem createActionSubSystem(ISubSystemFactory factory)
+// {
+// return null;
+// }
+//
+// /**
+// * Populate main context menu with a "User Actions->" submenu cascade,
+// * which will only be populated when the submenu is selected.
+// *
+// * This is called by the addCommonRemoteObjectsActions method, if this subsystem
+// * supports user defined actions.
+// */
+// public static void addUserDefinedActions(ISubSystemFactory factory, Shell shell, IStructuredSelection selection, SystemMenuManager menu, String menuGroup, SystemUDActionSubsystem userActionSubSystem)
+// {
+// SystemUDACascadeAction act = new SystemUDACascadeAction(userActionSubSystem, selection);
+// menu.add(menuGroup, act);
+// }
+
+
+ // ---------------------------------
+ // COMPILE ACTIONS METHODS...
+ // ---------------------------------
+
+ // ---------------------------------
+ // USER-PREFERENCE METHODS...
+ // ---------------------------------
+
+
+ // ---------------------------------
+ // PROXY METHODS. USED INTERNALLY...
+ // ---------------------------------
+
+
+ // ---------------------------------
+ // FACTORY ATTRIBUTE METHODS...
+ // ---------------------------------
+
+
+ /**
+ * Return image descriptor of this factory.
+ * This comes from the xml "icon" attribute of the extension point.
+ */
+ public ImageDescriptor getImage(ISubSystemConfiguration factory)
+ {
+ return factory.getImage();
+ }
+ /**
+ * Return actual graphics Image of this factory.
+ * This is the same as calling getImage().createImage() but the resulting
+ * image is cached.
+ */
+ public Image getGraphicsImage(ISubSystemConfiguration factory)
+ {
+ ImageDescriptor id = getImage(factory);
+ if (id != null)
+ {
+ Image image = null;
+ if (imageTable == null)
+ imageTable = new Hashtable();
+ else
+ image = (Image) imageTable.get(id);
+ if (image == null)
+ {
+ image = id.createImage();
+ imageTable.put(id, image);
+ }
+ return image;
+ }
+ return null;
+ }
+
+ /**
+ * Return image to use when this susystem is connection.
+ * This comes from the xml "iconlive" attribute of the extension point.
+ */
+ public ImageDescriptor getLiveImage(ISubSystemConfiguration factory)
+ {
+ return factory.getLiveImage();
+ }
+
+ /**
+ * Return actual graphics LiveImage of this factory.
+ * This is the same as calling getLiveImage().createImage() but the resulting
+ * image is cached.
+ */
+ public Image getGraphicsLiveImage(ISubSystemConfiguration factory)
+ {
+ ImageDescriptor id = getLiveImage(factory);
+ if (id != null)
+ {
+ Image image = null;
+ if (imageTable == null)
+ imageTable = new Hashtable();
+ else
+ image = (Image) imageTable.get(id);
+ if (image == null)
+ {
+ image = id.createImage();
+ imageTable.put(id, image);
+ }
+ return image;
+ }
+ return null;
+ }
+
+
+ // ---------------------------------
+ // PROFILE METHODS...
+ // ---------------------------------
+
+ // private methods...
+
+
+ // ---------------------------------
+ // SUBSYSTEM METHODS...
+ // ---------------------------------
+
+
+ /**
+ * Returns a list of actions for the popup menu when user right clicks on a subsystem object from this factory.
+ * By default returns a single item array with a SystemNewFilterPoolAction object and
+ * calls overridable method getAdditionalSubSystemActions.
+ *
+ * If you wish to support more actions, override getAdditionalSubSystemActions to return a Vector
+ * of IAction objects.
+ * @see #getSubSystemNewFilterPoolActions(ISubSystem, Shell)
+ * @see #getAdditionalSubSystemActions(ISubSystem, Shell)
+ * @param selectedSubSystem the currently selected subsystem
+ * @param shell The Shell of the view where this action was launched from
+ * @return array of IAction objects to contribute to the popup menu
+ */
+ public IAction[] getSubSystemActions(ISubSystemConfiguration factory, ISubSystem selectedSubSystem, Shell shell)
+ {
+ Vector ourChildActions = getAdditionalSubSystemActions(factory, selectedSubSystem, shell);
+ // we need to start with a fresh vector each time not build up on what our child
+ // class gives us, since that may be cached and hence will grow if we keep adding to i.
+ Vector childActions = new Vector();
+ if (ourChildActions != null)
+ for (int idx = 0; idx < ourChildActions.size(); idx++)
+ childActions.addElement(ourChildActions.elementAt(idx));
+ if (factory.supportsFilters())
+ {
+ boolean showFilterPools = factory.showFilterPools();
+ // if showing filter pools, we have to add a "new filter pool" action here...
+ if (showFilterPools)
+ {
+ IAction[] newFPActions = getSubSystemNewFilterPoolActions(factory, selectedSubSystem, shell);
+ if (newFPActions != null)
+ {
+ for (int idx = 0; idx < newFPActions.length; idx++)
+ {
+ // special case handling...
+ // set input subsystem for new filter pool actions...
+ if (newFPActions[idx] instanceof SystemFilterAbstractFilterPoolAction)
+ {
+ SystemFilterAbstractFilterPoolAction fpAction = (SystemFilterAbstractFilterPoolAction) newFPActions[idx];
+ fpAction.setFilterPoolManagerNamePreSelection(selectedSubSystem.getSystemProfile().getName());
+ fpAction.setFilterPoolManagerProvider(factory);
+ }
+ childActions.addElement(newFPActions[idx]);
+ } // end for loop
+ } // end if newFPActions != null
+ } // and if showFilterPools
+ // if showing filter pools, we have to add a "select filter pool and work-with filter pools" actions here...
+ if (showFilterPools)
+ {
+ childActions.addElement(new SystemFilterSelectFilterPoolsAction(shell));
+ childActions.addElement(new SystemFilterWorkWithFilterPoolsAction(shell));
+ } // end if showFilterPools
+ // if not showing filter pools, we have to add a "new filter" action here...
+ if (!showFilterPools)
+ {
+ IAction[] newFilterActions = getNewFilterPoolFilterActions(factory, null, shell);
+ if ((newFilterActions != null) && (newFilterActions.length > 0))
+ {
+ // pre-scan for legacy
+ for (int idx = 0; idx < newFilterActions.length; idx++)
+ {
+ if (newFilterActions[idx] instanceof SystemNewFilterAction)
+ ((SystemNewFilterAction) newFilterActions[idx]).setCallBackConfigurator(this, selectedSubSystem);
+ else
+ {
+ }
+ }
+ /*
+ if (anyLegacy)
+ {
+ SystemFilterPoolReferenceManager refMgr = selectedSubSystem.getSystemFilterPoolReferenceManager();
+ SystemFilterPool[] refdPools = refMgr.getReferencedSystemFilterPools();
+ if ( refdPools.length == 0 )
+ SystemPlugin.logInfo("SubSystemFactoryImpl::getSubSystemActions - getReferencedSystemFilterPools returned array of lenght zero.");
+ for (int idx=0; idx
+ * The processing we do here is to specify the filter pools to prompt the user for, in the
+ * second page of the New Filter wizards.
+ *
+ * This method is from the ISystemNewFilterActionConfigurator interface
+ */
+ public void configureNewFilterAction(ISubSystemConfiguration factory, SystemNewFilterAction newFilterAction, Object callerData)
+ {
+ //System.out.println("Inside configureNewFilterAction! It worked!");
+ newFilterAction.setFromRSE(true);
+ boolean showFilterPools = factory.showFilterPools();
+
+ // It does not make sense, when invoked from a filterPool, to ask the user
+ // for the parent filter pool, or to ask the user whether the filter is connection
+ // specific, as they user has explicitly chosen their pool...
+ //if (!showFilterPools || (callerData instanceof SubSystem))
+ if (!showFilterPools)
+ {
+ ISubSystem selectedSubSystem = (ISubSystem) callerData;
+ // When not showing filter pools, we need to distinquish between an advanced user and a new user.
+ // For a new user we simply want to ask them whether this filter is to be team sharable or private,
+ // and based on that, we will place the filter in the default filter pool for the appropriate profile.
+ // For an advanced user who has simply turned show filter pools back off, we want to let them choose
+ // explicitly which filter pool they want to place the filter in.
+ // To approximate the decision, we will define an advanced user as someone who already has a reference
+ // to a filter pool other than the default pools in the active profiles.
+ boolean advancedUser = false;
+ ISystemFilterPoolReferenceManager refMgr = selectedSubSystem.getSystemFilterPoolReferenceManager();
+ ISystemFilterPool[] refdPools = refMgr.getReferencedSystemFilterPools();
+ if (refdPools.length == 0)
+ SystemBasePlugin.logInfo("SubSystemFactoryImpl::getSubSystemActions - getReferencedSystemFilterPools returned array of length zero.");
+ // so there already exists references to more than one filter pool, but it might simply be a reference
+ // to the default filter pool in the user's profile and another to reference to the default filter pool in
+ // the team profile... let's see...
+ else if (refdPools.length > 1)
+ {
+ for (int idx = 0; !advancedUser && (idx < refdPools.length); idx++)
+ {
+ if (!refdPools[idx].isDefault() && (refdPools[idx].getOwningParentName()==null))
+ advancedUser = true;
+ }
+ }
+ if (advancedUser)
+ {
+ newFilterAction.setAllowFilterPoolSelection(refdPools); // show all pools referenced in this subsystem, and let them choose one
+ }
+ else
+ {
+ boolean anyAdded = false;
+ SystemFilterPoolWrapperInformation poolWrapperInfo = getNewFilterWizardPoolWrapperInformation();
+ ISystemProfile[] activeProfiles = SystemPlugin.getTheSystemRegistry().getActiveSystemProfiles();
+ ISystemProfile activeProfile = selectedSubSystem.getHost().getSystemProfile();
+ for (int idx = 0; idx < activeProfiles.length; idx++)
+ {
+ ISystemFilterPool defaultPool = getDefaultSystemFilterPool(factory, (ISystemProfile)activeProfiles[idx]);
+
+ if (defaultPool != null)
+ {
+ poolWrapperInfo.addWrapper(activeProfiles[idx].getName(), defaultPool, (activeProfiles[idx] == activeProfile)); // display name, pool to wrap, whether to preselect
+ anyAdded = true;
+ }
+ }
+ if (anyAdded)
+ newFilterAction.setAllowFilterPoolSelection(poolWrapperInfo);
+ }
+ }
+ }
+
+ /**
+ * Given a profile, return the first (hopefully only) default pool for this
+ * profile.
+ */
+ public ISystemFilterPool getDefaultSystemFilterPool(ISubSystemConfiguration factory, ISystemProfile profile)
+ {
+ ISystemFilterPool pool = null;
+ ISystemFilterPoolManager mgr = factory.getFilterPoolManager(profile);
+ pool = mgr.getFirstDefaultSystemFilterPool(); // RETURN FIRST
+ return pool;
+ }
+
+ /**
+ * Overridable entry for child classes to supply their own flavour of ISystemFilterPoolWrapperInformation for
+ * the new filter wizards.
+ */
+ protected SystemFilterPoolWrapperInformation getNewFilterWizardPoolWrapperInformation()
+ {
+ return new SystemFilterPoolWrapperInformation(SystemResources.RESID_NEWFILTER_PAGE2_PROFILE_LABEL, SystemResources.RESID_NEWFILTER_PAGE2_PROFILE_TOOLTIP,
+ SystemResources.RESID_NEWFILTER_PAGE2_PROFILE_VERBAGE);
+ }
+ /**
+ * Overridable entry for child classes to supply their own "new" action(s) for creating a
+ * filter pool.
+ * By default, this creates an action for creating a new filter pool and a new filter pool reference.
+ * @param selectedSubSystem the currently selected subsystem
+ * @param shell The Shell of the view where this action was launched from
+ * @return array of IAction objects to contribute to the popup menu
+ */
+ protected IAction[] getSubSystemNewFilterPoolActions(ISubSystemConfiguration factory, ISubSystem selectedSubSystem, Shell shell)
+ {
+ IAction[] actions = new IAction[2];
+ actions[0] = new SystemFilterNewFilterPoolAction(shell);
+ ((ISystemAction) actions[0]).setHelp(SystemPlugin.HELPPREFIX + "actn0040");
+ ((SystemFilterNewFilterPoolAction) actions[0]).setDialogHelp(SystemPlugin.HELPPREFIX + "wnfp0000");
+ actions[1] = new SystemFilterCascadingNewFilterPoolReferenceAction(shell, selectedSubSystem.getSystemFilterPoolReferenceManager());
+ ((ISystemAction) actions[1]).setHelp(SystemPlugin.HELPPREFIX + "actn0041");
+ return actions;
+ }
+ /**
+ * Overridable entry for child classes to contribute subsystem actions
+ * beyond the default supplied actions.
+ *
+ * By default, returns null.
+ * @return Vector of IAction objects.
+ * @see #getSubSystemActions(ISubSystem,Shell)
+ */
+ protected Vector getAdditionalSubSystemActions(ISubSystemConfiguration factory, ISubSystem selectedSubSystem, Shell shell)
+ {
+ return null;
+ }
+
+
+
+
+
+
+ /**
+ * Supply the image to be used for filter pool managers, within actions.
+ * REQUIRED BY SYSTEMFILTERPOOLMANAGERPROVIDER INTERFACE
+ */
+ public ImageDescriptor getSystemFilterPoolManagerImage()
+ {
+ return SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_PROFILE_ID);
+ }
+ /**
+ * Supply the image to be used for filter pools, within actions.
+ * REQUIRED BY SYSTEMFILTERPOOLMANAGERPROVIDER INTERFACE
+ */
+ public ImageDescriptor getSystemFilterPoolImage(ISystemFilterPool filterPool)
+ {
+ return SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_FILTERPOOL_ID);
+ }
+ /**
+ * Supply the image to be used for filters, within actions.
+ * REQUIRED BY SYSTEMFILTERPOOLMANAGERPROVIDER INTERFACE
+ */
+ public ImageDescriptor getSystemFilterImage(ISystemFilter filter)
+ {
+ return SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_FILTER_ID);
+ }
+ /*
+ * Supply the image to be used for the given filter string, within actions.
+ * REQUIRED BY SYSTEMFILTERPOOLMANAGERPROVIDER INTERFACE
+ */
+ public ImageDescriptor getSystemFilterStringImage(ISystemFilterString filterString)
+ {
+ return getSystemFilterStringImage(filterString.getString());
+ }
+
+ /*
+ * Supply the image to be used for the given filter string string, within actions.
+ * REQUIRED BY SYSTEMFILTERPOOLMANAGERPROVIDER INTERFACE
+ */
+ public ImageDescriptor getSystemFilterStringImage(String filterStringString)
+ {
+ return SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_FILTERSTRING_ID);
+ }
+
+
+ // ------------------------------------------------
+ // HELPER METHODS TO SIMPLY EVENT FIRING...
+ // ------------------------------------------------
+
+
+
+ // ------------------------------------------------
+ // FILTER POOL MANAGER PROVIDER CALLBACK METHODS...
+ // ------------------------------------------------
+
+ // ---------------------
+ // FILTER POOL EVENTS...
+ // ---------------------
+
+ /**
+ * Returns a list of actions for the popup menu when user right clicks on a
+ * filter pool object within a subsystem of this factory.
+ * Only supported and used by subsystems that support filters.
+ *
+ * YOU DO NOT NEED TO OVERRIDE THIS METHOD.
+ *
+ * Most actions are handled in this base, except if you have your own action for
+ * creating a new filter. In this case, override getNewFilterAction()
+ * To add additional actions, override {@link #getAdditionalFilterPoolActions(ISystemFilterPool selectedPool, Shell shell)}.
+ *
+ * @param pool the currently selected pool
+ * @param shell parent shell of viewer where the popup menu is being constructed
+ */
+ public IAction[] getFilterPoolActions(ISubSystemConfiguration factory, ISystemFilterPool selectedPool, Shell shell)
+ {
+ Vector childActions = new Vector();
+ Vector ourChildActions = getAdditionalFilterPoolActions(factory, selectedPool, shell);
+ if (ourChildActions != null)
+ for (int idx = 0; idx < ourChildActions.size(); idx++)
+ childActions.addElement(ourChildActions.elementAt(idx));
+ IAction[] newActions = getNewFilterPoolFilterActions(factory, selectedPool, shell);
+ if (newActions != null)
+ {
+ for (int idx = 0; idx < newActions.length; idx++)
+ {
+ childActions.addElement(newActions[idx]);
+ //if (newActions[idx] instanceof SystemNewFilterAction)
+ // ((SystemNewFilterAction) newActions[idx]).setCallBackConfigurator(this, null);
+ }
+ }
+ if (filterPoolActions == null)
+ {
+ int nbr = 2;
+ filterPoolActions = new IAction[nbr];
+ SystemFilterCopyFilterPoolAction copyAction = new SystemFilterCopyFilterPoolAction(shell);
+ copyAction.setPromptString(SystemResources.RESID_COPY_TARGET_PROFILE_PROMPT);
+ copyAction.setHelp(SystemPlugin.HELPPREFIX + "actn0060");
+ copyAction.setDialogHelp(SystemPlugin.HELPPREFIX + "dcfp0000");
+ SystemFilterMoveFilterPoolAction moveAction = new SystemFilterMoveFilterPoolAction(shell);
+ moveAction.setPromptString(SystemResources.RESID_MOVE_TARGET_PROFILE_PROMPT);
+ moveAction.setHelp(SystemPlugin.HELPPREFIX + "actn0061");
+ moveAction.setDialogHelp(SystemPlugin.HELPPREFIX + "dmfp0000");
+ filterPoolActions[0] = copyAction;
+ filterPoolActions[1] = moveAction;
+ }
+ for (int idx = 0; idx < filterPoolActions.length; idx++)
+ {
+ childActions.addElement(filterPoolActions[idx]);
+ }
+
+ IAction[] allFilterPoolActions = new IAction[childActions.size()];
+ for (int idx = 0; idx < childActions.size(); idx++)
+ allFilterPoolActions[idx] = (IAction) childActions.elementAt(idx);
+
+ return allFilterPoolActions;
+ }
+ /**
+ * Overridable entry for child classes to contribute filter pool actions beyond the
+ * default supplied actions.
+ *
+ * By default, this returns null.
+ * @param pool the currently selected pool
+ * @param shell parent shell of viewer where the popup menu is being constructed
+ * @return Vector of IAction objects.
+ * @see #getFilterPoolActions(ISystemFilterPool,Shell)
+ */
+ protected Vector getAdditionalFilterPoolActions(ISubSystemConfiguration factory, ISystemFilterPool selectedPool, Shell shell)
+ {
+ return null;
+ }
+ /**
+ * Overridable method to return the actions for creating a new filter in a filter pool.
+ * By default returns one action created by calling {@link #getNewFilterPoolFilterAction(ISystemFilterPool, Shell)}.
+ *
+ * If you have multiple actions for creating new filters, override this.
+ *
+ * If you have only a single action for creating new filters, override getNewFilterPoolFilterAction (without the 's').
+ *
+ * @param pool the currently selected pool
+ * @param shell parent shell of viewer where the popup menu is being constructed
+ */
+ protected IAction[] getNewFilterPoolFilterActions(ISubSystemConfiguration factory, ISystemFilterPool selectedPool, Shell shell)
+ {
+ IAction[] actions = new IAction[1];
+ actions[0] = getNewFilterPoolFilterAction(factory, selectedPool, shell);
+ return actions;
+ }
+ /**
+ * Overridable method to return the single action for creating a new filter in a filter pool.
+ * By default returns a default supplied action for this.
+ *
+ * If you have multiple actions for creating new filters, override getNewFilterPoolFilterActions (note the 's').
+ *
+ * If you have only a single action for creating new filters, override this.
+ *
+ * @param pool the currently selected pool
+ * @param shell parent shell of viewer where the popup menu is being constructed
+ */
+ protected IAction getNewFilterPoolFilterAction(ISubSystemConfiguration factory, ISystemFilterPool selectedPool, Shell shell)
+ {
+ SystemNewFilterAction action = new SystemNewFilterAction(shell, selectedPool);
+ action.setHelp(SystemPlugin.HELPPREFIX + "actn0042");
+ action.setDialogHelp(SystemPlugin.HELPPREFIX + "wnfr0000");
+ return action;
+ }
+ /**
+ * Overridable method to return the action for creating a new nested filter inside another filter.
+ * By default returns getNewFilterPoolFilterAction(selectedFilter.getParentFilterPool(),shell).
+ * @param pool the currently selected pool
+ * @param shell parent shell of viewer where the popup menu is being constructed
+ */
+ protected IAction getNewNestedFilterAction(ISubSystemConfiguration factory, ISystemFilter selectedFilter, Shell shell)
+ {
+ return getNewFilterPoolFilterAction(factory, selectedFilter.getParentFilterPool(), shell);
+ }
+ /**
+ * Overridable method to return the action for changing an existing filter.
+ * By default returns new SystemChangeFilterAction, unless the filter's isSingleFilterStringOnly()
+ * returns true, in which case null is returned.
+ *
+ * @param selectedFilter the currently selected filter
+ * @param shell parent shell of viewer where the popup menu is being constructed
+ */
+ protected IAction getChangeFilterAction(ISubSystemConfiguration factory, ISystemFilter selectedFilter, Shell shell)
+ {
+ /* We don't do this here now as this is overridable. Now done in SystemChangeFilterAction.
+ * Also, single filter string doesn't mean non-editable.
+ *
+ if (selectedFilter.isSingleFilterStringOnly())
+ {
+ //System.out.println("filter " + selectedFilter + " is single filter string only");
+ return null;
+ }*/
+ SystemChangeFilterAction action = new SystemChangeFilterAction(shell);
+ action.setHelp(SystemPlugin.HELPPREFIX + "actn0081");
+ action.setDialogHelp(SystemPlugin.HELPPREFIX + "dufr0000");
+ return action;
+ }
+ /**
+ * In addition to a change filter action, we now also support the same functionality
+ * via a Properties page for filters. When this page is activated, this method is called
+ * to enable customization of the page, given the selected filter.
+ *
+ * By default, this method will call {@link #getChangeFilterAction(ISystemFilter, Shell)} to get
+ * your change filter action, and will configure the given page from the dialog created by your
+ * change filter action.
+ *
+ * If your filter uses its own Change Filter dialog, versus subclassing or configuring
+ * {@link org.eclipse.rse.ui.filters.dialogs.SystemChangeFilterDialog} you will have to override this method
+ * and specify the following information for the supplied page (via its setters):
+ *
+ * By default, this method will call {@link #getChangeFilterAction(ISystemFilter, Shell)} to get
+ * your change filter action, and will configure the given page from the dialog created by your
+ * change filter action.
+ *
+ * If your filter uses its own Change Filter dialog, versus subclassing or configuring
+ * {@link org.eclipse.rse.ui.filters.dialogs.SystemChangeFilterDialog} you will have to
+ * override this method and specify the following information for the supplied page (via its setters):
+ *
+ * By default, this returns null.
+ * @param pool the currently selected pool
+ * @param shell parent shell of viewer where the popup menu is being constructed
+ * @return Vector of IAction objects.
+ * @see #getFilterPoolReferenceActions(ISystemFilterPoolReference,Shell)
+ */
+ protected Vector getAdditionalFilterPoolReferenceActions(ISubSystemConfiguration factory, ISystemFilterPool selectedPool, Shell shell)
+ {
+ return null;
+ }
+ /**
+ * Overridable method to return the action for removing a filter pool reference.
+ * By default returns new SystemRemoveFilterPoolReferenceAction.
+ * @param pool the currently selected pool
+ * @param shell parent shell of viewer where the popup menu is being constructed
+ */
+ protected IAction getRemoveFilterPoolReferenceAction(ISubSystemConfiguration factory, ISystemFilterPool selectedPool, Shell shell)
+ {
+ ISystemAction action = new SystemFilterRemoveFilterPoolReferenceAction(shell);
+ action.setHelp(SystemPlugin.HELPPREFIX + "actn0062");
+ return action;
+ }
+
+ // ---------------------------------
+ // FILTER METHODS
+ // ---------------------------------
+
+
+
+ /**
+ * Prompt the user to create a new filter as a result of the user expanding a promptable
+ * filter.
+ *
+ * This base implementation prompts using the generic filter prompt. You should override this but
+ * copy this code to use as a base/example how to do this.
+ *
+ * @return the filter created by the user or null if they cancelled the prompting
+ */
+ public ISystemFilter createFilterByPrompting(ISubSystemConfiguration factory, ISystemFilterReference referenceToPromptableFilter, Shell shell) throws Exception
+ {
+ ISystemFilter filterPrompt = referenceToPromptableFilter.getReferencedFilter();
+ ISystemFilterPool selectedPool = filterPrompt.getParentFilterPool();
+
+ SystemNewFilterAction action = new SystemNewFilterAction(shell, selectedPool);
+ Object simulatedSelectedParent = null;
+ if (!factory.showFilterPools()) // if we are not showing filter pools, the parent will be the subsystem itself
+ {
+ simulatedSelectedParent = referenceToPromptableFilter.getProvider(); // this is the subsystem
+ action.setCallBackConfigurator(this, simulatedSelectedParent);
+ }
+ else // if we are showing filter pools, the parent will be the selected filter pool reference
+ {
+ simulatedSelectedParent = referenceToPromptableFilter.getParentSystemFilterReferencePool();
+ action.setCallBackConfigurator(this, referenceToPromptableFilter.getProvider());
+ }
+ action.setSelection(new StructuredSelection(simulatedSelectedParent)); // pretend parent node was selected
+
+ action.run();
+ ISystemFilter newFilter = action.getNewFilter();
+ return newFilter;
+ }
+
+ /**
+ * Returns a list of actions for the popup menu when user right clicks on a
+ * filter object.
+ *
+ * Only supported and used by subsystems that support filters.
+ *
+ * YOU DO NOT NEED TO OVERRIDE THIS METHOD.
+ *
+ * Most actions are handled in this base, except if you have your own action for
+ * creating a new nested filter. In this case, override getNewFilterAction()
+ */
+ public IAction[] getFilterActions(ISubSystemConfiguration factory, ISystemFilter selectedFilter, Shell shell)
+ {
+ Vector childActions = new Vector();
+ Vector ourChildActions = getAdditionalFilterActions(factory, selectedFilter, shell);
+ int pasteIndex = -1;
+ if (ourChildActions != null)
+ for (int idx = 0; idx < ourChildActions.size(); idx++)
+ {
+ // we want to make sure the order is kept consistent at
+ // Copy, Paste, Move, Delete Rename
+ if (ourChildActions.elementAt(idx) instanceof SystemPasteFromClipboardAction) pasteIndex = idx;
+ else childActions.addElement(ourChildActions.elementAt(idx));
+ }
+
+ // Add our static default-supplied actions
+ if (filterActions == null)
+ {
+ int additionalActions = 4;
+ if (pasteIndex > -1) additionalActions++;
+ int fsIdx = 0;
+ filterActions = new IAction[additionalActions];
+ SystemFilterCopyFilterAction copyAction = new SystemFilterCopyFilterAction(shell);
+ copyAction.setPromptString(SystemResources.RESID_COPY_TARGET_FILTERPOOL_PROMPT);
+ copyAction.setHelp(SystemPlugin.HELPPREFIX + "actn0082");
+ copyAction.setDialogHelp(SystemPlugin.HELPPREFIX + "dcfr0000");
+ filterActions[fsIdx++] = copyAction;
+
+ // we want to make sure the order is kept consistent at
+ // Copy, Paste, Move, Delete Rename
+ if (pasteIndex > -1)
+ {
+ filterActions[fsIdx++] = (IAction) ourChildActions.elementAt(pasteIndex);
+ }
+
+ SystemFilterMoveFilterAction moveAction = new SystemFilterMoveFilterAction(shell);
+ moveAction.setPromptString(SystemResources.RESID_MOVE_TARGET_FILTERPOOL_PROMPT);
+ moveAction.setHelp(SystemPlugin.HELPPREFIX + "actn0083");
+ moveAction.setDialogHelp(SystemPlugin.HELPPREFIX + "dmfr0000");
+ filterActions[fsIdx++] = moveAction;
+
+ filterActions[fsIdx] = new SystemFilterMoveUpFilterAction(shell);
+ ((SystemFilterMoveUpFilterAction) filterActions[fsIdx++]).setHelp(SystemPlugin.HELPPREFIX + "actn0084");
+ filterActions[fsIdx] = new SystemFilterMoveDownFilterAction(shell);
+ ((SystemFilterMoveDownFilterAction) filterActions[fsIdx++]).setHelp(SystemPlugin.HELPPREFIX + "actn0085");
+ }
+ // add overridable dynamic actions
+ if (factory.supportsNestedFilters())
+ {
+ IAction newNestedFilterAction = getNewNestedFilterAction(factory, selectedFilter, shell);
+ if (newNestedFilterAction != null)
+ childActions.addElement(newNestedFilterAction);
+ }
+ IAction chgFilterAction = getChangeFilterAction(factory, selectedFilter, shell);
+ if (chgFilterAction != null)
+ childActions.addElement(chgFilterAction);
+ /*
+ if (showFilterStrings())
+ {
+ IAction[] newStringActions = getNewFilterStringActions(selectedFilter, shell);
+ if (newStringActions != null)
+ for (int idx=0; idx
+ * YOU DO NOT NEED TO OVERRIDE THIS METHOD.
+ *
+ * Most actions are handled in this base, except if you have your own action for
+ * creating a new filter. In this case, override getNewFilterAction()
+ * To add additional actions, override {@link #getAdditionalFilterReferenceActions(ISystemFilterReference, Shell)}.
+ *
+ * @param selectedFilterRef the currently selected filter reference
+ * @param shell parent shell of viewer where the popup menu is being constructed
+ */
+ public IAction[] getFilterReferenceActions(ISubSystemConfiguration factory, ISystemFilterReference selectedFilterRef, Shell shell)
+ {
+ Vector childActions = getAdditionalFilterReferenceActions(factory, selectedFilterRef, shell);
+ int nbrChildActions = 0;
+ if (childActions != null)
+ nbrChildActions = childActions.size();
+ else
+ childActions = new Vector();
+ /*
+ if (filterReferenceActions == null)
+ {
+ int nbr = 2;
+ filterReferenceActions = new IAction[nbr];
+ }
+ for (int idx=0; idx
+ * YOU DO NOT NEED TO OVERRIDE THIS METHOD.
+ *
+ * Most actions are handled in this base, only override if you have something unique.
+ *
+ public IAction[] getFilterStringActions(SystemFilterString selectedFilterString, Shell shell)
+ {
+ Vector childActions = new Vector();
+ Vector ourChildActions = getAdditionalFilterStringActions(selectedFilterString, shell);
+ if (ourChildActions != null)
+ for (int idx=0; idx
+ * By default, this returns the default change filter string action.
+ * @param selectedFilterString the currently selected filter string
+ * @param shell parent shell of viewer where the popup menu is being constructed
+ * @return change action.
+ *
+ protected IAction getChangeFilterStringAction(SystemFilterString selectedFilterString, Shell shell)
+ {
+ //IAction chgAction = new SystemFilterDefaultUpdateFilterStringAction(shell);
+ //return chgAction;
+ return null;
+ }*/
+
+ /*
+ * Returns a list of actions for the popup menu when user right clicks on a
+ * filter string reference object (and has set the preferences to see them).
+ *
+ * Only supported and used by subsystems that support filters.
+ *
+ * Most actions are handled in this base, only override if you have something unique.
+ *
+ public IAction[] getFilterStringReferenceActions(SystemFilterStringReference selectedFilterStringRef, Shell shell)
+ {
+ Vector childActions = new Vector();
+ Vector ourChildActions = getAdditionalFilterStringReferenceActions(selectedFilterStringRef, shell);
+ if (ourChildActions != null)
+ for (int idx=0; idx
+ * We return {@link org.eclipse.rse.ui.widgets.ServerLauncherForm}.
+ * Override if appropriate.
+ */
+ public IServerLauncherForm getServerLauncherForm(ISubSystemConfiguration factory, Shell shell, ISystemMessageLine msgLine)
+ {
+ return new IBMServerLauncherForm(shell, msgLine);
+ }
+
+ /**
+ * Called by SystemRegistry's renameSystemProfile method to ensure we update our
+ * filter pool manager names (and their folders)
+ *
+ * Must be called AFTER changing the profile's name!!
+ */
+ public void renameSubSystemProfile(ISubSystemConfiguration factory, String oldProfileName, String newProfileName)
+ {
+ //SystemPlugin.logDebugMessage(this.getClass().getName(), "Inside renameSubSystemProfile. newProfileName = "+newProfileName);
+ ISystemProfile profile = factory.getSystemProfile(newProfileName);
+ factory.renameFilterPoolManager(profile); // update filter pool manager name
+ //if (profile.isDefaultPrivate()) // I don't remember why this was here, but it caused bad things, Phil.
+ {
+ // Rename the default filter pool for this profile, as it's name is derived from the profile.
+ ISystemFilterPool defaultPoolForThisProfile = factory.getDefaultFilterPool(profile, oldProfileName);
+ if (defaultPoolForThisProfile != null)
+ try
+ {
+ factory.getFilterPoolManager(profile).renameSystemFilterPool(defaultPoolForThisProfile, SubSystemConfiguration.getDefaultFilterPoolName(newProfileName, factory.getId()));
+ }
+ catch (Exception exc)
+ {
+ SystemBasePlugin.logError("Unexpected error renaming default filter pool " + SubSystemConfiguration.getDefaultFilterPoolName(newProfileName, factory.getId()), exc);
+ System.out.println("Unexpected error renaming default filter pool " + SubSystemConfiguration.getDefaultFilterPoolName(newProfileName, factory.getId()) + ": " + exc);
+ }
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SubsystemFactoryAdapterFactory.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SubsystemFactoryAdapterFactory.java
new file mode 100644
index 00000000000..8a674d1d211
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SubsystemFactoryAdapterFactory.java
@@ -0,0 +1,59 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.core.runtime.IAdapterManager;
+import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
+import org.eclipse.rse.core.subsystems.util.ISubsystemConfigurationAdapter;
+
+
+public class SubsystemFactoryAdapterFactory implements IAdapterFactory
+{
+
+ private ISubsystemConfigurationAdapter ssFactoryAdapter = new SubsystemFactoryAdapter();
+
+ /**
+ * @see IAdapterFactory#getAdapterList()
+ */
+ public Class[] getAdapterList()
+ {
+ return new Class[] {ISubsystemConfigurationAdapter.class};
+ }
+ /**
+ * Called by our plugin's startup method to register our adaptable object types
+ * with the platform. We prefer to do it here to isolate/encapsulate all factory
+ * logic in this one place.
+ */
+ public void registerWithManager(IAdapterManager manager)
+ {
+ manager.registerAdapters(this, ISubSystemConfiguration.class);
+ }
+ /**
+ * @see IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
+ */
+ public Object getAdapter(Object adaptableObject, Class adapterType)
+ {
+ Object adapter = null;
+ if (adaptableObject instanceof ISubSystemConfiguration)
+ adapter = ssFactoryAdapter;
+
+ return adapter;
+ }
+
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemAbstractAPIProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemAbstractAPIProvider.java
new file mode 100644
index 00000000000..35004908c6a
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemAbstractAPIProvider.java
@@ -0,0 +1,215 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.rse.core.SystemAdapterHelpers;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.model.ISystemMessageObject;
+import org.eclipse.rse.model.ISystemRegistry;
+import org.eclipse.rse.model.SystemMessageObject;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.swt.widgets.Shell;
+
+
+
+/**
+ * This is a base class that a provider of root nodes to the remote systems tree viewer part can
+ * use as a parent class.
+ */
+public abstract class SystemAbstractAPIProvider
+ implements ISystemViewInputProvider, ISystemMessages
+{
+
+
+ protected Shell shell;
+ protected Viewer viewer;
+ protected ISystemRegistry sr;
+
+ protected Object[] emptyList = new Object[0];
+ protected Object[] msgList = new Object[1];
+ protected SystemMessageObject nullObject = null;
+ protected SystemMessageObject canceledObject = null;
+ protected SystemMessageObject errorObject = null;
+
+
+ /**
+ * Constructor
+ */
+ public SystemAbstractAPIProvider()
+ {
+ super();
+ sr = SystemPlugin.getTheSystemRegistry();
+ }
+
+ /**
+ * This is the method required by the IAdaptable interface.
+ * Given an adapter class type, return an object castable to the type, or
+ * null if this is not possible.
+ */
+ public Object getAdapter(Class adapterType)
+ {
+ return Platform.getAdapterManager().getAdapter(this, adapterType);
+ }
+
+ /**
+ * Set the shell in case it is needed for anything.
+ * The label and content provider will call this.
+ */
+ public void setShell(Shell shell)
+ {
+ this.shell = shell;
+ }
+
+ /**
+ * Return the shell of the current viewer
+ */
+ public Shell getShell()
+ {
+ return shell;
+ }
+
+ /**
+ * Set the viewer in case it is needed for anything.
+ * The label and content provider will call this.
+ */
+ public void setViewer(Viewer viewer)
+ {
+ this.viewer = viewer;
+ }
+
+ /**
+ * Return the viewer we are currently associated with
+ */
+ public Viewer getViewer()
+ {
+ return viewer;
+ }
+
+ /**
+ * Return true to show the action bar (ie, toolbar) above the viewer.
+ * The action bar contains connection actions, predominantly.
+ * We return false
+ */
+ public boolean showActionBar()
+ {
+ return false;
+ }
+
+ /**
+ * Return true to show the button bar above the viewer.
+ * The tool bar contains "Get List" and "Refresh" buttons and is typically
+ * shown in dialogs that list only remote system objects.
+ * We return false.
+ */
+ public boolean showButtonBar()
+ {
+ return false;
+ }
+
+ /**
+ * Return true to show right-click popup actions on objects in the tree.
+ * We return false.
+ */
+ public boolean showActions()
+ {
+ return false;
+ }
+
+ private void initMsgObjects()
+ {
+ nullObject = new SystemMessageObject(SystemPlugin.getPluginMessage(MSG_EXPAND_EMPTY),ISystemMessageObject.MSGTYPE_EMPTY, null);
+ canceledObject = new SystemMessageObject(SystemPlugin.getPluginMessage(MSG_LIST_CANCELLED),ISystemMessageObject.MSGTYPE_CANCEL, null);
+ errorObject = new SystemMessageObject(SystemPlugin.getPluginMessage(MSG_EXPAND_FAILED),ISystemMessageObject.MSGTYPE_ERROR, null);
+ }
+
+ /**
+ * In getChildren, return checkForNull(children, true/false) vs your array directly.
+ * This method checks for a null array which not allow and replaces it with an empty array.
+ * If true is passed then it returns the "Empty list" message object if the array is null or empty
+ */
+ protected Object[] checkForNull(Object[] children, boolean returnNullMsg)
+ {
+ if ((children == null) || (children.length==0))
+ {
+ if (!returnNullMsg)
+ return emptyList;
+ else
+ {
+ if (nullObject == null)
+ initMsgObjects();
+ msgList[0] = nullObject;
+ return msgList;
+ }
+ }
+ else
+ return children;
+ }
+
+ /**
+ * Return the "Operation cancelled by user" msg as an object array so can be used to answer getChildren()
+ */
+ protected Object[] getCancelledMessageObject()
+ {
+ if (canceledObject == null)
+ initMsgObjects();
+ msgList[0] = canceledObject;
+ return msgList;
+ }
+
+ /**
+ * Return the "Operation failed" msg as an object array so can be used to answer getChildren()
+ */
+ protected Object[] getFailedMessageObject()
+ {
+ if (errorObject == null)
+ initMsgObjects();
+ msgList[0] = errorObject;
+ return msgList;
+ }
+
+ /**
+ * Return true if we are listing connections or not, so we know whether we are interested in
+ * connection-add events
+ */
+ public boolean showingConnections()
+ {
+ return false;
+ }
+
+ // ------------------
+ // HELPER METHODS...
+ // ------------------
+ /**
+ * Returns the implementation of ISystemViewElement for the given
+ * object. Returns null if the adapter is not defined or the
+ * object is not adaptable.
+ */
+ protected ISystemViewElementAdapter getAdapter(Object o)
+ {
+ return SystemAdapterHelpers.getAdapter(o);
+ }
+
+ /**
+ * Returns the implementation of ISystemRemoteElement for the given
+ * object. Returns null if this object does not adaptable to this.
+ */
+ protected ISystemRemoteElementAdapter getRemoteAdapter(Object o)
+ {
+ return SystemAdapterHelpers.getRemoteAdapter(o);
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemActionViewerFilter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemActionViewerFilter.java
new file mode 100644
index 00000000000..8935025cf03
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemActionViewerFilter.java
@@ -0,0 +1,190 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+
+/**
+ * This class is a viewer filter that tests attributes of thise
+ */
+public class SystemActionViewerFilter extends ViewerFilter {
+
+ /**
+ * Inner class representing a filter criterion.
+ */
+ private class FilterCriterion {
+
+ private String name;
+ private String value;
+
+ /**
+ * Constructor.
+ * @param name the name.
+ * @param value the value.
+ */
+ private FilterCriterion(String name, String value) {
+ this.name = name;
+ this.value = value;
+ }
+
+ /**
+ * Returns the name.
+ * @return the name.
+ */
+ private String getName() {
+ return name;
+ }
+
+ /**
+ * Returns the value.
+ * @return the value.
+ */
+ private String getValue() {
+ return value;
+ }
+ }
+
+ // list to hold filter criteria for each object type
+ private HashMap map;
+
+ /**
+ * Constructor.
+ */
+ public SystemActionViewerFilter() {
+ super();
+ map = new HashMap();
+ }
+
+ /**
+ * Adds a filter criterion.
+ * @param objectTypes object types that the filter criterion applies to.
+ * @param name the name.
+ * @param value the value.
+ */
+ public void addFilterCriterion(Class[] objectTypes, String name, String value) {
+ FilterCriterion criterion = new FilterCriterion(name, value);
+
+ // go through each object type
+ for (int i = 0; i < objectTypes.length; i++) {
+ Class type = objectTypes[i];
+
+ List criteria = null;
+
+ // we do not have object type, so add it
+ if (!map.containsKey(type)) {
+ criteria = new ArrayList();
+ }
+ // we already have object type, so get its list of criteria
+ else {
+ criteria = (List)(map.get(type));
+ }
+
+ // add criterion to list
+ criteria.add(criterion);
+
+ // put type and list of criteria in map
+ map.put(type, criteria);
+ }
+ }
+
+ /**
+ * Removes all criteria.
+ */
+ public void removeAllCriterion() {
+ map.clear();
+ }
+
+ /**
+ * Checks if the object is an instance of any of the types in our list, and returns the
+ * type for which the object is an instance.
+ * @param obj the object.
+ * @return the type for which the object is an instance, or
+ * A cell editor that presents a list of items in a combo box.
+ * The cell editor's value is the zero-based index of the selected
+ * item.
+ *
+ * This class may be instantiated; it is not intended to be subclassed.
+ *
+ * The editor is configured with the current validator if there is one.
+ * We return an empty list.
+ */
+ public Object[] getSystemViewRoots()
+ {
+ return emptyList;
+ }
+ /**
+ * Return true if {@link #getSystemViewRoots()} will return a non-empty list
+ * We return false.
+ */
+ public boolean hasSystemViewRoots()
+ {
+ return false;
+ }
+ /**
+ * This method is called by the connection adapter when the user expands
+ * a connection. This method must return the child objects to show for that
+ * connection.
+ * We return an empty list
+ */
+ public Object[] getConnectionChildren(IHost selectedConnection)
+ {
+ return emptyList; //
+ }
+ /**
+ * This method is called by the connection adapter when deciding to show a plus-sign
+ * or not beside a connection. Return true if this connection has children to be shown.
+ * we return false
+ */
+ public boolean hasConnectionChildren(IHost selectedConnection)
+ {
+ return false;
+ }
+
+ /**
+ * Return true to show the action bar (ie, toolbar) above the viewer.
+ * The action bar contains connection actions, predominantly.
+ */
+ public boolean showActionBar()
+ {
+ return false;
+ }
+ /**
+ * Return true to show the button bar above the viewer.
+ * The tool bar contains "Get List" and "Refresh" buttons and is typicall
+ * shown in dialogs that list only remote system objects.
+ */
+ public boolean showButtonBar()
+ {
+ return true;
+ }
+ /**
+ * Return true to show right-click popup actions on objects in the tree.
+ */
+ public boolean showActions()
+ {
+ return false;
+ }
+
+
+
+ // ----------------------------------
+ // OUR OWN METHODS...
+ // ----------------------------------
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemInheritablePropertyData.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemInheritablePropertyData.java
new file mode 100644
index 00000000000..b789e2ffede
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemInheritablePropertyData.java
@@ -0,0 +1,173 @@
+/********************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+import org.eclipse.rse.ui.SystemPropertyResources;
+/**
+ * This class captures the data needed to populate a
+ * InheritableTextCellEditor.
+ */
+public class SystemInheritablePropertyData
+{
+ private String localValue="";
+ private String inheritedValue="";
+ private boolean isLocal;
+ private boolean notApplicable = false;
+
+ private String inheritedXlatedString;
+
+ public SystemInheritablePropertyData()
+ {
+ super();
+ setInheritedDisplayString(SystemPropertyResources.RESID_PROPERTY_INHERITED);
+ }
+
+ /**
+ * Identify this value as "not applicable". This causes
+ * this string to be displayed, and prevents users from editing this property.
+ */
+ public void setNotApplicable(boolean set)
+ {
+ notApplicable = set;
+ }
+ /**
+ * Get the notApplicable flag. Default is false.
+ */
+ public boolean getNotApplicable()
+ {
+ return notApplicable;
+ }
+
+ /**
+ * Gets the localValue
+ * @return Returns a String
+ */
+ public String getLocalValue()
+ {
+ return localValue;
+ }
+ /**
+ * Sets the localValue
+ * @param localValue The localValue to set
+ */
+ public void setLocalValue(String localValue)
+ {
+ if (localValue == null)
+ localValue = ""; // to prevent equals() from crashing
+ this.localValue = localValue;
+ }
+
+ /**
+ * Gets the inheritedValue
+ * @return Returns a String
+ */
+ public String getInheritedValue()
+ {
+ return inheritedValue;
+ }
+ /**
+ * Sets the inheritedValue
+ * @param inheritedValue The inheritedValue to set
+ */
+ public void setInheritedValue(String inheritedValue)
+ {
+ if (inheritedValue == null)
+ inheritedValue = ""; // to prevent equals() from crashing
+ this.inheritedValue = inheritedValue;
+ }
+
+
+ /**
+ * Gets the isLocal
+ * @return Returns a boolean
+ */
+ public boolean getIsLocal()
+ {
+ return isLocal;
+ }
+ /**
+ * Sets the isLocal
+ * @param isLocal The isLocal to set
+ */
+ public void setIsLocal(boolean isLocal)
+ {
+ this.isLocal = isLocal;
+ }
+
+ /**
+ * Set the string to append to the inherited value in display-only mode
+ */
+ public void setInheritedDisplayString(String s)
+ {
+ inheritedXlatedString = s;
+ }
+
+ /**
+ * Convert to string for readonly-property sheet value
+ */
+ public String toString()
+ {
+ if (notApplicable)
+ return SystemPropertyResources.RESID_TERM_NOTAPPLICABLE;
+ String value = null;
+ if (isLocal)
+ value = localValue;
+ else
+ //value = " (*INHERITED)";
+ value = inheritedValue + " " + inheritedXlatedString;
+ return value;
+ }
+
+ /**
+ * The property sheet viewer will decide to call the adapter back when Enter is pressed,
+ * only if the result of calling equals() on the previous and current versions of this
+ * object returns false. If we did not have this method, they'd always return true.
+ */
+ public boolean equals(Object other)
+ {
+ if (other instanceof SystemInheritablePropertyData)
+ {
+ SystemInheritablePropertyData otherData = (SystemInheritablePropertyData)other;
+ boolean equal =
+ ((isLocal == otherData.getIsLocal()) &&
+ (localValue.equals(otherData.getLocalValue())) &&
+ (inheritedValue.equals(otherData.getInheritedValue())) );
+ /*
+ System.out.println("inside equals. Result? " + equal + " Local value: " + localValue);
+ if (!equal)
+ {
+ System.out.println("... isLocal.......: " + isLocal + " vs " + otherData.getIsLocal());
+ System.out.println("... localValue....: '" + localValue + "' vs '" + otherData.getLocalValue() + "'");
+ System.out.println("... inheritedValue: '" + inheritedValue + "' vs " + otherData.getInheritedValue() + "'");
+ }
+ */
+ return equal;
+ }
+ else
+ return super.equals(other);
+ }
+
+ /**
+ * For debugging
+ */
+ public void printDetails()
+ {
+ System.out.println("SystemInheritablePropertyData: ");
+ System.out.println("...localValue = "+localValue);
+ System.out.println("...inheritedValue = "+inheritedValue);
+ System.out.println("...isLocal = "+isLocal);
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemInheritableTextCellEditor.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemInheritableTextCellEditor.java
new file mode 100644
index 00000000000..3112b8b8c4c
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemInheritableTextCellEditor.java
@@ -0,0 +1,517 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+import java.text.MessageFormat;
+
+import org.eclipse.jface.util.Assert;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.rse.ui.widgets.InheritableEntryField;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.FocusAdapter;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.events.TraverseEvent;
+import org.eclipse.swt.events.TraverseListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Text;
+
+
+/**
+ * A cell editor that manages an inheritable text entry field.
+ * The cell editor's value is the text string itself.
+ */
+public class SystemInheritableTextCellEditor
+ //extends DialogCellEditor
+ extends CellEditor
+ implements SelectionListener
+{
+ protected InheritableEntryField textField;
+ protected Text text;
+ protected SystemInheritablePropertyData data;
+ private String toggleButtonToolTipText, entryFieldToolTipText;
+
+ private ModifyListener modifyListener;
+
+ /**
+ * State information for updating action enablement
+ */
+ private boolean isSelection = false;
+ private boolean isDeleteable = false;
+ private boolean isSelectable = false;
+
+ /**
+ * Creates a new text string cell editor parented under the given control.
+ * The cell editor value is the string itself, which is initially the empty string.
+ * Initially, the cell editor has no cell validator.
+ *
+ * @param parent the parent control
+ */
+ public SystemInheritableTextCellEditor(Composite parent)
+ {
+ super(parent);
+ }
+ /**
+ * Checks to see if the "deleteable" state (can delete/
+ * nothing to delete) has changed and if so fire an
+ * enablement changed notification.
+ */
+ private void checkDeleteable()
+ {
+ boolean oldIsDeleteable = isDeleteable;
+ isDeleteable = isDeleteEnabled();
+ if (oldIsDeleteable != isDeleteable)
+ {
+ fireEnablementChanged(DELETE);
+ }
+ }
+
+
+ /**
+ * Checks to see if the "selectable" state (can select)
+ * has changed and if so fire an enablement changed notification.
+ */
+ private void checkSelectable()
+ {
+ boolean oldIsSelectable = isSelectable;
+ isSelectable = isSelectAllEnabled();
+ if (oldIsSelectable != isSelectable)
+ {
+ fireEnablementChanged(SELECT_ALL);
+ }
+ }
+ /**
+ * Checks to see if the selection state (selection /
+ * no selection) has changed and if so fire an
+ * enablement changed notification.
+ */
+ private void checkSelection()
+ {
+ boolean oldIsSelection = isSelection;
+ isSelection = getTextField().getSelectionCount() > 0;
+ if (oldIsSelection != isSelection)
+ {
+ fireEnablementChanged(COPY);
+ fireEnablementChanged(CUT);
+ }
+ }
+ /**
+ * Return the entry field of the composite control
+ */
+ private Text getTextField()
+ {
+ return textField.getTextField();
+ }
+
+ public InheritableEntryField getInheritableEntryField()
+ {
+ return textField;
+ }
+
+ /**
+ * Gets the toggleButtonToolTipText
+ * @return Returns a String
+ */
+ public String getToggleButtonToolTipText()
+ {
+ return toggleButtonToolTipText;
+ }
+ /**
+ * Sets the toggleButtonToolTipText
+ * @param toggleButtonToolTipText The toggleButtonToolTipText to set
+ */
+ public void setToggleButtonToolTipText(String toggleButtonToolTipText)
+ {
+ this.toggleButtonToolTipText = toggleButtonToolTipText;
+ if (textField != null)
+ textField.setToggleToolTipText(toggleButtonToolTipText);
+ }
+
+ /**
+ * Gets the entryFieldToolTipText
+ * @return Returns a String
+ */
+ public String getEntryFieldToolTipText()
+ {
+ return entryFieldToolTipText;
+ }
+ /**
+ * Sets the entryFieldToolTipText
+ * @param entryFieldToolTipText The entryFieldToolTipText to set
+ */
+ public void setEntryFieldToolTipText(String entryFieldToolTipText)
+ {
+ this.entryFieldToolTipText = entryFieldToolTipText;
+ if (textField != null)
+ textField.setTextFieldToolTipText(entryFieldToolTipText);
+ }
+
+ /* (non-Javadoc)
+ * Method declared on CellEditor.
+ */
+ protected Control createControl(Composite parent)
+ {
+ // specify no borders on text widget as cell outline in
+ // table already provides the look of a border.
+ textField = new InheritableEntryField(parent, SWT.NULL, SWT.BORDER, SWT.SINGLE);
+ textField.setToggleButtonHeight(14);
+ textField.setBackground(parent.getBackground());
+ textField.addSelectionListener(this);
+ if (toggleButtonToolTipText != null)
+ textField.setToggleToolTipText(toggleButtonToolTipText);
+ if (entryFieldToolTipText != null)
+ textField.setTextFieldToolTipText(entryFieldToolTipText);
+ text = getTextField();
+ text.addKeyListener(new KeyAdapter()
+ {
+ public void keyPressed(KeyEvent e)
+ {
+ // The call to inherited keyReleaseOccurred is what causes the apply
+ // event if the key pressed is Enter.
+ keyReleaseOccured(e);
+ // as a result of processing the above call, clients may have
+ // disposed this cell editor
+ if ((getControl() == null) || getControl().isDisposed())
+ return;
+ checkSelection(); // see explaination below
+ checkDeleteable();
+ checkSelectable();
+ }
+ });
+ text.addTraverseListener(new TraverseListener()
+ {
+ public void keyTraversed(TraverseEvent e)
+ {
+ if (e.detail == SWT.TRAVERSE_ESCAPE || e.detail == SWT.TRAVERSE_RETURN)
+ {
+ e.doit = false;
+ }
+ }
+ });
+ // We really want a selection listener but it is not supported so we
+ // use a key listener and a mouse listener to know when selection changes
+ // may have occured
+ text.addMouseListener(new MouseAdapter()
+ {
+ public void mouseUp(MouseEvent e) {
+ checkSelection();
+ checkDeleteable();
+ checkSelectable();
+ }
+ });
+ text.addFocusListener(new FocusAdapter() {
+ public void focusGained(FocusEvent e) {
+ }
+
+ public void focusLost(FocusEvent e) {
+ SystemInheritableTextCellEditor.this.focusLost();
+ }
+ });
+ textField.getToggleButton().addFocusListener(new FocusAdapter() {
+ public void focusLost(FocusEvent e) {
+ SystemInheritableTextCellEditor.this.focusLost();
+ }
+
+ public void focusGained(FocusEvent e) {
+ }
+ });
+
+ text.setFont(parent.getFont());
+ //text.setBackground(parent.getBackground());
+ text.setText("");//$NON-NLS-1$
+ text.addModifyListener(getModifyListener());
+ setValueValid(true);
+ return textField;
+ }
+
+ protected void focusLost()
+ {
+ super.focusLost();
+ }
+
+ /**
+ * Return current data.
+ *
+ * @return the SystemInheritablePropertyData data object
+ */
+ protected Object doGetValue()
+ {
+ SystemInheritablePropertyData outputData = new SystemInheritablePropertyData();
+ outputData.setIsLocal(textField.isLocal());
+ outputData.setLocalValue(textField.getLocalText());
+ outputData.setInheritedValue(textField.getInheritedText());
+ return outputData;
+ }
+
+
+ /* (non-Javadoc)
+ * Method declared on CellEditor.
+ */
+ protected void doSetFocus()
+ {
+ if (text != null)
+ {
+ if (text.isEnabled())
+ {
+ text.selectAll();
+ text.setFocus();
+ }
+ else
+ {
+ textField.setToggleButtonFocus();
+ }
+
+ checkSelection();
+ checkDeleteable();
+ checkSelectable();
+ }
+ }
+ /**
+ * The
+ * This default implementation always returns
+ *
+ * Subclasses may override
+ *
+ * Default is false
+ */
+ public void setShowPropertySheet(boolean show)
+ {
+ this.showPropertySheet = show;
+ }
+
+
+
+ /**
+ * Specify a validator to use when the user selects a remote file or folder.
+ * This allows you to decide if OK should be enabled or not for that remote file or folder.
+ */
+ public void setSelectionValidator(IValidatorRemoteSelection selectionValidator)
+ {
+ _selectionValidator = selectionValidator;
+ }
+
+ protected void clearErrorMessage()
+ {
+ if (_msgLine != null)
+ _msgLine.clearErrorMessage();
+ }
+ protected void setErrorMessage(String msg)
+ {
+ if (_msgLine != null)
+ if (msg != null)
+ _msgLine.setErrorMessage(msg);
+ else
+ _msgLine.clearErrorMessage();
+ }
+ protected void setErrorMessage(SystemMessage msg)
+ {
+ if (_msgLine != null)
+ if (msg != null)
+ _msgLine.setErrorMessage(msg);
+ else
+ _msgLine.clearErrorMessage();
+ }
+
+
+ /**
+ * Set the message shown as the text at the top of the form. Eg, "Select a file"
+ */
+ public void setMessage(String message)
+ {
+ this._verbage = message;
+ if (verbageLabel != null)
+ verbageLabel.setText(message);
+ }
+ /**
+ * Set the tooltip text for the remote systems tree from which an item is selected.
+ */
+ public void setSelectionTreeToolTipText(String tip)
+ {
+ _systemViewForm.setToolTipText(tip);
+ }
+
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemResourceSelectionInputProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemResourceSelectionInputProvider.java
new file mode 100644
index 00000000000..6fd2249b834
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemResourceSelectionInputProvider.java
@@ -0,0 +1,115 @@
+/********************************************************************************
+ * Copyright (c) 2004, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.model.IHost;
+import org.eclipse.rse.model.ISystemRegistry;
+
+
+public abstract class SystemResourceSelectionInputProvider extends SystemAbstractAPIProvider
+{
+ private IHost _connection;
+ private boolean _onlyConnection = false;
+ private boolean _allowNew = true;
+ private String[] _systemTypes;
+
+ public SystemResourceSelectionInputProvider(IHost connection)
+ {
+ _connection = connection;
+ }
+
+ public SystemResourceSelectionInputProvider()
+ {
+ _connection = null;
+ }
+
+ public IHost getSystemConnection()
+ {
+ return _connection;
+ }
+
+ public boolean allowMultipleConnections()
+ {
+ return !_onlyConnection;
+ }
+
+ public void setAllowNewConnection(boolean flag)
+ {
+ _allowNew = flag;
+ }
+
+ public boolean allNewConnection()
+ {
+ return _allowNew;
+ }
+
+ public void setSystemConnection(IHost connection, boolean onlyConnection)
+ {
+ _connection = connection;
+ _onlyConnection = onlyConnection;
+ }
+
+ public String[] getSystemTypes()
+ {
+ return _systemTypes;
+ }
+
+ public void setSystemTypes(String[] types)
+ {
+ _systemTypes = types;
+ }
+
+ public Object[] getSystemViewRoots()
+ {
+ if (_connection == null)
+ {
+ ISystemRegistry registry = SystemPlugin.getTheSystemRegistry();
+ _connection = registry.getHosts()[0];
+
+ }
+ return getConnectionChildren(_connection);
+ }
+
+ public boolean hasSystemViewRoots()
+ {
+ return false;
+ }
+
+ public Object[] getConnectionChildren(IHost selectedConnection)
+ {
+ if (selectedConnection != null)
+ {
+ return getSubSystem(selectedConnection).getChildren();
+ }
+ return null;
+ }
+
+ public boolean hasConnectionChildren(IHost selectedConnection)
+ {
+ if (selectedConnection != null)
+ {
+ return getSubSystem(selectedConnection).hasChildren();
+ }
+ return false;
+ }
+
+ protected abstract ISubSystem getSubSystem(IHost selectedConnection);
+
+
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemSelectRemoteObjectAPIProviderImpl.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemSelectRemoteObjectAPIProviderImpl.java
new file mode 100644
index 00000000000..c6a923bca4e
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemSelectRemoteObjectAPIProviderImpl.java
@@ -0,0 +1,634 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+import org.eclipse.rse.core.SystemAdapterHelpers;
+import org.eclipse.rse.core.SystemBasePlugin;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
+import org.eclipse.rse.filters.ISystemFilter;
+import org.eclipse.rse.filters.ISystemFilterReference;
+import org.eclipse.rse.filters.ISystemFilterStringReference;
+import org.eclipse.rse.filters.SystemFilterSimple;
+import org.eclipse.rse.internal.model.SystemNewConnectionPromptObject;
+import org.eclipse.rse.model.IHost;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * This class is a provider of root nodes to the remote systems tree viewer part.
+ *
+ * It is used when the contents are used to allow the user to select a remote system object.
+ * The tree will begin with the filter pool references or filter references (depending on
+ * the user's preferences setting) of the given subsystem.
+ *
+ * Alternatively, a filter string can be given and the contents will be the result of resolving
+ * that filter string.
+ */
+public class SystemSelectRemoteObjectAPIProviderImpl
+ extends SystemAbstractAPIProvider
+ implements ISystemViewInputProvider, ISystemMessages
+{
+
+
+ protected ISubSystem subsystem = null;
+ protected String filterString = null;
+ protected ISystemViewElementAdapter subsystemAdapter = null;
+
+ // For mode when we want to list the connections ...
+ protected boolean listConnectionsMode = false;
+ protected boolean showNewConnectionPrompt = false;
+ protected boolean singleConnectionMode = false;
+ protected String subsystemFactoryId;
+ protected String subsystemFactoryCategory;
+ protected String filterSuffix;
+ protected String[] systemTypes;
+ protected String preSelectFilterChild;
+ protected Object preSelectFilterChildObject;
+ protected ISystemFilter[] quickFilters;
+ protected IHost[] inputConnections;
+ protected SystemNewConnectionPromptObject connPrompt = null;
+ protected Object[] connPromptAsArray;
+ protected ISystemSelectRemoteObjectAPIProviderCaller caller;
+ protected boolean multiConnections = false;
+
+ /**
+ * Constructor that takes the input needed to drive the list. Specifically,
+ * we need to know what connections to list, and when a connection is expanded,
+ * what subsystems to query for the remote objects.
+ *
+ * This can be done by giving one of two possible pieces of information:
+ *
+ * You must supply one of these. There is no need to supply both.
+ *
+ * Also, it is often desired to restrict what system types the user can create new connections for.
+ * While this could be deduced from the first two pieces of information, it is safer to ask the
+ * caller to explicitly identify these. If null is passed, then there is no restrictions.
+ *
+ * @param factoryId The subsystemFactoryId to restrict connections and subsystems to
+ * An alternative to factoryCategory. Specify only one, pass null for the other.
+ * @param factoryCategory The subsystemFactory category to restrict connections and subsystems to.
+ * An alternative to factoryId. Specify only one, pass null for the other.
+ * @param showNewConnectionPrompt true if to show "New Connection" prompt, false if not to
+ * @param systemTypes Optional list of system types to restrict the "New Connection" wizard to. Pass null for no restrictions
+ */
+ public SystemSelectRemoteObjectAPIProviderImpl(String factoryId, String factoryCategory,
+ boolean showNewConnectionPrompt, String[] systemTypes)
+ {
+ super();
+ this.subsystemFactoryId = factoryId;
+ this.subsystemFactoryCategory = factoryCategory;
+ this.systemTypes = systemTypes;
+ this.showNewConnectionPrompt = showNewConnectionPrompt;
+ this.listConnectionsMode = true;
+ }
+
+ /**
+ * Set the caller to callback to for some events, such as the expansion of a prompting
+ * transient filter.
+ */
+ public void setCaller(ISystemSelectRemoteObjectAPIProviderCaller caller)
+ {
+ this.caller = caller;
+ }
+
+ /**
+ * Specify whether the user should see the "New Connection..." special connection prompt
+ */
+ public void setShowNewConnectionPrompt(boolean show)
+ {
+ this.showNewConnectionPrompt = show;
+ }
+
+ /**
+ * Specify system types to restrict what types of connections the user can create, and see.
+ * This will override subsystemFactoryId,if that has been set!
+ * @see org.eclipse.rse.core.ISystemTypes
+ */
+ public void setSystemTypes(String[] systemTypes)
+ {
+ this.systemTypes = systemTypes;
+ }
+
+ /**
+ * Constructor when there is a subsystem
+ * @param subsystem The subsystem that will resolve the filter string
+ */
+ public SystemSelectRemoteObjectAPIProviderImpl(ISubSystem subsystem)
+ {
+ super();
+ setSubSystem(subsystem);
+ }
+
+ /**
+ * Constructor when there is no subsystem yet
+ * @see #setSubSystem(ISubSystem)
+ */
+ public SystemSelectRemoteObjectAPIProviderImpl()
+ {
+ super();
+ }
+
+ /**
+ * Default or Restrict to a specific connection.
+ * If default mode, it is preselected.
+ * If only mode, it is the only connection listed.
+ * @param connection The connection to default or restrict to
+ * @param onlyMode true if this is to be the only connection shown in the list
+ */
+ public void setSystemConnection(IHost connection, boolean onlyMode)
+ {
+ this.inputConnections = new IHost[] {connection};
+ this.singleConnectionMode = onlyMode;
+ if (onlyMode)
+ multiConnections = false;
+ }
+
+ /**
+ * Change the input subsystem
+ */
+ public void setSubSystem(ISubSystem subsystem)
+ {
+ this.subsystem = subsystem;
+ if (subsystem != null)
+ this.subsystemAdapter = getAdapter(subsystem);
+ else
+ this.subsystemAdapter = null;
+ }
+
+ /**
+ * Set the filter string to use to resolve the inputs.
+ * If this is an absolute filter string, it gets turned into a quick filter string,
+ * so that the user sees it and can expand it. If it is a relative filter string
+ * to apply to all expansions, it is used to decorate all filtering as the user drills down.
+ */
+ public void setFilterString(String string)
+ {
+ // WARNING: ENTERING BIG HUGE HACK AREA!
+ this.filterString = string;
+ filterSuffix = null;
+ if (string == null)
+ return;
+
+ if (string.endsWith(","))
+ {
+ int idx = string.indexOf('/');
+ if (idx == -1)
+ idx = string.indexOf('\\');
+ if (idx == -1)
+ {
+ filterSuffix = string;
+ }
+ }
+
+ if (filterSuffix != null)
+ filterString = null;
+
+ SystemBasePlugin.logDebugMessage(this.getClass().getName(), "*** FILTER SUFFIX = '" + filterSuffix + "' ***");
+ }
+
+ /**
+ * Set the quick filters to be exposed to the user. These will be shown to the
+ * user when they expand a connection.
+ * @see org.eclipse.rse.filters.SystemFilterSimple
+ */
+ public void setQuickFilters(ISystemFilter[] filters)
+ {
+ this.quickFilters = filters;
+ }
+
+ /**
+ * Set child of the first filter to preselect
+ */
+ public void setPreSelectFilterChild(String name)
+ {
+ this.preSelectFilterChild = name;
+ }
+
+ /**
+ * Get the name of the item to select when the first filter is expanded.
+ * Called by the filter adapter.
+ */
+ public String getPreSelectFilterChild()
+ {
+ return preSelectFilterChild;
+ }
+
+ /**
+ * Set actual child object of the first filter to preselect. Called
+ * by the filter adapter once the children are resolved and a match on
+ * the name is found.
+ */
+ public void setPreSelectFilterChildObject(Object obj)
+ {
+ this.preSelectFilterChildObject = obj;
+ }
+
+ /**
+ * Get the actual object of the item to select when the first filter is expanded.
+ * Called by the GUI form after expansion, so it can select this object
+ */
+ public Object getPreSelectFilterChildObject()
+ {
+ return preSelectFilterChildObject;
+ }
+
+ /**
+ * Adorn filter string with any relative attributes requested. Eg "/nf" for folders only
+ */
+ public String decorateFilterString(Object selectedObject, String inputFilterString)
+ {
+ // this is a hack explicitly for the universal file system. We want to propogate "type filters"
+ // like "/nf" and "class," on down the chain, even though we start by showing the user's filters.
+ // When those filters are finally expanded, the filter adapter calls us to do this adornment.
+
+ if (inputFilterString == null)
+ return inputFilterString;
+ else if ((filterSuffix != null) && (inputFilterString.indexOf(filterSuffix)==-1))
+ {
+ SystemBasePlugin.logDebugMessage(this.getClass().getName(), "*** INPUT FILTER = '" + inputFilterString + "' ***");
+ String result = inputFilterString;
+ if (filterSuffix.equals(" /nf"))
+ result = inputFilterString + filterSuffix;
+ else
+ {
+ /** FIXME - can't be coupled with IRemoteFile
+ RemoteFileFilterString rffs =
+ new RemoteFileFilterString((IRemoteFileSubSystemFactory)getSubSystemFactory(selectedObject), inputFilterString);
+ rffs.setFile(filterSuffix);
+ result = rffs.toString();
+ */
+ result = inputFilterString;
+ }
+ SystemBasePlugin.logDebugMessage(this.getClass().getName(), "*** ADORNED FILTER = '" + result + "' ***");
+ return result;
+ }
+ else
+ return inputFilterString;
+ }
+
+ /**
+ * For performance reasons, pre-check to see if filter decoration is even necessary...
+ */
+ public boolean filtersNeedDecoration(Object selectedObject)
+ {
+ ISubSystemConfiguration ssf = getSubSystemFactory(selectedObject);
+ if (ssf == null)
+ return false;
+ /** FIXME - can't be coupled with IRemoteFile
+ return ((ssf instanceof IRemoteFileSubSystemFactory) && (filterSuffix != null));
+ */
+ return false;
+
+ }
+
+ /**
+ * get subsystem factory from filter or filter string
+ */
+ private ISubSystemConfiguration getSubSystemFactory(Object selectedObject)
+ {
+ if (selectedObject instanceof ISystemFilterReference)
+ {
+ ISubSystem ss = (ISubSystem)((ISystemFilterReference)selectedObject).getProvider();
+ return ss.getSubSystemConfiguration();
+ }
+ else if (selectedObject instanceof ISystemFilterStringReference)
+ {
+ ISubSystem ss = (ISubSystem)((ISystemFilterStringReference)selectedObject).getProvider();
+ return ss.getSubSystemConfiguration();
+ }
+ else
+ return null;
+ }
+
+ // ----------------------------------
+ // SYSTEMVIEWINPUTPROVIDER METHODS...
+ // ----------------------------------
+ /**
+ * Return the children objects to consistute the root elements in the system view tree.
+ */
+ public Object[] getSystemViewRoots()
+ {
+ if (listConnectionsMode)
+ return getConnections();
+
+ if (subsystemAdapter == null)
+ {
+ return emptyList;
+ }
+
+ Object[] children = null;
+
+ if (filterString == null)
+ children = subsystemAdapter.getChildren(subsystem);
+ else
+ {
+ children = resolveFilterString(subsystem, filterString);
+ }
+
+ return checkForNull(children, true);
+ }
+
+ /**
+ * Return true if {@link #getSystemViewRoots()} will return a non-empty list
+ */
+ public boolean hasSystemViewRoots()
+ {
+ if (listConnectionsMode)
+ return true;
+ else
+ {
+ boolean hasroots = false;
+ if (subsystemAdapter == null)
+ hasroots = false;
+ else if (filterString != null)
+ hasroots = true;
+ else
+ hasroots = subsystemAdapter.hasChildren(subsystem);
+
+ return hasroots;
+ }
+ }
+
+ /**
+ * This method is called by the connection adapter when the user expands
+ * a connection. This method must return the child objects to show for that
+ * connection.
+ */
+ public Object[] getConnectionChildren(IHost selectedConnection)
+ {
+ if (!listConnectionsMode)
+ return null; // not applicable, never get called
+ else
+ {
+ Object[] children = null;
+ ISubSystem[] subsystems = getSubSystems(selectedConnection);
+
+ if ((subsystems != null) && (subsystems.length > 0))
+ {
+ ISubSystem subsystem = subsystems[0]; // always just use first. Hopefully never a problem!
+
+ if (subsystems.length > 1)
+ SystemBasePlugin.logWarning(this.getClass().getName() + ": More than one subsystem meeting criteria. SSFID = "+subsystemFactoryId+", SSFCat = "+subsystemFactoryCategory);
+
+ if (quickFilters != null)
+ {
+ // DKM - quick filters are only work properly for first subsystem, so for now, I'm only
+ // only going to use them for the initial subsystem
+ //boolean useFilters = false;
+
+ // Phil
+ // 50167: re-using the same filter object for every connection causes
+ // grief, so we have to clone the filter for each connection.
+ if (multiConnections)
+ {
+ // walk through quick filters, and create a clone for each one
+ children = new ISystemFilter[quickFilters.length];
+
+ for (int idx=0; idx
+ * Simply passes the request on to the caller.
+ *
+ * NOT SUPPORTED YET!
+ *
+ * @return the filter created by the user or null if they cancelled the prompting
+ */
+ public ISystemFilter createFilterByPrompting(ISystemFilter filterPrompt, Shell shell)
+ throws Exception
+ {
+ if (caller!=null)
+ return caller.createFilterByPrompting(filterPrompt, shell);
+ else
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableTreeView.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableTreeView.java
new file mode 100644
index 00000000000..d6a6a23a5ff
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableTreeView.java
@@ -0,0 +1,1839 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Vector;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.ICellModifier;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableLayout;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.window.SameShellProvider;
+import org.eclipse.rse.core.SystemAdapterHelpers;
+import org.eclipse.rse.core.SystemBasePlugin;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.SystemPopupMenuActionContributorManager;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.model.IHost;
+import org.eclipse.rse.model.ISystemRegistry;
+import org.eclipse.rse.model.ISystemRemoteChangeEvent;
+import org.eclipse.rse.model.ISystemRemoteChangeEvents;
+import org.eclipse.rse.model.ISystemRemoteChangeListener;
+import org.eclipse.rse.model.ISystemResourceChangeEvent;
+import org.eclipse.rse.model.ISystemResourceChangeEvents;
+import org.eclipse.rse.model.ISystemResourceChangeListener;
+import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.ISystemDeleteTarget;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.ISystemRenameTarget;
+import org.eclipse.rse.ui.SystemMenuManager;
+import org.eclipse.rse.ui.SystemPropertyResources;
+import org.eclipse.rse.ui.actions.ISystemAction;
+import org.eclipse.rse.ui.actions.SystemCommonDeleteAction;
+import org.eclipse.rse.ui.actions.SystemCommonRenameAction;
+import org.eclipse.rse.ui.actions.SystemCommonSelectAllAction;
+import org.eclipse.rse.ui.actions.SystemOpenExplorerPerspectiveAction;
+import org.eclipse.rse.ui.actions.SystemRefreshAction;
+import org.eclipse.rse.ui.actions.SystemRemotePropertiesAction;
+import org.eclipse.rse.ui.actions.SystemShowInTableAction;
+import org.eclipse.rse.ui.actions.SystemSubMenuManager;
+import org.eclipse.rse.ui.messages.ISystemMessageLine;
+import org.eclipse.rse.ui.messages.SystemMessageDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.FileTransfer;
+import org.eclipse.swt.dnd.TextTransfer;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Layout;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeColumn;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.swt.widgets.Widget;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.PropertyDialogAction;
+import org.eclipse.ui.part.EditorInputTransfer;
+import org.eclipse.ui.part.PluginTransfer;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+
+
+/**
+ * This subclass of the standard JFace tabletree viewer is used to
+ * show a generic tabletree view of the selected object
+ *
+ *
+ * TableViewer comes from com.ibm.jface.viewer
+ */
+public class SystemTableTreeView
+// TODO change TreeViewer to TableTreeViewer when Eclipse fixes SWT viewer
+//extends TableTreeViewer
+extends TreeViewer
+implements IMenuListener, ISystemDeleteTarget, ISystemRenameTarget, ISystemSelectAllTarget, ISystemResourceChangeListener, ISystemRemoteChangeListener, ISelectionChangedListener, ISelectionProvider
+{
+
+
+ protected Composite getTableTree()
+ {
+ // TODO - turn back to table tree
+ return getTree();
+ }
+
+ // TODO - turn back into tabletree
+ // inner class to support cell editing - only use with table
+ private ICellModifier cellModifier = new ICellModifier()
+ {
+ public Object getValue(Object element, String property)
+ {
+ ISystemViewElementAdapter adapter = getAdapter(element);
+ adapter.setPropertySourceInput(element);
+ Object value = adapter.getPropertyValue(property);
+ if (value == null)
+ {
+ value = "";
+ }
+ return value;
+ }
+
+ public boolean canModify(Object element, String property)
+ {
+ boolean modifiable = true;
+ return modifiable;
+ }
+
+ public void modify(Object element, String property, Object value)
+ {
+ if (element instanceof TableItem && value != null)
+ {
+ Object obj = ((TableItem) element).getData();
+ ISystemViewElementAdapter adapter = getAdapter(obj);
+ if (adapter != null)
+ {
+ adapter.setPropertyValue(property, value);
+
+ SelectionChangedEvent event = new SelectionChangedEvent(SystemTableTreeView.this, getSelection());
+
+ // fire the event
+ fireSelectionChanged(event);
+ }
+ }
+ }
+ };
+
+ private class HeaderSelectionListener extends SelectionAdapter
+ {
+
+ public HeaderSelectionListener()
+ {
+ _upI = SystemPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_MOVEUP_ID);
+ _downI = SystemPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_MOVEDOWN_ID);
+ }
+
+
+ /**
+ * Handles the case of user selecting the
+ * header area.
+ * If the column has not been selected previously,
+ * it will set the sorter of that column to be
+ * the current table view sorter. Repeated
+ * presses on the same column header will
+ * toggle sorting order (ascending/descending).
+ */
+ public void widgetSelected(SelectionEvent e)
+ {
+ Tree table = getTree();
+ if (!table.isDisposed())
+ {
+ // column selected - need to sort
+ TreeColumn tcolumn = (TreeColumn)e.widget;
+ int column = table.indexOf(tcolumn);
+ SystemTableViewSorter oldSorter = (SystemTableViewSorter) getSorter();
+ if (oldSorter != null && column == oldSorter.getColumnNumber())
+ {
+ oldSorter.setReversed(!oldSorter.isReversed());
+ if (tcolumn.getImage() == _upI)
+ {
+ tcolumn.setImage(_downI);
+ }
+ else
+ {
+ tcolumn.setImage(_upI);
+ }
+ }
+ else
+ {
+ setSorter(new SystemTableViewSorter(column, SystemTableTreeView.this, _columnManager));
+ tcolumn.setImage(_downI);
+ }
+
+ // unset image of other columns
+ TreeColumn[] allColumns = table.getColumns();
+ for (int i = 0; i < allColumns.length; i++)
+ {
+ if (i != column)
+ {
+ if (allColumns[i].getImage() != null)
+ {
+ allColumns[i].setImage(null);
+ }
+ }
+ }
+ refresh();
+ }
+ }
+ }
+ private Object _objectInput;
+ private ArrayList _attributeColumns;
+ private TableLayout _layout;
+ protected SystemTableTreeViewProvider _provider;
+ private HeaderSelectionListener _columnSelectionListener;
+ private SystemTableViewColumnManager _columnManager;
+ private MenuManager _menuManager;
+ private int _charWidth = 3;
+ private SystemTableViewFilter _filter;
+ private IPropertyDescriptor[] _uniqueDescriptors;
+
+ // these variables were copied from SystemView to allow for limited support
+ // of actions. I say limited because somethings don't yet work properly.
+ protected SystemRefreshAction _refreshAction;
+ protected PropertyDialogAction _propertyDialogAction;
+ protected SystemRemotePropertiesAction _remotePropertyDialogAction;
+ protected SystemOpenExplorerPerspectiveAction _openToPerspectiveAction;
+ protected SystemShowInTableAction _showInTableAction;
+
+ // global actions
+ // Note the Edit menu actions are set in SystemViewPart. Here we use these
+ // actions from our own popup menu actions.
+ protected SystemCommonDeleteAction _deleteAction;
+ // for global delete menu item
+ protected SystemCommonRenameAction _renameAction;
+ // for common rename menu item
+ protected SystemCommonSelectAllAction _selectAllAction;
+ // for common Ctrl+A select-all
+
+ protected boolean _selectionShowRefreshAction;
+ protected boolean _selectionShowOpenViewActions;
+ protected boolean _selectionShowDeleteAction;
+ protected boolean _selectionShowRenameAction;
+ protected boolean _selectionEnableDeleteAction;
+ protected boolean _selectionEnableRenameAction;
+
+ protected boolean _selectionIsRemoteObject = true;
+ protected boolean _selectionFlagsUpdated = false;
+
+ private IWorkbenchPart _workbenchPart = null;
+
+ private int[] _lastWidths = null;
+ private ISystemMessageLine _messageLine;
+ protected boolean menuListenerAdded = false;
+
+
+ private static final int LEFT_BUTTON = 1;
+ private int mouseButtonPressed = LEFT_BUTTON;
+
+ private Image _upI;
+ private Image _downI;
+
+
+ /**
+ * Constructor for the table view
+ *
+ */
+ public SystemTableTreeView(Tree tableTree, ISystemMessageLine msgLine)
+ {
+ super(tableTree);
+ _messageLine = msgLine;
+ _attributeColumns = new ArrayList();
+ _layout = new TableLayout();
+
+ _columnManager = new SystemTableViewColumnManager(this);
+ _provider = new SystemTableTreeViewProvider(_columnManager);
+ _columnSelectionListener = new HeaderSelectionListener();
+
+
+ setContentProvider(_provider);
+ setLabelProvider(_provider);
+
+ _filter = new SystemTableViewFilter();
+ addFilter(_filter);
+
+ _charWidth = tableTree.getFont().getFontData()[0].getHeight() / 2;
+ computeLayout();
+
+ _menuManager = new MenuManager("#PopupMenu");
+ _menuManager.setRemoveAllWhenShown(true);
+ _menuManager.addMenuListener(this);
+ Menu menu = _menuManager.createContextMenu(tableTree);
+ tableTree.setMenu(menu);
+
+ addSelectionChangedListener(this);
+
+ SystemPlugin.getTheSystemRegistry().addSystemResourceChangeListener(this);
+ SystemPlugin.getTheSystemRegistry().addSystemRemoteChangeListener(this);
+
+ initDragAndDrop();
+
+ tableTree.setVisible(false);
+ // key listening for delete press
+ getControl().addKeyListener(new KeyAdapter()
+ {
+ public void keyPressed(KeyEvent e)
+ {
+ handleKeyPressed(e);
+ }
+ });
+ getControl().addMouseListener(new MouseAdapter()
+ {
+ public void mouseDown(MouseEvent e)
+ {
+ mouseButtonPressed = e.button; //d40615
+ }
+ });
+ }
+
+ public Layout getLayout()
+ {
+ return _layout;
+ }
+
+ public void setWorkbenchPart(IWorkbenchPart part)
+ {
+ _workbenchPart = part;
+ }
+
+ public void setViewFilters(String[] filter)
+ {
+ if (_filter.getFilters() != filter)
+ {
+ _filter.setFilters(filter);
+ refresh();
+ }
+ }
+
+ public String[] getViewFilters()
+ {
+ return _filter.getFilters();
+ }
+
+ /**
+ * Return the popup menu for the table
+ */
+ public Menu getContextMenu()
+ {
+ return getTableTree().getMenu();
+ }
+ /**
+ * Return the popup menu for the table
+ */
+ public MenuManager getContextMenuManager()
+ {
+ return _menuManager;
+ }
+
+ /**
+ * Called whenever the input for the view changes
+ */
+ public void inputChanged(Object newObject, Object oldObject)
+ {
+ if (newObject instanceof IAdaptable)
+ {
+ getTableTree().setVisible(true);
+ _objectInput = newObject;
+
+ SystemTableTreeViewProvider provider = (SystemTableTreeViewProvider) getContentProvider();
+ Object[] children = provider.getChildren(_objectInput);
+
+ computeLayout();
+
+ // reset the filter
+ setViewFilters(null);
+
+ super.inputChanged(newObject, oldObject);
+
+ }
+ else if (newObject == null)
+ {
+ getTableTree().setVisible(false);
+ _objectInput = null;
+ computeLayout();
+
+ setViewFilters(null);
+ }
+ }
+
+ public Object getInput()
+ {
+ return _objectInput;
+ }
+
+ /**
+ * Convenience method for retrieving the view adapter for an object
+ */
+ protected ISystemViewElementAdapter getAdapter(Object obj)
+ {
+ return SystemAdapterHelpers.getAdapter(obj, this);
+ }
+
+ public SystemTableViewColumnManager getColumnManager()
+ {
+ return _columnManager;
+ }
+
+ private IPropertyDescriptor[] getCustomDescriptors(ISystemViewElementAdapter adapter)
+ {
+ return _columnManager.getVisibleDescriptors(adapter);
+ }
+ /**
+ * Used to determine what the columns should be on the table.
+ */
+ public IPropertyDescriptor[] getVisibleDescriptors(Object object)
+ {
+ SystemTableTreeViewProvider provider = (SystemTableTreeViewProvider) getContentProvider();
+ Object[] children = provider.getChildren(object);
+ return getVisibleDescriptors(children);
+ }
+
+ private IPropertyDescriptor[] getVisibleDescriptors(Object[] children)
+ {
+ if (children != null && children.length > 0)
+ {
+ IAdaptable child = (IAdaptable) children[0];
+ ISystemViewElementAdapter adapter = getAdapter(child);
+ adapter.setPropertySourceInput(child);
+ return getCustomDescriptors(adapter);
+ }
+
+ return new IPropertyDescriptor[0];
+ }
+
+
+
+ public IPropertyDescriptor getNameDescriptor(Object object)
+ {
+ SystemTableTreeViewProvider provider = (SystemTableTreeViewProvider) getContentProvider();
+ Object[] children = provider.getChildren(object);
+ return getNameDescriptor(children);
+ }
+
+ private IPropertyDescriptor getNameDescriptor(Object[] children)
+ {
+ if (children != null && children.length > 0)
+ {
+ IAdaptable child = (IAdaptable) children[0];
+ return getAdapter(child).getPropertyDescriptors()[0];
+ }
+
+ return null;
+ }
+
+ /**
+ * Used to determine the formats of each descriptor.
+ */
+ private ArrayList getFormatsIn()
+ {
+ ArrayList results = new ArrayList();
+ SystemTableTreeViewProvider provider = (SystemTableTreeViewProvider) getContentProvider();
+ Object[] children = provider.getChildren(_objectInput);
+
+ if (children != null && children.length > 0)
+ {
+ IAdaptable child = (IAdaptable) children[0];
+
+ Object adapter = child.getAdapter(ISystemViewElementAdapter.class);
+ if (adapter instanceof ISystemViewElementAdapter)
+ {
+ ISystemViewElementAdapter ad = (ISystemViewElementAdapter) adapter;
+ ad.setPropertySourceInput(child);
+ IPropertyDescriptor[] descriptors = ad.getUniquePropertyDescriptors();
+ for (int i = 0; i < descriptors.length; i++)
+ {
+ IPropertyDescriptor descriptor = descriptors[i];
+
+ try
+ {
+ Object key = descriptor.getId();
+
+ Object propertyValue = ad.getPropertyValue(key, false);
+ results.add(propertyValue.getClass());
+ }
+ catch (Exception e)
+ {
+ results.add(String.class);
+ }
+
+ }
+ }
+ }
+
+ return results;
+ }
+ protected void computeLayout()
+ {
+ computeLayout(false);
+ }
+
+ private boolean sameDescriptors(IPropertyDescriptor[] descriptors1, IPropertyDescriptor[] descriptors2)
+ {
+ if (descriptors1 == null || descriptors2 == null)
+ {
+ return false;
+ }
+ if (descriptors1.length == descriptors2.length)
+ {
+ boolean same = true;
+ for (int i = 0; i < descriptors1.length && same; i++)
+ {
+ same = descriptors1[i] == descriptors2[i];
+ }
+ return same;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ private CellEditor getCellEditor(Tree parent, IPropertyDescriptor descriptor)
+ {
+ CellEditor editor = descriptor.createPropertyEditor(parent);
+ if (editor instanceof SystemInheritableTextCellEditor)
+ {
+ ((SystemInheritableTextCellEditor) editor).getInheritableEntryField().setAllowEditingOfInheritedText(true);
+ }
+
+ return editor;
+ }
+
+ /**
+ * Determines what columns should be shown in this view. The columns may change
+ * anytime the view input changes. The columns in the control are modified and
+ * columns may be added or deleted as necessary to make it conform to the
+ * new data.
+ */
+ public void computeLayout(boolean force)
+ {
+ if (_objectInput == null)
+ return;
+
+ SystemTableTreeViewProvider provider = (SystemTableTreeViewProvider) getContentProvider();
+ Object[] children = provider.getChildren(_objectInput);
+
+ // if no children, don't update
+ if (children == null || children.length == 0)
+ {
+ return;
+ }
+
+ IPropertyDescriptor[] descriptors = getVisibleDescriptors(children);
+ IPropertyDescriptor nameDescriptor = getNameDescriptor(children);
+
+ int n = descriptors.length; // number of columns we need (name column + other columns)
+ if (nameDescriptor != null)
+ n += 1;
+ if (n == 0)
+ return; // there is nothing to lay out!
+
+
+ if (sameDescriptors(descriptors,_uniqueDescriptors) && !force)
+ {
+ setLastColumnWidths(getCurrentColumnWidths());
+ return;
+ }
+ _uniqueDescriptors = descriptors;
+ Tree tree = getTree();
+ if (tree == null || tree.isDisposed())
+ return;
+
+ // set column attributes, create new columns if necessary
+ TreeColumn[] columns = tree.getColumns();
+ int numColumns = columns.length; // number of columns in the control
+ CellEditor editors[] = new CellEditor[n];
+ String headings[] = new String[n];
+ String propertyIds[] = new String[n];
+ ArrayList formats = getFormatsIn();
+
+
+ _layout = new TableLayout();
+ for (int i = 0; i < n; i++)
+ { // for each column
+ String name = null;
+ String propertyId = null;
+ CellEditor editor = null;
+ int alignment = SWT.LEFT;
+ int weight = 100;
+ if (i == 0)
+ {
+ // this is the first column -- treat it special
+ name = SystemPropertyResources.RESID_PROPERTY_NAME_LABEL;
+ propertyId = (String) nameDescriptor.getId();
+ editor = getCellEditor(tree, nameDescriptor);
+ weight = 200;
+ }
+ else
+ { // these columns come from the regular descriptors
+ IPropertyDescriptor descriptor = descriptors[i - 1];
+
+ Class format = (Class) formats.get(i - 1);
+ name = descriptor.getDisplayName();
+ propertyId = (String) descriptor.getId();
+ editor = getCellEditor(tree, descriptor);
+ if (format != String.class)
+ alignment = SWT.RIGHT;
+ }
+ TreeColumn tc = null;
+ if (i >= numColumns)
+ {
+ tc = new TreeColumn(tree, alignment, i);
+ tc.addSelectionListener(_columnSelectionListener);
+
+ }
+ else
+ {
+ tc = columns[i];
+ tc.setAlignment(alignment);
+ }
+ _layout.addColumnData(new ColumnWeightData(weight));
+ tc.setText(name);
+ if (i == 0)
+ {
+ // tc.setImage(_downI);
+ }
+ headings[i] = name;
+ editors[i] = editor;
+ propertyIds[i] = propertyId;
+ }
+ setColumnProperties(propertyIds);
+ setCellEditors(editors);
+ setCellModifier(cellModifier);
+
+ // dispose of any extra columns the tree control may have
+ for (int i = n; i < numColumns; i++)
+ {
+ columns[i].dispose();
+ columns[i] = null;
+ }
+
+ // compute column widths
+ columns = tree.getColumns();
+ numColumns = columns.length;
+ Rectangle clientA = tree.getClientArea();
+ int totalWidth = clientA.width - 5;
+ if (totalWidth <= 0)
+ {
+ // find a default
+ totalWidth = 500;
+ }
+
+
+ int[] lastWidths = getLastColumnWidths();
+ if (numColumns > 1)
+ {
+ // check if previous widths can be used
+ if (lastWidths != null && lastWidths.length == numColumns)
+ {
+
+ // use previously established widths
+ setCurrentColumnWidths(lastWidths);
+ }
+ else
+ {
+ if (totalWidth > 0)
+ {
+ // no previous widths or number of columns has changed - need to calculate
+ int averageWidth = totalWidth / numColumns;
+ int firstWidth = Math.max(averageWidth, 150);
+ averageWidth = (totalWidth - firstWidth) / (numColumns - 1);
+ averageWidth = Math.max(averageWidth, 80);
+ columns[0].setWidth(firstWidth);
+ for (int i = 1; i < numColumns; i++)
+ {
+
+ columns[i].setWidth(averageWidth);
+ }
+ setLastColumnWidths(getCurrentColumnWidths());
+ }
+ }
+ tree.setHeaderVisible(true);
+ }
+ else
+ {
+
+ if (numColumns == 1)
+ {
+ int width = totalWidth;
+ if (lastWidths != null && lastWidths.length == 1)
+ {
+ width = (totalWidth > lastWidths[0]) ? totalWidth : lastWidths[0];
+ }
+
+
+ int maxWidth = provider.getMaxCharsInColumnZero() * _charWidth;
+ if (maxWidth > width)
+ {
+ width = maxWidth;
+ }
+
+ if (width > 0)
+ {
+ columns[0].setWidth(width);
+ }
+ tree.setHeaderVisible(false);
+ }
+ }
+ }
+
+ public int[] getCurrentColumnWidths()
+ {
+ Composite tree = getTableTree();
+
+ return new int[0];
+ }
+
+ public void setCurrentColumnWidths(int[] widths)
+ {
+ Composite tree = getTableTree();
+ }
+
+ public int[] getLastColumnWidths()
+ {
+ return _lastWidths;
+ }
+
+ public void setLastColumnWidths(int[] widths)
+ {
+ _lastWidths = widths;
+ }
+
+ protected void initDragAndDrop()
+ {
+ int ops = DND.DROP_COPY | DND.DROP_MOVE;
+ Transfer[] transfers = new Transfer[] { PluginTransfer.getInstance(), TextTransfer.getInstance(), EditorInputTransfer.getInstance(), FileTransfer.getInstance()};
+
+ addDragSupport(ops, transfers, new SystemViewDataDragAdapter((ISelectionProvider) this));
+ addDropSupport(ops | DND.DROP_DEFAULT, transfers, new SystemViewDataDropAdapter(this));
+ }
+
+ /**
+ * Used to asynchronously update the view whenever properties change.
+ */
+ public void systemResourceChanged(ISystemResourceChangeEvent event)
+ {
+
+ boolean madeChange = false;
+ Object parent = event.getParent();
+ Object child = event.getSource();
+ int eventType = event.getType();
+ switch (eventType)
+ {
+ case ISystemResourceChangeEvents.EVENT_PROPERTY_CHANGE :
+ case ISystemResourceChangeEvents.EVENT_PROPERTYSHEET_UPDATE :
+ {
+ Widget w = findItem(child);
+
+ if (w != null)
+ {
+ updateItem(w, child);
+ }
+ }
+ break;
+ case ISystemResourceChangeEvents.EVENT_ADD :
+ case ISystemResourceChangeEvents.EVENT_ADD_RELATIVE :
+ {
+ boolean addingConnection = (child instanceof IHost);
+ if (_objectInput instanceof ISystemRegistry && addingConnection)
+ {
+ SystemTableTreeViewProvider provider = (SystemTableTreeViewProvider) getContentProvider();
+
+ if (provider != null)
+ {
+ if (!madeChange)
+ {
+ provider.flushCache();
+ madeChange = true;
+ }
+
+ computeLayout();
+ internalRefresh(_objectInput);
+ }
+ }
+ }
+ break;
+ case ISystemResourceChangeEvents.EVENT_REFRESH:
+ {
+ Widget w = findItem(parent);
+ if (w != null)
+ {
+ SystemTableTreeViewProvider provider = (SystemTableTreeViewProvider) getContentProvider();
+ if (!madeChange)
+ {
+ provider.flushCache();
+ madeChange = true;
+ }
+ internalRefresh(parent);
+ }
+ }
+ break;
+ default :
+ break;
+
+ }
+
+ if (child == _objectInput || parent == _objectInput)
+ {
+ SystemTableTreeViewProvider provider = (SystemTableTreeViewProvider) getContentProvider();
+
+ if (provider != null)
+ {
+ if (!madeChange)
+ {
+ provider.flushCache();
+ madeChange = true;
+ }
+
+ computeLayout();
+ try
+ {
+ internalRefresh(_objectInput);
+ }
+ catch (Exception e)
+ {
+ SystemBasePlugin.logError(e.getMessage());
+ }
+ }
+ }
+ }
+
+ /**
+ * This is the method in your class that will be called when a remote resource
+ * changes. You will be called after the resource is changed.
+ * @see org.eclipse.rse.model.ISystemRemoteChangeEvent
+ */
+ public void systemRemoteResourceChanged(ISystemRemoteChangeEvent event)
+ {
+ boolean madeChange = false;
+ int eventType = event.getEventType();
+ Object remoteResourceParent = event.getResourceParent();
+ Object remoteResource = event.getResource();
+ boolean originatedHere = (event.getOriginatingViewer() == this);
+ Vector remoteResourceNames = null;
+ if (remoteResource instanceof Vector)
+ {
+ remoteResourceNames = (Vector) remoteResource;
+ remoteResource = remoteResourceNames.elementAt(0);
+ }
+ String remoteResourceParentName = getRemoteResourceAbsoluteName(remoteResourceParent);
+ String remoteResourceName = getRemoteResourceAbsoluteName(remoteResource);
+ if (remoteResourceName == null)
+ return;
+ SystemTableTreeViewProvider provider = (SystemTableTreeViewProvider) getContentProvider();
+
+ switch (eventType)
+ {
+ // --------------------------
+ // REMOTE RESOURCE CHANGED...
+ // --------------------------
+ case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_CHANGED :
+ {
+ if (remoteResourceParent == getInput())
+ {
+ Widget w = findItem(remoteResource);
+ if (w != null)
+ {
+ updateItem(w, remoteResource);
+ }
+
+ }
+ }
+ break;
+
+ // --------------------------
+ // REMOTE RESOURCE CREATED...
+ // --------------------------
+ case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_CREATED :
+ {
+ String inputResourceName = getRemoteResourceAbsoluteName(getInput());
+ if (remoteResourceParentName != null && remoteResourceParentName.equals(inputResourceName))
+ {
+ if (provider == null)
+ {
+ return;
+ }
+ if (!madeChange)
+ {
+ provider.flushCache();
+ madeChange = true;
+ }
+
+ refresh();
+ }
+ }
+ break;
+
+ // --------------------------
+ // REMOTE RESOURCE DELETED...
+ // --------------------------
+ case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_DELETED :
+ {
+ {
+ Object dchild = remoteResource;
+
+ ISystemViewElementAdapter dadapt = getAdapter(dchild);
+ if (dadapt != null)
+ {
+ ISubSystem dSubSystem = dadapt.getSubSystem(dchild);
+ String dkey = dadapt.getAbsoluteName(dchild);
+
+ if (provider != null)
+ {
+ Object[] children = provider.getChildren(_objectInput);
+ for (int i = 0; i < children.length; i++)
+ {
+ Object existingChild = children[i];
+ if (existingChild != null)
+ {
+ ISystemViewElementAdapter eadapt = getAdapter(existingChild);
+ ISubSystem eSubSystem = eadapt.getSubSystem(existingChild);
+
+ if (dSubSystem == eSubSystem)
+ {
+ String ekey = eadapt.getAbsoluteName(existingChild);
+ if (ekey.equals(dkey))
+ {
+ if (!madeChange)
+ {
+ provider.flushCache();
+ madeChange = true;
+
+ // do a full refresh
+ refresh();
+ }
+ }
+ }
+
+ }
+ }
+ }
+ }
+ }
+
+ }
+ break;
+
+ // --------------------------
+ // REMOTE RESOURCE RENAMED...
+ // --------------------------
+ case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_RENAMED :
+ {
+ String oldName = event.getOldName();
+ Object child = event.getResource();
+
+ if (provider != null)
+ {
+ Object[] previousResults = provider.getCache();
+ if (previousResults != null)
+ {
+ for (int i = 0; i < previousResults.length; i++)
+ {
+ Object previousResult = previousResults[i];
+
+ if (previousResult == child)
+ {
+ Widget widget = findItem(previousResult);
+ if (widget != null)
+ {
+ widget.setData(child);
+ updateItem(widget, child);
+ return;
+ }
+ }
+ else
+ {
+ String previousName = getAdapter(previousResult).getAbsoluteName(previousResult);
+
+ if (previousName != null && previousName.equals(oldName))
+ {
+ provider.flushCache();
+ internalRefresh(_objectInput);
+ return;
+ }
+ }
+ }
+
+ }
+ }
+ }
+
+ break;
+ }
+ }
+
+ /**
+ * Turn a given remote object reference into a fully qualified absolute name
+ */
+ private String getRemoteResourceAbsoluteName(Object remoteResource)
+ {
+ if (remoteResource == null)
+ return null;
+ String remoteResourceName = null;
+ if (remoteResource instanceof String)
+ remoteResourceName = (String) remoteResource;
+ else
+ {
+ ISystemRemoteElementAdapter ra = getRemoteAdapter(remoteResource);
+ if (ra == null)
+ return null;
+ remoteResourceName = ra.getAbsoluteName(remoteResource);
+ }
+ return remoteResourceName;
+ }
+
+ public void selectionChanged(SelectionChangedEvent event)
+ {
+ _selectionFlagsUpdated = false;
+ IStructuredSelection sel = (IStructuredSelection)event.getSelection();
+ Object firstSelection = sel.getFirstElement();
+ if (firstSelection == null)
+ return;
+
+ _selectionFlagsUpdated = false;
+ ISystemViewElementAdapter adapter = getAdapter(firstSelection);
+ if (adapter != null)
+ {
+ displayMessage(adapter.getStatusLineText(firstSelection));
+ if ((mouseButtonPressed == LEFT_BUTTON))
+ adapter.selectionChanged(firstSelection);
+ }
+ else
+ clearMessage();
+ }
+
+ public void dispose()
+ {
+ removeAsListener();
+
+ Composite tree = getTableTree();
+
+ boolean isDisposed = tree.isDisposed();
+
+ // dispose control if not disposed
+ if (!isDisposed) {
+ tree.dispose();
+ }
+ }
+
+ /**
+ * Display a message/status on the message/status line
+ */
+ public void displayMessage(String msg)
+ {
+ if (_messageLine != null)
+ _messageLine.setMessage(msg);
+ }
+
+ /**
+ * Convenience method for retrieving the view adapter for an object's children
+ */
+ public ISystemViewElementAdapter getAdapterForContents()
+ {
+ SystemTableTreeViewProvider provider = (SystemTableTreeViewProvider) getContentProvider();
+ Object[] children = provider.getChildren(getInput());
+ if (children != null && children.length > 0)
+ {
+ IAdaptable child = (IAdaptable) children[0];
+ return getAdapter(child);
+ }
+ return null;
+ }
+
+ /**
+ * Clear message/status shown on the message/status line
+ */
+ public void clearMessage()
+ {
+ if (_messageLine != null)
+ _messageLine.clearMessage();
+ }
+
+ /**
+ * Remove as listener.
+ */
+ public void removeAsListener() {
+
+ // remove listeners
+ removeSelectionChangedListener(this);
+ SystemPlugin.getTheSystemRegistry().removeSystemResourceChangeListener(this);
+ SystemPlugin.getTheSystemRegistry().removeSystemRemoteChangeListener(this);
+
+ Composite tree = getTableTree();
+
+ boolean isDisposed = tree.isDisposed();
+
+ }
+
+
+
+ /**
+ * Rather than pre-defining this common action we wait until it is first needed,
+ * for performance reasons.
+ */
+ protected PropertyDialogAction getPropertyDialogAction()
+ {
+ if (_propertyDialogAction == null)
+ {
+ _propertyDialogAction = new PropertyDialogAction(new SameShellProvider(getShell()), this);
+ //propertyDialogAction.setToolTipText(" ");
+ }
+ _propertyDialogAction.selectionChanged(getSelection());
+ return _propertyDialogAction;
+ }
+ /**
+ * Rather than pre-defining this common action we wait until it is first needed,
+ * for performance reasons.
+ */
+ protected SystemRemotePropertiesAction getRemotePropertyDialogAction()
+ {
+ if (_remotePropertyDialogAction == null)
+ {
+ _remotePropertyDialogAction = new SystemRemotePropertiesAction(getShell());
+ }
+ _remotePropertyDialogAction.setSelection(getSelection());
+ return _remotePropertyDialogAction;
+ }
+ /**
+ * Return the select All action
+ */
+ protected IAction getSelectAllAction()
+ {
+ if (_selectAllAction == null)
+ _selectAllAction = new SystemCommonSelectAllAction(getShell(), this, this);
+ return _selectAllAction;
+ }
+
+ /**
+ * Rather than pre-defined this common action we wait until it is first needed,
+ * for performance reasons.
+ */
+ protected IAction getRenameAction()
+ {
+ if (_renameAction == null)
+ _renameAction = new SystemCommonRenameAction(getShell(), this);
+ return _renameAction;
+ }
+ /**
+ * Rather than pre-defined this common action we wait until it is first needed,
+ * for performance reasons.
+ */
+ protected IAction getDeleteAction()
+ {
+ if (_deleteAction == null)
+ _deleteAction = new SystemCommonDeleteAction(getShell(), this);
+ return _deleteAction;
+ }
+
+ /**
+ * Return the refresh action
+ */
+ protected IAction getRefreshAction()
+ {
+ if (_refreshAction == null)
+ _refreshAction = new SystemRefreshAction(getShell());
+ return _refreshAction;
+ }
+ /*
+ * Get the common "Open to->" action for opening a new Remote Systems Explorer view,
+ * scoped to the currently selected object.
+ *
+ protected SystemCascadingOpenToAction getOpenToAction()
+ {
+ if (openToAction == null)
+ openToAction = new SystemCascadingOpenToAction(getShell(),getWorkbenchWindow());
+ return openToAction;
+ } NOT USED YET */
+ /**
+ * Get the common "Open to->" action for opening a new Remote Systems Explorer view,
+ * scoped to the currently selected object.
+ */
+ protected SystemOpenExplorerPerspectiveAction getOpenToPerspectiveAction()
+ {
+ if (_openToPerspectiveAction == null)
+ {
+ IWorkbench desktop = PlatformUI.getWorkbench();
+ IWorkbenchWindow win = desktop.getActiveWorkbenchWindow();
+
+ _openToPerspectiveAction = new SystemOpenExplorerPerspectiveAction(getShell(), win);
+ }
+ //getWorkbenchWindow());
+ return _openToPerspectiveAction;
+ }
+
+ protected SystemShowInTableAction getShowInTableAction()
+ {
+ if (_showInTableAction == null)
+ {
+ _showInTableAction = new SystemShowInTableAction(getShell());
+ }
+ //getWorkbenchWindow());
+ return _showInTableAction;
+ }
+
+ public Shell getShell()
+ {
+ return getTableTree().getShell();
+ }
+
+ /**
+ * Required method from ISystemDeleteTarget.
+ * Decides whether to even show the delete menu item.
+ * Assumes scanSelections() has already been called
+ */
+ public boolean showDelete()
+ {
+ if (!_selectionFlagsUpdated)
+ scanSelections();
+ return _selectionShowDeleteAction;
+ }
+ /**
+ * Required method from ISystemDeleteTarget
+ * Decides whether to enable the delete menu item.
+ * Assumes scanSelections() has already been called
+ */
+ public boolean canDelete()
+ {
+ if (!_selectionFlagsUpdated)
+ scanSelections();
+ return _selectionEnableDeleteAction;
+ }
+
+ /*
+ * Required method from ISystemDeleteTarget
+ */
+ public boolean doDelete(IProgressMonitor monitor)
+ {
+ ISystemRegistry sr = SystemPlugin.getDefault().getSystemRegistry();
+ IStructuredSelection selection = (IStructuredSelection) getSelection();
+ Iterator elements = selection.iterator();
+ //int selectedCount = selection.size();
+ //Object multiSource[] = new Object[selectedCount];
+ //int idx = 0;
+ Object element = null;
+ //Object parentElement = getSelectedParent();
+ ISystemViewElementAdapter adapter = null;
+ boolean ok = true;
+ boolean anyOk = false;
+ Vector deletedVector = new Vector();
+ try
+ {
+ while (ok && elements.hasNext())
+ {
+ element = elements.next();
+ //multiSource[idx++] = element;
+ adapter = getAdapter(element);
+ ok = adapter.doDelete(getShell(), element, monitor);
+ if (ok)
+ {
+ anyOk = true;
+ deletedVector.addElement(element);
+ }
+ }
+ }
+ catch (SystemMessageException exc)
+ {
+ SystemMessageDialog.displayErrorMessage(getShell(), exc.getSystemMessage());
+ ok = false;
+ }
+ catch (Exception exc)
+ {
+ String msg = exc.getMessage();
+ if ((msg == null) || (exc instanceof ClassCastException))
+ msg = exc.getClass().getName();
+ SystemMessageDialog.displayErrorMessage(getShell(), SystemPlugin.getPluginMessage(ISystemMessages.MSG_EXCEPTION_DELETING).makeSubstitution(element, msg));
+ ok = false;
+ }
+ if (anyOk)
+ {
+ Object[] deleted = new Object[deletedVector.size()];
+ for (int idx = 0; idx < deleted.length; idx++)
+ deleted[idx] = deletedVector.elementAt(idx);
+ if (_selectionIsRemoteObject)
+ //sr.fireEvent(new com.ibm.etools.systems.model.impl.SystemResourceChangeEvent(deleted, ISystemResourceChangeEvent.EVENT_DELETE_REMOTE_MANY, null));
+ sr.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_DELETED, deletedVector, null, null, null, this);
+ else
+ sr.fireEvent(new org.eclipse.rse.model.SystemResourceChangeEvent(deleted, ISystemResourceChangeEvents.EVENT_DELETE_MANY, getInput()));
+ }
+ return ok;
+ }
+
+ // ---------------------------
+ // ISYSTEMRENAMETARGET METHODS
+ // ---------------------------
+
+ /**
+ * Required method from ISystemRenameTarget.
+ * Decides whether to even show the rename menu item.
+ * Assumes scanSelections() has already been called
+ */
+ public boolean showRename()
+ {
+ if (!_selectionFlagsUpdated)
+ scanSelections();
+ return _selectionShowRenameAction;
+ }
+ /**
+ * Required method from ISystemRenameTarget
+ * Decides whether to enable the rename menu item.
+ * Assumes scanSelections() has already been called
+ */
+ public boolean canRename()
+ {
+ if (!_selectionFlagsUpdated)
+ scanSelections();
+ return _selectionEnableRenameAction;
+ }
+
+ // default implementation
+ // in default table, parent is input
+ protected Object getParentForContent(Object element)
+ {
+ return _objectInput;
+ }
+
+ /**
+ * Required method from ISystemRenameTarget
+ */
+ public boolean doRename(String[] newNames)
+ {
+ ISystemRegistry sr = SystemPlugin.getDefault().getSystemRegistry();
+ IStructuredSelection selection = (IStructuredSelection) getSelection();
+ Iterator elements = selection.iterator();
+ int selectedCount = selection.size();
+ Object element = null;
+
+ ISystemViewElementAdapter adapter = null;
+ ISystemRemoteElementAdapter remoteAdapter = null;
+ String oldFullName = null;
+ boolean ok = true;
+ try
+ {
+ int nameIdx = 0;
+ while (ok && elements.hasNext())
+ {
+ element = elements.next();
+ adapter = getAdapter(element);
+ Object parentElement = getParentForContent(element);
+
+ remoteAdapter = getRemoteAdapter(element);
+ if (remoteAdapter != null)
+ oldFullName = remoteAdapter.getAbsoluteName(element);
+ // pre-rename
+ ok = adapter.doRename(getShell(), element, newNames[nameIdx++]);
+ if (ok)
+ {
+ if (remoteAdapter != null) {
+ sr.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_RENAMED, element, parentElement, remoteAdapter.getSubSystem(element), oldFullName, this);
+ }
+ else {
+ sr.fireEvent(new org.eclipse.rse.model.SystemResourceChangeEvent(element, ISystemResourceChangeEvents.EVENT_RENAME, parentElement));
+ }
+ }
+ }
+ }
+ catch (SystemMessageException exc)
+ {
+ SystemMessageDialog.displayErrorMessage(getShell(), exc.getSystemMessage());
+ ok = false;
+ }
+ catch (Exception exc)
+ {
+ //String msg = exc.getMessage();
+ //if ((msg == null) || (exc instanceof ClassCastException))
+ // msg = exc.getClass().getName();
+ SystemMessageDialog.displayErrorMessage(getShell(), SystemPlugin.getPluginMessage(ISystemMessages.MSG_EXCEPTION_RENAMING).makeSubstitution(element, exc),
+ //msg),
+ exc);
+ ok = false;
+ }
+ return ok;
+ }
+
+ /**
+ * Returns the implementation of ISystemRemoteElement for the given
+ * object. Returns null if this object does not adaptable to this.
+ */
+ protected ISystemRemoteElementAdapter getRemoteAdapter(Object o)
+ {
+ ISystemRemoteElementAdapter adapter = null;
+ if (!(o instanceof IAdaptable))
+ adapter = (ISystemRemoteElementAdapter) Platform.getAdapterManager().getAdapter(o, ISystemRemoteElementAdapter.class);
+ else
+ adapter = (ISystemRemoteElementAdapter) ((IAdaptable) o).getAdapter(ISystemRemoteElementAdapter.class);
+ if ((adapter != null) && (adapter instanceof ISystemViewElementAdapter))
+ ((ISystemViewElementAdapter) adapter).setViewer(this);
+ return adapter;
+ }
+
+ /**
+ * Return true if select all should be enabled for the given object.
+ * For a tree view, you should return true if and only if the selected object has children.
+ * You can use the passed in selection or ignore it and query your own selection.
+ */
+ public boolean enableSelectAll(IStructuredSelection selection)
+ {
+ return true;
+ }
+ /**
+ * When this action is run via Edit->Select All or via Ctrl+A, perform the
+ * select all action. For a tree view, this should select all the children
+ * of the given selected object. You can use the passed in selected object
+ * or ignore it and query the selected object yourself.
+ */
+ public void doSelectAll(IStructuredSelection selection)
+ {
+
+ Composite tree = getTableTree();
+
+ Tree theTree = (Tree) tree;
+ theTree.setSelection(theTree.getItems());
+ TreeItem[] items = theTree.getItems();
+ Object[] objects = new Object[items.length];
+ for (int idx = 0; idx < items.length; idx++)
+ objects[idx] = items[idx].getData();
+ fireSelectionChanged(new SelectionChangedEvent(this, new StructuredSelection(objects)));
+
+ }
+
+ public void menuAboutToShow(IMenuManager manager)
+ {
+ SystemView.createStandardGroups(manager);
+
+ if (!menuListenerAdded)
+ {
+ if (manager instanceof MenuManager)
+ {
+ Menu m = ((MenuManager)manager).getMenu();
+ if (m != null)
+ {
+ menuListenerAdded = true;
+ SystemViewMenuListener ml = new SystemViewMenuListener();
+ if (_messageLine != null)
+ ml.setShowToolTipText(true, _messageLine);
+ m.addMenuListener(ml);
+ }
+ }
+ }
+ fillContextMenu(manager);
+ }
+
+ public ISelection getSelection()
+ {
+ ISelection selection = super.getSelection();
+ if (selection == null || selection.isEmpty())
+ {
+ // make the selection the parent
+ ArrayList list = new ArrayList();
+ if (_objectInput != null)
+ {
+ list.add(_objectInput);
+ selection = new StructuredSelection(list);
+ }
+ }
+
+ return selection;
+ }
+
+ public void fillContextMenu(IMenuManager menu) {
+
+ IStructuredSelection selection = (IStructuredSelection) getSelection();
+
+ boolean allSelectionsFromSameParent = true;
+ int selectionCount = selection.size();
+
+
+
+ if (selectionCount == 0) // nothing selected
+ {
+ return;
+ }
+ else
+ {
+
+ if (selectionCount == 1) {
+
+ if (selection.getFirstElement() == getInput()) {
+ //return;
+ }
+ }
+
+ if (selectionCount > 1)
+ {
+ allSelectionsFromSameParent = sameParent();
+
+ if (!allSelectionsFromSameParent)
+ {
+ if (selectionHasAncestryRelationship())
+ {
+ // don't show the menu because actions with
+ // multiple select on objects that are ancestors
+ // of each other is problematic
+ // still create the standard groups
+ SystemView.createStandardGroups(menu);
+ return;
+ }
+ }
+ }
+
+ // Partition into groups...
+ SystemView.createStandardGroups(menu);
+
+ // ADD COMMON ACTIONS...
+
+ // COMMON RENAME ACTION...
+ if (canRename())
+ {
+ if (showRename())
+ menu.appendToGroup(ISystemContextMenuConstants.GROUP_REORGANIZE, getRenameAction());
+ }
+
+ // ADAPTER SPECIFIC ACTIONS
+ SystemMenuManager ourMenu = new SystemMenuManager(menu);
+
+ Iterator elements = selection.iterator();
+ Hashtable adapters = new Hashtable();
+ while (elements.hasNext())
+ {
+ Object element = elements.next();
+ ISystemViewElementAdapter adapter = getAdapter(element);
+ adapters.put(adapter, element); // want only unique adapters
+ }
+ Enumeration uniqueAdapters = adapters.keys();
+ Shell shell = getShell();
+ while (uniqueAdapters.hasMoreElements())
+ {
+ ISystemViewElementAdapter nextAdapter = (ISystemViewElementAdapter) uniqueAdapters.nextElement();
+ nextAdapter.addActions(ourMenu, selection, shell, ISystemContextMenuConstants.GROUP_ADAPTERS);
+
+ if (nextAdapter instanceof AbstractSystemViewAdapter)
+ {
+
+ AbstractSystemViewAdapter aVA = (AbstractSystemViewAdapter)nextAdapter;
+ // add remote actions
+ aVA.addCommonRemoteActions(ourMenu, selection, shell, ISystemContextMenuConstants.GROUP_ADAPTERS);
+
+ // add dynamic menu popups
+ aVA.addDynamicPopupMenuActions(ourMenu, selection, shell, ISystemContextMenuConstants.GROUP_ADDITIONS);
+ }
+ }
+
+ // wail through all actions, updating shell and selection
+ IContributionItem[] items = menu.getItems();
+ for (int idx = 0; idx < items.length; idx++)
+ {
+ if ((items[idx] instanceof ActionContributionItem) && (((ActionContributionItem) items[idx]).getAction() instanceof ISystemAction))
+ {
+ ISystemAction item = (ISystemAction) (((ActionContributionItem) items[idx]).getAction());
+ item.setInputs(getShell(), this, selection);
+ }
+ else if (items[idx] instanceof SystemSubMenuManager)
+ {
+ SystemSubMenuManager item = (SystemSubMenuManager) items[idx];
+ item.setInputs(getShell(), this, selection);
+ }
+ }
+
+ // COMMON DELETE ACTION...
+ if (canDelete() && showDelete())
+ {
+ //menu.add(getDeleteAction());
+ menu.appendToGroup(ISystemContextMenuConstants.GROUP_REORGANIZE, getDeleteAction());
+ ((ISystemAction) getDeleteAction()).setInputs(getShell(), this, selection);
+ menu.add(new Separator());
+ }
+
+ // PROPERTIES ACTION...
+ // This is supplied by the system, so we pretty much get it for free. It finds the
+ // registered propertyPages extension points registered for the selected object's class type.
+ //propertyDialogAction.selectionChanged(selection);
+
+ if (!_selectionIsRemoteObject) // is not a remote object
+ {
+ PropertyDialogAction pdAction = getPropertyDialogAction();
+ if (pdAction.isApplicableForSelection())
+ {
+
+ menu.appendToGroup(ISystemContextMenuConstants.GROUP_PROPERTIES, pdAction);
+ }
+ // OPEN IN NEW PERSPECTIVE ACTION... if (fromSystemViewPart && showOpenViewActions())
+ {
+ //SystemCascadingOpenToAction openToAction = getOpenToAction();
+ SystemOpenExplorerPerspectiveAction openToPerspectiveAction = getOpenToPerspectiveAction();
+ SystemShowInTableAction showInTableAction = getShowInTableAction();
+ openToPerspectiveAction.setSelection(selection);
+ showInTableAction.setSelection(selection);
+ //menu.appendToGroup(ISystemContextMenuConstants.GROUP_OPEN, openToAction.getSubMenu());
+ menu.appendToGroup(ISystemContextMenuConstants.GROUP_OPEN, openToPerspectiveAction);
+ menu.appendToGroup(ISystemContextMenuConstants.GROUP_OPEN, showInTableAction);
+
+ }
+ }
+ else // is a remote object
+ {
+ //Object firstSelection = selection.getFirstElement();
+ //ISystemRemoteElementAdapter remoteAdapter = getRemoteAdapter(firstSelection);
+ //logMyDebugMessage(this.getClass().getName(), ": there is a remote adapter");
+ SystemRemotePropertiesAction pdAction = getRemotePropertyDialogAction();
+ if (pdAction.isApplicableForSelection())
+ menu.appendToGroup(ISystemContextMenuConstants.GROUP_PROPERTIES, pdAction);
+ //else
+ //logMyDebugMessage(this.getClass().getName(), ": but it is not applicable for selection");
+ // --------------------------------------------------------------------------------------------------------------------
+ // look for and add any popup menu actions registered via our org.eclipse.rse.core.popupMenus extension point...
+ // --------------------------------------------------------------------------------------------------------------------
+ if (_workbenchPart != null)
+ {
+ SystemPopupMenuActionContributorManager.getManager().contributeObjectActions(_workbenchPart, ourMenu, this, null);
+ }
+ }
+
+ }
+ }
+
+ /**
+ * This is called to ensure all elements in a multiple-selection have the same parent in the
+ * tree viewer. If they don't we automatically disable all actions.
+ *
+ * Designed to be as fast as possible by going directly to the SWT widgets
+ */
+ public boolean sameParent()
+ {
+ boolean same = true;
+
+ Tree tree = getTree();
+
+ TreeItem[] items = tree.getSelection();
+
+ if ((items == null) || (items.length ==0)) {
+ return true;
+ }
+
+ TreeItem prevParent = null;
+ TreeItem currParent = null;
+
+ for (int idx = 0; idx < items.length; idx++)
+ {
+ currParent = items[idx].getParentItem();
+
+ if ((idx>0) && (currParent != prevParent)) {
+ same = false;
+ break;
+ }
+ else
+ {
+ prevParent = currParent;
+ }
+ }
+ return same;
+ }
+
+ private boolean selectionHasAncestryRelationship() {
+ Tree tree = getTree();
+
+ TreeItem[] items = tree.getSelection();
+
+ for (int idx=0; idx
+ * Walking this list multiple times while building the popup menu is a performance
+ * hit, so we have this common method that does it only once, setting instance
+ * variables for all of the decisions we are in interested in.
+ * --------------------------------------------------------------------------------
+ */
+ protected void scanSelections()
+ {
+ // initial these variables to true. Then if set to false even once, leave as false always...
+ _selectionShowRefreshAction = true;
+ _selectionShowOpenViewActions = true;
+ _selectionShowDeleteAction = true;
+ _selectionShowRenameAction = true;
+ _selectionEnableDeleteAction = true;
+ _selectionEnableRenameAction = true;
+ _selectionIsRemoteObject = true;
+ _selectionFlagsUpdated = true;
+
+ IStructuredSelection selection = (IStructuredSelection) getSelection();
+ Iterator elements = selection.iterator();
+ while (elements.hasNext())
+ {
+ Object element = elements.next();
+ ISystemViewElementAdapter adapter = getAdapter(element);
+
+ if (_selectionShowRefreshAction)
+ _selectionShowRefreshAction = adapter.showRefresh(element);
+
+ if (_selectionShowOpenViewActions)
+ _selectionShowOpenViewActions = adapter.showOpenViewActions(element);
+
+ if (_selectionShowDeleteAction)
+ _selectionShowDeleteAction = adapter.showDelete(element);
+
+ if (_selectionShowRenameAction)
+ _selectionShowRenameAction = adapter.showRename(element);
+
+ if (_selectionEnableDeleteAction)
+ _selectionEnableDeleteAction = _selectionShowDeleteAction && adapter.canDelete(element);
+ //System.out.println("ENABLE DELETE SET TO " + selectionEnableDeleteAction);
+
+ if (_selectionEnableRenameAction)
+ _selectionEnableRenameAction = _selectionShowRenameAction && adapter.canRename(element);
+
+ if (_selectionIsRemoteObject)
+ _selectionIsRemoteObject = (getRemoteAdapter(element) != null);
+ }
+
+ }
+
+ public void positionTo(String name)
+ {
+ ArrayList selectedItems = new ArrayList();
+ Composite tree = getTableTree();
+ }
+
+ protected void handleKeyPressed(KeyEvent event)
+ {
+ if ((event.character == SWT.DEL) && (event.stateMask == 0) && (((IStructuredSelection) getSelection()).size() > 0))
+ {
+ scanSelections();
+ if (showDelete() && canDelete())
+ {
+ SystemCommonDeleteAction dltAction = (SystemCommonDeleteAction) getDeleteAction();
+ dltAction.setShell(getShell());
+ dltAction.setSelection(getSelection());
+ dltAction.setViewer(this);
+ dltAction.run();
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableTreeViewProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableTreeViewProvider.java
new file mode 100644
index 00000000000..c003c0f499c
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableTreeViewProvider.java
@@ -0,0 +1,343 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.util.ListenerList;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.rse.core.SystemAdapterHelpers;
+import org.eclipse.rse.model.ISystemContainer;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+
+
+/**
+ * This is the content and label provider for the SystemTableTreeView.
+ * This class is used both to populate the SystemTableTreeView but also
+ * to resolve the icon and labels for the cells in the table/tree.
+ *
+ */
+public class SystemTableTreeViewProvider implements ILabelProvider, ITableLabelProvider, ITreeContentProvider
+{
+
+
+ private ListenerList listeners = new ListenerList(1);
+
+ protected Object[] _lastResults = null;
+ protected Object _lastObject = null;
+ protected SimpleDateFormat _dateFormat = new SimpleDateFormat();
+ protected Viewer _viewer = null;
+ protected int _maxCharsInColumnZero = 0;
+
+ /**
+ * The cache of images that have been dispensed by this provider.
+ * Maps ImageDescriptor->Image.
+ */
+ private Map imageTable = new Hashtable(40);
+ private SystemTableViewColumnManager _columnManager;
+ private HashMap cache;
+ /**
+ * Constructor for table view provider where a column manager is present.
+ * In this case, the columns are customizable by the user.
+ * @param columnManager
+ */
+ public SystemTableTreeViewProvider(SystemTableViewColumnManager columnManager)
+ {
+ super();
+ _columnManager= columnManager;
+ cache = new HashMap();
+ }
+
+ public void inputChanged(Viewer visualPart, Object oldInput, Object newInput)
+ {
+ _viewer = visualPart;
+ }
+
+ public void setCache(Object[] newCache)
+ {
+ _lastResults = newCache;
+ }
+
+ public Object[] getCache()
+ {
+ return _lastResults;
+ }
+
+ public boolean flushCache()
+ {
+ if (_lastResults == null)
+ {
+ return false;
+ }
+ if (_lastObject instanceof ISystemContainer)
+ {
+ ((ISystemContainer)_lastObject).markStale(true);
+ }
+
+ _lastResults = null;
+ return true;
+ }
+
+ public boolean isDeleted(Object element)
+ {
+ return false;
+ }
+
+ public Object[] getChildren(Object object)
+ {
+ return getElements(object);
+ }
+
+ public Object getParent(Object object)
+ {
+ return getAdapterFor(object).getParent(object);
+ }
+
+ public boolean hasChildren(Object object)
+ {
+ return getAdapterFor(object).hasChildren(object);
+
+ }
+
+ public Object getElementAt(Object object, int i)
+ {
+
+ return null;
+ }
+
+
+
+ protected ISystemViewElementAdapter getAdapterFor(Object object)
+ {
+ ISystemViewElementAdapter result = null;
+ if (_viewer != null)
+ {
+ result = SystemAdapterHelpers.getAdapter(object, _viewer);
+ }
+ else
+ {
+ result = SystemAdapterHelpers.getAdapter(object);
+ }
+ result.setPropertySourceInput(object);
+ return result;
+ }
+
+ public Object[] getElements(Object object)
+ {
+ Object[] results = null;
+ if (object == _lastObject && _lastResults != null)
+ {
+ return _lastResults;
+ }
+ else
+ if (object instanceof IAdaptable)
+ {
+ ISystemViewElementAdapter adapter = getAdapterFor(object);
+ adapter.setViewer(_viewer);
+ if (adapter != null && adapter.hasChildren(object))
+ {
+ results = adapter.getChildren(object);
+ if (adapter instanceof SystemViewRootInputAdapter)
+ {
+ ArrayList filterredResults = new ArrayList();
+ for (int i = 0; i < results.length; i++)
+ {
+ Object result = results[i];
+ ISystemViewElementAdapter cadapter = getAdapterFor(result);
+ if (!(cadapter instanceof SystemViewPromptableAdapter))
+ {
+ filterredResults.add(result);
+ }
+ }
+ results = filterredResults.toArray();
+ }
+
+ _lastResults = results;
+ _lastObject = object;
+ }
+ }
+ if (results == null)
+ {
+ return new Object[0];
+ }
+
+ return results;
+ }
+
+
+ public String getText(Object object)
+ {
+ String result = getAdapterFor(object).getText(object);
+ int len = result.length();
+ if (len > _maxCharsInColumnZero)
+ {
+ _maxCharsInColumnZero = len;
+ }
+ return result;
+ }
+
+ public int getMaxCharsInColumnZero()
+ {
+ return _maxCharsInColumnZero;
+ }
+
+ public Image getImage(Object object)
+ {
+
+ ImageDescriptor descriptor = getAdapterFor(object).getImageDescriptor(object);
+
+ Image image = null;
+ if (descriptor != null)
+ {
+ Object iobj = imageTable.get(descriptor);
+ if (iobj == null)
+ {
+ image = descriptor.createImage();
+ imageTable.put(descriptor, image);
+ }
+ else
+ {
+ image = (Image) iobj;
+ }
+ }
+
+ return image;
+ }
+
+
+ public String getColumnText(Object obj, int index)
+ {
+ if (index == 0)
+ {
+ // get the first descriptor
+ return getText(obj);
+ }
+ else
+ {
+
+ index = index - 1;
+ ISystemViewElementAdapter adapter = getAdapterFor(obj);
+
+ IPropertyDescriptor[] descriptors = null;
+ if (_columnManager != null)
+ {
+ descriptors = _columnManager.getVisibleDescriptors(adapter);
+ }
+ else
+ {
+ descriptors = adapter.getUniquePropertyDescriptors();
+ }
+
+ if (descriptors.length > index)
+ {
+ IPropertyDescriptor descriptor = descriptors[index];
+
+ try
+ {
+ Object key = descriptor.getId();
+
+ Object propertyValue = adapter.getPropertyValue(key);
+
+ if (propertyValue instanceof String)
+ {
+ return (String) propertyValue;
+ }
+ else if (propertyValue instanceof Date)
+ {
+ return _dateFormat.format((Date)propertyValue);
+ }
+ else
+ if (propertyValue != null)
+ {
+ return propertyValue.toString();
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ return "";
+ }
+
+ }
+
+ public Image getColumnImage(Object obj, int i)
+ {
+ if (i == 0)
+ {
+ return getImage(obj);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public void addListener(ILabelProviderListener listener)
+ {
+ listeners.add(listener);
+ }
+
+ public boolean isLabelProperty(Object element, String property)
+ {
+ return true;
+ }
+
+ public void removeListener(ILabelProviderListener listener)
+ {
+ listeners.remove(listener);
+ }
+
+ /**
+ * Cache the objects for the given parent.
+ * @param parent the parent object.
+ * @param children the children to cache.
+ */
+ public void setCachedObjects(Object parent, Object[] children) {
+ cache.put(parent, children);
+ }
+
+ /**
+ * Returns the cached objects for the given parent.
+ * @param parent the parent object.
+ * @return the cached children.
+ */
+ public Object[] getCachedObjects(Object parent) {
+ return (Object[])(cache.get(parent));
+ }
+
+ /**
+ * The visual part that is using this content provider is about
+ * to be disposed. Deallocate all allocated SWT resources.
+ */
+ public void dispose() {
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableView.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableView.java
new file mode 100644
index 00000000000..3208ba51f29
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableView.java
@@ -0,0 +1,1905 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Vector;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.ICellModifier;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableLayout;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.window.SameShellProvider;
+import org.eclipse.rse.core.SystemAdapterHelpers;
+import org.eclipse.rse.core.SystemBasePlugin;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.SystemPopupMenuActionContributorManager;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.filters.ISystemFilterReference;
+import org.eclipse.rse.model.IHost;
+import org.eclipse.rse.model.ISystemContainer;
+import org.eclipse.rse.model.ISystemRegistry;
+import org.eclipse.rse.model.ISystemRemoteChangeEvent;
+import org.eclipse.rse.model.ISystemRemoteChangeEvents;
+import org.eclipse.rse.model.ISystemRemoteChangeListener;
+import org.eclipse.rse.model.ISystemResourceChangeEvent;
+import org.eclipse.rse.model.ISystemResourceChangeEvents;
+import org.eclipse.rse.model.ISystemResourceChangeListener;
+import org.eclipse.rse.services.clientserver.StringCompare;
+import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.ISystemDeleteTarget;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.ISystemRenameTarget;
+import org.eclipse.rse.ui.SystemMenuManager;
+import org.eclipse.rse.ui.SystemPropertyResources;
+import org.eclipse.rse.ui.actions.ISystemAction;
+import org.eclipse.rse.ui.actions.SystemCommonDeleteAction;
+import org.eclipse.rse.ui.actions.SystemCommonRenameAction;
+import org.eclipse.rse.ui.actions.SystemCommonSelectAllAction;
+import org.eclipse.rse.ui.actions.SystemOpenExplorerPerspectiveAction;
+import org.eclipse.rse.ui.actions.SystemRefreshAction;
+import org.eclipse.rse.ui.actions.SystemRemotePropertiesAction;
+import org.eclipse.rse.ui.actions.SystemShowInTableAction;
+import org.eclipse.rse.ui.actions.SystemSubMenuManager;
+import org.eclipse.rse.ui.messages.ISystemMessageLine;
+import org.eclipse.rse.ui.messages.SystemMessageDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.FileTransfer;
+import org.eclipse.swt.dnd.TextTransfer;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Layout;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Widget;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.PropertyDialogAction;
+import org.eclipse.ui.part.EditorInputTransfer;
+import org.eclipse.ui.part.PluginTransfer;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+
+
+/**
+ * This subclass of the standard JFace table viewer is used to
+ * show a generic table view of the selected object in the Systems view
+ *
+ *
+ * TableViewer comes from com.ibm.jface.viewer
+ */
+public class SystemTableView
+ extends TableViewer
+ implements IMenuListener, ISystemDeleteTarget, ISystemRenameTarget, ISystemSelectAllTarget, ISystemResourceChangeListener, ISystemRemoteChangeListener, ISelectionChangedListener, ISelectionProvider
+{
+
+
+ // inner class to support cell editing
+ private ICellModifier cellModifier = new ICellModifier()
+ {
+ public Object getValue(Object element, String property)
+ {
+ ISystemViewElementAdapter adapter = getAdapter(element);
+ adapter.setPropertySourceInput(element);
+ Object value = adapter.getPropertyValue(property);
+ if (value == null)
+ {
+ value = "";
+ }
+ return value;
+ }
+
+ public boolean canModify(Object element, String property)
+ {
+ boolean modifiable = true;
+ return modifiable;
+ }
+
+ public void modify(Object element, String property, Object value)
+ {
+ if (element instanceof TableItem && value != null)
+ {
+ Object obj = ((TableItem) element).getData();
+ ISystemViewElementAdapter adapter = getAdapter(obj);
+ if (adapter != null)
+ {
+ adapter.setPropertyValue(property, value);
+
+ SelectionChangedEvent event = new SelectionChangedEvent(SystemTableView.this, getSelection());
+
+ // fire the event
+ fireSelectionChanged(event);
+ }
+ }
+ }
+ };
+
+ private class HeaderSelectionListener extends SelectionAdapter
+ {
+
+ public HeaderSelectionListener()
+ {
+ _upI = SystemPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_MOVEUP_ID);
+ _downI = SystemPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_MOVEDOWN_ID);
+ }
+
+
+ /**
+ * Handles the case of user selecting the
+ * header area.
+ * If the column has not been selected previously,
+ * it will set the sorter of that column to be
+ * the current table view sorter. Repeated
+ * presses on the same column header will
+ * toggle sorting order (ascending/descending).
+ */
+ public void widgetSelected(SelectionEvent e)
+ {
+ Table table = getTable();
+ if (!table.isDisposed())
+ {
+ // column selected - need to sort
+ TableColumn tcolumn = (TableColumn)e.widget;
+ int column = table.indexOf(tcolumn);
+ SystemTableViewSorter oldSorter = (SystemTableViewSorter) getSorter();
+ if (oldSorter != null && column == oldSorter.getColumnNumber())
+ {
+ oldSorter.setReversed(!oldSorter.isReversed());
+ if (tcolumn.getImage() == _upI)
+ {
+ tcolumn.setImage(_downI);
+ }
+ else
+ {
+ tcolumn.setImage(_upI);
+ }
+ }
+ else
+ {
+ setSorter(new SystemTableViewSorter(column, SystemTableView.this, _columnManager));
+ tcolumn.setImage(_downI);
+ }
+
+ // unset image of other columns
+ TableColumn[] allColumns = table.getColumns();
+ for (int i = 0; i < allColumns.length; i++)
+ {
+ if (i != column)
+ {
+ if (allColumns[i].getImage() != null)
+ {
+ allColumns[i].setImage(null);
+ }
+ }
+ }
+ refresh();
+ }
+ }
+ }
+
+ private Object _objectInput;
+ private TableLayout _layout;
+ protected SystemTableViewProvider _provider;
+ private HeaderSelectionListener _columnSelectionListener;
+ private MenuManager _menuManager;
+ private SystemTableViewFilter _filter;
+ private IPropertyDescriptor[] _uniqueDescriptors;
+ private SystemTableViewColumnManager _columnManager;
+
+ // these variables were copied from SystemView to allow for limited support
+ // of actions. I say limited because somethings don't yet work properly.
+ protected SystemRefreshAction _refreshAction;
+ protected PropertyDialogAction _propertyDialogAction;
+ protected SystemRemotePropertiesAction _remotePropertyDialogAction;
+ protected SystemOpenExplorerPerspectiveAction _openToPerspectiveAction;
+ protected SystemShowInTableAction _showInTableAction;
+
+ // global actions
+ // Note the Edit menu actions are set in SystemViewPart. Here we use these
+ // actions from our own popup menu actions.
+ protected SystemCommonDeleteAction _deleteAction;
+ // for global delete menu item
+ protected SystemCommonRenameAction _renameAction;
+ // for common rename menu item
+ protected SystemCommonSelectAllAction _selectAllAction;
+ // for common Ctrl+A select-all
+
+ protected boolean _selectionShowRefreshAction;
+ protected boolean _selectionShowOpenViewActions;
+ protected boolean _selectionShowDeleteAction;
+ protected boolean _selectionShowRenameAction;
+ protected boolean _selectionEnableDeleteAction;
+ protected boolean _selectionEnableRenameAction;
+
+ protected boolean _selectionIsRemoteObject = true;
+ protected boolean _selectionFlagsUpdated = false;
+
+ private IWorkbenchPart _workbenchPart = null;
+ private ISystemMessageLine _messageLine;
+
+ private int[] _lastWidths = null;
+ private int _charWidth = 3;
+
+ private boolean _showColumns = true;
+
+ private Image _upI;
+ private Image _downI;
+
+ protected boolean menuListenerAdded = false;
+
+ private static final int LEFT_BUTTON = 1;
+ private int mouseButtonPressed = LEFT_BUTTON;
+ /**
+ * Constructor for the table view
+ *
+ */
+ public SystemTableView(Table table, ISystemMessageLine msgLine)
+ {
+ super(table);
+ _layout = new TableLayout();
+ _messageLine = msgLine;
+
+ _columnManager = new SystemTableViewColumnManager(this);
+ _provider = getProvider();
+ _columnSelectionListener = new HeaderSelectionListener();
+
+ setContentProvider(_provider);
+
+ setLabelProvider(new SystemDecoratingLabelProvider(_provider, SystemPlugin.getDefault().getWorkbench().getDecoratorManager().getLabelDecorator()));
+ //setLabelProvider(_provider);
+
+ _filter = new SystemTableViewFilter();
+ addFilter(_filter);
+
+ _charWidth = table.getFont().getFontData()[0].getHeight() / 2;
+ computeLayout();
+
+ _menuManager = new MenuManager("#PopupMenu");
+ _menuManager.setRemoveAllWhenShown(true);
+ _menuManager.addMenuListener(this);
+ Menu menu = _menuManager.createContextMenu(table);
+ table.setMenu(menu);
+
+ addSelectionChangedListener(this);
+
+ SystemPlugin.getTheSystemRegistry().addSystemResourceChangeListener(this);
+ SystemPlugin.getTheSystemRegistry().addSystemRemoteChangeListener(this);
+
+ initDragAndDrop();
+
+ table.setVisible(false);
+
+ // key listening for delete press
+ getControl().addKeyListener(new KeyAdapter()
+ {
+ public void keyPressed(KeyEvent e)
+ {
+ handleKeyPressed(e);
+ }
+ });
+ getControl().addMouseListener(new MouseAdapter()
+ {
+ public void mouseDown(MouseEvent e)
+ {
+ mouseButtonPressed = e.button; //d40615
+ }
+ });
+
+
+ _upI = SystemPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_ARROW_UP_ID);
+ _downI = SystemPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_ARROW_DOWN_ID);
+ }
+
+ protected SystemTableViewProvider getProvider()
+ {
+ if (_provider == null)
+ {
+ _provider = new SystemTableViewProvider(_columnManager);
+ }
+ return _provider;
+ }
+
+ public void showColumns(boolean flag)
+ {
+ _showColumns = flag;
+ }
+
+
+ public Layout getLayout()
+ {
+ return _layout;
+ }
+
+ public void setWorkbenchPart(IWorkbenchPart part)
+ {
+ _workbenchPart = part;
+ }
+
+ public void setViewFilters(String[] filter)
+ {
+ if (_filter.getFilters() != filter)
+ {
+ _filter.setFilters(filter);
+ refresh();
+ }
+ }
+
+ public String[] getViewFilters()
+ {
+ return _filter.getFilters();
+ }
+
+ /**
+ * Return the popup menu for the table
+ */
+ public Menu getContextMenu()
+ {
+ return getTable().getMenu();
+ }
+ /**
+ * Return the popup menu for the table
+ */
+ public MenuManager getContextMenuManager()
+ {
+ return _menuManager;
+ }
+
+ /**
+ * Called whenever the input for the view changes
+ */
+ public void inputChanged(Object newObject, Object oldObject)
+ {
+ if (newObject instanceof IAdaptable)
+ {
+ getTable().setVisible(true);
+ _objectInput = newObject;
+ computeLayout();
+
+ // reset the filter
+ //setViewFilters(null);
+
+ super.inputChanged(newObject, oldObject);
+
+ }
+ else if (newObject == null)
+ {
+ getTable().setVisible(false);
+ _objectInput = null;
+ computeLayout();
+
+ setViewFilters(null);
+ }
+ }
+
+ public Object getInput()
+ {
+ return _objectInput;
+ }
+
+ /**
+ * Convenience method for retrieving the view adapter for an object
+ */
+ protected ISystemViewElementAdapter getAdapter(Object obj)
+ {
+ ISystemViewElementAdapter adapter = SystemAdapterHelpers.getAdapter(obj, this);
+ if (adapter != null)
+ adapter.setPropertySourceInput(obj);
+ return adapter;
+ }
+
+ /**
+ * Convenience method for retrieving the view adapter for an object's children
+ */
+ public ISystemViewElementAdapter getAdapterForContents()
+ {
+ SystemTableViewProvider provider = (SystemTableViewProvider) getContentProvider();
+ Object[] children = provider.getChildren(getInput());
+ if (children != null && children.length > 0)
+ {
+ IAdaptable child = (IAdaptable) children[0];
+ return getAdapter(child);
+ }
+ return null;
+ }
+
+ /**
+ * Used to determine what the columns should be on the table.
+ */
+ public IPropertyDescriptor[] getVisibleDescriptors(Object object)
+ {
+ SystemTableViewProvider provider = (SystemTableViewProvider) getContentProvider();
+ Object[] children = provider.getChildren(object);
+ return getVisibleDescriptors(children);
+ }
+
+ private IPropertyDescriptor[] getVisibleDescriptors(Object[] children)
+ {
+ if (children != null && children.length > 0)
+ {
+ IAdaptable child = (IAdaptable) children[0];
+ return getCustomDescriptors(getAdapter(child));
+ }
+
+ return new IPropertyDescriptor[0];
+ }
+
+ public SystemTableViewColumnManager getColumnManager()
+ {
+ return _columnManager;
+ }
+
+ public IPropertyDescriptor getNameDescriptor(Object object)
+ {
+ SystemTableViewProvider provider = (SystemTableViewProvider) getContentProvider();
+ Object[] children = provider.getChildren(object);
+ return getNameDescriptor(children);
+ }
+
+ private IPropertyDescriptor getNameDescriptor(Object[] children)
+ {
+ if (children != null && children.length > 0)
+ {
+ IAdaptable child = (IAdaptable) children[0];
+ return getAdapter(child).getPropertyDescriptors()[0];
+ }
+
+ return null;
+ }
+
+ /**
+ * Used to determine the formats of each descriptor.
+ */
+ private ArrayList getFormatsIn()
+ {
+ SystemTableViewProvider provider = (SystemTableViewProvider) getContentProvider();
+ Object[] children = provider.getChildren(_objectInput);
+ return getFormatsIn(children);
+ }
+
+ private IPropertyDescriptor[] getCustomDescriptors(ISystemViewElementAdapter adapter)
+ {
+ return _columnManager.getVisibleDescriptors(adapter);
+ }
+
+ private ArrayList getFormatsIn(Object[] children)
+ {
+ ArrayList results = new ArrayList();
+
+ if (children != null && children.length > 0)
+ {
+ IAdaptable child = (IAdaptable) children[0];
+
+ Object adapter = child.getAdapter(ISystemViewElementAdapter.class);
+ if (adapter instanceof ISystemViewElementAdapter)
+ {
+ ISystemViewElementAdapter ad = (ISystemViewElementAdapter) adapter;
+ ad.setPropertySourceInput(child);
+
+ IPropertyDescriptor[] descriptors = getCustomDescriptors(ad);
+ for (int i = 0; i < descriptors.length; i++)
+ {
+ IPropertyDescriptor descriptor = descriptors[i];
+
+ try
+ {
+ Object key = descriptor.getId();
+
+ Object propertyValue = ad.getPropertyValue(key, false);
+ results.add(propertyValue.getClass());
+ }
+ catch (Exception e)
+ {
+ results.add(String.class);
+ }
+
+ }
+ }
+ }
+
+ return results;
+ }
+
+ public void computeLayout()
+ {
+ computeLayout(false);
+ }
+
+ private CellEditor getCellEditor(Table parent, IPropertyDescriptor descriptor)
+ {
+ CellEditor editor = descriptor.createPropertyEditor(parent);
+ if (editor instanceof SystemInheritableTextCellEditor)
+ {
+ ((SystemInheritableTextCellEditor) editor).getInheritableEntryField().setAllowEditingOfInheritedText(true);
+ }
+
+ return editor;
+ }
+
+ private boolean sameDescriptors(IPropertyDescriptor[] descriptors1, IPropertyDescriptor[] descriptors2)
+ {
+ if (descriptors1 == null || descriptors2 == null)
+ {
+ return false;
+ }
+ if (descriptors1.length == descriptors2.length)
+ {
+ boolean same = true;
+ for (int i = 0; i < descriptors1.length && same; i++)
+ {
+ same = descriptors1[i] == descriptors2[i];
+ }
+ return same;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ /**
+ * Determines what columns should be shown in this view. The columns may change
+ * anytime the view input changes. The columns in the control are modified and
+ * columns may be added or deleted as necessary to make it conform to the
+ * new data.
+ */
+ public void computeLayout(boolean force)
+ {
+ if (_showColumns == false)
+ return;
+ if (_objectInput == null)
+ return;
+
+ SystemTableViewProvider provider = (SystemTableViewProvider) getContentProvider();
+ Object[] children = provider.getChildren(_objectInput);
+
+ // if no children, don't update
+ if (children == null || children.length == 0)
+ {
+ return;
+ }
+
+ IPropertyDescriptor[] descriptors = getVisibleDescriptors(children);
+ IPropertyDescriptor nameDescriptor = getNameDescriptor(children);
+
+ int n = descriptors.length; // number of columns we need (name column + other columns)
+ if (nameDescriptor != null)
+ n += 1;
+ if (n == 0)
+ return; // there is nothing to lay out!
+
+
+ if (sameDescriptors(descriptors,_uniqueDescriptors) && !force)
+ {
+ setLastColumnWidths(getCurrentColumnWidths());
+ return;
+ }
+ _uniqueDescriptors = descriptors;
+ Table table = getTable();
+ if (table == null || table.isDisposed())
+ return;
+
+ // set column attributes, create new columns if necessary
+ TableColumn[] columns = table.getColumns();
+ int numColumns = columns.length; // number of columns in the control
+ CellEditor editors[] = new CellEditor[n];
+ String headings[] = new String[n];
+ String propertyIds[] = new String[n];
+ ArrayList formats = getFormatsIn();
+
+
+ _layout = new TableLayout();
+ for (int i = 0; i < n; i++)
+ { // for each column
+ String name = null;
+ String propertyId = null;
+ CellEditor editor = null;
+ int alignment = SWT.LEFT;
+ int weight = 100;
+ if (i == 0)
+ {
+ // this is the first column -- treat it special
+ name = SystemPropertyResources.RESID_PROPERTY_NAME_LABEL;
+ propertyId = (String) nameDescriptor.getId();
+ editor = getCellEditor(table, nameDescriptor);
+ weight = 200;
+ }
+ else
+ { // these columns come from the regular descriptors
+ IPropertyDescriptor descriptor = descriptors[i - 1];
+
+ Class format = (Class) formats.get(i - 1);
+ name = descriptor.getDisplayName();
+ propertyId = (String) descriptor.getId();
+ editor = getCellEditor(table, descriptor);
+ if (format != String.class)
+ alignment = SWT.RIGHT;
+ }
+ TableColumn tc = null;
+ if (i >= numColumns)
+ {
+ tc = new TableColumn(table, alignment, i);
+ tc.setMoveable(true);
+ tc.addSelectionListener(_columnSelectionListener);
+ }
+ else
+ {
+ tc = columns[i];
+ tc.setAlignment(alignment);
+ }
+ _layout.addColumnData(new ColumnWeightData(weight));
+ tc.setText(name);
+ if (i == 0)
+ {
+ // tc.setImage(_downI);
+ }
+ headings[i] = name;
+ editors[i] = editor;
+ propertyIds[i] = propertyId;
+ }
+ setColumnProperties(propertyIds);
+ setCellEditors(editors);
+ setCellModifier(cellModifier);
+
+ // dispose of any extra columns the table control may have
+ for (int i = n; i < numColumns; i++)
+ {
+ columns[i].dispose();
+ columns[i] = null;
+ }
+
+ // compute column widths
+ columns = table.getColumns();
+ numColumns = columns.length;
+ Rectangle clientA = table.getClientArea();
+ int totalWidth = clientA.width - 5;
+ if (totalWidth <= 0)
+ {
+ // find a default
+ totalWidth = 500;
+ }
+
+
+ int[] lastWidths = getLastColumnWidths();
+ if (numColumns > 1)
+ {
+ // check if previous widths can be used
+ if (lastWidths != null && lastWidths.length == numColumns)
+ {
+
+ // use previously established widths
+ setCurrentColumnWidths(lastWidths);
+ }
+ else
+ {
+ if (totalWidth > 0)
+ {
+ // no previous widths or number of columns has changed - need to calculate
+ int averageWidth = totalWidth / numColumns;
+ int firstWidth = Math.max(averageWidth, 150);
+ averageWidth = (totalWidth - firstWidth) / (numColumns - 1);
+ averageWidth = Math.max(averageWidth, 80);
+ columns[0].setWidth(firstWidth);
+ for (int i = 1; i < numColumns; i++)
+ {
+
+ columns[i].setWidth(averageWidth);
+ }
+ setLastColumnWidths(getCurrentColumnWidths());
+ }
+ }
+ table.setHeaderVisible(true);
+ }
+ else
+ {
+
+ if (numColumns == 1)
+ {
+ int width = totalWidth;
+ if (lastWidths != null && lastWidths.length == 1)
+ {
+ width = (totalWidth > lastWidths[0]) ? totalWidth : lastWidths[0];
+ }
+
+
+ int maxWidth = provider.getMaxCharsInColumnZero() * _charWidth;
+ if (maxWidth > width)
+ {
+ width = maxWidth;
+ }
+
+ if (width > 0)
+ {
+ columns[0].setWidth(width);
+ }
+ table.setHeaderVisible(false);
+ }
+ }
+ }
+
+ public int[] getCurrentColumnWidths()
+ {
+ Table table = getTable();
+ if (table != null && !table.isDisposed())
+ {
+ int[] widths = new int[table.getColumnCount()];
+ TableColumn[] columns = table.getColumns();
+ for (int i = 0; i < columns.length; i++)
+ {
+ widths[i] = columns[i].getWidth();
+ }
+ return widths;
+ }
+
+ return new int[0];
+ }
+
+ public void setCurrentColumnWidths(int[] widths)
+ {
+ Table table = getTable();
+ if (table != null && !table.isDisposed())
+ {
+ TableColumn[] columns = table.getColumns();
+ for (int i = 0; i < columns.length && i < widths.length; i++)
+ {
+ columns[i].setWidth(widths[i]);
+ }
+ }
+ }
+
+ public int[] getLastColumnWidths()
+ {
+ return _lastWidths;
+ }
+
+ public void setLastColumnWidths(int[] widths)
+ {
+ _lastWidths = widths;
+ }
+
+ protected void initDragAndDrop()
+ {
+ int ops = DND.DROP_COPY | DND.DROP_MOVE;
+ Transfer[] transfers = new Transfer[] { PluginTransfer.getInstance(), TextTransfer.getInstance(), EditorInputTransfer.getInstance(), FileTransfer.getInstance()};
+
+ addDragSupport(ops, transfers, new SystemViewDataDragAdapter((ISelectionProvider) this));
+ addDropSupport(ops | DND.DROP_DEFAULT, transfers, new SystemViewDataDropAdapter(this));
+ }
+
+ /**
+ * Used to asynchronously update the view whenever properties change.
+ */
+ public void systemResourceChanged(ISystemResourceChangeEvent event)
+ {
+
+ boolean madeChange = false;
+ Object parent = event.getParent();
+ Object child = event.getSource();
+ int eventType = event.getType();
+ switch (eventType)
+ {
+ case ISystemResourceChangeEvents.EVENT_RENAME_FILTER_REFERENCE:
+ case ISystemResourceChangeEvents.EVENT_CHANGE_FILTER_REFERENCE:
+ case ISystemResourceChangeEvents.EVENT_CHANGE_FILTERSTRING_REFERENCE:
+ {
+ if (_objectInput instanceof ISystemFilterReference)
+ {
+ if (child == ((ISystemFilterReference)_objectInput).getReferencedFilter())
+ {
+ SystemTableViewProvider provider = (SystemTableViewProvider) getContentProvider();
+
+ if (provider != null)
+ {
+ if (!madeChange)
+ {
+ provider.flushCache();
+ madeChange = true;
+ }
+
+ computeLayout();
+ try
+ {
+ internalRefresh(_objectInput);
+ }
+ catch (Exception e)
+ {
+ SystemBasePlugin.logError(e.getMessage());
+ }
+ }
+
+ }
+ }
+ }
+ break;
+ case ISystemResourceChangeEvents.EVENT_PROPERTY_CHANGE :
+ case ISystemResourceChangeEvents.EVENT_PROPERTYSHEET_UPDATE :
+ case ISystemResourceChangeEvents.EVENT_ICON_CHANGE:
+ {
+ try
+ {
+ Widget w = findItem(child);
+ if (w != null)
+ {
+ updateItem(w, child);
+ }
+ }
+ catch (Exception e)
+ {
+
+ }
+ }
+ break;
+
+ case ISystemResourceChangeEvents.EVENT_DELETE:
+ case ISystemResourceChangeEvents.EVENT_DELETE_MANY:
+ {
+ if (child instanceof ISystemFilterReference)
+ {
+ Widget w = findItem(child);
+ if (w != null)
+ {
+ remove(child);
+ }
+ }
+ }
+ break;
+
+ case ISystemResourceChangeEvents.EVENT_ADD :
+ case ISystemResourceChangeEvents.EVENT_ADD_RELATIVE :
+ {
+ boolean addingConnection = (child instanceof IHost);
+ if (_objectInput instanceof ISystemRegistry && addingConnection)
+ {
+ SystemTableViewProvider provider = (SystemTableViewProvider) getContentProvider();
+
+ if (provider != null)
+ {
+ if (!madeChange)
+ {
+ provider.flushCache();
+ madeChange = true;
+ }
+
+ computeLayout();
+ internalRefresh(_objectInput);
+ }
+ }
+ }
+ break;
+
+ case ISystemResourceChangeEvents.EVENT_REFRESH:
+ {
+ if (child == SystemPlugin.getTheSystemRegistry())
+ {
+ // treat this as refresh all
+ child = _objectInput;
+ }
+ }
+ default :
+ break;
+
+ }
+
+ if (child == _objectInput || parent == _objectInput)
+ {
+ SystemTableViewProvider provider = (SystemTableViewProvider) getContentProvider();
+
+ if (provider != null)
+ {
+ if (!madeChange)
+ {
+ provider.flushCache();
+ madeChange = true;
+ }
+
+ computeLayout();
+ try
+ {
+ internalRefresh(_objectInput);
+ }
+ catch (Exception e)
+ {
+ SystemBasePlugin.logError(e.getMessage());
+ }
+ }
+ }
+ }
+
+ /**
+ * This is the method in your class that will be called when a remote resource
+ * changes. You will be called after the resource is changed.
+ * @see org.eclipse.rse.model.ISystemRemoteChangeEvent
+ */
+ public void systemRemoteResourceChanged(ISystemRemoteChangeEvent event)
+ {
+ boolean madeChange = false;
+ int eventType = event.getEventType();
+ Object remoteResourceParent = event.getResourceParent();
+ Object remoteResource = event.getResource();
+ boolean originatedHere = (event.getOriginatingViewer() == this);
+ Vector remoteResourceNames = null;
+ if (remoteResource instanceof Vector)
+ {
+ remoteResourceNames = (Vector) remoteResource;
+ remoteResource = remoteResourceNames.elementAt(0);
+ }
+ String remoteResourceParentName = getRemoteResourceAbsoluteName(remoteResourceParent);
+ String remoteResourceName = getRemoteResourceAbsoluteName(remoteResource);
+ if (remoteResourceName == null)
+ return;
+ SystemTableViewProvider provider = (SystemTableViewProvider) getContentProvider();
+
+ if (_objectInput instanceof ISystemContainer && ((ISystemContainer)_objectInput).isStale())
+ {
+ provider.flushCache();
+ refresh();
+ return;
+ }
+
+ switch (eventType)
+ {
+ // --------------------------
+ // REMOTE RESOURCE CHANGED...
+ // --------------------------
+ case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_CHANGED :
+ {
+ if (remoteResourceParent == getInput())
+ {
+ Widget w = findItem(remoteResource);
+ if (w != null)
+ {
+ updateItem(w, remoteResource);
+ }
+
+ }
+ }
+ break;
+
+ // --------------------------
+ // REMOTE RESOURCE CREATED...
+ // --------------------------
+ case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_CREATED :
+ {
+ String inputResourceName = getRemoteResourceAbsoluteName(getInput());
+ if (remoteResourceParentName != null && remoteResourceParentName.equals(inputResourceName))
+ {
+ if (provider == null)
+ {
+ return;
+ }
+ if (!madeChange)
+ {
+ provider.flushCache();
+ madeChange = true;
+ }
+
+ refresh();
+ }
+ }
+ break;
+
+ // --------------------------
+ // REMOTE RESOURCE DELETED...
+ // --------------------------
+ case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_DELETED :
+ {
+ {
+ Object dchild = remoteResource;
+
+ ISystemViewElementAdapter dadapt = getAdapter(dchild);
+ if (dadapt != null)
+ {
+ ISubSystem dSubSystem = dadapt.getSubSystem(dchild);
+ String dkey = dadapt.getAbsoluteName(dchild);
+
+ if (provider != null)
+ {
+ Object[] children = provider.getChildren(_objectInput);
+ for (int i = 0; i < children.length; i++)
+ {
+ Object existingChild = children[i];
+ if (existingChild != null)
+ {
+ ISystemViewElementAdapter eadapt = getAdapter(existingChild);
+ ISubSystem eSubSystem = eadapt.getSubSystem(existingChild);
+
+ if (dSubSystem == eSubSystem)
+ {
+ String ekey = eadapt.getAbsoluteName(existingChild);
+ if (ekey.equals(dkey))
+ {
+ if (!madeChange)
+ {
+ provider.flushCache();
+ madeChange = true;
+
+ // do a full refresh
+ refresh();
+ }
+ }
+ }
+
+ }
+ }
+ }
+ }
+ }
+
+ }
+ break;
+
+ // --------------------------
+ // REMOTE RESOURCE RENAMED...
+ // --------------------------
+ case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_RENAMED :
+ {
+ String oldName = event.getOldName();
+ Object child = event.getResource();
+
+ if (provider != null)
+ {
+ Object[] previousResults = provider.getCache();
+ if (previousResults != null)
+ {
+ for (int i = 0; i < previousResults.length; i++)
+ {
+ Object previousResult = previousResults[i];
+
+ if (previousResult == child)
+ {
+ Widget widget = findItem(previousResult);
+ if (widget != null)
+ {
+ widget.setData(child);
+ updateItem(widget, child);
+ return;
+ }
+ }
+ else
+ {
+ String previousName = getAdapter(previousResult).getAbsoluteName(previousResult);
+
+ if (previousName != null && previousName.equals(oldName))
+ {
+ provider.flushCache();
+ internalRefresh(_objectInput);
+ return;
+ }
+ }
+ }
+
+ }
+ }
+ }
+
+ break;
+
+ /*
+ // --------------------------
+ // REMOTE RESOURCE RENAMED...
+ // --------------------------
+ case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_RENAMED :
+ {
+ if (remoteResourceParent == getInput())
+ {
+ if (provider != null)
+ {
+ provider.flushCache();
+ }
+
+ refresh();
+ }
+
+ }
+ break;
+ */
+ }
+ }
+
+ /**
+ * Turn a given remote object reference into a fully qualified absolute name
+ */
+ private String getRemoteResourceAbsoluteName(Object remoteResource)
+ {
+ if (remoteResource == null)
+ return null;
+ String remoteResourceName = null;
+ if (remoteResource instanceof String)
+ remoteResourceName = (String) remoteResource;
+ else
+ {
+ ISystemRemoteElementAdapter ra = getRemoteAdapter(remoteResource);
+ if (ra == null)
+ return null;
+ remoteResourceName = ra.getAbsoluteName(remoteResource);
+ }
+ return remoteResourceName;
+ }
+
+ public void selectionChanged(SelectionChangedEvent event)
+ {
+ IStructuredSelection sel = (IStructuredSelection)event.getSelection();
+ Object firstSelection = sel.getFirstElement();
+ if (firstSelection == null)
+ return;
+
+ _selectionFlagsUpdated = false;
+ ISystemViewElementAdapter adapter = getAdapter(firstSelection);
+ if (adapter != null)
+ {
+ displayMessage(adapter.getStatusLineText(firstSelection));
+ if ((mouseButtonPressed == LEFT_BUTTON))
+ adapter.selectionChanged(firstSelection);
+ }
+ else
+ clearMessage();
+ }
+
+ public void dispose()
+ {
+ removeSelectionChangedListener(this);
+ SystemPlugin.getTheSystemRegistry().removeSystemResourceChangeListener(this);
+ SystemPlugin.getTheSystemRegistry().removeSystemRemoteChangeListener(this);
+ _menuManager.removeAll();
+
+ Table table = getTable();
+
+ if (!table.isDisposed())
+ {
+ table.removeAll();
+ TableColumn[] columns = table.getColumns();
+ for (int i = 0; i < columns.length; i++)
+ {
+ TableColumn column = columns[i];
+ if (column != null && !column.isDisposed())
+ {
+ column.removeSelectionListener(_columnSelectionListener);
+ column.dispose();
+ column = null;
+ }
+ }
+
+ table.dispose();
+ }
+ }
+
+ /*
+ * Everything below is basically stuff copied and pasted from SystemsView
+ * -There needs to be cleaning up of the below code as some of this stuff
+ * is broken for the table view
+ *
+ *
+ public void createStandardGroups(IMenuManager menu)
+ {
+ if (!menu.isEmpty())
+ return;
+ // simply sets partitions in the menu, into which actions can be directed.
+ // Each partition can be delimited by a separator (new Separator) or not (new GroupMarker).
+ // Deleted groups are not used yet.
+ menu.add(new Separator(ISystemContextMenuConstants.GROUP_NEW));
+ // new->
+ menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_GOTO));
+ menu.add(new Separator(ISystemContextMenuConstants.GROUP_EXPANDTO));
+ // expand to->
+ menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_EXPAND));
+ // expand, collapse
+ // goto into, go->
+ menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_OPENWITH));
+ // open with->
+ menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_BROWSEWITH));
+ // browse with ->
+ menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_OPEN));
+ // open xxx
+ menu.add(new Separator(ISystemContextMenuConstants.GROUP_WORKWITH));
+ // work with->
+ //menu.add(new Separator(ISystemContextMenuConstants.GROUP_SHOW)); // show->type hierarchy, in-navigator
+ menu.add(new Separator(ISystemContextMenuConstants.GROUP_BUILD));
+ // build, rebuild, refresh
+ menu.add(new Separator(ISystemContextMenuConstants.GROUP_CHANGE));
+ // update, change
+ menu.add(new Separator(ISystemContextMenuConstants.GROUP_REORGANIZE));
+ // rename,move,copy,delete,bookmark,refactoring
+ menu.add(new Separator(ISystemContextMenuConstants.GROUP_REORDER));
+ // move up, move down
+ menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_GENERATE));
+ // getters/setters, etc. Typically in editor
+ menu.add(new Separator(ISystemContextMenuConstants.GROUP_SEARCH));
+ // search
+ menu.add(new Separator(ISystemContextMenuConstants.GROUP_CONNECTION));
+ // connection-related actions
+ menu.add(new Separator(ISystemContextMenuConstants.GROUP_IMPORTEXPORT));
+ // get or put actions
+ menu.add(new Separator(ISystemContextMenuConstants.GROUP_ADAPTERS));
+ // actions queried from adapters
+ menu.add(new Separator(ISystemContextMenuConstants.GROUP_ADDITIONS));
+ // user or BP/ISV additions
+ //menu.add(new Separator(ISystemContextMenuConstants.GROUP_VIEWER_SETUP)); // ? Probably View->by xxx, yyy
+ menu.add(new Separator(ISystemContextMenuConstants.GROUP_TEAM));
+ // Team
+ menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_COMPAREWITH));
+ menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_REPLACEWITH));
+ menu.add(new Separator(ISystemContextMenuConstants.GROUP_PROPERTIES));
+ // Properties
+ }
+
+ /**
+ * Rather than pre-defining this common action we wait until it is first needed,
+ * for performance reasons.
+ */
+ protected PropertyDialogAction getPropertyDialogAction()
+ {
+ if (_propertyDialogAction == null)
+ {
+ _propertyDialogAction = new PropertyDialogAction(new SameShellProvider(getShell()), this);
+ //propertyDialogAction.setToolTipText(" ");
+ }
+ _propertyDialogAction.selectionChanged(getSelection());
+ return _propertyDialogAction;
+ }
+ /**
+ * Rather than pre-defining this common action we wait until it is first needed,
+ * for performance reasons.
+ */
+ protected SystemRemotePropertiesAction getRemotePropertyDialogAction()
+ {
+ if (_remotePropertyDialogAction == null)
+ {
+ _remotePropertyDialogAction = new SystemRemotePropertiesAction(getShell());
+ }
+ _remotePropertyDialogAction.setSelection(getSelection());
+ return _remotePropertyDialogAction;
+ }
+ /**
+ * Return the select All action
+ */
+ protected IAction getSelectAllAction()
+ {
+ if (_selectAllAction == null)
+ _selectAllAction = new SystemCommonSelectAllAction(getShell(), this, this);
+ return _selectAllAction;
+ }
+
+ /**
+ * Rather than pre-defined this common action we wait until it is first needed,
+ * for performance reasons.
+ */
+ protected IAction getRenameAction()
+ {
+ if (_renameAction == null)
+ _renameAction = new SystemCommonRenameAction(getShell(), this);
+ return _renameAction;
+ }
+ /**
+ * Rather than pre-defined this common action we wait until it is first needed,
+ * for performance reasons.
+ */
+ protected IAction getDeleteAction()
+ {
+ if (_deleteAction == null)
+ _deleteAction = new SystemCommonDeleteAction(getShell(), this);
+ return _deleteAction;
+ }
+
+ /**
+ * Return the refresh action
+ */
+ protected IAction getRefreshAction()
+ {
+ if (_refreshAction == null)
+ _refreshAction = new SystemRefreshAction(getShell());
+ return _refreshAction;
+ }
+ /*
+ * Get the common "Open to->" action for opening a new Remote Systems Explorer view,
+ * scoped to the currently selected object.
+ *
+ protected SystemCascadingOpenToAction getOpenToAction()
+ {
+ if (openToAction == null)
+ openToAction = new SystemCascadingOpenToAction(getShell(),getWorkbenchWindow());
+ return openToAction;
+ } NOT USED YET */
+ /**
+ * Get the common "Open to->" action for opening a new Remote Systems Explorer view,
+ * scoped to the currently selected object.
+ */
+ protected SystemOpenExplorerPerspectiveAction getOpenToPerspectiveAction()
+ {
+ if (_openToPerspectiveAction == null)
+ {
+ IWorkbench desktop = PlatformUI.getWorkbench();
+ IWorkbenchWindow win = desktop.getActiveWorkbenchWindow();
+
+ _openToPerspectiveAction = new SystemOpenExplorerPerspectiveAction(getShell(), win);
+ }
+ //getWorkbenchWindow());
+ return _openToPerspectiveAction;
+ }
+
+ protected SystemShowInTableAction getShowInTableAction()
+ {
+ if (_showInTableAction == null)
+ {
+ _showInTableAction = new SystemShowInTableAction(getShell());
+ }
+ //getWorkbenchWindow());
+ return _showInTableAction;
+ }
+
+ public Shell getShell()
+ {
+ return getTable().getShell();
+ }
+
+ /**
+ * Required method from ISystemDeleteTarget.
+ * Decides whether to even show the delete menu item.
+ * Assumes scanSelections() has already been called
+ */
+ public boolean showDelete()
+ {
+ if (!_selectionFlagsUpdated)
+ scanSelections();
+ return _selectionShowDeleteAction;
+ }
+ /**
+ * Required method from ISystemDeleteTarget
+ * Decides whether to enable the delete menu item.
+ * Assumes scanSelections() has already been called
+ */
+ public boolean canDelete()
+ {
+ if (!_selectionFlagsUpdated)
+ scanSelections();
+ return _selectionEnableDeleteAction;
+ }
+
+ /*
+ * Required method from ISystemDeleteTarget
+ */
+ public boolean doDelete(IProgressMonitor monitor)
+ {
+ ISystemRegistry sr = SystemPlugin.getDefault().getSystemRegistry();
+ IStructuredSelection selection = (IStructuredSelection) getSelection();
+ Iterator elements = selection.iterator();
+ //int selectedCount = selection.size();
+ //Object multiSource[] = new Object[selectedCount];
+ //int idx = 0;
+ Object element = null;
+ //Object parentElement = getSelectedParent();
+ ISystemViewElementAdapter adapter = null;
+ boolean ok = true;
+ boolean anyOk = false;
+ Vector deletedVector = new Vector();
+ try
+ {
+ while (ok && elements.hasNext())
+ {
+ element = elements.next();
+ //multiSource[idx++] = element;
+ adapter = getAdapter(element);
+ ok = adapter.doDelete(getShell(), element, monitor);
+ if (ok)
+ {
+ anyOk = true;
+ deletedVector.addElement(element);
+ }
+ }
+ }
+ catch (SystemMessageException exc)
+ {
+ SystemMessageDialog.displayErrorMessage(getShell(), exc.getSystemMessage());
+ ok = false;
+ }
+ catch (Exception exc)
+ {
+ String msg = exc.getMessage();
+ if ((msg == null) || (exc instanceof ClassCastException))
+ msg = exc.getClass().getName();
+ SystemMessageDialog.displayErrorMessage(getShell(), SystemPlugin.getPluginMessage(ISystemMessages.MSG_EXCEPTION_DELETING).makeSubstitution(element, msg));
+ ok = false;
+ }
+ if (anyOk)
+ {
+ Object[] deleted = new Object[deletedVector.size()];
+ for (int idx = 0; idx < deleted.length; idx++)
+ deleted[idx] = deletedVector.elementAt(idx);
+ if (_selectionIsRemoteObject)
+ //sr.fireEvent(new com.ibm.etools.systems.model.impl.SystemResourceChangeEvent(deleted, ISystemResourceChangeEvent.EVENT_DELETE_REMOTE_MANY, null));
+ sr.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_DELETED, deletedVector, null, null, null, this);
+ else
+ sr.fireEvent(new org.eclipse.rse.model.SystemResourceChangeEvent(deleted, ISystemResourceChangeEvents.EVENT_DELETE_MANY, getInput()));
+ }
+ return ok;
+ }
+
+ // ---------------------------
+ // ISYSTEMRENAMETARGET METHODS
+ // ---------------------------
+
+ /**
+ * Required method from ISystemRenameTarget.
+ * Decides whether to even show the rename menu item.
+ * Assumes scanSelections() has already been called
+ */
+ public boolean showRename()
+ {
+ if (!_selectionFlagsUpdated)
+ scanSelections();
+ return _selectionShowRenameAction;
+ }
+ /**
+ * Required method from ISystemRenameTarget
+ * Decides whether to enable the rename menu item.
+ * Assumes scanSelections() has already been called
+ */
+ public boolean canRename()
+ {
+ if (!_selectionFlagsUpdated)
+ scanSelections();
+ return _selectionEnableRenameAction;
+ }
+
+ // default implementation
+ // in default table, parent is input
+ protected Object getParentForContent(Object element)
+ {
+ return _objectInput;
+ }
+
+ /**
+ * Required method from ISystemRenameTarget
+ */
+ public boolean doRename(String[] newNames)
+ {
+ ISystemRegistry sr = SystemPlugin.getDefault().getSystemRegistry();
+ IStructuredSelection selection = (IStructuredSelection) getSelection();
+ Iterator elements = selection.iterator();
+ int selectedCount = selection.size();
+ Object element = null;
+
+ ISystemViewElementAdapter adapter = null;
+ ISystemRemoteElementAdapter remoteAdapter = null;
+ String oldFullName = null;
+ boolean ok = true;
+ try
+ {
+ int nameIdx = 0;
+ while (ok && elements.hasNext())
+ {
+ element = elements.next();
+ adapter = getAdapter(element);
+ Object parentElement = getParentForContent(element);
+
+ remoteAdapter = getRemoteAdapter(element);
+ if (remoteAdapter != null)
+ oldFullName = remoteAdapter.getAbsoluteName(element);
+ // pre-rename
+ ok = adapter.doRename(getShell(), element, newNames[nameIdx++]);
+ if (ok)
+ {
+ if (remoteAdapter != null)
+ {
+ // do rename here
+ Widget widget = findItem(element);
+ if (widget != null)
+ {
+ updateItem(widget, element);
+ }
+
+ //sr.fireEvent(new com.ibm.etools.systems.model.impl.SystemResourceChangeEvent(element, ISystemResourceChangeEvent.EVENT_RENAME_REMOTE, oldFullName));
+ sr.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_RENAMED, element, parentElement, remoteAdapter.getSubSystem(element), oldFullName, this);
+
+ }
+ else
+ sr.fireEvent(new org.eclipse.rse.model.SystemResourceChangeEvent(element, ISystemResourceChangeEvents.EVENT_RENAME, parentElement));
+ }
+ }
+ }
+ catch (SystemMessageException exc)
+ {
+ SystemMessageDialog.displayErrorMessage(getShell(), exc.getSystemMessage());
+ ok = false;
+ }
+ catch (Exception exc)
+ {
+ //String msg = exc.getMessage();
+ //if ((msg == null) || (exc instanceof ClassCastException))
+ // msg = exc.getClass().getName();
+ SystemMessageDialog.displayErrorMessage(getShell(), SystemPlugin.getPluginMessage(ISystemMessages.MSG_EXCEPTION_RENAMING).makeSubstitution(element, exc),
+ //msg),
+ exc);
+ ok = false;
+ }
+ return ok;
+ }
+
+ /**
+ * Returns the implementation of ISystemRemoteElement for the given
+ * object. Returns null if this object does not adaptable to this.
+ */
+ protected ISystemRemoteElementAdapter getRemoteAdapter(Object o)
+ {
+ ISystemRemoteElementAdapter adapter = null;
+ if (!(o instanceof IAdaptable))
+ adapter = (ISystemRemoteElementAdapter) Platform.getAdapterManager().getAdapter(o, ISystemRemoteElementAdapter.class);
+ else
+ adapter = (ISystemRemoteElementAdapter) ((IAdaptable) o).getAdapter(ISystemRemoteElementAdapter.class);
+ if ((adapter != null) && (adapter instanceof ISystemViewElementAdapter))
+ ((ISystemViewElementAdapter) adapter).setViewer(this);
+ return adapter;
+ }
+
+ /**
+ * Return true if select all should be enabled for the given object.
+ * For a tree view, you should return true if and only if the selected object has children.
+ * You can use the passed in selection or ignore it and query your own selection.
+ */
+ public boolean enableSelectAll(IStructuredSelection selection)
+ {
+ return true;
+ }
+ /**
+ * When this action is run via Edit->Select All or via Ctrl+A, perform the
+ * select all action. For a tree view, this should select all the children
+ * of the given selected object. You can use the passed in selected object
+ * or ignore it and query the selected object yourself.
+ */
+ public void doSelectAll(IStructuredSelection selection)
+ {
+ Table table = getTable();
+ TableItem[] items = table.getItems();
+
+ table.setSelection(items);
+ Object[] objects = new Object[items.length];
+ for (int idx = 0; idx < items.length; idx++)
+ objects[idx] = items[idx].getData();
+ fireSelectionChanged(new SelectionChangedEvent(this, new StructuredSelection(objects)));
+ }
+
+ public void menuAboutToShow(IMenuManager manager)
+ {
+ SystemView.createStandardGroups(manager);
+
+ fillContextMenu(manager);
+
+ if (!menuListenerAdded)
+ {
+ if (manager instanceof MenuManager)
+ {
+ Menu m = ((MenuManager)manager).getMenu();
+ if (m != null)
+ {
+ menuListenerAdded = true;
+ SystemViewMenuListener ml = new SystemViewMenuListener();
+ if (_messageLine != null)
+ ml.setShowToolTipText(true, _messageLine);
+ m.addMenuListener(ml);
+ }
+ }
+ }
+
+ }
+
+ public ISelection getSelection()
+ {
+ ISelection selection = super.getSelection();
+ if (selection == null || selection.isEmpty())
+ {
+ // make the selection the parent
+ ArrayList list = new ArrayList();
+ if (_objectInput != null)
+ {
+ list.add(_objectInput);
+ selection = new StructuredSelection(list);
+ }
+ }
+
+ return selection;
+ }
+
+ public void fillContextMenu(IMenuManager menu)
+ {
+ IStructuredSelection selection = (IStructuredSelection) getSelection();
+ int selectionCount = selection.size();
+
+ {
+
+ // ADD COMMON ACTIONS...
+ // no need for refresh of object in table
+ //menu.appendToGroup(ISystemContextMenuConstants.GROUP_BUILD, getRefreshAction());
+
+ // COMMON RENAME ACTION...
+ if (canRename())
+ {
+ if (showRename())
+ menu.appendToGroup(ISystemContextMenuConstants.GROUP_REORGANIZE, getRenameAction());
+ }
+
+ // ADAPTER SPECIFIC ACTIONS
+ SystemMenuManager ourMenu = new SystemMenuManager(menu);
+
+ Iterator elements = selection.iterator();
+ Hashtable adapters = new Hashtable();
+ while (elements.hasNext())
+ {
+ Object element = elements.next();
+ ISystemViewElementAdapter adapter = getAdapter(element);
+ adapters.put(adapter, element); // want only unique adapters
+ }
+ Enumeration uniqueAdapters = adapters.keys();
+ Shell shell = getShell();
+ while (uniqueAdapters.hasMoreElements())
+ {
+ ISystemViewElementAdapter nextAdapter = (ISystemViewElementAdapter) uniqueAdapters.nextElement();
+ nextAdapter.addActions(ourMenu, selection, shell, ISystemContextMenuConstants.GROUP_ADAPTERS);
+
+ if (nextAdapter instanceof AbstractSystemViewAdapter)
+ {
+ AbstractSystemViewAdapter aVA = (AbstractSystemViewAdapter)nextAdapter;
+ // add remote actions
+ aVA.addCommonRemoteActions(ourMenu, selection, shell, ISystemContextMenuConstants.GROUP_ADAPTERS);
+
+ // add dynamic menu popups
+ aVA.addDynamicPopupMenuActions(ourMenu, selection, shell, ISystemContextMenuConstants.GROUP_ADDITIONS);
+ }
+ }
+
+ // wail through all actions, updating shell and selection
+ IContributionItem[] items = menu.getItems();
+ for (int idx = 0; idx < items.length; idx++)
+ {
+ if ((items[idx] instanceof ActionContributionItem) && (((ActionContributionItem) items[idx]).getAction() instanceof ISystemAction))
+ {
+ ISystemAction item = (ISystemAction) (((ActionContributionItem) items[idx]).getAction());
+ //item.setShell(getShell());
+ //item.setSelection(selection);
+ //item.setViewer(this);
+ item.setInputs(getShell(), this, selection);
+ }
+ else if (items[idx] instanceof SystemSubMenuManager)
+ {
+ SystemSubMenuManager item = (SystemSubMenuManager) items[idx];
+ //item.setShell(getShell());
+ //item.setSelection(selection);
+ //item.setViewer(this);
+ item.setInputs(getShell(), this, selection);
+ }
+ }
+
+ // COMMON DELETE ACTION...
+ if (canDelete() && showDelete())
+ {
+ //menu.add(getDeleteAction());
+ menu.appendToGroup(ISystemContextMenuConstants.GROUP_REORGANIZE, getDeleteAction());
+ ((ISystemAction) getDeleteAction()).setInputs(getShell(), this, selection);
+ menu.add(new Separator());
+ }
+
+ // PROPERTIES ACTION...
+ // This is supplied by the system, so we pretty much get it for free. It finds the
+ // registered propertyPages extension points registered for the selected object's class type.
+ //propertyDialogAction.selectionChanged(selection);
+
+ if (!_selectionIsRemoteObject) // is not a remote object
+ {
+ PropertyDialogAction pdAction = getPropertyDialogAction();
+ if (pdAction.isApplicableForSelection())
+ {
+
+ menu.appendToGroup(ISystemContextMenuConstants.GROUP_PROPERTIES, pdAction);
+ }
+ // OPEN IN NEW PERSPECTIVE ACTION... if (fromSystemViewPart && showOpenViewActions())
+ {
+ //SystemCascadingOpenToAction openToAction = getOpenToAction();
+ SystemOpenExplorerPerspectiveAction openToPerspectiveAction = getOpenToPerspectiveAction();
+ SystemShowInTableAction showInTableAction = getShowInTableAction();
+ openToPerspectiveAction.setSelection(selection);
+ showInTableAction.setSelection(selection);
+ //menu.appendToGroup(ISystemContextMenuConstants.GROUP_OPEN, openToAction.getSubMenu());
+ menu.appendToGroup(ISystemContextMenuConstants.GROUP_OPEN, openToPerspectiveAction);
+ menu.appendToGroup(ISystemContextMenuConstants.GROUP_OPEN, showInTableAction);
+
+ }
+ }
+ else // is a remote object
+ {
+ //Object firstSelection = selection.getFirstElement();
+ //ISystemRemoteElementAdapter remoteAdapter = getRemoteAdapter(firstSelection);
+ //logMyDebugMessage(this.getClass().getName(), ": there is a remote adapter");
+ SystemRemotePropertiesAction pdAction = getRemotePropertyDialogAction();
+ if (pdAction.isApplicableForSelection())
+ menu.appendToGroup(ISystemContextMenuConstants.GROUP_PROPERTIES, pdAction);
+ //else
+ //logMyDebugMessage(this.getClass().getName(), ": but it is not applicable for selection");
+ // --------------------------------------------------------------------------------------------------------------------
+ // look for and add any popup menu actions registered via our org.eclipse.rse.core.popupMenus extension point...
+ // --------------------------------------------------------------------------------------------------------------------
+ if (_workbenchPart != null)
+ {
+ SystemPopupMenuActionContributorManager.getManager().contributeObjectActions(_workbenchPart, ourMenu, this, null);
+ }
+ }
+
+ }
+ }
+
+ /**
+ * --------------------------------------------------------------------------------
+ * For many actions we have to walk the selection list and examine each selected
+ * object to decide if a given common action is supported or not.
+ *
+ * Walking this list multiple times while building the popup menu is a performance
+ * hit, so we have this common method that does it only once, setting instance
+ * variables for all of the decisions we are in interested in.
+ * --------------------------------------------------------------------------------
+ */
+ protected void scanSelections()
+ {
+ // initial these variables to true. Then if set to false even once, leave as false always...
+ _selectionShowRefreshAction = true;
+ _selectionShowOpenViewActions = true;
+ _selectionShowDeleteAction = true;
+ _selectionShowRenameAction = true;
+ _selectionEnableDeleteAction = true;
+ _selectionEnableRenameAction = true;
+ _selectionIsRemoteObject = true;
+ _selectionFlagsUpdated = true;
+
+ IStructuredSelection selection = (IStructuredSelection) getSelection();
+ Iterator elements = selection.iterator();
+ while (elements.hasNext())
+ {
+ Object element = elements.next();
+ ISystemViewElementAdapter adapter = getAdapter(element);
+
+ if (_selectionShowRefreshAction)
+ _selectionShowRefreshAction = adapter.showRefresh(element);
+
+ if (_selectionShowOpenViewActions)
+ _selectionShowOpenViewActions = adapter.showOpenViewActions(element);
+
+ if (_selectionShowDeleteAction)
+ _selectionShowDeleteAction = adapter.showDelete(element);
+
+ if (_selectionShowRenameAction)
+ _selectionShowRenameAction = adapter.showRename(element);
+
+ if (_selectionEnableDeleteAction)
+ _selectionEnableDeleteAction = _selectionShowDeleteAction && adapter.canDelete(element);
+ //System.out.println("ENABLE DELETE SET TO " + selectionEnableDeleteAction);
+
+ if (_selectionEnableRenameAction)
+ _selectionEnableRenameAction = _selectionShowRenameAction && adapter.canRename(element);
+
+ if (_selectionIsRemoteObject)
+ _selectionIsRemoteObject = (getRemoteAdapter(element) != null);
+ }
+
+ }
+
+ public void positionTo(String name)
+ {
+ ArrayList selectedItems = new ArrayList();
+ Table table = getTable();
+ int topIndex = 0;
+ for (int i = 0; i < table.getItemCount(); i++)
+ {
+ TableItem item = table.getItem(i);
+ Object data = item.getData();
+ if (data instanceof IAdaptable)
+ {
+ ISystemViewElementAdapter adapter = getAdapter(data);
+ String itemName = adapter.getName(data);
+
+ if (StringCompare.compare(name, itemName, false))
+ {
+ if (topIndex == 0)
+ {
+ topIndex = i;
+ }
+ selectedItems.add(item);
+ }
+ }
+ }
+
+ if (selectedItems.size() > 0)
+ {
+ TableItem[] tItems = new TableItem[selectedItems.size()];
+ for (int i = 0; i < selectedItems.size(); i++)
+ {
+ tItems[i] = (TableItem) selectedItems.get(i);
+ }
+
+ table.setSelection(tItems);
+ table.setTopIndex(topIndex);
+ setSelection(getSelection(), true);
+ }
+ }
+
+ void handleKeyPressed(KeyEvent event)
+ {
+ //System.out.println("Key Pressed");
+ //System.out.println("...event character : " + event.character + ", "+(int)event.character);
+ //System.out.println("...event state mask: " + event.stateMask);
+ //System.out.println("...CTRL : " + SWT.CTRL);
+ if ((event.character == SWT.DEL) && (event.stateMask == 0) && (((IStructuredSelection) getSelection()).size() > 0))
+ {
+ scanSelections();
+ /* DKM - 53694
+ if (showDelete() && canDelete())
+ {
+ SystemCommonDeleteAction dltAction = (SystemCommonDeleteAction) getDeleteAction();
+ dltAction.setShell(getShell());
+ dltAction.setSelection(getSelection());
+ dltAction.setViewer(this);
+ dltAction.run();
+ }
+ */
+ }
+ }
+
+ /**
+ * Display a message/status on the message/status line
+ */
+ public void displayMessage(String msg)
+ {
+ if (_messageLine != null)
+ _messageLine.setMessage(msg);
+ }
+ /**
+ * Clear message/status shown on the message/status line
+ */
+ public void clearMessage()
+ {
+ if (_messageLine != null)
+ _messageLine.clearMessage();
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableViewColumnManager.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableViewColumnManager.java
new file mode 100644
index 00000000000..e668557288d
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableViewColumnManager.java
@@ -0,0 +1,146 @@
+/********************************************************************************
+ * Copyright (c) 2004, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+import java.util.HashMap;
+
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.rse.core.SystemPreferencesManager;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+
+
+/**
+ * @author dmcknigh
+ */
+public class SystemTableViewColumnManager
+{
+ private Viewer _viewer;
+ protected HashMap _descriptorCache;
+ public SystemTableViewColumnManager(Viewer viewer)
+ {
+ _viewer = viewer;
+ _descriptorCache = new HashMap();
+ }
+
+ protected IPropertyDescriptor[] getCachedDescriptors(ISystemViewElementAdapter adapter)
+ {
+ Object descriptors = _descriptorCache.get(adapter);
+ if (descriptors != null && descriptors instanceof IPropertyDescriptor[])
+ {
+ return (IPropertyDescriptor[])descriptors;
+ }
+ return null;
+ }
+
+ protected void putCachedDescriptors(ISystemViewElementAdapter adapter, IPropertyDescriptor[] descriptors)
+ {
+ _descriptorCache.put(adapter, descriptors);
+ }
+
+ public void setCustomDescriptors(ISystemViewElementAdapter adapter, IPropertyDescriptor[] descriptors)
+ {
+ putCachedDescriptors(adapter, descriptors);
+ SystemPreferencesManager mgr = SystemPreferencesManager.getPreferencesManager();
+ String historyKey = getHistoryKey(adapter);
+ String[] history = new String[descriptors.length];
+ for (int i = 0; i < descriptors.length; i++)
+ {
+ history[i] = descriptors[i].getId().toString();
+ }
+
+ mgr.setWidgetHistory(historyKey, history);
+ }
+
+ /**
+ * Gets the property descriptors to display as columns in the table
+ * The set of descriptors and their order may change depending on user customizations
+ * @param adapter
+ * @return
+ */
+ public IPropertyDescriptor[] getVisibleDescriptors(ISystemViewElementAdapter adapter)
+ {
+ if (adapter != null)
+ {
+ IPropertyDescriptor[] descriptors = getCachedDescriptors(adapter);
+ if (descriptors == null)
+ {
+ return getCustomDescriptors(adapter);
+ }
+ else
+ {
+ return descriptors;
+ }
+ }
+
+ return new IPropertyDescriptor[0];
+ }
+
+ private String getHistoryKey(ISystemViewElementAdapter adapter)
+ {
+ String adapterName = adapter.getClass().getName();
+ String viewName = _viewer.getClass().getName();
+ return adapterName + ":" + viewName;
+ }
+
+ protected IPropertyDescriptor[] getCustomDescriptors(ISystemViewElementAdapter adapter)
+ {
+ IPropertyDescriptor[] uniqueDescriptors = adapter.getUniquePropertyDescriptors();
+
+ SystemPreferencesManager mgr = SystemPreferencesManager.getPreferencesManager();
+ String historyKey = getHistoryKey(adapter);
+ String[] history = mgr.getWidgetHistory(historyKey);
+
+ // determine the order and which of the uniqueDescriptors to use based on the history
+ if (history != null && history.length > 0)
+ {
+ int len = history.length;
+ if (uniqueDescriptors != null && uniqueDescriptors.length < len)
+ {
+ len = uniqueDescriptors.length;
+ }
+ IPropertyDescriptor[] customDescriptors = new IPropertyDescriptor[len];
+ for (int i = 0; i < len; i++)
+ {
+ String propertyName = history[i];
+ // find the associated descriptor
+ boolean found = false;
+ for (int d = 0; d < uniqueDescriptors.length && !found; d++)
+ {
+ IPropertyDescriptor descriptor = uniqueDescriptors[d];
+ if (propertyName.equals(descriptor.getId().toString()))
+ {
+ customDescriptors[i] = descriptor;
+ found = true;
+ }
+ }
+ // DKM - problem here - no such descriptor exists anymore
+ if (found == false)
+ {
+ // invalidate the current history
+ setCustomDescriptors(adapter, uniqueDescriptors);
+ return uniqueDescriptors;
+ }
+ }
+ return customDescriptors;
+ }
+ else
+ {
+ setCustomDescriptors(adapter, uniqueDescriptors);
+ }
+
+ return uniqueDescriptors;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableViewFilter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableViewFilter.java
new file mode 100644
index 00000000000..6760405620c
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableViewFilter.java
@@ -0,0 +1,81 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.rse.services.clientserver.StringCompare;
+
+
+/**
+ * This class is used for filtering in the SystemTableView. The filter
+ * determines what objects to show in the view.
+ *
+ */
+public class SystemTableViewFilter extends ViewerFilter
+{
+
+ private String[] _filters;
+
+ public SystemTableViewFilter()
+ {
+ super();
+
+ }
+
+ public void setFilters(String[] filters)
+ {
+ _filters = filters;
+ }
+
+ public String[] getFilters()
+ {
+ return _filters;
+ }
+
+ public boolean select(Viewer viewer, Object parent, Object element)
+ {
+ boolean result = true;
+ if (viewer instanceof TableViewer)
+ {
+ if (_filters != null)
+ {
+ TableViewer tviewer = (TableViewer) viewer;
+ ITableLabelProvider labelProvider = (ITableLabelProvider) tviewer.getLabelProvider();
+
+ for (int i = 0; i < _filters.length && result; i++)
+ {
+ String filter = _filters[i];
+
+ if (filter != null && filter.length() > 0)
+ {
+ String text = labelProvider.getColumnText(element, i);
+ if (!StringCompare.compare(filter, text, true))
+ {
+ result = false;
+ }
+ }
+ }
+ }
+ }
+
+ return result;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableViewPart.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableViewPart.java
new file mode 100644
index 00000000000..ff12ddd9a26
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableViewPart.java
@@ -0,0 +1,1839 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IStatusLineManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.window.Window;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.SystemPreferencesManager;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.filters.ISystemFilterReference;
+import org.eclipse.rse.model.IHost;
+import org.eclipse.rse.model.ISystemContainer;
+import org.eclipse.rse.model.ISystemProfile;
+import org.eclipse.rse.model.ISystemRegistry;
+import org.eclipse.rse.model.ISystemRemoteChangeEvent;
+import org.eclipse.rse.model.ISystemRemoteChangeEvents;
+import org.eclipse.rse.model.ISystemRemoteChangeListener;
+import org.eclipse.rse.model.ISystemResourceChangeEvent;
+import org.eclipse.rse.model.ISystemResourceChangeEvents;
+import org.eclipse.rse.model.ISystemResourceChangeListener;
+import org.eclipse.rse.model.SystemResourceChangeEvent;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.SystemPropertyResources;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.SystemWidgetHelpers;
+import org.eclipse.rse.ui.actions.SystemCommonDeleteAction;
+import org.eclipse.rse.ui.actions.SystemCopyToClipboardAction;
+import org.eclipse.rse.ui.actions.SystemPasteFromClipboardAction;
+import org.eclipse.rse.ui.actions.SystemRefreshAction;
+import org.eclipse.rse.ui.actions.SystemTablePrintAction;
+import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
+import org.eclipse.rse.ui.dialogs.SystemSelectAnythingDialog;
+import org.eclipse.rse.ui.messages.ISystemMessageLine;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+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.List;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.Widget;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.ISelectionListener;
+import org.eclipse.ui.ISelectionService;
+import org.eclipse.ui.IViewSite;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.part.CellEditorActionHandler;
+import org.eclipse.ui.part.ViewPart;
+import org.eclipse.ui.progress.UIJob;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.osgi.framework.Bundle;
+
+
+
+/**
+ * Comment goes here
+ */
+public class SystemTableViewPart extends ViewPart implements ISelectionListener, ISelectionChangedListener,
+ ISystemMessageLine, ISystemResourceChangeListener, ISystemRemoteChangeListener, IRSEViewPart
+{
+
+
+ class BrowseAction extends Action
+ {
+
+ public BrowseAction()
+ {
+ }
+
+ public BrowseAction(String label, ImageDescriptor des)
+ {
+ super(label, des);
+
+ setToolTipText(label);
+ }
+
+ public void checkEnabledState()
+ {
+ if (_viewer != null && _viewer.getInput() != null)
+ {
+ setEnabled(true);
+ }
+ else
+ {
+ setEnabled(false);
+ }
+ }
+
+ public void run()
+ {
+ }
+ }
+
+ class ForwardAction extends BrowseAction
+ {
+ public ForwardAction()
+ {
+ super(SystemResources.ACTION_HISTORY_MOVEFORWARD_LABEL, getEclipseImageDescriptor("elcl16/forward_nav.gif"));
+
+ setTitleToolTip(SystemResources.ACTION_HISTORY_MOVEFORWARD_TOOLTIP);
+ setDisabledImageDescriptor(getEclipseImageDescriptor("dlcl16/forward_nav.gif"));
+ }
+
+ public void checkEnabledState()
+ {
+ if (_isLocked && _browseHistory != null && _browseHistory.size() > 0)
+ {
+ if (_browsePosition < _browseHistory.size() - 1)
+ {
+ setEnabled(true);
+ return;
+ }
+ }
+
+ setEnabled(false);
+ }
+
+ public void run()
+ {
+ _browsePosition++;
+
+ HistoryItem historyItem = (HistoryItem) _browseHistory.get(_browsePosition);
+ setInput(historyItem);
+ }
+ }
+
+ class BackwardAction extends BrowseAction
+ {
+ public BackwardAction()
+ {
+ super(SystemResources.ACTION_HISTORY_MOVEBACKWARD_LABEL, getEclipseImageDescriptor("elcl16/backward_nav.gif"));
+ setTitleToolTip(SystemResources.ACTION_HISTORY_MOVEBACKWARD_TOOLTIP);
+ setDisabledImageDescriptor(getEclipseImageDescriptor("dlcl16/backward_nav.gif"));
+ }
+
+ public void checkEnabledState()
+ {
+ if (_isLocked && _browseHistory != null && _browseHistory.size() > 0)
+ {
+ if (_browsePosition > 0)
+ {
+ setEnabled(true);
+ return;
+ }
+ }
+
+ setEnabled(false);
+ }
+
+ public void run()
+ {
+ _browsePosition--;
+
+ HistoryItem historyItem = (HistoryItem) _browseHistory.get(_browsePosition);
+ setInput(historyItem);
+ }
+ }
+
+ class UpAction extends BrowseAction
+ {
+ private IAdaptable _parent;
+ public UpAction()
+ {
+ super(SystemResources.ACTION_MOVEUP_LABEL, getEclipseImageDescriptor("elcl16/up_nav.gif"));
+
+ setDisabledImageDescriptor(getEclipseImageDescriptor("dlcl16/up_nav.gif"));
+ }
+
+ public void checkEnabledState()
+ {
+ if (_viewer.getInput() != null)
+ {
+ SystemTableViewProvider provider = (SystemTableViewProvider) _viewer.getContentProvider();
+
+ // assume there is a parent
+ if (provider != null)
+ {
+ Object parent = provider.getParent(_viewer.getInput());
+ if (parent instanceof IAdaptable)
+ {
+ _parent = (IAdaptable) parent;
+ boolean enabled = _parent != null;
+ setEnabled(enabled);
+ }
+ }
+ else
+ {
+ _parent = null;
+ setEnabled(false);
+ }
+ }
+ else
+ {
+ _parent = null;
+ setEnabled(false);
+ }
+ }
+
+ public void run()
+ {
+ if (_parent != null)
+ {
+ setInput(_parent);
+ }
+ }
+ }
+
+ class LockAction extends BrowseAction
+ {
+ public LockAction()
+ {
+ super();
+ setImageDescriptor(SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_LOCK_ID));
+ String label = determineLabel();
+ setText(label);
+ setToolTipText(label);
+ }
+
+ /**
+ * Sets as checked or unchecked, depending on the lock state. Also changes the text and tooltip.
+ */
+ public void checkEnabledState()
+ {
+ setChecked(_isLocked);
+ String label = determineLabel();
+ setText(label);
+ setToolTipText(label);
+ }
+
+ public void run()
+ {
+ _isLocked = !_isLocked;
+ showLock();
+ }
+
+ /**
+ * Returns the label depending on lock state.
+ * @return the label.
+ */
+ public String determineLabel() {
+
+ if (!_isLocked) {
+ return SystemResources.ACTION_LOCK_LABEL;
+ }
+ else {
+ return SystemResources.ACTION_UNLOCK_LABEL;
+ }
+ }
+
+ /**
+ * Returns the tooltip depending on lock state.
+ * @return the tooltip.
+ */
+ public String determineTooltip() {
+
+ if (!_isLocked) {
+ return SystemResources.ACTION_LOCK_TOOLTIP;
+ }
+ else {
+ return SystemResources.ACTION_UNLOCK_TOOLTIP;
+ }
+ }
+ }
+
+ class RefreshAction extends BrowseAction
+ {
+ public RefreshAction()
+ {
+ super(SystemResources.ACTION_REFRESH_LABEL,
+ //SystemPlugin.getDefault().getImageDescriptor(ICON_SYSTEM_REFRESH_ID));
+ SystemPlugin.getDefault().getImageDescriptorFromIDE(ISystemIconConstants.ICON_IDE_REFRESH_ID));
+ }
+
+ public void run()
+ {
+ Object inputObject = _viewer.getInput();
+ if (inputObject instanceof ISystemContainer)
+ {
+ ((ISystemContainer)inputObject).markStale(true);
+ }
+ ((SystemTableViewProvider) _viewer.getContentProvider()).flushCache();
+ ISystemRegistry registry = SystemPlugin.getTheSystemRegistry();
+ registry.fireEvent(new SystemResourceChangeEvent(inputObject, ISystemResourceChangeEvents.EVENT_REFRESH, inputObject));
+
+ //_viewer.refresh();
+
+ // refresh layout too
+ //_viewer.computeLayout(true);
+
+ }
+ }
+
+ class SelectAllAction extends BrowseAction
+ {
+ public SelectAllAction()
+ {
+ super(SystemResources.ACTION_SELECT_ALL_LABEL, null);
+ setToolTipText(SystemResources.ACTION_SELECT_ALL_TOOLTIP);
+ }
+
+ public void checkEnabledState()
+ {
+ if (_viewer != null && _viewer.getInput() != null)
+ {
+ setEnabled(true);
+ }
+ else
+ {
+ setEnabled(false);
+ }
+ }
+ public void run()
+ {
+ _viewer.getTable().selectAll();
+ // force viewer selection change
+ _viewer.setSelection(_viewer.getSelection());
+ }
+ }
+
+ class SelectInputAction extends BrowseAction
+ {
+ public SelectInputAction()
+ {
+ super(SystemResources.ACTION_SELECT_INPUT_LABEL, null);
+ setToolTipText(SystemResources.ACTION_SELECT_INPUT_TOOLTIP);
+ }
+
+ public void checkEnabledState()
+ {
+ setEnabled(true);
+ }
+
+ public void run()
+ {
+
+ SystemSelectAnythingDialog dlg = new SystemSelectAnythingDialog(_viewer.getShell(), SystemResources.ACTION_SELECT_INPUT_DLG);
+ Object inputObject = _viewer.getInput();
+ if (inputObject == null)
+ {
+ inputObject = SystemPlugin.getTheSystemRegistry();
+ }
+ dlg.setInputObject(inputObject);
+ if (dlg.open() == Window.OK)
+ {
+ Object selected = dlg.getSelectedObject();
+ if (selected != null && selected instanceof IAdaptable)
+ {
+ IAdaptable adaptable = (IAdaptable)selected;
+ ((ISystemViewElementAdapter)adaptable.getAdapter(ISystemViewElementAdapter.class)).setViewer(_viewer);
+ setInput(adaptable);
+ }
+ }
+ }
+ }
+
+ class PositionToAction extends BrowseAction
+ {
+ class PositionToDialog extends SystemPromptDialog
+ {
+ private String _name;
+ private Combo _cbName;
+ public PositionToDialog(Shell shell, String title, HistoryItem historyItem)
+ {
+ super(shell, title);
+ }
+
+ public String getPositionName()
+ {
+ return _name;
+ }
+
+ protected void buttonPressed(int buttonId)
+ {
+ setReturnCode(buttonId);
+ _name = _cbName.getText();
+ close();
+ }
+
+ protected Control getInitialFocusControl()
+ {
+ return _cbName;
+ }
+
+ public Control createInner(Composite parent)
+ {
+ Composite c = SystemWidgetHelpers.createComposite(parent, 2);
+
+ Label aLabel = new Label(c, SWT.NONE);
+ aLabel.setText(SystemPropertyResources.RESID_PROPERTY_NAME_LABEL);
+
+ _cbName = SystemWidgetHelpers.createCombo(c, null);
+ GridData textData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
+ _cbName.setLayoutData(textData);
+ _cbName.setText("*");
+ _cbName.setToolTipText(SystemResources.RESID_TABLE_POSITIONTO_ENTRY_TOOLTIP);
+
+ this.getShell().setText(SystemResources.RESID_TABLE_POSITIONTO_LABEL);
+ setHelp();
+ return c;
+ }
+
+ private void setHelp()
+ {
+ setHelp(SystemPlugin.HELPPREFIX + "gnpt0000");
+ }
+ }
+
+ public PositionToAction()
+ {
+ super(SystemResources.ACTION_POSITIONTO_LABEL, null);
+ setToolTipText(SystemResources.ACTION_POSITIONTO_TOOLTIP);
+ }
+
+ public void run()
+ {
+
+ PositionToDialog posDialog = new PositionToDialog(getViewer().getShell(), getTitle(), _currentItem);
+ if (posDialog.open() == Window.OK)
+ {
+ String name = posDialog.getPositionName();
+
+ _viewer.positionTo(name);
+ }
+ }
+ }
+
+ class SubSetAction extends BrowseAction
+ {
+ class SubSetDialog extends SystemPromptDialog
+ {
+ private String[] _filters;
+ private Text[] _controls;
+ private IPropertyDescriptor[] _uniqueDescriptors;
+ private HistoryItem _historyItem;
+
+ public SubSetDialog(Shell shell, IPropertyDescriptor[] uniqueDescriptors, HistoryItem historyItem)
+ {
+ super(shell, SystemResources.RESID_TABLE_SUBSET_LABEL);
+ _uniqueDescriptors = uniqueDescriptors;
+ _historyItem = historyItem;
+ }
+
+ public String[] getFilters()
+ {
+ return _filters;
+ }
+
+ protected void buttonPressed(int buttonId)
+ {
+ setReturnCode(buttonId);
+
+ for (int i = 0; i < _controls.length; i++)
+ {
+ _filters[i] = _controls[i].getText();
+ }
+
+ close();
+ }
+
+ protected Control getInitialFocusControl()
+ {
+ return _controls[0];
+ }
+
+ public Control createInner(Composite parent)
+ {
+ Composite c = SystemWidgetHelpers.createComposite(parent, 2);
+
+ int numberOfFields = _uniqueDescriptors.length;
+ _controls = new Text[numberOfFields + 1];
+ _filters = new String[numberOfFields + 1];
+
+ Label nLabel = new Label(c, SWT.NONE);
+ nLabel.setText(SystemPropertyResources.RESID_PROPERTY_NAME_LABEL);
+
+ String[] histFilters = null;
+ if (_historyItem != null)
+ {
+ histFilters = _historyItem.getFilters();
+ }
+
+ _controls[0] = SystemWidgetHelpers.createTextField(c, null);
+ GridData textData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
+ _controls[0].setLayoutData(textData);
+ _controls[0].setText("*");
+ _controls[0].setToolTipText(SystemResources.RESID_TABLE_SUBSET_ENTRY_TOOLTIP);
+
+ if (histFilters != null)
+ {
+ _controls[0].setText(histFilters[0]);
+ }
+
+ for (int i = 0; i < numberOfFields; i++)
+ {
+ IPropertyDescriptor des = _uniqueDescriptors[i];
+
+ Label aLabel = new Label(c, SWT.NONE);
+ aLabel.setText(des.getDisplayName());
+
+ _controls[i + 1] = SystemWidgetHelpers.createTextField(c, null);
+ GridData textData3 = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
+ _controls[i + 1].setLayoutData(textData3);
+ _controls[i + 1].setText("*");
+ if (histFilters != null)
+ {
+ _controls[i + 1].setText(histFilters[i + 1]);
+ _controls[i + 1].setToolTipText(SystemResources.RESID_TABLE_SUBSET_ENTRY_TOOLTIP);
+ }
+ }
+
+ setHelp();
+ return c;
+ }
+
+ private void setHelp()
+ {
+ setHelp(SystemPlugin.HELPPREFIX + "gnss0000");
+ }
+ }
+
+ public SubSetAction()
+ {
+ super(SystemResources.ACTION_SUBSET_LABEL, null);
+ setToolTipText(SystemResources.ACTION_SUBSET_TOOLTIP);
+ }
+
+ public void run()
+ {
+ SubSetDialog subsetDialog = new SubSetDialog(getViewer().getShell(), _viewer.getVisibleDescriptors(_viewer.getInput()), _currentItem);
+ if (subsetDialog.open() == Window.OK)
+ {
+ String[] filters = subsetDialog.getFilters();
+ _currentItem.setFilters(filters);
+ _viewer.setViewFilters(filters);
+
+ }
+ }
+ }
+
+ class HistoryItem
+ {
+ private String[] _filters;
+ private IAdaptable _object;
+
+ public HistoryItem(IAdaptable object, String[] filters)
+ {
+ _object = object;
+ _filters = filters;
+ }
+
+ public IAdaptable getObject()
+ {
+ return _object;
+ }
+
+ public String[] getFilters()
+ {
+ return _filters;
+ }
+
+ public void setFilters(String[] filters)
+ {
+ _filters = filters;
+ }
+ }
+
+ class RestoreStateRunnable extends UIJob
+ {
+ private IMemento _memento;
+ public RestoreStateRunnable(IMemento memento)
+ {
+ super("Restore RSE Table");
+ _memento = memento;
+ }
+
+ public IStatus runInUIThread(IProgressMonitor monitor)
+ {
+ IMemento memento = _memento;
+ String profileId = memento.getString(TAG_TABLE_VIEW_PROFILE_ID);
+ String connectionId = memento.getString(TAG_TABLE_VIEW_CONNECTION_ID);
+ String subsystemId = memento.getString(TAG_TABLE_VIEW_SUBSYSTEM_ID);
+ String filterID = memento.getString(TAG_TABLE_VIEW_FILTER_ID);
+ String objectID = memento.getString(TAG_TABLE_VIEW_OBJECT_ID);
+
+ ISystemRegistry registry = SystemPlugin.getTheSystemRegistry();
+ Object input = null;
+ if (subsystemId == null)
+ {
+ if (connectionId != null)
+ {
+
+ ISystemProfile profile = registry.getSystemProfile(profileId);
+ input = registry.getHost(profile, connectionId);
+ }
+ else
+ {
+ // TODO why did we use null for a while?
+ //input = null;
+ input = registry;
+ }
+ }
+ else
+ {
+ // from the subsystem ID determine the profile, system and subsystem
+ ISubSystem subsystem = registry.getSubSystem(subsystemId);
+
+ if (subsystem != null)
+ {
+ if (filterID == null && objectID == null)
+ {
+ input = subsystem;
+ }
+ else
+ {
+
+ if (!subsystem.isConnected())
+ {
+ try
+ {
+ subsystem.connect();
+ }
+ catch (Exception e)
+ {
+ return Status.CANCEL_STATUS;
+ }
+ }
+ if (subsystem.isConnected())
+ {
+
+ if (filterID != null)
+ {
+ try
+ {
+ input = subsystem.getObjectWithAbsoluteName(filterID);
+ }
+ catch (Exception e)
+ {
+ }
+ }
+ else
+ {
+
+ if (objectID != null)
+ {
+
+ try
+ {
+ input = subsystem.getObjectWithAbsoluteName(objectID);
+ }
+ catch (Exception e)
+ {
+ return Status.CANCEL_STATUS;
+ }
+ }
+ } // end else
+ } // end if (subsystem.isConnected)
+ } // end else
+ } // end if (subsystem != null)
+ } // end else
+
+ if (input != null && input instanceof IAdaptable)
+ {
+ _mementoInput = (IAdaptable) input;
+ if (_mementoInput != null && _viewer != null)
+ {
+ String columnWidths = memento.getString(TAG_TABLE_VIEW_COLUMN_WIDTHS_ID);
+ if (columnWidths != null)
+ {
+ StringTokenizer tok = new StringTokenizer(columnWidths, ",");
+ int[] colWidths = new int[tok.countTokens()];
+ int t = 0;
+ while (tok.hasMoreTokens())
+ {
+ String columnStr = tok.nextToken();
+ colWidths[t] = Integer.parseInt(columnStr);
+ t++;
+ }
+
+ _viewer.setLastColumnWidths(colWidths);
+ }
+
+ setInput(_mementoInput);
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ }
+
+
+
+ private class SelectColumnsAction extends BrowseAction
+ {
+
+ class SelectColumnsDialog extends SystemPromptDialog
+ {
+ private ISystemViewElementAdapter _adapter;
+ private SystemTableViewColumnManager _columnManager;
+ private IPropertyDescriptor[] _uniqueDescriptors;
+ private ArrayList _currentDisplayedDescriptors;
+ private ArrayList _availableDescriptors;
+
+ private List _availableList;
+ private List _displayedList;
+
+ private Button _addButton;
+ private Button _removeButton;
+ private Button _upButton;
+ private Button _downButton;
+
+
+ public SelectColumnsDialog(Shell shell, ISystemViewElementAdapter viewAdapter, SystemTableViewColumnManager columnManager)
+ {
+ super(shell, SystemResources.RESID_TABLE_SELECT_COLUMNS_LABEL);
+ _adapter = viewAdapter;
+ _columnManager = columnManager;
+ _uniqueDescriptors = viewAdapter.getUniquePropertyDescriptors();
+ IPropertyDescriptor[] initialDisplayedDescriptors = _columnManager.getVisibleDescriptors(_adapter);
+ _currentDisplayedDescriptors = new ArrayList(initialDisplayedDescriptors.length);
+ for (int i = 0; i < initialDisplayedDescriptors.length;i++)
+ {
+ if (!_currentDisplayedDescriptors.contains(initialDisplayedDescriptors[i]))
+ _currentDisplayedDescriptors.add(initialDisplayedDescriptors[i]);
+ }
+ _availableDescriptors = new ArrayList(_uniqueDescriptors.length);
+ for (int i = 0; i < _uniqueDescriptors.length;i++)
+ {
+ if (!_currentDisplayedDescriptors.contains(_uniqueDescriptors[i]))
+ {
+ _availableDescriptors.add(_uniqueDescriptors[i]);
+ }
+ }
+ }
+
+
+ public void handleEvent(Event e)
+ {
+ Widget source = e.widget;
+ if (source == _addButton)
+ {
+ int[] toAdd = _availableList.getSelectionIndices();
+ addToDisplay(toAdd);
+ }
+ else if (source == _removeButton)
+ {
+ int[] toAdd = _displayedList.getSelectionIndices();
+ removeFromDisplay(toAdd);
+ }
+ else if (source == _upButton)
+ {
+ int index = _displayedList.getSelectionIndex();
+ moveUp(index);
+ _displayedList.select(index - 1);
+ }
+ else if (source == _downButton)
+ {
+ int index = _displayedList.getSelectionIndex();
+ moveDown(index);
+ _displayedList.select(index + 1);
+ }
+
+ // update button enable states
+ updateEnableStates();
+ }
+
+ public IPropertyDescriptor[] getDisplayedColumns()
+ {
+ IPropertyDescriptor[] displayedColumns = new IPropertyDescriptor[_currentDisplayedDescriptors.size()];
+ for (int i = 0; i< _currentDisplayedDescriptors.size();i++)
+ {
+ displayedColumns[i]= (IPropertyDescriptor)_currentDisplayedDescriptors.get(i);
+ }
+ return displayedColumns;
+ }
+
+ private void updateEnableStates()
+ {
+ boolean enableAdd = false;
+ boolean enableRemove = false;
+ boolean enableUp = false;
+ boolean enableDown = false;
+
+ int[] availableSelected = _availableList.getSelectionIndices();
+ for (int i = 0; i < availableSelected.length; i++)
+ {
+ int index = availableSelected[i];
+ IPropertyDescriptor descriptor = (IPropertyDescriptor)_availableDescriptors.get(index);
+ if (!_currentDisplayedDescriptors.contains(descriptor))
+ {
+ enableAdd = true;
+ }
+ }
+
+ if (_displayedList.getSelectionCount()>0)
+ {
+ enableRemove = true;
+
+ int index = _displayedList.getSelectionIndex();
+ if (index > 0)
+ {
+ enableUp = true;
+ }
+ if (index < _displayedList.getItemCount()-1)
+ {
+ enableDown = true;
+ }
+ }
+
+ _addButton.setEnabled(enableAdd);
+ _removeButton.setEnabled(enableRemove);
+ _upButton.setEnabled(enableUp);
+ _downButton.setEnabled(enableDown);
+
+ }
+
+ private void moveUp(int index)
+ {
+ Object obj = _currentDisplayedDescriptors.remove(index);
+ _currentDisplayedDescriptors.add(index - 1, obj);
+ refreshDisplayedList();
+ }
+
+ private void moveDown(int index)
+ {
+ Object obj = _currentDisplayedDescriptors.remove(index);
+ _currentDisplayedDescriptors.add(index + 1, obj);
+
+ refreshDisplayedList();
+ }
+
+ private void addToDisplay(int[] toAdd)
+ {
+ ArrayList added = new ArrayList();
+ for (int i = 0; i < toAdd.length; i++)
+ {
+ int index = toAdd[i];
+
+ IPropertyDescriptor descriptor = (IPropertyDescriptor)_availableDescriptors.get(index);
+
+ if (!_currentDisplayedDescriptors.contains(descriptor))
+ {
+ _currentDisplayedDescriptors.add(descriptor);
+ added.add(descriptor);
+ }
+ }
+
+ for (int i = 0; i < added.size(); i++)
+ {
+ _availableDescriptors.remove(added.get(i));
+ }
+
+
+ refreshAvailableList();
+ refreshDisplayedList();
+
+ }
+
+ private void removeFromDisplay(int[] toRemove)
+ {
+ for (int i = 0; i < toRemove.length; i++)
+ {
+ int index = toRemove[i];
+ IPropertyDescriptor descriptor = (IPropertyDescriptor)_currentDisplayedDescriptors.get(index);
+ _currentDisplayedDescriptors.remove(index);
+ _availableDescriptors.add(descriptor);
+ }
+ refreshDisplayedList();
+ refreshAvailableList();
+ }
+
+ protected void buttonPressed(int buttonId)
+ {
+ setReturnCode(buttonId);
+
+ close();
+ }
+
+ protected Control getInitialFocusControl()
+ {
+ return _availableList;
+ }
+
+ public Control createInner(Composite parent)
+ {
+ Composite main = SystemWidgetHelpers.createComposite(parent, 1);
+
+ Label label = SystemWidgetHelpers.createLabel(main, SystemResources.RESID_TABLE_SELECT_COLUMNS_DESCRIPTION_LABEL);
+
+ Composite c = SystemWidgetHelpers.createComposite(main, 4);
+ c.setLayoutData(new GridData(GridData.FILL_BOTH));
+ _availableList = SystemWidgetHelpers.createListBox(c, SystemResources.RESID_TABLE_SELECT_COLUMNS_AVAILABLE_LABEL, this, true);
+
+ Composite addRemoveComposite = SystemWidgetHelpers.createComposite(c, 1);
+ addRemoveComposite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_CENTER));
+ _addButton = SystemWidgetHelpers.createPushButton(addRemoveComposite,
+ SystemResources.RESID_TABLE_SELECT_COLUMNS_ADD_LABEL,
+ this);
+ _addButton.setToolTipText(SystemResources.RESID_TABLE_SELECT_COLUMNS_ADD_TOOLTIP);
+
+ _removeButton = SystemWidgetHelpers.createPushButton(addRemoveComposite,
+ SystemResources.RESID_TABLE_SELECT_COLUMNS_REMOVE_LABEL,
+ this);
+ _removeButton.setToolTipText(SystemResources.RESID_TABLE_SELECT_COLUMNS_REMOVE_TOOLTIP);
+
+ _displayedList = SystemWidgetHelpers.createListBox(c, SystemResources.RESID_TABLE_SELECT_COLUMNS_DISPLAYED_LABEL, this, false);
+
+ Composite upDownComposite = SystemWidgetHelpers.createComposite(c, 1);
+ upDownComposite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_CENTER));
+ _upButton = SystemWidgetHelpers.createPushButton(upDownComposite,
+ SystemResources.RESID_TABLE_SELECT_COLUMNS_UP_LABEL,
+ this);
+ _upButton.setToolTipText(SystemResources.RESID_TABLE_SELECT_COLUMNS_UP_TOOLTIP);
+
+ _downButton = SystemWidgetHelpers.createPushButton(upDownComposite,
+ SystemResources.RESID_TABLE_SELECT_COLUMNS_DOWN_LABEL,
+ this);
+ _downButton.setToolTipText(SystemResources.RESID_TABLE_SELECT_COLUMNS_DOWN_TOOLTIP);
+
+ initLists();
+
+ setHelp();
+ return c;
+ }
+
+ private void initLists()
+ {
+ refreshAvailableList();
+ refreshDisplayedList();
+ updateEnableStates();
+ }
+
+ private void refreshAvailableList()
+ {
+ _availableList.removeAll();
+ // initialize available list
+ for (int i = 0; i < _availableDescriptors.size(); i++)
+ {
+ IPropertyDescriptor descriptor = (IPropertyDescriptor)_availableDescriptors.get(i);
+ _availableList.add(descriptor.getDisplayName());
+ }
+ }
+
+ private void refreshDisplayedList()
+ {
+ _displayedList.removeAll();
+ // initialize display list
+ for (int i = 0; i < _currentDisplayedDescriptors.size(); i++)
+ {
+
+ Object obj = _currentDisplayedDescriptors.get(i);
+ if (obj != null && obj instanceof IPropertyDescriptor)
+ {
+ _displayedList.add(((IPropertyDescriptor)obj).getDisplayName());
+ }
+ }
+ }
+
+ private void setHelp()
+ {
+ setHelp(SystemPlugin.HELPPREFIX + "gntc0000");
+ }
+ }
+
+ public SelectColumnsAction()
+ {
+ super(SystemResources.ACTION_SELECTCOLUMNS_LABEL, null);
+ setToolTipText(SystemResources.ACTION_SELECTCOLUMNS_TOOLTIP);
+ setImageDescriptor(SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_FILTER_ID));
+ }
+
+ public void checkEnabledState()
+ {
+ if (_viewer != null && _viewer.getInput() != null)
+ {
+ setEnabled(true);
+ }
+ else
+ {
+ setEnabled(false);
+ }
+ }
+ public void run()
+ {
+ SystemTableViewColumnManager mgr = _viewer.getColumnManager();
+ ISystemViewElementAdapter adapter = _viewer.getAdapterForContents();
+ SelectColumnsDialog dlg = new SelectColumnsDialog(getShell(), adapter, mgr);
+ if (dlg.open() == Window.OK)
+ {
+ mgr.setCustomDescriptors(adapter, dlg.getDisplayedColumns());
+ _viewer.computeLayout(true);
+ _viewer.refresh();
+ }
+ }
+ }
+
+ private HistoryItem _currentItem;
+
+ private SystemTableView _viewer;
+
+ protected ArrayList _browseHistory;
+ protected int _browsePosition;
+
+ private ForwardAction _forwardAction = null;
+ private BackwardAction _backwardAction = null;
+ private UpAction _upAction = null;
+
+ private LockAction _lockAction = null;
+ private RefreshAction _refreshAction = null;
+ private SystemRefreshAction _refreshSelectionAction = null;
+
+ private SelectInputAction _selectInputAction = null;
+ private PositionToAction _positionToAction = null;
+ private SubSetAction _subsetAction = null;
+ private SystemTablePrintAction _printTableAction = null;
+ private SelectColumnsAction _selectColumnsAction = null;
+
+ // common actions
+ private SystemCopyToClipboardAction _copyAction;
+ private SystemPasteFromClipboardAction _pasteAction;
+ private SystemCommonDeleteAction _deleteAction;
+
+ private IMemento _memento = null;
+ private IAdaptable _mementoInput = null;
+ private Object _lastSelection = null;
+
+ private boolean _isLocked = false;
+
+ // for ISystemMessageLine
+ private String _message, _errorMessage;
+ private SystemMessage sysErrorMessage;
+ private IStatusLineManager _statusLine = null;
+
+ // constants
+ public static final String ID = "org.eclipse.rse.ui.view.systemTableView"; // matches id in plugin.xml, view tag
+
+ // Restore memento tags
+ public static final String TAG_TABLE_VIEW_PROFILE_ID = "tableViewProfileID";
+ public static final String TAG_TABLE_VIEW_CONNECTION_ID = "tableViewConnectionID";
+ public static final String TAG_TABLE_VIEW_SUBSYSTEM_ID = "tableViewSubsystemID";
+ public static final String TAG_TABLE_VIEW_OBJECT_ID = "tableViewObjectID";
+ public static final String TAG_TABLE_VIEW_FILTER_ID = "tableViewFilterID";
+
+ // Subset memento tags
+ public static final String TAG_TABLE_VIEW_SUBSET = "subset";
+
+ // layout memento tags
+ public static final String TAG_TABLE_VIEW_COLUMN_WIDTHS_ID = "columnWidths";
+
+ public void setFocus()
+ {
+ if (_viewer.getInput() == null)
+ {
+ if (_memento != null)
+ {
+ restoreState(_memento);
+ }
+ else
+ {
+ setInput(SystemPlugin.getTheSystemRegistry());
+ }
+ }
+
+ _viewer.getControl().setFocus();
+ }
+
+ public SystemTableView getViewer()
+ {
+ return _viewer;
+ }
+
+ public Viewer getRSEViewer()
+ {
+ return _viewer;
+ }
+
+ public void createPartControl(Composite parent)
+ {
+ Table table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION | SWT.HIDE_SELECTION);
+ _viewer = new SystemTableView(table, this);
+ _viewer.setWorkbenchPart(this);
+
+ table.setLinesVisible(true);
+
+ ISelectionService selectionService = getSite().getWorkbenchWindow().getSelectionService();
+ selectionService.addSelectionListener(this);
+ _viewer.addSelectionChangedListener(this);
+ getSite().setSelectionProvider(_viewer);
+
+ _viewer.addDoubleClickListener(new IDoubleClickListener()
+ {
+ public void doubleClick(DoubleClickEvent event)
+ {
+ handleDoubleClick(event);
+ }
+ });
+
+ _isLocked = true;
+ fillLocalToolBar();
+
+ _browseHistory = new ArrayList();
+ _browsePosition = 0;
+
+ // register global edit actions
+ ISystemRegistry registry = SystemPlugin.getTheSystemRegistry();
+ Clipboard clipboard = registry.getSystemClipboard();
+
+ CellEditorActionHandler editorActionHandler = new CellEditorActionHandler(getViewSite().getActionBars());
+
+ _copyAction = new SystemCopyToClipboardAction(_viewer.getShell(), clipboard);
+ _pasteAction = new SystemPasteFromClipboardAction(_viewer.getShell(), clipboard);
+ _deleteAction = new SystemCommonDeleteAction(_viewer.getShell(), _viewer);
+
+ editorActionHandler.setCopyAction(_copyAction);
+ editorActionHandler.setPasteAction(_pasteAction);
+ editorActionHandler.setDeleteAction(_deleteAction);
+ editorActionHandler.setSelectAllAction(new SelectAllAction());
+
+ registry.addSystemResourceChangeListener(this);
+ registry.addSystemRemoteChangeListener(this);
+
+ SystemWidgetHelpers.setHelp(_viewer.getControl(), SystemPlugin.HELPPREFIX + "sysd0000");
+
+ getSite().registerContextMenu(_viewer.getContextMenuManager(), _viewer);
+ }
+
+ public void selectionChanged(IWorkbenchPart part, ISelection sel)
+ {
+ if (part != this && (part instanceof SystemViewPart))
+ {
+ if (!_isLocked)
+ {
+ if (sel instanceof IStructuredSelection)
+ {
+ Object first = ((IStructuredSelection) sel).getFirstElement();
+ if (_lastSelection != first)
+ {
+ _lastSelection = first;
+ if (first instanceof IAdaptable)
+ {
+ {
+ IAdaptable adapt = (IAdaptable) first;
+ ISystemViewElementAdapter va = (ISystemViewElementAdapter) adapt.getAdapter(ISystemViewElementAdapter.class);
+ if (va != null && !(va instanceof SystemViewPromptableAdapter))
+ {
+ if (va.hasChildren(adapt) && adapt != _viewer.getInput())
+ {
+ setInput(adapt);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ else
+ if (part == this)
+ {
+ updateActionStates();
+ }
+ }
+
+ public void dispose()
+ {
+ ISelectionService selectionService = getSite().getWorkbenchWindow().getSelectionService();
+ selectionService.removeSelectionListener(this);
+ _viewer.removeSelectionChangedListener(this);
+
+ SystemPlugin.getTheSystemRegistry().removeSystemResourceChangeListener(this);
+ if (_viewer != null)
+ {
+ _viewer.dispose();
+ }
+
+ super.dispose();
+ }
+
+ private void handleDoubleClick(DoubleClickEvent event)
+ {
+ IStructuredSelection s = (IStructuredSelection) event.getSelection();
+ Object element = s.getFirstElement();
+ if (element == null)
+ return;
+
+ ISystemViewElementAdapter adapter = (ISystemViewElementAdapter) ((IAdaptable) element).getAdapter(ISystemViewElementAdapter.class);
+ boolean alreadyHandled = false;
+ if (adapter != null)
+ {
+ if (adapter.hasChildren(element))
+ {
+ setInput((IAdaptable) element);
+ }
+ else
+ {
+ alreadyHandled = adapter.handleDoubleClick(element);
+ }
+ }
+ }
+
+ public void updateActionStates()
+ {
+ if (_refreshAction == null)
+ fillLocalToolBar();
+
+ _backwardAction.checkEnabledState();
+ _forwardAction.checkEnabledState();
+ _upAction.checkEnabledState();
+ _lockAction.checkEnabledState();
+ _refreshAction.checkEnabledState();
+
+ _selectInputAction.checkEnabledState();
+ _positionToAction.checkEnabledState();
+ _subsetAction.checkEnabledState();
+
+ _printTableAction.checkEnabledState();
+ _selectColumnsAction.checkEnabledState();
+ }
+
+ private ImageDescriptor getEclipseImageDescriptor(String relativePath)
+ {
+ String iconPath = "icons/full/"; //$NON-NLS-1$
+ try
+ {
+ Bundle bundle = Platform.getBundle(PlatformUI.PLUGIN_ID);
+ URL installURL = bundle.getEntry("/");
+ URL url = new URL(installURL, iconPath + relativePath);
+ return ImageDescriptor.createFromURL(url);
+ }
+ catch (MalformedURLException e)
+ {
+ return null;
+ }
+ }
+
+ public void fillLocalToolBar()
+ {
+
+ if (_refreshAction == null)
+ {
+ // refresh action
+ _refreshAction = new RefreshAction();
+
+ // history actions
+ _backwardAction = new BackwardAction();
+ _forwardAction = new ForwardAction();
+
+ // parent/child actions
+ _upAction = new UpAction();
+
+ // lock action
+ _lockAction = new LockAction();
+
+ _selectInputAction = new SelectInputAction();
+ _positionToAction = new PositionToAction();
+ _subsetAction = new SubSetAction();
+
+ _printTableAction = new SystemTablePrintAction(getTitle(), _viewer);
+ _selectColumnsAction = new SelectColumnsAction();
+ }
+
+ updateActionStates();
+
+ IActionBars actionBars = getViewSite().getActionBars();
+ IToolBarManager toolBarManager = actionBars.getToolBarManager();
+ IMenuManager menuMgr = actionBars.getMenuManager();
+
+
+ _refreshSelectionAction = new SystemRefreshAction(getShell());
+ actionBars.setGlobalActionHandler(ActionFactory.REFRESH.getId(), _refreshSelectionAction);
+ _refreshSelectionAction.setSelectionProvider(_viewer);
+
+ _statusLine = actionBars.getStatusLineManager();
+
+ addToolBarItems(toolBarManager);
+ addToolBarMenuItems(menuMgr);
+ }
+
+ private void addToolBarMenuItems(IMenuManager menuManager)
+ {
+ menuManager.removeAll();
+ menuManager.add(_selectColumnsAction);
+ menuManager.add(new Separator("View"));
+ menuManager.add(_selectInputAction);
+ menuManager.add(new Separator("Filter"));
+ menuManager.add(_positionToAction);
+ menuManager.add(_subsetAction);
+
+ //DKM - this action is useless - remove it
+ // menuManager.add(new Separator("Print"));
+ // menuManager.add(_printTableAction);
+
+ }
+
+ private void addToolBarItems(IToolBarManager toolBarManager)
+ {
+ toolBarManager.removeAll();
+
+ _lockAction.setChecked(_isLocked);
+
+ toolBarManager.add(_lockAction);
+ toolBarManager.add(_refreshAction);
+
+
+ toolBarManager.add(new Separator("Navigate"));
+ // only support history when we're locked
+ if (_isLocked)
+ {
+ toolBarManager.add(_backwardAction);
+ toolBarManager.add(_forwardAction);
+ }
+
+ toolBarManager.add(_upAction);
+
+ toolBarManager.add(new Separator("View"));
+ toolBarManager.add(_selectColumnsAction);
+ }
+
+ public void showLock()
+ {
+ if (_upAction != null)
+ {
+ IToolBarManager toolBarManager = getViewSite().getActionBars().getToolBarManager();
+ toolBarManager.removeAll();
+
+ updateActionStates();
+
+ addToolBarItems(toolBarManager);
+ }
+ }
+
+ public void selectionChanged(SelectionChangedEvent e)
+ {
+ // listener for this view
+ updateActionStates();
+
+ IStructuredSelection sel = (IStructuredSelection) e.getSelection();
+ _copyAction.setEnabled(_copyAction.updateSelection(sel));
+ _pasteAction.setEnabled(_pasteAction.updateSelection(sel));
+ _deleteAction.setEnabled(_deleteAction.updateSelection(sel));
+ }
+
+ public void setInput(IAdaptable object)
+ {
+ setInput(object, null, _isLocked);
+
+ if (!_isLocked)
+ {
+ _currentItem = new HistoryItem(object, null);
+ }
+ }
+
+ public void setInput(HistoryItem historyItem)
+ {
+ setInput(historyItem.getObject(), historyItem.getFilters(), false);
+ _currentItem = historyItem;
+ }
+
+ public void setInput(IAdaptable object, String[] filters, boolean updateHistory)
+ {
+ if (_viewer != null /*&& object != null*/)
+ {
+ setTitle(object);
+ _viewer.setInput(object);
+
+ if (_refreshSelectionAction != null)
+ {
+ _refreshSelectionAction.updateSelection(new StructuredSelection(object));
+ }
+ if (filters != null)
+ {
+ _viewer.setViewFilters(filters);
+ }
+
+ if (updateHistory)
+ {
+ while (_browsePosition < _browseHistory.size() - 1)
+ {
+ _browseHistory.remove(_browseHistory.get(_browseHistory.size() - 1));
+ }
+
+ _currentItem = new HistoryItem(object, filters);
+
+ _browseHistory.add(_currentItem);
+ _browsePosition = _browseHistory.lastIndexOf(_currentItem);
+ }
+
+ updateActionStates();
+
+ }
+ }
+
+ public void setTitle(IAdaptable object)
+ {
+ if (object == null)
+ {
+ setContentDescription("");
+ }
+ else
+ {
+ ISystemViewElementAdapter va = (ISystemViewElementAdapter) object.getAdapter(ISystemViewElementAdapter.class);
+ if (va != null)
+ {
+ String type = va.getType(object);
+ String name = va.getName(object);
+ //setPartName(type + " " + name);
+
+ setContentDescription(type + " "+ name);
+
+ //SystemTableViewProvider provider = (SystemTableViewProvider) _viewer.getContentProvider();
+ //setTitleImage(provider.getImage(object));
+ }
+ }
+ }
+
+ /**
+ * Used to asynchronously update the view whenever properties change.
+ */
+ public void systemResourceChanged(ISystemResourceChangeEvent event)
+ {
+ Object child = event.getSource();
+ Object input = _viewer.getInput();
+ switch (event.getType())
+ {
+ case ISystemResourceChangeEvents.EVENT_RENAME:
+ {
+ if (child == input)
+ {
+ setTitle((IAdaptable) child);
+ }
+ }
+ break;
+ case ISystemResourceChangeEvents.EVENT_DELETE:
+ case ISystemResourceChangeEvents.EVENT_DELETE_MANY:
+ {
+ if (child instanceof ISystemFilterReference)
+ {
+
+ if (child == input)
+ {
+ removeFromHistory(input);
+ }
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ protected void removeFromHistory(Object c)
+ {
+ // if the object is in history, remove it since it's been deleted
+ for (int i = 0; i < _browseHistory.size(); i++)
+ {
+ HistoryItem hist = (HistoryItem)_browseHistory.get(i);
+ if (hist.getObject() == c)
+ {
+
+ _browseHistory.remove(hist);
+ if (_browsePosition >= i)
+ {
+ _browsePosition--;
+ if (_browsePosition < 0)
+ {
+ _browsePosition = 0;
+ }
+ }
+ if (hist == _currentItem)
+ {
+ if (_browseHistory.size() > 0)
+ {
+ _currentItem = (HistoryItem)_browseHistory.get(_browsePosition);
+ setInput(_currentItem.getObject(), null, false);
+ }
+ else
+ {
+ _currentItem = null;
+ setInput((IAdaptable)null, null, false);
+ }
+
+
+ }
+ }
+ }
+ }
+
+ /**
+ * This is the method in your class that will be called when a remote resource
+ * changes. You will be called after the resource is changed.
+ * @see org.eclipse.rse.model.ISystemRemoteChangeEvent
+ */
+ public void systemRemoteResourceChanged(ISystemRemoteChangeEvent event)
+ {
+ int eventType = event.getEventType();
+ Object remoteResourceParent = event.getResourceParent();
+ Object remoteResource = event.getResource();
+
+ Vector remoteResourceNames = null;
+ if (remoteResource instanceof Vector)
+ {
+ remoteResourceNames = (Vector) remoteResource;
+ remoteResource = remoteResourceNames.elementAt(0);
+ }
+
+ Object child = event.getResource();
+
+
+ Object input = _viewer.getInput();
+ if (input == child || child instanceof Vector)
+ {
+ switch (eventType)
+ {
+ // --------------------------
+ // REMOTE RESOURCE CHANGED...
+ // --------------------------
+ case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_CHANGED :
+ break;
+
+ // --------------------------
+ // REMOTE RESOURCE CREATED...
+ // --------------------------
+ case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_CREATED :
+ break;
+
+ // --------------------------
+ // REMOTE RESOURCE DELETED...
+ // --------------------------
+ case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_DELETED :
+ {
+ if (child instanceof Vector)
+ {
+ Vector vec = (Vector)child;
+ for (int v = 0; v < vec.size(); v++)
+ {
+ Object c = vec.get(v);
+
+ removeFromHistory(c);
+ /*
+ if (c == input)
+ {
+ setInput((IAdaptable)null, null, false);
+
+ return;
+ }
+ */
+ }
+ }
+ else
+ {
+ removeFromHistory(child);
+ //setInput((IAdaptable)null);
+
+ return;
+ }
+ }
+ break;
+
+ // --------------------------
+ // REMOTE RESOURCE RENAMED...
+ // --------------------------
+ case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_RENAMED :
+ {
+ setInput((IAdaptable)child);
+ }
+
+ break;
+ }
+ }
+ }
+
+ public Shell getShell()
+ {
+ return _viewer.getShell();
+ }
+
+ private void restoreState(IMemento memento)
+ {
+ RestoreStateRunnable rsr = new RestoreStateRunnable(memento);
+ rsr.setRule(SystemPlugin.getTheSystemRegistry());
+ rsr.schedule();
+ _memento = null;
+ }
+
+ /**
+ * Initializes this view with the given view site. A memento is passed to
+ * the view which contains a snapshot of the views state from a previous
+ * session. Where possible, the view should try to recreate that state
+ * within the part controls.
+ *
+ * The parent's default implementation will ignore the memento and initialize
+ * the view in a fresh state. Subclasses may override the implementation to
+ * perform any state restoration as needed.
+ */
+ public void init(IViewSite site, IMemento memento) throws PartInitException
+ {
+ super.init(site, memento);
+
+ if (memento != null && SystemPreferencesManager.getPreferencesManager().getRememberState())
+ {
+ _memento = memento;
+
+ }
+ }
+
+ /**
+ * Method declared on IViewPart.
+ */
+ public void saveState(IMemento memento)
+ {
+ super.saveState(memento);
+
+ if (!SystemPreferencesManager.getPreferencesManager().getRememberState())
+ return;
+
+ if (_viewer != null)
+ {
+ Object input = _viewer.getInput();
+
+ if (input != null)
+ {
+ if (input instanceof ISystemRegistry)
+ {
+
+ }
+ else if (input instanceof IHost)
+ {
+ IHost connection = (IHost) input;
+ String connectionID = connection.getAliasName();
+ String profileID = connection.getSystemProfileName();
+ memento.putString(TAG_TABLE_VIEW_CONNECTION_ID, connectionID);
+ memento.putString(TAG_TABLE_VIEW_PROFILE_ID, profileID);
+ }
+ else
+ {
+ ISystemViewElementAdapter va = (ISystemViewElementAdapter) ((IAdaptable) input).getAdapter(ISystemViewElementAdapter.class);
+
+ ISubSystem subsystem = va.getSubSystem(input);
+ if (subsystem != null)
+ {
+ ISystemRegistry registry = SystemPlugin.getTheSystemRegistry();
+ String subsystemID = registry.getAbsoluteNameForSubSystem(subsystem);
+ String profileID = subsystem.getHost().getSystemProfileName();
+ String connectionID = subsystem.getHost().getAliasName();
+ String objectID = va.getAbsoluteName(input);
+
+ memento.putString(TAG_TABLE_VIEW_PROFILE_ID, profileID);
+ memento.putString(TAG_TABLE_VIEW_CONNECTION_ID, connectionID);
+ memento.putString(TAG_TABLE_VIEW_SUBSYSTEM_ID, subsystemID);
+
+ if (input instanceof ISystemFilterReference)
+ {
+ memento.putString(TAG_TABLE_VIEW_FILTER_ID, objectID);
+ memento.putString(TAG_TABLE_VIEW_OBJECT_ID, null);
+ }
+ else
+ if (input instanceof ISubSystem)
+ {
+ memento.putString(TAG_TABLE_VIEW_OBJECT_ID, null);
+ memento.putString(TAG_TABLE_VIEW_FILTER_ID, null);
+ }
+ else
+ {
+ memento.putString(TAG_TABLE_VIEW_OBJECT_ID, objectID);
+ memento.putString(TAG_TABLE_VIEW_FILTER_ID, null);
+ }
+ }
+ }
+
+ Table table = _viewer.getTable();
+ if (table != null && !table.isDisposed())
+ {
+ String columnWidths = new String();
+ TableColumn[] columns = table.getColumns();
+ for (int i = 0; i < columns.length; i++)
+ {
+ TableColumn column = columns[i];
+ int width = column.getWidth();
+ if (i == columns.length - 1)
+ {
+ columnWidths += width;
+ }
+ else
+ {
+ columnWidths += width + ",";
+ }
+ }
+ memento.putString(TAG_TABLE_VIEW_COLUMN_WIDTHS_ID, columnWidths);
+ }
+ }
+ }
+ }
+
+
+// -------------------------------
+ // ISystemMessageLine interface...
+ // -------------------------------
+ /**
+ * Clears the currently displayed error message and redisplayes
+ * the message which was active before the error message was set.
+ */
+ public void clearErrorMessage()
+ {
+ _errorMessage = null;
+ sysErrorMessage = null;
+ if (_statusLine != null)
+ _statusLine.setErrorMessage(_errorMessage);
+ }
+ /**
+ * Clears the currently displayed message.
+ */
+ public void clearMessage()
+ {
+ _message = null;
+ if (_statusLine != null)
+ _statusLine.setMessage(_message);
+ }
+ /**
+ * Get the currently displayed error text.
+ * @return The error message. If no error message is displayed NOT APPLICABLE TO US
+ */
+ public Object[] getConnectionChildren(IHost selectedConnection)
+ {
+ return null; //
+ }
+ /**
+ * This method is called by the connection adapter when deciding to show a plus-sign
+ * or not beside a connection. Return true if this connection has children to be shown.
+ * NOT APPLICABLE TO US
+ */
+ public boolean hasConnectionChildren(IHost selectedConnection)
+ {
+ return true;
+ }
+
+ /**
+ * Return true to show the action bar (ie, toolbar) above the viewer.
+ * The action bar contains connection actions, predominantly.
+ */
+ public boolean showActionBar()
+ {
+ return false;
+ }
+ /**
+ * Return true to show the button bar above the viewer.
+ * The tool bar contains "Get List" and "Refresh" buttons and is typicall
+ * shown in dialogs that list only remote system objects.
+ */
+ public boolean showButtonBar()
+ {
+ return true;
+ }
+ /**
+ * Return true to show right-click popup actions on objects in the tree.
+ */
+ public boolean showActions()
+ {
+ return false;
+ }
+
+
+
+ // ----------------------------------
+ // OUR OWN METHODS...
+ // ----------------------------------
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemView.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemView.java
new file mode 100644
index 00000000000..dc8200f5633
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemView.java
@@ -0,0 +1,5846 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Vector;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.GroupMarker;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.viewers.DecoratingLabelProvider;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IBasicPropertyConstants;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.ITreeViewerListener;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeExpansionEvent;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.jface.window.SameShellProvider;
+import org.eclipse.rse.core.SystemAdapterHelpers;
+import org.eclipse.rse.core.SystemElapsedTimer;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.SystemPopupMenuActionContributorManager;
+import org.eclipse.rse.core.SystemPreferencesManager;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
+import org.eclipse.rse.filters.ISystemFilter;
+import org.eclipse.rse.filters.ISystemFilterContainer;
+import org.eclipse.rse.filters.ISystemFilterContainerReference;
+import org.eclipse.rse.filters.ISystemFilterPool;
+import org.eclipse.rse.filters.ISystemFilterPoolReference;
+import org.eclipse.rse.filters.ISystemFilterPoolReferenceManager;
+import org.eclipse.rse.filters.ISystemFilterPoolReferenceManagerProvider;
+import org.eclipse.rse.filters.ISystemFilterReference;
+import org.eclipse.rse.filters.ISystemFilterString;
+import org.eclipse.rse.filters.ISystemFilterStringReference;
+import org.eclipse.rse.model.IHost;
+import org.eclipse.rse.model.ISystemContainer;
+import org.eclipse.rse.model.ISystemMessageObject;
+import org.eclipse.rse.model.ISystemPromptableObject;
+import org.eclipse.rse.model.ISystemRegistry;
+import org.eclipse.rse.model.ISystemRemoteChangeEvent;
+import org.eclipse.rse.model.ISystemRemoteChangeEvents;
+import org.eclipse.rse.model.ISystemRemoteChangeListener;
+import org.eclipse.rse.model.ISystemResourceChangeEvent;
+import org.eclipse.rse.model.ISystemResourceChangeEvents;
+import org.eclipse.rse.model.ISystemResourceChangeListener;
+import org.eclipse.rse.model.ISystemResourceSet;
+import org.eclipse.rse.model.SystemRemoteElementResourceSet;
+import org.eclipse.rse.model.SystemRemoteResourceSet;
+import org.eclipse.rse.references.ISystemBaseReferencingObject;
+import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.ISystemDeleteTarget;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.ISystemRenameTarget;
+import org.eclipse.rse.ui.SystemMenuManager;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.actions.ISystemAction;
+import org.eclipse.rse.ui.actions.SystemCascadingGoToAction;
+import org.eclipse.rse.ui.actions.SystemCollapseAction;
+import org.eclipse.rse.ui.actions.SystemCommonDeleteAction;
+import org.eclipse.rse.ui.actions.SystemCommonRenameAction;
+import org.eclipse.rse.ui.actions.SystemCommonSelectAllAction;
+import org.eclipse.rse.ui.actions.SystemExpandAction;
+import org.eclipse.rse.ui.actions.SystemNewConnectionAction;
+import org.eclipse.rse.ui.actions.SystemOpenExplorerPerspectiveAction;
+import org.eclipse.rse.ui.actions.SystemRefreshAction;
+import org.eclipse.rse.ui.actions.SystemRemotePropertiesAction;
+import org.eclipse.rse.ui.actions.SystemShowInMonitorAction;
+import org.eclipse.rse.ui.actions.SystemShowInTableAction;
+import org.eclipse.rse.ui.actions.SystemSubMenuManager;
+import org.eclipse.rse.ui.messages.ISystemMessageLine;
+import org.eclipse.rse.ui.messages.SystemMessageDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.FileTransfer;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.TreeEvent;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Item;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.swt.widgets.Widget;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.dialogs.PropertyDialogAction;
+import org.eclipse.ui.part.EditorInputTransfer;
+import org.eclipse.ui.part.PluginTransfer;
+import org.eclipse.ui.views.framelist.GoIntoAction;
+
+
+/**
+ * This subclass of the standard JFace tree viewer is used to show a tree
+ * view of connections to remote systems, which can be manipulated and expanded
+ * to access remote objects in the remote system.
+ */
+public class SystemView extends TreeViewer implements ISystemTree,
+ ISystemResourceChangeListener,
+ ISystemRemoteChangeListener,
+ IMenuListener,
+ //MenuListener,
+ //IDoubleClickListener,
+ //ArmListener,
+ ISelectionChangedListener,
+ ISelectionProvider,
+ ITreeViewerListener,
+ ISystemResourceChangeEvents,
+ ISystemDeleteTarget,
+ ISystemRenameTarget,
+ ISystemSelectAllTarget
+ //, IWireEventTarget
+{
+
+ protected Shell shell; // shell hosting this viewer
+ protected ISystemViewInputProvider inputProvider; // who is supplying our tree root elements?
+ protected ISystemViewInputProvider previousInputProvider; // who is supplying our tree root elements?
+ protected Object previousInput;
+ protected IHost previousInputConnection;
+ // protected actions
+ protected SystemNewConnectionAction newConnectionAction;
+ protected SystemRefreshAction refreshAction;
+ protected PropertyDialogAction propertyDialogAction;
+ protected SystemRemotePropertiesAction remotePropertyDialogAction;
+ protected SystemCollapseAction collapseAction; // defect 41203
+ protected SystemExpandAction expandAction; // defect 41203
+ protected SystemOpenExplorerPerspectiveAction openToPerspectiveAction;
+
+ protected SystemShowInTableAction showInTableAction;
+ protected SystemShowInMonitorAction showInMonitorAction;
+ protected GoIntoAction goIntoAction;
+ protected SystemCascadingGoToAction gotoActions;
+ // global actions
+ // Note the Edit menu actions are set in SystemViewPart. Here we use these
+ // actions from our own popup menu actions.
+ protected SystemCommonDeleteAction deleteAction; // for global delete menu item
+ protected SystemCommonRenameAction renameAction; // for common rename menu item
+ protected SystemCommonSelectAllAction selectAllAction; // for common Ctrl+A select-all
+ // special flags needed when building popup menu, set after examining selections
+ protected boolean selectionShowRefreshAction;
+ protected boolean selectionShowOpenViewActions;
+ protected boolean selectionShowGenericShowInTableAction;
+ protected boolean selectionShowDeleteAction;
+ protected boolean selectionShowRenameAction;
+ protected boolean selectionEnableDeleteAction;
+ protected boolean selectionEnableRenameAction;
+ protected boolean selectionIsRemoteObject;
+ protected boolean selectionHasAncestorRelation;
+ protected boolean selectionFlagsUpdated = false;
+ // misc
+ protected MenuManager menuMgr;
+ protected boolean showActions = true;
+ protected boolean hardCodedConnectionSelected = false;
+ protected boolean mixedSelection = false;
+ protected boolean specialMode = false;
+ protected boolean menuListenerAdded = false;
+ protected boolean fromSystemViewPart = false;
+ protected boolean areAnyRemote = false;
+ protected boolean enabledMode = true;
+ protected Widget previousItem = null;
+ protected int searchDepth = 0;
+ //protected Vector remoteItemsToSkip = null;
+ protected Cursor busyCursor;
+ protected TreeItem inputTreeItem = null;
+ protected static final int SEARCH_INFINITE = 10; // that's far enough down to search!
+ public boolean debug = false;
+ public boolean debugRemote = false;
+ public boolean debugProperties = debug && false;
+ public boolean doTimings = false;
+ public SystemElapsedTimer elapsedTime = new SystemElapsedTimer();
+ // for support of Expand To actions ... transient filters really.
+ // we need to record these per tree node they are applied to.
+ protected Hashtable expandToFiltersByObject; // most efficient way to find these is by binary object
+ protected Hashtable expandToFiltersByTreePath; // however, we lose that after a refresh so we also record by tree path
+
+ // message line
+ protected ISystemMessageLine messageLine = null;
+ // button pressed
+ protected static final int LEFT_BUTTON = 1;
+ protected int mouseButtonPressed = LEFT_BUTTON; //d40615
+ protected boolean expandingTreeOnly = false; //d40615
+ protected ViewerFilter[] initViewerFilters = null;
+
+ protected List _setList;
+
+ /**
+ * Constructor
+ * @param shell The shell hosting this tree viewer widget
+ * @param parent The composite widget into which to place this widget
+ * @param inputProvider The input object which will supply the initial root objects in the tree.
+ * Can be null initially, but be sure to call #setInputProvider(ISystemViewInputProvider) later.
+ * @param msgLine Where to display messages and tooltip text
+ */
+ public SystemView(Shell shell, Composite parent, ISystemViewInputProvider inputProvider, ISystemMessageLine msgLine)
+ {
+ super(parent);
+ this.shell = shell;
+ this.inputProvider = inputProvider;
+ this.inputProvider.setShell(shell); // DY: defect 44544
+ this.messageLine = msgLine;
+ init();
+ }
+ /**
+ * Constructor to use when you want to specify styles for the tree widget
+ * @param shell The shell hosting this tree viewer widget
+ * @param parent The composite widget into which to place this widget
+ * @param style The style to give the tree widget
+ * @param inputProvider The input object which will supply the initial root objects in the tree.
+ * Can be null initially, but be sure to call #setInputProvider(ISystemViewInputProvider) later.
+ * @param msgLine Where to display messages and tooltip text
+ */
+ public SystemView(Shell shell, Composite parent, int style, ISystemViewInputProvider inputProvider, ISystemMessageLine msgLine)
+ {
+ super(parent, style);
+ this.shell = shell;
+ this.inputProvider = inputProvider;
+ this.inputProvider.setShell(shell); // DY: defect 44544
+ this.messageLine = msgLine;
+ init();
+ }
+
+ /**
+ * Constructor to use when you want to specify styles for the tree widget
+ * @param shell The shell hosting this tree viewer widget
+ * @param parent The composite widget into which to place this widget
+ * @param style The style to give the tree widget
+ * @param inputProvider The input object which will supply the initial root objects in the tree.
+ * Can be null initially, but be sure to call #setInputProvider(ISystemViewInputProvider) later.
+ * @param msgLine Where to display messages and tooltip text
+ * @param initViewerFilters the initial viewer filters to apply.
+ */
+ public SystemView(Shell shell, Composite parent, int style, ISystemViewInputProvider inputProvider,
+ ISystemMessageLine msgLine, ViewerFilter[] initViewerFilters)
+ {
+ super(parent, style);
+ this.shell = shell;
+ this.inputProvider = inputProvider;
+ this.inputProvider.setShell(shell); // DY: defect 44544
+ this.messageLine = msgLine;
+ this.initViewerFilters = initViewerFilters;
+ init();
+ }
+
+ /**
+ * Constructor to use when you create your own tree widget.
+ * @param shell The shell hosting this tree viewer widget
+ * @param tree The Tree widget you created.
+ * @param inputProvider The input object which will supply the initial root objects in the tree.
+ * Can be null initially, but be sure to call #setInputProvider(ISystemViewInputProvider) later.
+ * @param msgLine Where to display messages and tooltip text
+ */
+ public SystemView(Shell shell, Tree tree, ISystemViewInputProvider inputProvider, ISystemMessageLine msgLine)
+ {
+ super(tree);
+ this.shell = shell;
+ this.inputProvider = inputProvider;
+ this.inputProvider.setShell(shell); // DY: defect 44544
+ this.messageLine = msgLine;
+ init();
+ }
+
+ /**
+ * Set the input provider. Sometimes this is delayed, or can change.
+ */
+ public void setInputProvider(ISystemViewInputProvider inputProvider)
+ {
+ this.inputProvider = inputProvider;
+ inputProvider.setViewer(this);
+ inputProvider.setShell(getShell()); // DY: Defect 44544, shell was not being set for Test dialogs, when they
+ // tried to connect there was not shell for the password prompt
+ // and an error message (expand failed) occured.
+ setInput(inputProvider);
+ }
+
+ /**
+ * Get the SystemViewPart that encapsulates us.
+ * Will be null unless fromSystemViewPart is true.
+ */
+ public SystemViewPart getSystemViewPart()
+ {
+ if (fromSystemViewPart)
+ return ((SystemViewPart)messageLine);
+ else
+ return null;
+ }
+
+ /**
+ * Get the workbench window containing this view part. Will only be non-null for the explorer view part,
+ * not when used within, say, a dialog
+ */
+ protected IWorkbenchWindow getWorkbenchWindow()
+ {
+ if (fromSystemViewPart)
+ return getSystemViewPart().getSite().getWorkbenchWindow();
+ else
+ return null;
+ }
+ /**
+ * Get the workbench part containing this view. Will only be non-null for the explorer view part,
+ * not when used within, say, a dialog
+ */
+ protected IWorkbenchPart getWorkbenchPart()
+ {
+ return getSystemViewPart();
+ }
+
+ /**
+ * Disable/Enable the viewer. We do this by blocking keystrokes without visually greying out
+ */
+ public void setEnabled(boolean enabled)
+ {
+ enabledMode = enabled;
+ }
+
+ /**
+ * Sets the label and content provider for the system view.
+ * This can be called externally if a custom RSE label and content provider is desired
+ * @param lcProvider the provider
+ */
+ public void setLabelAndContentProvider(SystemViewLabelAndContentProvider lcProvider)
+ {
+ setLabelProvider(new DecoratingLabelProvider(lcProvider, SystemPlugin.getDefault().getWorkbench().getDecoratorManager().getLabelDecorator()));
+ setContentProvider(lcProvider);
+ }
+
+ protected void init()
+ {
+ _setList = new ArrayList();
+ busyCursor = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
+ setUseHashlookup(true); // new for our 2nd release. Attempt to fix 38 minutes to refresh for 15K elements
+
+ // set content provider
+ SystemViewLabelAndContentProvider lcProvider = new SystemViewLabelAndContentProvider();
+ setLabelAndContentProvider(lcProvider);
+
+ // set initial viewer filters
+ if (initViewerFilters != null) {
+
+ for (int i = 0; i < initViewerFilters.length; i++) {
+ addFilter(initViewerFilters[i]);
+ }
+ }
+
+ fromSystemViewPart = ((messageLine != null) && (messageLine instanceof SystemViewPart));
+
+ // set the tree's input. Provides initial roots.
+ if (inputProvider != null)
+ {
+ inputProvider.setViewer(this);
+ setInput(inputProvider);
+ if (fromSystemViewPart)
+ {
+ previousInputConnection = getInputConnection(getWorkbenchPart().getSite().getPage().getInput());
+ }
+ }
+ //addDoubleClickListener(this);
+ addSelectionChangedListener(this);
+ addTreeListener(this);
+ // ----------------------------------------
+ // register with system registry for events
+ // ----------------------------------------
+ SystemPlugin.getTheSystemRegistry().addSystemResourceChangeListener(this);
+ SystemPlugin.getTheSystemRegistry().addSystemRemoteChangeListener(this);
+ // -----------------------------
+ // Enable right-click popup menu
+ // -----------------------------
+ menuMgr = new MenuManager("#PopupMenu");
+ menuMgr.setRemoveAllWhenShown(true);
+ menuMgr.addMenuListener(this);
+ Menu menu = menuMgr.createContextMenu(getTree());
+ getTree().setMenu(menu);
+ // -------------------------------------------
+ // Enable specific keys: dbl-click, Delete, F5
+ // -------------------------------------------
+ addDoubleClickListener(new IDoubleClickListener()
+ {
+ public void doubleClick(DoubleClickEvent event)
+ {
+ handleDoubleClick(event);
+ }
+ });
+ getControl().addKeyListener(new KeyAdapter()
+ {
+ public void keyPressed(KeyEvent e)
+ {
+ handleKeyPressed(e);
+ }
+ });
+ getControl().addMouseListener(new MouseAdapter()
+ {
+ public void mouseDown(MouseEvent e)
+ {
+ mouseButtonPressed = e.button; //d40615
+ if (!enabledMode)
+ {
+ //e.doit = false;
+ return;
+ }
+ }
+ });
+
+ initRefreshKey();
+
+ // initialize drag and drop
+ initDragAndDrop();
+ }
+
+ /**
+ * Create the KeyListener for doing the refresh on the viewer.
+ */
+ protected void initRefreshKey()
+ {
+ /* DKM - no need for explicit key listener since we
+ * have global action
+ getControl().addKeyListener(new KeyAdapter()
+ {
+ public void keyReleased(KeyEvent event)
+ {
+ if (!enabledMode)
+ return;
+ if (event.keyCode == SWT.F5)
+ {
+ //if (debug)
+ // System.out.println("F5 pressed");
+ refreshAll();
+ }
+ }
+ });
+ */
+ }
+
+ /**
+ * Handles double clicks in viewer.
+ * Opens editor if file double-clicked.
+ */
+ protected void handleDoubleClick(DoubleClickEvent event)
+ {
+ if (!enabledMode)
+ {
+ //event.doit = false;
+ return;
+ }
+ IStructuredSelection s= (IStructuredSelection) event.getSelection();
+ Object element= s.getFirstElement();
+ if (element == null)
+ return;
+ ISystemViewElementAdapter adapter = getAdapter(element);
+ boolean alreadyHandled = false;
+ if (adapter != null)
+ alreadyHandled = adapter.handleDoubleClick(element);
+ if (!alreadyHandled && isExpandable(element))
+ {
+ boolean expandedState = getExpandedState(element);
+ setExpandedState(element, !expandedState);
+ // DY: fire collapse / expand event
+ if (expandedState) {
+ fireTreeCollapsed(new TreeExpansionEvent(this, element));
+ } else {
+ fireTreeExpanded(new TreeExpansionEvent(this, element));
+ }
+ return;
+ }
+ }
+ /**
+ * Handles key events in viewer.
+ */
+ void handleKeyPressed(KeyEvent event)
+ {
+ if ((event.character == SWT.DEL) && (event.stateMask == 0) && (((IStructuredSelection)getSelection()).size()>0) )
+ {
+ scanSelections("handleKeyPressed");
+ /* DKM - 53694
+ if (showDelete() && canDelete())
+ {
+
+ SystemCommonDeleteAction dltAction = (SystemCommonDeleteAction)getDeleteAction();
+ dltAction.setShell(getShell());
+ dltAction.setSelection(getSelection());
+ dltAction.setViewer(this);
+ dltAction.run();
+
+ }
+ */
+ }
+ else if ((event.character == '-') && (event.stateMask == SWT.CTRL) )
+ {
+ collapseAll();
+ }
+ else if ((event.character == 1) && // for some reason Ctrl+A comes in as Ctrl plus the number 1!
+ (event.stateMask == SWT.CTRL) && !fromSystemViewPart)
+ {
+ //System.out.println("Inside Ctrl+A processing");
+ if (enableSelectAll(null))
+ doSelectAll(null);
+ }
+ else if ((event.character == '-') && (((IStructuredSelection)getSelection()).size()>0) )
+ {
+ //System.out.println("Inside Ctrl+- processing");
+ collapseSelected();
+ }
+ else if ((event.character == '+') && (((IStructuredSelection)getSelection()).size()>0) )
+ {
+ //System.out.println("Inside Ctrl++ processing");
+ expandSelected();
+ }
+
+ }
+
+ /**
+ * Handles a collapse-selected request
+ */
+ public void collapseSelected()
+ {
+ TreeItem[] selectedItems = ((Tree)getControl()).getSelection();
+ if ((selectedItems != null) && (selectedItems.length>0))
+ {
+ for (int idx=0; idx
+ */
+ protected void moveTreeItems(Widget parentItem, Object[] src, int delta)
+ {
+ int[] oldPositions = new int[src.length];
+ Item[] oldItems = new Item[src.length];
+
+ for (int idx=0; idx
+ * Assumption:
+ * 1. event.getGrandParent() == subsystem (one event fired per affected subsystem)
+ * 2. event.getSource() == filter or filter string (not the reference, the real filter or string)
+ * 3. event.getParent() == parent of filter or filter string. One of:
+ * a. filterPool reference or filter reference (nested)
+ * b. filterPool for non-nested filters when showing filter pools
+ * c. subsystem for non-nested filters when not showing filter pools
+ * d. filter for nested filters
+ *
+ * Our job here:
+ * 1. Determine if we are even showing the given subsystem
+ * 2. Find the reference to the updated filter in that subsystem's subtree
+ * 3. Ask that parent to either update its name or collapse and refresh its children
+ * 4. Forget selecting something ... the original item remains selected!
+ */
+ protected void findAndUpdateFilter(ISystemResourceChangeEvent event, int type)
+ {
+ ISystemFilter filter = (ISystemFilter)event.getSource();
+ //Object parent = event.getParent();
+ if (debug)
+ {
+ String eventType = null;
+ switch(type)
+ {
+ case EVENT_RENAME_FILTER_REFERENCE:
+ eventType = "EVENT_RENAME_FILTER_REFERENCE";
+ break;
+ case EVENT_CHANGE_FILTER_REFERENCE:
+ eventType = "EVENT_CHANGE_FILTER_REFERENCE";
+ break;
+ }
+ logDebugMsg("SV event: "+eventType);
+ }
+
+ // STEP 1. ARE WE EVEN SHOWING THE GIVEN SUBSYSTEM?
+ ISubSystem ss = (ISubSystem)event.getGrandParent();
+ Widget widget = findItem(ss);
+
+ if (widget != null)
+ {
+
+ // STEP 2: ARE WE SHOWING A REFERENCE TO RENAMED OR UPDATED FILTER?
+ Widget item = null;
+
+ Control c = getControl();
+
+ // KM: defect 53008.
+ // Yes we are showing the subsystem, so widget is the subsystem item
+ if (widget != c && widget instanceof Item) {
+
+ if (debug)
+ logDebugMsg("...Found ss " + ss);
+
+ item = internalFindReferencedItem(widget, filter, SEARCH_INFINITE);
+ }
+ // No, we are not showing the subsystem, so widget is the control
+ else if (widget == c) {
+
+ if (debug)
+ logDebugMsg("...Din not find ss " + ss);
+
+ item = internalFindReferencedItem(widget, filter, SEARCH_INFINITE);
+ }
+
+ if (item == null)
+ logDebugMsg("......didn't find renamed/updated filter's reference!");
+ else
+ {
+ // STEP 3: UPDATE THAT FILTER...
+ if (type == EVENT_RENAME_FILTER_REFERENCE)
+ {
+ String[] rproperties = {IBasicPropertyConstants.P_TEXT};
+ update(item.getData(), rproperties); // for refreshing non-structural properties in viewer when model changes
+ }
+ else if (type == EVENT_CHANGE_FILTER_REFERENCE)
+ {
+ //if (((TreeItem)item).getExpanded())
+ //refresh(item.getData());
+ smartRefresh(new TreeItem[] {(TreeItem)item});
+ /*
+ Object data = item.getData();
+ boolean wasExpanded = getExpanded((Item)item);
+ setExpandedState(data, false); // collapse node
+ refresh(data); // clear all cached widgets
+ if (wasExpanded)
+ setExpandedState(data, true); // by doing this all subnodes that were expanded are now collapsed
+ */
+ }
+ updatePropertySheet();
+ }
+ }
+ }
+ protected void findAndUpdateFilterString(ISystemResourceChangeEvent event, int type)
+ {
+ ISystemFilterString filterString = (ISystemFilterString)event.getSource();
+ // STEP 1. ARE WE EVEN SHOWING THE GIVEN SUBSYSTEM?
+ ISubSystem ss = (ISubSystem)event.getGrandParent();
+ Widget item = findItem(ss);
+ if (item != null && item != getControl())
+ {
+ Item ssItem = (Item)item;
+ if (debug)
+ logDebugMsg("...Found ss "+ss);
+ // STEP 2: ARE WE SHOWING A REFERENCE TO THE UPDATED FILTER STRING?
+ item = internalFindReferencedItem(ssItem, filterString, SEARCH_INFINITE);
+ if (item == null)
+ logDebugMsg("......didn't find updated filter string's reference!");
+ else
+ {
+ // STEP 3: UPDATE THAT FILTER STRING...
+ if (type == EVENT_CHANGE_FILTERSTRING_REFERENCE) // HAD BETTER!
+ {
+ //if (((TreeItem)item).getExpanded())
+ //refresh(item.getData());
+ // boolean wasExpanded = getExpanded((Item)item);
+ Object data = item.getData();
+ setExpandedState(data, false); // collapse node
+ refresh(data); // clear all cached widgets
+ //if (wasExpanded)
+ //setExpandedState(data, true); // hmm, should we?
+ String properties[] = {IBasicPropertyConstants.P_TEXT};
+ update(item.getData(), properties); // for refreshing non-structural properties in viewer when model changes
+ updatePropertySheet();
+ }
+ }
+ }
+ }
+
+ /**
+ * We don't show actual filters, only filter references that are unique generated
+ * for each subtree of each subsystem. Yet, each event is relative to the filter,
+ * not our special filter references. Hence, all this code!!
+ *
+ * Special case handling for updates to filters which affect the parent of the
+ * filter, such that the parent's children must be re-generated:
+ * 1. New filter created (ADD)
+ * 2. Existing filter deleted (DELETE)
+ * 3. Existing filters reordered (MOVE)
+ *
+ * Assumption:
+ * 1. event.getGrandParent() == subsystem (one event fired per affected subsystem)
+ * 2. event.getSource() == filter (not the reference, the real filter)
+ * 3. event.getParent() == parent of filter. One of:
+ * a. filterPool reference or filter reference (nested)
+ * b. filterPool for non-nested filters when showing filter pools
+ * c. subsystem for non-nested filters when not showing filter pools
+ * d. filter for nested filters
+ *
+ * Our job here:
+ * 1. Determine if we are even showing the given subsystem
+ * 2. Find the parent to the given filter: filterPool or subsystem
+ * 3. Ask that parent to refresh its children (causes re-gen of filter references)
+ * 4. Select something: QUESTION: is this subsystem the origin of this action??
+ * a. For ADD, select the newly created filter reference for the new filter
+ * ANSWER: IF PARENT OF NEW FILTER IS WITHIN THIS SUBSYSTEM, AND WAS SELECTED PREVIOUSLY
+ * b. For DELETE, select the parent of the filter?
+ * ANSWER: IF DELETED FILTER IS WITHING THIS SUBSYSTEM AND WAS SELECTED PREVIOUSLY
+ * c. For MOVE, select the moved filters
+ * ANSWER: IF MOVED FILTERS ARE WITHIN THIS SUBSYSTEM, AND WERE SELECTED PREVIOUSLY
+ */
+ protected void findAndUpdateFilterParent(ISystemResourceChangeEvent event, int type)
+ {
+ ISubSystem ss = (ISubSystem)event.getGrandParent();
+ boolean add = false, move = false, delete = false;
+ boolean afilterstring = false;
+ //if (debug)
+ //{
+ String eventType = null;
+ switch(type)
+ {
+ case EVENT_ADD_FILTER_REFERENCE:
+ add = true;
+ if (debug)
+ eventType = "EVENT_ADD_FILTER_REFERENCE";
+ break;
+ case EVENT_DELETE_FILTER_REFERENCE:
+ delete = true;
+ if (debug)
+ eventType = "EVENT_DELETE_FILTER_REFERENCE";
+ break;
+ case EVENT_MOVE_FILTER_REFERENCES:
+ move = true;
+ if (debug)
+ eventType = "EVENT_MOVE_FILTER_REFERENCES";
+ break;
+ case EVENT_ADD_FILTERSTRING_REFERENCE:
+ add = true;
+ afilterstring = true;
+ if (debug)
+ eventType = "EVENT_ADD_FILTERSTRING_REFERENCE";
+ break;
+ case EVENT_DELETE_FILTERSTRING_REFERENCE:
+ delete = true;
+ afilterstring = true;
+ if (debug)
+ eventType = "EVENT_DELETE_FILTERSTRING_REFERENCE";
+ break;
+ case EVENT_MOVE_FILTERSTRING_REFERENCES:
+ move = true;
+ afilterstring = true;
+ if (debug)
+ eventType = "EVENT_MOVE_FILTERSTRING_REFERENCES";
+ break;
+
+ }
+ if (debug)
+ logDebugMsg("SV event: "+eventType);
+ //}
+ //clearSelection();
+
+ ISystemFilter filter = null;
+ ISystemFilterString filterstring = null;
+ if (!afilterstring)
+ filter = (ISystemFilter)event.getSource(); // for multi-source move, gets first filter
+ else
+ filterstring = (ISystemFilterString)event.getSource();
+
+ boolean multiSource = move;
+ // STEP 1: ARE WE SHOWING THE SUBSYSTEM GRANDPARENT OF CURRENT REFRESH?
+ Widget item = findItem(ss);
+
+ if (item == null)
+ {
+ refresh();
+
+ if (debug)
+ logDebugMsg("...Did not find ss "+ss.getName());
+ return;
+ }
+ Item ssItem = (Item)item;
+ boolean wasSelected = false;
+ IStructuredSelection oldSelections = (IStructuredSelection)getSelection();
+
+
+
+ Object parent = event.getParent();
+ if (debug)
+ logDebugMsg("...Found ss "+ss);
+
+ // STEP 2: ARE WE SHOWING A REFERENCE TO THE FILTER's PARENT POOL?
+ Item parentRefItem = null;
+ ISystemFilterContainer refdParent = null;
+ // 3a (reference to filter pool or filter)
+ if (parent instanceof ISystemFilterContainerReference) // given a reference to parent?
+ {
+ refdParent = ((ISystemFilterContainerReference)parent).getReferencedSystemFilterContainer();
+ parentRefItem = (Item)internalFindReferencedItem(ssItem, refdParent, SEARCH_INFINITE);
+ }
+ // 3b and 3d. (filter pool or filter)
+ else if (parent instanceof ISystemFilterContainer)
+ {
+ refdParent = (ISystemFilterContainer)parent;
+ parentRefItem = (Item)internalFindReferencedItem(ssItem, refdParent, SEARCH_INFINITE);
+ }
+ // 3c (subsystem)
+ else
+ {
+ parentRefItem = ssItem;
+ }
+ if (parentRefItem != null)
+ {
+ if (debug)
+ logDebugMsg("......We are showing reference to parent");
+ // STEP 3... YES, SO REFRESH PARENT... IT WILL RE-GEN THE FILTER REFERENCES FOR EACH CHILD FILTER
+ // ... actually, call off the whole show if that parent is currently not expanded!!
+ // HMMM... WE NEED TO REFRESH EVEN IF NOT EXPANDED IF ADDING FIRST CHILD
+ if (!add) // move or delete
+ {
+ if ( !(((TreeItem)parentRefItem).getExpanded()))
+ {
+ refresh(parentRefItem.getData()); // flush cached widgets so next expand is fresh
+ return;
+ }
+ // move or delete and parent is expanded...
+ Item oldItem = (Item)internalFindReferencedItem(parentRefItem, afilterstring?(Object)filterstring:(Object)filter, 1);
+ //if (debug)
+ //logDebugMsg("oldItem null? " + (oldItem==null));
+ if (oldItem != null) // found moved or deleted filter in our subtree
+ {
+ wasSelected = isSelected(oldItem.getData(), oldSelections); // was it selected before?
+ //if (debug)
+ //logDebugMsg("was selected? " + wasSelected);
+ }
+ else
+ {
+ // else interesting case ... we are showing the parent, but can't find the child!
+ }
+ if (move)
+ {
+ Object[] srcObjects = null;
+ if (multiSource)
+ srcObjects = event.getMultiSource();
+ else
+ {
+ srcObjects = new Object[1];
+ srcObjects[0] = event.getSource();
+ }
+ moveReferencedTreeItems(parentRefItem, srcObjects, event.getPosition());
+ //refresh(parentRefItem.getData());
+ }
+ else // remove
+ {
+ remove(oldItem.getData());
+ }
+ }
+ else // add operation
+ {
+ if ( !(((TreeItem)parentRefItem).getExpanded()))
+ {
+ refresh(parentRefItem.getData()); // delete cached GUIs
+ //setExpandedState(parentRefItem,true); // not our job to expand here.
+ }
+ else if (afilterstring)
+ {
+ ISystemFilterReference fr = (ISystemFilterReference)parentRefItem.getData();
+ ISystemFilterStringReference fsr = fr.getSystemFilterStringReference(filterstring);
+ createTreeItem(parentRefItem, fsr, event.getPosition());
+ //setSelection(new StructuredSelection(fsr),true);
+ }
+ else
+ {
+ Object data = parentRefItem.getData();
+ if (data instanceof ISystemFilterContainerReference)
+ {
+ ISystemFilterContainerReference sfcr = (ISystemFilterContainerReference)data;
+ ISystemFilterReference sfr = sfcr.getSystemFilterReference(ss, filter);
+ createTreeItem(parentRefItem, sfr, event.getPosition());
+ }
+ else // hmm, could be parent is a subsystem, child is a filter in no-show-filter-pools mode
+ {
+ if (data instanceof ISystemFilterPoolReferenceManagerProvider) // that's a subsystem!
+ {
+ ISystemFilterPoolReferenceManagerProvider sfprmp = (ISystemFilterPoolReferenceManagerProvider)data;
+ ISystemFilterPoolReferenceManager sfprm = sfprmp.getSystemFilterPoolReferenceManager();
+ ISystemFilterReference sfr = sfprm.getSystemFilterReference(ss, filter);
+ createTreeItem(parentRefItem, sfr, sfprm.getSystemFilterReferencePosition(sfr));
+ }
+ }
+ }
+ //refresh(parentRefItem.getData());
+ }
+
+ // STEP 4: DECIDE WHAT TO SELECT:
+
+ // 4a. ADD ... only select if parent of new filter was previously selected...
+ if (add && isSelected(parentRefItem.getData(),oldSelections))
+ {
+ if (debug)
+ logDebugMsg(".........that parent was previously selected");
+ // .... YES, SO SELECT NEW FILTER'S REFERENCE
+ Item filterItem = (Item)internalFindReferencedItem(parentRefItem, afilterstring?(Object)filterstring:(Object)filter, 1); // start at filter's parent, search for filter
+ if (filterItem == null)
+ {
+ if (debug)
+ logDebugMsg("Hmm, didn't find new filter's reference!");
+ }
+ else
+ {
+ if (debug)
+ logDebugMsg(".........Trying to set selection to " + filterItem.getData());
+ setSelection(new StructuredSelection(filterItem.getData()),true);
+ }
+ }
+ // 4b. DELETE ... select parent if deleted filter was previously selected
+ else if (delete && wasSelected)
+ {
+ setSelection(new StructuredSelection(parentRefItem.getData())); // select parent
+ }
+ // 4c. MOVE ... only select if any of moved references were previously selected...
+ else if (move && wasSelected && !afilterstring)
+ {
+ ISystemFilter[] filters = (ISystemFilter[])event.getMultiSource();
+ if (filters != null)
+ {
+ ISystemFilterReference[] newRefs = new ISystemFilterReference[filters.length];
+ for (int idx=0; idx
+ * The getParent() method in the adapter is very unreliable... adapters can't be sure
+ * of the context which can change via filtering and view options.
+ */
+ public Object getSelectedParent()
+ {
+ Tree tree = getTree();
+ TreeItem[] items = tree.getSelection();
+ if ((items==null) || (items.length==0))
+ {
+ return tree.getData();
+ }
+ else
+ {
+ TreeItem parentItem = items[0].getParentItem();
+ if (parentItem != null)
+ return parentItem.getData();
+ else
+ return tree.getData();
+ }
+ }
+ /**
+ * Return the TreeItem of the parent of the selected node. Or null if a root is selected.
+ */
+ public TreeItem getSelectedParentItem()
+ {
+ Tree tree = getTree();
+ TreeItem[] items = tree.getSelection();
+ if ((items==null) || (items.length==0))
+ {
+ return null;
+ }
+ else
+ {
+ return items[0].getParentItem();
+ }
+ }
+ /**
+ * This returns the element immediately before the first selected element in this tree level.
+ * Often needed for enablement decisions for move up actions.
+ */
+ public Object getPreviousElement()
+ {
+ Object prevElement = null;
+ Tree tree = getTree();
+ TreeItem[] items = tree.getSelection();
+ if ((items != null) && (items.length>0))
+ {
+ TreeItem item1 = items[0];
+ TreeItem[] parentItems = null;
+ TreeItem parentItem = item1.getParentItem();
+ if (parentItem != null)
+ parentItems = parentItem.getItems();
+ else
+ parentItems = item1.getParent().getItems();
+ if (parentItems != null)
+ {
+ TreeItem prevItem = null;
+ for (int idx=0; (prevItem==null) && (idx Not applicable for us.
+ */
+ public Object[] getConnectionChildren(IHost selectedConnection)
+ {
+ //return sr.getSubSystems(selectedConnection);
+ return getAdapter(selectedConnection).getChildren(selectedConnection); // pc42690
+ }
+ /**
+ * This method is called by the connection adapter when deciding to show a plus-sign
+ * or not beside a connection. Return true if this connection has children to be shown.
+ * Not applicable for us.
+ */
+ public boolean hasConnectionChildren(IHost selectedConnection)
+ {
+ return true;
+ }
+ /**
+ * Return true to show right-click popup actions on objects in the tree.
+ * We return true.
+ */
+ public boolean showActions()
+ {
+ return true;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewAPIProviderForFilterPools.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewAPIProviderForFilterPools.java
new file mode 100644
index 00000000000..3e048628857
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewAPIProviderForFilterPools.java
@@ -0,0 +1,128 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.filters.ISystemFilterPool;
+import org.eclipse.rse.filters.ISystemFilterPoolReference;
+import org.eclipse.rse.model.IHost;
+
+
+/**
+ * This class is a provider of root nodes to the remote systems tree viewer part.
+ * It is used when the contents are the children of a particular subsystem.
+ * Used when user right clicks on a filter pool and selects Open In New Perspective.
+ */
+public class SystemViewAPIProviderForFilterPools
+ extends SystemAbstractAPIProvider
+{
+
+
+ protected ISubSystem subsystem = null;
+ protected ISystemFilterPool filterPool = null;
+ protected ISystemFilterPoolReference filterPoolReference = null;
+
+ /**
+ * Constructor
+ * @param filterPoolReference The filterpool reference object we are drilling down on.
+ */
+ public SystemViewAPIProviderForFilterPools(ISystemFilterPoolReference filterPoolReference)
+ {
+ super();
+ setFilterPoolReference(filterPoolReference);
+ }
+
+ /**
+ * Get the parent subsystem object.
+ */
+ public ISubSystem getSubSystem()
+ {
+ return subsystem;
+ }
+ /**
+ * Get the input filter pool reference object.
+ */
+ public ISystemFilterPoolReference getSystemFilterPoolReference()
+ {
+ return filterPoolReference;
+ }
+ /**
+ * Get the filter pool referenced by the input filter pool reference object.
+ */
+ public ISystemFilterPool getSystemFilterPool()
+ {
+ return filterPool;
+ }
+
+ /**
+ * Reset the input filter pool reference object.
+ */
+ public void setFilterPoolReference(ISystemFilterPoolReference filterPoolReference)
+ {
+ this.filterPoolReference = filterPoolReference;
+ this.filterPool = filterPoolReference.getReferencedFilterPool();
+ this.subsystem = (ISubSystem)filterPoolReference.getProvider();
+ }
+
+ // ----------------------------------
+ // SYSTEMVIEWINPUTPROVIDER METHODS...
+ // ----------------------------------
+ /**
+ * Return the children objects to consistute the root elements in the system view tree.
+ * We return all filters for this filter pool
+ */
+ public Object[] getSystemViewRoots()
+ {
+ return filterPoolReference.getSystemFilterReferences(getSubSystem());
+ }
+ /**
+ * Return true if {@link #getSystemViewRoots()} will return a non-empty list
+ * We return true if the referenced filter pool has any filters
+ */
+ public boolean hasSystemViewRoots()
+ {
+ return (filterPool.getSystemFilterCount() > 0);
+ }
+ /**
+ * This method is called by the connection adapter when the user expands
+ * a connection. This method must return the child objects to show for that
+ * connection.
+ * Not applicable for us.
+ */
+ public Object[] getConnectionChildren(IHost selectedConnection)
+ {
+ return null;
+ }
+ /**
+ * This method is called by the connection adapter when deciding to show a plus-sign
+ * or not beside a connection. Return true if this connection has children to be shown.
+ * Not applicable for us.
+ */
+ public boolean hasConnectionChildren(IHost selectedConnection)
+ {
+ return false;
+ }
+
+ /**
+ * Return true to show right-click popup actions on objects in the tree.
+ * We return true.
+ */
+ public boolean showActions()
+ {
+ return true;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewAPIProviderForFilterStrings.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewAPIProviderForFilterStrings.java
new file mode 100644
index 00000000000..bf0f622a226
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewAPIProviderForFilterStrings.java
@@ -0,0 +1,201 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.filters.ISystemFilter;
+import org.eclipse.rse.filters.ISystemFilterPool;
+import org.eclipse.rse.filters.ISystemFilterPoolReference;
+import org.eclipse.rse.filters.ISystemFilterReference;
+import org.eclipse.rse.filters.ISystemFilterString;
+import org.eclipse.rse.filters.ISystemFilterStringReference;
+import org.eclipse.rse.model.IHost;
+import org.eclipse.rse.model.ISystemMessageObject;
+import org.eclipse.rse.model.SystemMessageObject;
+import org.eclipse.rse.ui.ISystemMessages;
+
+
+/**
+ * This class is a provider of root nodes to the remote systems tree viewer part.
+ * It is used when the contents are the children of a particular subsystem.
+ * Used when user right clicks on a filter string and selects Open In New Perspective.
+ */
+public class SystemViewAPIProviderForFilterStrings
+ extends SystemAbstractAPIProvider implements ISystemMessages
+{
+
+
+ protected ISubSystem subsystem = null;
+ protected ISystemFilterPool filterPool = null;
+ protected ISystemFilterPoolReference filterPoolReference = null;
+ protected ISystemFilterReference filterReference = null;
+ protected ISystemFilter filter = null;
+ protected ISystemFilterString filterString = null;
+ protected ISystemFilterStringReference filterStringReference = null;
+
+ /**
+ * Constructor
+ * @param filterStringReference The filter string reference object we are drilling down on.
+ */
+ public SystemViewAPIProviderForFilterStrings(ISystemFilterStringReference filterStringReference)
+ {
+ super();
+ setFilterStringReference(filterStringReference);
+ }
+
+ /**
+ * Get the parent subsystem object.
+ */
+ public ISubSystem getSubSystem()
+ {
+ return subsystem;
+ }
+ /**
+ * Get the parent filter pool reference object.
+ */
+ public ISystemFilterPoolReference getSystemFilterPoolReference()
+ {
+ return filterPoolReference;
+ }
+ /**
+ * Get the parent filter pool.
+ */
+ public ISystemFilterPool getSystemFilterPool()
+ {
+ return filterPool;
+ }
+ /**
+ * Get the parent filter reference object.
+ */
+ public ISystemFilterReference getSystemFilterReference()
+ {
+ return filterReference;
+ }
+ /**
+ * Get the parent filter
+ */
+ public ISystemFilter getSystemFilter()
+ {
+ return filter;
+ }
+ /**
+ * Get the input filter string reference object.
+ */
+ public ISystemFilterStringReference getSystemFilterStringReference()
+ {
+ return filterStringReference;
+ }
+ /**
+ * Get the filter referenced by the input filter string reference object.
+ */
+ public ISystemFilterString getSystemFilterString()
+ {
+ return filterString;
+ }
+
+
+ /**
+ * Reset the input filter string reference object.
+ */
+ public void setFilterStringReference(ISystemFilterStringReference filterStringReference)
+ {
+ this.filterStringReference = filterStringReference;
+ this.filterString = filterStringReference.getReferencedFilterString();
+ this.filterReference = filterStringReference.getParent();
+ this.filter = filterReference.getReferencedFilter();
+ this.filterPoolReference = filterReference.getParentSystemFilterReferencePool();
+ this.filterPool = filterPoolReference.getReferencedFilterPool();
+ this.subsystem = (ISubSystem)filterPoolReference.getProvider();
+ }
+
+ // ----------------------------------
+ // SYSTEMVIEWINPUTPROVIDER METHODS...
+ // ----------------------------------
+ /**
+ * Return the children objects to consistute the root elements in the system view tree.
+ * What we return depends on setting of Show Filter Strings.
+ */
+ public Object[] getSystemViewRoots()
+ {
+ ISubSystem ss = subsystem;
+ Object element = filterStringReference;
+ Object[] children = null;
+ try
+ {
+ children = ss.resolveFilterString(filterStringReference.getString(),getShell());
+ if ((children == null) || (children.length==0))
+ {
+ children = new SystemMessageObject[1];
+ children[0] = new SystemMessageObject(SystemPlugin.getPluginMessage(MSG_EXPAND_EMPTY),
+ ISystemMessageObject.MSGTYPE_EMPTY, element);
+ }
+ }
+ catch (InterruptedException exc)
+ {
+ children = new SystemMessageObject[1];
+ children[0] = new SystemMessageObject(SystemPlugin.getPluginMessage(MSG_EXPAND_CANCELLED),
+ ISystemMessageObject.MSGTYPE_CANCEL, element);
+ System.out.println("Canceled.");
+ }
+ catch (Exception exc)
+ {
+ children = new SystemMessageObject[1];
+ children[0] = new SystemMessageObject(SystemPlugin.getPluginMessage(MSG_EXPAND_FAILED),
+ ISystemMessageObject.MSGTYPE_ERROR, element);
+ System.out.println("Exception resolving filter strings: " + exc.getClass().getName() + ", " + exc.getMessage());
+ exc.printStackTrace();
+ } // message already issued
+ return children;
+ }
+ /**
+ * Return true if {@link #getSystemViewRoots()} will return a non-empty list
+ * We return true
+ */
+ public boolean hasSystemViewRoots()
+ {
+ return true;
+ }
+ /**
+ * This method is called by the connection adapter when the user expands
+ * a connection. This method must return the child objects to show for that
+ * connection.
+ * Not applicable for us.
+ */
+ public Object[] getConnectionChildren(IHost selectedConnection)
+ {
+ return null;
+ }
+ /**
+ * This method is called by the connection adapter when deciding to show a plus-sign
+ * or not beside a connection. Return true if this connection has children to be shown.
+ * Not applicable for us.
+ */
+ public boolean hasConnectionChildren(IHost selectedConnection)
+ {
+ return false;
+ }
+
+ /**
+ * Return true to show right-click popup actions on objects in the tree.
+ * We return true.
+ */
+ public boolean showActions()
+ {
+ return true;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewAPIProviderForFilters.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewAPIProviderForFilters.java
new file mode 100644
index 00000000000..612534fe8ae
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewAPIProviderForFilters.java
@@ -0,0 +1,258 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.rse.core.SystemBasePlugin;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
+import org.eclipse.rse.core.subsystems.SubSystemHelpers;
+import org.eclipse.rse.core.subsystems.util.ISubsystemConfigurationAdapter;
+import org.eclipse.rse.filters.ISystemFilter;
+import org.eclipse.rse.filters.ISystemFilterPool;
+import org.eclipse.rse.filters.ISystemFilterPoolReference;
+import org.eclipse.rse.filters.ISystemFilterReference;
+import org.eclipse.rse.model.IHost;
+import org.eclipse.rse.model.ISystemMessageObject;
+import org.eclipse.rse.model.ISystemRegistry;
+import org.eclipse.rse.model.ISystemResourceChangeEvents;
+import org.eclipse.rse.model.ISystemResourceChangeListener;
+import org.eclipse.rse.model.SystemMessageObject;
+import org.eclipse.rse.model.SystemResourceChangeEvent;
+import org.eclipse.rse.ui.ISystemMessages;
+
+
+
+/**
+ * This class is a provider of root nodes to the remote systems tree viewer part.
+ * It is used when the contents are the children of a particular subsystem.
+ * Used when user right clicks on a filter and selects Open In New Perspective.
+ */
+public class SystemViewAPIProviderForFilters
+ extends SystemAbstractAPIProvider implements ISystemMessages
+{
+
+
+ protected ISubSystem subsystem = null;
+ protected ISystemFilterPool filterPool = null;
+ protected ISystemFilterPoolReference filterPoolReference = null;
+ protected ISystemFilterReference filterReference = null;
+ protected ISystemFilter filter = null;
+
+ /**
+ * Constructor
+ * @param filterReference The filter reference object we are drilling down on.
+ */
+ public SystemViewAPIProviderForFilters(ISystemFilterReference filterReference)
+ {
+ super();
+ setFilterReference(filterReference);
+ }
+
+ /**
+ * Get the parent subsystem object.
+ */
+ public ISubSystem getSubSystem()
+ {
+ return subsystem;
+ }
+ /**
+ * Get the parent filter pool reference object.
+ */
+ public ISystemFilterPoolReference getSystemFilterPoolReference()
+ {
+ return filterPoolReference;
+ }
+ /**
+ * Get the parent filter pool.
+ */
+ public ISystemFilterPool getSystemFilterPool()
+ {
+ return filterPool;
+ }
+ /**
+ * Get the input filter reference object.
+ */
+ public ISystemFilterReference getSystemFilterReference()
+ {
+ return filterReference;
+ }
+ /**
+ * Get the filter referenced by the input filter reference object.
+ */
+ public ISystemFilter getSystemFilter()
+ {
+ return filter;
+ }
+
+ /**
+ * Reset the input filter reference object.
+ */
+ public void setFilterReference(ISystemFilterReference filterReference)
+ {
+ this.filterReference = filterReference;
+ this.filter = filterReference.getReferencedFilter();
+ this.filterPoolReference = filterReference.getParentSystemFilterReferencePool();
+ this.filterPool = filterPoolReference.getReferencedFilterPool();
+ this.subsystem = (ISubSystem)filterPoolReference.getProvider();
+ }
+
+ // ----------------------------------
+ // SYSTEMVIEWINPUTPROVIDER METHODS...
+ // ----------------------------------
+ /**
+ * Return the children objects to consistute the root elements in the system view tree.
+ * What we return depends on setting of Show Filter Strings.
+ */
+ public Object[] getSystemViewRoots()
+ {
+ // see getChildren() OF SystemViewFilterReferenceAdapter. TODO: RE-USE VS COPY!
+ Object[] children = null;
+ ISystemFilterReference fRef = filterReference;
+ Object element = fRef;
+ //Object[] children = fRef.getChildren(getShell());
+ ISystemFilter referencedFilter = fRef.getReferencedFilter();
+
+ ISubSystemConfiguration ssf = SubSystemHelpers.getParentSubSystemFactory(referencedFilter);
+ boolean promptable = referencedFilter.isPromptable();
+ //System.out.println("Promptable? " + promptable);
+ if (promptable)
+ {
+ children = new SystemMessageObject[1];
+ try {
+ ISubsystemConfigurationAdapter adapter = (ISubsystemConfigurationAdapter)ssf.getAdapter(ISubsystemConfigurationAdapter.class);
+ ISystemFilter newFilter = adapter.createFilterByPrompting(ssf, fRef, getShell());
+ if (newFilter == null)
+ {
+ children[0] = new SystemMessageObject(SystemPlugin.getPluginMessage(MSG_EXPAND_CANCELLED),
+ ISystemMessageObject.MSGTYPE_CANCEL,element);
+ }
+ else // filter successfully created!
+ {
+ // return "filter created successfully" message object for this node
+ children[0] = new SystemMessageObject(SystemPlugin.getPluginMessage(MSG_EXPAND_FILTERCREATED),
+ ISystemMessageObject.MSGTYPE_OBJECTCREATED,element);
+ // select the new filter reference...
+ ISubSystem ss = fRef.getSubSystem();
+ ISystemFilterReference sfr = fRef.getParentSystemFilterReferencePool().getExistingSystemFilterReference(ss, newFilter);
+ ISystemViewInputProvider inputProvider = this;
+ if ((sfr != null) && (inputProvider != null) && (inputProvider.getViewer()!=null))
+ {
+ ISystemRegistry sr = SystemPlugin.getTheSystemRegistry();
+ SystemResourceChangeEvent event = new SystemResourceChangeEvent(sfr, ISystemResourceChangeEvents.EVENT_SELECT_EXPAND, null);
+ Viewer v = inputProvider.getViewer();
+ if (v instanceof ISystemResourceChangeListener)
+ {
+ //sr.fireEvent((ISystemResourceChangeListener)v, event); // only expand in the current viewer, not all viewers!
+ sr.postEvent((ISystemResourceChangeListener)v, event); // only expand in the current viewer, not all viewers!
+ }
+ }
+ }
+ } catch (Exception exc) {
+ children[0] = new SystemMessageObject(SystemPlugin.getPluginMessage(MSG_EXPAND_FAILED),
+ ISystemMessageObject.MSGTYPE_ERROR, element);
+ SystemBasePlugin.logError("Exception prompting for filter ",exc);
+ }
+ //SystemPlugin.logDebugMessage(this.getClass().getName(),"returning children");
+ return children;
+ }
+ ISubSystem ss = fRef.getSubSystem();
+ Object[] nestedFilterReferences = fRef.getSystemFilterReferences(ss);
+ int nbrFilterStrings = referencedFilter.getFilterStringCount();
+ if (nbrFilterStrings == 0)
+ return nestedFilterReferences;
+ else
+ {
+
+ {
+ String[] filterStrings = referencedFilter.getFilterStrings();
+ try
+ {
+ Object[] allChildren = ss.resolveFilterStrings(filterStrings,getShell());
+ int nbrNestedFilters = (nestedFilterReferences==null) ? 0: nestedFilterReferences.length;
+ children = new Object[nbrNestedFilters + allChildren.length];
+ int idx = 0;
+ for (idx=0; idx Not applicable for us.
+ */
+ public Object[] getConnectionChildren(IHost selectedConnection)
+ {
+ return null;
+ }
+ /**
+ * This method is called by the connection adapter when deciding to show a plus-sign
+ * or not beside a connection. Return true if this connection has children to be shown.
+ * Not applicable for us.
+ */
+ public boolean hasConnectionChildren(IHost selectedConnection)
+ {
+ return false;
+ }
+
+ /**
+ * Return true to show right-click popup actions on objects in the tree.
+ * We return true.
+ */
+ public boolean showActions()
+ {
+ return true;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewAPIProviderForSubSystems.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewAPIProviderForSubSystems.java
new file mode 100644
index 00000000000..0e26638d7c0
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewAPIProviderForSubSystems.java
@@ -0,0 +1,107 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.model.IHost;
+
+
+/**
+ * This class is a provider of root nodes to the remote systems tree viewer part.
+ * It is used when the contents are the children of a particular subsystem.
+ * Used when user right clicks on a subsystem and selects Open In New Perspective.
+ */
+public class SystemViewAPIProviderForSubSystems
+ extends SystemAbstractAPIProvider
+{
+
+
+ protected ISubSystem subsystem = null;
+
+ /**
+ * Constructor
+ * @param subsystem The subsystem object we are drilling down on.
+ */
+ public SystemViewAPIProviderForSubSystems(ISubSystem subsystem)
+ {
+ super();
+ setSubSystem(subsystem);
+ }
+
+ /**
+ * Get the input subsystem object.
+ */
+ public ISubSystem getSubSystem()
+ {
+ return subsystem;
+ }
+ /**
+ * Reset the input subsystem object.
+ */
+ public void setSubSystem(ISubSystem subsystem)
+ {
+ this.subsystem = subsystem;
+ }
+
+ // ----------------------------------
+ // SYSTEMVIEWINPUTPROVIDER METHODS...
+ // ----------------------------------
+ /**
+ * Return the children objects to consistute the root elements in the system view tree.
+ * We return all filter pools for this subsystem
+ */
+ public Object[] getSystemViewRoots()
+ {
+ return subsystem.getChildren();
+ }
+ /**
+ * Return true if {@link #getSystemViewRoots()} will return a non-empty list
+ * We return subsystem.hasChildren()
+ */
+ public boolean hasSystemViewRoots()
+ {
+ return subsystem.hasChildren();
+ }
+ /**
+ * This method is called by the connection adapter when the user expands
+ * a connection. This method must return the child objects to show for that
+ * connection.
+ * Not applicable for us.
+ */
+ public Object[] getConnectionChildren(IHost selectedConnection)
+ {
+ return null;
+ }
+ /**
+ * This method is called by the connection adapter when deciding to show a plus-sign
+ * or not beside a connection. Return true if this connection has children to be shown.
+ * Not applicable for us.
+ */
+ public boolean hasConnectionChildren(IHost selectedConnection)
+ {
+ return false;
+ }
+
+ /**
+ * Return true to show right-click popup actions on objects in the tree.
+ * We return true.
+ */
+ public boolean showActions()
+ {
+ return true;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewAdapterFactory.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewAdapterFactory.java
new file mode 100644
index 00000000000..6379ac107c6
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewAdapterFactory.java
@@ -0,0 +1,353 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.core.runtime.IAdapterManager;
+import org.eclipse.rse.core.SystemBasePlugin;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.filters.ISystemFilter;
+import org.eclipse.rse.filters.ISystemFilterPool;
+import org.eclipse.rse.filters.ISystemFilterPoolReference;
+import org.eclipse.rse.filters.ISystemFilterReference;
+import org.eclipse.rse.filters.ISystemFilterString;
+import org.eclipse.rse.internal.model.SystemNewConnectionPromptObject;
+import org.eclipse.rse.model.IHost;
+import org.eclipse.rse.model.ISystemMessageObject;
+import org.eclipse.rse.model.ISystemProfile;
+import org.eclipse.rse.model.ISystemPromptableObject;
+import org.eclipse.rse.ui.view.team.SystemTeamViewCategoryAdapter;
+import org.eclipse.rse.ui.view.team.SystemTeamViewCategoryNode;
+import org.eclipse.rse.ui.view.team.SystemTeamViewProfileAdapter;
+import org.eclipse.rse.ui.view.team.SystemTeamViewSubSystemFactoryAdapter;
+import org.eclipse.rse.ui.view.team.SystemTeamViewSubSystemFactoryNode;
+import org.eclipse.ui.IActionFilter;
+import org.eclipse.ui.model.IWorkbenchAdapter;
+import org.eclipse.ui.progress.IDeferredWorkbenchAdapter;
+import org.eclipse.ui.views.properties.IPropertySource;
+
+
+/**
+ * This factory maps requests for an adapter object from a given
+ * element object.
+ */
+public class SystemViewAdapterFactory implements IAdapterFactory
+{
+
+ private SystemViewRootInputAdapter rootAdapter = new SystemViewRootInputAdapter();
+ private SystemViewConnectionAdapter connectionAdapter= new SystemViewConnectionAdapter();
+ private SystemViewSubSystemAdapter subsystemAdapter = new SystemViewSubSystemAdapter();
+ private SystemViewFilterPoolAdapter filterPoolAdapter= new SystemViewFilterPoolAdapter();
+ private SystemViewFilterAdapter filterAdapter = new SystemViewFilterAdapter();
+ private SystemViewFilterPoolReferenceAdapter filterPoolReferenceAdapter= new SystemViewFilterPoolReferenceAdapter();
+ private SystemViewFilterReferenceAdapter filterReferenceAdapter = new SystemViewFilterReferenceAdapter();
+ private SystemViewMessageAdapter msgAdapter = new SystemViewMessageAdapter();
+ private SystemViewPromptableAdapter promptAdapter = new SystemViewPromptableAdapter();
+ private SystemViewNewConnectionPromptAdapter newConnPromptAdapter = new SystemViewNewConnectionPromptAdapter();
+ private SystemTeamViewProfileAdapter profileAdapter= new SystemTeamViewProfileAdapter();
+ private SystemTeamViewCategoryAdapter categoryAdapter;
+ private SystemTeamViewSubSystemFactoryAdapter subsysFactoryAdapter;
+
+ private SystemViewFilterStringAdapter filterStringAdapter = new SystemViewFilterStringAdapter();
+
+ /**
+ * @see IAdapterFactory#getAdapterList()
+ */
+ public Class[] getAdapterList()
+ {
+ return new Class[] {
+ ISystemViewElementAdapter.class,
+ ISystemDragDropAdapter.class,
+ IPropertySource.class,
+ IWorkbenchAdapter.class,
+ IActionFilter.class,
+ IDeferredWorkbenchAdapter.class
+ };
+ }
+ /**
+ * Called by our plugin's startup method to register our adaptable object types
+ * with the platform. We prefer to do it here to isolate/encapsulate all factory
+ * logic in this one place.
+ */
+ public void registerWithManager(IAdapterManager manager)
+ {
+ manager.registerAdapters(this, ISystemViewInputProvider.class);
+ manager.registerAdapters(this, ISystemProfile.class);
+ manager.registerAdapters(this, IHost.class);
+ manager.registerAdapters(this, ISubSystem.class);
+ manager.registerAdapters(this, ISystemFilter.class);
+ manager.registerAdapters(this, ISystemFilterPool.class);
+ manager.registerAdapters(this, ISystemFilterPoolReference.class);
+ manager.registerAdapters(this, ISystemFilterReference.class);
+ manager.registerAdapters(this, ISystemFilterString.class);
+ manager.registerAdapters(this, ISystemMessageObject.class);
+ manager.registerAdapters(this, ISystemPromptableObject.class);
+ manager.registerAdapters(this, SystemTeamViewCategoryNode.class);
+ manager.registerAdapters(this, SystemTeamViewSubSystemFactoryNode.class);
+
+ // FIXME - UDAs no longer in core
+ //manager.registerAdapters(this, SystemTeamViewCompileTypeNode.class);
+ //manager.registerAdapters(this, SystemTeamViewCompileCommandNode.class);
+ //manager.registerAdapters(this, SystemUDActionElement.class);
+ }
+ /**
+ * @see IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
+ */
+ public Object getAdapter(Object adaptableObject, Class adapterType)
+ {
+ Object adapter = null;
+ if (adaptableObject instanceof ISystemViewElementAdapter)
+ adapter = adaptableObject;
+ else if (adaptableObject instanceof ISystemDragDropAdapter)
+ adapter = adaptableObject;
+ else if (adaptableObject instanceof ISystemViewInputProvider)
+ adapter = rootAdapter;
+ else if (adaptableObject instanceof ISystemProfile)
+ adapter = profileAdapter;
+ else if (adaptableObject instanceof IHost)
+ adapter = connectionAdapter;
+ else if (adaptableObject instanceof ISubSystem)
+ adapter = subsystemAdapter;
+ else if (adaptableObject instanceof ISystemFilterPoolReference)
+ adapter = filterPoolReferenceAdapter;
+ else if (adaptableObject instanceof ISystemFilterPool)
+ adapter = filterPoolAdapter;
+ else if (adaptableObject instanceof ISystemFilterReference)
+ adapter = filterReferenceAdapter;
+ else if (adaptableObject instanceof ISystemFilterString)
+ adapter = filterStringAdapter;
+ else if (adaptableObject instanceof ISystemFilter)
+ adapter = filterAdapter;
+ else if (adaptableObject instanceof ISystemMessageObject)
+ adapter = msgAdapter;
+ else if (adaptableObject instanceof ISystemPromptableObject) {
+
+ if (adaptableObject instanceof SystemNewConnectionPromptObject) {
+ adapter = newConnPromptAdapter;
+ }
+ else {
+ adapter = promptAdapter;
+ }
+ }
+ else if (adaptableObject instanceof SystemTeamViewCategoryNode)
+ adapter = getCategoryAdapter();
+ else if (adaptableObject instanceof SystemTeamViewSubSystemFactoryNode)
+ adapter = getSubSystemFactoryAdapter();
+
+ /** FIXME - UDAs no longer in core
+ else if (adaptableObject instanceof SystemTeamViewCompileTypeNode)
+ adapter = getCompileTypeAdapter();
+ else if (adaptableObject instanceof SystemTeamViewCompileCommandNode)
+ adapter = getCompileCommandAdapter();
+ else if (adaptableObject instanceof SystemUDActionElement)
+ adapter = getUserActionAdapter();
+ */
+
+ if ((adapter != null) && (adapterType == IPropertySource.class))
+ {
+ ((ISystemViewElementAdapter)adapter).setPropertySourceInput(adaptableObject);
+ }
+ else if (adapter == null)
+ {
+ SystemBasePlugin.logWarning("No adapter found for object of type: " + adaptableObject.getClass().getName());
+ }
+ return adapter;
+ }
+
+ /**
+ * Because we use singletons for our adapters, it is possible to speed up
+ * access to them by simply returning them from here.
+ *
+ * This method returns the RSE adapter for root inputs to the RSE
+ * @return SystemViewRootInputAdapter
+ */
+ public SystemViewRootInputAdapter getRootInputAdapter()
+ {
+ return rootAdapter;
+ }
+
+ /**
+ * Because we use singletons for our adapters, it is possible to speed up
+ * access to them by simply returning them from here.
+ *
+ * This method returns the RSE adapter for connection objects
+ * @return SystemViewConnectionAdapter
+ */
+ public SystemViewConnectionAdapter getConnectionAdapter()
+ {
+ return connectionAdapter;
+ }
+
+ /**
+ * Because we use singletons for our adapters, it is possible to speed up
+ * access to them by simply returning them from here.
+ *
+ * This method returns the RSE adapter for profile objects
+ * @return SystemViewProfileAdapter
+ */
+ public SystemTeamViewProfileAdapter getProfileAdapter()
+ {
+ return profileAdapter;
+ }
+
+ /**
+ * Because we use singletons for our adapters, it is possible to speed up
+ * access to them by simply returning them from here.
+ *
+ * This method returns the RSE adapter for filters
+ * @return SystemViewFilterAdapter
+ */
+ public SystemViewFilterAdapter getFilterAdapter()
+ {
+ return filterAdapter;
+ }
+
+ /**
+ * Because we use singletons for our adapters, it is possible to speed up
+ * access to them by simply returning them from here.
+ *
+ * This method returns the RSE adapter for filter pools
+ * @return SystemViewFilterPoolAdapter
+ */
+ public SystemViewFilterPoolAdapter getFilterPoolAdapter()
+ {
+ return filterPoolAdapter;
+ }
+
+ /**
+ * Because we use singletons for our adapters, it is possible to speed up
+ * access to them by simply returning them from here.
+ *
+ * This method returns the RSE adapter for filter pool references, which
+ * are what we actually see in the RSE.
+ * @return SystemViewFilterPoolReferenceAdapter
+ */
+ public SystemViewFilterPoolReferenceAdapter getFilterPoolReferenceAdapter()
+ {
+ return filterPoolReferenceAdapter;
+ }
+
+ /**
+ * Because we use singletons for our adapters, it is possible to speed up
+ * access to them by simply returning them from here.
+ *
+ * This method returns the RSE adapter for filter references, which are
+ * what we actually see in the RSE
+ * @return SystemViewFilterReferenceAdapter
+ */
+ public SystemViewFilterReferenceAdapter getFilterReferenceAdapter()
+ {
+ return filterReferenceAdapter;
+ }
+
+ /**
+ * Because we use singletons for our adapters, it is possible to speed up
+ * access to them by simply returning them from here.
+ *
+ * This method returns the RSE adapter for messages shown in the RSE as child objects
+ * @return SystemViewMessageAdapter
+ */
+ public SystemViewMessageAdapter getMsgAdapter()
+ {
+ return msgAdapter;
+ }
+
+ /**
+ * Because we use singletons for our adapters, it is possible to speed up
+ * access to them by simply returning them from here.
+ *
+ * This method returns the RSE adapter for promptable objects the run an action when expanded
+ * @return SystemViewPromptableAdapter
+ */
+ public SystemViewPromptableAdapter getPromptAdapter()
+ {
+ return promptAdapter;
+ }
+
+ /**
+ * Because we use singletons for our adapters, it is possible to speed up
+ * access to them by simply returning them from here.
+ *
+ * This method returns the RSE adapter for subsystems
+ * @return SystemViewSubSystemAdapter
+ */
+ public SystemViewSubSystemAdapter getSubsystemAdapter()
+ {
+ return subsystemAdapter;
+ }
+
+ /**
+ * Return adapter for category nodes in team view
+ */
+ public SystemTeamViewCategoryAdapter getCategoryAdapter()
+ {
+ if (categoryAdapter == null)
+ categoryAdapter = new SystemTeamViewCategoryAdapter();
+ return categoryAdapter;
+ }
+ /**
+ * Return adapter for subsystem factory nodes in team view
+ */
+ public SystemTeamViewSubSystemFactoryAdapter getSubSystemFactoryAdapter()
+ {
+ if (subsysFactoryAdapter == null)
+ subsysFactoryAdapter = new SystemTeamViewSubSystemFactoryAdapter();
+ return subsysFactoryAdapter;
+ }
+
+// FIXME user actions and compile commands no longer coupled with core
+// /**
+// * Return adapter for user actions nodes in team view
+// */
+// public SystemTeamViewUserActionAdapter getUserActionAdapter()
+// {
+// if (userActionAdapter == null)
+// userActionAdapter = new SystemTeamViewUserActionAdapter();
+// return userActionAdapter;
+// }
+//
+// /**
+// * Return adapter for compile type nodes in team view
+// */
+// public SystemTeamViewCompileTypeAdapter getCompileTypeAdapter()
+// {
+// if (compileTypeAdapter == null)
+// compileTypeAdapter = new SystemTeamViewCompileTypeAdapter();
+// return compileTypeAdapter;
+// }
+// /**
+// * Return adapter for compile command nodes in team view
+// */
+// public SystemTeamViewCompileCommandAdapter getCompileCommandAdapter()
+// {
+// if (compileCmdAdapter == null)
+// compileCmdAdapter = new SystemTeamViewCompileCommandAdapter();
+// return compileCmdAdapter;
+// }
+
+ /**
+ * Because we use singletons for our adapters, it is possible to speed up
+ * access to them by simply returning them from here.
+ *
+ * This method returns the RSE adapter for filter strings
+ * @return SystemViewFilterStringAdapter
+ */
+ public SystemViewFilterStringAdapter getFilterStringAdapter()
+ {
+ return filterStringAdapter;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewCompositeActionGroup.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewCompositeActionGroup.java
new file mode 100644
index 00000000000..2ae276ac08a
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewCompositeActionGroup.java
@@ -0,0 +1,104 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.util.Assert;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.actions.ActionContext;
+import org.eclipse.ui.actions.ActionGroup;
+
+public class SystemViewCompositeActionGroup extends ActionGroup {
+
+
+
+ private ActionGroup[] fGroups;
+
+ public SystemViewCompositeActionGroup() {
+ }
+
+ public SystemViewCompositeActionGroup(ActionGroup[] groups) {
+ setGroups(groups);
+ }
+
+ protected void setGroups(ActionGroup[] groups) {
+ Assert.isTrue(fGroups == null);
+ Assert.isNotNull(groups);
+ fGroups= groups;
+ }
+
+ public ActionGroup get(int index) {
+ if (fGroups == null)
+ return null;
+ return fGroups[index];
+ }
+
+ public void addGroup(ActionGroup group) {
+ if (fGroups == null) {
+ fGroups= new ActionGroup[] { group };
+ } else {
+ ActionGroup[] newGroups= new ActionGroup[fGroups.length + 1];
+ System.arraycopy(fGroups, 0, newGroups, 0, fGroups.length);
+ newGroups[fGroups.length]= group;
+ fGroups= newGroups;
+ }
+ }
+
+ public void dispose() {
+ super.dispose();
+ if (fGroups == null)
+ return;
+ for (int i= 0; i < fGroups.length; i++) {
+ fGroups[i].dispose();
+ }
+ }
+
+ public void fillActionBars(IActionBars actionBars) {
+ super.fillActionBars(actionBars);
+ if (fGroups == null)
+ return;
+ for (int i= 0; i < fGroups.length; i++) {
+ fGroups[i].fillActionBars(actionBars);
+ }
+ }
+
+ public void fillContextMenu(IMenuManager menu) {
+ super.fillContextMenu(menu);
+ if (fGroups == null)
+ return;
+ for (int i= 0; i < fGroups.length; i++) {
+ fGroups[i].fillContextMenu(menu);
+ }
+ }
+
+ public void setContext(ActionContext context) {
+ super.setContext(context);
+ if (fGroups == null)
+ return;
+ for (int i= 0; i < fGroups.length; i++) {
+ fGroups[i].setContext(context);
+ }
+ }
+
+ public void updateActionBars() {
+ super.updateActionBars();
+ if (fGroups == null)
+ return;
+ for (int i= 0; i < fGroups.length; i++) {
+ fGroups[i].updateActionBars();
+ }
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewConnectionAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewConnectionAdapter.java
new file mode 100644
index 00000000000..22a1edbdc1a
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewConnectionAdapter.java
@@ -0,0 +1,646 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+import java.util.Vector;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.core.ISystemTypes;
+import org.eclipse.rse.core.ISystemUserIdConstants;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.SystemPreferencesManager;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.model.IHost;
+import org.eclipse.rse.model.ISystemRegistry;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.SystemMenuManager;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.actions.SystemClearAllPasswordsAction;
+import org.eclipse.rse.ui.actions.SystemConnectAllSubSystemsAction;
+import org.eclipse.rse.ui.actions.SystemCopyConnectionAction;
+import org.eclipse.rse.ui.actions.SystemDisconnectAllSubSystemsAction;
+import org.eclipse.rse.ui.actions.SystemMoveConnectionAction;
+import org.eclipse.rse.ui.actions.SystemMoveDownConnectionAction;
+import org.eclipse.rse.ui.actions.SystemMoveUpConnectionAction;
+import org.eclipse.rse.ui.actions.SystemNewConnectionFromExistingConnectionAction;
+import org.eclipse.rse.ui.actions.SystemWorkOfflineAction;
+import org.eclipse.rse.ui.validators.ISystemValidator;
+import org.eclipse.rse.ui.validators.ValidatorSpecialChar;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.PropertyDescriptor;
+import org.eclipse.ui.views.properties.TextPropertyDescriptor;
+
+
+/**
+ * Adapter for displaying SystemConnection objects in tree views.
+ */
+public class SystemViewConnectionAdapter
+ extends AbstractSystemViewAdapter
+ implements ISystemViewElementAdapter, ISystemUserIdConstants
+{
+ private SystemNewConnectionFromExistingConnectionAction anotherConnectionAction = null;
+ //private SystemUpdateConnectionAction updateAction = null;
+ private SystemMoveUpConnectionAction upAction = null;
+ private SystemMoveDownConnectionAction downAction = null;
+ private SystemDisconnectAllSubSystemsAction disconnectAction = null;
+ private SystemConnectAllSubSystemsAction connectAction = null;
+ private SystemClearAllPasswordsAction clearPasswordAction = null;
+ private SystemCopyConnectionAction copyAction = null;
+ private SystemMoveConnectionAction moveAction = null;
+
+ // yantzi: artemis 6.0, add work offline support
+ private SystemWorkOfflineAction offlineAction = null;
+
+ private SystemInheritablePropertyData userIdData = new SystemInheritablePropertyData();
+ private String translatedType = null;
+ private String translatedHostname = null;
+ private String translatedDescription = null;
+ // for reset property support
+ private String original_hostName, original_description;
+ private SystemInheritablePropertyData original_userIdData = new SystemInheritablePropertyData();
+ private boolean changed_hostName, changed_description, changed_userId;
+ private boolean actionsCreated = false;
+
+ // -------------------
+ // property descriptors
+ // -------------------
+ private static PropertyDescriptor[] propertyDescriptorArray = null;
+
+
+ /**
+ * Returns any actions that should be contributed to the popup menu
+ * for the given element.
+ * @param menu The menu to contribute actions to
+ * @param selection The window's current selection.
+ * @param shell Shell of viewer
+ * @param menuGroup recommended menu group to add actions to. If added to another group, you must be sure to create that group first.
+ */
+ public void addActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup)
+ {
+ if (!actionsCreated)
+ createActions();
+ //updateAction.setValue(null); // reset
+ menu.add(menuGroup, anotherConnectionAction);
+ menu.add(menuGroup, copyAction);
+ menu.add(menuGroup, moveAction);
+ menu.add(menuGroup, upAction);
+ menu.add(menuGroup, downAction);
+
+ // MJB: RE defect 40854
+ addConnectOrDisconnectAction(menu, menuGroup, selection);
+
+ menu.add(menuGroup, clearPasswordAction);
+
+ // yantzi: artemis 6.0, offline support, only add work offline action for system types that support offline mode
+ if (SystemPlugin.getDefault().getSystemTypeEnableOffline(((IHost)selection.getFirstElement()).getSystemType()))
+ {
+ menu.add(menuGroup, offlineAction);
+ }
+ }
+
+ private void addConnectOrDisconnectAction(SystemMenuManager menu, String menuGroup, IStructuredSelection selection)
+ {
+ IHost sysCon = (IHost) selection.getFirstElement();
+ ISystemRegistry sysReg = SystemPlugin.getTheSystemRegistry();
+ boolean anyConnected = sysReg.isAnySubSystemConnected(sysCon);
+ boolean allConnected = sysReg.areAllSubSystemsConnected(sysCon);
+ if (!allConnected) menu.add(menuGroup, connectAction);
+ if (anyConnected) menu.add(menuGroup, disconnectAction);
+ }
+
+ private void createActions()
+ {
+ anotherConnectionAction = new SystemNewConnectionFromExistingConnectionAction(null);
+ //updateAction = new SystemUpdateConnectionAction(null);
+ upAction = new SystemMoveUpConnectionAction(null);
+ downAction = new SystemMoveDownConnectionAction(null);
+ disconnectAction = new SystemDisconnectAllSubSystemsAction(null);
+ copyAction = new SystemCopyConnectionAction(null);
+ moveAction = new SystemMoveConnectionAction(null);
+ offlineAction = new SystemWorkOfflineAction(null);
+ connectAction = new SystemConnectAllSubSystemsAction(null);
+ clearPasswordAction = new SystemClearAllPasswordsAction(null);
+
+ actionsCreated = true;
+ }
+
+ /**
+ * Returns an image descriptor for the image. More efficient than getting the image.
+ * @param element The element for which an image is desired
+ */
+ public ImageDescriptor getImageDescriptor(Object element)
+ {
+ IHost conn = (IHost)element;
+ String systype = conn.getSystemType();
+ /* history is over! phil
+ if (systype.equals("OS/400")) // historical
+ {
+ systype = ISystemTypes.SYSTEMTYPE_ISERIES;
+ conn.setSystemType(systype);
+ try {
+ conn.getConnectionPool().save(conn);
+ } catch (Exception exc) {}
+ }
+ */
+ boolean anyConnected = SystemPlugin.getTheSystemRegistry().isAnySubSystemConnected(conn);
+ ImageDescriptor imageD = SystemPlugin.getDefault().getSystemTypeImage(systype, anyConnected);
+ return imageD;
+ }
+
+ /**
+ * Return the label for this object
+ */
+ public String getText(Object element)
+ {
+ IHost conn = (IHost)element;
+ boolean qualifyNames = SystemPlugin.getTheSystemRegistry().getQualifiedHostNames();
+ if (!qualifyNames)
+ return conn.getAliasName();
+ else
+ return conn.getSystemProfileName() + "." + conn.getAliasName();
+ }
+
+ /**
+ * Return the name of this object, which may be different than the display text ({#link #getText(Object)}.
+ *
+ * Called by common rename and delete actions.
+ */
+ public String getName(Object element)
+ {
+ IHost conn = (IHost)element;
+ return conn.getAliasName();
+ }
+
+ /**
+ * Return the absolute name, versus just display name, of this object
+ */
+ public String getAbsoluteName(Object element)
+ {
+ IHost conn = (IHost)element;
+ return conn.getSystemProfileName() + "." + conn.getAliasName();
+ }
+
+ /**
+ * Return the type label for this object
+ */
+ public String getType(Object element)
+ {
+ if (translatedType == null)
+ translatedType = SystemViewResources.RESID_PROPERTY_CONNECTION_TYPE_VALUE;
+ return translatedType;
+ }
+
+ /**
+ * Return the string to display in the status line when the given object is selected.
+ * We return:
+ * Connection: name - Host name: hostName - Description: description
+ */
+ public String getStatusLineText(Object element)
+ {
+ IHost conn = (IHost)element;
+ if (translatedHostname == null)
+ translatedHostname = SystemViewResources.RESID_PROPERTY_HOSTNAME_LABEL;
+ if (translatedDescription == null)
+ translatedDescription = SystemViewResources.RESID_PROPERTY_CONNDESCRIPTION_LABEL;
+ String statusText =
+ getType(element) + ": " + conn.getAliasName() + " - " +
+ translatedHostname + ": " + conn.getHostName();
+ String text = conn.getDescription();
+ if ((text==null) || (text.length()==0))
+ return statusText;
+ else
+ return statusText + " - " + translatedDescription + ": " + text;
+ }
+
+ /**
+ * Return the parent of this object
+ */
+ public Object getParent(Object element)
+ {
+ return SystemPlugin.getTheSystemRegistry();
+ }
+
+ /**
+ * Return the children of this object
+ */
+ public Object[] getChildren(Object element)
+ {
+ IHost conn = (IHost)element;
+ ISystemViewInputProvider input = getInput();
+ if (input != null)
+ {
+ Object[] children = input.getConnectionChildren(conn);
+ if (children != null)
+ {
+ Vector v = new Vector();
+ boolean someSkipped = false;
+ for (int idx=0; idx
+ * Form and return a new canonical (unique) name for this object, given a candidate for the new
+ * name. This is called by the generic multi-rename dialog to test that all new names are unique.
+ * To do this right, sometimes more than the raw name itself is required to do uniqueness checking.
+ *
+ * Returns profile.connectionName, upperCased
+ */
+ public String getCanonicalNewName(Object element, String newName)
+ {
+ IHost conn = (IHost)element;
+ return (conn.getSystemProfileName() + "." + newName).toUpperCase();
+ }
+
+
+ // FOR COMMON DRAG AND DROP ACTIONS
+ /**
+ * Indicates whether the connection can be dragged.
+ * Can't be used for physical copies but rather
+ * for views (like the Scratchpad)
+ */
+ public boolean canDrag(Object element)
+ {
+ return true;
+ }
+
+ /**
+ * Returns the connection (no phyiscal operation required to drag and subsystem (because it's local)
+ */
+ public Object doDrag(Object element, boolean sameSystemType, IProgressMonitor monitor)
+ {
+ return element;
+ }
+
+
+
+ // ------------------------------------------------------------
+ // METHODS FOR SAVING AND RESTORING EXPANSION STATE OF VIEWER...
+ // ------------------------------------------------------------
+ /**
+ * Return what to save to disk to identify this element in the persisted list of expanded elements.
+ * This just defaults to getName, but if that is not sufficient override it here.
+ */
+ public String getMementoHandle(Object element)
+ {
+ IHost conn = (IHost)element;
+ return conn.getSystemProfileName() + "." + conn.getAliasName();
+ }
+ /**
+ * Return a short string to uniquely identify the type of resource. Eg "conn" for connection.
+ * This just defaults to getType, but if that is not sufficient override it here, since that is
+ * a translated string.
+ */
+ public String getMementoHandleKey(Object element)
+ {
+ return ISystemMementoConstants.MEMENTO_KEY_CONNECTION;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewConnectionSelectionInputProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewConnectionSelectionInputProvider.java
new file mode 100644
index 00000000000..ac55c942ebb
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewConnectionSelectionInputProvider.java
@@ -0,0 +1,151 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.internal.model.SystemNewConnectionPromptObject;
+import org.eclipse.rse.model.IHost;
+
+
+/**
+ * This input provider for the System View is used when we want to merely present a
+ * list of existing connections for the user to select from, and optionally include
+ * the New Connection prompting connection.
+ * Form and return a new canonical (unique) name for this object, given a candidate for the new
+ * name. This is called by the generic multi-rename dialog to test that all new names are unique.
+ * To do this right, sometimes more than the raw name itself is required to do uniqueness checking.
+ *
+ * Returns mgrName.poolName.filterName, upperCased
+ */
+ public String getCanonicalNewName(Object element, String newName)
+ {
+ ISystemFilter filter = (ISystemFilter)element;
+ if (!filter.isTransient())
+ {
+ String mgrName = filter.getSystemFilterPoolManager().getName();
+ return (mgrName + "." + filter.getParentFilterPool().getName() + "." + newName).toUpperCase();
+ }
+ else
+ return newName.toUpperCase();
+ }
+
+ // FOR COMMON REFRESH ACTIONS
+ public boolean showRefresh(Object element)
+ {
+ return !getFilter(element).isTransient();
+ }
+
+ /**
+ * Return true if we should show the refresh action in the popup for the given element.
+ */
+ public boolean showOpenViewActions(Object element)
+ {
+ return !getFilter(element).isTransient();
+ }
+
+ /**
+ * Overide of parent method.
+ * Form and return a new canonical (unique) name for this object, given a candidate for the new
+ * name. This is called by the generic multi-rename dialog to test that all new names are unique.
+ * To do this right, sometimes more than the raw name itself is required to do uniqueness checking.
+ *
+ * Returns mgrName.poolName, upperCased
+ */
+ public String getCanonicalNewName(Object element, String newName)
+ {
+ String mgrName = ((ISystemFilterPool)element).getSystemFilterPoolManager().getName();
+ return (mgrName + "." + newName).toUpperCase();
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewFilterPoolReferenceAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewFilterPoolReferenceAdapter.java
new file mode 100644
index 00000000000..a58a8239ceb
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewFilterPoolReferenceAdapter.java
@@ -0,0 +1,366 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+import java.util.Vector;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
+import org.eclipse.rse.core.subsystems.SubSystemHelpers;
+import org.eclipse.rse.core.subsystems.util.ISubsystemConfigurationAdapter;
+import org.eclipse.rse.filters.ISystemFilterPool;
+import org.eclipse.rse.filters.ISystemFilterPoolManager;
+import org.eclipse.rse.filters.ISystemFilterPoolReference;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.SystemMenuManager;
+import org.eclipse.rse.ui.validators.ISystemValidator;
+import org.eclipse.rse.ui.validators.ValidatorFilterPoolName;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.PropertyDescriptor;
+
+
+/**
+ * Adapter for displaying SystemFilterPool reference objects in tree views.
+ * These are children of SubSystem objects
+ */
+public class SystemViewFilterPoolReferenceAdapter
+ extends AbstractSystemViewAdapter implements ISystemViewElementAdapter
+{
+ protected String translatedType;
+ //protected Object parent;
+
+ // for reset property support
+ //private String original_userId, original_port;
+ // -------------------
+ // property descriptors
+ // -------------------
+ private static PropertyDescriptor[] propertyDescriptorArray = null;
+
+ /**
+ * Returns any actions that should be contributed to the popup menu
+ * for the given subsystem object.
+ * Calls the method getActions on the subsystem's factory, and places
+ * all action objects returned from the call, into the menu.
+ * @param menu The menu to contribute actions to
+ * @param selection The window's current selection.
+ * @param shell Shell of viewer
+ * @param menuGroup recommended menu group to add actions to. If added to another group, you must be sure to create that group first.
+ */
+ public void addActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup)
+ {
+ //if (selection.size() != 1)
+ // return; // does not make sense adding unique actions per multi-selection
+ Object element = selection.getFirstElement();
+ ISystemFilterPool pool = getFilterPool(element);
+ ISubSystemConfiguration ssFactory = getSubSystemFactory(pool);
+ ISubsystemConfigurationAdapter adapter = (ISubsystemConfigurationAdapter)ssFactory.getAdapter(ISubsystemConfigurationAdapter.class);
+
+ IAction[] actions = adapter.getFilterPoolActions(ssFactory, pool, shell);
+ if (actions != null)
+ {
+ for (int idx=0; idx
+ * Called by common rename and delete actions.
+ */
+ public String getName(Object element)
+ {
+ return getFilterPool(element).getName();
+ }
+ /**
+ * Return the absolute name, versus just display name, of this object
+ */
+ public String getAbsoluteName(Object element)
+ {
+ ISystemFilterPoolReference filterPoolRef = (ISystemFilterPoolReference)element;
+ return filterPoolRef.getReferencedFilterPool().getSystemFilterPoolManager().getName() + "." + filterPoolRef.getName();
+ }
+ /**
+ * Return the type label for this object
+ */
+ public String getType(Object element)
+ {
+ if (translatedType == null)
+ translatedType = SystemViewResources.RESID_PROPERTY_FILTERPOOLREFERENCE_TYPE_VALUE;
+ return translatedType;
+ }
+
+ /**
+ * Return the parent of this object
+ */
+ public Object getParent(Object element)
+ {
+ ISystemFilterPoolReference fpr = getFilterPoolReference(element);
+ return SubSystemHelpers.getParentSubSystem(fpr);
+ }
+
+ /**
+ * Return the children of this object.
+ * For filter pools, this is a list of filters.
+ */
+ public Object[] getChildren(Object element)
+ {
+ ISystemFilterPoolReference fpRef = getFilterPoolReference(element);
+ ISubSystem ss = getSubSystem(element);
+ return fpRef.getSystemFilterReferences(ss);
+ }
+
+ /**
+ * Return true if this object has children
+ */
+ public boolean hasChildren(Object element)
+ {
+ ISystemFilterPoolReference fpRef = getFilterPoolReference(element);
+ return (fpRef.getReferencedFilterPool().getSystemFilterCount() > 0);
+ }
+
+ // Property sheet descriptors defining all the properties we expose in the Property Sheet
+ /**
+ * Return our unique property descriptors
+ */
+ protected IPropertyDescriptor[] internalGetPropertyDescriptors()
+ {
+ if (propertyDescriptorArray == null)
+ {
+ propertyDescriptorArray = new PropertyDescriptor[3];
+ int idx = 0;
+
+ // parent filter pool
+ propertyDescriptorArray[idx] = createSimplePropertyDescriptor(P_PARENT_FILTERPOOL, SystemViewResources.RESID_PROPERTY_FILTERPOOLREFERENCE_PARENTPOOL_LABEL, SystemViewResources.RESID_PROPERTY_FILTERPOOLREFERENCE_PARENTPOOL_TOOLTIP);
+
+ // parent filter pool's profile
+ propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(P_PROFILE, SystemViewResources.RESID_PROPERTY_FILTERPOOLREFERENCE_PARENTPROFILE_LABEL, SystemViewResources.RESID_PROPERTY_FILTERPOOLREFERENCE_PARENTPROFILE_TOOLTIP);
+
+ // Related connection
+ propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(P_RELATED_CONNECTION, SystemViewResources.RESID_PROPERTY_FILTERPOOLREFERENCE_RELATEDCONNECTION_LABEL, SystemViewResources.RESID_PROPERTY_FILTERPOOLREFERENCE_RELATEDCONNECTION_TOOLTIP);
+ }
+ return propertyDescriptorArray;
+ }
+ /**
+ * Return our unique property values
+ */
+ protected Object internalGetPropertyValue(Object key)
+ {
+ String name = (String)key;
+ //SystemFilterPoolReference ref = getFilterPoolReference(propertySourceInput);
+ ISystemFilterPool pool = getFilterPool(propertySourceInput);
+ if (name.equals(ISystemPropertyConstants.P_PARENT_FILTERPOOL))
+ return pool.getName();
+ else if (name.equals(ISystemPropertyConstants.P_PROFILE))
+ return pool.getSystemFilterPoolManager().getName();
+ else if (name.equals(ISystemPropertyConstants.P_RELATED_CONNECTION))
+ return (pool.getOwningParentName()==null) ? getTranslatedNotApplicable() : pool.getOwningParentName();
+ else
+ return null;
+ }
+
+ // FOR COMMON DELETE ACTIONS
+ /**
+ * Return true if this object is deletable by the user. If so, when selected,
+ * the Edit->Delete menu item will be enabled.
+ */
+ public boolean canDelete(Object element)
+ {
+ ISystemFilterPool fp = getFilterPool(element);
+ return fp.isDeletable();
+ }
+
+ /**
+ * Perform the delete action.
+ * This physically deletes the filter pool and all references.
+ */
+ public boolean doDelete(Shell shell, Object element, IProgressMonitor monitor) throws Exception
+ {
+ ISystemFilterPoolReference fpr = getFilterPoolReference(element);
+ ISystemFilterPool fp = getFilterPool(element);
+ ISystemFilterPoolManager fpMgr = fp.getSystemFilterPoolManager();
+ fpMgr.deleteSystemFilterPool(fp);
+ //SubSystemFactory ssParentFactory = getSubSystemFactory(fp);
+ //ssParentFactory.deleteFilterPool(fp);
+ return true;
+ }
+
+ // FOR COMMON RENAME ACTIONS
+ /**
+ * Return true if this object is renamable by the user. If so, when selected,
+ * the Rename menu item will be enabled.
+ */
+ public boolean canRename(Object element)
+ {
+ if (!canDelete(element))
+ return false;
+ ISystemFilterPool fp = getFilterPool(element);
+ return !fp.isNonRenamable();
+ }
+
+ /**
+ * Perform the rename action. Assumes uniqueness checking was done already.
+ */
+ public boolean doRename(Shell shell, Object element, String name) throws Exception
+ {
+ ISystemFilterPool fp = getFilterPool(element);
+ ISystemFilterPoolManager fpMgr = fp.getSystemFilterPoolManager();
+ fpMgr.renameSystemFilterPool(fp,name);
+ //SubSystemFactory ssParentFactory = getSubSystemFactory(fp);
+ //ssParentFactory.renameFilterPool(fp,name);
+ return true;
+ }
+ /**
+ * Return a validator for verifying the new name is correct.
+ */
+ public ISystemValidator getNameValidator(Object element)
+ {
+ ISystemFilterPool fp = null;
+ if (element instanceof ISystemFilterPoolReference)
+ fp = getFilterPool(element);
+ else
+ fp = (ISystemFilterPool)element;
+ ISystemFilterPoolManager mgr = fp.getSystemFilterPoolManager();
+ Vector v = mgr.getSystemFilterPoolNamesVector();
+ /*
+ if (fp != null) // might be called by the New wizard vs rename action
+ v.removeElement(fp.getName());
+ */
+ ISystemValidator nameValidator = new ValidatorFilterPoolName(v);
+ return nameValidator;
+ }
+ /**
+ * Parent override.
+ *
+ * Form and return a new canonical (unique) name for this object, given a candidate for the new
+ * name. This is called by the generic multi-rename dialog to test that all new names are unique.
+ * To do this right, sometimes more than the raw name itself is required to do uniqueness checking.
+ *
+ * Returns mgrName.poolName, upperCased
+ */
+ public String getCanonicalNewName(Object element, String newName)
+ {
+ String mgrName = ((ISystemFilterPoolReference)element).getReferencedFilterPoolManagerName();
+ return (mgrName + "." + newName).toUpperCase();
+ }
+
+ // ------------------------------------------------------------
+ // METHODS FOR SAVING AND RESTORING EXPANSION STATE OF VIEWER...
+ // ------------------------------------------------------------
+
+ /**
+ * Return what to save to disk to identify this element in the persisted list of expanded elements.
+ * This just defaults to getName, but if that is not sufficient override it here.
+ */
+ public String getMementoHandle(Object element)
+ {
+ ISystemFilterPoolReference fpRef = (ISystemFilterPoolReference)element;
+ return fpRef.getFullName();
+ }
+ /**
+ * Return what to save to disk to identify this element when it is the input object to a secondary
+ * Remote Systems Explorer perspective.
+ */
+ public String getInputMementoHandle(Object element)
+ {
+ Object parent = getParent(element);
+ return getAdapter(parent).getInputMementoHandle(parent) + MEMENTO_DELIM + getMementoHandle(element);
+ }
+ /**
+ * Return a short string to uniquely identify the type of resource. Eg "conn" for connection.
+ * This just defaults to getType, but if that is not sufficient override it here, since that is
+ * a translated string.
+ */
+ public String getMementoHandleKey(Object element)
+ {
+ return ISystemMementoConstants.MEMENTO_KEY_FILTERPOOLREFERENCE;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewFilterReferenceAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewFilterReferenceAdapter.java
new file mode 100644
index 00000000000..529ba8e286b
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewFilterReferenceAdapter.java
@@ -0,0 +1,960 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+
+import java.util.Vector;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.rse.core.SystemBasePlugin;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.SystemPreferencesManager;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
+import org.eclipse.rse.core.subsystems.SubSystemHelpers;
+import org.eclipse.rse.core.subsystems.util.ISubsystemConfigurationAdapter;
+import org.eclipse.rse.filters.ISystemFilter;
+import org.eclipse.rse.filters.ISystemFilterContainerReference;
+import org.eclipse.rse.filters.ISystemFilterPool;
+import org.eclipse.rse.filters.ISystemFilterPoolManager;
+import org.eclipse.rse.filters.ISystemFilterPoolReference;
+import org.eclipse.rse.filters.ISystemFilterReference;
+import org.eclipse.rse.model.IHost;
+import org.eclipse.rse.model.ISystemMessageObject;
+import org.eclipse.rse.model.ISystemRegistry;
+import org.eclipse.rse.model.ISystemResourceChangeEvents;
+import org.eclipse.rse.model.ISystemResourceChangeListener;
+import org.eclipse.rse.model.ISystemResourceSet;
+import org.eclipse.rse.model.SystemChildrenContentsType;
+import org.eclipse.rse.model.SystemMessageObject;
+import org.eclipse.rse.model.SystemRemoteResourceSet;
+import org.eclipse.rse.model.SystemResourceChangeEvent;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.SystemMenuManager;
+import org.eclipse.rse.ui.validators.ISystemValidator;
+import org.eclipse.rse.ui.validators.ValidatorFilterName;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.PropertyDescriptor;
+
+
+/**
+ * Adapter for displaying SystemFilterReference objects in tree views.
+ * These are children of SystemFilterPoolReference and SystemFilterReference objects
+ */
+public class SystemViewFilterReferenceAdapter
+ extends AbstractSystemViewAdapter
+ implements ISystemViewElementAdapter, ISystemMessages
+{
+ //private static String translatedFilterString = null;
+ // -------------------
+ // property descriptors
+ // -------------------
+ private static PropertyDescriptor[] propertyDescriptorArray = null;
+ //private SystemComboBoxPropertyDescriptor filterStringsDescriptor, filtersDescriptor;
+
+ /**
+ * Returns any actions that should be contributed to the popup menu
+ * for the given filter object.
+ * @param menu The menu to contribute actions to
+ * @param selection The window's current selection.
+ * @param shell Shell of viewer
+ * @param menuGroup recommended menu group to add actions to. If added to another group, you must be sure to create that group first.
+ */
+ public void addActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup)
+ {
+ //if (selection.size() != 1)
+ // return; // does not make sense adding unique actions per multi-selection
+ ISystemFilter filter = getFilter(selection.getFirstElement());
+ ISubSystemConfiguration ssFactory = getSubSystemFactory(filter);
+ ISubSystem currentSubSystem = (ISubSystem) getFilterReference(selection.getFirstElement()).getSubSystem();
+ IHost currentConnection = currentSubSystem.getHost();
+ ssFactory.setConnection(currentConnection);
+ ssFactory.setCurrentSelection(selection.toArray());
+ ISubsystemConfigurationAdapter adapter = (ISubsystemConfigurationAdapter)ssFactory.getAdapter(ISubsystemConfigurationAdapter.class);
+
+ IAction[] actions = adapter.getFilterActions(ssFactory, filter, shell);
+ if (actions != null)
+ {
+ for (int idx = 0; idx < actions.length; idx++)
+ {
+ IAction action = actions[idx];
+ menu.add(menuGroup, action);
+ }
+ }
+ actions = adapter.getFilterReferenceActions(ssFactory, getFilterReference(selection.getFirstElement()), shell);
+ if (actions != null)
+ {
+ for (int idx = 0; idx < actions.length; idx++)
+ {
+ IAction action = actions[idx];
+ menu.add(menuGroup, action);
+ }
+ }
+ }
+
+ private ISubSystemConfiguration getSubSystemFactory(ISystemFilter filter)
+ {
+ return SubSystemHelpers.getParentSubSystemFactory(filter);
+ }
+ /**
+ * Overridden from parent.
+ * Called by common rename and delete actions.
+ */
+ public String getName(Object element)
+ {
+ return getFilter(element).getName();
+ }
+ /**
+ * Return the absolute name, versus just display name, of this object
+ */
+ public String getAbsoluteName(Object element)
+ {
+ ISystemFilter filter = getFilter(element);
+ return filter.getSystemFilterPoolManager().getName() + "." + filter.getParentFilterPool().getName() + "." + filter.getName();
+ }
+
+ /**
+ * Return the type label for this object
+ */
+ public String getType(Object element)
+ {
+ ISystemFilter filter = getFilter(element);
+ ISubSystemConfiguration ssParentFactory = getSubSystemFactory(filter);
+ return ssParentFactory.getTranslatedFilterTypeProperty(filter);
+ }
+
+ /**
+ * Return the parent of this object
+ */
+ public Object getParent(Object element)
+ {
+ ISystemFilterReference fr = getFilterReference(element);
+ ISystemFilterContainerReference parentContainer = fr.getParent();
+ // if parent is a filter (eg, we are nested) that is always the parent...
+ if (parentContainer instanceof ISystemFilterReference)
+ return parentContainer;
+ // else parent is a filter pool. The parent will be the pool only if
+ // we are in "Show Filter Pools" mode, else it is the subsystem.
+ boolean showFPs = SystemPreferencesManager.getPreferencesManager().getShowFilterPools();
+ if (showFPs)
+ return parentContainer;
+ else
+ return (ISubSystem) fr.getProvider();
+ //return fr.getParent();
+ }
+
+ /**
+ * Return the children of this object.
+ * For filters, this is one or more of:
+ *
+ * Default is false unless this is a prompting filter
+ */
+ public boolean isPromptable(Object element)
+ {
+ boolean promptable = false;
+ ISystemFilter filter = getFilter(element);
+ promptable = filter.isPromptable();
+ //if (!promptable && !SystemPreferencesManager.getPreferencesManager().getShowFilterStrings())
+ if (!promptable)
+ {
+ //if (isCommandFilter(filter) || isJobFilter(filter))
+ if (isCommandFilter(filter))
+ promptable = true;
+ }
+ return promptable;
+ }
+
+ /**
+ * Overide of parent method.
+ * Returns mgrName.poolName.filterName, upperCased
+ */
+ public String getCanonicalNewName(Object element, String newName)
+ {
+ ISystemFilterReference fRef = (ISystemFilterReference) element;
+ ISystemFilter filter = fRef.getReferencedFilter();
+ String mgrName = filter.getSystemFilterPoolManager().getName();
+ return (mgrName + "." + filter.getParentFilterPool().getName() + "." + newName).toUpperCase();
+ }
+
+ /**
+ * Don't show "Open in new perspective" if this is promptable
+ */
+ public boolean showOpenViewActions(Object element)
+ {
+ ISystemFilter filter = getFilter(element);
+ return !filter.isPromptable();
+ }
+
+
+ /**
+ * Don't show generic "Show in Table" if the factory asks not to
+ */
+ public boolean showGenericShowInTableAction(Object element)
+ {
+ ISystemFilter filter = getFilter(element);
+ ISubSystemConfiguration ssParentFactory = getSubSystemFactory(filter);
+ return ssParentFactory.showGenericShowInTableOnFilter();
+ }
+
+ /**
+ * Return true if we should show the refresh action in the popup for the element.
+ */
+ public boolean showRefresh(Object element)
+ {
+ ISystemFilter filter = getFilter(element);
+ ISubSystemConfiguration ssParentFactory = getSubSystemFactory(filter);
+ return ssParentFactory.showRefreshOnFilter();
+ }
+
+ // ------------------------------------------------------------
+ // METHODS FOR SAVING AND RESTORING EXPANSION STATE OF VIEWER...
+ // ------------------------------------------------------------
+
+ /**
+ * Return what to save to disk to identify this element in the persisted list of expanded elements.
+ * This just defaults to getName, but if that is not sufficient override it here.
+ */
+ public String getMementoHandle(Object element)
+ {
+ ISystemFilterReference fRef = getFilterReference(element);
+ ISystemFilter referencedFilter = fRef.getReferencedFilter();
+ ISystemFilterPool pool = referencedFilter.getParentFilterPool();
+ String handle = pool.getReferenceName() + "=";
+ ISystemFilter parentFilter = referencedFilter.getParentFilter();
+ while (parentFilter != null)
+ {
+ handle += parentFilter.getName() + ";";
+ parentFilter = parentFilter.getParentFilter();
+ }
+ handle += referencedFilter.getName();
+ return handle;
+ }
+ /**
+ * Return what to save to disk to identify this element when it is the input object to a secondary
+ * Remote Systems Explorer perspective.
+ */
+ public String getInputMementoHandle(Object element)
+ {
+ Object parent = ((ISystemFilterReference) element).getParent(); //getParent(element); // will be filter (nested) or filter pool
+ ISystemViewElementAdapter parentAdapter = getAdapter(parent);
+ boolean showFPs = SystemPreferencesManager.getPreferencesManager().getShowFilterPools();
+ if (parent instanceof ISystemFilterPoolReference) // not a nested filter
+ {
+ if (!showFPs) // not showing the real parent in GUI?
+ {
+ parent = parentAdapter.getParent(parent); // get the subsystem parent of the filter pool reference
+ parentAdapter = getAdapter(parent); // get the adapter for the subsystem parent
+ }
+ }
+ return parentAdapter.getInputMementoHandle(parent) + MEMENTO_DELIM + getMementoHandle(element);
+ }
+
+ /**
+ * Return a short string to uniquely identify the type of resource. Eg "conn" for connection.
+ * This just defaults to getType, but if that is not sufficient override it here, since that is
+ * a translated string.
+ */
+ public String getMementoHandleKey(Object element)
+ {
+ return ISystemMementoConstants.MEMENTO_KEY_FILTERREFERENCE;
+ }
+
+ /**
+ * Somtimes we don't want to remember an element's expansion state, such as for temporarily inserted
+ * messages. In these cases return false from this method. The default is true.
+ *
+ * WE RETURN FALSE IF THIS IS A PROMPTABLE FILTER, COMMAND FILTER OR JOB FILTER.
+ */
+ public boolean saveExpansionState(Object element)
+ {
+ boolean savable = true;
+ ISystemFilterReference fRef = getFilterReference(element);
+ ISystemFilter referencedFilter = fRef.getReferencedFilter();
+ boolean promptable = referencedFilter.isPromptable();
+ if (promptable)
+ savable = false;
+ else
+ {
+ // I thought the types would be set for these filters, but it isn't! Phil.
+ /*
+ String type = referencedFilter.getType();
+ if ((type!=null) && (type.equals("Command") || type.equals("Job")))
+ savable = false;
+ */
+ if (isCommandFilter(referencedFilter))
+ savable = false;
+ }
+ return savable;
+ }
+
+ /**
+ * Return true if the given filter is from a command subsystem
+ */
+ public static boolean isCommandFilter(ISystemFilter filter)
+ {
+ ISubSystemConfiguration ssf = (ISubSystemConfiguration) filter.getProvider();
+ /** TODO - this was originally for iseries..but
+ * with new model, another approach should be used (maybe via factory api)
+ if ((ssf != null) && (ssf instanceof IRemoteCmdSubSystemFactory))
+ return true;
+ else
+ **/
+ return false;
+ }
+
+
+ // ------------------------------------------
+ // METHODS TO SUPPORT COMMON DRAG AND DROP FUNCTION...
+ // ------------------------------------------
+ /**
+ * drag support is handled directly for filter references, rather than delegated here.
+ */
+ public boolean canDrag(Object element)
+ {
+ ISystemFilterReference fRef = getFilterReference(element);
+ if (fRef != null)
+ {
+ if (getSubSystemFactory(fRef.getReferencedFilter()).supportsFilterStringExport())
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Can this object be added as part of the filter?
+ */
+ public boolean canDrop(Object element)
+ {
+ ISystemFilterReference fRef = getFilterReference(element);
+ if (fRef != null)
+ {
+ ISubSystemConfiguration factory = getSubSystemFactory(fRef.getReferencedFilter());
+ if (factory.supportsDropInFilters())
+ {
+ // if the drop is handled by the subsystem rather than this adapter, this will be true.
+ if (factory.providesCustomDropInFilters())
+ {
+ return true;
+ }
+
+ if (!fRef.getReferencedFilter().isNonChangable())
+ {
+ if (factory.supportsMultiStringFilters())
+ {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ public ISystemResourceSet doDrag(SystemRemoteResourceSet set, IProgressMonitor monitor)
+ {
+ return set;
+ }
+
+ /**
+ * drag support is handled directory for filter references, rather than delegated here.
+ */
+ public Object doDrag(Object element, boolean sameSystemType, IProgressMonitor monitor)
+ {
+ return element;
+ }
+
+ /**
+ * Add the absolute name of the from object to the list of filter strings for this filter
+ */
+ public Object doDrop(Object from, Object to, boolean sameSystemType, boolean sameSystem, int srcType, IProgressMonitor monitor)
+ {
+ if (sameSystemType)
+ {
+ ISystemFilterReference fRef = getFilterReference(to);
+ ISystemFilter filter = fRef.getReferencedFilter();
+
+ if (from instanceof ISystemFilterReference)
+ {
+ ISystemFilter srcFilter = ((ISystemFilterReference) from).getReferencedFilter();
+ String[] filterStrings = srcFilter.getFilterStrings();
+ for (int i = 0; i < filterStrings.length; i++)
+ {
+ filter.addFilterString(filterStrings[i]);
+ }
+ return fRef;
+ }
+ else if (from instanceof IAdaptable)
+ {
+ ISystemRemoteElementAdapter radapter = (ISystemRemoteElementAdapter) ((IAdaptable) from).getAdapter(ISystemRemoteElementAdapter.class);
+
+ {
+
+ String newFilterStr = radapter.getFilterStringFor(from);
+ if (newFilterStr != null)
+ {
+ filter.addFilterString(newFilterStr);
+ return fRef;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Validate that the source and target for the drag and drop operation are
+ * compatable.
+ */
+ public boolean validateDrop(Object src, Object target, boolean sameSystem)
+ {
+ if (!sameSystem)
+ {
+ if (src instanceof IResource)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ if (target instanceof ISystemFilterReference)
+ {
+ ISystemFilterReference filterRef = (ISystemFilterReference) target;
+ if (getSubSystemFactory(filterRef.getReferencedFilter()).supportsMultiStringFilters())
+ {
+ if (src instanceof ISystemFilterReference)
+ {
+ // yantzi: wswb2.1.2 (defect 50994) add check for filter types
+ String srcType = ((ISystemFilterReference)src).getReferencedFilter().getType();
+ String targetType = filterRef.getReferencedFilter().getType();
+ if (targetType != null && srcType != null)
+ {
+ if (targetType.equals(srcType))
+ {
+ return true;
+ }
+ }
+ else
+ {
+ return true;
+ }
+ }
+ // check if src has a filter string
+ else if (src instanceof IAdaptable)
+ {
+ ISystemRemoteElementAdapter adapter = (ISystemRemoteElementAdapter) ((IAdaptable) src).getAdapter(ISystemRemoteElementAdapter.class);
+ if (adapter != null)
+ {
+ if (adapter.getFilterStringFor(src) != null)
+ {
+ return true;
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+
+ /*
+ * Return whether deferred queries are supported.
+ */
+ public boolean supportsDeferredQueries()
+ {
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewFilterStringAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewFilterStringAdapter.java
new file mode 100644
index 00000000000..47bf8ef9919
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewFilterStringAdapter.java
@@ -0,0 +1,285 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+import java.util.Vector;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.subsystems.util.ISubsystemConfigurationAdapter;
+import org.eclipse.rse.filters.ISystemFilter;
+import org.eclipse.rse.filters.ISystemFilterPool;
+import org.eclipse.rse.filters.ISystemFilterPoolManager;
+import org.eclipse.rse.filters.ISystemFilterString;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.SystemMenuManager;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.PropertyDescriptor;
+
+
+/**
+ * Default Adapter for displaying filter string objects in tree views.
+ */
+public class SystemViewFilterStringAdapter extends AbstractSystemViewAdapter implements ISystemViewElementAdapter, ISystemMessages
+{
+ //private static String translatedFilterString = null;
+ // -------------------
+ // property descriptors
+ // -------------------
+ private static PropertyDescriptor[] propertyDescriptorArray = null;
+
+ /**
+ * Returns any actions that should be contributed to the popup menu
+ * for the given filter object.
+ * @param menu The menu to contribute actions to
+ * @param selection The window's current selection.
+ * @param shell Shell of viewer
+ * @param menuGroup recommended menu group to add actions to. If added to another group, you must be sure to create that group first.
+ */
+ public void addActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup)
+ {
+ //if (selection.size() != 1)
+ // return; // does not make sense adding unique actions per multi-selection
+ ISystemFilterString filterString = getFilterString(selection.getFirstElement());
+ if (filterString.getParentSystemFilter().isTransient())
+ return;
+ /*
+ SubSystemFactory ssFactory = SubSystemHelpers.getParentSubSystemFactory(filterString);
+ ssFactory.setConnection(null);
+ IAction[] actions = ssFactory.getFilterActions(filter, shell);
+ if (actions != null)
+ {
+ for (int idx=0; idx
+ * The getParent() method in the adapter is very unreliable... adapters can't be sure
+ * of the context which can change via filtering and view options.
+ */
+ public Object getSelectedParent()
+ {
+ return tree.getSelectedParent();
+ }
+ /**
+ * This returns the element immediately before the first selected element in this tree level.
+ * Often needed for enablement decisions for move up actions.
+ */
+ public Object getPreviousElement()
+ {
+ return tree.getPreviousElement();
+ }
+ /**
+ * This returns the element immediately after the last selected element in this tree level
+ * Often needed for enablement decisions for move down actions.
+ */
+ public Object getNextElement()
+ {
+ return tree.getNextElement();
+ }
+
+ /**
+ * This is called to walk the tree back up to the roots and return the visible root
+ * node for the first selected object.
+ */
+ public Object getRootParent()
+ {
+ return tree.getRootParent();
+ }
+ /**
+ * This returns an array containing each element in the tree, up to but not including the root.
+ * The array is in reverse order, starting at the leaf and going up.
+ */
+ public Object[] getElementNodes(Object element)
+ {
+ return tree.getElementNodes(element);
+ }
+ /**
+ * Helper method to determine if a given object is currently selected.
+ * Does consider if a child node of the given object is currently selected.
+ */
+ public boolean isSelectedOrChildSelected(Object parentElement)
+ {
+ return tree.isSelectedOrChildSelected(parentElement);
+ }
+
+ /**
+ * Return the number of immediate children in the tree, for the given tree node
+ */
+ public int getChildCount(Object element)
+ {
+ return tree.getChildCount(element);
+ }
+
+ /**
+ * Called when a property is updated and we need to inform the Property Sheet viewer.
+ * There is no formal mechanism for this so we simulate a selection changed event as
+ * this is the only event the property sheet listens for.
+ */
+ public void updatePropertySheet()
+ {
+ tree.updatePropertySheet();
+ }
+
+ /**
+ * Called to select an object within the tree, and optionally expand it
+ */
+ public void select(Object element, boolean expand)
+ {
+ tree.select(element, expand);
+ }
+
+ /**
+ * Returns the tree item of the first selected object. Used for setViewerItem in a resource
+ * change event.
+ */
+ public Item getViewerItem()
+ {
+ return tree.getViewerItem();
+ }
+
+ /**
+ * Returns true if it is ok to close the dialog or wizard page. Returns false if there
+ * is a remote request currently in progress.
+ */
+ public boolean okToClose()
+ {
+ return !requestInProgress; //d43433
+ }
+
+ // -----------------------
+ // INTERNAL-USE METHODS...
+ // -----------------------
+ /**
+ * Prepares this composite control and sets the default layout data.
+ * @param Number of columns the new group will contain.
+ */
+ protected Composite prepareComposite(int numColumns,
+ int horizontalSpan, int verticalSpan)
+ {
+ Composite composite = this;
+ //GridLayout
+ GridLayout layout = new GridLayout();
+ layout.numColumns = numColumns;
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ layout.horizontalSpacing = 0;
+ layout.verticalSpacing = 0;
+ composite.setLayout(layout);
+ //GridData
+ GridData data = new GridData();
+ data.verticalAlignment = GridData.FILL;
+ data.horizontalAlignment = GridData.FILL;
+ data.grabExcessHorizontalSpace = true;
+ data.grabExcessVerticalSpace = true;
+ data.widthHint = DEFAULT_WIDTH;
+ data.heightHint = DEFAULT_HEIGHT;
+ data.horizontalSpan = horizontalSpan;
+ data.verticalSpan = verticalSpan;
+ composite.setLayoutData(data);
+ return composite;
+ }
+
+ protected void createSystemView(Shell shell, ISystemViewInputProvider inputProvider, boolean singleSelectionMode)
+ {
+ // TREE
+ int style = (singleSelectionMode ? SWT.SINGLE : SWT.MULTI) | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER;
+ tree = new SystemView(shell, this, style, deferLoading ? emptyProvider : inputProvider, msgLine, initViewerFilters);
+ GridData treeData = new GridData();
+ treeData.horizontalAlignment = GridData.FILL;
+ treeData.verticalAlignment = GridData.FILL;
+ treeData.grabExcessHorizontalSpace = true;
+ treeData.grabExcessVerticalSpace = true;
+ treeData.widthHint = 300;
+ treeData.heightHint= 200;
+ tree.getTree().setLayoutData(treeData);
+ tree.setShowActions(showActions);
+ }
+
+ protected void createToolBar(Shell shell)
+ {
+ toolbar = new ToolBar(this, SWT.FLAT | SWT.WRAP);
+ toolbarMgr = new ToolBarManager(toolbar);
+ }
+
+ protected void populateToolBar(Shell shell)
+ {
+ SystemNewConnectionAction newConnAction = new SystemNewConnectionAction(shell, false, tree); // false implies not from popup menu
+ toolbarMgr.add(newConnAction);
+ SystemCascadingPulldownMenuAction submenuAction = new SystemCascadingPulldownMenuAction(shell, tree);
+ toolbarMgr.add(submenuAction);
+ toolbarMgr.update(false);
+ }
+
+ protected void createButtonBar(Composite parentComposite, int nbrButtons)
+ {
+ // Button composite
+ Composite composite_buttons = SystemWidgetHelpers.createTightComposite(parentComposite, nbrButtons);
+ getListButton = SystemWidgetHelpers.createPushButton(composite_buttons, null, SystemResources.ACTION_VIEWFORM_GETLIST_LABEL, SystemResources.ACTION_VIEWFORM_GETLIST_TOOLTIP);
+ refreshButton = SystemWidgetHelpers.createPushButton(composite_buttons, null, SystemResources.ACTION_VIEWFORM_REFRESH_LABEL, SystemResources.ACTION_VIEWFORM_REFRESH_TOOLTIP);
+ }
+
+
+ protected void addOurSelectionListener()
+ {
+ // Add the button listener
+ SelectionListener selectionListener = new SelectionListener()
+ {
+ public void widgetDefaultSelected(SelectionEvent event)
+ {
+ };
+ public void widgetSelected(SelectionEvent event)
+ {
+ Object src = event.getSource();
+ if (src==getListButton)
+ processGetListButton();
+ else if (src==refreshButton)
+ processRefreshButton();
+ };
+ };
+ if (getListButton != null)
+ getListButton.addSelectionListener(selectionListener);
+ if (refreshButton != null)
+ refreshButton.addSelectionListener(selectionListener);
+
+ }
+ protected void addOurMouseListener()
+ {
+ MouseListener mouseListener = new MouseAdapter()
+ {
+ public void mouseDown(MouseEvent e)
+ {
+ //requestActivation();
+ }
+ };
+ toolbar.addMouseListener(mouseListener);
+ }
+
+ /**
+ * Process the refresh button.
+ */
+ protected void processRefreshButton()
+ {
+ refreshButton.setEnabled(false);
+ getListButton.setEnabled(false);
+ requestInProgress = true;
+ fireRequestStartEvent();
+
+ refresh();
+
+ fireRequestStopEvent();
+ requestInProgress = false;
+ enableButtonBarButtons(true);
+ }
+
+ /**
+ * Process the getList button.
+ */
+ protected void processGetListButton()
+ {
+ refreshButton.setEnabled(false);
+ getListButton.setEnabled(false);
+ requestInProgress = true;
+ fireRequestStartEvent();
+
+ tree.setInputProvider(inputProvider);
+
+ fireRequestStopEvent();
+ requestInProgress = false;
+ enableButtonBarButtons(true);
+ }
+
+ /**
+ * Enable/Disable refresh and getList buttons.
+ * Note that these are mutually exclusive
+ */
+ protected void enableButtonBarButtons(boolean enableRefresh)
+ {
+ if (refreshButton != null)
+ refreshButton.setEnabled(enableRefresh);
+ if (getListButton != null)
+ getListButton.setEnabled(!enableRefresh);
+ }
+
+ /**
+ * Fire long running request listener event
+ */
+ protected void fireRequestStartEvent()
+ {
+ if (requestListeners != null)
+ {
+ SystemLongRunningRequestEvent event = new SystemLongRunningRequestEvent();
+ for (int idx=0; idx
+ * The objects must all implement com.ibm.etools.systems.model.ISystemExpandablePromptableObject
+ * to use this adapter.
+ */
+public class SystemViewMessageAdapter
+ extends AbstractSystemViewAdapter implements ISystemViewElementAdapter
+{
+
+ /**
+ * Add actions to context menu.
+ * We don't add any for message objects, at this point.
+ */
+ public void addActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup)
+ {
+ }
+
+ /**
+ * Returns an image descriptor for the image. More efficient than getting the image.
+ * @param element The element for which an image is desired
+ */
+ public ImageDescriptor getImageDescriptor(Object element)
+ {
+ ISystemMessageObject msg = (ISystemMessageObject)element;
+ int type = msg.getType();
+ if (type==ISystemMessageObject.MSGTYPE_ERROR)
+ return SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_ERROR_ID);
+ else if (type==ISystemMessageObject.MSGTYPE_CANCEL)
+ return SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_INFO_TREE_ID);
+ // DY: icon vetoed by UCD
+ // return SystemPlugin.getDefault().getImageDescriptor(ISystemConstants.ICON_SYSTEM_CANCEL_ID);
+ else if (type==ISystemMessageObject.MSGTYPE_EMPTY)
+ return SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_EMPTY_ID);
+ else if (type==ISystemMessageObject.MSGTYPE_OBJECTCREATED)
+ return SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_OK_ID);
+ else
+ return SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_INFO_TREE_ID);
+ }
+
+ /**
+ * Return the label for this object. Uses getMessage() on the given ISystemMessageObject object.
+ */
+ public String getText(Object element)
+ {
+ ISystemMessageObject msg = (ISystemMessageObject)element;
+ return msg.getMessage();
+ }
+ /**
+ * Return the absolute name, versus just display name, of this object.
+ * Just uses getText(element);
+ */
+ public String getAbsoluteName(Object element)
+ {
+ return getText(element);
+ }
+ /**
+ * Return the type label for this object
+ */
+ public String getType(Object element)
+ {
+ return SystemViewResources.RESID_PROPERTY_MESSAGE_TYPE_VALUE;
+ }
+
+ /**
+ * Return the parent of this object.
+ */
+ public Object getParent(Object element)
+ {
+ ISystemMessageObject msg = (ISystemMessageObject)element;
+ return msg.getParent();
+ }
+
+ /**
+ * Return the children of this object. Not applicable for us.
+ */
+ public Object[] getChildren(Object element)
+ {
+ return null;
+ }
+
+ /**
+ * Return true if this object has children. Always false for us.
+ */
+ public boolean hasChildren(Object element)
+ {
+ return false;
+ }
+ /**
+ * Return our unique property descriptors
+ */
+ protected IPropertyDescriptor[] internalGetPropertyDescriptors()
+ {
+
+ return null;
+ }
+ /**
+ * Return our unique property values
+ */
+ public Object internalGetPropertyValue(Object key)
+ {
+ return null;
+ }
+ /**
+ * Don't show delete
+ */
+ public boolean showDelete(Object element)
+ {
+ return false;
+ }
+
+ /**
+ * Don't show rename
+ */
+ public boolean showRename(Object element)
+ {
+ return false;
+ }
+
+ /**
+ * Don't show refresh
+ */
+ public boolean showRefresh(Object element)
+ {
+ return false;
+ }
+
+ /**
+ * Don't show "Open in new perspective"
+ */
+ public boolean showOpenViewActions(Object element)
+ {
+ return false;
+ }
+
+ // ------------------------------------------------------------
+ // METHODS FOR SAVING AND RESTORING EXPANSION STATE OF VIEWER...
+ // ------------------------------------------------------------
+
+ /**
+ * Return what to save to disk to identify this element in the persisted list of expanded elements.
+ * This just defaults to getName, but if that is not sufficient override it here.
+ */
+ public String getMementoHandle(Object element)
+ {
+ return getName(element);
+ }
+ /**
+ * Return a short string to uniquely identify the type of resource. Eg "conn" for connection.
+ * This just defaults to getType, but if that is not sufficient override it here, since that is
+ * a translated string.
+ */
+ public String getMementoHandleKey(Object element)
+ {
+ return "Msg";
+ }
+
+ /**
+ * Somtimes we don't want to remember an element's expansion state, such as for temporarily inserted
+ * messages. In these cases return false from this method. The default is true.
+ *
+ * WE RETURN FALSE.
+ */
+ public boolean saveExpansionState(Object element)
+ {
+ return false;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewNewConnectionPromptAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewNewConnectionPromptAdapter.java
new file mode 100644
index 00000000000..b4aaeb96b35
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewNewConnectionPromptAdapter.java
@@ -0,0 +1,38 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.actions.SystemRunAction;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * Adapter class for new connection prompt objects.
+ */
+public class SystemViewNewConnectionPromptAdapter extends SystemViewPromptableAdapter {
+
+ /**
+ * @see org.eclipse.rse.ui.view.SystemViewPromptableAdapter#getRunAction(org.eclipse.swt.widgets.Shell)
+ */
+ protected SystemRunAction getRunAction(Shell shell) {
+ return (new SystemRunAction(SystemResources.ACTION_NEWCONN_LABEL, SystemResources.ACTION_NEWCONN_TOOLTIP,
+ SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_NEWCONNECTION_ID), shell));
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewPart.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewPart.java
new file mode 100644
index 00000000000..5352665831c
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewPart.java
@@ -0,0 +1,1903 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Vector;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.core.runtime.IAdapterManager;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IStatusLineManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.rse.core.SystemBasePlugin;
+import org.eclipse.rse.core.SystemElapsedTimer;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.SystemPreferencesManager;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
+import org.eclipse.rse.filters.ISystemFilterPoolReference;
+import org.eclipse.rse.filters.ISystemFilterReference;
+import org.eclipse.rse.filters.ISystemFilterStringReference;
+import org.eclipse.rse.model.IHost;
+import org.eclipse.rse.model.ISystemPreferenceChangeEvent;
+import org.eclipse.rse.model.ISystemPreferenceChangeEvents;
+import org.eclipse.rse.model.ISystemPreferenceChangeListener;
+import org.eclipse.rse.model.ISystemProfile;
+import org.eclipse.rse.model.ISystemRegistry;
+import org.eclipse.rse.model.ISystemResourceChangeEvents;
+import org.eclipse.rse.model.SystemResourceChangeEvent;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.ISystemPreferencesConstants;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.SystemWidgetHelpers;
+import org.eclipse.rse.ui.actions.SystemCascadingPreferencesAction;
+import org.eclipse.rse.ui.actions.SystemCollapseAllAction;
+import org.eclipse.rse.ui.actions.SystemCopyToClipboardAction;
+import org.eclipse.rse.ui.actions.SystemNewConnectionAction;
+import org.eclipse.rse.ui.actions.SystemPasteFromClipboardAction;
+import org.eclipse.rse.ui.actions.SystemPreferenceQualifyConnectionNamesAction;
+import org.eclipse.rse.ui.actions.SystemPreferenceRestoreStateAction;
+import org.eclipse.rse.ui.actions.SystemPreferenceShowFilterPoolsAction;
+import org.eclipse.rse.ui.actions.SystemRefreshAction;
+import org.eclipse.rse.ui.actions.SystemRefreshAllAction;
+import org.eclipse.rse.ui.actions.SystemStartCommunicationsDaemonAction;
+import org.eclipse.rse.ui.actions.SystemWorkWithProfilesAction;
+import org.eclipse.rse.ui.messages.ISystemMessageLine;
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.ScrollBar;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorReference;
+import org.eclipse.ui.IElementFactory;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.IPartListener;
+import org.eclipse.ui.IPersistableElement;
+import org.eclipse.ui.IViewSite;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.part.CellEditorActionHandler;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.part.ISetSelectionTarget;
+import org.eclipse.ui.part.ViewPart;
+import org.eclipse.ui.progress.UIJob;
+import org.eclipse.ui.views.framelist.FrameList;
+
+
+/**
+ * This is the desktop view wrapper of the System View viewer.
+ * ViewPart is from com.ibm.itp.ui.support.parts
+ */
+public class SystemViewPart
+ extends ViewPart
+ implements ISetSelectionTarget, ISystemShellProvider, ISystemMessageLine, IElementFactory, IPersistableElement, IAdapterFactory, ISystemPreferenceChangeListener, ISelectionChangedListener, IRSEViewPart
+{
+
+ public class ToggleLinkingAction extends Action
+ {
+ public ToggleLinkingAction(SystemViewPart viewPart, String label)
+ {
+ super(label);
+ setChecked(isLinkingEnabled);
+ }
+
+ public void run()
+ {
+ toggleLinkingEnabled();
+ setChecked(isLinkingEnabled);
+ }
+ }
+
+ protected SystemView systemView;
+ protected ISystemViewInputProvider input = null;
+ protected String message, errorMessage;
+ protected SystemMessage sysErrorMessage;
+ protected IStatusLineManager statusLine = null;
+ protected boolean inputIsRoot = true;
+ protected boolean doTimings = false;
+ protected boolean isLinkingEnabled = false;
+
+ protected SystemElapsedTimer timer;
+ protected FrameList frameList;
+ protected SystemViewPartGotoActionGroup gotoActionGroup;
+ protected ToggleLinkingAction toggleLinkingAction;
+
+ // remember-state variables...
+
+ protected IMemento fMemento;
+ protected IAdapterManager platformManager;
+ // preference toggle actions that need to be updated when preferences change
+ protected SystemPreferenceQualifyConnectionNamesAction qualifyConnectionNamesAction;
+ protected SystemPreferenceShowFilterPoolsAction showFilterPoolsAction;
+ protected SystemPreferenceRestoreStateAction restoreStateAction;
+ //protected SystemPreferenceShowFilterStringsAction showFilterStringsAction;
+ protected static SystemWorkWithProfilesAction wwProfilesAction;
+ // copy and paste actions
+ protected SystemCopyToClipboardAction _copyAction;
+ protected SystemPasteFromClipboardAction _pasteAction;
+
+ // Persistance tags.
+ static final String TAG_RELEASE = "release";
+ static final String TAG_SELECTION = "selection";
+ static final String TAG_EXPANDED_TO = "expandedTo";
+ static final String TAG_EXPANDED = "expanded";
+ static final String TAG_ELEMENT = "element";
+ static final String TAG_PATH = "path";
+ static final String TAG_FILTER = "filter";
+ static final String TAG_INPUT = "svInput";
+ static final String TAG_VERTICAL_POSITION = "verticalPosition";
+ static final String TAG_HORIZONTAL_POSITION = "horizontalPosition";
+ static final String TAG_SHOWFILTERPOOLS = "showFilterPools";
+ static final String TAG_SHOWFILTERSTRINGS = "showFilterStrings";
+ static final String TAG_LINKWITHEDITOR = "linkWithEditor";
+
+ public static final String MEMENTO_DELIM = "///";
+
+ // constants
+ public static final String ID = "org.eclipse.rse.ui.view.systemView"; // matches id in plugin.xml, view tag
+
+ /**
+ * SystemViewPart constructor.
+ */
+ public SystemViewPart()
+ {
+ super();
+ //SystemPlugin.logDebugMessage(this.getClass().getName(),"INSIDE CTOR FOR SYSTEMVIEWPART.");
+ }
+ /**
+ * Easy access to the TreeViewer object
+ */
+ public SystemView getSystemView()
+ {
+ return systemView;
+ }
+
+ public Viewer getRSEViewer()
+ {
+ return systemView;
+ }
+
+ /**
+ * When an element is added/deleted/changed/etc and we have focus, this
+ * method is called. See SystemStaticHelpers.selectReveal method.
+ */
+ public void selectReveal(ISelection selection)
+ {
+ systemView.setSelection(selection, true);
+ }
+
+ /**
+ * Returns the name for the given element.
+ * Used as the name for the current frame.
+ */
+ protected String getFrameName(Object element)
+ {
+ return ((ILabelProvider) getSystemView().getLabelProvider()).getText(element);
+ }
+
+ /**
+ * Returns the tool tip text for the given element.
+ * Used as the tool tip text for the current frame, and for the view title tooltip.
+ */
+ protected String getFrameToolTipText(Object element)
+ {
+ return ((ILabelProvider) getSystemView().getLabelProvider()).getText(element);
+ }
+
+ public void toggleLinkingEnabled()
+ {
+ isLinkingEnabled = !isLinkingEnabled;
+ if (isLinkingEnabled)
+ {
+ IWorkbenchWindow activeWindow = SystemBasePlugin.getActiveWorkbenchWindow();
+ IWorkbenchPage activePage = activeWindow.getActivePage();
+ IEditorPart editor = activePage.getActiveEditor();
+ if (editor != null)
+ {
+ editorActivated(editor);
+ }
+ }
+ }
+
+ /**
+ * An editor has been activated. Sets the selection in this navigator
+ * to be the editor's input, if linking is enabled.
+ *
+ * @param editor the active editor
+ * @since 2.0
+ */
+ protected void editorActivated(IEditorPart editor)
+ {
+ if (!isLinkingEnabled)
+ return;
+
+ IEditorInput input = editor.getEditorInput();
+ if (input instanceof IFileEditorInput)
+ {
+ IFileEditorInput fileInput = (IFileEditorInput) input;
+ IFile file = fileInput.getFile();
+ /* FIXME - can't couple this view to files ui
+ SystemIFileProperties properties = new SystemIFileProperties(file);
+ Object rmtEditable = properties.getRemoteFileObject();
+ Object remoteObj = null;
+ if (rmtEditable != null && rmtEditable instanceof ISystemEditableRemoteObject)
+ {
+ ISystemEditableRemoteObject editable = (ISystemEditableRemoteObject) rmtEditable;
+ remoteObj = editable.getRemoteObject();
+
+ }
+ else
+ {
+ String subsystemId = properties.getRemoteFileSubSystem();
+ String path = properties.getRemoteFilePath();
+ if (subsystemId != null && path != null)
+ {
+ ISubSystem subSystem = SystemPlugin.getTheSystemRegistry().getSubSystem(subsystemId);
+ if (subSystem != null)
+ {
+ if (subSystem.isConnected())
+ {
+ try
+ {
+ remoteObj = subSystem.getObjectWithAbsoluteName(path);
+ }
+ catch (Exception e)
+ {
+ return;
+ }
+ }
+ }
+ }
+ }
+
+
+ if (remoteObj != null)
+ {
+ // DKM - causes editor to loose focus
+ //systemView.refreshRemoteObject(path, remoteObj, true);
+
+ SystemResourceChangeEvent event = new SystemResourceChangeEvent(remoteObj, ISystemResourceChangeEvents.EVENT_SELECT_REMOTE, null);
+ systemView.systemResourceChanged(event);
+ }
+ */
+ }
+ }
+ /**
+ * Updates the title text and title tool tip.
+ * Called whenever the input of the viewer changes.
+ */
+ protected void updateTitle()
+ {
+ //IAdaptable inputObj = getSite().getPage().getInput();
+ Object inputObj = getSystemView().getInput();
+ SystemBasePlugin.logInfo("Inside updateTitle. inputObject class type: " + inputObj.getClass().getName());
+ if (inputObj != null)
+ {
+ setTitleToolTip(getFrameToolTipText(input));
+ String viewName = getConfigurationElement().getAttribute("name"); //$NON-NLS-1$
+ if (inputObj instanceof IHost)
+ {
+ IHost conn = (IHost) inputObj;
+ setPartName(viewName + " : " + conn.getAliasName());
+ }
+ else if (inputObj instanceof ISubSystem)
+ {
+ ISubSystem ss = (ISubSystem) inputObj;
+ setPartName(viewName + " : " + ss.getName());
+ }
+ else if (inputObj instanceof ISystemFilterPoolReference)
+ {
+ ISystemFilterPoolReference sfpr = (ISystemFilterPoolReference) inputObj;
+ setPartName(viewName + " : " + sfpr.getName());
+ }
+ else if (inputObj instanceof ISystemFilterReference)
+ {
+ ISystemFilterReference sfr = (ISystemFilterReference) inputObj;
+ setPartName(viewName + " : " + sfr.getName());
+ }
+ else if (inputObj instanceof ISystemFilterStringReference)
+ {
+ ISystemFilterStringReference sfsr = (ISystemFilterStringReference) inputObj;
+ setPartName(viewName + " : " + sfsr.getString());
+ }
+ else
+ {
+ setPartName(viewName);
+ setTitleToolTip(""); //$NON-NLS-1$
+ }
+ }
+ }
+
+ /*
+ * Set our input provider that will be used to populate the tree view
+ *
+ public void setInputProvider(ISystemViewInputProvider input)
+ {
+ SystemPlugin.logDebugMessage(this.getClass().getName(),"INSIDE SETINPUTPROVIDER FOR SYSTEMVIEWPART.");
+ this.input = input;
+ }*/
+ /**
+ * Creates the SWT controls for a part.
+ * Called by Eclipse framework.
+ */
+ public void createPartControl(Composite parent)
+ {
+ //SystemPlugin.logInfo("INSIDE CREATEPARTCONTROL FOR SYSTEMVIEWPART.");
+ if (input == null)
+ //input = SystemPlugin.getTheSystemRegistry();
+ input = getInputProvider();
+ systemView = new SystemView(getShell(), parent, input, this);
+ frameList = createFrameList();
+
+ gotoActionGroup = new SystemViewPartGotoActionGroup(this);
+ IActionBars actionBars = getActionBars();
+ if (actionBars != null)
+ {
+ actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), systemView.getDeleteAction());
+ //SystemCommonSelectAllAction selAllAction = new SystemCommonSelectAllAction(getShell(), systemView, systemView);
+ actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), systemView.getSelectAllAction());
+ // added by Phil in 3.0 ...
+ //actionBars.setGlobalActionHandler(IWorkbenchActionConstants.PROPERTIES, systemView.getPropertyDialogAction(); hmm, different one for local vs remote objects
+ actionBars.setGlobalActionHandler(ActionFactory.REFRESH.getId(), systemView.getRefreshAction());
+
+ statusLine = actionBars.getStatusLineManager();
+ }
+
+ // register global edit actions
+ ISystemRegistry registry = SystemPlugin.getTheSystemRegistry();
+
+ Clipboard clipboard = registry.getSystemClipboard();
+
+ CellEditorActionHandler editorActionHandler = new CellEditorActionHandler(getViewSite().getActionBars());
+
+ _copyAction = new SystemCopyToClipboardAction(systemView.getShell(), clipboard);
+ _pasteAction = new SystemPasteFromClipboardAction(systemView.getShell(), clipboard);
+
+ editorActionHandler.setCopyAction(_copyAction);
+ editorActionHandler.setPasteAction(_pasteAction);
+ editorActionHandler.setDeleteAction(systemView.getDeleteAction());
+ editorActionHandler.setSelectAllAction(systemView.getSelectAllAction());
+
+ systemView.addSelectionChangedListener(this);
+ //hook the part focus to the viewer's control focus.
+ //hookFocus(systemView.getControl());
+
+ //prime the selection
+ //selectionChanged(null, getSite().getDesktopWindow().getSelectionService().getSelection());
+
+ boolean showConnectionActions = true;
+ fillLocalToolBar(showConnectionActions);
+
+ // -----------------------------
+ // Enable right-click popup menu
+ // -----------------------------
+ getSite().registerContextMenu(systemView.getContextMenuManager(), systemView);
+
+ // ----------------------------------------------------------------------
+ // Enable property sheet updates when tree items are selected.
+ // Note for this to work each item in the tree must either implement
+ // IPropertySource, or support IPropertySource.class as an adapter type
+ // in its AdapterFactory.
+ // ----------------------------------------------------------------------
+ getSite().setSelectionProvider(systemView);
+ // listen to editor events for linking
+ getSite().getPage().addPartListener(partListener);
+
+ SystemWidgetHelpers.setHelp(parent, SystemPlugin.HELPPREFIX + "sysv0000");
+
+ // ----------------------
+ // Restore previous state
+ // ----------------------
+ if ((fMemento != null) && (input instanceof ISystemRegistry))
+ restoreState(fMemento);
+ //fMemento = null;
+
+ // Register for preference change events
+ registry.addSystemPreferenceChangeListener(this);
+
+ // if this is the primary RSE view, and there are no user-defined
+ // connections, auto-expand the New Connection prompt...
+ if ((input == SystemPlugin.getTheSystemRegistry()) && (SystemPlugin.getTheSystemRegistry().getHosts().length == 1))
+ {
+ // assume this is the primary RSE view
+
+ // WE GET ALL THE WAY HERE, BUT THESE LINES OF CODE ARE INEFFECTIVE FOR SOME REASON!!
+ TreeItem firstItem = systemView.getTree().getItems()[0];
+ systemView.setSelection(new StructuredSelection(firstItem.getData()));
+ systemView.setExpandedState(firstItem.getData(), true);
+ }
+ }
+
+ /**
+ * Creates the frame source and frame list, and connects them.
+ *
+ * @since 2.0
+ */
+ protected FrameList createFrameList()
+ {
+ SystemViewPartFrameSource frameSource = new SystemViewPartFrameSource(this);
+ FrameList frameList = new FrameList(frameSource);
+ frameSource.connectTo(frameList);
+ return frameList;
+ }
+ /**
+ * Return the FrameList object for this view part
+ * @since 2.0
+ */
+ public FrameList getFrameList()
+ {
+ return frameList;
+ }
+
+ /**
+ * Return the Goto action group
+ */
+ public SystemViewPartGotoActionGroup getGotoActionGroup()
+ {
+ return gotoActionGroup;
+ }
+
+ /**
+ * Return the shell for this view part
+ */
+ public Shell getShell()
+ {
+ if (systemView != null)
+ return systemView.getTree().getShell();
+ else
+ return getSite().getShell();
+ }
+ /**
+ * Return the action bars for this view part
+ */
+ public IActionBars getActionBars()
+ {
+ return getViewSite().getActionBars();
+ }
+
+ /**
+ * @see IWorkbenchPart#setFocus()
+ */
+ public void setFocus()
+ {
+ //System.out.println("INSIDE SETFOCUS FOR SYSTEMVIEWPART. SYSTEMVIEW NULL? " + (systemView==null));
+ SystemPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell().setFocus();
+ systemView.getControl().setFocus();
+ /* the following was an attempt to fix problem with scrollbar needing two clicks to activate. didn't help.
+ if (!SystemPreferencesGlobal.getGlobalSystemPreferences().getRememberState())
+ {
+ TreeItem[] roots = systemView.getTree().getItems();
+ if ((roots != null) && (roots.length>0))
+ systemView.setSelection(new StructuredSelection(roots[0].getData()));
+ }
+ */
+
+ }
+
+ public void selectionChanged(SelectionChangedEvent e)
+ {
+ IStructuredSelection sel = (IStructuredSelection) e.getSelection();
+ _copyAction.setEnabled(_copyAction.updateSelection(sel));
+ _pasteAction.setEnabled(_pasteAction.updateSelection(sel));
+ //systemView.getPropertyDialogAction();
+ if (isLinkingEnabled)
+ {
+ linkToEditor(sel);
+ }
+ }
+
+
+ // link back to editor
+ protected void linkToEditor(IStructuredSelection selection)
+ {
+ Object obj = selection.getFirstElement();
+ if (obj instanceof IAdaptable)
+ {
+ try
+ {
+ ISystemRemoteElementAdapter adapter = (ISystemRemoteElementAdapter)((IAdaptable)obj).getAdapter(ISystemRemoteElementAdapter.class);
+ if (adapter != null)
+ {
+
+ if (adapter.canEdit(obj))
+ {
+ IWorkbenchPage page = getSite().getPage();
+ IEditorReference[] editorRefs = page.getEditorReferences();
+ for (int i = 0; i < editorRefs.length; i++)
+ {
+ IEditorReference editorRef = editorRefs[i];
+
+ IEditorPart editor = editorRef.getEditor(false);
+ if (editor != null)
+ {
+ IEditorInput input = editor.getEditorInput();
+ if (input instanceof FileEditorInput)
+ {
+ IFile file = ((FileEditorInput)input).getFile();
+ /** FIXME - can't couple this view to files ui
+ if (file.getProject().getName().equals(SystemRemoteEditManager.REMOTE_EDIT_PROJECT_NAME))
+ {
+ SystemIFileProperties properties = new SystemIFileProperties(file);
+ String path = properties.getRemoteFilePath();
+ if (path != null && path.equals(adapter.getAbsoluteName(obj)))
+ {
+ page.bringToTop(editor);
+ return;
+ }
+ }
+ */
+ }
+ }
+ }
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+
+
+ /**
+ * Fills the local tool bar with actions.
+ */
+ protected void fillLocalToolBar(boolean showConnectionActions)
+ {
+ IActionBars actionBars = getViewSite().getActionBars();
+ SystemRefreshAction refreshAction = new SystemRefreshAction(getShell());
+ refreshAction.setSelectionProvider(systemView);
+ actionBars.setGlobalActionHandler(ActionFactory.REFRESH.getId(), refreshAction);
+
+ IToolBarManager toolBarMgr = actionBars.getToolBarManager();
+ if (showConnectionActions)
+ {
+ SystemNewConnectionAction newConnAction = new SystemNewConnectionAction(getShell(), false, systemView); // false implies not from popup menu
+ toolBarMgr.add(newConnAction);
+ }
+
+ refreshAction.setSelectionProvider(systemView);
+ toolBarMgr.add(refreshAction);
+
+ toolBarMgr.add(new Separator("Navigate"));
+ SystemViewPartGotoActionGroup gotoActions = new SystemViewPartGotoActionGroup(this);
+ gotoActions.fillActionBars(actionBars);
+
+ // defect 41203
+ toolBarMgr.add(new Separator());
+
+ // DKM - changing hover image to the elcl16 one since the navigator no long has clcl16 icons
+ SystemCollapseAllAction collapseAllAction = new SystemCollapseAllAction(getShell());
+ collapseAllAction.setSelectionProvider(systemView);
+ // PSC ... better to encapsulate this in the SystemCollapseAllAction class
+ //collapseAllAction.setImageDescriptor(getNavigatorImageDescriptor("elcl16/collapseall.gif")); //$NON-NLS-1$
+ //collapseAllAction.setHoverImageDescriptor(getNavigatorImageDescriptor("elcl16/collapseall.gif")); //$NON-NLS-1$
+
+ toolBarMgr.add(collapseAllAction);
+
+ toggleLinkingAction = new ToggleLinkingAction(this, org.eclipse.ui.internal.views.navigator.ResourceNavigatorMessages.ToggleLinkingAction_text);
+
+ toggleLinkingAction.setToolTipText(org.eclipse.ui.internal.views.navigator.ResourceNavigatorMessages.ToggleLinkingAction_toolTip);
+ toggleLinkingAction.setImageDescriptor(getNavigatorImageDescriptor(ISystemIconConstants.ICON_IDE_LINKTOEDITOR_ID));
+ toggleLinkingAction.setHoverImageDescriptor(getNavigatorImageDescriptor(ISystemIconConstants.ICON_IDE_LINKTOEDITOR_ID));
+ toolBarMgr.add(toggleLinkingAction);
+
+
+
+ IMenuManager menuMgr = actionBars.getMenuManager();
+ populateSystemViewPulldownMenu(menuMgr, getShell(), showConnectionActions, this, systemView);
+ }
+ /**
+ * Pulldown the local toolbar menu with actions
+ */
+ public static void populateSystemViewPulldownMenu(IMenuManager menuMgr, Shell shell, boolean showConnectionActions, IWorkbenchPart viewPart, ISelectionProvider sp)
+ {
+ SystemRefreshAllAction refreshAllAction = new SystemRefreshAllAction(shell);
+ //SystemCascadingUserIdPerSystemTypeAction userIdPerSystemTypeAction = new SystemCascadingUserIdPerSystemTypeAction(shell); d51541
+ SystemPreferenceShowFilterPoolsAction showFilterPoolsAction = new SystemPreferenceShowFilterPoolsAction(shell);
+ SystemPreferenceQualifyConnectionNamesAction qualifyConnectionNamesAction = null;
+ SystemPreferenceRestoreStateAction restoreStateAction = new SystemPreferenceRestoreStateAction(shell);
+
+ if (viewPart instanceof SystemViewPart)
+ {
+ ((SystemViewPart) viewPart).showFilterPoolsAction = showFilterPoolsAction; // set non-static field
+ ((SystemViewPart) viewPart).restoreStateAction = restoreStateAction; // set non-static field
+ }
+
+ if (showConnectionActions)
+ {
+ boolean fromPopup = false;
+ boolean wantIcon = false;
+ SystemNewConnectionAction newConnectionAction = new SystemNewConnectionAction(shell, fromPopup, wantIcon, sp);
+ SystemWorkWithProfilesAction wwProfilesAction = new SystemWorkWithProfilesAction(shell);
+ menuMgr.add(newConnectionAction);
+ menuMgr.add(new Separator());
+ menuMgr.add(wwProfilesAction);
+ menuMgr.add(new Separator());
+ // moved Qualify Connection Names from here for d51541
+ //menuMgr.add(new Separator()); d51541
+ }
+ menuMgr.add(refreshAllAction);
+ menuMgr.add(new Separator());
+ if (showConnectionActions)
+ {
+ qualifyConnectionNamesAction = new SystemPreferenceQualifyConnectionNamesAction(shell);
+ if (viewPart instanceof SystemViewPart)
+ ((SystemViewPart) viewPart).qualifyConnectionNamesAction = qualifyConnectionNamesAction;
+ menuMgr.add(qualifyConnectionNamesAction); // moved here for d51541
+ }
+ //menuMgr.add(userIdPerSystemTypeAction.getSubMenu()); d51541
+ menuMgr.add(showFilterPoolsAction);
+ menuMgr.add(restoreStateAction); // d51541
+
+ // Now query our remoteSystemsViewPreferencesActions for extenders who wish to appear in the
+ // preferences cascading menu...
+ SystemCascadingPreferencesAction preferencesAction = new SystemCascadingPreferencesAction(shell);
+ menuMgr.add(preferencesAction.getSubMenu());
+
+ menuMgr.add(new Separator());
+ menuMgr.add(new SystemStartCommunicationsDaemonAction(shell));
+
+ if (viewPart != null)
+ {
+ /*
+ SystemCascadingTeamAction teamAction = new SystemCascadingTeamAction(shell, viewPart);
+ menuMgr.add(new Separator());
+ menuMgr.add(teamAction.getSubMenu());
+ */
+ }
+ SystemViewMenuListener menuListener = new SystemViewMenuListener(true); // true says this is a persistent menu
+ if (viewPart instanceof ISystemMessageLine)
+ menuListener.setShowToolTipText(true, (ISystemMessageLine) viewPart);
+ menuMgr.addMenuListener(menuListener);
+
+ }
+
+ /**
+ *
+ */
+ public void dispose()
+ {
+ super.dispose();
+ if (platformManager != null)
+ unregisterWithManager(platformManager);
+ SystemPlugin.getTheSystemRegistry().removeSystemPreferenceChangeListener(this);
+ getSite().getPage().removePartListener(partListener);
+ //System.out.println("INSIDE DISPOSE FOR SYSTEMVIEWPART.");
+ }
+
+ /**
+ * Returns the initial input provider for the viewer.
+ * Tries to deduce the appropriate input provider based on current input.
+ */
+ protected ISystemViewInputProvider getInputProvider()
+ {
+ IAdaptable inputObj = getSite().getPage().getInput();
+ inputIsRoot = false;
+ ISystemViewInputProvider inputProvider = SystemPlugin.getTheSystemRegistry();
+ if (inputObj != null)
+ {
+ platformManager = Platform.getAdapterManager();
+ if (inputObj instanceof IHost)
+ {
+ IHost conn = (IHost) inputObj;
+ inputProvider = new SystemViewAPIProviderForConnections(conn);
+ setPartName(getTitle() + " : " + conn.getAliasName());
+ }
+ else if (inputObj instanceof ISubSystem)
+ {
+ ISubSystem ss = (ISubSystem) inputObj;
+ inputProvider = new SystemViewAPIProviderForSubSystems(ss);
+ setPartName(getTitle() + " : " + ss.getName());
+ }
+ else if (inputObj instanceof ISystemFilterPoolReference)
+ {
+ ISystemFilterPoolReference sfpr = (ISystemFilterPoolReference) inputObj;
+ inputProvider = new SystemViewAPIProviderForFilterPools(sfpr);
+ setPartName(getTitle() + " : " + sfpr.getName());
+ }
+ else if (inputObj instanceof ISystemFilterReference)
+ {
+ ISystemFilterReference sfr = (ISystemFilterReference) inputObj;
+ inputProvider = new SystemViewAPIProviderForFilters(sfr);
+ setPartName(getTitle() + " : " + sfr.getName());
+ }
+ else if (inputObj instanceof ISystemFilterStringReference)
+ {
+ ISystemFilterStringReference sfsr = (ISystemFilterStringReference) inputObj;
+ inputProvider = new SystemViewAPIProviderForFilterStrings(sfsr);
+ setPartName(getTitle() + " : " + sfsr.getString());
+ }
+ else
+ {
+ platformManager = null;
+ inputIsRoot = true;
+ }
+
+ if (platformManager != null)
+ registerWithManager(platformManager, inputObj);
+ //msg = "INSIDE GETINPUTPROVIDER FOR SYSTEMVIEWPART: inputObj="+inputObj+", input class="+inputObj.getClass().getName()+", inputProvider="+inputProvider;
+ }
+ else
+ {
+ //msg = "INSIDE GETINPUTPROVIDER FOR SYSTEMVIEWPART: inputObj is null, inputProvider="+inputProvider;
+ }
+ //SystemPlugin.logDebugMessage(this.getClass().getName(),msg);
+ //System.out.println("INSIDE getInputProvider. inputProvider = "+inputProvider);
+ return inputProvider;
+ }
+
+ // --------------------------------------------
+ // ISystemPreferenceChangeListener interface...
+ // --------------------------------------------
+ public void systemPreferenceChanged(ISystemPreferenceChangeEvent event)
+ {
+ if ((event.getType() == ISystemPreferenceChangeEvents.EVENT_QUALIFYCONNECTIONNAMES) && (qualifyConnectionNamesAction != null))
+ qualifyConnectionNamesAction.setChecked(SystemPreferencesManager.getPreferencesManager().getQualifyConnectionNames());
+ else if ((event.getType() == ISystemPreferenceChangeEvents.EVENT_SHOWFILTERPOOLS) && (showFilterPoolsAction != null))
+ showFilterPoolsAction.setChecked(SystemPreferencesManager.getPreferencesManager().getShowFilterPools());
+ else if ((event.getType() == ISystemPreferenceChangeEvents.EVENT_RESTORESTATE) && (restoreStateAction != null))
+ restoreStateAction.setChecked(SystemPreferencesManager.getPreferencesManager().getRememberState());
+
+ //else if ((event.getType() == ISystemPreferenceChangeEvents.EVENT_SHOWFILTERSTRINGS) &&
+ // (showFilterStringsAction != null))
+ // showFilterStringsAction.setChecked(SystemPreferencesManager.getPreferencesManager().getShowFilterStrings());
+
+ }
+
+ // -------------------------------
+ // ISystemMessageLine interface...
+ // -------------------------------
+ /**
+ * Clears the currently displayed error message and redisplayes
+ * the message which was active before the error message was set.
+ */
+ public void clearErrorMessage()
+ {
+ errorMessage = null;
+ sysErrorMessage = null;
+ if (statusLine != null)
+ statusLine.setErrorMessage(errorMessage);
+ }
+ /**
+ * Clears the currently displayed message.
+ */
+ public void clearMessage()
+ {
+ message = null;
+ if (statusLine != null)
+ statusLine.setMessage(message);
+ }
+ /**
+ * Get the currently displayed error text.
+ * @return The error message. If no error message is displayed
+ * The parent's default implementation will ignore the memento and initialize
+ * the view in a fresh state. Subclasses may override the implementation to
+ * perform any state restoration as needed.
+ */
+ public void init(IViewSite site, IMemento memento) throws PartInitException
+ {
+ init(site);
+ fMemento = memento;
+ //System.out.println("INSIDE INIT");
+ }
+
+ /**
+ * Returns the image descriptor with the given relative path.
+ */
+ protected ImageDescriptor getNavigatorImageDescriptor(String relativePath)
+ {
+ return SystemPlugin.getDefault().getImageDescriptorFromIDE(relativePath); // more reusable
+ /*
+ String iconPath = "icons/full/"; //$NON-NLS-1$
+ try
+ {
+ AbstractUIPlugin plugin = (AbstractUIPlugin) Platform.getPlugin(PlatformUI.PLUGIN_ID);
+ URL installURL = plugin.getDescriptor().getInstallURL();
+
+ URL url = new URL(installURL, iconPath + relativePath);
+ ImageDescriptor descriptor = ImageDescriptor.createFromURL(url);
+ return descriptor;
+ }
+ catch (MalformedURLException e)
+ {
+ // should not happen
+ return ImageDescriptor.getMissingImageDescriptor();
+ }*/
+ }
+
+ /**
+ * Method declared on IViewPart.
+ */
+ public void saveState(IMemento memento)
+ {
+ //System.out.println("INSIDE SAVESTATE");
+ if (!SystemPreferencesManager.getPreferencesManager().getRememberState())
+ return;
+ if (systemView == null)
+ {
+ // part has not been created
+ if (fMemento != null) //Keep the old state;
+ memento.putMemento(fMemento);
+ return;
+ }
+
+ if (isLinkingEnabled)
+ {
+ memento.putString(TAG_LINKWITHEDITOR, "t");
+ }
+ else
+ {
+ memento.putString(TAG_LINKWITHEDITOR, "f");
+ }
+
+ // We record the current release for future in case anything significant changes from release to release
+ memento.putString(TAG_RELEASE, SystemResources.CURRENT_RELEASE_NAME);
+
+ // We record the current preferences for show filter string and show filter pools.
+ // We do this to ensure the states match on restore. If they don't we will be in trouble
+ // restoring expansion state and hence will abandon it.
+
+ memento.putString(TAG_SHOWFILTERPOOLS, SystemPreferencesManager.getPreferencesManager().getShowFilterPools() ? "t" : "f");
+ //memento.putString(TAG_SHOWFILTERSTRINGS, SystemPreferencesManager.getPreferencesManager().getShowFilterStrings() ? "t" : "f");
+
+ String inputMemento = memento.getString("factoryID"); // see IWorkbenchWindow ... this is only clue I can figure out!
+ if (inputMemento != null)
+ {
+ saveInputState(memento);
+ return;
+ }
+
+ Tree tree = systemView.getTree();
+
+ // SAVE EXPAND-TO HASHTABLE
+ Hashtable expandToFilters = systemView.getExpandToFilterTable();
+ if ((expandToFilters != null) && (expandToFilters.size() > 0))
+ {
+ IMemento expandedMem = memento.createChild(TAG_EXPANDED_TO);
+ Enumeration keys = expandToFilters.keys();
+ while (keys.hasMoreElements())
+ {
+ Object key = keys.nextElement();
+ Object value = expandToFilters.get(key);
+ if (value != null)
+ {
+ IMemento elementMem = expandedMem.createChild(TAG_ELEMENT);
+ elementMem.putString(TAG_PATH, (String) key);
+ elementMem.putString(TAG_FILTER, (String) value);
+ }
+ }
+ }
+
+ // SAVE EXPANSION STATE
+ //Object expandedElements[]= systemView.getExpandedElements();
+ Object expandedElements[] = systemView.getVisibleExpandedElements();
+ if ((expandedElements != null) && (expandedElements.length > 0))
+ {
+ IMemento expandedMem = memento.createChild(TAG_EXPANDED);
+ for (int i = 0; i < expandedElements.length; i++)
+ {
+ Object o = expandedElements[i];
+ ISystemViewElementAdapter adapter = systemView.getAdapter(o);
+ //ISystemRemoteElementAdapter radapter = systemView.getRemoteAdapter(o);
+ //if (adapter.saveExpansionState(o) && (radapter==null))
+ if (adapter.saveExpansionState(o))
+ {
+ IMemento elementMem = expandedMem.createChild(TAG_ELEMENT);
+ elementMem.putString(TAG_PATH, getMementoHandle(o, adapter));
+ //System.out.println("Added to saved expansion list: " + getMementoHandle(o, adapter));
+ }
+ }
+ }
+
+ // SAVE SELECTION STATE
+ Object elements[] = ((IStructuredSelection) systemView.getSelection()).toArray();
+ if ((elements != null) && (elements.length > 0))
+ {
+ IMemento selectionMem = memento.createChild(TAG_SELECTION);
+ for (int i = 0; i < elements.length; i++)
+ {
+ Object o = elements[i];
+ ISystemViewElementAdapter adapter = systemView.getAdapter(o);
+ //ISystemRemoteElementAdapter radapter = systemView.getRemoteAdapter(o);
+ //if (adapter.saveExpansionState(o) && (radapter==null))
+ if (adapter.saveExpansionState(o))
+ {
+ IMemento elementMem = selectionMem.createChild(TAG_ELEMENT);
+ elementMem.putString(TAG_PATH, getMementoHandle(o, adapter));
+ }
+ }
+ }
+
+ //save vertical position
+ ScrollBar bar = tree.getVerticalBar();
+ int position = bar != null ? bar.getSelection() : 0;
+ memento.putString(TAG_VERTICAL_POSITION, String.valueOf(position));
+ //save horizontal position
+ bar = tree.getHorizontalBar();
+ position = bar != null ? bar.getSelection() : 0;
+ memento.putString(TAG_HORIZONTAL_POSITION, String.valueOf(position));
+
+ }
+
+ /**
+ * Defer to the adapter to get the memento handle key plus the memento handle for
+ * each part leading up to the current object.
+ */
+ protected String getMementoHandle(Object o, ISystemViewElementAdapter adapter)
+ {
+ StringBuffer idBuffer = new StringBuffer(adapter.getMementoHandleKey(o));
+ Object[] elementNodes = systemView.getElementNodes(o);
+ if (elementNodes != null)
+ {
+ for (int idx = elementNodes.length - 1; idx >= 0; idx--)
+ {
+ o = elementNodes[idx];
+ adapter = systemView.getAdapter(o);
+ idBuffer.append(MEMENTO_DELIM + adapter.getMementoHandle(o));
+ }
+ }
+ //System.out.println("MEMENTO HANDLE: " + idBuffer.toString());
+ return idBuffer.toString();
+ }
+
+ /**
+ * Our own method for restoring state
+ */
+ protected void restoreState(IMemento memento)
+ {
+ RestoreStateRunnable restoreAction = new RestoreStateRunnable(memento);
+ restoreAction.setRule(SystemPlugin.getTheSystemRegistry());
+ restoreAction.schedule();
+
+ /* DKM - Moved to RestoreStateRunnable
+ * - resolves invalid shell problem at startup
+ * *
+ //System.out.println("SYSTEMVIEWPART: restoreState");
+ if (!SystemPreferencesManager.getPreferencesManager().getRememberState())
+ return;
+
+ if (doTimings)
+ timer = new SystemElapsedTimer();
+
+ // restore the show filter pools and show filter strings settings as they were when this was saved
+ boolean showFilterPools = false;
+ boolean showFilterStrings = false;
+ String savedValue = memento.getString(TAG_SHOWFILTERPOOLS);
+ if (savedValue != null)
+ showFilterPools = savedValue.equals("t");
+ else
+ showFilterPools = SystemPreferencesManager.getPreferencesManager().getShowFilterPools();
+
+ savedValue = memento.getString(TAG_SHOWFILTERSTRINGS); // historical
+ if (savedValue != null)
+ showFilterStrings = savedValue.equals("t");
+ //else
+ //showFilterStrings = SystemPreferencesManager.getPreferencesManager().getShowFilterStrings();
+
+ IMemento childMem = null;
+
+ // restore expand-to hashtable state
+ childMem= memento.getChild(TAG_EXPANDED_TO);
+ if (childMem != null)
+ {
+ IMemento[] elementMem= childMem.getChildren(TAG_ELEMENT);
+ Hashtable ht = new Hashtable();
+ for (int i= 0; i < elementMem.length; i++)
+ {
+ String key = elementMem[i].getString(TAG_PATH);
+ String value = elementMem[i].getString(TAG_FILTER);
+ if ((key != null) && (value != null))
+ ht.put(key, value);
+ }
+ if (ht.size() > 0)
+ systemView.setExpandToFilterTable(ht);
+ }
+
+ // restore expansion state
+ childMem= memento.getChild(TAG_EXPANDED);
+ if (childMem != null)
+ {
+ ArrayList elements= new ArrayList();
+ Vector remoteElements = new Vector();
+ IMemento[] elementMem= childMem.getChildren(TAG_ELEMENT);
+ // walk through list of expanded nodes, breaking into 2 lists: non-remote and remote
+ for (int i= 0; i < elementMem.length; i++)
+ {
+ Object element= getObjectFromMemento(showFilterPools, showFilterStrings, elementMem[i].getString(TAG_PATH));
+ if (element != null)
+ if (element instanceof RemoteObject) // this is a remote object
+ {
+ remoteElements.add(element);
+ //System.out.println("Added to remote expansion list: " + element);
+ }
+ else
+ {
+ elements.add(element);
+ //System.out.println("Added to non-remote expansion list: " + element);
+ }
+ }
+ // expand non-remote...
+ systemView.setExpandedElements(elements.toArray());
+ // expand remote...
+ if (remoteElements.size() > 0)
+ {
+ SystemResourceChangeEvent event = null;
+ for (int idx=0; idx
+ * WE RETURN FALSE.
+ */
+ public boolean saveExpansionState(Object element)
+ {
+ return false;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewResources.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewResources.java
new file mode 100644
index 00000000000..d2873ddfc11
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewResources.java
@@ -0,0 +1,250 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+
+import org.eclipse.osgi.util.NLS;
+
+
+/**
+ * Constants used throughout the SystemView plugin
+ */
+public class SystemViewResources extends NLS {
+ private static String BUNDLE_NAME = "org.eclipse.rse.ui.view.SystemViewResources"; //$NON-NLS-1$
+
+ // -------------------------
+ // Property names...
+ // -------------------------
+ // Property sheet values: Common
+ public static String RESID_PROPERTY_NBRCHILDREN_LABEL;
+ public static String RESID_PROPERTY_NBRCHILDREN_TOOLTIP;
+
+ public static String RESID_PROPERTY_NBRCHILDRENRETRIEVED_LABEL;
+ public static String RESID_PROPERTY_NBRCHILDRENRETRIEVED_TOOLTIP;
+
+ // Property sheet values: Connections
+ public static String RESID_PROPERTY_PROFILE_TYPE_VALUE;
+
+ public static String RESID_PROPERTY_PROFILESTATUS_LABEL;
+ public static String RESID_PROPERTY_PROFILESTATUS_TOOLTIP;
+
+ public static String RESID_PROPERTY_PROFILESTATUS_ACTIVE_LABEL;
+
+ public static String RESID_PROPERTY_PROFILESTATUS_NOTACTIVE_LABEL;
+
+ public static String RESID_PROPERTY_CONNECTION_TYPE_VALUE;
+
+ public static String RESID_PROPERTY_SYSTEMTYPE_LABEL;
+ public static String RESID_PROPERTY_SYSTEMTYPE_TOOLTIP;
+
+ public static String RESID_PROPERTY_CONNECTIONSTATUS_LABEL;
+ public static String RESID_PROPERTY_CONNECTIONSTATUS_TOOLTIP;
+ public static String RESID_PROPERTY_CONNECTIONSTATUS_CONNECTED_VALUE;
+
+ public static String RESID_PROPERTY_CONNECTIONSTATUS_DISCONNECTED_VALUE;
+
+
+ public static String RESID_PROPERTY_ALIASNAME_LABEL;
+ public static String RESID_PROPERTY_ALIASNAME_TOOLTIP;
+
+ public static String RESID_PROPERTY_HOSTNAME_LABEL;
+ public static String RESID_PROPERTY_HOSTNAME_TOOLTIP;
+
+ public static String RESID_PROPERTY_DEFAULTUSERID_LABEL;
+ public static String RESID_PROPERTY_DEFAULTUSERID_TOOLTIP;
+
+ public static String RESID_PROPERTY_CONNDESCRIPTION_LABEL;
+ public static String RESID_PROPERTY_CONNDESCRIPTION_TOOLTIP;
+
+ public static String RESID_PROPERTY_PROFILE_LABEL;
+ public static String RESID_PROPERTY_PROFILE_TOOLTIP;
+
+
+ // Property sheet values: SubSystems
+ public static String RESID_PROPERTY_SUBSYSTEM_TYPE_VALUE;
+
+ public static String RESID_PROPERTY_USERID_LABEL;
+ public static String RESID_PROPERTY_USERID_TOOLTIP;
+
+ public static String RESID_PROPERTY_PORT_LABEL;
+ public static String RESID_PROPERTY_PORT_TOOLTIP;
+
+ public static String RESID_PROPERTY_CONNECTED_TOOLTIP;
+ public static String RESID_PROPERTY_CONNECTED_LABEL;
+
+ public static String RESID_PROPERTY_VRM_LABEL;
+ public static String RESID_PROPERTY_VRM_TOOLTIP;
+
+ // Property sheet values: Filter Pools
+ public static String RESID_PROPERTY_FILTERPOOL_TYPE_VALUE;
+
+ public static String RESID_PROPERTY_FILTERPOOLREFERENCE_TYPE_VALUE;
+
+ public static String RESID_PROPERTY_FILTERPOOLREFERENCE_PARENTPOOL_LABEL;
+ public static String RESID_PROPERTY_FILTERPOOLREFERENCE_PARENTPOOL_TOOLTIP;
+ public static String RESID_PROPERTY_FILTERPOOLREFERENCE_PARENTPROFILE_LABEL;
+ public static String RESID_PROPERTY_FILTERPOOLREFERENCE_PARENTPROFILE_TOOLTIP;
+ public static String RESID_PROPERTY_FILTERPOOLREFERENCE_RELATEDCONNECTION_LABEL;
+ public static String RESID_PROPERTY_FILTERPOOLREFERENCE_RELATEDCONNECTION_TOOLTIP;
+ public static String RESID_PROPERTY_FILTERPOOLREFERENCE_IS_CONNECTIONPRIVATE_LABEL;
+ public static String RESID_PROPERTY_FILTERPOOLREFERENCE_IS_CONNECTIONPRIVATE_TOOLTIP;
+
+ // Property sheet values: Filters
+ public static String RESID_PROPERTY_FILTERTYPE_LABEL;
+ public static String RESID_PROPERTY_FILTERTYPE_VALUE;
+ public static String RESID_PROPERTY_FILTERTYPE_TOOLTIP;
+
+ public static String RESID_PROPERTY_FILTERSTRING_LABEL;
+ public static String RESID_PROPERTY_FILTERSTRING_VALUE;
+ public static String RESID_PROPERTY_FILTERSTRING_TOOLTIP;
+
+ public static String RESID_PROPERTY_FILTERSTRINGS_LABEL;
+ public static String RESID_PROPERTY_FILTERSTRINGS_TOOLTIP;
+
+ public static String RESID_PROPERTY_FILTERSTRINGS_COUNT_LABEL;
+ public static String RESID_PROPERTY_FILTERSTRINGS_COUNT_TOOLTIP;
+
+ public static String RESID_PROPERTY_FILTERPARENTFILTER_LABEL;
+ public static String RESID_PROPERTY_FILTERPARENTFILTER_TOOLTIP;
+
+ public static String RESID_PROPERTY_FILTERPARENTPOOL_LABEL;
+ public static String RESID_PROPERTY_FILTERPARENTPOOL_TOOLTIP;
+
+ public static String RESID_PROPERTY_FILTERS_LABEL;
+ public static String RESID_PROPERTY_FILTERS_DESCRIPTION;
+
+ // Property sheet values: Files
+ public static String RESID_PROPERTY_FILE_TYPE_FILE_VALUE;
+ public static String RESID_PROPERTY_FILE_TYPE_FOLDER_VALUE;
+ public static String RESID_PROPERTY_FILE_TYPE_ROOT_VALUE;
+
+ public static String RESID_PROPERTY_ARCHIVE_EXPANDEDSIZE_LABEL;
+
+ public static String RESID_PROPERTY_ARCHIVE_EXPANDEDSIZE_VALUE;
+ public static String RESID_PROPERTY_ARCHIVE_EXPANDEDSIZE_DESCRIPTION;
+
+ public static String RESID_PROPERTY_ARCHIVE_COMMENT_LABEL;
+ public static String RESID_PROPERTY_ARCHIVE_COMMENT_DESCRIPTION;
+
+
+ public static String RESID_PROPERTY_VIRTUALFILE_COMPRESSEDSIZE_LABEL;
+ public static String RESID_PROPERTY_VIRTUALFILE_COMPRESSEDSIZE_VALUE;
+ public static String RESID_PROPERTY_VIRTUALFILE_COMPRESSEDSIZE_DESCRIPTION;
+
+ public static String RESID_PROPERTY_VIRTUALFILE_COMMENT_LABEL;
+ public static String RESID_PROPERTY_VIRTUALFILE_COMMENT_DESCRIPTION;
+
+ public static String RESID_PROPERTY_VIRTUALFILE_COMPRESSIONRATIO_LABEL;
+ public static String RESID_PROPERTY_VIRTUALFILE_COMPRESSIONRATIO_DESCRIPTION;
+
+ public static String RESID_PROPERTY_VIRTUALFILE_COMPRESSIONMETHOD_LABEL;
+ public static String RESID_PROPERTY_VIRTUALFILE_COMPRESSIONMETHOD_DESCRIPTION;
+
+ public static String RESID_PROPERTY_FILE_SIZE_VALUE;
+
+ public static String RESID_PROPERTY_FILE_PATH_LABEL;
+ public static String RESID_PROPERTY_FILE_PATH_TOOLTIP;
+
+ public static String RESID_PROPERTY_FILE_LASTMODIFIED_LABEL;
+ public static String RESID_PROPERTY_FILE_LASTMODIFIED_TOOLTIP;
+
+ public static String RESID_PROPERTY_FILE_SIZE_LABEL;
+ public static String RESID_PROPERTY_FILE_SIZE_TOOLTIP;
+
+ public static String RESID_PROPERTY_FILE_CANONICAL_PATH_LABEL;
+ public static String RESID_PROPERTY_FILE_CANONICAL_PATH_TOOLTIP;
+
+ public static String RESID_PROPERTY_FILE_CLASSIFICATION_LABEL;
+ public static String RESID_PROPERTY_FILE_CLASSIFICATION_TOOLTIP;
+
+ public static String RESID_PROPERTY_FILE_READONLY_LABEL;
+ public static String RESID_PROPERTY_FILE_READONLY_TOOLTIP;
+
+ public static String RESID_PROPERTY_FILE_READABLE_LABEL;
+ public static String RESID_PROPERTY_FILE_READABLE_TOOLTIP;
+
+ public static String RESID_PROPERTY_FILE_WRITABLE_LABEL;
+ public static String RESID_PROPERTY_FILE_WRITABLE_TOOLTIP;
+
+ public static String RESID_PROPERTY_FILE_HIDDEN_LABEL;
+ public static String RESID_PROPERTY_FILE_HIDDEN_TOOLTIP;
+
+ // search result properties
+ public static String RESID_PROPERTY_SEARCH_LINE_LABEL;
+ public static String RESID_PROPERTY_SEARCH_LINE_TOOLTIP;
+ //public static String RESID_PROPERTY_SEARCH_CHAR_END_LABEL;
+ //public static String RESID_PROPERTY_SEARCH_CHAR_END_TOOLTIP;
+
+
+
+ // shell status properties
+ public static String RESID_PROPERTY_SHELL_STATUS_LABEL;
+ public static String RESID_PROPERTY_SHELL_STATUS_TOOLTIP;
+ public static String RESID_PROPERTY_SHELL_CONTEXT_LABEL;
+ public static String RESID_PROPERTY_SHELL_CONTEXT_TOOLTIP;
+
+ public static String RESID_PROPERTY_SHELL_STATUS_ACTIVE_VALUE;
+ public static String RESID_PROPERTY_SHELL_STATUS_INACTIVE_VALUE;
+
+ // error properties
+ public static String RESID_PROPERTY_ERROR_FILENAME_LABEL;
+ public static String RESID_PROPERTY_ERROR_FILENAME_TOOLTIP;
+
+ public static String RESID_PROPERTY_ERROR_LINENO_LABEL;
+ public static String RESID_PROPERTY_ERROR_LINENO_TOOLTIP;
+
+ // Property sheet values: Messages
+ public static String RESID_PROPERTY_MESSAGE_TYPE_VALUE;
+
+ // Property sheet values: Categories in Team view
+ public static String RESID_PROPERTY_TEAM_CATEGORY_TYPE_VALUE;
+ public static String RESID_PROPERTY_TEAM_SSFACTORY_TYPE_VALUE;
+ public static String RESID_PROPERTY_TEAM_USERACTION_TYPE_VALUE;
+ public static String RESID_PROPERTY_TEAM_COMPILETYPE_TYPE_VALUE;
+ public static String RESID_PROPERTY_TEAM_COMPILECMD_TYPE_VALUE;
+
+ // Property sheet values: User actions
+ public static String RESID_PROPERTY_ORIGIN_IBM_VALUE;
+ public static String RESID_PROPERTY_ORIGIN_IBMUSER_VALUE;
+ public static String RESID_PROPERTY_ORIGIN_USER_VALUE;
+ public static String RESID_PROPERTY_ORIGIN_ISV_VALUE;
+ public static String RESID_PROPERTY_ORIGIN_ISVUSER_VALUE;
+ public static String RESID_PROPERTY_USERACTION_VENDOR_LABEL;
+ public static String RESID_PROPERTY_USERACTION_VENDOR_TOOLTIP;
+ public static String RESID_PROPERTY_USERACTION_DOMAIN_LABEL;
+ public static String RESID_PROPERTY_USERACTION_DOMAIN_TOOLTIP;
+ public static String RESID_PROPERTY_USERACTION_DOMAIN_ALL_VALUE;
+
+ // Property sheet values: Compile types
+ public static String RESID_PROPERTY_COMPILETYPE_TYPES_LABEL;
+ public static String RESID_PROPERTY_COMPILETYPE_TYPES_DESCRIPTION;
+
+ // Miscellaneous / common
+ public static String RESID_PROPERTY_ORIGIN_LABEL;
+ public static String RESID_PROPERTY_ORIGIN_TOOLTIP;
+ public static String RESID_PROPERTY_COMMAND_LABEL;
+ public static String RESID_PROPERTY_COMMAND_TOOLTIP;
+ public static String RESID_PROPERTY_COMMENT_LABEL;
+ public static String RESID_PROPERTY_COMMENT_TOOLTIP;
+
+ public static String RESID_SCRATCHPAD;
+ public static String RESID_REMOTE_SCRATCHPAD;
+
+ static {
+ // load message values from bundle file
+ NLS.initializeMessages(BUNDLE_NAME, SystemViewResources.class);
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewResources.properties b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewResources.properties
new file mode 100644
index 00000000000..8ad70fec708
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewResources.properties
@@ -0,0 +1,212 @@
+################################################################################
+# Copyright (c) 2000, 2006 IBM Corporation. All rights reserved.
+# This program and the accompanying materials are made available under the terms
+# of the Eclipse Public License v1.0 which accompanies this distribution, and is
+# available at http://www.eclipse.org/legal/epl-v10.html
+#
+# Initial Contributors:
+# The following IBM employees contributed to the Remote System Explorer
+# component that contains this file: David McKnight, Kushal Munir,
+# Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+# Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+#
+# Contributors:
+# {Name} (company) - description of contribution.
+################################################################################
+
+# NLS_MESSAGEFORMAT_NONE
+
+#COMMON PROPERTIES
+RESID_PROPERTY_NBRCHILDREN_LABEL=Number of children
+RESID_PROPERTY_NBRCHILDREN_TOOLTIP=Number of children currently under this parent
+RESID_PROPERTY_NBRCHILDRENRETRIEVED_LABEL=Last retrieved
+RESID_PROPERTY_NBRCHILDRENRETRIEVED_TOOLTIP=Number of children last retrieved
+
+
+#CONNECTION PROPERTIES
+RESID_PROPERTY_SYSTEMTYPE_LABEL=Remote system type
+RESID_PROPERTY_SYSTEMTYPE_TOOLTIP=System type of remote host
+RESID_PROPERTY_PROFILE_TYPE_VALUE=Profile
+RESID_PROPERTY_PROFILESTATUS_LABEL=Status
+RESID_PROPERTY_PROFILESTATUS_TOOLTIP=Active status of this profile. Connections and filters are shown for active profiles only
+RESID_PROPERTY_PROFILESTATUS_ACTIVE_LABEL=Active
+RESID_PROPERTY_PROFILESTATUS_NOTACTIVE_LABEL=Not active
+RESID_PROPERTY_CONNECTION_TYPE_VALUE=Connection
+RESID_PROPERTY_CONNECTIONSTATUS_LABEL=Connection status
+RESID_PROPERTY_CONNECTIONSTATUS_TOOLTIP=Connection status of subsystems
+RESID_PROPERTY_CONNECTIONSTATUS_CONNECTED_VALUE=Some subsystems connected
+RESID_PROPERTY_CONNECTIONSTATUS_DISCONNECTED_VALUE=No subsystems connected
+
+RESID_PROPERTY_ALIASNAME_LABEL=Connection name
+RESID_PROPERTY_ALIASNAME_TOOLTIP=Unique name for this connection
+
+RESID_PROPERTY_HOSTNAME_LABEL=Host name
+RESID_PROPERTY_HOSTNAME_TOOLTIP=Host name or IP address of remote system
+
+RESID_PROPERTY_DEFAULTUSERID_LABEL=Default User ID
+RESID_PROPERTY_DEFAULTUSERID_TOOLTIP=Default user ID when no user ID in subsystem
+
+RESID_PROPERTY_CONNDESCRIPTION_LABEL=Description
+RESID_PROPERTY_CONNDESCRIPTION_TOOLTIP=Description of this connection
+
+RESID_PROPERTY_PROFILE_LABEL=Parent profile
+RESID_PROPERTY_PROFILE_TOOLTIP=Profile that owns this connection
+
+
+#SUBSYSTEM PROPERTIES
+RESID_PROPERTY_SUBSYSTEM_TYPE_VALUE=Subsystem
+
+RESID_PROPERTY_USERID_LABEL=User ID
+RESID_PROPERTY_USERID_TOOLTIP=User ID for connecting to this service
+
+RESID_PROPERTY_PORT_LABEL=Port
+RESID_PROPERTY_PORT_TOOLTIP=Port to use when connecting to this remote subsystem
+
+RESID_PROPERTY_CONNECTED_TOOLTIP=Currently connected to this service?
+RESID_PROPERTY_CONNECTED_LABEL=Connected
+
+RESID_PROPERTY_VRM_LABEL=Version
+RESID_PROPERTY_VRM_TOOLTIP=Version, release and modification of remote system, if available
+
+
+#FILTER POOL PROPERTIES
+RESID_PROPERTY_FILTERPOOL_TYPE_VALUE=Filter pool
+RESID_PROPERTY_FILTERPOOLREFERENCE_TYPE_VALUE=Filter pool reference
+
+RESID_PROPERTY_FILTERPOOLREFERENCE_PARENTPOOL_LABEL=Referenced filter pool
+RESID_PROPERTY_FILTERPOOLREFERENCE_PARENTPOOL_TOOLTIP=Filter pool this references
+RESID_PROPERTY_FILTERPOOLREFERENCE_PARENTPROFILE_LABEL=Parent profile
+RESID_PROPERTY_FILTERPOOLREFERENCE_PARENTPROFILE_TOOLTIP=Profile containing referenced filter pool
+RESID_PROPERTY_FILTERPOOLREFERENCE_RELATEDCONNECTION_LABEL=Related connection
+RESID_PROPERTY_FILTERPOOLREFERENCE_RELATEDCONNECTION_TOOLTIP=If this is a connection-private filter pool, this is the name of that connection
+RESID_PROPERTY_FILTERPOOLREFERENCE_IS_CONNECTIONPRIVATE_LABEL=Connection-private
+RESID_PROPERTY_FILTERPOOLREFERENCE_IS_CONNECTIONPRIVATE_TOOLTIP=Is this is a connection-private filter pool, which only exists for this connection?
+
+
+#FILTER PROPERTIES
+RESID_PROPERTY_FILTERTYPE_LABEL=Filter
+RESID_PROPERTY_FILTERTYPE_VALUE=Remote system filter
+RESID_PROPERTY_FILTERTYPE_TOOLTIP=Remote system filter
+
+RESID_PROPERTY_FILTERSTRING_LABEL=Filter string
+RESID_PROPERTY_FILTERSTRING_VALUE=Remote system filter string
+RESID_PROPERTY_FILTERSTRING_TOOLTIP=Filter string used to get this resource
+
+RESID_PROPERTY_FILTERSTRINGS_LABEL=Filter strings
+RESID_PROPERTY_FILTERSTRINGS_TOOLTIP=Filter strings used to retrieve list of remote system objects
+
+RESID_PROPERTY_FILTERSTRINGS_COUNT_LABEL=Number of filter strings
+RESID_PROPERTY_FILTERSTRINGS_COUNT_TOOLTIP=How many filter strings contained in this filter
+
+RESID_PROPERTY_FILTERPARENTFILTER_LABEL=Parent filter
+RESID_PROPERTY_FILTERPARENTFILTER_TOOLTIP=Filter containing this nested filter
+
+RESID_PROPERTY_FILTERPARENTPOOL_LABEL=Parent filter pool
+RESID_PROPERTY_FILTERPARENTPOOL_TOOLTIP=Filter pool that directly or indirectly contains this filter
+
+RESID_PROPERTY_FILTERS_LABEL=Filter Strings
+RESID_PROPERTY_FILTERS_DESCRIPTION=List of file system filters for this named filter
+
+
+
+#FILE PROPERTIES
+RESID_PROPERTY_FILE_TYPE_FILE_VALUE=File
+RESID_PROPERTY_FILE_TYPE_FOLDER_VALUE=Folder
+RESID_PROPERTY_FILE_TYPE_ROOT_VALUE=Root
+RESID_PROPERTY_FILE_LASTMODIFIED_LABEL=Last modified
+RESID_PROPERTY_FILE_LASTMODIFIED_TOOLTIP=When last changed
+RESID_PROPERTY_FILE_SIZE_LABEL=Size
+RESID_PROPERTY_FILE_SIZE_VALUE=&1 bytes
+RESID_PROPERTY_FILE_SIZE_TOOLTIP=Number of bytes in this file
+RESID_PROPERTY_FILE_PATH_LABEL=Location
+RESID_PROPERTY_FILE_PATH_TOOLTIP=Path containing this file or folder
+RESID_PROPERTY_FILE_READABLE_LABEL=Readable
+RESID_PROPERTY_FILE_READABLE_TOOLTIP=Is this file readable
+RESID_PROPERTY_FILE_WRITABLE_LABEL=Writable
+RESID_PROPERTY_FILE_WRITABLE_TOOLTIP=Is this file writable
+RESID_PROPERTY_FILE_READONLY_LABEL=Read-only
+RESID_PROPERTY_FILE_READONLY_TOOLTIP=Is this file read-only
+RESID_PROPERTY_FILE_HIDDEN_LABEL=Hidden
+RESID_PROPERTY_FILE_HIDDEN_TOOLTIP=Is this file hidden
+RESID_PROPERTY_FILE_CANONICAL_PATH_LABEL=Canonical Path
+RESID_PROPERTY_FILE_CANONICAL_PATH_TOOLTIP=Canonical path of this file or folder
+RESID_PROPERTY_FILE_CLASSIFICATION_LABEL=Classification
+RESID_PROPERTY_FILE_CLASSIFICATION_TOOLTIP=Classification path of this file
+
+
+
+#SEARCH RESULT PROPERTIES
+RESID_PROPERTY_SEARCH_LINE_LABEL=Line
+RESID_PROPERTY_SEARCH_LINE_TOOLTIP=Line in file of match
+
+#ARCHIVE PROPERTIES
+RESID_PROPERTY_ARCHIVE_EXPANDEDSIZE_LABEL=Expanded Size
+RESID_PROPERTY_ARCHIVE_EXPANDEDSIZE_VALUE=&1 bytes
+RESID_PROPERTY_ARCHIVE_EXPANDEDSIZE_DESCRIPTION=Number of bytes in this archive when it is decompressed/expanded
+RESID_PROPERTY_ARCHIVE_COMMENT_LABEL=Comment
+RESID_PROPERTY_ARCHIVE_COMMENT_DESCRIPTION=The user-defined comment for this archive
+
+
+
+#VIRTUAL FILE PROPERTIES
+RESID_PROPERTY_VIRTUALFILE_COMPRESSEDSIZE_LABEL=Compressed Size
+RESID_PROPERTY_VIRTUALFILE_COMPRESSEDSIZE_VALUE=&1 bytes
+RESID_PROPERTY_VIRTUALFILE_COMPRESSEDSIZE_DESCRIPTION=Number of bytes in the file after compression
+RESID_PROPERTY_VIRTUALFILE_COMPRESSIONRATIO_LABEL=Compression ratio
+RESID_PROPERTY_VIRTUALFILE_COMPRESSIONRATIO_DESCRIPTION=Compressed size divided by expanded size expressed as a percentage
+RESID_PROPERTY_VIRTUALFILE_COMPRESSIONMETHOD_LABEL=Compression method
+RESID_PROPERTY_VIRTUALFILE_COMPRESSIONMETHOD_DESCRIPTION=The algorithm used to compress the file
+RESID_PROPERTY_VIRTUALFILE_COMMENT_LABEL=Comment
+RESID_PROPERTY_VIRTUALFILE_COMMENT_DESCRIPTION=The user-defined comment for this virtual file
+
+#SHELL PROPERTIES
+RESID_PROPERTY_SHELL_STATUS_LABEL=Status
+RESID_PROPERTY_SHELL_STATUS_TOOLTIP=Status of the shell
+RESID_PROPERTY_SHELL_CONTEXT_LABEL=Context
+RESID_PROPERTY_SHELL_CONTEXT_TOOLTIP=Current context within the shell
+RESID_PROPERTY_SHELL_STATUS_ACTIVE_VALUE=Running
+RESID_PROPERTY_SHELL_STATUS_INACTIVE_VALUE=Finished
+
+#MESSAGE PROPERTIES
+RESID_PROPERTY_MESSAGE_TYPE_VALUE=Message
+
+#ERROR PROPERTIES
+RESID_PROPERTY_ERROR_FILENAME_LABEL=File
+RESID_PROPERTY_ERROR_FILENAME_TOOLTIP=File Containing Error
+RESID_PROPERTY_ERROR_LINENO_LABEL=Line
+RESID_PROPERTY_ERROR_LINENO_TOOLTIP=Line number
+
+#TEAM VIEW PROPERTIES
+RESID_PROPERTY_TEAM_CATEGORY_TYPE_VALUE=Category
+RESID_PROPERTY_TEAM_SSFACTORY_TYPE_VALUE=SubSystem factory
+RESID_PROPERTY_TEAM_USERACTION_TYPE_VALUE=User action
+RESID_PROPERTY_TEAM_COMPILETYPE_TYPE_VALUE=Compilable source type
+RESID_PROPERTY_TEAM_COMPILECMD_TYPE_VALUE=Compile command
+
+#USER ACTION PROPERTIES
+RESID_PROPERTY_ORIGIN_IBM_VALUE=IBM supplied
+RESID_PROPERTY_ORIGIN_IBMUSER_VALUE=IBM supplied, user edited
+RESID_PROPERTY_ORIGIN_ISV_VALUE=ISV supplied
+RESID_PROPERTY_ORIGIN_ISVUSER_VALUE=ISV supplied, user edited
+RESID_PROPERTY_ORIGIN_USER_VALUE=User defined
+RESID_PROPERTY_USERACTION_DOMAIN_ALL_VALUE=All
+RESID_PROPERTY_USERACTION_VENDOR_LABEL=Vendor
+RESID_PROPERTY_USERACTION_VENDOR_TOOLTIP=Vendor that supplied this command
+RESID_PROPERTY_USERACTION_DOMAIN_LABEL=Domain
+RESID_PROPERTY_USERACTION_DOMAIN_TOOLTIP=Object domain this applies to
+
+
+#COMPILE TYPE PROPERTIES
+RESID_PROPERTY_COMPILETYPE_TYPES_LABEL=File type
+RESID_PROPERTY_COMPILETYPE_TYPES_DESCRIPTION=File type this refers to
+
+#MISCELLANEOUS PROPERTIES
+RESID_PROPERTY_ORIGIN_LABEL=Origin
+RESID_PROPERTY_ORIGIN_TOOLTIP=Where this originated from
+RESID_PROPERTY_COMMAND_LABEL=Command
+RESID_PROPERTY_COMMAND_TOOLTIP=The command that will be executed
+RESID_PROPERTY_COMMENT_LABEL=Comment
+RESID_PROPERTY_COMMENT_TOOLTIP=A description
+
+RESID_SCRATCHPAD=Scratchpad
+RESID_REMOTE_SCRATCHPAD=Remote Scratchpad
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewRootInputAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewRootInputAdapter.java
new file mode 100644
index 00000000000..0ba04367946
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewRootInputAdapter.java
@@ -0,0 +1,226 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.core.SystemPreferencesManager;
+import org.eclipse.rse.internal.model.SystemNewConnectionPromptObject;
+import org.eclipse.rse.model.ISystemRegistry;
+import org.eclipse.rse.ui.SystemMenuManager;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.validators.ISystemValidator;
+import org.eclipse.swt.widgets.Shell;
+
+
+
+/**
+ * Adapter for the root-providing object of the SystemView tree viewer.
+ */
+public class SystemViewRootInputAdapter extends AbstractSystemViewAdapter implements ISystemViewElementAdapter
+{
+ private SystemPreferencesManager spg;
+ private SystemNewConnectionPromptObject newConnPrompt;
+ private Object[] newConnPromptArray;
+
+ /**
+ * Ctor
+ */
+ public SystemViewRootInputAdapter()
+ {
+
+ }
+
+ /**
+ * Returns any actions that should be contributed to the popup menu
+ * for the given element.
+ * @param menu The menu to contribute actions to
+ * @param selection The window's current selection.
+ * @param shell Shell of viewer
+ * @param menuGroup recommended menu group to add actions to. If added to another group, you must be sure to create that group first.
+ */
+ public void addActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup)
+ {
+
+ }
+
+ /**
+ * Returns an image descriptor for the image. More efficient than getting the image.
+ * @param element The element for which an image is desired
+ */
+ public ImageDescriptor getImageDescriptor(Object element)
+ {
+ return null;
+ }
+
+ /**
+ * Return the label for this object
+ */
+ public String getText(Object element)
+ {
+ return SystemResources.RESID_SYSTEMREGISTRY_CONNECTIONS;
+ }
+ /**
+ * Return the absolute name, versus just display name, of this object.
+ * Just uses getText(element);
+ */
+ public String getAbsoluteName(Object element)
+ {
+ return getText(element);
+ }
+ /**
+ * Return the type label for this object
+ */
+ public String getType(Object element)
+ {
+ //return "System Root Provider"; // should never be called
+ // DKM - MRI hack to get "root"
+ return SystemViewResources.RESID_PROPERTY_FILE_TYPE_ROOT_VALUE;
+ }
+
+ /**
+ * Return the parent of this object
+ */
+ public Object getParent(Object element)
+ {
+ return null;
+ }
+
+ /**
+ * Return the children of this object
+ */
+ public Object[] getChildren(Object element)
+ {
+ ISystemViewInputProvider provider = (ISystemViewInputProvider)element;
+
+ if ((provider instanceof ISystemRegistry) && showNewConnectionPrompt())
+ {
+ Object[] children = provider.getSystemViewRoots();
+ if ((children == null) || (children.length == 0))
+ {
+ return getNewConnectionPromptObjectAsArray();
+ }
+ else
+ {
+ Object[] allChildren = new Object[children.length+1];
+ allChildren[0] = getNewConnectionPromptObject();
+ for (int idx=0; idx
+ * Designed to be as fast as possible by going directly to the SWT widgets
+ */
+ public boolean sameParent()
+ {
+ boolean same = true;
+
+ Tree tree = getTree();
+
+ TreeItem[] items = tree.getSelection();
+
+ if ((items == null) || (items.length ==0)) {
+ return true;
+ }
+
+ TreeItem prevParent = null;
+ TreeItem currParent = null;
+
+ for (int idx = 0; idx < items.length; idx++)
+ {
+ currParent = items[idx].getParentItem();
+
+ if ((idx>0) && (currParent != prevParent)) {
+ same = false;
+ break;
+ }
+ else
+ {
+ prevParent = currParent;
+ }
+ }
+ return same;
+ }
+
+ private boolean selectionHasAncestryRelationship() {
+ Tree tree = getTree();
+
+ TreeItem[] items = tree.getSelection();
+
+ for (int idx=0; idx
+ * Walking this list multiple times while building the popup menu is a performance
+ * hit, so we have this common method that does it only once, setting instance
+ * variables for all of the decisions we are in interested in.
+ * --------------------------------------------------------------------------------
+ */
+ protected void scanSelections()
+ {
+ // initial these variables to true. Then if set to false even once, leave as false always...
+ _selectionShowRefreshAction = true;
+ _selectionShowOpenViewActions = true;
+ _selectionShowDeleteAction = true;
+ _selectionShowRenameAction = true;
+ _selectionEnableDeleteAction = true;
+ _selectionEnableRenameAction = true;
+ _selectionIsRemoteObject = true;
+ _selectionFlagsUpdated = true;
+
+ IStructuredSelection selection = (IStructuredSelection) getSelection();
+ Iterator elements = selection.iterator();
+ while (elements.hasNext())
+ {
+ Object element = elements.next();
+ ISystemViewElementAdapter adapter = getAdapter(element);
+
+ if (_selectionShowRefreshAction)
+ _selectionShowRefreshAction = adapter.showRefresh(element);
+
+ if (_selectionShowOpenViewActions)
+ _selectionShowOpenViewActions = adapter.showOpenViewActions(element);
+
+ if (_selectionShowDeleteAction)
+ _selectionShowDeleteAction = adapter.showDelete(element);
+
+ if (_selectionShowRenameAction)
+ _selectionShowRenameAction = adapter.showRename(element);
+
+ if (_selectionEnableDeleteAction)
+ _selectionEnableDeleteAction = _selectionShowDeleteAction && adapter.canDelete(element);
+ //System.out.println("ENABLE DELETE SET TO " + selectionEnableDeleteAction);
+
+ if (_selectionEnableRenameAction)
+ _selectionEnableRenameAction = _selectionShowRenameAction && adapter.canRename(element);
+
+ if (_selectionIsRemoteObject)
+ _selectionIsRemoteObject = (getRemoteAdapter(element) != null);
+ }
+
+ }
+
+
+ void handleKeyPressed(KeyEvent event)
+ {
+ //System.out.println("Key Pressed");
+ //System.out.println("...event character : " + event.character + ", "+(int)event.character);
+ //System.out.println("...event state mask: " + event.stateMask);
+ //System.out.println("...CTRL : " + SWT.CTRL);
+ if ((event.character == SWT.DEL) && (event.stateMask == 0) && (((IStructuredSelection) getSelection()).size() > 0))
+ {
+ scanSelections();
+ if (showDelete() && canDelete())
+ {
+ SystemCommonDeleteAction dltAction = (SystemCommonDeleteAction) getDeleteAction();
+ dltAction.setShell(getShell());
+ dltAction.setSelection(getSelection());
+ dltAction.setViewer(this);
+ dltAction.run();
+ }
+ }
+ }
+
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/scratchpad/SystemScratchpadViewPart.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/scratchpad/SystemScratchpadViewPart.java
new file mode 100644
index 00000000000..7617ff58e8a
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/scratchpad/SystemScratchpadViewPart.java
@@ -0,0 +1,388 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view.scratchpad;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IStatusLineManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.model.ISystemRegistry;
+import org.eclipse.rse.model.ISystemResourceChangeEvent;
+import org.eclipse.rse.model.ISystemResourceChangeEvents;
+import org.eclipse.rse.model.ISystemResourceChangeListener;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.SystemWidgetHelpers;
+import org.eclipse.rse.ui.actions.SystemCommonDeleteAction;
+import org.eclipse.rse.ui.actions.SystemCopyToClipboardAction;
+import org.eclipse.rse.ui.actions.SystemPasteFromClipboardAction;
+import org.eclipse.rse.ui.actions.SystemRefreshAction;
+import org.eclipse.rse.ui.messages.ISystemMessageLine;
+import org.eclipse.rse.ui.view.IRSEViewPart;
+import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.ISelectionListener;
+import org.eclipse.ui.ISelectionService;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.part.CellEditorActionHandler;
+import org.eclipse.ui.part.ViewPart;
+
+
+/**
+ * This class is the Remote Scratchpad view.
+ */
+public class SystemScratchpadViewPart extends ViewPart implements ISelectionListener, ISelectionChangedListener,
+ ISystemResourceChangeListener, ISystemMessageLine, IRSEViewPart
+{
+
+
+ private SystemScratchpadView _viewer;
+
+ // common actions
+ private SystemCopyToClipboardAction _copyAction;
+ private SystemPasteFromClipboardAction _pasteAction;
+ private SystemCommonDeleteAction _deleteAction;
+ private ClearAction _clearAction;
+ private ClearSelectedAction _clearSelectionAction;
+
+ // for ISystemMessageLine
+ private String _message, _errorMessage;
+ private SystemMessage sysErrorMessage;
+ private IStatusLineManager _statusLine = null;
+
+ // constants
+ public static final String ID = "org.eclipse.rse.ui.view.scratchpad.SystemScratchpadViewPart"; // matches id in plugin.xml, view tag
+
+ public void setFocus()
+ {
+ _viewer.getControl().setFocus();
+ }
+
+ public SystemScratchpadView getViewer()
+ {
+ return _viewer;
+ }
+
+ public Viewer getRSEViewer()
+ {
+ return _viewer;
+ }
+
+ public void createPartControl(Composite parent)
+ {
+ Tree tree = new Tree(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION | SWT.HIDE_SELECTION);
+
+ _viewer = new SystemScratchpadView(tree, this);
+ _viewer.setWorkbenchPart(this);
+
+ ISelectionService selectionService = getSite().getWorkbenchWindow().getSelectionService();
+ selectionService.addSelectionListener(this);
+ _viewer.addSelectionChangedListener(this);
+ getSite().setSelectionProvider(_viewer);
+
+ _viewer.addDoubleClickListener(new IDoubleClickListener()
+ {
+ public void doubleClick(DoubleClickEvent event)
+ {
+ handleDoubleClick(event);
+ }
+ });
+
+ fillLocalToolBar();
+
+ // register global edit actions
+ ISystemRegistry registry = SystemPlugin.getTheSystemRegistry();
+ Clipboard clipboard = registry.getSystemClipboard();
+
+ CellEditorActionHandler editorActionHandler = new CellEditorActionHandler(getViewSite().getActionBars());
+
+ _copyAction = new SystemCopyToClipboardAction(_viewer.getShell(), clipboard);
+ _pasteAction = new SystemPasteFromClipboardAction(_viewer.getShell(), clipboard);
+ _deleteAction = new SystemCommonDeleteAction(_viewer.getShell(), _viewer);
+
+ editorActionHandler.setCopyAction(_copyAction);
+ editorActionHandler.setPasteAction(_pasteAction);
+ editorActionHandler.setDeleteAction(_deleteAction);
+ //editorActionHandler.setSelectAllAction(new SelectAllAction());
+
+ registry.addSystemResourceChangeListener(this);
+
+ SystemWidgetHelpers.setHelp(_viewer.getControl(), SystemPlugin.HELPPREFIX + "scrp0000");
+
+ setInput(registry.getSystemScratchPad());
+
+ getSite().registerContextMenu(_viewer.getContextMenuManager(), _viewer);
+ }
+
+ public void selectionChanged(IWorkbenchPart part, ISelection sel)
+ {
+ }
+
+ public void dispose()
+ {
+ ISelectionService selectionService = getSite().getWorkbenchWindow().getSelectionService();
+ selectionService.removeSelectionListener(this);
+ _viewer.removeSelectionChangedListener(this);
+
+ SystemPlugin.getTheSystemRegistry().removeSystemResourceChangeListener(this);
+
+ if (_viewer != null)
+ {
+ _viewer.dispose();
+ }
+
+ super.dispose();
+ }
+
+ private void handleDoubleClick(DoubleClickEvent event)
+ {
+ IStructuredSelection s = (IStructuredSelection) event.getSelection();
+ Object element = s.getFirstElement();
+
+ if (element == null)
+ return;
+
+ ISystemViewElementAdapter adapter = (ISystemViewElementAdapter) ((IAdaptable) element).getAdapter(ISystemViewElementAdapter.class);
+ boolean alreadyHandled = false;
+
+ if (adapter != null)
+ {
+ if (adapter.hasChildren(element))
+ {
+ setInput((IAdaptable) element);
+ }
+ else
+ {
+ alreadyHandled = adapter.handleDoubleClick(element);
+ }
+ }
+ }
+
+ public void updateActionStates()
+ {
+ if (_clearAction == null)
+ fillLocalToolBar();
+
+ _clearAction.checkEnabledState();
+ _clearSelectionAction.checkEnabledState();
+ }
+
+ public void fillLocalToolBar()
+ {
+ //if (_refreshAction == null)
+ if (_clearAction == null)
+ {
+ // refresh action
+ //_refreshAction = new RefreshAction();
+ _clearAction = new ClearAction(_viewer);
+ _clearSelectionAction = new ClearSelectedAction(_viewer);
+
+ }
+
+ updateActionStates();
+
+ IActionBars actionBars = getViewSite().getActionBars();
+ IToolBarManager toolBarManager = actionBars.getToolBarManager();
+ IMenuManager menuMgr = actionBars.getMenuManager();
+
+ SystemRefreshAction refreshAction = new SystemRefreshAction(getShell());
+ actionBars.setGlobalActionHandler(ActionFactory.REFRESH.getId(), refreshAction);
+ _statusLine = actionBars.getStatusLineManager();
+
+ addToolBarItems(toolBarManager);
+ addToolBarMenuItems(menuMgr);
+ }
+
+ private void addToolBarMenuItems(IMenuManager menuManager)
+ {
+ menuManager.removeAll();
+ menuManager.add(_clearSelectionAction);
+ menuManager.add(new Separator());
+ menuManager.add(_clearAction);
+ }
+
+ private void addToolBarItems(IToolBarManager toolBarManager)
+ {
+ toolBarManager.removeAll();
+ toolBarManager.add(_clearSelectionAction);
+ toolBarManager.add(new Separator());
+ toolBarManager.add(_clearAction);
+ }
+
+ public void selectionChanged(SelectionChangedEvent e)
+ {
+ // listener for this view
+ updateActionStates();
+
+ IStructuredSelection sel = (IStructuredSelection) e.getSelection();
+ _copyAction.setEnabled(_copyAction.updateSelection(sel));
+ _pasteAction.setEnabled(_pasteAction.updateSelection(sel));
+ _deleteAction.setEnabled(_deleteAction.updateSelection(sel));
+ }
+
+ public void setInput(IAdaptable object)
+ {
+ setInput(object, null);
+
+ }
+
+ public void setInput(IAdaptable object, String[] filters)
+ {
+ if (_viewer != null && object != null)
+ {
+ _viewer.setInput(object);
+
+ updateActionStates();
+
+ }
+ }
+
+ /**
+ * Used to asynchronously update the view whenever properties change.
+ */
+ public void systemResourceChanged(ISystemResourceChangeEvent event)
+ {
+ Object child = event.getSource();
+ Object parent = event.getParent();
+ Object input = _viewer.getInput();
+
+ if (event.getType() == ISystemResourceChangeEvents.EVENT_RENAME)
+ {
+ }
+
+ if (parent == _viewer.getInput())
+ {
+ updateActionStates();
+ }
+ }
+
+ public Shell getShell()
+ {
+ return _viewer.getShell();
+ }
+
+
+// -------------------------------
+ // ISystemMessageLine interface...
+ // -------------------------------
+ /**
+ * Clears the currently displayed error message and redisplayes
+ * the message which was active before the error message was set.
+ */
+ public void clearErrorMessage()
+ {
+ _errorMessage = null;
+ sysErrorMessage = null;
+ if (_statusLine != null)
+ _statusLine.setErrorMessage(_errorMessage);
+ }
+ /**
+ * Clears the currently displayed message.
+ */
+ public void clearMessage()
+ {
+ _message = null;
+ if (_statusLine != null)
+ _statusLine.setMessage(_message);
+ }
+ /**
+ * Get the currently displayed error text.
+ * @return The error message. If no error message is displayed
+ * Designed to be as fast as possible by going directly to the SWT widgets
+ */
+ public boolean sameParent()
+ {
+ boolean same = true;
+
+ Tree tree = null;
+
+ if (currentViewer instanceof AbstractTreeViewer) {
+ tree = (Tree)(currentViewer.getControl());
+ }
+ else {
+ return false;
+ }
+
+ TreeItem[] items = tree.getSelection();
+
+ if ((items == null) || (items.length == 0))
+ return true;
+
+ TreeItem prevParent = null;
+ TreeItem currParent = null;
+
+ for (int idx=0; same && (idx
+ * The parent's default implementation will ignore the memento and initialize
+ * the view in a fresh state. Subclasses may override the implementation to
+ * perform any state restoration as needed.
+ */
+ public void init(IViewSite site,IMemento memento) throws PartInitException
+ {
+ super.init(site,memento);
+ fMemento = memento;
+ //System.out.println("INSIDE INIT");
+ }
+
+ /**
+ * Adds the listeners to the tree viewer.
+ */
+ protected void addTreeViewerListeners()
+ {
+ treeViewer.addDoubleClickListener(new IDoubleClickListener()
+ {
+ public void doubleClick(DoubleClickEvent event) {
+ handleDoubleClick(event);
+ }
+ });
+
+ //System.out.println("Add key listener");
+
+ treeViewer.getControl().addKeyListener(new KeyAdapter() {
+ public void keyReleased(KeyEvent e) {
+ handleKeyReleased(e);
+ } });
+ treeViewer.getControl().addKeyListener(new KeyAdapter() {
+ public void keyPressed(KeyEvent e) {
+ handleKeyPressed(e);
+ } });
+
+ treeViewer.addSelectionChangedListener(this);
+
+ treeViewer.addOpenListener(new IOpenListener() {
+ public void open(OpenEvent event) {
+ handleOpen(event);
+ }
+ });
+ }
+
+
+ /**
+ * Returns the shell to use for opening dialogs.
+ * Used in this class, and in the actions.
+ */
+ public Shell getShell()
+ {
+ return getViewSite().getShell();
+ }
+
+ /**
+ * Handles double clicks in viewer. It is responsible for expanding
+ * and collapsing of folders.
+ */
+ private void handleDoubleClick(DoubleClickEvent event)
+ {
+ /*
+ IStructuredSelection rseSSel =
+ (IStructuredSelection) event.getSelection();
+ Object rseObject = rseSSel.getFirstElement();
+ if (treeViewer.isExpandable(rseObject))
+ {
+ treeViewer.setExpandedState(
+ rseObject,
+ !treeViewer.getExpandedState(rseObject));
+ }
+ */
+ }
+
+ /**
+ * Handles an open event from the viewer.
+ * Opens an editor on the selected file.
+ */
+ protected void handleOpen(OpenEvent event)
+ {
+ }
+
+ /**
+ * Handles key events in viewer.
+ * Called by common rename and delete actions.
+ */
+ public String getName(Object element)
+ {
+ return ((ISystemProfile)element).getName();
+ }
+
+ /**
+ * Return the absolute name, versus just display name, of this object
+ */
+ public String getAbsoluteName(Object element)
+ {
+ return ((ISystemProfile)element).getName();
+ }
+
+ /**
+ * Return the type label for this object
+ */
+ public String getType(Object element)
+ {
+ return SystemViewResources.RESID_PROPERTY_PROFILE_TYPE_VALUE;
+ }
+
+ /**
+ * Return the string to display in the status line when the given object is selected.
+ * We return:
+ * Connection: name - Host name: hostName - Description: description
+ */
+ public String getStatusLineText(Object element)
+ {
+ ISystemProfile profile = (ISystemProfile)element;
+ boolean active = SystemPlugin.getTheSystemRegistry().getSystemProfileManager().isSystemProfileActive(profile.getName());
+ return getType(element) + ": " + profile.getName() + ", " +
+ SystemViewResources.RESID_PROPERTY_PROFILESTATUS_LABEL + ": " +
+ (active ? SystemViewResources.RESID_PROPERTY_PROFILESTATUS_ACTIVE_LABEL : SystemViewResources.RESID_PROPERTY_PROFILESTATUS_NOTACTIVE_LABEL);
+ }
+
+ /**
+ * Return the parent of this object. We return the RemoteSystemsConnections project
+ */
+ public Object getParent(Object element)
+ {
+ return SystemResourceManager.getRemoteSystemsProject();
+ }
+
+ /**
+ * Return the children of this profile.
+ */
+ public Object[] getChildren(Object element)
+ {
+ ISystemProfile profile = (ISystemProfile)element;
+ return getCategoryChildren(profile);
+ }
+
+ /**
+ * Given a profile, return all the category children for it. If this child objects have yet to be created,
+ * create them now.
+ */
+ public SystemTeamViewCategoryNode[] getCategoryChildren(ISystemProfile profile)
+ {
+ SystemTeamViewCategoryNode[] children = (SystemTeamViewCategoryNode[])categoriesByProfile.get(profile);
+ if (children == null)
+ {
+ children = new SystemTeamViewCategoryNode[4]; //5];
+ for (int idx=0; idx
+ * Form and return a new canonical (unique) name for this object, given a candidate for the new
+ * name. This is called by the generic multi-rename dialog to test that all new names are unique.
+ * To do this right, sometimes more than the raw name itself is required to do uniqueness checking.
+ *
+ * Returns profile.connectionName, upperCased
+ */
+ public String getCanonicalNewName(Object element, String newName)
+ {
+ return newName.toUpperCase();
+ }
+
+ // ------------------------------------------------------------
+ // METHODS FOR SAVING AND RESTORING EXPANSION STATE OF VIEWER...
+ // ------------------------------------------------------------
+ /**
+ * Return what to save to disk to identify this element in the persisted list of expanded elements.
+ */
+ public String getMementoHandle(Object element)
+ {
+ ISystemProfile profile = (ISystemProfile)element;
+ return profile.getName();
+ }
+ /**
+ * Return a short string to uniquely identify the type of resource.
+ */
+ public String getMementoHandleKey(Object element)
+ {
+ return ISystemMementoConstants.MEMENTO_KEY_PROFILE;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewRefreshAllAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewRefreshAllAction.java
new file mode 100644
index 00000000000..a8f0704545e
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewRefreshAllAction.java
@@ -0,0 +1,76 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view.team;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.SystemResourceManager;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.actions.SystemBaseAction;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * The action allows users to refresh the entire System Team tree view
+ */
+public class SystemTeamViewRefreshAllAction extends SystemBaseAction
+ //
+{
+ private SystemTeamViewPart teamView;
+
+ /**
+ * Constructor for SystemRefreshAllAction
+ */
+ public SystemTeamViewRefreshAllAction(Shell parent, SystemTeamViewPart teamView)
+ {
+ super(SystemResources.ACTION_REFRESH_ALL_LABEL,SystemResources.ACTION_REFRESH_ALL_TOOLTIP,
+ SystemPlugin.getDefault().getImageDescriptorFromIDE(ISystemIconConstants.ICON_IDE_REFRESH_ID),
+ parent);
+ this.teamView = teamView;
+ allowOnMultipleSelection(true);
+ setContextMenuGroup(ISystemContextMenuConstants.GROUP_BUILD);
+ setSelectionSensitive(false);
+
+ setHelp(SystemPlugin.HELPPREFIX+"actn0009");
+ }
+
+ /**
+ * @see SystemBaseAction#updateSelection(IStructuredSelection)
+ */
+ public boolean updateSelection(IStructuredSelection selection)
+ {
+ boolean enable = true;
+ return enable;
+ }
+
+ /**
+ * This is the method called when the user selects this action.
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ public void run()
+ {
+ try {
+ SystemResourceManager.getRemoteSystemsProject().refreshLocal(IResource.DEPTH_INFINITE, null);
+ } catch (Exception exc) {}
+
+ SystemTeamView teamViewer = (SystemTeamView)teamView.getTreeViewer();
+ teamViewer.refresh();
+ //System.out.println("Running refresh all");
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewResourceAdapterFactory.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewResourceAdapterFactory.java
new file mode 100644
index 00000000000..78e1fb21f9a
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewResourceAdapterFactory.java
@@ -0,0 +1,68 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view.team;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.core.runtime.IAdapterManager;
+import org.eclipse.rse.core.SystemResourceManager;
+import org.eclipse.rse.model.ISystemRegistry;
+
+
+/**
+ * Special adapter factory that maps Remote Systems Framework objects to underlying workbench resources
+ */
+public class SystemTeamViewResourceAdapterFactory implements IAdapterFactory
+{
+ /**
+ * @see IAdapterFactory#getAdapterList()
+ */
+ public Class[] getAdapterList()
+ {
+ return new Class[] {IResource.class};
+ }
+ /**
+ * Called by our plugin's startup method to register our adaptable object types
+ * with the platform. We prefer to do it here to isolate/encapsulate all factory
+ * logic in this one place.
+ */
+ public void registerWithManager(IAdapterManager manager)
+ {
+ manager.registerAdapters(this, ISystemRegistry.class);
+ //manager.registerAdapters(this, SystemProfile.class); DEFERRED UNTIL NEXT RELEASE
+ }
+ /**
+ * @see IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
+ */
+ public Object getAdapter(Object adaptableObject, Class adapterType)
+ {
+ Object adapter = null;
+ if (adaptableObject instanceof ISystemRegistry)
+ {
+ //SystemRegistry sr = (SystemRegistry)adaptableObject;
+ adapter = SystemResourceManager.getRemoteSystemsProject();
+ }
+ /* deferred
+ else if (adaptableObject instanceof SystemProfile)
+ {
+ SystemProfile profile = (SystemProfile)adaptableObject;
+ adapter = SystemResourceManager.getProfileFolder(profile);
+ }*/
+ return adapter;
+ }
+
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewSubSystemFactoryAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewSubSystemFactoryAdapter.java
new file mode 100644
index 00000000000..4bc875d8305
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewSubSystemFactoryAdapter.java
@@ -0,0 +1,309 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view.team;
+
+import java.util.Hashtable;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.core.ISystemUserIdConstants;
+import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
+import org.eclipse.rse.filters.ISystemFilterPoolManager;
+import org.eclipse.rse.model.ISystemProfile;
+import org.eclipse.rse.ui.SystemMenuManager;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.filters.actions.SystemFilterWorkWithFilterPoolsAction;
+import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
+import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
+import org.eclipse.rse.ui.view.SystemViewResources;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.views.properties.PropertyDescriptor;
+
+
+/**
+ * Adapter for displaying and processing SystemTeamViewSubSystemFactoryNode objects in tree views, such as
+ * the Team view.
+ */
+public class SystemTeamViewSubSystemFactoryAdapter
+ extends AbstractSystemViewAdapter
+ implements ISystemViewElementAdapter, ISystemUserIdConstants
+{
+
+ private boolean actionsCreated = false;
+ private Hashtable categoriesByProfile = new Hashtable();
+ private SystemFilterWorkWithFilterPoolsAction wwPoolsAction;
+
+ // -------------------
+ // property descriptors
+ // -------------------
+ private static PropertyDescriptor[] propertyDescriptorArray = null;
+
+
+ /**
+ * Returns any actions that should be contributed to the popup menu
+ * for the given element.
+ * @param menu The menu to contribute actions to
+ * @param selection The window's current selection.
+ * @param shell Shell of viewer
+ * @param menuGroup recommended menu group to add actions to. If added to another group, you must be sure to create that group first.
+ */
+ public void addActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup)
+ {
+ if (!actionsCreated)
+ createActions();
+
+ SystemTeamViewSubSystemFactoryNode ssfNode = (SystemTeamViewSubSystemFactoryNode)selection.getFirstElement();
+ SystemTeamViewCategoryNode category = ssfNode.getParentCategory();
+ String categoryType = category.getMementoHandle();
+
+// FIXME - user actions and compilecmds no longer coupled to core
+// if (categoryType.equals(SystemTeamViewCategoryNode.MEMENTO_USERACTIONS) && ssfNode.getSubSystemFactory().supportsUserDefinedActions())
+// {
+// wwActionsAction.reset();
+// wwActionsAction.setShell(shell);
+// menu.add(menuGroup, wwActionsAction);
+// }
+// else if (categoryType.equals(SystemTeamViewCategoryNode.MEMENTO_COMPILECMDS) && ssfNode.getSubSystemFactory().supportsCompileActions())
+// {
+// wwCmdsAction.reset();
+// wwCmdsAction.setShell(shell);
+// menu.add(menuGroup, wwCmdsAction);
+// }
+ if (categoryType.equals(SystemTeamViewCategoryNode.MEMENTO_FILTERPOOLS) && ssfNode.getSubSystemFactory().supportsFilters())
+ {
+ wwPoolsAction.reset();
+ wwPoolsAction.setShell(shell);
+ wwPoolsAction.setFilterPoolManagerProvider(ssfNode.getSubSystemFactory());
+ ISystemFilterPoolManager[] poolMgrs = new ISystemFilterPoolManager[1];
+ poolMgrs[0] = ssfNode.getSubSystemFactory().getFilterPoolManager(ssfNode.getProfile());
+ wwPoolsAction.setFilterPoolManagers(poolMgrs);
+ menu.add(menuGroup, wwPoolsAction);
+ }
+ }
+ private void createActions()
+ {
+ actionsCreated = true;
+
+// FIXME - user actions and compile actions no longer coupled to core
+// wwActionsAction = new SystemWorkWithUDAsAction(null, true);
+// wwCmdsAction = new SystemWorkWithCompileCommandsAction(null, true);
+ wwPoolsAction = new SystemFilterWorkWithFilterPoolsAction(null, false);
+ }
+
+ /**
+ * Returns an image descriptor for the image. More efficient than getting the image.
+ * @param element The element for which an image is desired
+ */
+ public ImageDescriptor getImageDescriptor(Object element)
+ {
+ return ((SystemTeamViewSubSystemFactoryNode)element).getImageDescriptor();
+ }
+
+ /**
+ * Return the label for this object
+ */
+ public String getText(Object element)
+ {
+ return ((SystemTeamViewSubSystemFactoryNode)element).getLabel();
+ }
+
+ /**
+ * Return the name of this object, which may be different than the display text ({#link #getText(Object)}.
+ *
+ * Called by common rename and delete actions.
+ */
+ public String getName(Object element)
+ {
+ return ((SystemTeamViewSubSystemFactoryNode)element).getLabel();
+ }
+
+ /**
+ * Return the absolute name, versus just display name, of this object
+ */
+ public String getAbsoluteName(Object element)
+ {
+ SystemTeamViewSubSystemFactoryNode factory = (SystemTeamViewSubSystemFactoryNode)element;
+ return factory.getProfile().getName() + "." + factory.getParentCategory().getLabel() + factory.getLabel();
+ }
+
+ /**
+ * Return the type label for this object
+ */
+ public String getType(Object element)
+ {
+ return SystemViewResources.RESID_PROPERTY_TEAM_SSFACTORY_TYPE_VALUE;
+ }
+
+ /**
+ * Return the string to display in the status line when the given object is selected.
+ */
+ public String getStatusLineText(Object element)
+ {
+ SystemTeamViewSubSystemFactoryNode factory = (SystemTeamViewSubSystemFactoryNode)element;
+ return SystemResources.RESID_TEAMVIEW_SUBSYSFACTORY_VALUE + ": " + factory.getLabel();
+ }
+
+ /**
+ * Return the parent of this object. We return the RemoteSystemsConnections project
+ */
+ public Object getParent(Object element)
+ {
+ SystemTeamViewSubSystemFactoryNode factory = (SystemTeamViewSubSystemFactoryNode)element;
+ return factory.getParentCategory();
+ }
+
+ /**
+ * Return the children of this profile.
+ */
+ public Object[] getChildren(Object element)
+ {
+ SystemTeamViewSubSystemFactoryNode ssfNode = (SystemTeamViewSubSystemFactoryNode)element;
+ SystemTeamViewCategoryNode category = ssfNode.getParentCategory();
+ ISystemProfile profile = ssfNode.getProfile();
+ String categoryType = category.getMementoHandle();
+ ISubSystemConfiguration ssf = ssfNode.getSubSystemFactory();
+ if (categoryType.equals(SystemTeamViewCategoryNode.MEMENTO_FILTERPOOLS))
+ {
+ return profile.getFilterPools(ssf);
+ }
+ else if (categoryType.equals(SystemTeamViewCategoryNode.MEMENTO_USERACTIONS))
+ {
+ /* FIXME
+ SystemUDActionElement[] children = profile.getUserActions(ssf);
+ for (int idx=0; idx
+ * If you call the enableAddButton method you must pass an object that implements this interface.
+ * The dialog will call you back when the user presses the Add button, so you can take
+ * appropriate action.
+ */
+public interface ISystemAddListener
+{
+
+
+ /**
+ * The user has pressed the Add button.
+ * Do something appropriate with the request.
+ * If this action fails for some reason, or you wish to display a completion
+ * message, return message text that will be displayed in the dialog's message
+ * line. Else, return null.
+ */
+ public String addButtonPressed(IHost selectedConnection, Object selectedObject);
+ /**
+ * The user has selected an object. Is this field valid to be added?
+ * If so, return null. If not, return a string to display on the
+ * message line indicating why it is not valid, such as it already has
+ * been added
+ */
+ public String okToEnableAddButton(IHost selectedConnection, Object selectedObject);
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/ISystemCollapsableSectionListener.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/ISystemCollapsableSectionListener.java
new file mode 100644
index 00000000000..9b3b82846e2
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/ISystemCollapsableSectionListener.java
@@ -0,0 +1,31 @@
+/********************************************************************************
+ * Copyright (c) 2004, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.widgets;
+
+/**
+ * Listener for collapse / expand events on the SystemCollapsableSection widget.
+ */
+public interface ISystemCollapsableSectionListener {
+
+
+ /**
+ * Notify listeners of a section collapsed or expanded.
+ *
+ * @return true if the section was collapsed, false if the section was expanded.
+ */
+ public void sectionCollapsed(boolean collapsed);
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/ISystemCombo.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/ISystemCombo.java
new file mode 100644
index 00000000000..f5b629ed976
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/ISystemCombo.java
@@ -0,0 +1,96 @@
+/********************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.widgets;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Combo;
+
+
+/**
+ * We have a number of composite widgets that include a combo-box. This
+ * interface enforces some common methods on all of them to make it easier
+ * to code to this in a consistent manner.
+ */
+public interface ISystemCombo
+{
+
+
+
+ /**
+ * Return the embedded combo box widget
+ */
+ public Combo getCombo();
+ /**
+ * Set auto-uppercase. When enabled, all non-quoted values are uppercased when appropriate
+ */
+ public void setAutoUpperCase(boolean enable);
+ /**
+ * Set the width hint for the combo box widget (in pixels).
+ * A rule of thumb is 10 pixels per character, but allow 15 for the litte button on the right.
+ * You must call this versus setting it yourself, else you may see truncation.
+ */
+ public void setWidthHint(int widthHint);
+ /**
+ * Query the combo field's current contents
+ */
+ public String getText();
+ /**
+ * Disable/Enable all the child controls
+ */
+ public void setEnabled(boolean enabled);
+ /**
+ * Set the tooltip text for the combo field
+ */
+ public void setToolTipText(String tip);
+ /**
+ * Set the tooltip text for the history button
+ */
+ public void setButtonToolTipText(String tip);
+ /**
+ * Set the focus to the combo field
+ */
+ public boolean setFocus();
+ /**
+ * Select the combo dropdown list entry at the given index
+ */
+ public void select(int selIdx);
+ /**
+ * Same as {@link #select(int)}
+ */
+ public void setSelectionIndex(int selIdx);
+ /**
+ * Clear the entered/selected contents of the combo box. Clears the text selection and the list selection
+ */
+ public void clearSelection();
+ /**
+ * Clear the entered/selected contents of the combo box. Clears only the text selection, not the list selection
+ */
+ public void clearTextSelection();
+ /**
+ * Get the index number of the currently selected item.
+ */
+ public int getSelectionIndex();
+ /**
+ * Register a listener interested in an item is selected in the combo box
+ * @see #removeSelectionListener(SelectionListener)
+ */
+ public void addSelectionListener(SelectionListener listener);
+ /**
+ * Remove a previously set combo box selection listener.
+ * @see #addSelectionListener(SelectionListener)
+ */
+ public void removeSelectionListener(SelectionListener listener);
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/ISystemEditPaneStates.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/ISystemEditPaneStates.java
new file mode 100644
index 00000000000..4a8171caf25
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/ISystemEditPaneStates.java
@@ -0,0 +1,53 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.widgets;
+/**
+ * @author coulthar
+ *
+ * This interfaces defines the constants for the modes and states
+ * of the {@link org.eclipse.rse.ui.widgets.SystemEditPaneStateMachine}
+ * class.
+ */
+public interface ISystemEditPaneStates
+{
+
+ /**
+ * MODE - UNSET. Nothing is selected so overall edit pane is hidden/disabled
+ */
+ public static final int MODE_UNSET = 2;
+ /**
+ * MODE - NEW. The user is creating a "new" thing
+ */
+ public static final int MODE_NEW = 4;
+ /**
+ * MODE - EDIT. The user is editing an existing thing
+ */
+ public static final int MODE_EDIT = 8;
+
+ /**
+ * STATE - NO CHANGES. No changes have been made by the user
+ */
+ public static final int STATE_INITIAL = 128;
+ /**
+ * STATE - CHANGES PENDING. User has made changes but they haven't been applied yet
+ */
+ public static final int STATE_PENDING = 256;
+ /**
+ * STATE - CHANGES MADE. User has made changes and applied them. None pending
+ */
+ public static final int STATE_APPLIED = 512;
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/InheritButton.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/InheritButton.java
new file mode 100644
index 00000000000..2c7e6a183f8
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/InheritButton.java
@@ -0,0 +1,240 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.widgets;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleAdapter;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+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.Display;
+
+/**
+ * An InheritButton is a specialized control that
+ * wraps a push button control with two states:
+ * "inherit" and "local". The initial state is "inherit". The button is
+ * painted with arrowhead image that points either left or right if the
+ * button is in "inherit" or "local" state respectively.
+ *
+ * Pressing the button will trigger a SelectionEvent which the client
+ * can listen for. Typically the client will use this to change the
+ * button state.
+ *
+ * An InheritButton is assumed to exist inside a composite control with a GridLayout.
+ * There is no need to set its layout data unless you wish to override the
+ * default characteristics.
+ *
+ * Although this control extends Composite, it does not make sense to
+ * add children to this control or to set a layout on it.
+ */
+public class InheritButton extends Composite {
+
+ /**
+ * Value is 12 pixels.
+ */
+ public static final int DEFAULT_WIDTH = 12;
+
+ /**
+ * Value is 20 pixels.
+ */
+ public static final int DEFAULT_HEIGHT = 20;
+
+ private Image leftArrow = null; // arrow points left, value is inherited
+ private Image rightArrow = null; // arrow points right, value is the local value
+ private boolean isLocal = false; // default is "inherit"
+ private Button toggle = null;
+
+ /**
+ * Create a new InheritButton.
+ * @param parent
+ */
+ public InheritButton(Composite parent) {
+ super(parent, SWT.NONE);
+ GridData data = new GridData(SWT.CENTER, SWT.CENTER, false, false);
+ data.widthHint = DEFAULT_WIDTH;
+ data.heightHint = DEFAULT_HEIGHT;
+ setLayoutData(data);
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ setLayout(layout);
+ initializeToggle(this);
+ }
+
+ private void initializeToggle(Composite parent) {
+ toggle = new Button(parent, SWT.PUSH);
+ createToggleImages(toggle.getBackground());
+ toggle.getAccessible().addAccessibleListener(new AccessibleAdapter() {
+ public void getHelp(AccessibleEvent e) { // this is the one that should supply the text heard.
+ e.result = getToolTipText();
+ }
+ public void getName(AccessibleEvent e) { // this is the one that apparently does supply the text heard.
+ e.result = getToolTipText();
+ }
+ });
+ toggle.addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent e) {
+ disposeToggleImages();
+ }
+ });
+ toggle.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ setToggleImage();
+ }
+
+ /**
+ * Set the inherit/local state.
+ * In the "local" state, the arrow image points to the right.
+ * In the "inherit" state, the arrow image points to the left.
+ * @param isLocal true if the button should be in "local" state. false if the
+ * button should be in "inherit" state.
+ */
+ public void setLocal(boolean isLocal) {
+ this.isLocal = isLocal;
+ setToggleImage();
+ }
+
+ /**
+ * Query the inherit/local state.
+ * @return true if the button is in local state
+ */
+ public boolean isLocal() {
+ return isLocal;
+ }
+
+ /**
+ * Register a listener interested in when the button is pressed.
+ *
+ * @see InheritButton#removeSelectionListener(SelectionListener)
+ */
+ public void addSelectionListener(SelectionListener listener) {
+ if (toggle == null) return;
+ toggle.addSelectionListener(listener);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.widgets.Control#addKeyListener(org.eclipse.swt.events.KeyListener)
+ */
+ public void addKeyListener(KeyListener listener) {
+ if (toggle == null) return;
+ toggle.addKeyListener(listener);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.widgets.Control#removeKeyListener(org.eclipse.swt.events.KeyListener)
+ */
+ public void removeKeyListener(KeyListener listener) {
+ if (toggle == null) return;
+ toggle.removeKeyListener(listener);
+ }
+
+ /**
+ * Remove a previously set selection listener.
+ * @see InheritButton#addSelectionListener(SelectionListener)
+ */
+ public void removeSelectionListener(SelectionListener listener) {
+ if (toggle == null) return;
+ toggle.removeSelectionListener(listener);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.widgets.Control#setFocus()
+ */
+ public boolean setFocus() {
+ return toggle.setFocus();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.widgets.Control#isFocusControl()
+ */
+ public boolean isFocusControl() {
+ return toggle.isFocusControl();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.widgets.Control#setToolTipText(java.lang.String)
+ */
+ public void setToolTipText(String string) {
+ toggle.setToolTipText(string);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.widgets.Control#getToolTipText()
+ */
+ public String getToolTipText() {
+ return toggle.getToolTipText();
+ }
+
+ /**
+ * Places the correct graphic on the button depending on the current
+ * button state.
+ * In the "local" state, the arrow image points to the right.
+ * In the "inherit" state, the arrow image points to the left.
+ */
+ private void setToggleImage() {
+ toggle.setImage(isLocal ? rightArrow : leftArrow);
+ }
+
+ /**
+ * Creates the images used for the button graphics. This should be done
+ * when the button is created.
+ * @param backgroundColor The background color with which the arrow images
+ * should be painted. The foreground color is black.
+ */
+ private void createToggleImages(Color backgroundColor) {
+ Display display = Display.getCurrent();
+ GC gc = null;
+ if (display != null) {
+ leftArrow = new Image(display, 3, 5);
+ gc = new GC(leftArrow);
+ gc.setBackground(backgroundColor);
+ gc.fillRectangle(leftArrow.getBounds());
+ gc.setForeground(display.getSystemColor(SWT.COLOR_BLACK));
+ gc.drawLine(0, 2, 0, 2);
+ gc.drawLine(1, 1, 1, 3);
+ gc.drawLine(2, 0, 2, 4);
+ gc.dispose();
+ rightArrow = new Image(display, 3, 5);
+ gc = new GC(rightArrow);
+ gc.setBackground(backgroundColor);
+ gc.fillRectangle(rightArrow.getBounds());
+ gc.setForeground(display.getSystemColor(SWT.COLOR_BLACK));
+ gc.drawLine(0, 0, 0, 4);
+ gc.drawLine(1, 1, 1, 3);
+ gc.drawLine(2, 2, 2, 2);
+ gc.dispose();
+ }
+ }
+
+ /**
+ * Dispose of the images used for the arrow graphics. Should be invoked
+ * when the button is disposed.
+ */
+ private void disposeToggleImages() {
+ if (leftArrow != null) leftArrow.dispose();
+ if (rightArrow != null) rightArrow.dispose();
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/InheritControl.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/InheritControl.java
new file mode 100644
index 00000000000..f7e4c3e8acd
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/InheritControl.java
@@ -0,0 +1,217 @@
+/********************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.widgets;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.TypedListener;
+
+/**
+ * A widget like the old ET/400 inherit/override widget.
+ * There are left and right arrows beside each other.
+ * Typically, clicking on left means to inherit from parent,
+ * clicking on right means to override locally.
+ * However, the control can be used for any binary decision!
+ * THIS IS NOT USED AND NOT WORKING. USE INHERITABLEENTRYFIELD INSTEAD
+ *
+ * @deprecated
+ * @see org.eclipse.rse.ui.widgets.InheritableEntryField
+ */
+public class InheritControl
+ extends Composite
+{
+ private Image local,interim,inherit;
+ private Button button;
+ private boolean isLocal=false;
+ /**
+ * Constructor.
+ * @param parent Composite to place this widget into
+ * @param style Widget style. Passed on to
+ * {@link org.eclipse.swt.widgets.Composite#Composite(org.eclipse.swt.widgets.Composite, int) constructor} of parent class Composite
+ */
+ public InheritControl(Composite parent, int style)
+ {
+ super(parent, style);
+ setLayout(new InheritControlLayout());
+ //Class c = InheritControl.class;
+ //String imagePath = "icons" + java.io.File.separatorChar;
+ SystemPlugin sp = SystemPlugin.getDefault();
+ try
+ {
+ //ImageData source = new ImageData(c.getResourceAsStream (imagePath+"local.gif"));
+ /*
+ Image image = sp.getImage(ISystemConstants.ICON_INHERITWIDGET_LOCAL_ID);
+ ImageData source = image.getImageData();
+ ImageData mask = source.getTransparencyMask();
+ //local = new Image (null, source, mask);
+ local = image;
+
+ image = sp.getImage(ISystemConstants.ICON_INHERITWIDGET_INHERIT_ID);
+ source = image.getImageData();
+ //source = new ImageData(c.getResourceAsStream (imagePath+"inherit.gif"));
+ mask = source.getTransparencyMask();
+ //inherit = new Image (null, source, mask);
+ inherit = image;
+
+ // don't know how to add third state, and don't really
+ // need it for Button. Could use it if we implement as Label ....
+ //source = new ImageData(c.getResourceAsStream (imagePath+"interim.gif"));
+ image = sp.getImage(ISystemConstants.ICON_INHERITWIDGET_INTERIM_ID);
+ source = image.getImageData();
+ mask = source.getTransparencyMask();
+ //interim = new Image (null, source, mask);
+ interim = image;
+ */
+ } catch (Throwable ex)
+ {
+ System.out.println ("failed to load images");
+ ex.printStackTrace();
+ }
+ button=new Button(this,style);
+ setLocal(true);
+ addDisposeListener(new DisposeListener()
+ {
+ public void widgetDisposed(DisposeEvent e)
+ {
+ // dispose of created resources!
+ InheritControl.this.widgetDisposed(e);
+ }
+ });
+ // Add the button listener
+ SelectionListener selectionListener = new SelectionAdapter()
+ {
+ public void widgetSelected(SelectionEvent event)
+ {
+ setLocal(!isLocal());
+ notifyListeners(SWT.Selection, new Event());
+ };
+ };
+ button.addSelectionListener(selectionListener);
+ }
+ /**
+ * Add a listener that is called whenever the left or right side is selected.
+ *
+ * Call {@link #isLocal()} to determine if left (false) or right (true) was pressed.
+ * @see #addSelectionListener(SelectionListener)
+ */
+ public void addSelectionListener(SelectionListener listener)
+ {
+ addListener(SWT.Selection, new TypedListener(listener));
+ }
+ /**
+ * Returns true if the right-side is selected, false if the left is selected
+ */
+ public boolean isLocal()
+ {
+ return isLocal;
+ }
+ /**
+ * Remove a previously set selection listener.
+ * @see #addSelectionListener(SelectionListener)
+ */
+ public void removeSelectionListener(SelectionListener listener)
+ {
+ removeListener(SWT.Selection, listener);
+ }
+ /**
+ * Programmatically select left (false) or right/local (true) arrow.
+ */
+ public void setLocal(boolean l)
+ {
+ isLocal=l;
+ button.setImage(isLocal?local:inherit);
+ }
+ /**
+ * Set tooltip text (hover help)
+ */
+ public void setToolTipText(String tip)
+ {
+ button.setToolTipText(tip);
+ }
+ /**
+ * Private hook called by system when this widget is disposed.
+ */
+ public void widgetDisposed(DisposeEvent e)
+ {
+ if (local!=null)
+ local.dispose();
+ if (interim!=null)
+ interim.dispose();
+ if (inherit!=null)
+ inherit.dispose();
+ }
+ /*
+ public static void main(String[] args)
+ {
+ // Example on how to use widget
+ final InheritControl c1,c2,c3;
+ final Text text1,text2,text3;
+ Display display = new Display();
+ Shell shell = new Shell();
+ GridLayout g=new GridLayout();
+ g.numColumns=2;
+ shell.setLayout(g);
+ c1=new InheritControl(shell,SWT.NULL);
+ text1 = new Text (shell, SWT.BORDER);
+ c2=new InheritControl(shell,SWT.NULL);
+ text2 = new Text (shell, SWT.BORDER);
+ c3=new InheritControl(shell,SWT.NULL);
+ text3 = new Text (shell, SWT.BORDER);
+ Button b1=new Button(shell,SWT.NULL);
+ b1.setText("Normal button ....");
+ //Add listeners:
+ c1.addSelectionListener(new SelectionAdapter()
+ {
+ public void widgetSelected(SelectionEvent event)
+ {
+ text1.setEnabled(c1.isLocal);
+ };
+ });
+ c2.addSelectionListener(new SelectionAdapter()
+ {
+ public void widgetSelected(SelectionEvent event)
+ {
+ text2.setEnabled(c2.isLocal);
+ };
+ });
+ c3.addSelectionListener(new SelectionAdapter()
+ {
+ public void widgetSelected(SelectionEvent event)
+ {
+ text3.setEnabled(c3.isLocal);
+ };
+ });
+ shell.pack();
+ shell.open();
+ // Event loop
+ while (! shell.isDisposed())
+ {
+ if (! display.readAndDispatch()) display.sleep();
+ }
+ display.dispose();
+ System.exit(0);
+ }
+ */
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/InheritControlLayout.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/InheritControlLayout.java
new file mode 100644
index 00000000000..ca002ff0c4a
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/InheritControlLayout.java
@@ -0,0 +1,44 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.widgets;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Layout;
+
+public class InheritControlLayout extends Layout
+{
+ private Point iExtent; // the cached size
+
+ protected Point computeSize(Composite composite, int wHint, int hHint, boolean changed)
+ {
+ Control [] children = composite.getChildren();
+ if (changed || (iExtent == null) )
+ //iExtent = children[0].computeSize(SWT.DEFAULT, SWT.DEFAULT, false);
+ iExtent = children[0].computeSize(wHint, hHint, true);
+ return new Point(iExtent.x, iExtent.y);
+ }
+ protected void layout(Composite composite, boolean changed)
+ {
+ Control [] children = composite.getChildren();
+ if (changed || (iExtent == null) )
+ iExtent = children[0].computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
+ children[0].setBounds(0, 0, iExtent.x, iExtent.y);
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/InheritableEntryField.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/InheritableEntryField.java
new file mode 100644
index 00000000000..aaa0e9cd3c2
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/InheritableEntryField.java
@@ -0,0 +1,345 @@
+/********************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.widgets;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+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.Composite;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * This is an entry which allows the user to decide whether to
+ * inherit a parent value or type in his own local value.
+ *
+ * To accomplish this, we create a composite containing a toggle button
+ * followed by an entry field.
+ *
+ * The toggle button has left and right arrows.
+ * Typically, an arrow pointing to the left means to inherit from parent,
+ * and pointing to the right means to override locally.
+ * However, the control can be used for any binary decision!
+ *
+ * Although this control inherits from Composite it does not make sense to
+ * set a layout for it or to add children to it.
+ */
+/*
+ * dwd: modified for defect 57974 (accessibility problems)
+ * Formatted source and organized imports.
+ * Removed all references to InheritControl.
+ * Changed button from SWT.ARROW to SWT.PUSH. SWT.ARROW buttons are not accessible.
+ * Simplified internal call structure complicated by case handling for InheritControl.
+ */
+public class InheritableEntryField extends Composite implements KeyListener {
+ private InheritButton toggleButton = null;
+ private Text entryField = null;
+ private String inheritValue = "";
+ private String localValue = "";
+ private boolean isLocal = true;
+ private boolean allowEditOfInherited = false;
+
+ /**
+ * Constructor
+ * @param parent The parent composite to hold this widget
+ * @param style the SWT style for this widget (eg, SWT.BORDER or SWT.NULL)
+ */
+ public InheritableEntryField(Composite parent, int style) {
+ this(parent, style, SWT.NULL, SWT.SINGLE | SWT.BORDER, true);
+ }
+
+ /**
+ * Constructor when you want to set the style of the toggle button and entry field too.
+ * @param parent The parent composite to hold this widget
+ * @param style the SWT style for this overall widget (eg, SWT.BORDER or SWT.NULL)
+ * @param style the SWT style for the toggle button widget
+ * @param style the SWT style for the entry field widget
+ */
+ public InheritableEntryField(Composite parent, int style, int buttonStyle, int textStyle) {
+ this(parent, style, buttonStyle, textStyle, true);
+ }
+
+ /**
+ * Constructor when you want to hide the toggle button
+ * @param parent The parent composite to hold this widget
+ * @param style the SWT style for this overall widget (eg, SWT.BORDER or SWT.NULL)
+ * @param style the SWT style for the toggle button widget
+ * @param style the SWT style for the entry field widget
+ * @param showToggleButton true to show the toggle button, false not to
+ */
+ public InheritableEntryField(Composite parent, int style, int buttonStyle, int textStyle, boolean showToggleButton) {
+ super(parent, style);
+ prepareComposite(2);
+ if (showToggleButton) {
+ createToggleButton(this, buttonStyle);
+ }
+ createTextField(this, textStyle);
+ setLocal(true); // default state
+ }
+
+ /**
+ * Toggle the inherit/local state.
+ * It is important that you have already called setLocalText and setInheritedText
+ */
+ public void setLocal(boolean local) {
+ boolean wasLocal = isLocal;
+ isLocal = local;
+ if (isLocal) { // from inherit to local
+ if (allowEditOfInherited && !wasLocal) inheritValue = entryField.getText();
+ entryField.setEnabled(true);
+ entryField.setText(localValue);
+ } else { // from local to inherit
+ if (wasLocal) // if this is actually a toggle
+ localValue = entryField.getText(); // remember what old local value was
+ entryField.setText(inheritValue);
+ entryField.setEnabled(allowEditOfInherited);
+ }
+ if (toggleButton != null) {
+ toggleButton.setLocal(isLocal);
+ }
+ }
+
+ /**
+ * Query the inherit/local state
+ */
+ public boolean isLocal() {
+ return isLocal;
+ }
+
+ /**
+ * Specify if user is allowed to edit the inherited text. Default is false.
+ */
+ public void setAllowEditingOfInheritedText(boolean allow) {
+ allowEditOfInherited = allow;
+ }
+
+ /**
+ * Set the entry field's inherited text value
+ */
+ public void setInheritedText(String text) {
+ if (text == null) text = "";
+ this.inheritValue = text;
+ }
+
+ /**
+ * Query the entry field's inherited text value.
+ * If widget is in inherit mode, returns entry field contents, else returns cached value
+ */
+ public String getInheritedText() {
+ if (!isLocal)
+ return entryField.getText();
+ else
+ return inheritValue;
+ }
+
+ /**
+ * Set the entry field's local text value
+ */
+ public void setLocalText(String text) {
+ if (text == null) text = "";
+ this.localValue = text;
+ }
+
+ /**
+ * Query the entry field's local text value.
+ * If widget is in local mode, returns entry field contents, else returns "".
+ */
+ public String getLocalText() {
+ if (isLocal)
+ return entryField.getText();
+ else
+ return "";
+ }
+
+ /**
+ * Query the entry field's current contents, regardless of local/inherit state
+ */
+ public String getText() {
+ return entryField.getText();
+ }
+
+ /**
+ * Return a reference to the entry field
+ */
+ public Text getTextField() {
+ return entryField;
+ }
+
+ /**
+ * Return the toggle button
+ */
+ public InheritButton getToggleButton() {
+ return toggleButton;
+ }
+
+ /**
+ * Disable the toggle. Used when there is no inherited value
+ */
+ public void setToggleEnabled(boolean enabled) {
+ if (toggleButton == null) return;
+ toggleButton.setEnabled(enabled);
+ }
+
+ /**
+ * Set the tooltip text for the toggle button
+ */
+ public void setToggleToolTipText(String tip) {
+ if (toggleButton == null) return;
+ toggleButton.setToolTipText(tip);
+ }
+
+ /**
+ * Set the tooltip text for the entry field
+ */
+ public void setTextFieldToolTipText(String tip) {
+ entryField.setToolTipText(tip);
+ }
+
+ /**
+ * Set the entry field's text limit
+ */
+ public void setTextLimit(int limit) {
+ entryField.setTextLimit(limit);
+ }
+
+ /**
+ * Set the focus to the toggle button
+ */
+ public void setToggleButtonFocus() {
+ if (toggleButton == null) return;
+ toggleButton.setFocus();
+ }
+
+ /**
+ * Set the focus to the entry field
+ */
+ public void setTextFieldFocus() {
+ entryField.setFocus();
+ }
+
+ /**
+ * Register a listener interested in when the button is toggled
+ *
+ * Call {@link #isLocal()} to determine if left (false) or right (true) was pressed.
+ * @see #removeSelectionListener(SelectionListener)
+ */
+ public void addSelectionListener(SelectionListener listener) {
+ if (toggleButton == null) return;
+ toggleButton.addSelectionListener(listener);
+ }
+
+ /**
+ * Remove a previously set toggle button selection listener.
+ * @see #addSelectionListener(SelectionListener)
+ */
+ public void removeSelectionListener(SelectionListener listener) {
+ if (toggleButton == null) return;
+ toggleButton.removeSelectionListener(listener);
+ }
+
+ /**
+ * Register a listener interested in entry field modify events
+ *
+ * @see #removeModifyListener(ModifyListener)
+ */
+ public void addModifyListener(ModifyListener listener) {
+ entryField.addModifyListener(listener);
+ }
+
+ /**
+ * Remove a previously set entry field listener.
+ * @see #addModifyListener(ModifyListener)
+ */
+ public void removeModifyListener(ModifyListener listener) {
+ entryField.removeModifyListener(listener);
+ }
+
+ // -----------------------
+ // INTERNAL-USE METHODS...
+ // -----------------------
+ /**
+ * Prepares this composite control and sets the default layout data.
+ * @param Number of columns the new group will contain.
+ */
+ protected Composite prepareComposite(int numColumns) {
+ Composite composite = this;
+ //GridLayout
+ GridLayout layout = new GridLayout();
+ layout.numColumns = numColumns;
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ layout.horizontalSpacing = 0;
+ composite.setLayout(layout);
+ //GridData
+ GridData data = new GridData();
+ data.verticalAlignment = GridData.FILL;
+ data.horizontalAlignment = GridData.FILL;
+ data.grabExcessHorizontalSpace = true;
+ composite.setLayoutData(data);
+ return composite;
+ }
+
+ /**
+ * Create our text field and insert it into a GridLayout.
+ * Assign the listener to the passed in implementer of Listener.
+ * @param GridLayout composite to put the field into.
+ */
+ protected void createTextField(Composite parent, int textStyle) {
+ entryField = new Text(parent, textStyle);
+ GridData data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ data.grabExcessHorizontalSpace = true;
+ data.widthHint = 150;
+ data.verticalAlignment = GridData.CENTER;
+ data.grabExcessVerticalSpace = false;
+ entryField.setLayoutData(data);
+ entryField.addKeyListener(this);
+ }
+
+ protected void createToggleButton(Composite parent, int buttonStyle) {
+ toggleButton = new InheritButton(parent);
+ toggleButton.addKeyListener(this);
+ toggleButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ setLocal(!isLocal());
+ }
+ });
+ }
+
+ public void setToggleButtonHeight(int height) {
+ if (toggleButton == null) return;
+ ((GridData) toggleButton.getLayoutData()).heightHint = height;
+ ((GridData) toggleButton.getLayoutData()).grabExcessVerticalSpace = false;
+ ((GridData) toggleButton.getLayoutData()).verticalAlignment = GridData.VERTICAL_ALIGN_BEGINNING;
+ }
+
+ public void keyPressed(KeyEvent e) {
+ }
+
+ public void keyReleased(KeyEvent e) {
+ if ((e.stateMask == SWT.CTRL) && (e.keyCode == SWT.ARROW_LEFT) && isLocal()) {
+ setLocal(false);
+ } else if ((e.stateMask == SWT.CTRL) && (e.keyCode == SWT.ARROW_RIGHT) && !isLocal()) {
+ setLocal(true);
+ }
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SSLForm.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SSLForm.java
new file mode 100644
index 00000000000..e07f267dbfa
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SSLForm.java
@@ -0,0 +1,94 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.widgets;
+
+import org.eclipse.rse.ui.SystemBaseForm;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.SystemWidgetHelpers;
+import org.eclipse.rse.ui.messages.ISystemMessageLine;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+
+
+/**
+ * This class provides a reusable widget for selecting whether or not
+ * a communications connection should use SSL
+ */
+public class SSLForm extends SystemBaseForm {
+
+
+ private Button _sslCheckBox;
+
+ /**
+ * Constructor for SSLForm.
+ * @param msgLine
+ */
+ public SSLForm(ISystemMessageLine msgLine) {
+ super(null, msgLine); // null is the shell.
+ }
+
+ /**
+ * Determines whether ssl is checked or not
+ * @return
+ */
+ public boolean isChecked()
+ {
+ return _sslCheckBox.getSelection();
+ }
+
+
+ /**
+ * Check/uncheck the ssl checkbox
+ * @param flag
+ */
+ public void setIsChecked(boolean flag)
+ {
+ _sslCheckBox.setSelection(flag);
+ }
+
+ /**
+ * Enable/disable the ssl checkbox
+ * @param flag
+ */
+ public void enableCheckBox(boolean flag)
+ {
+ _sslCheckBox.setEnabled(flag);
+ }
+
+ /**
+ * @see org.eclipse.rse.ui.SystemBaseForm#createContents(Composite)
+ */
+ public Control createContents(Composite parent)
+ {
+ super.setShell(parent.getShell());
+ _sslCheckBox = SystemWidgetHelpers.createCheckBox(parent, SystemResources.RESID_SUBSYSTEM_SSL_LABEL, this);
+ _sslCheckBox.setToolTipText(SystemResources.RESID_SUBSYSTEM_SSL_TIP);
+
+
+ return _sslCheckBox;
+ }
+
+
+
+ public void handleEvent(Event evt)
+ {
+
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/ServerConnectionSecurityForm.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/ServerConnectionSecurityForm.java
new file mode 100644
index 00000000000..6f679d3a7e0
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/ServerConnectionSecurityForm.java
@@ -0,0 +1,87 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+
+package org.eclipse.rse.ui.widgets;
+
+
+import org.eclipse.rse.ui.SystemBaseForm;
+import org.eclipse.rse.ui.messages.ISystemMessageLine;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+
+public class ServerConnectionSecurityForm extends SystemBaseForm
+{
+
+
+
+ private SSLForm _sslForm;
+
+ private ISystemMessageLine _msgLine;
+
+ public ServerConnectionSecurityForm(Shell shell, ISystemMessageLine msgLine)
+ {
+ super(shell, msgLine);
+ _msgLine = msgLine;
+ }
+
+ public void disable()
+ {
+ _sslForm.enableCheckBox(false);
+ }
+
+ public void enable()
+ {
+ _sslForm.enableCheckBox(true);
+ }
+
+ /**
+ * @see org.eclipse.rse.ui.SystemBaseForm#createContents(Composite)
+ */
+ public Control createContents(Composite parent)
+ {
+
+ _sslForm = new SSLForm(_msgLine);
+ _sslForm.createContents(parent);
+
+ // help
+
+ // initialization
+ initDefaults();
+ return parent;
+ }
+
+ private void initDefaults()
+ {
+ // pull info from preferences and/or persistance model
+
+ }
+
+
+ public void setUseSSL(boolean flag)
+ {
+ _sslForm.setIsChecked(flag);
+ }
+
+ public boolean getUseSSL()
+ {
+ return _sslForm.isChecked();
+ }
+
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemCollapsableSection.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemCollapsableSection.java
new file mode 100644
index 00000000000..4e83703897d
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemCollapsableSection.java
@@ -0,0 +1,441 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.widgets;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Layout;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * Class to provide a collapsible composite that can be collapsed
+ * to hide some controls
+ */
+public class SystemCollapsableSection extends Composite implements MouseListener, PaintListener
+{
+
+ public static final String Copyright =
+ "(C) Copyright IBM Corp. 2002, 2003. All Rights Reserved.";
+
+ protected boolean _bCollapsed = false;
+ protected boolean _bMouseOver = false;
+ protected Composite _compositePage = null;
+ protected String _strText = null;
+ protected String _strExpandedText = null;
+ protected String _strCollapsedText = null;
+ protected String _strExpandedToolTip = null;
+ protected String _strCollapsedToolTip = null;
+ protected Label _labelTitle = null;
+
+ protected static Color _colorCollapsable = null;
+
+ // yantzi: added so we can have a collapse / expand action in the iSeries table view for
+ // accessability reasons.
+ private List listeners = new ArrayList(5);
+
+ /**
+ *
+ */
+ protected class RTwisteeLayout extends Layout
+ {
+
+ /**
+ *
+ */
+ protected Point computeSize(
+ Composite composite,
+ int wHint,
+ int hHint,
+ boolean flushCache)
+ {
+ checkWidget();
+
+ Point ptSize = getTitleSize(_strText);
+ Point ptPageSize =
+ _compositePage.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
+
+ ptSize.x = Math.max(ptSize.x, ptPageSize.x + 8);
+
+ if (_bCollapsed == false)
+ ptSize.y += ptPageSize.y;
+
+ return ptSize;
+ }
+
+ /**
+ * Layout.
+ */
+ protected void layout(Composite composite, boolean flushCache)
+ {
+ Point ptTitleSize = getTitleSize(_strText);
+ Point ptLocation = getLocation();
+
+ if (_bCollapsed == true)
+ {
+ Rectangle rectClient = getClientArea();
+ Point ptPageSize =
+ new Point(
+ rectClient.width - 16,
+ rectClient.height - ptTitleSize.y);
+ _compositePage.setBounds(16, ptTitleSize.y, ptPageSize.x, 4);
+ setSize(
+ Math.max(ptTitleSize.x, ptPageSize.x + 16),
+ ptTitleSize.y);
+ }
+
+ else
+ {
+ Rectangle rectClient = getClientArea();
+ Point ptPageSize =
+ new Point(
+ rectClient.width - 16,
+ rectClient.height - ptTitleSize.y);
+ // Point ptPageSize = _compositePage.computeSize( SWT.DEFAULT, SWT.DEFAULT, true );
+ _compositePage.setBounds(
+ 16,
+ ptTitleSize.y,
+ ptPageSize.x,
+ ptPageSize.y);
+ setSize(
+ Math.max(ptTitleSize.x, ptPageSize.x + 16),
+ ptTitleSize.y + ptPageSize.y);
+ }
+ }
+ }
+
+ /**
+ * Constructor
+ */
+ public SystemCollapsableSection(Composite compositeParent)
+ {
+
+ super(compositeParent, SWT.NULL);
+
+ if (_colorCollapsable == null)
+ {
+ Display display = Display.getCurrent();
+ _colorCollapsable = new Color(display, 0, 140, 140);
+ }
+
+ setLayout(new RTwisteeLayout());
+
+ // Page content
+ //-------------
+ _compositePage = new Composite(this, SWT.NULL);
+
+ GridData gridData = new GridData();
+ setLayoutData(gridData);
+
+ addPaintListener(this);
+ addMouseListener(this);
+ }
+
+ /**
+ * Get the actual composite inside the collapsible section to
+ * be usde for filling it up with controls
+ */
+ public Composite getPageComposite()
+ {
+ return _compositePage;
+ }
+
+ /**
+ * Compute the title area size.
+ */
+ private Point getTitleSize(String strText)
+ {
+
+ if (strText == null || strText.length() == 0)
+ {
+ strText = "MMMMMMMMMMMM";
+ }
+
+ GC gc = new GC(this);
+
+ Point ptSize = gc.textExtent(strText);
+ ptSize.y = Math.max(ptSize.y, gc.getFontMetrics().getHeight());
+
+ ptSize.x += 20;
+ ptSize.y = Math.max(ptSize.y, 20);
+
+ gc.dispose();
+
+ return ptSize;
+ }
+
+ /**
+ * Return the collapse state
+ */
+ public boolean getCollapsed()
+ {
+ return _bCollapsed;
+ }
+
+ /**
+ * Get the default title text
+ */
+ public String getText()
+ {
+ return _strText;
+ }
+
+ /**
+ *
+ */
+ public void mouseDoubleClick(MouseEvent e)
+ {
+
+ }
+
+ /**
+ *
+ */
+ public void mouseDown(MouseEvent e)
+ {
+
+ }
+
+ /**
+ * Handle the collapse or expand request from the mouse up event
+ */
+ public void mouseUp(MouseEvent e)
+ {
+
+ _bCollapsed = _bCollapsed == true ? false : true;
+
+ if (_bCollapsed)
+ {
+ setToolTipText(_strCollapsedToolTip);
+ }
+ else
+ {
+ setToolTipText(_strExpandedToolTip);
+ }
+
+ List list = new ArrayList();
+
+ Composite compositeParent = this;
+
+ do
+ {
+ list.add(compositeParent);
+ compositeParent = compositeParent.getParent();
+ }
+ while (compositeParent instanceof Shell == false);
+
+ for (int i = list.size() - 1; i >= 0; --i)
+ {
+ compositeParent = (Composite) list.get(i);
+ compositeParent.layout();
+ }
+
+ fireCollapseEvent(_bCollapsed);
+ // composite.redraw();
+ }
+
+ /**
+ * Paint the control
+ */
+ public void paintControl(PaintEvent e)
+ {
+
+ paintCollapsable(e.gc, 0, 2, _bCollapsed);
+
+ if (_bCollapsed)
+ {
+ setToolTipText(_strCollapsedToolTip);
+ if (_strCollapsedText != null)
+ _strText = _strCollapsedText;
+ }
+ else
+ {
+ setToolTipText(_strExpandedToolTip);
+ if (_strExpandedText != null)
+ _strText = _strExpandedText;
+ }
+
+ if (_strText == null)
+ return;
+
+ e.gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_BLACK));
+ e.gc.drawString(_strText, 17, 0, true);
+ }
+
+ /**
+ * Paints the two states of a collapsable indicator of a collapsable container.
+ */
+ public static void paintCollapsable(
+ GC gc,
+ int iX,
+ int iY,
+ boolean bCollapsed)
+ {
+
+ // Not collapsed: v
+ //-----------------
+
+ if (bCollapsed == false)
+ {
+ gc.setForeground(_colorCollapsable);
+
+ int iA = iX;
+ int iB = iY + 3;
+ gc.drawLine(iA, iB, iA + 10, iB);
+ iA++;
+ iB++;
+ gc.drawLine(iA, iB, iA + 8, iB);
+ iA++;
+ iB++;
+ gc.drawLine(iA, iB, iA + 6, iB);
+ iA++;
+ iB++;
+ gc.drawLine(iA, iB, iA + 4, iB);
+ iA++;
+ iB++;
+ gc.drawLine(iA, iB, iA + 2, iB);
+ iA++;
+ iB++;
+ gc.drawLine(iA, iB, iA, iB);
+
+ iA = iX;
+ iB = iY;
+ }
+
+ // Collapsed: >
+ //-------------
+ else
+ {
+ gc.setForeground(_colorCollapsable);
+
+ int iA = iX + 2;
+ int iB = iY;
+
+ gc.drawLine(iA, iB, iA, iB + 10);
+ iA++;
+ iB++;
+ gc.drawLine(iA, iB, iA, iB + 8);
+ iA++;
+ iB++;
+ gc.drawLine(iA, iB, iA, iB + 6);
+ iA++;
+ iB++;
+ gc.drawLine(iA, iB, iA, iB + 4);
+ iA++;
+ iB++;
+ gc.drawLine(iA, iB, iA, iB + 2);
+ iA++;
+ iB++;
+ gc.drawLine(iA, iB, iA, iB);
+ }
+ }
+
+ /**
+ * Set the section to be collapsed
+ */
+ public void setCollapsed(boolean bCollapsed)
+ {
+
+ _bCollapsed = bCollapsed;
+ if (_bCollapsed)
+ setToolTipText(_strCollapsedToolTip);
+ else
+ setToolTipText(_strExpandedToolTip);
+
+ redraw();
+
+ fireCollapseEvent(bCollapsed);
+ }
+
+ /**
+ * Set the default text title
+ */
+ public void setText(String strText)
+ {
+ _strText = strText;
+ redraw();
+ }
+ /**
+ * Set the title to be displayed when the section is expanded
+ */
+ public void setExpandedText(String strText)
+ {
+ _strExpandedText = strText;
+ }
+ /**
+ * Set the title to be displayed when the section is collapsed
+ */
+ public void setCollapsedText(String strText)
+ {
+ _strCollapsedText = strText;
+ }
+
+ /**
+ * Set the two tooltips used in expanded state and collapsed state
+ * @param String - tooltip for the expanded state. e.g. Click line to collapse the section
+ * @param String - tooltip for the collapsed state. e.g. Click line to expand the section
+ */
+ public void setToolTips(String strExpandedToolTip, String strCollapsedToolTip)
+ {
+ _strCollapsedToolTip = strCollapsedToolTip;
+ _strExpandedToolTip = strExpandedToolTip;
+ }
+
+ /**
+ * Add a collapse / expand event listener
+ */
+ public void addCollapseListener(ISystemCollapsableSectionListener listener)
+ {
+ if (!listeners.contains(listener))
+ {
+ listeners.add(listener);
+ }
+ }
+
+ /**
+ * Remove a collapse / expand event listener
+ */
+ public void removeCollapseListener(ISystemCollapsableSectionListener listener)
+ {
+ listeners.remove(listener);
+ }
+
+ /**
+ * Notify collapse / expand listeners of an event
+ */
+ private void fireCollapseEvent(boolean collapsed)
+ {
+ for (int i = 0; i < listeners.size(); i++)
+ {
+ ((ISystemCollapsableSectionListener) listeners.get(i)).sectionCollapsed(collapsed);
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemEditPaneStateMachine.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemEditPaneStateMachine.java
new file mode 100644
index 00000000000..6a2ff5aad2a
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemEditPaneStateMachine.java
@@ -0,0 +1,451 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.widgets;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.messages.SystemMessageDialog;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+
+
+/**
+ * @author coulthar
+ *
+ * This class attempts to encapsulate the states an edit page (with apply/reset buttons)
+ * can go through and handle managing the state transitions. For example, it manages
+ * the enabled/disabled state of the apply/reset buttons.
+ *
+ * There are three modes supported:
+ *
+ * To use this properly, call the following methods at the appropriate times:
+ *
+ * This constructor sets the initial mode to MODE_UNSET.
+ *
+ * While this class will handle enabling/disabling the apply/reset buttons,
+ * it is still your job to add listeners and actually do the applying and resetting!
+ * @param composite - overall composite of the edit pane
+ * @param applyButton - the Apply pushbutton
+ * @param resetButton - the Reset pushbutton. Can be null.
+ */
+ public SystemEditPaneStateMachine(Composite composite, Button applyButton, Button resetButton)
+ {
+ super();
+ this.composite = composite;
+ this.applyButton = applyButton;
+ this.resetButton = resetButton;
+
+ this.applyLabel_applyMode = applyButton.getText();
+ this.applyTip_applyMode = applyButton.getToolTipText();
+ this.applyLabelMode = true;
+
+ setApplyLabelForNewMode(SystemResources.BUTTON_CREATE_LABEL, SystemResources.BUTTON_CREATE_TOOLTIP);
+
+ setUnsetMode();
+ //setMode(MODE_UNSET);
+ //setState(STATE_INITIAL);
+ //enableButtons();
+
+ // I have decided it is safer to force the user of this class to call this,
+ // since it is possible that Apply will find errors and not actually do the apply
+ /*
+ applyButton.addSelectionListener(this);
+ if (resetButton != null)
+ resetButton.addSelectionListener(this);
+ */
+ }
+
+ /**
+ * Set the label and tooltip to use for the apply button in "new" mode.
+ * By default, generic values are used
+ */
+ public void setApplyLabelForNewMode(String label, String tooltip)
+ {
+ this.applyLabel_newMode = label;
+ this.applyTip_newMode = tooltip;
+ }
+
+ /**
+ * Set the mode to "New". User has selected "new" and wants to create a new thing.
+ * It is your responsibility to call {@link #isSaveRequired()} first.
+ * It is assumed that after the object is created by pressing Apply, your UI will
+ * select the new object and then call setEditMode
+ */
+ public void setNewMode()
+ {
+ setButtonText(mode, MODE_NEW);
+ setMode(MODE_NEW);
+ setState(STATE_INITIAL);
+ enableButtons();
+ if (!composite.isVisible())
+ composite.setVisible(true);
+ }
+ /**
+ * Set the mode to "Edit". User has selected an existing object and wants to changed/edit it
+ * It is your responsibility to call {@link #isSaveRequired()} first.
+ */
+ public void setEditMode()
+ {
+ setButtonText(mode, MODE_EDIT);
+ setMode(MODE_EDIT);
+ setState(STATE_INITIAL);
+ enableButtons();
+ if (!composite.isVisible())
+ composite.setVisible(true);
+ }
+ /**
+ * Set the mode to "Unset". User has selected nothing or something not editable
+ * It is your responsibility to call {@link #isSaveRequired()} first.
+ */
+ public void setUnsetMode()
+ {
+ setButtonText(mode, MODE_UNSET);
+ setMode(MODE_UNSET);
+ setState(STATE_INITIAL);
+ enableButtons();
+ if (composite.isVisible())
+ composite.setVisible(false);
+ }
+ /**
+ * User has made changes, such as typing text or selecting a checkbox or radio button.
+ * It is VERY important this be called religiously for every possible change the user can make!
+ */
+ public void setChangesMade()
+ {
+ setState(STATE_PENDING);
+ enableButtons();
+ }
+ /**
+ * Query if it is ok to switch modes.
+ * If no changes pending, returns false
+ * If changes pending, user is asked to whether to save (true) or discard (false).
+ */
+ public boolean isSaveRequired()
+ {
+ boolean changesPending = areChangesPending();
+ if (changesPending)
+ {
+ if (pendingMsg == null)
+ {
+ pendingMsg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_CONFIRM_CHANGES);
+ }
+ SystemMessageDialog pendingMsgDlg = new SystemMessageDialog(composite.getShell(), pendingMsg);
+ try {
+ changesPending = pendingMsgDlg.openQuestion();
+ } catch (Exception exc) {}
+ }
+ //if (!changesPending) // user has made decision, so clear state
+ setState(STATE_INITIAL); // one way or another, decision has been made
+ return changesPending;
+ }
+
+ /**
+ * User has successfully pressed Apply (that is, no errors found)
+ */
+ public void applyPressed()
+ {
+ setState(STATE_APPLIED);
+ enableButtons();
+ }
+ /**
+ * User has successfully pressed Reset (that is, no errors found)
+ */
+ public void resetPressed()
+ {
+ setState(STATE_INITIAL);
+ enableButtons();
+ }
+
+ /**
+ * Are any changes pending?
+ */
+ public boolean areChangesPending()
+ {
+ return (state == STATE_PENDING);
+ }
+
+ // -----------------------------------
+ // GETTERS FOR STUFF PASSED IN CTOR...
+ // -----------------------------------
+ /**
+ * Returns the resetButton.
+ * @return Button
+ */
+ public Button getResetButton()
+ {
+ return resetButton;
+ }
+
+ /**
+ * Returns the applyButton.
+ * @return Button
+ */
+ public Button getApplyButton()
+ {
+ return applyButton;
+ }
+
+ /**
+ * Returns the composite.
+ * @return Composite
+ */
+ public Composite getComposite()
+ {
+ return composite;
+ }
+
+ // -----------------------------------
+ // GETTERS FOR MODE AND STATE
+ // -----------------------------------
+ /**
+ * Returns the mode.
+ * @return int
+ * @see org.eclipse.rse.ui.widgets.ISystemEditPaneStates
+ */
+ public int getMode()
+ {
+ return mode;
+ }
+
+ /**
+ * Returns the state.
+ * @return int
+ * @see org.eclipse.rse.ui.widgets.ISystemEditPaneStates
+ */
+ public int getState()
+ {
+ return state;
+ }
+
+
+ // -------------------
+ // INTERNAL METHODS...
+ // -------------------
+
+ /**
+ * enable/disable buttons based on state
+ */
+ private void enableButtons()
+ {
+ boolean enableApply = false;
+ boolean enableReset = false;
+ switch(state)
+ {
+ case STATE_INITIAL:
+ enableApply = false;
+ enableReset = false;
+ break;
+ case STATE_APPLIED:
+ enableApply = false;
+ enableReset = false; // true; only true if reset returns to pre-applied values. Not usually the case
+ break;
+ case STATE_PENDING:
+ enableApply = true;
+ enableReset = true;
+ break;
+ }
+ applyButton.setEnabled(enableApply);
+ if (resetButton != null)
+ resetButton.setEnabled(enableReset);
+ }
+
+ /**
+ * Change apply button label and tooltiptext when switching
+ * to/from new/edit modes.
+ */
+ private void setButtonText(int oldMode, int newMode)
+ {
+ if (oldMode != newMode)
+ {
+ if ((newMode == MODE_NEW) && applyLabelMode)
+ {
+ applyButton.setText(applyLabel_newMode);
+ applyButton.setToolTipText(applyTip_newMode);
+ applyLabelMode = false;
+ if (resetButton != null)
+ {
+ //resetButton.setVisible(false);
+ //GridData gd = (GridData)applyButton.getLayoutData();
+ //if (gd != null)
+ //{
+ // gd.horizontalSpan = 2;
+ // composite.layout(true);
+ //}
+ }
+ }
+ else if ((newMode == MODE_EDIT) && !applyLabelMode)
+ {
+ applyButton.setText(applyLabel_applyMode);
+ applyButton.setToolTipText(applyTip_applyMode);
+ applyLabelMode = true;
+ if (resetButton != null)
+ {
+ //resetButton.setVisible(true);
+ //GridData gd = (GridData)applyButton.getLayoutData();
+ //if (gd != null)
+ //{
+ // gd.horizontalSpan = 1;
+ // composite.layout(true);
+ //}
+ }
+ }
+ }
+ }
+
+ /**
+ * Sets the mode.
+ * @param mode The mode to set
+ * @see org.eclipse.rse.ui.widgets.ISystemEditPaneStates
+ */
+ private void setMode(int mode)
+ {
+ this.mode = mode;
+ }
+
+ /**
+ * Sets the state.
+ * @param state The state to set
+ * @see org.eclipse.rse.ui.widgets.ISystemEditPaneStates
+ */
+ private void setState(int state)
+ {
+ this.state = state;
+ }
+
+ /*
+ * Keep track of the fact that New is selected by the Delete action and not by user
+ * so that user can exit later by using OK without supplying a command //d47125
+ */
+ public void setNewSetByDelete(boolean newSetByDelete)
+ {
+ this.newSetByDelete = newSetByDelete;
+ }
+
+ public boolean getNewSetByDelete()
+ {
+ return newSetByDelete;
+ }
+ /*
+ * Internal method.
+ * From SelectionListener. Called when user presses Apply or Reset buttons
+ *
+ public void widgetSelected(SelectionEvent event)
+ {
+ Object source = event.getSource();
+ if (source == applyButton)
+ {
+ setState(STATE_APPLIED);
+ enableButtons();
+ }
+ else if (source == resetButton)
+ {
+ setState(STATE_INITIAL);
+ enableButtons();
+ }
+ }
+ **
+ * Internal method.
+ * From SelectionListener. Called when user presses Enter?
+ *
+ public void widgetDefaultSelected(SelectionEvent event)
+ {
+ }
+ */
+
+ /**
+ * Backup state method
+ */
+ public void backup()
+ {
+ backupMode = mode;
+ backupState = state;
+ }
+
+ /**
+ * Restore state method
+ */
+ public void restore()
+ {
+ switch(backupMode)
+ {
+ case MODE_UNSET:
+ setUnsetMode();
+ break;
+ case MODE_NEW:
+ setNewMode();
+ break;
+ case MODE_EDIT:
+ setEditMode();
+ break;
+ }
+ switch(backupState)
+ {
+ case STATE_PENDING:
+ setChangesMade();
+ break;
+ case STATE_INITIAL:
+ break;
+ case STATE_APPLIED:
+ applyPressed();
+ break;
+ }
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemHistoryCombo.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemHistoryCombo.java
new file mode 100644
index 00000000000..87c6f0e7718
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemHistoryCombo.java
@@ -0,0 +1,696 @@
+/********************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.widgets;
+import org.eclipse.rse.core.SystemPreferencesManager;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.dialogs.SystemWorkWithHistoryDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleAdapter;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+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.events.TraverseEvent;
+import org.eclipse.swt.events.TraverseListener;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+
+
+/**
+ * This re-usable widget is for a combox box that persists its history and
+ * allows the user to manipulate that history.
+ *
+ * The composite is layed as follows:
+ * This is called automatically for you when setText is called. However, for non-readonly
+ * versions, you should still call this yourself when OK is successfully pressed on the
+ * dialog box.
+ */
+ public void updateHistory(boolean refresh)
+ {
+ String textValue = historyCombo.getText().trim();
+ if (autoUppercase)
+ if (!(textValue.startsWith("\"")&& textValue.endsWith("\"")))
+ textValue = textValue.toUpperCase();
+ boolean alreadyThere = false;
+ String[] newHistory = null;
+ if (textValue.length() > 0)
+ {
+ // d41463 - seletced item should go to the top
+ String[] currentHistory = historyCombo.getItems();
+ if ( currentHistory.length > 0)
+ {
+ if (!textValue.equals(currentHistory[0]))
+ {
+ alreadyThere = false;
+ // if string exists
+ for (int idx=0; !alreadyThere && (idx
+ * Without the New button, the composite is layed as follows:
+ * With the New button, the composite is layed as follows:
+ * There are numerous ways to subset the connection list:
+ * Does NOT set the widthHint as that causes problems. Instead the combo will
+ * consume what space is available within this composite.
+ * @param parent composite to put the button into.
+ */
+ public static Combo createCombo(Composite parent, boolean readonly)
+ {
+ Combo combo = null;
+ if (!readonly)
+ combo = new Combo(parent, SWT.DROP_DOWN);
+ else
+ combo = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
+ GridData data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ data.grabExcessHorizontalSpace = true;
+ data.verticalAlignment = GridData.CENTER;
+ data.grabExcessVerticalSpace = false;
+ combo.setLayoutData(data);
+ return combo;
+ }
+
+ /**
+ * Populates a readonly connection combobox instance with system connections for the given
+ * system type.
+ *
+ * This fills the combination with the names of all the active connections of the given
+ * system type.
+ * @param connectionCombo composite to populate
+ * @param systemType the system type to restrict the connection list to. Pass null or * for all system types
+ * @param defaultConnection the default system connection to preselect.
+ * @param preSelectIfNoMatch true if we should preselect the first item if the given connection is not found
+ * @return true if given default connection was found and selected
+ */
+ protected boolean populateConnectionCombo(Combo combo, String systemType, IHost defaultConnection,
+ boolean preSelectIfNoMatch)
+ {
+ return populateConnectionCombo(combo, systemType, defaultConnection, preSelectIfNoMatch, false);
+ }
+
+ /**
+ * Populates a readonly connection combobox instance with system connections for the given
+ * system type.
+ *
+ * This fills the combination with the names of all the active connections of the given
+ * system type.
+ * @param connectionCombo composite to populate
+ * @param systemType the system type to restrict the connection list to. Pass null or * for all system types
+ * @param defaultConnection the default system connection to preselect.
+ * @param preSelectIfNoMatch true if we should preselect the first item if the given connection is not found
+ * @param appendToCombo indicates whether or not to append to combo with population or replace
+ * @return true if given default connection was found and selected
+ */
+ protected boolean populateConnectionCombo(Combo combo, String systemType, IHost defaultConnection,
+ boolean preSelectIfNoMatch, boolean appendToCombo)
+ {
+ boolean matchFound = false;
+ IHost[] additionalConnections = null;
+ if ( (systemType == null) || (systemType.equals("*")) )
+ additionalConnections = SystemPlugin.getTheSystemRegistry().getHosts();
+ else
+ additionalConnections = SystemPlugin.getTheSystemRegistry().getHostsBySystemType(systemType);
+ if (additionalConnections != null)
+ {
+ String[] connectionNames = new String[additionalConnections.length];
+ int selectionIndex = -1;
+ for (int idx=0; idx
+ * @param connectionCombo composite to populate
+ * @param subsystemFactory the subsystem factory to restrict the connection list to.
+ * @param defaultConnection the default system connection to preselect.
+ * @return true if given default connection was found and selected
+ */
+ protected boolean populateConnectionCombo(Combo combo, ISubSystemConfiguration ssFactory, IHost defaultConnection)
+ {
+ connections = SystemPlugin.getTheSystemRegistry().getHostsBySubSystemConfiguration(ssFactory);
+ return addConnections(combo, connections, defaultConnection);
+ }
+ /**
+ * Populates a readonly connection combobox instance with system connections which have subsystems
+ * owned by a subsystem factory of the given subsystem factory id.
+ *
+ * @param connectionCombo composite to populate
+ * @param defaultConnection the default system connection to preselect.
+ * @param subsystemFactoryId the subsystem factory id to restrict the connection list by.
+ * @return true if given default connection was found and selected
+ */
+ protected boolean populateConnectionCombo(Combo combo, String ssFactoryId, IHost defaultConnection)
+ {
+ connections = SystemPlugin.getTheSystemRegistry().getHostsBySubSystemConfigurationId(ssFactoryId);
+ return addConnections(combo, connections, defaultConnection);
+ }
+
+ /**
+ * Populates a readonly connection combobox instance with system connections which have subsystems
+ * owned by a subsystem factory of the given subsystem factory category.
+ *
+ * @param connectionCombo composite to populate
+ * @param defaultConnection the default system connection to preselect.
+ * @param subsystemFactoryCategory the subsystem factory category to restrict the connection list by.
+ * @return true if given default connection was found and selected
+ */
+ protected boolean populateConnectionCombo(Combo combo, IHost defaultConnection, String ssFactoryCategory)
+ {
+ connections = SystemPlugin.getTheSystemRegistry().getHostsBySubSystemConfigurationCategory(ssFactoryCategory);
+ return addConnections(combo, connections, defaultConnection);
+ }
+ /**
+ * An attempt to get some abstraction
+ */
+ private boolean addConnections(Combo combo, IHost[] connections, IHost defaultConnection)
+ {
+ boolean matchFound = false;
+ if (connections != null)
+ {
+ String[] connectionNames = new String[connections.length];
+ int selectionIndex = -1;
+ for (int idx=0; idx
+ * This form may be used to populate a dialog or a wizard page.
+ *
+ * To configure the functionality, call these methods:
+ *
+ * To configure the text on the dialog, call these methods:
+ *
+ * After running, call these methods to get the output:
+ *
+ * Default is false
+ */
+ public void setShowPropertySheet(boolean show)
+ {
+ this.showPropertySheet = show;
+ }
+
+ /**
+ * Set multiple selection mode. Default is single selection mode
+ *
+ * If you turn on multiple selection mode, you must use the getSelectedConnections()
+ * method to retrieve the list of selected connections.
+ *
+ * @see #getSelectedConnections()
+ */
+ public void setMultipleSelectionMode(boolean multiple)
+ {
+ this.multipleSelectionMode = multiple;
+ }
+
+ /**
+ * Add a listener to selection change events in the list
+ */
+ public void addSelectionChangedListener(ISelectionChangedListener l)
+ {
+ if (tree != null)
+ tree.addSelectionChangedListener(l);
+ else
+ listeners.addElement(l);
+ }
+ /**
+ * Remove a listener for selection change events in the list
+ */
+ public void removeSelectionChangedListener(ISelectionChangedListener l)
+ {
+ if (tree != null)
+ tree.removeSelectionChangedListener(l);
+ else
+ listeners.removeElement(l);
+ }
+
+
+ // ---------------------------------
+ // OUTPUT METHODS...
+ // ---------------------------------
+ /**
+ * Return all selected connections.
+ * @see #setMultipleSelectionMode(boolean)
+ */
+ public IHost[] getSelectedConnections()
+ {
+ return outputConnections;
+ }
+ /**
+ * Return selected connection
+ */
+ public IHost getSelectedConnection()
+ {
+ return outputConnection;
+ }
+
+ /**
+ * Return the multiple selection mode current setting
+ */
+ public boolean getMultipleSelectionMode()
+ {
+ return multipleSelectionMode;
+ }
+
+ // -----------------------------------------------------
+ // SEMI-PRIVATE METHODS USED BY CALLING DIALOG/WIZARD...
+ // -----------------------------------------------------
+
+ /**
+ * Return control to recieve initial focus
+ */
+ public Control getInitialFocusControl()
+ {
+ return tree.getTreeControl();
+ }
+
+ /**
+ * Show or hide the property sheet. This is called after the contents are created when the user
+ * toggles the Details button.
+ * @param shell Use getShell() in your dialog or wizard page
+ * @param contents Use getContents() in your dialog or wizard page
+ * @return new state -> true if showing, false if hiding
+ */
+ public boolean toggleShowPropertySheet(Shell shell, Control contents)
+ {
+ Point windowSize = shell.getSize();
+ Point oldSize = contents.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+
+ if (showPropertySheet) // hiding?
+ {
+ ps.dispose();
+ spacer1.dispose();
+ spacer2.dispose();
+ ps_composite.dispose();
+ ps = null; spacer1 = spacer2 = null; ps_composite = null;
+ ((GridLayout)outerParent.getLayout()).numColumns = 1;
+ }
+ else // showing?
+ {
+ //createPropertySheet((Composite)contents, shell);
+ ((GridLayout)outerParent.getLayout()).numColumns = 2;
+ createPropertySheet(outerParent, shell);
+ }
+
+ Point newSize = contents.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ shell.setSize(new Point(windowSize.x + (newSize.x - oldSize.x), windowSize.y));
+
+ if (ps != null)
+ {
+ ISelection s = tree.getSelection();
+ if (s != null)
+ ps.selectionChanged(s);
+ }
+
+ showPropertySheet = !showPropertySheet;
+ return showPropertySheet;
+ }
+
+ /**
+ * Create the property sheet viewer
+ */
+ private void createPropertySheet(Composite outerParent, Shell shell)
+ {
+ ps_composite = SystemWidgetHelpers.createFlushComposite(outerParent, 1);
+ ((GridData)ps_composite.getLayoutData()).grabExcessVerticalSpace = true;
+ ((GridData)ps_composite.getLayoutData()).verticalAlignment = GridData.FILL;
+
+ // SPACER LINES
+ spacer1 = SystemWidgetHelpers.createLabel(ps_composite, "", 1);
+ spacer2 = SystemWidgetHelpers.createLabel(ps_composite, "", 1);
+ // PROPERTY SHEET VIEWER
+ ps = new SystemPropertySheetForm(shell, ps_composite, SWT.BORDER, getMessageLine());
+ }
+
+ public void dispose()
+ {
+ if (tree != null)
+ {
+ tree.removeSelectionChangedListener(this);
+ for (int i = 0; i < listeners.size(); i++)
+ {
+ tree.removeSelectionChangedListener((ISelectionChangedListener)listeners.get(i));
+ }
+ }
+ }
+ /**
+ * In this method, we populate the given SWT container with widgets and return the container
+ * to the caller.
+ * @param parent The parent composite
+ */
+ public Control createContents(Composite parent)
+ {
+ contentsCreated = true;
+
+ outerParent = parent;
+ // OUTER COMPOSITE
+ //if (showPropertySheet)
+ {
+ outerParent = SystemWidgetHelpers.createComposite(parent, showPropertySheet ? 2 : 1);
+ }
+
+ // INNER COMPOSITE
+ int gridColumns = 2;
+ Composite composite_prompts = SystemWidgetHelpers.createFlushComposite(outerParent, gridColumns);
+
+ // PROPERTY SHEET COMPOSITE
+ if (showPropertySheet)
+ {
+ createPropertySheet(outerParent, getShell());
+ }
+ else
+ {
+ //((GridLayout)composite_prompts.getLayout()).margin...
+ }
+
+ // MESSAGE/VERBAGE TEXT AT TOP
+ verbageLabel = (Label) SystemWidgetHelpers.createVerbage(composite_prompts, verbage, gridColumns, false, PROMPT_WIDTH);
+ //verbageLabel = SystemWidgetHelpers.createLabel(composite_prompts, verbage, gridColumns);
+
+ // SPACER LINE
+ SystemWidgetHelpers.createLabel(composite_prompts, "", gridColumns);
+
+ // SELECT OBJECT READONLY TEXT FIELD
+ Composite nameComposite = composite_prompts;
+ int nameSpan = gridColumns;
+ nameEntryValue = SystemWidgetHelpers.createReadonlyTextField(nameComposite);
+ ((GridData)nameEntryValue.getLayoutData()).horizontalSpan = nameSpan;
+
+ // TREE
+ SystemViewConnectionSelectionInputProvider inputProvider = new SystemViewConnectionSelectionInputProvider();
+ inputProvider.setShowNewConnectionPrompt(allowNew);
+ inputProvider.setSystemTypes(systemTypes);
+ tree = new SystemViewForm(getShell(), composite_prompts, SWT.NULL, inputProvider, !multipleSelectionMode, getMessageLine(), gridColumns, 1);
+ ((GridData)tree.getLayoutData()).widthHint = PROMPT_WIDTH; // normally its 300
+
+ // initialize fields
+ if (!initDone)
+ doInitializeFields();
+
+ // add selection listeners
+ tree.addSelectionChangedListener(this);
+ if (listeners.size() > 0)
+ for (int idx=0; idx A wizard is a multi-page UI, that prompts users for information and then uses that information
+ * to create something (typically). The wizard has an overall title that shows for each page, and
+ * a wizard page title that can be unique per page, but typically is not. Typically, the overall title
+ * is a verb, such as "New", while the page title expands on the verb, as in "File". There is also a
+ * description per page, which is unique and explains the purpose of that page. Further, there is a
+ * wizard image that is always the same per wizard page.
+ * Using this base class for wizards offers the following advantages over just using the
+ * eclipse Wizard class:
+ * To use this class, :
+ * This is not used by default, but can be queried via getPageTitle() when constructing
+ * pages.
+ */
+ public void setWizardPageTitle(String pageTitle)
+ {
+ this.pageTitle = pageTitle;
+ }
+ /**
+ * Return the page title as set via setWizardPageTitle
+ */
+ public String getWizardPageTitle()
+ {
+ return pageTitle;
+ }
+
+ /**
+ * Set the wizard image. Using this makes it possible to avoid subclassing
+ */
+ public void setWizardImage(ImageDescriptor wizardImage)
+ {
+ super.setDefaultPageImageDescriptor(wizardImage);
+ }
+ /**
+ * Set the help context Id (infoPop) for this wizard. This must be fully qualified by
+ * plugin ID.
+ *
+ * Same as {@link org.eclipse.rse.ui.actions.SystemBaseAction #setHelp(String)}
+ * @see org.eclipse.rse.ui.actions.SystemBaseAction #getHelpContextId()
+ */
+ public void setHelp(String id)
+ {
+ this.helpId = id;
+ }
+ /**
+ * Return the help Id as set in setHelp(String)
+ */
+ public String getHelpContextId()
+ {
+ return helpId;
+ }
+ /**
+ * Intercept of parent method so we can percolate the help id
+ */
+ public void addPage(IWizardPage page)
+ {
+ super.addPage(page);
+ if ((helpId!=null) && (page instanceof ISystemWizardPage))
+ {
+ // tweak by Phil 10/19/2002 ... this was overriding page-specific help
+ // on secondary pages. To reduce regression I only test if help is already
+ // specified if this is not the first page... hence one-page wizards are
+ // not affected...
+ ISystemWizardPage swPage = (ISystemWizardPage)page;
+ if ((super.getPageCount() == 1) || (swPage.getHelpContextId() == null))
+ swPage.setHelp(helpId);
+ }
+ }
+
+ /**
+ * Set the Viewer that called this wizard. It is good practice for actions to call this
+ * so wizard can directly access the originating viewer if needed.
+ *
+ * This is called for you if using a subclass of {@link org.eclipse.rse.ui.actions.SystemBaseWizardAction}.
+ */
+ public void setViewer(Viewer v)
+ {
+ this.viewer = v;
+ }
+ /**
+ * Get the Viewer that called this wizard. This will be null unless set by the action that started this wizard.
+ */
+ public Viewer getViewer()
+ {
+ return viewer;
+ }
+ /**
+ * Return the current viewer as an ISystemTree if it is one, or null otherwise
+ */
+ protected ISystemTree getCurrentTreeView()
+ {
+ Viewer v = getViewer();
+ if (v instanceof ISystemTree)
+ return (ISystemTree)v;
+ else
+ return null;
+ }
+
+ /**
+ * For explicitly setting input object
+ */
+ public void setInputObject(Object inputObject)
+ {
+ this.input = inputObject;
+ //System.out.println("Inside AbstractSystemWizard#setInputObject: " + inputObject + ", class = " + inputObject.getClass().getName());
+ }
+ /**
+ * For explicitly getting input object
+ */
+ public Object getInputObject()
+ {
+ return input;
+ }
+
+ /**
+ * For explicitly getting output object after wizard is dismissed. Set by the
+ * wizard's processFinish method.
+ */
+ public Object getOutputObject()
+ {
+ return output;
+ }
+
+ /**
+ * For explicitly setting output object after wizard is dismissed. Called in the
+ * wizard's processFinish method, typically.
+ */
+ protected void setOutputObject(Object outputObject)
+ {
+ output = outputObject;
+ }
+
+ /**
+ * Allow caller to determine if wizard was cancelled or not.
+ */
+ public boolean wasCancelled()
+ {
+ if (cancelled) // most reliable
+ return true;
+ else
+ return !finishPressed;
+ }
+ /**
+ * You must call this in your performFinish method.
+ */
+ protected void setWasCancelled(boolean cancelled)
+ {
+ finishPressed = !cancelled;
+ }
+ /**
+ * Override of parent so we can record the fact the wizard was cancelled.
+ */
+ public boolean performCancel()
+ {
+ //System.out.println("inside performCancel");
+ cancelled = true;
+ setWasCancelled(true);
+ return super.performCancel();
+ }
+
+ /**
+ * Required by INewWizard interface. It is called by the framework for wizards
+ * that are launched file the File->New interface. Otherwise we don't use it.
+ * If you need it, the selection is stored in protected variable "selection".
+ */
+ public void init(IWorkbench workbench, IStructuredSelection selection)
+ {
+ this.selection = selection;
+ }
+
+ /**
+ * Set the wizard's min page width and height.
+ * If you pass 0 for either one, the Eclipse default value will be used.
+ */
+ public void setMinimumPageSize(int width, int height)
+ {
+ if (width <= 0)
+ width = 300; // found this number in WizardDialog code
+ if (height <= 0)
+ height = 225; // found this number in WizardDialog code
+ this.minPageWidth = width;
+ this.minPageHeight = height;
+ }
+
+ /**
+ * Return the minimum page width. If zero, it has not been explicitly set, so the default is to be used.
+ */
+ public int getMinimumPageWidth()
+ {
+ return minPageWidth;
+ }
+ /**
+ * Return the minimum page height. If zero, it has not been explicitly set, so the default is to be used.
+ */
+ public int getMinimumPageHeight()
+ {
+ return minPageHeight;
+ }
+
+ /**
+ * If in the processing of performFinish an error is detected on another page of the
+ * wizard, the best we can do is tell the user this via an error message on their own
+ * page. It seems there is no way in JFace to successfully switch focus to another page.
+ *
+ * To simplify processing, simply call this method in your wizard's performFinish if any
+ * page's performFinish returned false. Pass the failing page. If it is not the current
+ * page, this code will issue msg RSEG1240 "Error on another page" to the user.
+ */
+ protected void setPageError(IWizardPage pageInError)
+ {
+ IWizardPage currentPage = getContainer().getCurrentPage();
+ if (currentPage != pageInError)
+ {
+ SystemMessage msg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_WIZARD_PAGE_ERROR);
+ if (currentPage instanceof AbstractSystemWizardPage)
+ ((AbstractSystemWizardPage)currentPage).setErrorMessage(msg);
+ else if (pageInError instanceof WizardPage)
+ ((WizardPage)currentPage).setErrorMessage(msg.getLevelOneText());
+ }
+ }
+
+ /**
+ * Expose inherited protected method convertWidthInCharsToPixels as a publicly
+ * excessible method
+ *
+ * Requires setOwningDialog to have been called, else returns -1
+ */
+ public int publicConvertWidthInCharsToPixels(int chars)
+ {
+ if (owningDialog != null)
+ return owningDialog.publicConvertWidthInCharsToPixels(chars);
+ else
+ return -1;
+ }
+ /**
+ * Expose inherited protected method convertHeightInCharsToPixels as a publicly
+ * excessible method
+ *
+ * Requires setOwningDialog to have been called, else returns -1
+ */
+ public int publicConvertHeightInCharsToPixels(int chars)
+ {
+ if (owningDialog != null)
+ return owningDialog.publicConvertHeightInCharsToPixels(chars);
+ else
+ return -1;
+ }
+ /**
+ * Set the cursor to the wait cursor (true) or restores it to the normal cursor (false).
+ */
+ public void setBusyCursor(boolean setBusy)
+ {
+ if (setBusy)
+ {
+ // Set the busy cursor to all shells.
+ Display d = getShell().getDisplay();
+ waitCursor = new Cursor(d, SWT.CURSOR_WAIT);
+ org.eclipse.rse.ui.dialogs.SystemPromptDialog.setDisplayCursor(getShell(), waitCursor);
+ }
+ else
+ {
+ org.eclipse.rse.ui.dialogs.SystemPromptDialog.setDisplayCursor(getShell(), null);
+ if (waitCursor != null)
+ waitCursor.dispose();
+ waitCursor = null;
+ }
+ }
+
+ // ----------------------------
+ // METHODS YOU MUST OVERRIDE...
+ // ----------------------------
+
+ /**
+ * Creates the wizard pages.
+ * This method is an override from the parent Wizard class, but is made abstract here to ensure child classes override it.
+ */
+ public abstract void addPages();
+
+ /**
+ * Called when finish pressed.
+ *
+ * Return true if no errors, false to cancel the finish operation.
+ *
+ * Typically, you walk through each wizard page calling performFinish on it, and only return true if they all return true.
+ * If one of the pages returns false, you should call setPageError(IWizardPage), which shows a message to the user about an
+ * error pending on another page, if the given page is not the current page.
+ */
+ public abstract boolean performFinish();
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/AbstractSystemWizardPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/AbstractSystemWizardPage.java
new file mode 100644
index 00000000000..98885f90d3d
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/AbstractSystemWizardPage.java
@@ -0,0 +1,518 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.wizards;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.Mnemonics;
+import org.eclipse.rse.ui.SystemWidgetHelpers;
+import org.eclipse.rse.ui.messages.ISystemMessageLine;
+import org.eclipse.rse.ui.messages.SystemMessageLine;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Cursor;
+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.Display;
+import org.eclipse.swt.widgets.Label;
+
+
+
+/**
+ * Abstract class for system wizards pages. Using this class is most effective when used in
+ * conjunction with {@link org.eclipse.rse.ui.wizards.AbstractSystemWizard}.
+ * Using this base class for wizards offers the following advantages over just using the
+ * eclipse WizardPage class:
+ * To use this class, : For error validation when there are multiple input fields on the page, there are two different approaches you can take: There is no consensus on the approach, although clearly the second one is preferable when it is possible.
+ *
+ * @see org.eclipse.rse.ui.wizards.AbstractSystemWizard
+ * @see org.eclipse.rse.ui.dialogs.SystemWizardDialog
+ * @see org.eclipse.rse.ui.actions.SystemBaseWizardAction
+ */
+public abstract class AbstractSystemWizardPage
+ extends WizardPage
+ implements ISystemWizardPage, ISystemMessageLine
+{
+ // state
+ private Object input;
+ private SystemMessageLine msgLine;
+ private String helpId;
+ private Composite parentComposite;
+ private SystemMessage pendingMessage, pendingErrorMessage;
+ //private Hashtable helpIdPerControl;
+ private Cursor waitCursor;
+
+ /**
+ * Constructor when a unique page title is desired.
+ * @param wizard - the page wizard.
+ * @param pageName - the untranslated ID of this page. Not really used.
+ * @param pageTitle - the translated title of this page. Appears below the overall wizard title.
+ * @param pageDescription - the translated description of this page. Appears to the right of the page title.
+ */
+ public AbstractSystemWizardPage(IWizard wizard,
+ String pageName, String pageTitle, String pageDescription)
+ {
+ super(pageName);
+ setWizard(wizard);
+ if (pageTitle != null)
+ setTitle(pageTitle);
+ else if (wizard instanceof AbstractSystemWizard)
+ setTitle(((AbstractSystemWizard)wizard).getWizardPageTitle());
+ setDescription(pageDescription);
+ }
+ /**
+ * Constructor when the overall wizard page title is desired, as specified in
+ * {@link org.eclipse.rse.ui.wizards.AbstractSystemWizard#setWizardPageTitle(String)}.
+ * It is a somewhat common design pattern to use the same title for all pages in a wizard, and
+ * this makes it easy to do that.
+ *
+ * Your wizard must extend AbstractSystemWizard, and you must have called setWizardPageTitle.
+ * @param wizard - the page's wizard.
+ * @param pageName - the untranslated ID of this page. Not really used.
+ * @param pageDescription - the translated description of this page. Appears to the right of the page title.
+ */
+ public AbstractSystemWizardPage(ISystemWizard wizard,
+ String pageName, String pageDescription)
+ {
+ this(wizard, pageName, null, pageDescription);
+ }
+
+ // ------------------------
+ // CONFIGURATION METHODS...
+ // ------------------------
+
+ /**
+ * Configuration method.
+ * This id is stored, and then applied to each of the input-capable
+ * controls in the main composite returned from createContents.
+ *
+ * Call this first to set the default help, then call {@link #setHelp(Control, String)} per individual
+ * control if control-unique help is desired.
+ */
+ public void setHelp(String helpId)
+ {
+ if (parentComposite != null)
+ SystemWidgetHelpers.setHelp(parentComposite, helpId);
+ //SystemWidgetHelpers.setCompositeHelp(parentComposite, helpId, helpIdPerControl);
+ //System.out.println("Setting help to " + helpId);
+ this.helpId = helpId;
+ }
+ /**
+ * Configuration method.
+ * This overrides the default set in the call to {@link #setHelp(String)}.
+ */
+ public void setHelp(Control c, String helpId)
+ {
+ SystemWidgetHelpers.setHelp(c, helpId);
+ //if (helpIdPerControl == null)
+ // helpIdPerControl = new Hashtable();
+ //helpIdPerControl.put(c, helpId);
+ }
+
+ /**
+ * Configuration method.
+ * You may find it useful to use the static methods in {@link org.eclipse.rse.ui.SystemWidgetHelpers}.
+ * If you do keystroke validation, you should call {@link #setErrorMessage(SystemMessage)} if you detect errors, and also
+ * {@link #setPageComplete(boolean)} to affect the enablement of the next and finish buttons.
+ *
+ * @see org.eclipse.rse.ui.SystemWidgetHelpers
+ */
+ public abstract Control createContents(Composite parent);
+
+ /**
+ * Abstract method.
+ * Child classes must override this, but can return null.
+ */
+ protected abstract Control getInitialFocusControl();
+
+ /**
+ * Abstract method. Called by the main wizard when the user presses Finish. The operation will be cancelled if
+ * this method returns false for any page.
+ */
+ public abstract boolean performFinish();
+
+ // -----------------------
+ // PARENT-OVERRIDE METHODS
+ // -----------------------
+ /**
+ * Parent override.
+ * Return true if the page is complete and has no errors
+ */
+ public boolean isPageComplete();
+
+ /**
+ * Return the subsystem factory that supplied this page
+ */
+ public ISubSystemConfiguration getSubSystemFactory();
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/ISystemWizard.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/ISystemWizard.java
new file mode 100644
index 00000000000..6ad2d52736d
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/ISystemWizard.java
@@ -0,0 +1,105 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.wizards;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.rse.ui.dialogs.ISystemPromptDialog;
+import org.eclipse.rse.ui.dialogs.SystemWizardDialog;
+import org.eclipse.ui.INewWizard;
+
+
+/**
+ * Suggested interface for wizards launchable via remote system explorer.
+ */
+public interface ISystemWizard extends INewWizard, ISystemPromptDialog
+{
+ /**
+ * Called when wizard to be used for update vs create.
+ * This is the input object to be updated. Automatically sets input mode to update.
+ */
+ //public void setUpdateInput(Object input);
+ /**
+ * Retrieve update mode
+ */
+ //public boolean getUpdateMode();
+ /**
+ * Retrieve input object used in update mode.
+ */
+ //public Object getUpdateInput();
+ /**
+ * Set current selection of viewer, at time wizard launched
+ */
+ //public void setSelection(IStructuredSelection selection);
+ /**
+ * Get current selection of viewer, at time wizard launched, as set
+ * by setSelection(IStructuredSelection selection)
+ */
+ //public IStructuredSelection getSelection();
+
+ public void setMinimumPageSize(int width, int height);
+ public int getMinimumPageWidth();
+ public int getMinimumPageHeight();
+
+ /**
+ * Set the help context Id (infoPop) for this wizard. This must be fully qualified by
+ * plugin ID.
+ *
+ * Same as {@link org.eclipse.rse.ui.actions.SystemBaseAction #setHelp(String)}
+ * @see org.eclipse.rse.ui.actions.SystemBaseAction #getHelpContextId()
+ */
+ public void setHelp(String id);
+ /**
+ * Return the help Id as set in setHelp(String)
+ */
+ public String getHelpContextId();
+
+ /**
+ * Set the Viewer that called this wizard. It is good practice for actions to call this
+ * so wizard can directly access the originating viewer if needed.
+ */
+ public void setViewer(Viewer v);
+ /**
+ * Get the Viewer that called this wizard. This will be null unless set by the action that started this wizard.
+ */
+ public Viewer getViewer();
+
+ /**
+ * Set the wizard page title. Using this makes it possible to avoid subclassing.
+ * The page title goes below the wizard title, and can be unique per page. However,
+ * typically the wizard page title is the same for all pages... eg "Filter".
+ *
+ * This is not used by default, but can be queried via getPageTitle() when constructing
+ * pages.
+ */
+ public void setWizardPageTitle(String pageTitle);
+ /**
+ * Return the page title as set via setWizardPageTitle
+ */
+ public String getWizardPageTitle();
+ /**
+ * Called from SystemWizardDialog when it is used as the hosting dialog
+ */
+ public void setSystemWizardDialog(SystemWizardDialog dlg);
+ /**
+ * Return the result of setSystemWizardDialog
+ */
+ public SystemWizardDialog getSystemWizardDialog();
+ /**
+ * Exposes this nice new 2.0 capability to the public.
+ * Only does anything if being hosted by SystemWizardDialog.
+ */
+ public void updateSize();
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/ISystemWizardPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/ISystemWizardPage.java
new file mode 100644
index 00000000000..8d98d1a6219
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/ISystemWizardPage.java
@@ -0,0 +1,53 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.wizards;
+/**
+ * Interface for wizard pages
+ */
+public interface ISystemWizardPage
+{
+ /**
+ * For explicitly setting input object for update mode wizards
+ */
+ public void setInputObject(Object inputObject);
+
+ /**
+ * For explicitly getting input object.
+ */
+ public Object getInputObject();
+
+ /**
+ * Perform error checking of the page contents, returning true only if there are no errors.
+ * Called by the main wizard when the user presses Finish. The operation will be cancelled if
+ * this method returns false for any page.
+ */
+ public boolean performFinish();
+
+ /**
+ * Set the help context Id (infoPop) for this wizard. This must be fully qualified by
+ * plugin ID.
+ *
+ * Same as {@link org.eclipse.rse.ui.actions.SystemBaseAction #setHelp(String)}
+ * @see org.eclipse.rse.ui.actions.SystemBaseAction #getHelpContextId()
+ */
+ public void setHelp(String id);
+ /**
+ * Return the help Id as set in setHelp(String)
+ */
+ public String getHelpContextId();
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SubSystemServiceWizardPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SubSystemServiceWizardPage.java
new file mode 100644
index 00000000000..dfc96069f89
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SubSystemServiceWizardPage.java
@@ -0,0 +1,188 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.wizards;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.servicesubsystem.IServiceSubSystem;
+import org.eclipse.rse.core.servicesubsystem.IServiceSubSystemConfiguration;
+import org.eclipse.rse.core.subsystems.IConnectorService;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
+import org.eclipse.rse.model.DummyHost;
+import org.eclipse.rse.model.IHost;
+import org.eclipse.rse.model.ISystemRegistry;
+import org.eclipse.rse.ui.widgets.services.FactoryServiceElement;
+import org.eclipse.rse.ui.widgets.services.RootServiceElement;
+import org.eclipse.rse.ui.widgets.services.ServiceElement;
+import org.eclipse.rse.ui.widgets.services.ServicesForm;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+
+public class SubSystemServiceWizardPage extends AbstractSystemNewConnectionWizardPage implements ISubSystemPropertiesWizardPage
+{
+ private ServicesForm _form;
+ private IServiceSubSystemConfiguration _selectedFactory;
+ private ServiceElement _root;
+ private ServiceElement[] _serviceElements;
+
+ public SubSystemServiceWizardPage(IWizard wizard, ISubSystemConfiguration parentFactory, String pageName, String pageTitle, String pageDescription)
+ {
+ super(wizard, parentFactory, pageName, pageTitle, pageDescription);
+ }
+
+ public SubSystemServiceWizardPage(IWizard wizard, ISubSystemConfiguration parentFactory, String pageDescription)
+ {
+ super(wizard, parentFactory, pageDescription);
+ }
+
+ public SubSystemServiceWizardPage(IWizard wizard, ISubSystemConfiguration parentFactory)
+ {
+ super(wizard, parentFactory);
+ }
+
+ public Control createContents(Composite parent)
+ {
+ _form = new ServicesForm(getMessageLine());
+ Control control = _form.createContents(parent);
+
+ ServiceElement[] elements = getServiceElements();
+ _root = new RootServiceElement(elements);
+ _form.init(_root);
+
+ return control;
+ }
+
+ protected ServiceElement[] getServiceElements()
+ {
+ if (_serviceElements == null)
+ {
+
+
+ IServiceSubSystemConfiguration currentFactory = (IServiceSubSystemConfiguration)getSubSystemFactory();
+ IServiceSubSystemConfiguration[] factories = getServiceSubSystemFactories(getMainPage().getSystemType(), currentFactory.getServiceType());
+
+ IHost dummyHost = null;
+ if (getWizard() instanceof SystemNewConnectionWizard)
+ {
+ dummyHost = ((SystemNewConnectionWizard)getWizard()).getDummyHost();
+ }
+
+ // create elements for each
+ _serviceElements = new ServiceElement[factories.length];
+ for (int i = 0; i < factories.length; i++)
+ {
+ IServiceSubSystemConfiguration factory = factories[i];
+ _serviceElements[i] = new FactoryServiceElement(dummyHost, factory);
+
+
+ if (factory == currentFactory)
+ {
+ _serviceElements[i].setSelected(true);
+ }
+ }
+ }
+ return _serviceElements;
+ }
+
+ protected IServiceSubSystemConfiguration[] getServiceSubSystemFactories(String systemType, Class serviceType)
+ {
+ List results = new ArrayList();
+ ISystemRegistry sr = SystemPlugin.getTheSystemRegistry();
+ ISubSystemConfiguration[] factories = sr.getSubSystemConfigurationsBySystemType(systemType);
+
+ for (int i = 0; i < factories.length; i++)
+ {
+ ISubSystemConfiguration factory = factories[i];
+ if (factory instanceof IServiceSubSystemConfiguration)
+ {
+ IServiceSubSystemConfiguration sfactory = (IServiceSubSystemConfiguration)factory;
+ if (sfactory.getServiceType() == serviceType)
+ {
+
+ results.add(sfactory);
+ }
+ }
+ }
+
+ return (IServiceSubSystemConfiguration[])results.toArray(new IServiceSubSystemConfiguration[results.size()]);
+ }
+
+ public boolean isPageComplete()
+ {
+ return true;
+ }
+
+ public boolean performFinish()
+ {
+ if (_root != null)
+ {
+ _root.commit();
+ _selectedFactory = ((FactoryServiceElement)_form.getSelectedService()).getFactory();
+ }
+ return true;
+ }
+
+ public boolean applyValues(ISubSystem ss)
+ {
+ if (_selectedFactory != null)
+ {
+ IServiceSubSystemConfiguration currentFactory = (IServiceSubSystemConfiguration)ss.getSubSystemConfiguration();
+ if (currentFactory != null)
+ {
+
+ if (_selectedFactory != currentFactory)
+ {
+ ((IServiceSubSystem)ss).switchServiceFactory(_selectedFactory);
+ }
+ }
+ }
+ return true;
+ }
+
+ protected IConnectorService getCustomConnectorService(IServiceSubSystemConfiguration config)
+ {
+ ServiceElement[] children = _root.getChildren();
+ for (int i = 0; i < children.length; i++)
+ {
+ ServiceElement child = (ServiceElement)children[i];
+ if (child instanceof FactoryServiceElement)
+ {
+ FactoryServiceElement fchild = (FactoryServiceElement)child;
+ if (fchild.getFactory() == config)
+ {
+ return fchild.getConnectorService();
+ }
+ }
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
+ */
+ public void handleVerifyComplete()
+ {
+ boolean complete = isPageComplete();
+ clearErrorMessage();
+ setPageComplete(complete);
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SystemNewConnectionWizard.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SystemNewConnectionWizard.java
new file mode 100644
index 00000000000..d508da493f5
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SystemNewConnectionWizard.java
@@ -0,0 +1,520 @@
+/********************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.wizards;
+import java.util.Hashtable;
+import java.util.Vector;
+
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.rse.core.ISystemTypes;
+import org.eclipse.rse.core.SystemBasePlugin;
+import org.eclipse.rse.core.SystemPerspectiveHelpers;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
+import org.eclipse.rse.core.subsystems.util.ISubsystemConfigurationAdapter;
+import org.eclipse.rse.model.DummyHost;
+import org.eclipse.rse.model.IHost;
+import org.eclipse.rse.model.ISystemProfile;
+import org.eclipse.rse.model.ISystemRegistry;
+import org.eclipse.rse.model.SystemStartHere;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.ISystemPreferencesConstants;
+import org.eclipse.rse.ui.SystemConnectionForm;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.messages.SystemMessageDialog;
+
+/**
+ * Wizard for creating a new remote systems connection.
+ */
+public class SystemNewConnectionWizard
+ extends AbstractSystemWizard
+
+{
+
+ private ISystemNewConnectionWizardMainPage mainPage;
+ private SystemNewConnectionWizardRenameProfilePage rnmProfilePage;
+ private ISystemNewConnectionWizardPage[] subsystemFactorySuppliedWizardPages;
+ private Hashtable ssfWizardPagesPerSystemType = new Hashtable();
+ private String defaultUserId;
+ private String defaultConnectionName;
+ private String defaultHostName;
+ private String[] activeProfileNames = null;
+ private int privateProfileIndex = -1;
+ private ISystemProfile privateProfile = null;
+ private IHost currentlySelectedConnection = null;
+ private String[] restrictSystemTypesTo;
+ private static String lastProfile = null;
+ private boolean showProfilePageInitially = true;
+ private IHost _dummyHost;
+
+ /**
+ * Constructor
+ */
+ public SystemNewConnectionWizard()
+ {
+ super(SystemResources.RESID_NEWCONN_TITLE,
+ SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_NEWCONNECTIONWIZARD_ID));
+ activeProfileNames = SystemStartHere.getSystemProfileManager().getActiveSystemProfileNames();
+ super.setForcePreviousAndNextButtons(true);
+ super.setNeedsProgressMonitor(true);
+ }
+
+ /**
+ * Call this to restrict the system type that the user is allowed to choose
+ */
+ public void restrictSystemType(String systemType)
+ {
+ restrictSystemTypesTo = new String[1];
+ restrictSystemTypesTo[0] = systemType;
+ if (mainPage != null)
+ mainPage.restrictSystemTypes(restrictSystemTypesTo);
+ }
+ /**
+ * Call this to restrict the system types that the user is allowed to choose
+ */
+ public void restrictSystemTypes(String[] systemTypes)
+ {
+ this.restrictSystemTypesTo = systemTypes;
+ if (mainPage != null)
+ mainPage.restrictSystemTypes(systemTypes);
+ }
+
+ public IHost getDummyHost()
+ {
+ if (_dummyHost == null)
+ {
+ _dummyHost = new DummyHost(mainPage.getHostName(), mainPage.getSystemType());
+ }
+ return _dummyHost;
+ }
+
+ /**
+ * Creates the wizard pages.
+ * This method is an override from the parent Wizard class.
+ */
+ public void addPages()
+ {
+ try {
+ mainPage = createMainPage(restrictSystemTypesTo);
+ mainPage.setConnectionNameValidators(SystemConnectionForm.getConnectionNameValidators());
+ mainPage.setCurrentlySelectedConnection(currentlySelectedConnection);
+ if (defaultUserId != null)
+ mainPage.setUserId(defaultUserId);
+ if (defaultConnectionName != null)
+ mainPage.setConnectionName(defaultConnectionName);
+ if (defaultHostName != null)
+ mainPage.setHostName(defaultHostName);
+
+ if (restrictSystemTypesTo != null)
+ mainPage.restrictSystemTypes(restrictSystemTypesTo);
+
+ ISystemProfile defaultProfile = SystemStartHere.getSystemProfileManager().getDefaultPrivateSystemProfile();
+
+ showProfilePageInitially = SystemPlugin.getDefault().getShowProfilePageInitially();
+ /* DKM - I don't think we should force profiles into the faces of users
+ * we no longer default to "private" so hopefully this would never be
+ * desirable
+ *
+ // if there is a default private profile, we might want to show the rename profile page
+ if (defaultProfile != null)
+ {
+ // make private profile equal to default profile
+ privateProfile = defaultProfile;
+
+ // get the private profile index in the list of active profiles
+ for (int idx=0; (privateProfileIndex<0) && (idx
+ * This page asks for a unique personal name for the private profile.
+ */
+
+public class SystemNewConnectionWizardRenameProfilePage
+ extends AbstractSystemWizardPage
+ implements ISystemMessages,
+ ISystemMessageLine
+{
+
+ protected SystemProfileForm form;
+
+ /**
+ * Constructor.
+ */
+ public SystemNewConnectionWizardRenameProfilePage(Wizard wizard)
+ {
+ super(wizard, "RenamePrivateProfile",
+ SystemResources.RESID_RENAMEDEFAULTPROFILE_PAGE1_TITLE,
+ SystemResources.RESID_RENAMEDEFAULTPROFILE_PAGE1_DESCRIPTION);
+ form = getForm();
+ setHelp(SystemPlugin.HELPPREFIX + "wncp0000");
+ }
+
+ /**
+ * Return our hosting wizard
+ */
+ protected SystemNewConnectionWizard getOurWizard()
+ {
+ return (SystemNewConnectionWizard)getWizard();
+ }
+
+ /**
+ * Overrride this if you want to supply your own form. This may be called
+ * multiple times so please only instantatiate if the form instance variable
+ * is null, and then return the form instance variable.
+ * @see org.eclipse.rse.ui.SystemProfileForm
+ */
+ protected SystemProfileForm getForm()
+ {
+ if (form == null)
+ form = new SystemProfileForm(this,this,null, true);
+ //SystemStartHere.getSystemProfileManager().getDefaultPrivateSystemProfile());
+ return form;
+ }
+ /**
+ * CreateContents is the one method that must be overridden from the parent class.
+ * In this method, we populate an SWT container with widgets and return the container
+ * to the caller (JFace). This is used as the contents of this page.
+ */
+ public Control createContents(Composite parent)
+ {
+ Control c = form.createContents(parent);
+ form.getInitialFocusControl().setFocus();
+
+ String initProfileName = SystemPlugin.getLocalMachineName();
+ int dotIndex = initProfileName.indexOf('.');
+
+ if (dotIndex != -1) {
+ initProfileName = initProfileName.substring(0, dotIndex);
+ }
+
+ form.setProfileName(initProfileName);
+
+ return c;
+ }
+ /**
+ * Return the Control to be given initial focus.
+ * Override from parent. Return control to be given initial focus.
+ */
+ protected Control getInitialFocusControl()
+ {
+ return form.getInitialFocusControl();
+ }
+
+ /**
+ * Completes processing of the wizard. If this
+ * method returns true, the wizard will close;
+ * otherwise, it will stay active.
+ * This method is an override from the parent Wizard class.
+ *
+ * @return whether the wizard finished successfully
+ */
+ public boolean performFinish()
+ {
+ return form.verify();
+ }
+
+ // --------------------------------- //
+ // METHODS FOR EXTRACTING USER DATA ...
+ // --------------------------------- //
+ /**
+ * Return name of profile to contain new connection.
+ * Call this after finish ends successfully.
+ */
+ public String getProfileName()
+ {
+ return form.getProfileName();
+ }
+
+ // ISystemMessageLine methods
+// public void clearMessage()
+// {
+// setMessage(null);
+// }
+ //public void clearErrorMessage()
+ //{
+ //setErrorMessage(null);
+ //}
+
+ public Object getLayoutData()
+ {
+ return null;
+ }
+
+ public void setLayoutData(Object gridData)
+ {
+ }
+
+ /**
+ * Return true if the page is complete, so to enable Finish.
+ * Called by wizard framework.
+ */
+ public boolean isPageComplete()
+ {
+ boolean ok = false;
+ if (form!=null)
+ {
+ ok = form.isPageComplete();
+ if (ok
+ && isCurrentPage()) // defect 41831
+ getOurWizard().setNewPrivateProfileName(form.getProfileName());
+ }
+ return ok;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SystemNewProfileWizard.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SystemNewProfileWizard.java
new file mode 100644
index 00000000000..37e09482c49
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SystemNewProfileWizard.java
@@ -0,0 +1,104 @@
+/********************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.wizards;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.rse.core.SystemBasePlugin;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.model.ISystemRegistry;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.messages.SystemMessageDialog;
+
+/**
+ * Wizard for creating a new remote system profile.
+ */
+public class SystemNewProfileWizard
+ extends AbstractSystemWizard
+
+{
+
+ private SystemNewProfileWizardMainPage mainPage;
+
+ /**
+ * Constructor
+ */
+ public SystemNewProfileWizard()
+ {
+ super(SystemResources.RESID_NEWPROFILE_TITLE,
+ SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_NEWPROFILEWIZARD_ID));
+ }
+
+ /**
+ * Creates the wizard pages.
+ * This method is an override from the parent Wizard class.
+ */
+ public void addPages()
+ {
+ try {
+ mainPage = createMainPage();
+ addPage((WizardPage)mainPage);
+ //super.addPages();
+ } catch (Exception exc)
+ {
+ SystemBasePlugin.logError("New connection: Error in createPages: ",exc);
+ }
+ }
+
+ /**
+ * Creates the wizard's main page.
+ * This method is an override from the parent class.
+ */
+ protected SystemNewProfileWizardMainPage createMainPage()
+ {
+ mainPage = new SystemNewProfileWizardMainPage(this);
+ return mainPage;
+ }
+ /**
+ * Completes processing of the wizard. If this
+ * method returns true, the wizard will close;
+ * otherwise, it will stay active.
+ * This method is an override from the parent Wizard class.
+ *
+ * @return whether the wizard finished successfully
+ */
+ public boolean performFinish()
+ {
+ boolean ok = true;
+ if (mainPage.performFinish())
+ {
+ //SystemMessage.showInformationMessage(getShell(),"Finish pressed.");
+ ISystemRegistry sr = SystemPlugin.getTheSystemRegistry();
+ String name = mainPage.getProfileName();
+ boolean makeActive = mainPage.getMakeActive();
+ try
+ {
+ sr.createSystemProfile(name,makeActive);
+ } catch (Exception exc)
+ {
+ String msg = "Exception creating profile ";
+ SystemBasePlugin.logError(msg,exc);
+ //System.out.println(msg + exc.getMessage() + ": " + exc.getClass().getName());
+ SystemMessageDialog.displayExceptionMessage(getShell(),exc);
+ }
+ return ok;
+ }
+ else
+ ok = false;
+ return ok;
+ }
+
+} // end class
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SystemNewProfileWizardMainPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SystemNewProfileWizardMainPage.java
new file mode 100644
index 00000000000..afb9f1a6386
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SystemNewProfileWizardMainPage.java
@@ -0,0 +1,208 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.wizards;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.SystemWidgetHelpers;
+import org.eclipse.rse.ui.dialogs.SystemUserIdPerSystemTypeDialog;
+import org.eclipse.rse.ui.messages.ISystemMessageLine;
+import org.eclipse.rse.ui.validators.ISystemValidator;
+import org.eclipse.rse.ui.validators.ValidatorProfileName;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Text;
+
+
+/**
+ * Default main page of the "New Profile" wizard.
+ * This page asks for the following information:
+ * February 24, 2005 The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available at http://www.eclipse.org/legal/epl-v10.html.
+For purposes of the EPL, "Program" will mean the Content. If you did not receive this Content directly from the Eclipse Foundation, the Content is being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content.
+ * The following features are supported:
+ *
+ * If the meaning of the 'Name' attribute isn't clear,
+ * there really should be more of a description here...
+ *
+ * If the meaning of the 'Type' attribute isn't clear,
+ * there really should be more of a description here...
+ *
+ * If the meaning of the 'Supports Nested Filters' attribute isn't clear,
+ * there really should be more of a description here...
+ *
+ * If the meaning of the 'Relative Order' attribute isn't clear,
+ * there really should be more of a description here...
+ *
+ * If the meaning of the 'Default' attribute isn't clear,
+ * there really should be more of a description here...
+ *
+ * If the meaning of the 'Strings Case Sensitive' attribute isn't clear,
+ * there really should be more of a description here...
+ *
+ * If the meaning of the 'Promptable' attribute isn't clear,
+ * there really should be more of a description here...
+ *
+ * If the meaning of the 'Supports Duplicate Filter Strings' attribute isn't clear,
+ * there really should be more of a description here...
+ *
+ * If the meaning of the 'Non Deletable' attribute isn't clear,
+ * there really should be more of a description here...
+ *
+ * If the meaning of the 'Non Renamable' attribute isn't clear,
+ * there really should be more of a description here...
+ *
+ * If the meaning of the 'Non Changable' attribute isn't clear,
+ * there really should be more of a description here...
+ *
+ * If the meaning of the 'Strings Non Changable' attribute isn't clear,
+ * there really should be more of a description here...
+ *
+ * If the meaning of the 'Release' attribute isn't clear,
+ * there really should be more of a description here...
+ *
+ * If the meaning of the 'Single Filter String Only' attribute isn't clear,
+ * there really should be more of a description here...
+ *
+ * If the meaning of the 'Nested Filters' containment reference list isn't clear,
+ * there really should be more of a description here...
+ *
+ * If the meaning of the 'Parent Filter' container reference isn't clear,
+ * there really should be more of a description here...
+ *
+ * If the meaning of the 'Strings' containment reference list isn't clear,
+ * there really should be more of a description here...
+ *
+ * We always return false.
+ * @see SystemFilterSimple
+ */
+ public boolean isTransient();
+ /**
+ * Clones a given filter to the given target filter.
+ * All filter strings, and all nested filters, are copied.
+ * @param targetFilter new filter into which we copy all our data
+ */
+ public void clone(ISystemFilter targetFilter);
+ /**
+ * Return the ISystemFilterContainer parent of this filter. Will be either
+ * a SystemFilterPool or a SystemFilter if this is a nested filter.
+ */
+ public ISystemFilterContainer getParentFilterContainer();
+ /**
+ * Return the caller which instantiated the filter pool manager overseeing this filter framework instance
+ */
+ public ISystemFilterPoolManagerProvider getProvider();
+
+} // SystemFilter
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterConstants.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterConstants.java
new file mode 100644
index 00000000000..d5477da716a
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterConstants.java
@@ -0,0 +1,41 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.filters;
+/**
+ * Constants used throughout filters framework.
+ */
+public interface ISystemFilterConstants extends ISystemFilterSavePolicies
+{
+ /**
+ * Parameter value on create operations when a restore should be attempted first
+ */
+ public static final boolean TRY_TO_RESTORE_YES = true;
+ /**
+ * Parameter value on create operations when no restore should be attempted first
+ */
+ public static final boolean TRY_TO_RESTORE_NO = false;
+
+ /**
+ * Suffix used when persisting data to a file.
+ */
+ public static final String SAVEFILE_SUFFIX = ".xmi";
+
+ /**
+ * Default value for the type attribute for filter pools, filters and filterstrings
+ */
+ public static final String DEFAULT_TYPE = "default";
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterContainer.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterContainer.java
new file mode 100644
index 00000000000..966971ef78c
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterContainer.java
@@ -0,0 +1,111 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.filters;
+//
+
+import java.util.Vector;
+
+import org.eclipse.rse.persistence.IRSEPersistableContainer;
+
+/**
+ * Filter containers are any objects that contain filters.
+ * This includes filter pools and filters themselves.
+ */
+public interface ISystemFilterContainer extends IRSEPersistableContainer
+{
+ /**
+ * Return the filter pool manager managing this collection of filter pools and their filters.
+ */
+ public ISystemFilterPoolManager getSystemFilterPoolManager();
+ /**
+ * @return The value of the StringsCaseSensitive attribute
+ * Are filter strings in this filter case sensitive?
+ * If not set locally, queries the parent filter pool manager's atttribute.
+ */
+ public boolean areStringsCaseSensitive();
+ /**
+ * Creates a new system filter within this container (SystemFilterPool or SystemFilter)
+ * @param data Optional transient data you want stored in the created filter. Can be null.
+ * @param aliasName The name to give the new filter. Must be unique for this pool.
+ * @param filterStrings The list of String objects that represent the filter strings.
+ */
+ public ISystemFilter createSystemFilter(String aliasName, Vector filterStrings);
+ /**
+ * Adds given filter to the list.
+ * PLEASE NOTE:
+ *
+ * Note that not all methods will be used for all saving policies.
+ *
+ * @see org.eclipse.rse.internal.filters.SystemFilterNamingPolicy#getNamingPolicy()
+ */
+public interface ISystemFilterNamingPolicy
+{
+ /**
+ * Get the unqualified save file name for the given SystemFilterPoolManager object name.
+ * Do NOT include the extension, as .xmi will be added.
+ */
+ public String getManagerSaveFileName(String managerName);
+ /**
+ * Get the unqualified save file name for the given SystemFilterPoolReferenceManager object name.
+ * Do NOT include the extension, as .xmi will be added.
+ */
+ public String getReferenceManagerSaveFileName(String managerName);
+ /**
+ * Get the unqualified save file name for the given SystemFilterPool object name.
+ * Do NOT include the extension, as .xmi will be added.
+ */
+ public String getFilterPoolSaveFileName(String poolName);
+ /**
+ * Get the file name prefix for all pool files.
+ * Used to deduce the saved pools by examining the file system
+ */
+ public String getFilterPoolSaveFileNamePrefix();
+ /**
+ * Get the folder name for the given SystemFilterPool object name.
+ */
+ public String getFilterPoolFolderName(String poolName);
+ /**
+ * Get the folder name prefix for all pool folders.
+ * Used to deduce the saved pools by examining the file system
+ */
+ public String getFilterPoolFolderNamePrefix();
+ /**
+ * Get the unqualified save file name for the given SystemFilter object name
+ * Do NOT include the extension, as .xmi will be added.
+ */
+ public String getFilterSaveFileName(String filterName);
+ /**
+ * Get the file name prefix for all filter files.
+ * Used to deduce the saved pools by examining the file system
+ */
+ public String getFilterSaveFileNamePrefix();
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPool.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPool.java
new file mode 100644
index 00000000000..a7a63bedd9a
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPool.java
@@ -0,0 +1,343 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.filters;
+import org.eclipse.rse.model.IRSEModelObject;
+import org.eclipse.rse.references.ISystemPersistableReferencedObject;
+
+
+/**
+ * This interface represents a system filter pool, which is a means of
+ * grouping filters.
+ * While the framework has all the code necessary to arrange filters and save/restore
+ * that arrangement, you may choose to use preferences instead of this support.
+ * In this case, call this method and pass in the saved and sorted filter name list.
+ *
+ * Called by someone after restore.
+ */
+ public void orderSystemFilters(String[] names);
+ /**
+ * Set the save file policy. See constants in SystemFilterConstants. One of:
+ *
+ * If the meaning of the 'Single Filter String Only' attribute isn't clear,
+ * there really should be more of a description here...
+ *
+ * If the meaning of the 'Owning Parent Name' attribute isn't clear,
+ * there really should be more of a description here...
+ *
+ * If the meaning of the 'Non Renamable' attribute isn't clear,
+ * there really should be more of a description here...
+ *
+ * Each filter pool that is managed becomes a folder on disk.
+ *
+ * To create a filter pool manager instance, use the factory methods
+ * in SystemFilterPoolManagerImpl in the ...impl package.
+ * You must pass a folder that represents the anchor point for the
+ * pools managed by this manager instance.
+ *
+ * Depending on your tools' needs, you have four choices about how
+ * the filter pools and filters are persisted to disk. The decision is
+ * made at the time you instantiate the pool manager and is one of the
+ * following constants from the {@link SystemFilterConstants} interface:
+ *
+ * With the policy of one file per pool, there are two possibilities regarding
+ * the folder structure:
+ *
+ * With the policy of one file per filter, each filter pool must have its own folder.
+ *
+ * With an instantiated filter pool manager (most tools will only need
+ * one such instance), you now simply call its methods to work with
+ * filter pools. For example, use it to:
+ *
+ * Further, this is the front door for working with filters too. By forcing all
+ * filter related activity through a single point like this, we can ensure that
+ * all changes are saved to disk, and events are fired properly.
+ */
+/**
+ * @lastgen interface SystemFilterPoolManager {}
+ */
+public interface ISystemFilterPoolManager extends IRSEPersistableContainer
+{
+ // ---------------------------------
+ // ATTRIBUTE METHODS
+ // ---------------------------------
+ /**
+ * Return the caller which instantiated the filter pool manager
+ */
+ public ISystemFilterPoolManagerProvider getProvider();
+
+ /**
+ * Return the owning profile for this provider
+ */
+ public ISystemProfile getSystemProfile();
+
+ /**
+ * Set the caller instance which instantiated the filter pool manager.
+ * This is only recorded to enable getProvider from any filter framework object.
+ */
+ public void setProvider(ISystemFilterPoolManagerProvider caller);
+
+ /**
+ * This is to set transient data that is subsequently queryable.
+ */
+ public void setSystemFilterPoolManagerData(Object data);
+ /**
+ * Return transient data set via setFilterPoolDataManager.
+ */
+ public Object getSystemFilterPoolManagerData();
+ /**
+ * Return the name of this manager.
+ * This matches the name of the folder, which is the parent of the individual filter pool folders.
+ */
+ public String getName();
+
+/**
+ * Set the name of this manager.
+ */
+ public void setName(String name);
+
+ /**
+ * Return attribute indicating if filter pools managed by this manager support nested filters.
+ */
+ public boolean supportsNestedFilters();
+ /**
+ * Return attribute indicating if filters managed by this manager support nested duplicate filter strings.
+ */
+ public boolean supportsDuplicateFilterStrings();
+ /**
+ * Set attribute indicating if filter pools managed by this manager support nested filters, by default.
+ */
+ public void setSupportsNestedFilters(boolean supports);
+
+ /**
+ * Set attribute indicating if filters managed by this manager support duplicate filter strings, by default.
+ */
+ public void setSupportsDuplicateFilterStrings(boolean supports);
+
+ /**
+ * @return The value of the StringsCaseSensitive attribute
+ * Are filter strings in this filter case sensitive?
+ */
+ public boolean isStringsCaseSensitive();
+
+ /**
+ * @return The value of the StringsCaseSensitive attribute
+ * Are filter strings in this filter case sensitive?
+ * Same as isStringsCaseSensitive()
+ */
+ public boolean areStringsCaseSensitive();
+
+ /**
+ * Return false if the instantiation of this filter pool manager resulting in a new manager versus a restoration
+ */
+ public boolean wasRestored();
+
+ // ---------------------------------
+ // FILTER POOL METHODS
+ // ---------------------------------
+ /**
+ * Get array of filter pool names currently existing.
+ */
+ public String[] getSystemFilterPoolNames();
+ /**
+ * Get vector of filter pool names currently existing.
+ */
+ public Vector getSystemFilterPoolNamesVector();
+
+ /**
+ * Return array of SystemFilterPools managed by this manager.
+ */
+ public ISystemFilterPool[] getSystemFilterPools();
+
+ /**
+ * Given a filter pool name, return that filter pool object.
+ * If not found, returns null.
+ */
+ public ISystemFilterPool getSystemFilterPool(String name);
+
+ /**
+ * Return the first pool that has the default attribute set to true.
+ * If none found, returns null.
+ */
+ public ISystemFilterPool getFirstDefaultSystemFilterPool();
+
+ /**
+ * Create a new filter pool.
+ * Inherits the following attributes from this manager:
+ *
+ * If a pool of this name already exists, null will be returned.
+ *
+ * Depending on the save policy, a new folder to hold the pool may be created. Its name will
+ * be derived from the pool name.
+ *
+ * If the operation is successful, the pool will be saved to disk.
+ *
+ * If this operation fails unexpectedly, an exception will be thrown.
+ */
+ public ISystemFilterPool createSystemFilterPool(String name, boolean isDeletable)
+ throws Exception;
+
+ /**
+ * Delete a given filter pool. Dependending on the save policy, the
+ * appropriate file or folder on disk will also be deleted.
+ *
+ * Does the following:
+ *
+ * Does the following:
+ *
+ * Does the following:
+ *
+ * Does the following:
+ *
+ * Does the following:
+ * Calls back to provider to inform of the event (filterEventFilterCreated)
+ * @param parent The parent which is either a SystemFilterPool or a SystemFilter
+ * @param aliasName The name to give the new filter. Must be unique for this pool.
+ * @param filterStrings The list of String objects that represent the filter strings.
+ */
+ public ISystemFilter createSystemFilter(ISystemFilterContainer parent,
+ String aliasName, Vector filterStrings)
+ throws Exception;
+ /**
+ * Creates a new system filter that is typed.
+ * Same as {@link #createSystemFilter(ISystemFilterContainer, String, Vector)} but
+ * takes a filter type as an additional parameter.
+ *
+ * A filter's type is an arbitrary string that is not interpreted or used by the base framework. This
+ * is for use entirely by tools who wish to support multiple types of filters and be able to launch unique
+ * actions per type, say.
+ *
+ * @param parent The parent which is either a SystemFilterPool or a SystemFilter
+ * @param aliasName The name to give the new filter. Must be unique for this pool.
+ * @param filterStrings The list of String objects that represent the filter strings.
+ * @param type The type of this filter
+ */
+ public ISystemFilter createSystemFilter(ISystemFilterContainer parent,
+ String aliasName, Vector filterStrings, String type)
+ throws Exception;
+ /**
+ * Creates a new system filter that is typed and promptable
+ * Same as {@link #createSystemFilter(ISystemFilterContainer, String ,Vector, String)} but
+ * takes a boolean indicating if it is promptable.
+ *
+ * A promptable filter is one in which the user is prompted for information at expand time.
+ * There is no base filter framework support for this, but tools can query this attribute and
+ * do their own thing at expand time.
+ *
+ * @param parent The parent which is either a SystemFilterPool or a SystemFilter
+ * @param aliasName The name to give the new filter. Must be unique for this pool.
+ * @param filterStrings The list of String objects that represent the filter strings.
+ * @param type The type of this filter
+ * @param promptable Pass true if this is a promptable filter
+ */
+ public ISystemFilter createSystemFilter(ISystemFilterContainer parent,
+ String aliasName, Vector filterStrings, String type, boolean promptable)
+ throws Exception;
+
+ /**
+ * Delete an existing system filter.
+ * Does the following:
+ *
+ * Does the following:
+ *
+ * Does the following:
+ *
+ * A filter's type is an arbitrary string that is not interpreted or used by the base framework. This
+ * is for use entirely by tools who wish to support multiple types of filters and be able to launch unique
+ * actions per type, say.
+ * @param parent The parent which is either a SystemFilterPool or a SystemFilter
+ * @param type The type of this filter
+ */
+ public void setSystemFilterType(ISystemFilter filter, String newType)
+ throws Exception;
+
+ /**
+ * Copy a system filter to a pool in this or another filter manager.
+ */
+ public ISystemFilter copySystemFilter(ISystemFilterPool targetPool, ISystemFilter oldFilter, String newName)
+ throws Exception;
+
+ /**
+ * Return the zero-based position of a SystemFilter object within its container
+ */
+ public int getSystemFilterPosition(ISystemFilter filter);
+
+ /**
+ * Move a system filter to a pool in this or another filter manager.
+ * Does this by first copying the filter, and only if successful, deleting the old copy.
+ */
+ public ISystemFilter moveSystemFilter(ISystemFilterPool targetPool, ISystemFilter oldFilter, String newName)
+ throws Exception;
+
+ /**
+ * Move existing filters a given number of positions in the same container.
+ * If the delta is negative, they are all moved up by the given amount. If
+ * positive, they are all moved down by the given amount.
+ *
+ * Does the following:
+ *
+ * While the framework has all the code necessary to arrange filters and save/restore
+ * that arrangement, you may choose to use preferences instead of this support.
+ * In this case, call this method and pass in the saved and sorted filter name list.
+ *
+ * Called by someone after restore.
+ */
+ public void orderSystemFilters(ISystemFilterPool pool, String[] names) throws Exception;
+
+ // -------------------------------
+ // SYSTEM FILTER STRING METHODS...
+ // -------------------------------
+ /**
+ * Append a new filter string to the given filter's list
+ *
+ * Does the following:
+ *
+ * Does the following:
+ *
+ * Does the following:
+ *
+ * Does the following:
+ *
+ * Does the following:
+ *
+ * Does the following:
+ *
+ *
+ * Does the following:
+ *
+ * If the meaning of the 'Single Filter String Only' attribute isn't clear,
+ * there really should be more of a description here...
+ *
+ * Further, the goal is the allow all the filter framework UI actions to work
+ * independently, able to fully handle all actions without intervention on the
+ * provider's part. However, often the provider needs to be informed of all events
+ * in order to fire events to update its GUI. So this interface captures those
+ * callbacks that done to the provider for every interesting event. Should you
+ * not care about these, supply empty shells for these methods.
+ */
+public interface ISystemFilterPoolManagerProvider extends IAdaptable
+{
+
+ /**
+ * Return the unique id for this provider
+ * @return
+ */
+ public String getId();
+
+ /**
+ * Return the manager object for the given manager name.
+ */
+ public ISystemFilterPoolManager getSystemFilterPoolManager(String managerName);
+ /**
+ * Return all the manager objects this provider owns
+ */
+ public ISystemFilterPoolManager[] getSystemFilterPoolManagers();
+ /**
+ * Return all the manager objects this provider owns, to which it wants
+ * to support referencing from the given filter reference manager.
+ *
+ * Called by SystemFilterPoolReferenceManager.
+ */
+ public ISystemFilterPoolManager[] getReferencableSystemFilterPoolManagers(ISystemFilterPoolReferenceManager refMgr);
+ /**
+ * Last chance call, by a filter pool reference manager, when a reference to a filter
+ * pool is found but the referenced master filter pool is not found in those the reference
+ * manager by getSystemFilterPoolManagers().
+ *
+ * If this returns null, then this broken reference will be deleted
+ */
+ public ISystemFilterPool getSystemFilterPoolForBrokenReference(ISystemFilterPoolReferenceManager callingRefenceMgr,
+ String missingPoolMgrName, String missingPoolName);
+
+ // ---------------------
+ // FILTER POOL EVENTS...
+ // ---------------------
+ /**
+ * A new filter pool has been created
+ */
+ public void filterEventFilterPoolCreated(ISystemFilterPool newPool);
+ /**
+ * A filter pool has been deleted
+ */
+ public void filterEventFilterPoolDeleted(ISystemFilterPool oldPool);
+ /**
+ * A filter pool has been renamed
+ */
+ public void filterEventFilterPoolRenamed(ISystemFilterPool pool, String oldName);
+ /**
+ * One or more filter pools have been re-ordered within their manager
+ */
+ public void filterEventFilterPoolsRePositioned(ISystemFilterPool[] pools, int delta);
+
+ // ---------------------
+ // FILTER EVENTS...
+ // ---------------------
+ /**
+ * A new filter has been created
+ */
+ public void filterEventFilterCreated(ISystemFilter newFilter);
+ /**
+ * A filter has been deleted
+ */
+ public void filterEventFilterDeleted(ISystemFilter oldFilter);
+ /**
+ * A filter has been renamed
+ */
+ public void filterEventFilterRenamed(ISystemFilter filter, String oldName);
+ /**
+ * A filter's strings have been updated
+ */
+ public void filterEventFilterUpdated(ISystemFilter filter);
+ /**
+ * One or more filters have been re-ordered within their pool or filter (if nested)
+ */
+ public void filterEventFiltersRePositioned(ISystemFilter[] filters, int delta);
+
+ // -----------------------
+ // FILTER STRING EVENTS...
+ // -----------------------
+ /**
+ * A new filter string has been created
+ */
+ public void filterEventFilterStringCreated(ISystemFilterString newFilterString);
+ /**
+ * A filter string has been deleted
+ */
+ public void filterEventFilterStringDeleted(ISystemFilterString oldFilterString);
+ /**
+ * A filter string has been updated
+ */
+ public void filterEventFilterStringUpdated(ISystemFilterString filterString);
+ /**
+ * One or more filters have been re-ordered within their filter
+ */
+ public void filterEventFilterStringsRePositioned(ISystemFilterString[] filterStrings, int delta);
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolReference.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolReference.java
new file mode 100644
index 00000000000..9cd0fb5c8ad
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolReference.java
@@ -0,0 +1,81 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.filters;
+import org.eclipse.rse.model.IRSEModelObject;
+import org.eclipse.rse.references.ISystemPersistableReferencingObject;
+
+
+/**
+ * Interface implemented by references to filter pools. Filter pools are stored at the profile
+ * level, while subsystems contain references to one or more pools. A pool can be referenced
+ * by multiple connections. Pools don't go away until explicitly deleted by the user, regardless
+ * of their reference count.
+ */
+/**
+ * @lastgen interface SystemFilterPoolReference extends SystemPersistableReferencingObject, ISystemPersistableReferencingObject, SystemFilterContainerReference {}
+ */
+public interface ISystemFilterPoolReference extends ISystemPersistableReferencingObject, ISystemFilterContainerReference, IRSEModelObject
+{
+ /**
+ * Return the reference manager which is managing this filter reference
+ * framework object.
+ */
+ public ISystemFilterPoolReferenceManager getFilterPoolReferenceManager();
+
+ /**
+ * Return the object which instantiated the pool reference manager object.
+ * Makes it easy to get back to the point of origin, given any filter reference
+ * framework object
+ */
+ public ISystemFilterPoolReferenceManagerProvider getProvider();
+
+ /**
+ * Return name of the filter pool we reference
+ * The pool name is stored qualified by the manager name,
+ * so we first have to strip it off.
+ */
+ public String getReferencedFilterPoolName();
+ /**
+ * Return name of the filter pool manager containing the pool we reference.
+ * The pool name is stored qualified by the manager name,
+ * so we get it from there.
+ */
+ public String getReferencedFilterPoolManagerName();
+
+ /**
+ * Reset the name of the filter pool we reference.
+ * Called on filter pool rename operations
+ */
+ public void resetReferencedFilterPoolName(String newName);
+
+
+ /**
+ * Set the filter pool that we reference.
+ * This also calls addReference(this) on that pool!
+ */
+ public void setReferenceToFilterPool(ISystemFilterPool pool);
+
+ /**
+ * Return referenced filter pool object
+ */
+ public ISystemFilterPool getReferencedFilterPool();
+
+ /**
+ * Return fully qualified name that includes the filter pool managers name
+ */
+ public String getFullName();
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolReferenceManager.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolReferenceManager.java
new file mode 100644
index 00000000000..b0e01a8277f
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolReferenceManager.java
@@ -0,0 +1,268 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.filters;
+import java.util.Vector;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.references.ISystemBasePersistableReferenceManager;
+
+
+/**
+ * This class manages a persistable list of objects each of which reference
+ * a filter pool. This class builds on the parent class SystemPersistableReferenceManager,
+ * offering convenience versions of the parent methods that are typed to the
+ * classes in the filters framework.
+ */
+/**
+ * @lastgen interface SystemFilterPoolReferenceManager extends SystemPersistableReferenceManager {}
+ */
+public interface ISystemFilterPoolReferenceManager extends ISystemBasePersistableReferenceManager
+{
+ /**
+ * Get the object which instantiated this instance of the filter pool reference manager.
+ * This is also available from any filter reference framework object.
+ */
+ public ISystemFilterPoolReferenceManagerProvider getProvider();
+ /**
+ * Set the object which instantiated this instance of the filter pool reference manager.
+ * This makes it available to retrieve from any filter reference framework object,
+ * via the ubiquitous getProvider interface method.
+ */
+ public void setProvider(ISystemFilterPoolReferenceManagerProvider caller);
+ /**
+ * Turn off callbacks to the provider until turned on again.
+ */
+ public void setProviderEventNotification(boolean fireEvents);
+ // ------------------------------------------------------------
+ // Methods for setting and querying related filterpool manager
+ // ------------------------------------------------------------
+ /*
+ * Set the managers of the master list of filter pools, from which
+ * objects in this list reference.
+ * NOW DELETED SO THAT WE DYNAMICALLY QUERY THIS LIST FROM THE
+ * ASSOCIATED SYSTEMFILTERPOOLMANAGER PROVIDER, SO IT IS ALWAYS UP
+ * TO DATE. psc.
+ */
+ //public void setSystemFilterPoolManagers(SystemFilterPoolManager[] mgrs);
+ /**
+ * Set the associated master pool manager provider. Note the provider
+ * typically manages multiple pool managers and we manage references
+ * across those.
+ */
+ public void setSystemFilterPoolManagerProvider(ISystemFilterPoolManagerProvider poolMgrProvider);
+ /**
+ * Get the associated master pool manager provider. Note the provider
+ * typically manages multiple pool managers and we manage references
+ * across those.
+ */
+ public ISystemFilterPoolManagerProvider getSystemFilterPoolManagerProvider();
+ /**
+ * Get the managers of the master list of filter pools, from which
+ * objects in this list reference.
+ */
+ public ISystemFilterPoolManager[] getSystemFilterPoolManagers();
+ /**
+ * Get the managers of the master list of filter pools, from which
+ * objects in this list reference, but which are not in the list of
+ * managers our pool manager supplier gives us. That is, these are
+ * references to filter pools outside the expected list.
+ * @return null if no unmatched managers found, else an array of such managers.
+ */
+ public ISystemFilterPoolManager[] getAdditionalSystemFilterPoolManagers();
+ /**
+ * Set the default manager of the master list of filter pools, from which
+ * objects in this list reference.
+ */
+ public void setDefaultSystemFilterPoolManager(ISystemFilterPoolManager mgr);
+ /**
+ * Get the default manager of the master list of filter pools, from which
+ * objects in this list reference.
+ */
+ public ISystemFilterPoolManager getDefaultSystemFilterPoolManager();
+
+ // ---------------------------------------------------
+ // Methods that work on FilterPool referencing objects
+ // ---------------------------------------------------
+ /**
+ * Ask each referenced pool for its name, and update it.
+ * Called after the name of the pool or its manager changes.
+ */
+ public void regenerateReferencedSystemFilterPoolNames();
+ /**
+ * Return array of SystemFilterPoolReference objects.
+ * Result will never be null, although it may be an array of length zero.
+ */
+ public ISystemFilterPoolReference[] getSystemFilterPoolReferences();
+ /**
+ * In one shot, set the filter pool references
+ * Calls back to inform provider
+ * @param array of filter pool reference objects to set the list to.
+ * @param deReference true to first de-reference all objects in the existing list.
+ */
+ public void setSystemFilterPoolReferences(ISystemFilterPoolReference[] filterPoolReferences,
+ boolean deReference);
+ /**
+ * Create a filter pool referencing object, but do NOT add it to the list, do NOT call back.
+ */
+ public ISystemFilterPoolReference createSystemFilterPoolReference(ISystemFilterPool filterPool);
+ /**
+ * Add a filter pool referencing object to the list.
+ * @return the new count of referencing objects
+ */
+ public int addSystemFilterPoolReference(ISystemFilterPoolReference filterPoolReference);
+ /**
+ * Reset the filter pool a reference points to. Called on a move-filter-pool operation
+ */
+ public void resetSystemFilterPoolReference(ISystemFilterPoolReference filterPoolReference, ISystemFilterPool newPool);
+ /**
+ * Remove a filter pool referencing object from the list.
+ * @param filterPool Reference the reference to remove
+ * @param deReference true if we want to dereference the referenced object (call removeReference on it)
+ * @return the new count of referencing objects
+ */
+ public int removeSystemFilterPoolReference(ISystemFilterPoolReference filterPoolReference,
+ boolean deReference);
+ /**
+ * Return count of referenced filter pools
+ */
+ public int getSystemFilterPoolReferenceCount();
+ /**
+ * Return the zero-based position of a SystemFilterPoolReference object within this list
+ */
+ public int getSystemFilterPoolReferencePosition(ISystemFilterPoolReference filterPoolRef);
+ /**
+ * Move a given filter pool reference to a given zero-based location
+ * Calls back to inform provider
+ */
+ public void moveSystemFilterPoolReference(ISystemFilterPoolReference filterPoolRef,int pos);
+ /**
+ * Move existing filter pool references a given number of positions.
+ * If the delta is negative, they are all moved up by the given amount. If
+ * positive, they are all moved down by the given amount.
+ * Calls back to inform provider
+ * @param filterPoolRefs Array of SystemFilterPoolReferences to move.
+ * @param newPosition new zero-based position for the filter pool references.
+ */
+ public void moveSystemFilterPoolReferences(ISystemFilterPoolReference[] filterPoolRefs, int delta);
+
+ // ----------------------------------------------
+ // Methods that work on FilterPool master objects
+ // ----------------------------------------------
+ /**
+ * Return array of filter pools currently referenced by this manager
+ * Result will never be null, although it may be an array of length zero.
+ */
+ public ISystemFilterPool[] getReferencedSystemFilterPools();
+ /**
+ * Return true if the given filter pool has a referencing object in this list.
+ */
+ public boolean isSystemFilterPoolReferenced(ISystemFilterPool filterPool);
+ /**
+ * Given a filter pool, locate the referencing object for it and return it.
+ * @return the referencing object if found, else null
+ */
+ public ISystemFilterPoolReference getReferenceToSystemFilterPool(ISystemFilterPool filterPool);
+ /**
+ * Given a filter pool, create a referencing object and add it to the list.
+ * Calls back to inform provider
+ * @return new filter pool reference
+ */
+ public ISystemFilterPoolReference addReferenceToSystemFilterPool(ISystemFilterPool filterPool);
+
+ /**
+ * Given a filter pool, locate the referencing object for it and remove it from the list.
+ * Calls back to inform provider
+ * @return the new count of referencing objects
+ */
+ public int removeReferenceToSystemFilterPool(ISystemFilterPool filterPool);
+ /**
+ * A reference filter pool has been renamed. Update our stored name...
+ * Calls back to inform provider
+ */
+ public void renameReferenceToSystemFilterPool(ISystemFilterPool pool);
+ /**
+ * In one shot, set the filter pool references to new references to supplied filter pools.
+ * Calls back to inform provider
+ * @param array of filter pool objects to create references for
+ * @param deReference true to first de-reference all objects in the existing list.
+ */
+ public void setSystemFilterPoolReferences(ISystemFilterPool[] filterPools,
+ boolean deReference);
+ // -------------------------
+ // SPECIAL CASE METHODS
+ // -------------------------
+ /**
+ * Create a single filter refererence to a given filter. Needed when a filter
+ * is added to a pool, and the GUI is not showing pools but rather all filters
+ * in all pool references.
+ */
+ public ISystemFilterReference getSystemFilterReference(ISubSystem subSystem, ISystemFilter filter);
+ /**
+ * Concatenate all filter references from all filter pools we reference, into one
+ * big list.
+ */
+ public ISystemFilterReference[] getSystemFilterReferences(ISubSystem subSystem);
+ /**
+ * Given a filter reference, return its position within this reference manager
+ * when you think of all filter references from all filter pool references as
+ * being concatenated
+ */
+ public int getSystemFilterReferencePosition(ISystemFilterReference filterRef);
+ /**
+ * Given a filter, return its position within this reference manager
+ * when you think of all filter references from all filter pool references as
+ * being concatenated
+ */
+ public int getSystemFilterReferencePosition(ISubSystem subSystem, ISystemFilter filter);
+ // -------------------------
+ // SAVE / RESTORE METHODS...
+ // -------------------------
+ /**
+ * After restoring this from disk, there is only the referenced object name,
+ * not the referenced object pointer, for each referencing object.
+ *
+ * This method is called after restore and for each restored object in the list must:
+ *
+ * Further, the goal is the allow all the filter framework UI actions to work
+ * independently, able to fully handle all actions without intervention on the
+ * provider's part. However, often the provider needs to be informed of all events
+ * in order to fire events to update its GUI. So this interface captures those
+ * callbacks that done to the provider for every interesting event. Should you
+ * not care about these, supply empty shells for these methods.
+ */
+public interface ISystemFilterPoolReferenceManagerProvider
+{
+ /**
+ * Return the SystemFilterPoolReferenceManager object this provider holds/provides.
+ */
+ public ISystemFilterPoolReferenceManager getSystemFilterPoolReferenceManager();
+ /**
+ * Return the owning filter pool that is unique to this provider
+ */
+ public ISystemFilterPool getUniqueOwningSystemFilterPool(boolean createIfNotFound);
+
+ // -------------------------------
+ // FILTER POOL REFERENCE EVENTS...
+ // -------------------------------
+ /**
+ * A new filter pool reference has been created
+ */
+ public void filterEventFilterPoolReferenceCreated(ISystemFilterPoolReference newPoolRef);
+ /**
+ * A filter pool reference has been deleted
+ */
+ public void filterEventFilterPoolReferenceDeleted(ISystemFilterPoolReference filterPoolRef);
+ /**
+ * A single filter pool reference has been reset to reference a new pool
+ */
+ public void filterEventFilterPoolReferenceReset(ISystemFilterPoolReference filterPoolRef);
+ /**
+ * All filter pool references has been reset
+ */
+ public void filterEventFilterPoolReferencesReset();
+ /**
+ * A filter pool reference has been renamed (ie, its reference filter pool renamed)
+ */
+ public void filterEventFilterPoolReferenceRenamed(ISystemFilterPoolReference poolRef, String oldName);
+ /**
+ * One or more filter pool references have been re-ordered within their manager
+ */
+ public void filterEventFilterPoolReferencesRePositioned(ISystemFilterPoolReference[] poolRefs, int delta);
+ // -------------------------------
+ // FILTER REFERENCE EVENTS...
+ // -------------------------------
+ /**
+ * A new filter has been created. This is called when a filter pool reference is selected and a new filter
+ * is created, so that the provider can expand the selected filter pool reference and reveal the new filter
+ * within the selected pool reference.
+ *
+ * Only the selected node should be expanded if not already. All other references to this pool will already
+ * have been informed of the new addition, and will have refreshed their children but not expanded them.
+ */
+ public void filterEventFilterCreated(Object selectedObject, ISystemFilter newFilter);
+ // ---------------------------------
+ // FILTER STRING REFERENCE EVENTS...
+ // ---------------------------------
+ /**
+ * A new filter string has been created. This is called when a filter reference is selected and a new filter
+ * string is created, so that the provider can expand the selected filter reference and reveal the new filter
+ * string within the selected filter reference.
+ *
+ * Only the selected node should be expanded if not already. All other references to this filter will already
+ * have been informed of the new addition, and will have refreshed their children but not expanded them.
+ */
+ public void filterEventFilterStringCreated(Object selectedObject, ISystemFilterString newFilterString);
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolSelectionValidator.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolSelectionValidator.java
new file mode 100644
index 00000000000..4ca0e68520d
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolSelectionValidator.java
@@ -0,0 +1,40 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.filters;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+
+/**
+ * An interface required if you wish to be called back by the
+ * system filter wizard, when the user selects a target filter pool.
+ */
+public interface ISystemFilterPoolSelectionValidator
+{
+
+ /**
+ * Delimiter used to qualify filter names by filter pool name, when calling
+ * filter pool selection validator in new filter wizard.
+ */
+ public static final String DELIMITER_FILTERPOOL_FILTER = "_____";
+
+ /**
+ * Validate the given selection.
+ * @param filterPool the user-selected filter pool
+ * @return null if no error, else a SystemMessage
+ */
+ public SystemMessage validate(ISystemFilterPool filterPool);
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolWrapper.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolWrapper.java
new file mode 100644
index 00000000000..1b123842e82
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolWrapper.java
@@ -0,0 +1,33 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.filters;
+/**
+ * The system filter wizard allows callers to pass a list of wrapper objects
+ * for the user to select a filter pool
+ */
+public interface ISystemFilterPoolWrapper
+{
+
+ /**
+ * Get the name to display in the combo box for this wrapper
+ */
+ public String getDisplayName();
+ /**
+ * Get the wrappered SystemFilterPool object
+ */
+ public ISystemFilterPool getSystemFilterPool();
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolWrapperInformation.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolWrapperInformation.java
new file mode 100644
index 00000000000..d450dad2648
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolWrapperInformation.java
@@ -0,0 +1,51 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.filters;
+/**
+ * The system filter wizard allows callers to pass a list of wrapper objects
+ * for the user to select a filter pool. Effectively, this prompting for
+ * euphamisms to filter pools. This requires an array of wrapper objects,
+ * and requires replacement mri for the pool prompt and tooltip text, and
+ * the verbage above it.
+ *
+ * This is all encapsulated in this interface. There is also a class offered
+ * that implements all this and is populated via setters.
+ */
+public interface ISystemFilterPoolWrapperInformation
+{
+
+ /**
+ * Get the label
+ */
+ public String getPromptLabel();
+
+ /**
+ * Get the tooltip
+ */
+ public String getPromptTooltip();
+
+ public String getVerbageLabel();
+ /**
+ * Get the list of wrappered filter pool objects to show in the combo. The wrappering allows
+ * each to be displayed with a different name in the list than just pool.getName()
+ */
+ public ISystemFilterPoolWrapper[] getWrappers();
+ /**
+ * Get the wrapper to preselect in the list.
+ */
+ public ISystemFilterPoolWrapper getPreSelectWrapper();
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterReference.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterReference.java
new file mode 100644
index 00000000000..8dec7a2c19e
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterReference.java
@@ -0,0 +1,101 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.filters;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.model.ISystemContainer;
+import org.eclipse.rse.model.ISystemContentsType;
+import org.eclipse.rse.references.ISystemReferencingObject;
+
+
+/**
+ * Represents a shadow or reference to a system filter.
+ * Such references are only transient, not savable to disk.
+ */
+/**
+ * @lastgen interface SystemFilterReference extends SystemReferencingObject, SystemFilterContainerReference {}
+ */
+public interface ISystemFilterReference extends ISystemReferencingObject, ISystemFilterContainerReference, ISystemContainer
+{
+ /**
+ * Return the reference manager which is managing this filter reference
+ * framework object.
+ */
+ public ISystemFilterPoolReferenceManager getFilterPoolReferenceManager();
+
+ /**
+ * Return the object which instantiated the pool reference manager object.
+ * Makes it easy to get back to the point of origin, given any filter reference
+ * framework object
+ */
+ public ISystemFilterPoolReferenceManagerProvider getProvider();
+
+ /**
+ * Gets the subsystem that contains this reference
+ * @return the subsystem
+ */
+ public ISubSystem getSubSystem();
+
+ /**
+ * Sets the subsystem that contains this reference
+ * @param subSystem
+ */
+ public void setSubSystem(ISubSystem subSystem);
+
+ /**
+ * Return the filter to which we reference...
+ */
+ public ISystemFilter getReferencedFilter();
+ /**
+ * Set the filter to which we reference...
+ */
+ public void setReferencedFilter(ISystemFilter filter);
+
+ /**
+ * Get the parent of this reference.
+ * It will be either a SystemFilterPoolReference, or
+ * a SystemFilterReference(if nested).
+ */
+ public ISystemFilterContainerReference getParent();
+ /**
+ * Get parent or super parent filter pool reference.
+ */
+ public ISystemFilterPoolReference getParentSystemFilterReferencePool();
+
+ // -------------------------------------------------
+ // Methods for returning filter string references...
+ // -------------------------------------------------
+ /**
+ * Return the number of filter strings in the referenced filter
+ */
+ public int getSystemFilterStringCount();
+ /**
+ * Get the filter strings contained by this filter. But get references to each,
+ * not the masters.
+ */
+ public ISystemFilterStringReference[] getSystemFilterStringReferences();
+ /**
+ * Create a single filter string refererence to a given filter string
+ */
+ public ISystemFilterStringReference getSystemFilterStringReference(ISystemFilterString filterString);
+
+ /*
+ * Sets the cached contents for this filter reference. If the filter changes or is refreshed, these cached
+ * items will be removed.
+ */
+ public void setContents(ISystemContentsType type, Object[] cachedContents);
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterSavePolicies.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterSavePolicies.java
new file mode 100644
index 00000000000..87c215218ca
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterSavePolicies.java
@@ -0,0 +1,46 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.filters;
+/**
+ * A save policy dictates how filter framework artifacts are persisted to disk.
+ */
+public interface ISystemFilterSavePolicies
+{
+ /**
+ * No saving. All save/restoring handled elsewhere.
+ */
+ public static final int SAVE_POLICY_NONE = -1;
+ /**
+ * Save all filter pools and all filters in one file, with same name as the manager
+ */
+ public static final int SAVE_POLICY_ONE_FILE_PER_MANAGER = 0;
+ /**
+ * Save all filters in each filter pool in one file per pool, with the same name as the pool.
+ * Each pool also has its own unique folder.
+ */
+ public static final int SAVE_POLICY_ONE_FILEANDFOLDER_PER_POOL = 1;
+ /**
+ * Save all filters in each filter pool in one file per pool, with the same name as the pool
+ * All pool files go into the same folder.
+ */
+ public static final int SAVE_POLICY_ONE_FILE_PER_POOL_SAME_FOLDER = 2;
+ /**
+ * Save each filter in each filter pool in its own file, with the same name as the filter
+ */
+ public static final int SAVE_POLICY_ONE_FILE_PER_FILTER = 3;
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterString.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterString.java
new file mode 100644
index 00000000000..387e0a6ffc4
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterString.java
@@ -0,0 +1,101 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.filters;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.rse.model.IRSEModelObject;
+import org.eclipse.rse.references.ISystemBaseReferencedObject;
+
+
+/**
+ * A filter string is a pattern used by the server-side code to know what to return to
+ * the client. A filter contains one or more filter strings. Basically, its nothing more
+ * than a string, and its up to each consumer to know what to do with it. Generally,
+ * a filter string edit pane is designed to prompt the user for the contents of the
+ * string in a domain-friendly way.
+ * @see org.eclipse.rse.ui.filters.SystemFilterStringEditPane
+ * @see org.eclipse.rse.ui.filters.dialogs.SystemChangeFilterDialog and
+ * @see org.eclipse.rse.ui.filters.actions.SystemChangeFilterAction
+ * @see org.eclipse.rse.ui.filters.dialogs.SystemNewFilterWizard and
+ * @see org.eclipse.rse.ui.filters.actions.SystemNewFilterAction
+ */
+public interface ISystemFilterString extends ISystemBaseReferencedObject, IAdaptable, IRSEModelObject
+{
+ /**
+ * Return the caller which instantiated the filter pool manager overseeing this filter framework instance
+ */
+ public ISystemFilterPoolManagerProvider getProvider();
+ /**
+ * Return the filter pool manager managing this collection of filter pools and their filters and their filter strings.
+ */
+ public ISystemFilterPoolManager getSystemFilterPoolManager();
+ /**
+ * Set the transient parent back-pointer. Called by framework at restore/create time.
+ */
+ public void setParentSystemFilter(ISystemFilter filter);
+ /**
+ * Get the parent filter that contains this filter string.
+ */
+ public ISystemFilter getParentSystemFilter();
+ /**
+ * Clones this filter string's attributes into the given filter string
+ */
+ public void clone(ISystemFilterString targetString);
+ /**
+ * Is this filter string changable? Depends on mof attributes of parent filter
+ */
+ public boolean isChangable();
+
+ /**
+ * @generated This field/method will be replaced during code generation
+ * @return The value of the String attribute
+ */
+ String getString();
+
+ /**
+ * @generated This field/method will be replaced during code generation
+ * @param value The new value of the String attribute
+ */
+ void setString(String value);
+
+ /**
+ * @generated This field/method will be replaced during code generation
+ * @return The value of the Type attribute
+ * Allows tools to have typed filter strings
+ */
+ String getType();
+
+ /**
+ * @generated This field/method will be replaced during code generation
+ * @param value The new value of the Type attribute
+ */
+ void setType(String value);
+
+ /**
+ * @generated This field/method will be replaced during code generation
+ * @return The value of the Default attribute
+ * Is this a vendor-supplied filter string versus a user-defined filter string
+ */
+ boolean isDefault();
+
+ /**
+ * @generated This field/method will be replaced during code generation
+ * @param value The new value of the Default attribute
+ */
+ void setDefault(boolean value);
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterStringReference.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterStringReference.java
new file mode 100644
index 00000000000..b8c825f9bfa
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterStringReference.java
@@ -0,0 +1,58 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.filters;
+import org.eclipse.rse.references.ISystemBaseReferencingObject;
+
+/**
+ * Represents a reference to a master filter string.
+ * Needed so GUI can show the same filter string multiple times.
+ * This is not modelled in MOF.
+ */
+public interface ISystemFilterStringReference
+ extends ISystemBaseReferencingObject
+{
+ /**
+ * Return the reference manager which is managing this filter reference
+ * framework object.
+ */
+ public ISystemFilterPoolReferenceManager getFilterPoolReferenceManager();
+
+ /**
+ * Return the object which instantiated the pool reference manager object.
+ * Makes it easy to get back to the point of origin, given any filter reference
+ * framework object
+ */
+ public ISystemFilterPoolReferenceManagerProvider getProvider();
+
+ /**
+ * Get the master filter string
+ */
+ public ISystemFilterString getReferencedFilterString();
+ /**
+ * Get the referenced filter that contains this filter string reference.
+ */
+ public ISystemFilterReference getParent();
+ /**
+ * Get the actual filter that contain the actual filter string we reference
+ */
+ public ISystemFilter getParentSystemFilter();
+
+ /**
+ * Same as getReferencedFilterString().getString()
+ */
+ public String getString();
+} //SystemFilterStringReference
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/SystemFilterPoolWrapper.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/SystemFilterPoolWrapper.java
new file mode 100644
index 00000000000..831444386a9
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/SystemFilterPoolWrapper.java
@@ -0,0 +1,59 @@
+/********************************************************************************
+ * Copyright (c) 2003, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.filters;
+
+/**
+ * The system filter wizard allows callers to pass a list of wrapper objects
+ * for the user to select a filter pool.
+ *
+ * This is a default implementation of the wrapper interface, that allows the
+ * display name and wrappered filter pool to be set via the constructor.
+ */
+public class SystemFilterPoolWrapper implements ISystemFilterPoolWrapper
+{
+
+
+ private String displayName;
+ private ISystemFilterPool pool;
+
+ /**
+ * Constructor for SystemFilterPoolWrapper.
+ */
+ public SystemFilterPoolWrapper(String displayName, ISystemFilterPool poolToWrapper)
+ {
+ super();
+ this.displayName = displayName;
+ this.pool = poolToWrapper;
+ }
+
+ /**
+ * @see org.eclipse.rse.filters.ISystemFilterPoolWrapper#getDisplayName()
+ */
+ public String getDisplayName()
+ {
+ return displayName;
+ }
+
+ /**
+ * @see org.eclipse.rse.filters.ISystemFilterPoolWrapper#getSystemFilterPool()
+ */
+ public ISystemFilterPool getSystemFilterPool()
+ {
+ return pool;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/SystemFilterPoolWrapperInformation.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/SystemFilterPoolWrapperInformation.java
new file mode 100644
index 00000000000..3fc99d96048
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/SystemFilterPoolWrapperInformation.java
@@ -0,0 +1,124 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.filters;
+
+import java.util.Vector;
+
+/**
+ * The system filter wizard allows callers to pass a list of wrapper objects
+ * for the user to select a filter pool. Effectively, this prompting for
+ * euphamisms to filter pools. This requires an array of wrapper objects,
+ * and requires replacement mri for the pool prompt and tooltip text, and
+ * the verbage above it.
+ *
+ * This is all encapsulated in this class. The information is set via setters
+ * or constructor parameters.
+ */
+public class SystemFilterPoolWrapperInformation
+ implements ISystemFilterPoolWrapperInformation
+{
+ private String promptLabel, promptTooltip, verbageLabel;
+ private Vector wrappers;
+ private ISystemFilterPoolWrapper[] wrapperArray;
+ private ISystemFilterPoolWrapper preSelectWrapper;
+
+ /**
+ * Constructor for SystemFilterPoolWrapperInformation.
+ */
+ public SystemFilterPoolWrapperInformation(String promptLabel, String promptTooltip, String verbageLabel)
+ {
+ super();
+ this.promptLabel= promptLabel;
+ this.verbageLabel = verbageLabel;
+ this.promptLabel= promptTooltip;
+ wrappers = new Vector();
+ }
+
+ /**
+ * Add a wrapper object
+ */
+ public void addWrapper(ISystemFilterPoolWrapper wrapper)
+ {
+ wrappers.add(wrapper);
+ }
+ /**
+ * Add a filter pool, which we will wrapper here by creating a SystemFilterPoolWrapper object for you
+ */
+ public void addWrapper(String displayName, ISystemFilterPool poolToWrap, boolean preSelect)
+ {
+ SystemFilterPoolWrapper wrapper = new SystemFilterPoolWrapper(displayName, poolToWrap);
+ wrappers.add(wrapper);
+ if (preSelect)
+ preSelectWrapper = wrapper;
+ }
+ /**
+ * Set the wrapper to preselect
+ */
+ public void setPreSelectWrapper(ISystemFilterPoolWrapper wrapper)
+ {
+ this.preSelectWrapper = wrapper;
+ }
+
+
+
+ public String getPromptLabel()
+ {
+ return promptLabel;
+ }
+
+ public String getPromptTooltip()
+ {
+ return promptTooltip;
+ }
+
+ public String getVerbageLabel()
+ {
+ return verbageLabel;
+ }
+
+
+ /**
+ * @see org.eclipse.rse.filters.ISystemFilterPoolWrapperInformation#getWrappers()
+ */
+ public ISystemFilterPoolWrapper[] getWrappers()
+ {
+ if (wrapperArray == null)
+ {
+ wrapperArray = new ISystemFilterPoolWrapper[wrappers.size()];
+ for (int idx=0; idx
+ * SystemFilter references typically exist for only one reason:
+ *
+ * Of course, this is a generic method, and in our case it is always
+ * true that we only hold a SystemFilter. Hence, this is the same
+ * as calling getReferenceFilter and casting the result.
+ */
+ public ISystemFilterContainer getReferencedSystemFilterContainer()
+ {
+ return getReferencedFilter();
+ }
+ /**
+ * Build and return an array of SystemFilterReference objects.
+ * Each object is created new. There is one for each of the filters
+ * in the reference SystemFilter or SystemFilterPool.
+ * For performance reasons, we will cache this array and only
+ * return a fresh one if something changes in the underlying
+ * filter list.
+ */
+ public ISystemFilterReference[] getSystemFilterReferences(ISubSystem subSystem)
+ {
+ return containerHelper.getSystemFilterReferences(subSystem);
+ }
+ /**
+ * Create a single filter refererence to a given filter.
+ * If there already is a reference to this filter, it is returned.
+ * If not, a new reference is created and appended to the end of the existing filter reference array.
+ * @see #getExistingSystemFilterReference(ISystemFilter)
+ */
+ public ISystemFilterReference getSystemFilterReference(ISubSystem subSystem, ISystemFilter filter)
+ {
+ //return containerHelper.generateFilterReference(filter);
+ return containerHelper.generateAndRecordFilterReference(subSystem, filter);
+ }
+ /**
+ * Return an existing reference to a given system filter.
+ * If no reference currently exists to this filter, returns null.
+ * @see #getSystemFilterReference(ISystemFilter)
+ */
+ public ISystemFilterReference getExistingSystemFilterReference(ISubSystem subSystem, ISystemFilter filter)
+ {
+ return containerHelper.getExistingSystemFilterReference(subSystem, filter);
+ }
+
+ /**
+ * Return true if the referenced pool or filter has filters.
+ */
+ public boolean hasFilters()
+ {
+ return containerHelper.hasFilters();
+ }
+
+ /**
+ * Return count of the number of filters in the referenced pool or filter
+ */
+ public int getFilterCount()
+ {
+ return containerHelper.getFilterCount();
+ }
+
+ /**
+ * Return the name of the SystemFilter or SystemFilterPool that we reference.
+ * For such objects this is what we show in the GUI.
+ */
+ public String getName()
+ {
+ ISystemFilter filter = getReferencedFilter();
+ if (filter != null)
+ return filter.getName();
+ else
+ return "";
+ }
+
+ /**
+ * Override of Object method. Turn this filter in an outputable string
+ */
+ public String toString()
+ {
+ return getName();
+ }
+
+ // -------------------------------------------------
+ // Methods for returning filter string references...
+ // -------------------------------------------------
+ /**
+ * Return the number of filter strings in the referenced filter
+ */
+ public int getSystemFilterStringCount()
+ {
+ int count = 0;
+ ISystemFilter referencedFilter = getReferencedFilter();
+ if (referencedFilter != null)
+ count = referencedFilter.getFilterStringCount();
+ return count;
+ }
+ /**
+ * Get the filter strings contained by this filter. But get references to each,
+ * not the masters.
+ */
+ public ISystemFilterStringReference[] getSystemFilterStringReferences()
+ {
+ // These reference objects are built on the fly, each time, rather than
+ // maintaining a persisted list of such references. The reason
+ // is we do no at this time allow users to subset the master list
+ // of strings maintained by a filter. Hence, we always simply
+ // return a complete list. However, to save memory we try to only
+ // re-gen the list if something has changed.
+ java.util.List mofList = getReferencedFilter().getStrings();
+ boolean needToReGen = compareFilterStrings(mofList);
+ if (needToReGen)
+ referencedFilterStrings = generateFilterStringReferences(mofList);
+ return referencedFilterStrings;
+ }
+
+ /**
+ * Create a single filter string refererence to a given filter string
+ */
+ public ISystemFilterStringReference getSystemFilterStringReference(ISystemFilterString filterString)
+ {
+ return new SystemFilterStringReference((ISystemFilterReference)this, filterString);
+ }
+
+
+ /**
+ * To save memory, we try to only regenerate the referenced filter list
+ * if something has changed.
+ */
+ private boolean compareFilterStrings(java.util.List newFilterStrings)
+ {
+ boolean mustReGen = false;
+ if (newFilterStrings == null)
+ {
+ if (referencedFilterStrings != null)
+ return true;
+ else
+ return false;
+ }
+ else if (referencedFilterStrings == null)
+ {
+ return true; // newFilterStrings != null && referencedFilterStrings == null
+ }
+ // both old and new are non-null
+ if (newFilterStrings.size() != referencedFilterStrings.length)
+ return true;
+ Iterator i = newFilterStrings.iterator();
+ for (int idx=0; !mustReGen && (idx
+ * This simple implementation does not support:
+ *
+ * We always return true
+ */
+ public boolean isTransient()
+ {
+ return true;
+ }
+
+ /**
+ * Clones a given filter to the given target filter.
+ * All filter strings, and all nested filters, are copied.
+ * @param targetFilter new filter into which we copy all our data
+ */
+ public void clone(ISystemFilter targetFilter)
+ {
+ super.clone(targetFilter);
+ // hmm, due to polymorphism, we should not have to do anything here!
+ // well, except for this:
+ targetFilter.setFilterStrings(getFilterStringsVector());
+ }
+
+ // -------------------------------------------------------
+ // New methods to simplify life. Often a simple filter
+ // contains a single filter string so these methods
+ // make it easier to set/get that filter string
+ // -------------------------------------------------------
+ /**
+ * Set the single filter string
+ */
+ public void setFilterString(String filterString)
+ {
+ filterStringVector.clear();
+ filterStringVector.addElement(filterString);
+ invalidateCache();
+ }
+ /**
+ * Get the single filter string.
+ * Returns null if setFilterString has not been called.
+ */
+ public String getFilterString()
+ {
+ if (filterStringVector.size() == 0)
+ return null;
+ else
+ return (String)filterStringVector.elementAt(0);
+ }
+
+ /**
+ * Set the parent. Since we don't have any filter manager, we need
+ * some way to store context info for the adapter. Use this.
+ */
+ public void setParent(Object parent)
+ {
+ this.parent = parent;
+ }
+
+ /**
+ * Get the parent as set in setParent(Object)
+ */
+ public Object getParent()
+ {
+ return parent;
+ }
+
+ // -------------------------------------------------------
+ // Functional methods overridden to do something simple...
+ // -------------------------------------------------------
+
+ /**
+ * Set the filter's name
+ */
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+ /**
+ * Get the filter's name
+ */
+ public String getName()
+ {
+ return name;
+ }
+ /**
+ * Set the filter's type
+ */
+ public void setType(String type)
+ {
+ this.type = type;
+ }
+ /**
+ * Get the filter's type
+ */
+ public String getType()
+ {
+ return type;
+ }
+ /**
+ * Specify if filter strings in this filter are case sensitive.
+ * Default is false.
+ * @param value The new value of the StringsCaseSensitive attribute
+ */
+ public void setStringsCaseSensitive(boolean value)
+ {
+ this.caseSensitive = value;
+ }
+
+ /**
+ * Are filter strings in this filter case sensitive?
+ */
+ public boolean isStringsCaseSensitive()
+ {
+ return caseSensitive;
+ }
+ /**
+ * Are filter strings in this filter case sensitive?
+ */
+ public boolean areStringsCaseSensitive()
+ {
+ return caseSensitive;
+ }
+
+ /**
+ * Is this a special filter that prompts the user when it is expanded?
+ */
+ public void setPromptable(boolean promptable)
+ {
+ this.promptable = promptable;
+ }
+ /**
+ * Is this a special filter that prompts the user when it is expanded?
+ */
+ public boolean isPromptable()
+ {
+ return promptable;
+ }
+
+ /**
+ * Return filter strings as an array of String objects.
+ */
+ public String[] getFilterStrings()
+ {
+ if (filterStringArray == null)
+ {
+ filterStringArray = new String[filterStringVector.size()];
+ for (int idx=0; idx PLEASE NOTE:
+ *
+ * This class supports two overloaded version of each method. One that
+ * takes a MOF java.util.List for the filter list, and one that takes a Vector for
+ * the filter list. This is to offer seamless flexibility in how the filters
+ * are stored internally.
+ */
+public class SystemFilterContainerCommonMethods
+ //implements ISystemFilterContainer
+{
+ private Vector filterNameVector, filterVector;
+ private ISystemFilter[] filterArray;
+
+ /**
+ * Constructor
+ */
+ protected SystemFilterContainerCommonMethods()
+ {
+ super();
+ }
+
+
+ /**
+ * For performance reasons we have decided to store a cache of the
+ * filters in vector and array form, so each request will not result
+ * in a new temporary vector or array. However, this cache can get out
+ * of date, so this method must be called religiously to invalidate it
+ * after any change in the filters.
+ */
+ public void invalidateCache()
+ {
+ filterNameVector = filterVector = null;
+ filterArray = null;
+ }
+
+ /**
+ * Creates a new system filter within this pool or filter.
+ * @param filters MOF list of filters the new filter is to be added to.
+ * @param parentPool pool that contains this filter (directly or indirectly).
+ * @param aliasName The name to give the new filter. Must be unique for this pool.
+ * @param filterStrings The list of String objects that represent the filter strings.
+ */
+ public ISystemFilter createSystemFilter(java.util.List filters,
+ ISystemFilterPool parentPool,
+ String aliasName, Vector filterStrings)
+ {
+ ISystemFilter newFilter = null;
+
+ // FIXME - not using error message and null return
+ // because I want to restore filters while not being hit with conflicts
+ newFilter = getSystemFilter(filters, aliasName);
+ if (newFilter != null)
+ {
+ return newFilter;
+ }
+ /* DKM
+ boolean exists = getSystemFilter(filters, aliasName) != null;
+ if (exists)
+ {
+ String msg = "Error creating filter: aliasName " + aliasName + " is not unique"; // no need to xlate, internal only
+ SystemPlugin.logError(msg);
+ return null;
+ }
+ */
+ newFilter = internalCreateSystemFilter(parentPool, aliasName, filterStrings);
+ if (newFilter != null)
+ internalAddSystemFilter(filters, newFilter);
+ return newFilter;
+ }
+ /**
+ * Creates a new system filter within this pool or filter.
+ * @param filters Vector of filters the new filter is to be added to.
+ * @param parentPool pool that contains this filter (directly or indirectly)
+ * @param aliasName The name to give the new filter. Must be unique for this pool.
+ * @param filterStrings The list of String objects that represent the filter strings.
+ */
+ public ISystemFilter createSystemFilter(Vector filters,
+ ISystemFilterPool parentPool,
+ String aliasName, Vector filterStrings)
+ {
+ ISystemFilter newFilter = null;
+ boolean exists = getSystemFilter(filters, aliasName) != null;
+ if (exists)
+ {
+ String msg = "Error creating filter: aliasName " + aliasName + " is not unique"; // no need to xlate, internal only
+ SystemBasePlugin.logError(msg);
+ return null;
+ }
+ newFilter = internalCreateSystemFilter(parentPool, aliasName, filterStrings);
+ if (newFilter != null)
+ internalAddSystemFilter(filters, newFilter);
+ return newFilter;
+ }
+
+
+ /**
+ * Internal encapsulation of mof effort to create new filter, and setting of
+ * the core attributes.
+ */
+ private ISystemFilter internalCreateSystemFilter(
+ ISystemFilterPool parentPool,
+ String aliasName, Vector filterStrings)
+ {
+ ISystemFilter newFilter = null;
+ try
+ {
+ newFilter = new SystemFilter();
+ // FIXME getMOFfactory().createSystemFilter();
+ newFilter.setRelease(SystemResources.CURRENT_RELEASE);
+ newFilter.setName(aliasName);
+ newFilter.setParentFilterPool(parentPool);
+ if (filterStrings != null)
+ newFilter.setFilterStrings(filterStrings);
+ //java.util.List filterStringList = newFilter.getFilterStrings();
+ //for (int idx=0; idx PLEASE NOTE:
+ *
+ * Returns "filterPools_"+managerName by default.
+ */
+ public String getManagerSaveFileName(String managerName)
+ {
+ return DEFAULT_FILENAME_PREFIX_FILTERPOOLMANAGER+managerName;
+ }
+ /**
+ * Get the unqualified save file name for the given SystemFilterPoolReferenceManager object.
+ * Do NOT include the extension, as .xmi will be added.
+ *
+ * Returns "filterPoolRefs_"+managerName by default.
+ */
+ public String getReferenceManagerSaveFileName(String managerName)
+ {
+ return DEFAULT_FILENAME_PREFIX_FILTERPOOLREFERENCEMANAGER+managerName;
+ }
+ /**
+ * Get the unqualified save file name for the given SystemFilterPool object.
+ * Do NOT include the extension, as .xmi will be added.
+ *
+ * Returns getFilterPoolSaveFileNamePrefix()+poolName by default.
+ */
+ public String getFilterPoolSaveFileName(String poolName)
+ {
+ return getFilterPoolSaveFileNamePrefix()+poolName;
+ }
+ /**
+ * Get the file name prefix for all pool files.
+ * Used to deduce the saved pools by examining the file system
+ *
+ * By default returns "filterPool_"
+ */
+ public String getFilterPoolSaveFileNamePrefix()
+ {
+ return DEFAULT_FILENAME_PREFIX_FILTERPOOL;
+ }
+ /**
+ * Get the folder name for the given SystemFilterPool object.
+ *
+ * Returns getFilterPoolFolderNamePrefix()+poolName by default.
+ */
+ public String getFilterPoolFolderName(String poolName)
+ {
+ return getFilterPoolFolderNamePrefix()+poolName;
+ }
+ /**
+ * Get the folder name prefix for all pool folders.
+ * Used to deduce the saved pools by examining the file system
+ *
+ * By default returns "FilterPool_"
+ */
+ public String getFilterPoolFolderNamePrefix()
+ {
+ return DEFAULT_FOLDERNAME_PREFIX_FILTERPOOL;
+ }
+ /**
+ * Get the unqualified save file name for the given SystemFilter object.
+ * Do NOT include the extension, as .xmi will be added.
+ *
+ * Returns getFilterSaveFileNamePrefix()+filterName by default.
+ */
+ public String getFilterSaveFileName(String filterName)
+ {
+ return getFilterSaveFileNamePrefix()+filterName;
+ }
+ /**
+ * Get the file name prefix for all filter files.
+ * Used to deduce the saved filters by examining the file system
+ *
+ * Returns "Filter_" by default.
+ */
+ public String getFilterSaveFileNamePrefix()
+ {
+ return DEFAULT_FILENAME_PREFIX_FILTER;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/internal/filters/SystemFilterPool.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/internal/filters/SystemFilterPool.java
new file mode 100644
index 00000000000..1308fcefda5
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/internal/filters/SystemFilterPool.java
@@ -0,0 +1,1397 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.internal.filters;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Vector;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.SystemResourceHelpers;
+import org.eclipse.rse.filters.ISystemFilter;
+import org.eclipse.rse.filters.ISystemFilterConstants;
+import org.eclipse.rse.filters.ISystemFilterContainer;
+import org.eclipse.rse.filters.ISystemFilterNamingPolicy;
+import org.eclipse.rse.filters.ISystemFilterPool;
+import org.eclipse.rse.filters.ISystemFilterPoolManager;
+import org.eclipse.rse.filters.ISystemFilterPoolManagerProvider;
+import org.eclipse.rse.filters.ISystemFilterSavePolicies;
+import org.eclipse.rse.internal.references.SystemPersistableReferencedObject;
+import org.eclipse.rse.ui.SystemResources;
+
+/**
+ * This is a system filter pool, which is a means of grouping filters
+ * and managing them as a list.
+ *
+ * To enable filters themselves to be automous and sharable, it is decided
+ * that no data will be persisted in the filter pool itself. Rather, all
+ * attributes other than the list of filters are transient and as such it is
+ * the responsibility of the programmer using a filter pool to set these
+ * attributes after creating or restoring a filter pool. Typically, this is
+ * what a filter pool manager (SystemFilterPoolManager) will do for you.
+ */
+/**
+ * @lastgen class SystemFilterPoolImpl extends SystemPersistableReferencedObjectImpl implements SystemFilterPool, SystemFilterSavePolicies, SystemFilterConstants, SystemFilterContainer, IAdaptable
+ */
+public class SystemFilterPool extends SystemPersistableReferencedObject
+ implements ISystemFilterPool, ISystemFilterSavePolicies, ISystemFilterConstants, ISystemFilterContainer, IAdaptable
+{
+
+ /**
+ * The default value of the '{@link #getName() Name}' attribute.
+ *
+ *
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+
+ private String name;
+ /**
+ * The default value of the '{@link #getType() Type}' attribute.
+ *
+ *
+ * @see #getType()
+ * @generated
+ * @ordered
+ */
+ protected static final String TYPE_EDEFAULT = null;
+
+ private int savePolicy;
+ private ISystemFilterNamingPolicy namingPolicy = null;
+ private ISystemFilterPoolManager mgr;
+ //private Vector filters = new Vector();
+ private SystemFilterContainerCommonMethods helpers = null;
+ private Object filterPoolData = null;
+ private boolean initialized = false;
+ //private boolean isSharable = false;
+ protected boolean specialCaseNoDataRestored = false;
+ private boolean debug = false;
+ protected static final String DELIMITER = SystemFilterPoolReference.DELIMITER;
+
+ // persistance
+ protected boolean _isDirty = true;
+ protected boolean _wasRestored = false;
+
+ /**
+ * @generated This field/method will be replaced during code generation.
+ */
+ protected String type = TYPE_EDEFAULT;
+ /**
+ * The default value of the '{@link #isSupportsNestedFilters() Supports Nested Filters}' attribute.
+ *
+ *
+ * @see #isSupportsNestedFilters()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean SUPPORTS_NESTED_FILTERS_EDEFAULT = false;
+
+ /**
+ * @generated This field/method will be replaced during code generation.
+ */
+ protected boolean supportsNestedFilters = SUPPORTS_NESTED_FILTERS_EDEFAULT;
+ /**
+ * The default value of the '{@link #isDeletable() Deletable}' attribute.
+ *
+ *
+ * @see #isDeletable()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean DELETABLE_EDEFAULT = false;
+
+ /**
+ * @generated This field/method will be replaced during code generation.
+ */
+ protected boolean deletable = DELETABLE_EDEFAULT;
+ /**
+ * The default value of the '{@link #isDefault() Default}' attribute.
+ *
+ *
+ * @see #isDefault()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean DEFAULT_EDEFAULT = false;
+
+ /**
+ * @generated This field/method will be replaced during code generation.
+ */
+ protected boolean default_ = DEFAULT_EDEFAULT;
+ /**
+ * The default value of the '{@link #isStringsCaseSensitive() Strings Case Sensitive}' attribute.
+ *
+ *
+ * @see #isStringsCaseSensitive()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean STRINGS_CASE_SENSITIVE_EDEFAULT = false;
+
+ /**
+ * @generated This field/method will be replaced during code generation.
+ */
+ protected boolean stringsCaseSensitive = STRINGS_CASE_SENSITIVE_EDEFAULT;
+ /**
+ * This is true if the Strings Case Sensitive attribute has been set.
+ *
+ *
+ * @generated
+ * @ordered
+ */
+ protected boolean stringsCaseSensitiveESet = false;
+
+ /**
+ * The default value of the '{@link #isSupportsDuplicateFilterStrings() Supports Duplicate Filter Strings}' attribute.
+ *
+ *
+ * @see #isSupportsDuplicateFilterStrings()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean SUPPORTS_DUPLICATE_FILTER_STRINGS_EDEFAULT = false;
+
+ /**
+ * @generated This field/method will be replaced during code generation.
+ */
+ protected boolean supportsDuplicateFilterStrings = SUPPORTS_DUPLICATE_FILTER_STRINGS_EDEFAULT;
+ /**
+ * The default value of the '{@link #getRelease() Release}' attribute.
+ *
+ *
+ * @see #getRelease()
+ * @generated
+ * @ordered
+ */
+ protected static final int RELEASE_EDEFAULT = 0;
+
+ /**
+ * @generated This field/method will be replaced during code generation.
+ */
+ protected int release = RELEASE_EDEFAULT;
+ /**
+ * The default value of the '{@link #isSingleFilterStringOnly() Single Filter String Only}' attribute.
+ *
+ *
+ * @see #isSingleFilterStringOnly()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean SINGLE_FILTER_STRING_ONLY_EDEFAULT = false;
+
+ /**
+ * The cached value of the '{@link #isSingleFilterStringOnly() Single Filter String Only}' attribute.
+ *
+ *
+ * @see #isSingleFilterStringOnly()
+ * @generated
+ * @ordered
+ */
+ protected boolean singleFilterStringOnly = SINGLE_FILTER_STRING_ONLY_EDEFAULT;
+
+ /**
+ * This is true if the Single Filter String Only attribute has been set.
+ *
+ *
+ * @generated
+ * @ordered
+ */
+ protected boolean singleFilterStringOnlyESet = false;
+
+ /**
+ * The default value of the '{@link #getOwningParentName() Owning Parent Name}' attribute.
+ *
+ *
+ * @see #getOwningParentName()
+ * @generated
+ * @ordered
+ */
+ protected static final String OWNING_PARENT_NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getOwningParentName() Owning Parent Name}' attribute.
+ *
+ *
+ * @see #getOwningParentName()
+ * @generated
+ * @ordered
+ */
+ protected String owningParentName = OWNING_PARENT_NAME_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #isNonRenamable() Non Renamable}' attribute.
+ *
+ *
+ * @see #isNonRenamable()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean NON_RENAMABLE_EDEFAULT = false;
+
+ /**
+ * The cached value of the '{@link #isNonRenamable() Non Renamable}' attribute.
+ *
+ *
+ * @see #isNonRenamable()
+ * @generated
+ * @ordered
+ */
+ protected boolean nonRenamable = NON_RENAMABLE_EDEFAULT;
+
+ /**
+ * @generated This field/method will be replaced during code generation.
+ */
+ protected java.util.List filters = null;
+/**
+ * Default constructor
+ */
+ protected SystemFilterPool()
+ {
+ super();
+ helpers = new SystemFilterContainerCommonMethods();
+ }
+ /**
+ * Static factory method for creating a new filter pool. Will
+ * first try to restore it, and if that fails will create a new instance and
+ * return it.
+ *
+ * Use this method only if you are not using a SystemFilterPoolManager, else
+ * use the createSystemFilterPool method in that class.
+ *
+ * @param mofHelpers SystemMOFHelpers object with helper methods for saving and restoring via mof
+ * @param poolFolder the folder that will hold the filter pool.
+ * This folder will be created if it does not already exist.
+ * @param name the name of the filter pool. Typically this is also the name
+ * of the given folder, but this is not required. For the save policy of one file
+ * per pool, the name of the file is derived from this.
+ * @param allowNestedFilters true if filters inside this filter pool are
+ * to allow nested filters.
+ * @param isDeletable true if this filter pool is allowed to be deleted by users.
+ * @param tryToRestore true to attempt a restore first, false if a pure create operation.
+ * @param savePolicy The save policy for the filter pool and filters. One of the
+ * following constants from the SystemFilterConstants interface:
+ * PLEASE NOTE:
+ *
+ * While the framework has all the code necessary to arrange filters and save/restore
+ * that arrangement, you may choose to use preferences instead of this support.
+ * In this case, call this method and pass in the saved and sorted filter name list.
+ *
+ * Called by someone after restore.
+ */
+ public void orderSystemFilters(String[] names)
+ {
+ java.util.List filterList = internalGetFilters();
+ ISystemFilter[] filters = new ISystemFilter[names.length];
+ for (int idx=0; idx
+ * Each filter pool that is managed becomes a folder on disk.
+ *
+ * To create a filter pool manager instance, use the factory method
+ * in SystemFilterPoolManagerImpl in the ...impl package.
+ * You must pass a folder that represents the anchor point for the
+ * pools managed by this manager instance.
+ *
+ * Depending on your tools' needs, you have four choices about how
+ * the filter pools and filters are persisted to disk. The decision is
+ * made at the time you instantiate the pool manager and is one of the
+ * following constants from the SystemFilterConstants interface:
+ *
+ * With the policy of one file per pool, there are two possibilities regarding
+ * the folder structure:
+ *
+ * With the policy of one file per filter, each filter pool must have its own folder.
+ *
+ * With an instantiated filter pool manager (most tools will only need
+ * one such instance), you now simply call its methods to work with
+ * filter pools. For example, use it to:
+ *
+ * Further, this is the front door for working with filters too. By forcing all
+ * filter related activity through a single point like this, we can ensure that
+ * all changes are saved to disk, and events are fired properly.
+ *
+ * The filter framework logs to a {@link com.ibm.etools.systems.logging.Logger Logger} file.
+ * By default the log in the org.eclipse.rse.core plugin is used, but you can change this
+ * by calling {@link #setLogger(com.ibm.etools.systems.logging.Logger)}.
+ */
+/**
+ * @lastgen class SystemFilterPoolManagerImpl Impl implements SystemFilterPoolManager {}
+ */
+public class SystemFilterPoolManager implements ISystemFilterPoolManager
+{
+ private ISystemFilterPool[] poolArray = null; // cache for performance
+ private ISystemFilterPoolManagerProvider caller = null;
+ private Object poolMgrData;
+ private Vector poolNames;
+ private boolean initialized = false;
+
+ private boolean suspendCallbacks = false;
+ private boolean suspendSave = false;
+ private Logger logger = null;
+ private ISystemProfile _profile;
+
+ // persistance
+ protected boolean _isDirty = true;
+ private boolean _wasRestored = false;
+
+ public static boolean debug = true;
+
+ /**
+ * The default value of the '{@link #getName() Name}' attribute.
+ *
+ *
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+
+
+ protected String name = NAME_EDEFAULT;
+ /**
+ * The default value of the '{@link #isSupportsNestedFilters() Supports Nested Filters}' attribute.
+ *
+ *
+ * @see #isSupportsNestedFilters()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean SUPPORTS_NESTED_FILTERS_EDEFAULT = false;
+
+ /**
+ * @generated This field/method will be replaced during code generation.
+ */
+ protected boolean supportsNestedFilters = SUPPORTS_NESTED_FILTERS_EDEFAULT;
+ /**
+ * The default value of the '{@link #isStringsCaseSensitive() Strings Case Sensitive}' attribute.
+ *
+ *
+ * @see #isStringsCaseSensitive()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean STRINGS_CASE_SENSITIVE_EDEFAULT = false;
+
+ /**
+ * @generated This field/method will be replaced during code generation.
+ */
+ protected boolean stringsCaseSensitive = STRINGS_CASE_SENSITIVE_EDEFAULT;
+ /**
+ * The default value of the '{@link #isSupportsDuplicateFilterStrings() Supports Duplicate Filter Strings}' attribute.
+ *
+ *
+ * @see #isSupportsDuplicateFilterStrings()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean SUPPORTS_DUPLICATE_FILTER_STRINGS_EDEFAULT = false;
+
+ /**
+ * @generated This field/method will be replaced during code generation.
+ */
+ protected boolean supportsDuplicateFilterStrings = SUPPORTS_DUPLICATE_FILTER_STRINGS_EDEFAULT;
+ /**
+ * This is true if the Supports Duplicate Filter Strings attribute has been set.
+ *
+ *
+ * @generated
+ * @ordered
+ */
+ protected boolean supportsDuplicateFilterStringsESet = false;
+
+ /**
+ * The default value of the '{@link #isSingleFilterStringOnly() Single Filter String Only}' attribute.
+ *
+ *
+ * @see #isSingleFilterStringOnly()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean SINGLE_FILTER_STRING_ONLY_EDEFAULT = false;
+
+ /**
+ * The cached value of the '{@link #isSingleFilterStringOnly() Single Filter String Only}' attribute.
+ *
+ *
+ * @see #isSingleFilterStringOnly()
+ * @generated
+ * @ordered
+ */
+ protected boolean singleFilterStringOnly = SINGLE_FILTER_STRING_ONLY_EDEFAULT;
+
+ /**
+ * @generated This field/method will be replaced during code generation.
+ */
+ protected java.util.List pools = null;
+
+
+ /**
+ * Constructor
+ */
+ protected SystemFilterPoolManager(ISystemProfile profile)
+ {
+ super();
+ _profile = profile;
+ }
+
+ public ISystemProfile getSystemProfile()
+ {
+ return _profile;
+ }
+
+ /**
+ * Factory to create a filter pool manager.
+ * @param logger A logging object into which to log errors as they happen in the framework
+ * @param caller Objects which instantiate this class should implement the
+ * SystemFilterPoolManagerProvider interface, and pass "this" for this parameter.
+ * Given any filter framework object, it is possible to retrieve the caller's
+ * object via the getProvider method call.
+ * @param mgrFolder the folder that will be the manager folder. This is
+ * the parent of the filter pool folders the manager folder will hold, or the single
+ * xmi file for the save policy of one file per manager. This folder will be created
+ * if it does not already exist.
+ * @param name the name of the filter pool manager. Typically this is also the name
+ * of the given folder, but this is not required. For the save policy of one file
+ * per manager, the name of the file is derived from this. For other save policies,
+ * the name is not used.
+ * @param allowNestedFilters true if filters inside filter pools in this manager are
+ * to allow nested filters. This is the default, but can be overridden at the
+ * individual filter pool level.
+ * @param savePolicy The save policy for the filter pools and filters. One of the
+ * following constants from the
+ * {@link org.eclipse.rse.filters.ISystemFilterConstants SystemFilterConstants} interface:
+ *
+ * Does the following:
+ *
+ * Does the following:
+ *
+ * Does the following:
+ *
+ * A filter's type is an arbitrary string that is not interpreted or used by the base framework. This
+ * is for use entirely by tools who wish to support multiple types of filters and be able to launch unique
+ * actions per type, say.
+ *
+ * @param parent The parent which is either a SystemFilterPool or a SystemFilter
+ * @param aliasName The name to give the new filter. Must be unique for this pool.
+ * @param filterStrings The list of String objects that represent the filter strings.
+ * @param type The type of this filter
+ */
+ public ISystemFilter createSystemFilter(ISystemFilterContainer parent,
+ String aliasName, Vector filterStrings, String type)
+ throws Exception
+ {
+ boolean oldSuspendSave = suspendSave;
+ boolean oldSuspendCallbacks = suspendCallbacks;
+ suspendSave = true;
+ suspendCallbacks = true;
+
+ ISystemFilter newFilter = createSystemFilter(parent, aliasName, filterStrings);
+ newFilter.setType(type);
+
+ suspendSave = oldSuspendSave;
+ suspendCallbacks = oldSuspendCallbacks;
+
+ if (!suspendSave)
+ {
+ ISystemFilterPool parentPool = null;
+ if (parent instanceof ISystemFilterPool)
+ parentPool = (ISystemFilterPool)parent;
+ else
+ parentPool = ((ISystemFilter)parent).getParentFilterPool();
+ commit(parentPool);
+ }
+ // if caller provider, callback to inform them of this event
+ if ((caller != null) && !suspendCallbacks)
+ caller.filterEventFilterCreated(newFilter);
+ return newFilter;
+ }
+ /**
+ * Creates a new system filter that is typed and promptable
+ * Same as {@link #createSystemFilter(ISystemFilterContainer, String ,Vector, String)} but
+ * takes a boolean indicating if it is promptable.
+ *
+ * A promptable filter is one in which the user is prompted for information at expand time.
+ * There is no base filter framework support for this, but tools can query this attribute and
+ * do their own thing at expand time.
+ *
+ * @param parent The parent which is either a SystemFilterPool or a SystemFilter
+ * @param aliasName The name to give the new filter. Must be unique for this pool.
+ * @param filterStrings The list of String objects that represent the filter strings.
+ * @param type The type of this filter
+ * @param promptable Pass true if this is a promptable filter
+ */
+ public ISystemFilter createSystemFilter(ISystemFilterContainer parent,
+ String aliasName, Vector filterStrings, String type, boolean promptable)
+ throws Exception
+ {
+ boolean oldSuspendSave = suspendSave;
+ boolean oldSuspendCallbacks = suspendCallbacks;
+ suspendSave = true;
+ suspendCallbacks = true;
+
+ ISystemFilter newFilter = createSystemFilter(parent, aliasName, filterStrings, type);
+ newFilter.setPromptable(promptable);
+
+ suspendSave = oldSuspendSave;
+ suspendCallbacks = oldSuspendCallbacks;
+
+ if (!suspendSave)
+ {
+ ISystemFilterPool parentPool = null;
+ if (parent instanceof ISystemFilterPool)
+ parentPool = (ISystemFilterPool)parent;
+ else
+ parentPool = ((ISystemFilter)parent).getParentFilterPool();
+ commit(parentPool);
+ }
+ // if caller provider, callback to inform them of this event
+ if ((caller != null) && !suspendCallbacks)
+ caller.filterEventFilterCreated(newFilter);
+ return newFilter;
+ }
+
+ /**
+ * Delete an existing system filter.
+ * Does the following:
+ *
+ * Does the following:
+ *
+ * Does the following:
+ *
+ * A filter's type is an arbitrary string that is not interpreted or used by the base framework. This
+ * is for use entirely by tools who wish to support multiple types of filters and be able to launch unique
+ * actions per type, say.
+ * @param parent The parent which is either a SystemFilterPool or a SystemFilter
+ * @param type The type of this filter
+ */
+ public void setSystemFilterType(ISystemFilter filter, String newType)
+ throws Exception
+ {
+ filter.setType(newType);
+ commit(filter.getParentFilterPool());
+ }
+
+ /**
+ * Copy a system filter to a pool in this or another filter manager.
+ */
+ public ISystemFilter copySystemFilter(ISystemFilterPool targetPool, ISystemFilter oldFilter, String newName)
+ throws Exception
+ {
+ ISystemFilterPoolManager targetMgr = targetPool.getSystemFilterPoolManager();
+ ISystemFilterPool oldPool = oldFilter.getParentFilterPool();
+
+ targetMgr.suspendCallbacks(true);
+
+ ISystemFilter newFilter = oldPool.copySystemFilter(targetPool, oldFilter, newName); // creates it in memory
+ commit(targetPool); // save updated pool to disk
+
+ targetMgr.suspendCallbacks(false);
+
+ targetMgr.getProvider().filterEventFilterCreated(newFilter);
+ return newFilter;
+ }
+ /**
+ * Move a system filter to a pool in this or another filter manager.
+ * Does this by first copying the filter, and only if successful, deleting the old copy.
+ */
+ public ISystemFilter moveSystemFilter(ISystemFilterPool targetPool, ISystemFilter oldFilter, String newName)
+ throws Exception
+ {
+ ISystemFilter newFilter = copySystemFilter(targetPool, oldFilter, newName);
+ if (newFilter != null)
+ {
+ deleteSystemFilter(oldFilter);
+ }
+ return newFilter;
+ }
+
+ /**
+ * Return the zero-based position of a SystemFilter object within its container
+ */
+ public int getSystemFilterPosition(ISystemFilter filter)
+ {
+ ISystemFilterContainer container = filter.getParentFilterContainer();
+ int position = -1;
+ boolean match = false;
+ ISystemFilter[] filters = container.getSystemFilters();
+
+ for (int idx = 0; !match && (idx
+ * Does the following:
+ *
+ * Called by someone after restore.
+ */
+ public void orderSystemFilters(ISystemFilterPool pool, String[] names) throws Exception
+ {
+ pool.orderSystemFilters(names);
+ commit(pool);
+ }
+
+ // -------------------------------
+ // SYSTEM FILTER STRING METHODS...
+ // -------------------------------
+ /**
+ * Append a new filter string to the given filter's list
+ *
+ * Does the following:
+ *
+ * Does the following:
+ *
+ * Does the following:
+ *
+ * Does the following:
+ *
+ * Does the following:
+ *
+ * Does the following:
+ *
+ * Does the following:
+ *
+ * Of course, this is a generic method, and in our case it is always
+ * true that we only hold a SystemFilter. Hence, this is the same
+ * as calling getReferenceFilter and casting the result.
+ */
+ public ISystemFilterContainer getReferencedSystemFilterContainer()
+ {
+ return getReferencedFilterPool();
+ }
+ /**
+ * Build and return an array of SystemFilterReference objects.
+ * Each object is created new. There is one for each of the filters
+ * in the reference SystemFilter or SystemFilterPool.
+ * For performance reasons, we will cache this array and only
+ * return a fresh one if something changes in the underlying
+ * filter list.
+ */
+ public ISystemFilterReference[] getSystemFilterReferences(ISubSystem subSystem)
+ {
+ return containerHelper.getSystemFilterReferences(subSystem);
+ }
+ /**
+ * Create a single filter refererence to a given filter.
+ * If there already is a reference to this filter, it is returned.
+ * If not, a new reference is created and appended to the end of the existing filter reference array.
+ * @see #getExistingSystemFilterReference(ISystemFilter)
+ */
+ public ISystemFilterReference getSystemFilterReference(ISubSystem subSystem, ISystemFilter filter)
+ {
+ //return containerHelper.generateFilterReference(filter);
+ return containerHelper.generateAndRecordFilterReference(subSystem, filter);
+ }
+ /**
+ * Return an existing reference to a given system filter.
+ * If no reference currently exists to this filter, returns null.
+ * @see #getSystemFilterReference(ISystemFilter)
+ */
+ public ISystemFilterReference getExistingSystemFilterReference(ISubSystem subSystem, ISystemFilter filter)
+ {
+ return containerHelper.getExistingSystemFilterReference(subSystem, filter);
+ }
+
+ /**
+ * Return true if the referenced pool or filter has filters.
+ */
+ public boolean hasFilters()
+ {
+ return containerHelper.hasFilters();
+ }
+
+ /**
+ * Return count of the number of filters in the referenced pool or filter
+ */
+ public int getFilterCount()
+ {
+ return containerHelper.getFilterCount();
+ }
+
+ /**
+ * Return the name of the SystemFilter or SystemFilterPool that we reference.
+ * For such objects this is what we show in the GUI.
+ */
+ public String getName()
+ {
+ return getReferencedFilterPoolName();
+ }
+
+ /**
+ * Return fully qualified name that includes the filter pool managers name
+ */
+ public String getFullName()
+ {
+ return super.getReferencedObjectName();
+ }
+
+ public boolean commit()
+ {
+ return false;
+ // return SystemPlugin.getThePersistenceManager().commit(getProvider().);
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/internal/filters/SystemFilterPoolReferenceManager.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/internal/filters/SystemFilterPoolReferenceManager.java
new file mode 100644
index 00000000000..b56e3b61867
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/internal/filters/SystemFilterPoolReferenceManager.java
@@ -0,0 +1,1099 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.internal.filters;
+import java.util.Vector;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.rse.core.SystemResourceHelpers;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.filters.ISystemFilter;
+import org.eclipse.rse.filters.ISystemFilterConstants;
+import org.eclipse.rse.filters.ISystemFilterNamingPolicy;
+import org.eclipse.rse.filters.ISystemFilterPool;
+import org.eclipse.rse.filters.ISystemFilterPoolManager;
+import org.eclipse.rse.filters.ISystemFilterPoolManagerProvider;
+import org.eclipse.rse.filters.ISystemFilterPoolReference;
+import org.eclipse.rse.filters.ISystemFilterPoolReferenceManager;
+import org.eclipse.rse.filters.ISystemFilterPoolReferenceManagerProvider;
+import org.eclipse.rse.filters.ISystemFilterReference;
+import org.eclipse.rse.filters.ISystemFilterSavePolicies;
+import org.eclipse.rse.internal.references.SystemPersistableReferenceManager;
+import org.eclipse.rse.references.ISystemBasePersistableReferenceManager;
+import org.eclipse.rse.references.ISystemBasePersistableReferencingObject;
+import org.eclipse.rse.references.ISystemPersistableReferencedObject;
+
+
+/**
+ * This class manages a persistable list of objects each of which reference
+ * a filter pool. This class builds on the parent class SystemPersistableReferenceManager,
+ * offering convenience versions of the parent methods that are typed to the
+ * classes in the filters framework.
+ */
+/**
+ * @lastgen class SystemFilterPoolReferenceManagerImpl extends SystemPersistableReferenceManagerImpl implements SystemFilterPoolReferenceManager, SystemPersistableReferenceManager {}
+ */
+public class SystemFilterPoolReferenceManager extends SystemPersistableReferenceManager implements ISystemFilterPoolReferenceManager, ISystemBasePersistableReferenceManager
+{
+ //private SystemFilterPoolManager[] poolMgrs = null;
+ private ISystemFilterPoolManagerProvider poolMgrProvider = null;
+ private ISystemFilterPoolManager defaultPoolMgr = null;
+ private ISystemFilterPoolReferenceManagerProvider caller = null;
+ private ISystemFilterNamingPolicy namingPolicy = null;
+ private int savePolicy = ISystemFilterSavePolicies.SAVE_POLICY_NONE;
+ private Object mgrData = null;
+ private IFolder mgrFolder = null;
+ private boolean initialized = false;
+ private boolean noSave;
+ private boolean noEvents;
+ private boolean fireEvents = true;
+ private ISystemFilterPoolReference[] fpRefsArray = null;
+ private static final ISystemFilterPoolReference[] emptyFilterPoolRefArray = new ISystemFilterPoolReference[0];
+
+/**
+ * Default constructor. Typically called by MOF factory methods.
+ */
+ public SystemFilterPoolReferenceManager()
+ {
+ super();
+ }
+ /**
+ * Create a SystemFilterPoolReferenceManager instance.
+ * @param caller Objects which instantiate this class should implement the
+ * SystemFilterPoolReferenceManagerProvider interface, and pass "this" for this parameter.
+ * Given any filter framework object, it is possible to retrieve the caller's
+ * object via the getProvider method call.
+ * @param relatedPoolManagers The managers that owns the master list of filter pools that
+ * this manager will contain references to.
+ * @param mgrFolder the folder that will hold the persisted file. This is used when
+ * the save policy is SAVE_POLICY_ONE_FILE_PER_MANAGER. For SAVE_POLICY_NONE, this
+ * is not used. If it is used, it is created if it does not already exist.
+ * @param name the name of the filter pool reference manager. This is used when
+ * the save policy is SAVE_POLICY_ONE_FILE_PER_MANAGER, to deduce the file name.
+ * @param savePolicy The save policy for the filter pool references list. One of the
+ * following from the {@link org.eclipse.rse.filters.ISystemFilterConstants SystemFilterConstants}
+ * interface:
+ *
+ *
+ * Calls back to inform provider
+ * @param filterPoolRefs Array of SystemFilterPoolReferences to move.
+ * @param newPosition new zero-based position for the filter pool references.
+ */
+ public void moveSystemFilterPoolReferences(ISystemFilterPoolReference[] filterPoolRefs, int delta)
+ {
+ int[] oldPositions = new int[filterPoolRefs.length];
+ noEvents = noSave = true;
+ for (int idx=0; idx
+ * @param mgrs The list of filter pool managers to scan for the given name
+ * @param mgrName The name of the manager to restrict the search to
+ */
+ public static ISystemFilterPoolManager getFilterPoolManager(ISystemFilterPoolManager[] mgrs, String mgrName)
+ {
+ ISystemFilterPoolManager mgr = null;
+ for (int idx=0; (mgr==null)&&(idx
+ * we are not yet ready to make this available.
+ * @param parentFilter The parent filter for this filter string reference.
+ * @param referencedString The filter string we reference
+ */
+ protected SystemFilterStringReference(ISystemFilter parentFilter, ISystemFilterString referencedString)
+ {
+ super();
+ this.parentFilter = parentFilter;
+ helper = new SystemReferencingObjectHelper(this);
+ setReferencedObject(referencedString);
+ }
+
+
+ /**
+ * Return the reference manager which is managing this filter reference
+ * framework object.
+ */
+ public ISystemFilterPoolReferenceManager getFilterPoolReferenceManager()
+ {
+ ISystemFilterReference filter = getParent();
+ if (parent != null)
+ return parent.getFilterPoolReferenceManager();
+ return null;
+ }
+
+ /**
+ * Return the object which instantiated the pool reference manager object.
+ * Makes it easy to get back to the point of origin, given any filter reference
+ * framework object
+ */
+ public ISystemFilterPoolReferenceManagerProvider getProvider()
+ {
+ ISystemFilterPoolReferenceManager mgr = getFilterPoolReferenceManager();
+ if (mgr != null)
+ return mgr.getProvider();
+ else
+ return null;
+ }
+
+ /**
+ * @see ISystemFilterStringReference#getReferencedFilterString()
+ */
+ public ISystemFilterString getReferencedFilterString()
+ {
+ return (ISystemFilterString)getReferencedObject();
+ }
+
+ /**
+ * Same as getReferencedFilterString().getString()
+ */
+ public String getString()
+ {
+ return getReferencedFilterString().getString();
+ }
+
+
+ /**
+ * @see ISystemFilterStringReference#getParent()
+ */
+ public ISystemFilterReference getParent()
+ {
+ return parent;
+ }
+ /**
+ * @see ISystemFilterStringReference#getParentSystemFilter()
+ */
+ public ISystemFilter getParentSystemFilter()
+ {
+ if (parentFilter != null)
+ return parentFilter;
+ else if (parent != null)
+ return parent.getReferencedFilter();
+ else
+ return null;
+ }
+
+
+ /**
+ * This is the method required by the IAdaptable interface.
+ * Given an adapter class type, return an object castable to the type, or
+ * null if this is not possible.
+ * By default this returns Platform.getAdapterManager().getAdapter(this, adapterType);
+ * This in turn results in the default subsystem adapter SystemViewSubSystemAdapter,
+ * in package org.eclipse.rse.ui.view.
+ */
+ public Object getAdapter(Class adapterType)
+ {
+ return Platform.getAdapterManager().getAdapter(this, adapterType);
+ }
+ // ----------------------------------------------
+ // ISystemReferencingObject methods...
+ // ----------------------------------------------
+
+ /**
+ * @see org.eclipse.rse.references.ISystemBaseReferencingObject#setReferencedObject(ISystemBaseReferencedObject)
+ */
+ public void setReferencedObject(ISystemBaseReferencedObject obj)
+ {
+ helper.setReferencedObject(obj);
+ }
+
+ /**
+ * @see org.eclipse.rse.references.ISystemBaseReferencingObject#getReferencedObject()
+ */
+ public ISystemBaseReferencedObject getReferencedObject()
+ {
+ return helper.getReferencedObject();
+ }
+
+ /**
+ * @see org.eclipse.rse.references.ISystemBaseReferencingObject#removeReference()
+ */
+ public int removeReference()
+ {
+ return helper.removeReference();
+ }
+
+ /**
+ * Set to true if this reference is currently broken/unresolved
+ */
+ public void setReferenceBroken(boolean broken)
+ {
+ referenceBroken = broken;
+ }
+
+ /**
+ * Return true if this reference is currently broken/unresolved
+ */
+ public boolean isReferenceBroken()
+ {
+ return referenceBroken;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/ctool16/new.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/ctool16/new.gif
new file mode 100644
index 0000000000000000000000000000000000000000..7aea894d0b603a02aed2a7f706bcb3170988774d
GIT binary patch
literal 612
zcmZ{h>q}E%9Dt8G)5LOgQI2^@7e=H}5t7*jq~=si${U5|rU_+M-j`oOU#sb&i!)6!
zQj1L2<%^C`(3Frs!zQH!M$LxHZR)0;HP3s_`~J#5py%WBe0&lT<%eQbQbx*H7)D;+
zC9mj8tL`~bsh6u?DXLzlp`Oc4!$r+QwcX=`U*-e?sC#^9(mL|ZR{74{H@%DrT A9VL}>?w1J7eN*3kUXk(DEU6m(EdKjHN)jkv7c;{Jb4a3C!1>qfFng9R*
literal 0
HcmV?d00001
diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/ctool16/newconnection_wiz.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/ctool16/newconnection_wiz.gif
new file mode 100644
index 0000000000000000000000000000000000000000..9f2b4acc733d73b2b6570ee603b53d7be7621d3c
GIT binary patch
literal 328
zcmZ?wbhEHb6krfwxXQq=e#QEgi&idQxO~Cv1v974oHlvdguV$kuixzL>FsFmxNzad
zn>X(TG8`ldJPaBlDmD~!9BBCQ
+ * It checks to see if the string is legally quoted, and if not, it returns it as is. A legally quoted
+ * string is one which begins and ends with single quotes, and where all single quotes inside the
+ * string are escaped with another single quote. If the string is legally quoted, it de-quotes it
+ * (hence the name). Dequoting means remove the single quotes, and remove any escape quotes
+ * from the inside of the string.
+ * There is also a general constructor that takes in the quoting character, the character to escape,
+ * and the character to use as an escape charcter. It also takes n a boolean flag that decides wether
+ * or not the string has to be quoted before this massager actually does the job.
+ */
+public class MassagerRemoveQuotes implements ISystemMassager {
+
+
+
+ private String quoteChar;
+ private String charToEscape;
+ private String escapeChar;
+ private boolean mustBeQuoted;
+
+ /**
+ * Default constructor for MassagerRemoveQuotes.
+ * Assumes that a legal string is one where the string is quoted with single quotes,
+ * and all inner quotes are escaped with a single quote.
+ */
+ public MassagerRemoveQuotes() {
+ this('\'', '\'', '\'', true);
+ }
+
+ /**
+ * Generic constructor. A valid string is one where every charToEscape is actually
+ * escaped with an escapeChar before it. If mustBeQuoted is true, then the string
+ * is only valid if it is quoted with the quoteChar, and the characters inside the
+ * string itself are properly escaped. If the string is determined to be a valid string,
+ * this massager returns the string with the quotes and escape characters stripped out.
+ * if not, the string is returned as is.
+ */
+ public MassagerRemoveQuotes(
+ char quoteChar,
+ char charToEscape,
+ char escapeChar,
+ boolean mustBeQuoted) {
+
+ this.quoteChar = String.valueOf(quoteChar);
+ this.charToEscape = String.valueOf(charToEscape);
+ this.escapeChar = String.valueOf(escapeChar);
+ this.mustBeQuoted = mustBeQuoted;
+ }
+
+ public String massage(String text) {
+ String strippedText = text;
+
+ if (mustBeQuoted) {
+ if (!isQuoted(text))
+ // String is not quoted, when it should be, return it as is.
+ // No need to de-quote since it is not a legal string.
+ return text;
+ else
+ strippedText = stripQuotes(text);
+ }
+
+ // check to see if string is a legal string, and if it is, de-quote it.
+ boolean islegal = isLegalString(strippedText);
+ if (islegal)
+ return deQuote(strippedText);
+ else
+ return text;
+ }
+
+ /**
+ * Returns true if string is single quoted.
+ */
+ protected boolean isQuoted(String text) {
+ if (text.startsWith(quoteChar) && text.endsWith(quoteChar))
+ return true;
+ else
+ return false;
+ }
+
+ /**
+ * Checks to see if we have a valid string. A valid string is one where all
+ * quotes are escaped with another quote.
+ */
+ protected boolean isLegalString(String text) {
+ if (charToEscape.equals(escapeChar))
+ return doForwardChecking(text);
+ else
+ return doBackwardChecking(text);
+ }
+
+ private boolean doForwardChecking(String text) {
+ int index = text.indexOf(charToEscape);
+ while (index != -1) {
+ // check the char AFTER the escape char since they are both the
+ // same. . Be careful if it is the last char.
+ if ((index == text.length() - 1)
+ || (text.charAt(index + 1) != escapeChar.charAt(0)))
+ // we have a quote that is not escaped => not a legal string.
+ return false;
+
+ // search for another quote *after* the escaped one.
+ index = text.indexOf(charToEscape, index + 2);
+ }
+
+ // all quotes are escaped, legal string.
+ return true;
+
+ }
+
+ private boolean doBackwardChecking(String text) {
+ int index = text.indexOf(charToEscape);
+ while (index != -1) {
+ // check the char before the character to escape. Be careful if it is the first char.
+ if ((index == 0)
+ || (text.charAt(index - 1) != escapeChar.charAt(0)))
+ // we have a quote that is not escaped => not a legal string.
+ return false;
+
+ // search for another quote *after* the escaped one.
+ index = text.indexOf(charToEscape, index + 1);
+ }
+
+ // all quotes are escaped, legal string.
+ return true;
+
+ }
+
+ /**
+ * Removes first and last chars if they are single quotes, otherwise
+ * returns the string as is.
+ */
+ private String stripQuotes(String text) {
+ if (isQuoted(text)) {
+ text = text.substring(1, text.length() - 1);
+ }
+ return text;
+ }
+
+ /**
+ * This method assumes that the passed string is a legal string, and it does
+ * the qe-quoting.
+ */
+ private String deQuote(String text) {
+ if (charToEscape.equals(escapeChar))
+ return doForwardDeQuote(text);
+ else
+ return doBackwardDeQuote(text);
+ }
+
+ private String doForwardDeQuote(String text) {
+ int index = text.indexOf(charToEscape);
+ while (index != -1) {
+ // strip the escape char.
+ text = text.substring(0, index) + text.substring(index + 1);
+
+ // search for another quote *after* the escaped one.
+ index = text.indexOf(charToEscape, index + 2);
+ }
+ return text;
+ }
+
+ private String doBackwardDeQuote(String text) {
+ int index = text.indexOf(charToEscape);
+ while (index != -1) {
+ // strip the escape char.
+ text = text.substring(0, index - 1) + text.substring(index);
+
+ // search for another quote *after* the escaped one.
+ index = text.indexOf(charToEscape, index + 1);
+ }
+ return text;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/Mnemonics.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/Mnemonics.java
new file mode 100644
index 00000000000..ba1c611d842
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/Mnemonics.java
@@ -0,0 +1,578 @@
+/********************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.rse.ui.widgets.InheritableEntryField;
+import org.eclipse.swt.events.ArmListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+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.MenuItem;
+import org.eclipse.swt.widgets.Text;
+
+
+
+/**
+ * A class for creating unique mnemonics per control per window.
+ */
+public class Mnemonics
+{
+ private static final String[] TransparentEndings = { // endings that should appear after a mnemonic
+ "...", // ellipsis
+ ">>", // standard "more"
+ "<<", // standard "less"
+ ">", // "more" -- non-standard usage, must appear in list after >>
+ "<", // "less" -- non-standard usage, must appear in list after <<
+ ":", // colon
+ "\uff0e\uff0e\uff0e", // wide ellipsis
+ "\uff1e\uff1e", // wide standard "more"
+ "\uff1c\uff1c", // wide standard "less"
+ "\uff1e", // wide non-standard "more"
+ "\uff1c", // wide non-standard "less"
+ "\uff1a" // wide colon
+ };
+
+ private StringBuffer mnemonics = new StringBuffer(); // mnemonics used so far
+ private static final String candidateChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
+ private String preferencePageMnemonics = null; // mnemonics used by Eclipse on preference pages
+ private String wizardPageMnemonics = null; // mnemonics used by Eclipse on wizard pages
+ // private static String preferencePageMnemonics = "AD"; // mnemonics used by Eclipse on preference pages
+ // private static String wizardPageMnemonics = "FBN"; // mnemonics used by Eclipse on wizard pages
+ public static final char MNEMONIC_CHAR = '&';
+ private boolean onPrefPage = false;
+ private boolean onWizardPage = false;
+ private boolean applyMnemonicsToPrecedingLabels = true;
+
+ /**
+ * Clear the list for re-use
+ */
+ public void clear()
+ {
+ mnemonics = new StringBuffer();
+ }
+
+ /**
+ * Inserts an added mnemonic of the form (&x) into a StringBuffer at the correct point.
+ * Checks for transparent endings and trailing spaces.
+ * @param label the label to check
+ */
+ private static void insertMnemonic(StringBuffer label, String mnemonic) {
+ int p = label.length();
+ // check for trailing spaces #1
+ while (p > 0 && label.charAt(p - 1) == ' ') {
+ p--;
+ }
+ // check for transparent endings
+ for (int i = 0; i < TransparentEndings.length; i++) {
+ String transparentEnding = TransparentEndings[i];
+ int l = transparentEnding.length();
+ int n = p - l;
+ if (n >= 0) {
+ String labelEnding = label.substring(n, n + l);
+ if (labelEnding.equals(transparentEnding)) {
+ p = n;
+ break;
+ }
+ }
+ }
+ // check for trailing spaces #2
+ while (p > 0 && label.charAt(p - 1) == ' ') {
+ p--;
+ }
+ // make sure there is something left to attach a mnemonic to
+ if (p > 0) {
+ label.insert(p, mnemonic);
+ }
+ }
+
+ /**
+ * Given a string, this starts at the first character and iterates until
+ * it finds a character not previously used as a mnemonic on this page.
+ * Not normally called from other classes, but rather by the setMnemonic
+ * methods in this class.
+ * @param label String to which to generate and apply the mnemonic
+ * @return input String with '&' inserted in front of the unique character
+ */
+ public String setUniqueMnemonic(String label)
+ {
+
+ // Kludge for now
+ // If there is already a mnemonic, remove it
+ label = removeMnemonic(label);
+ //int iMnemonic = label.indexOf( MNEMONIC_CHAR );
+ //if( iMnemonic >= 0 && iMnemonic < label.length() - 1 ){
+ //mnemonics.append( label.charAt( iMnemonic + 1 ) );
+ //return label;
+ //}
+
+ int labelLen = label.length();
+ if (labelLen == 0)
+ return label;
+ else if ((labelLen == 1) && label.equals("?"))
+ return label;
+ StringBuffer newLabel = new StringBuffer(label);
+ int mcharPos = findUniqueMnemonic(label);
+ if (mcharPos != -1)
+ newLabel.insert(mcharPos,MNEMONIC_CHAR);
+ // if no unique character found, then
+ // find a new arbitrary one from the alphabet...
+ else
+ {
+ mcharPos = findUniqueMnemonic(candidateChars);
+ if (mcharPos != -1)
+ {
+ String addedMnemonic = "(" + MNEMONIC_CHAR + candidateChars.charAt(mcharPos) + ")";
+ insertMnemonic(newLabel, addedMnemonic);
+ }
+ }
+ return newLabel.toString();
+ } // end getUniqueMnemonic
+ /**
+ * Given a label and mnemonic, this applies that mnemonic to the label.
+ * Not normally called from other classes, but rather by the setUniqueMnemonic
+ * methods in this class.
+ * @param label String to which to apply the mnemonic
+ * @param mnemonicChar the character that is to be the mnemonic character
+ * @return input String with '&' inserted in front of the given character
+ */
+ public static String applyMnemonic(String label, char mnemonicChar)
+ {
+ int labelLen = label.length();
+ if (labelLen == 0)
+ return label;
+ StringBuffer newLabel = new StringBuffer(label);
+ int mcharPos = findCharPos(label, mnemonicChar);
+ if (mcharPos != -1)
+ newLabel.insert(mcharPos,MNEMONIC_CHAR);
+ else
+ {
+ String addedMnemonic = new String("("+MNEMONIC_CHAR + mnemonicChar + ")");
+ insertMnemonic(newLabel, addedMnemonic);
+ }
+ return newLabel.toString();
+ } // end getUniqueMnemonic
+ /**
+ * Given a char, find its position in the given string
+ */
+ private static int findCharPos(String label, char charToFind)
+ {
+ int pos = -1;
+ for (int idx=0; (pos==-1) && (idxfalse
if it does not work
+ * in your dialog, wizard, preference or property page, i.e. you have labels preceding these
+ * widgets that do not necessarily refer to them.
+ * @param apply true
to apply mnemonic to preceding labels, false
otherwise.
+ * @return this instance, for convenience
+ */
+ public Mnemonics setApplyMnemonicsToPrecedingLabels(boolean apply) {
+ this.applyMnemonicsToPrecedingLabels = apply;
+ return this;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemBaseForm.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemBaseForm.java
new file mode 100644
index 00000000000..6dd7e691acf
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemBaseForm.java
@@ -0,0 +1,303 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui;
+
+import java.util.Vector;
+
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.messages.ISystemMessageLine;
+import org.eclipse.rse.ui.propertypages.ISystemConnectionWizardErrorUpdater;
+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.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+
+
+
+/**
+ * A reusable base form.
+ *
+ * This is usually set by the using dialog/pane, and queried by this object.
+ */
+ public void setInputObject(Object inputObject)
+ {
+ this.inputObject = inputObject;
+ }
+ /**
+ * Return the input object as set by {@link #setInputObject(Object)}.
+ */
+ protected Object getInputObject()
+ {
+ return inputObject;
+ }
+ /**
+ * Set the output object. This is usually set by this object, and is subsequently
+ * queried by the using dialog/page.
+ */
+ protected void setOutputObject(Object outputObject)
+ {
+ this.outputObject = outputObject;
+ }
+ /**
+ * Return the output object as set by {@link #setOutputObject(Object)}.
+ */
+ public Object getOutputObject()
+ {
+ return outputObject;
+ }
+
+ /**
+ * Default implementation to satisfy Listener interface. Does nothing.
+ */
+ public void handleEvent(Event evt) {}
+
+ /**
+ * Register an interest in knowing whenever {@link #setPageComplete(boolean)} is
+ * called by subclass code.
+ */
+ public void addPageCompleteListener(ISystemPageCompleteListener l)
+ {
+ if (pageCompleteListeners == null)
+ pageCompleteListeners = new Vector();
+ pageCompleteListeners.add(l);
+ }
+ /**
+ * De-register a page complete listener.
+ */
+ public void removePageCompleteListener(ISystemPageCompleteListener l)
+ {
+ if (pageCompleteListeners != null)
+ pageCompleteListeners.remove(l);
+ }
+
+ /**
+ * The completeness of the page has changed.
+ * We direct it to the Apply button versus just the OK button
+ * @see {@link #addPageCompleteListener(ISystemPageCompleteListener)}
+ */
+ protected void setPageComplete(boolean complete)
+ {
+ this.complete = complete;
+ if (pageCompleteListeners != null)
+ {
+ for (int idx=0; idxISystemValidator
object.
+ * If the ISystemValidator
reports an error the error message is displayed
+ * in the Dialog's message line.
+ * @see #setConnectionNameValidators(ISystemValidator[])
+ */
+ protected SystemMessage validateConnectionNameInput(boolean userTyped)
+ {
+ if (!connectionNameListen)
+ return null;
+ errorMessage= null;
+ int selectedProfile = 0;
+ if (profileCombo != null)
+ {
+ selectedProfile = profileCombo.getSelectionIndex();
+ }
+ if (selectedProfile < 0)
+ selectedProfile = 0;
+ ISystemValidator nameValidator = null;
+ if ((nameValidators!=null) && (nameValidators.length>0))
+ nameValidator = nameValidators[selectedProfile];
+ String connName = textConnectionName.getText().trim();
+ if (nameValidator != null)
+ {
+ errorMessage = nameValidator.validate(connName);
+ }
+ showErrorMessage(errorMessage);
+ setPageComplete();
+ if (userTyped)
+ connectionNameEmpty = (connName.length()==0); // d43191
+ return errorMessage;
+ }
+ /**
+ * Set the connection name internally without validation
+ */
+ protected void internalSetConnectionName(String name)
+ {
+ SystemMessage currErrorMessage = errorMessage;
+ connectionNameListen = false;
+ textConnectionName.setText(name);
+ connectionNameListen = true;
+ errorMessage = currErrorMessage;
+ }
+ /**
+ * This hook method is called whenever the text changes in the input field.
+ * The default implementation delegates the request to an ISystemValidator
object.
+ * If the ISystemValidator
reports an error the error message is displayed
+ * in the Dialog's message line.
+ * @see #setHostNameValidator(ISystemValidator)
+ */
+ protected SystemMessage validateHostNameInput()
+ {
+ String hostName = textHostName.getText().trim();
+ if (connectionNameEmpty) // d43191
+ internalSetConnectionName(hostName);
+ errorMessage= null;
+ if (hostValidator != null)
+ errorMessage= hostValidator.validate(hostName);
+ else if (getHostName().length() == 0)
+ errorMessage = SystemPlugin.getPluginMessage(MSG_VALIDATE_HOSTNAME_EMPTY);
+ if (updateMode && !userPickedVerifyHostnameCB)
+ {
+ boolean hostNameChanged = !hostName.equals(defaultHostName);
+ verifyHostNameCB.setSelection(hostNameChanged);
+ }
+ showErrorMessage(errorMessage);
+ setPageComplete();
+ return errorMessage;
+ }
+ /**
+ * This hook method is called whenever the text changes in the input field.
+ * The default implementation delegates the request to an ISystemValidator
object.
+ * If the ISystemValidator
reports an error the error message is displayed
+ * in the Dialog's message line.
+ * @see #setUserIdValidator(ISystemValidator)
+ */
+ protected SystemMessage validateUserIdInput()
+ {
+ errorMessage= null;
+ if (textUserId != null)
+ {
+ if (userIdValidator != null)
+ errorMessage= userIdValidator.validate(textUserId.getText());
+ else if (getDefaultUserId().length()==0)
+ errorMessage = SystemPlugin.getPluginMessage(MSG_VALIDATE_USERID_EMPTY);
+ }
+ showErrorMessage(errorMessage);
+ setPageComplete();
+ return errorMessage;
+ }
+
+ /**
+ * Inform caller of page-complete status of this form
+ */
+ public void setPageComplete()
+ {
+ boolean complete = isPageComplete();
+ if (complete && (textSystemType!=null))
+ lastSystemType = textSystemType.getText().trim();
+ if (callerInstanceOfWizardPage)
+ {
+ ((WizardPage)caller).setPageComplete(complete);
+ }
+ else if (callerInstanceOfSystemPromptDialog)
+ {
+ ((SystemPromptDialog)caller).setPageComplete(complete);
+ }
+ else if (callerInstanceOfPropertyPage)
+ {
+ ((PropertyPage)caller).setValid(complete);
+ }
+ }
+
+ /**
+ * Display error message or clear error message
+ */
+ private void showErrorMessage(SystemMessage msg)
+ {
+ if (msgLine != null)
+ if (msg != null)
+ msgLine.setErrorMessage(msg);
+ else
+ msgLine.clearErrorMessage();
+ else
+ SystemBasePlugin.logDebugMessage(this.getClass().getName(), "MSGLINE NULL. TRYING TO WRITE MSG " + msg);
+ }
+
+ // ---------------------------------------------------------------
+ // STATIC METHODS FOR GETTING A CONNECTION NAME VALIDATOR...
+ // ---------------------------------------------------------------
+
+ /**
+ * Reusable method to return a name validator for renaming a connection.
+ * @param the current connection object on updates. Can be null for new names. Used
+ * to remove from the existing name list the current connection.
+ */
+ public static ISystemValidator getConnectionNameValidator(IHost conn)
+ {
+ ISystemProfile profile = conn.getSystemProfile();
+ Vector v = SystemPlugin.getTheSystemRegistry().getHostAliasNames(profile);
+ if (conn != null) // hmm, line 1 of this method will crash if this is the case!
+ v.removeElement(conn.getAliasName());
+ ValidatorConnectionName connNameValidator = new ValidatorConnectionName(v);
+ return connNameValidator;
+ }
+ /**
+ * Reusable method to return a name validator for renaming a connection.
+ * @param the current connection object's profile from which to get the existing names.
+ * Can be null for syntax checking only, versus name-in-use.
+ */
+ public static ISystemValidator getConnectionNameValidator(ISystemProfile profile)
+ {
+ Vector v = SystemPlugin.getTheSystemRegistry().getHostAliasNames(profile);
+ ValidatorConnectionName connNameValidator = new ValidatorConnectionName(v);
+ return connNameValidator;
+ }
+
+ /**
+ * Reusable method to return name validators for creating a connection.
+ * There is one validator per active system profile.
+ */
+ public static ISystemValidator[] getConnectionNameValidators()
+ {
+ ISystemRegistry sr = SystemPlugin.getTheSystemRegistry();
+ ISystemProfile[] profiles = sr.getActiveSystemProfiles();
+ ISystemValidator[] connNameValidators = new ISystemValidator[profiles.length];
+ for (int idx=0; idxISystemValidator
object.
+ * If the ISystemValidator
reports an error the error message is displayed
+ * in the Dialog's message line.
+ * @see #setNameValidators(ISystemValidator)
+ */
+ protected SystemMessage validateNameInput()
+ {
+ errorMessage= null;
+ errorMessage= nameValidator.validate(profileName.getText().trim());
+ showErrorMessage(errorMessage);
+ setPageComplete();
+ return errorMessage;
+ }
+
+ /**
+ * This method can be called by the dialog or wizard page host, to decide whether to enable
+ * or disable the next, final or ok buttons. It returns true if the minimal information is
+ * available and is correct.
+ */
+ public boolean isPageComplete()
+ {
+ boolean pageComplete = false;
+ if (errorMessage == null)
+ pageComplete = (getProfileName().length() > 0);
+ return pageComplete;
+ }
+
+ /**
+ * Inform caller of page-complete status of this form
+ */
+ public void setPageComplete()
+ {
+ boolean complete = isPageComplete();
+ if (callerInstanceOfWizardPage)
+ {
+ ((WizardPage)caller).setPageComplete(complete);
+ }
+ else if (callerInstanceOfSystemPromptDialog)
+ {
+ ((SystemPromptDialog)caller).setPageComplete(complete);
+ }
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemPropertyResources.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemPropertyResources.java
new file mode 100644
index 00000000000..1bd1d9a56bc
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemPropertyResources.java
@@ -0,0 +1,51 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui;
+
+import org.eclipse.osgi.util.NLS;
+
+public class SystemPropertyResources extends NLS
+{
+ private static String BUNDLE_NAME = "org.eclipse.rse.ui.SystemPropertyResources";//$NON-NLS-1$
+
+// ------------------------------
+ // PROPERTY SHEET VALUES
+ // ------------------------------
+ // PROPERTY SHEET VALUES: GENERIC
+
+ public static String RESID_PROPERTY_NAME_LABEL;
+ public static String RESID_PROPERTY_NAME_TOOLTIP;
+
+ public static String RESID_PROPERTY_TYPE_LABEL;
+ public static String RESID_PROPERTY_TYPE_TOOLTIP;
+
+ public static String RESID_PROPERTY_DESCRIPTION_LABEL;
+ public static String RESID_PROPERTY_DESCRIPTION_TOOLTIP;
+
+ public static String RESID_PROPERTY_FILTERTYPE_VALUE;
+
+ public static String RESID_TERM_NOTAPPLICABLE;
+ public static String RESID_TERM_NOTAVAILABLE;
+
+ public static String RESID_PORT_DYNAMICSELECT;
+ public static String RESID_PROPERTY_INHERITED;
+
+ static {
+ // load message values from bundle file
+ NLS.initializeMessages(BUNDLE_NAME, SystemPropertyResources.class);
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemPropertyResources.properties b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemPropertyResources.properties
new file mode 100644
index 00000000000..1bae7213902
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemPropertyResources.properties
@@ -0,0 +1,34 @@
+################################################################################
+# Copyright (c) 2006 IBM Corporation. All rights reserved.
+# This program and the accompanying materials are made available under the terms
+# of the Eclipse Public License v1.0 which accompanies this distribution, and is
+# available at http://www.eclipse.org/legal/epl-v10.html
+#
+# Initial Contributors:
+# The following IBM employees contributed to the Remote System Explorer
+# component that contains this file: David McKnight, Kushal Munir,
+# Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+# Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+#
+# Contributors:
+# {Name} (company) - description of contribution.
+################################################################################
+
+##############################################################
+# PROPERTY VALUES...
+##############################################################
+# NLS_MESSAGEFORMAT_NONE
+
+RESID_PROPERTY_NAME_LABEL=Name
+RESID_PROPERTY_NAME_TOOLTIP=Name of resources
+RESID_PROPERTY_TYPE_LABEL=Type
+RESID_PROPERTY_TYPE_TOOLTIP=Type of resource
+RESID_PROPERTY_DESCRIPTION_LABEL=Description
+RESID_PROPERTY_DESCRIPTION_TOOLTIP=Description of resource
+
+RESID_TERM_NOTAPPLICABLE=Not applicable
+RESID_TERM_NOTAVAILABLE=Not available
+RESID_PORT_DYNAMICSELECT=(First-available)
+RESID_PROPERTY_INHERITED=(Inherited)
+
+RESID_PROPERTY_FILTERTYPE_VALUE=Remote system filter
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemResources.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemResources.java
new file mode 100644
index 00000000000..301da49e3a5
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemResources.java
@@ -0,0 +1,1227 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui;
+
+import org.eclipse.osgi.util.NLS;
+
+
+/**
+ * Constants used throughout the System plugin.
+ */
+public class SystemResources extends NLS
+{
+ private static String BUNDLE_NAME = "org.eclipse.rse.ui.SystemResources";//$NON-NLS-1$
+
+ /**
+ * Current release as a number (multiplied by 10). E.g. 30 is for release
+ * 3.0.
+ */
+ public static final int CURRENT_RELEASE = 700; // updated to new release
+/**
+ * Current release as a string.
+ */
+ public static final String CURRENT_RELEASE_NAME = "7.0.0";
+
+
+ // Buttons
+ // *** NOT GOOD TO USE BUTTONS. BETTER TO USE ACTIONS WITH THEIR
+ // .label,.tooltip and .description ASSOCIATIONS
+ // THESE BUTTON LABELS ARE USED IN SYSTEMPROMPTDIALOG
+ public static String BUTTON_BROWSE;
+ public static String BUTTON_TEST;
+ public static String BUTTON_CLOSE;
+ public static String BUTTON_ADD;
+ public static String BUTTON_CREATE_LABEL;
+ public static String BUTTON_CREATE_TOOLTIP;
+ public static String BUTTON_APPLY_LABEL;
+ public static String BUTTON_APPLY_TOOLTIP;
+ public static String BUTTON_RESET_LABEL;
+ public static String BUTTON_RESET_TOOLTIP;
+
+
+ // THESE TERMS ARE USED POTENTIALLY ANYWHERE
+ public static String TERM_YES;
+ public static String TERM_NO;
+
+ public static String TERM_TRUE;
+ public static String TERM_FALSE;
+
+ public static String TERM_LOCAL;
+ public static String TERM_ALL;
+
+ public static String RESID_MSGLINE_TIP;
+
+ // ----------------------------------------
+ // GENERIC/COMMON WIZARD AND DIALOG STRINGS
+ // ----------------------------------------
+ // GENERIC MULTI-SELECT RENAME DIALOG...
+ public static String RESID_RENAME_TITLE;
+ public static String RESID_RENAME_SINGLE_TITLE;
+ public static String RESID_RENAME_VERBAGE;
+ public static String RESID_RENAME_COLHDG_OLDNAME;
+ public static String RESID_RENAME_COLHDG_NEWNAME;
+ public static String RESID_RENAME_COLHDG_TYPE;
+
+ // SPECIALIZED PROMPTS FOR GENERIC RENAME DIALOG...
+ public static String RESID_MULTI_RENAME_PROFILE_VERBAGE;
+
+ // GENERIC SINGLE-SELECT RENAME DIALOG...
+
+ public static String RESID_SIMPLE_RENAME_PROMPT_LABEL;
+ public static String RESID_SIMPLE_RENAME_PROMPT_TOOLTIP;
+
+
+
+ public static String RESID_SIMPLE_RENAME_RESOURCEPROMPT_LABEL;
+ public static String RESID_SIMPLE_RENAME_RESOURCEPROMPT_TOOLTIP;
+ public static String RESID_SIMPLE_RENAME_RADIO_OVERWRITE_LABEL;
+ public static String RESID_SIMPLE_RENAME_RADIO_OVERWRITE_TOOLTIP;
+ public static String RESID_SIMPLE_RENAME_RADIO_RENAME_LABEL;
+ public static String RESID_SIMPLE_RENAME_RADIO_RENAME_TOOLTIP;
+
+ // SPECIALIZED PROMPTS FOR GENERIC RENAME DIALOG...
+ public static String RESID_SIMPLE_RENAME_PROFILE_PROMPT_LABEL;
+
+ public static String RESID_SIMPLE_RENAME_PROFILE_PROMPT_TIP;
+
+ // GENERIC DELETE DIALOG...
+ public static String RESID_DELETE_TITLE;
+
+ public static String RESID_DELETE_PROMPT;
+
+ public static String RESID_DELETE_PROMPT_SINGLE;
+
+
+ public static String RESID_DELETE_RESOURCEPROMPT_LABEL;
+ public static String RESID_DELETE_RESOURCEPROMPT_TOOLTIP;
+
+ public static String RESID_DELETE_TIP;
+
+ public static String RESID_DELETE_WARNING_LABEL;
+ public static String RESID_DELETE_WARNING_TOOLTIP;
+
+ public static String RESID_DELETE_WARNINGLOCAL_LABEL;
+ public static String RESID_DELETE_WARNINGLOCAL_TOOLTIP;
+
+ public static String RESID_DELETE_COLHDG_OLDNAME;
+
+ public static String RESID_DELETE_COLHDG_TYPE;
+
+ public static String RESID_DELETE_BUTTON;
+
+ // SPECIALIZED PROMPTS FOR GENERIC DELETE DIALOG...
+ public static String RESID_DELETE_PROFILES_PROMPT;
+
+ // GENERIC COPY DIALOG...
+ public static String RESID_COPY_TITLE;
+ public static String RESID_COPY_SINGLE_TITLE;
+ public static String RESID_COPY_PROMPT;
+ public static String RESID_COPY_TARGET_PROFILE_PROMPT;
+ public static String RESID_COPY_TARGET_FILTERPOOL_PROMPT;
+ public static String RESID_COPY_TARGET_FILTER_PROMPT;
+
+ // GENERIC MOVE DIALOG...
+ public static String RESID_MOVE_TITLE;
+ public static String RESID_MOVE_SINGLE_TITLE;
+ public static String RESID_MOVE_PROMPT;
+ public static String RESID_MOVE_TARGET_PROFILE_PROMPT;
+ public static String RESID_MOVE_TARGET_FILTERPOOL_PROMPT;
+ public static String RESID_MOVE_TARGET_FILTER_PROMPT;
+
+ // GENERIC RESOURCE NAME COLLISION DIALOG...
+ public static String RESID_COLLISION_RENAME_TITLE;
+ public static String RESID_COLLISION_RENAME_VERBAGE;
+ public static String RESID_COLLISION_RENAME_LABEL;
+ public static String RESID_COLLISION_RENAME_TOOLTIP;
+
+ // GENERIC SELECT CONNECTION DIALOG...
+ public static String RESID_SELECTCONNECTION_TITLE;
+ public static String RESID_SELECTCONNECTION_VERBAGE;
+
+ // -------------------------
+ // WIZARD AND DIALOG STRINGS
+ // -------------------------
+ // NEW PROFILE WIZARD...
+ public static String RESID_NEWPROFILE_TITLE;
+ public static String RESID_NEWPROFILE_PAGE1_TITLE;
+ public static String RESID_NEWPROFILE_PAGE1_DESCRIPTION;
+ public static String RESID_NEWPROFILE_NAME_LABEL;
+ public static String RESID_NEWPROFILE_NAME_TOOLTIP;
+ public static String RESID_NEWPROFILE_MAKEACTIVE_LABEL;
+ public static String RESID_NEWPROFILE_MAKEACTIVE_TOOLTIP;
+ public static String RESID_NEWPROFILE_VERBAGE;
+
+ // RENAME DEFAULT PROFILE WIZARD PAGE...
+ public static String RESID_RENAMEDEFAULTPROFILE_PAGE1_TITLE;
+
+ public static String RESID_RENAMEDEFAULTPROFILE_PAGE1_DESCRIPTION;
+
+ public static String RESID_PROFILE_PROFILENAME_LABEL;
+ public static String RESID_PROFILE_PROFILENAME_TIP;
+ public static String RESID_PROFILE_PROFILENAME_VERBAGE;
+
+
+ // COPY SYSTEM PROFILE DIALOG...
+ public static String RESID_COPY_PROFILE_TITLE;
+
+ public static String RESID_COPY_PROFILE_PROMPT_LABEL;
+ public static String RESID_COPY_PROFILE_PROMPT_TOOLTIP;
+
+ // NEW SYSTEM CONNECTION WIZARD...
+ public static String RESID_NEWCONN_PROMPT_LABEL;
+ public static String RESID_NEWCONN_PROMPT_TOOLTIP;
+ public static String RESID_NEWCONN_PROMPT_VALUE;
+ public static String RESID_NEWCONN_EXPANDABLEPROMPT_VALUE;
+ public static String RESID_NEWCONN_TITLE;
+ public static String RESID_NEWCONN_PAGE1_TITLE;
+ public static String RESID_NEWCONN_PAGE1_REMOTE_TITLE;
+ public static String RESID_NEWCONN_PAGE1_LOCAL_TITLE;
+ public static String RESID_NEWCONN_PAGE1_DESCRIPTION;
+ public static String RESID_NEWCONN_SUBSYSTEMPAGE_FILES_DESCRIPTION;
+ public static String RESID_NEWCONN_SUBSYSTEMPAGE_FILES_TITLE;
+ public static String RESID_NEWCONN_SUBSYSTEMPAGE_FILES_VERBAGE1;
+ public static String RESID_NEWCONN_SUBSYSTEMPAGE_FILES_VERBAGE2;
+ public static String RESID_NEWCONN_SUBSYSTEMPAGE_DESCRIPTION;
+
+ public static String RESID_CONNECTION_TYPE_LABEL;
+ public static String RESID_CONNECTION_TYPE_VALUE;
+ public static String RESID_CONNECTION_SYSTEMTYPE_LABEL;
+ public static String RESID_CONNECTION_SYSTEMTYPE_TIP;
+ public static String RESID_CONNECTION_SYSTEMTYPE_READONLY_LABEL;
+ public static String RESID_CONNECTION_SYSTEMTYPE_READONLY_TIP;
+
+ public static String RESID_CONNECTION_CONNECTIONNAME_LABEL;
+ public static String RESID_CONNECTION_CONNECTIONNAME_TIP;
+
+ public static String RESID_CONNECTION_HOSTNAME_LABEL;
+ public static String RESID_CONNECTION_HOSTNAME_TIP;
+
+ public static String RESID_CONNECTION_HOSTNAME_READONLY_LABEL;
+ public static String RESID_CONNECTION_HOSTNAME_READONLY_TIP;
+
+ public static String RESID_CONNECTION_VERIFYHOSTNAME_LABEL;
+ public static String RESID_CONNECTION_VERIFYHOSTNAME_TOOLTIP;
+
+ public static String RESID_CONNECTION_USERID_LABEL;
+ public static String RESID_CONNECTION_USERID_TIP;
+
+ public static String RESID_CONNECTION_DEFAULTUSERID_LABEL;
+ public static String RESID_CONNECTION_DEFAULTUSERID_TIP;
+ public static String RESID_CONNECTION_DEFAULTUSERID_INHERITBUTTON_TIP;
+
+ public static String RESID_CONNECTION_PORT_LABEL;
+ public static String RESID_CONNECTION_PORT_TIP;
+
+ public static String RESID_CONNECTION_DAEMON_PORT_LABEL;
+ public static String RESID_CONNECTION_DAEMON_PORT_TIP;
+
+ public static String RESID_CONNECTION_DEFAULTPORT_LABEL;
+ public static String RESID_CONNECTION_DEFAULTPORT_TIP;
+
+ public static String RESID_CONNECTION_DESCRIPTION_LABEL;
+ public static String RESID_CONNECTION_DESCRIPTION_TIP;
+
+ public static String RESID_CONNECTION_PROFILE_LABEL;
+ public static String RESID_CONNECTION_PROFILE_TIP;
+
+ public static String RESID_CONNECTION_PROFILE_READONLY_TIP;
+
+ // CHANGE SYSTEM CONNECTION DIALOG...
+ public static String RESID_CHGCONN_TITLE;
+
+ // SET DEFAULT USERID PER SYSTEM TYPE DIALOG...
+ public static String RESID_USERID_PER_SYSTEMTYPE_TITLE;
+ public static String RESID_USERID_PER_SYSTEMTYPE_SYSTEMTYPE_LABEL;
+ public static String RESID_USERID_PER_SYSTEMTYPE_SYSTEMTYPE_TOOLTIP;
+ public static String RESID_USERID_PER_SYSTEMTYPE_LABEL;
+ public static String RESID_USERID_PER_SYSTEMTYPE_TOOLTIP;
+
+
+
+ // NEW FILTER POOL WIZARD...
+ public static String RESID_NEWFILTERPOOL_TITLE;
+
+ public static String RESID_NEWFILTERPOOL_PAGE1_TITLE;
+
+ public static String RESID_NEWFILTERPOOL_PAGE1_DESCRIPTION;
+
+ // WIDGETS FOR THIS WIZARD...
+ public static String RESID_FILTERPOOLNAME_LABEL;
+ public static String RESID_FILTERPOOLNAME_TIP;
+
+ public static String RESID_FILTERPOOLMANAGERNAME_LABEL;
+ public static String RESID_FILTERPOOLMANAGERNAME_TIP;
+
+ // SELECT FILTER POOLS DIALOG...
+ public static String RESID_SELECTFILTERPOOLS_TITLE;
+
+ public static String RESID_SELECTFILTERPOOLS_PROMPT;
+
+ // WORK WITH FILTER POOLS DIALOG...
+ public static String RESID_WORKWITHFILTERPOOLS_TITLE;
+
+ public static String RESID_WORKWITHFILTERPOOLS_PROMPT;
+
+ // NEW SYSTEM FILTER WIZARD...
+ public static String RESID_NEWFILTER_TITLE;
+
+ public static String RESID_NEWFILTER_PAGE_TITLE;
+
+ // MAIN PAGE (page 1) OF NEW FILTER WIZARD...
+ public static String RESID_NEWFILTER_PAGE1_DESCRIPTION;
+
+ public static String RESID_NEWFILTER_POOLTIP;
+
+ // NAME PAGE (page 2) OF NEW FILTER WIZARD...
+ public static String RESID_NEWFILTER_PAGE2_DESCRIPTION;
+
+ public static String RESID_NEWFILTER_PAGE2_NAME_VERBAGE;
+
+ public static String RESID_NEWFILTER_PAGE2_POOL_VERBAGE;
+
+ public static String RESID_NEWFILTER_PAGE2_POOL_VERBAGE_TIP;
+
+ public static String RESID_NEWFILTER_PAGE2_PROFILE_VERBAGE;
+
+ public static String RESID_NEWFILTER_PAGE2_NAME_LABEL;
+ public static String RESID_NEWFILTER_PAGE2_NAME_TOOLTIP;
+
+ public static String RESID_NEWFILTER_PAGE2_PROFILE_LABEL;
+ public static String RESID_NEWFILTER_PAGE2_PROFILE_TOOLTIP;
+
+ public static String RESID_NEWFILTER_PAGE2_POOL_LABEL;
+ public static String RESID_NEWFILTER_PAGE2_POOL_TOOLTIP;
+
+ public static String RESID_NEWFILTER_PAGE2_UNIQUE_LABEL;
+ public static String RESID_NEWFILTER_PAGE2_UNIQUE_TOOLTIP;
+
+ // INFO PAGE (page 3) OF NEW FILTER WIZARD...
+ public static String RESID_NEWFILTER_PAGE3_DESCRIPTION;
+ public static String RESID_NEWFILTER_PAGE3_STRINGS_VERBAGE;
+ public static String RESID_NEWFILTER_PAGE3_POOLS_VERBAGE;
+
+ public static String RESID_FILTERALIAS_LABEL;
+ public static String RESID_FILTERALIAS_TIP;
+ public static String RESID_FILTERPARENTPOOL_LABEL;
+ public static String RESID_FILTERPARENTPOOL_TIP;
+ public static String RESID_FILTERSTRINGS_LABEL;
+ public static String RESID_FILTERSTRINGS_TIP;
+
+
+ // CHANGE SYSTEM FILTER DIALOG...
+ public static String RESID_CHGFILTER_TITLE;
+ public static String RESID_CHGFILTER_LIST_NEWITEM;
+ public static String RESID_CHGFILTER_NAME_LABEL;
+ public static String RESID_CHGFILTER_NAME_TOOLTIP;
+ public static String RESID_CHGFILTER_POOL_LABEL;
+ public static String RESID_CHGFILTER_POOL_TOOLTIP;
+ public static String RESID_CHGFILTER_LIST_LABEL;
+ public static String RESID_CHGFILTER_LIST_TOOLTIP;
+ public static String RESID_CHGFILTER_FILTERSTRING_LABEL;
+ public static String RESID_CHGFILTER_FILTERSTRING_TOOLTIP;
+ public static String RESID_CHGFILTER_NEWFILTERSTRING_LABEL;
+ public static String RESID_CHGFILTER_NEWFILTERSTRING_TOOLTIP;
+ public static String RESID_CHGFILTER_BUTTON_TEST_LABEL;
+ public static String RESID_CHGFILTER_BUTTON_TEST_TOOLTIP;
+ public static String RESID_CHGFILTER_BUTTON_APPLY_LABEL;
+ public static String RESID_CHGFILTER_BUTTON_APPLY_TOOLTIP;
+ public static String RESID_CHGFILTER_BUTTON_REVERT_LABEL;
+ public static String RESID_CHGFILTER_BUTTON_REVERT_TOOLTIP;
+ public static String RESID_CHGFILTER_BUTTON_CREATE_LABEL;
+ public static String RESID_CHGFILTER_BUTTON_CREATE_TOOLTIP;
+
+
+ // CREATE UNNAMED FILTER DIALOG...
+ public static String RESID_CRTFILTER_TITLE;
+
+ // RENAME SYSTEM FILTER DIALOG...
+ public static String RESID_RENAME_FILTER_TITLE;
+
+ public static String RESID_RENAME_FILTER_PROMPT;
+
+ // COPY SYSTEM FILTER DIALOG...
+ public static String RESID_COPY_FILTER_TITLE;
+
+ public static String RESID_COPY_FILTER_PROMPT;
+
+ // NEW SYSTEM FILTER STRING WIZARD...
+ public static String RESID_NEWFILTERSTRING_TITLE;
+ public static String RESID_NEWFILTERSTRING_ADD_TITLE;
+ public static String RESID_NEWFILTERSTRING_PAGE1_TITLE;
+ public static String RESID_NEWFILTERSTRING_PAGE1_DESCRIPTION;
+
+ public static String RESID_NEWFILTERSTRING_PREFIX_LABEL;
+ public static String RESID_NEWFILTERSTRING_PREFIX_TOOLTIP;
+ public static String RESID_NEWFILTERSTRING_PREFIX_PROMPT;
+
+ public static String RESID_FILTERSTRING_STRING_LABEL;
+ public static String RESID_FILTERSTRING_STRING_TIP;
+
+ // CHANGE FILTER STRING ACTION AND DIALOG...
+ public static String RESID_CHGFILTERSTRING_PREFIX_LABEL;
+ public static String RESID_CHGFILTERSTRING_PREFIX_TOOLTIP;
+ public static String RESID_CHGFILTERSTRING_TITLE;
+ public static String RESID_CHGFILTERSTRING_PREFIX_PROMPT;
+
+ // TEST SYSTEM FILTER STRING DIALOG...
+ public static String RESID_TESTFILTERSTRING_TITLE;
+
+ public static String RESID_TESTFILTERSTRING_PROMPT_LABEL;
+ public static String RESID_TESTFILTERSTRING_PROMPT_TOOLTIP;
+
+ public static String RESID_TESTFILTERSTRING_TREE_TIP;
+
+
+ // WORK WITH HISTORY DIALOG...
+ public static String RESID_WORKWITHHISTORY_TITLE;
+ public static String RESID_WORKWITHHISTORY_VERBAGE;
+ public static String RESID_WORKWITHHISTORY_PROMPT;
+ public static String RESID_WORKWITHHISTORY_BUTTON_LABEL;
+ public static String RESID_WORKWITHHISTORY_BUTTON_TIP;
+
+ // PROMPT FOR PASSWORD DIALOG...
+ public static String RESID_PASSWORD_TITLE;
+
+ public static String RESID_PASSWORD_LABEL;
+ public static String RESID_PASSWORD_TIP;
+
+ public static String RESID_PASSWORD_USERID_LABEL;
+ public static String RESID_PASSWORD_USERID_TIP;
+
+ public static String RESID_PASSWORD_USERID_ISPERMANENT_LABEL;
+ public static String RESID_PASSWORD_USERID_ISPERMANENT_TIP;
+
+ public static String RESID_PASSWORD_SAVE_LABEL;
+ public static String RESID_PASSWORD_SAVE_TOOLTIP;
+
+
+ // TABLE VIEW DIALOGS
+ public static String RESID_TABLE_POSITIONTO_LABEL;
+ public static String RESID_TABLE_POSITIONTO_ENTRY_TOOLTIP;
+
+ public static String RESID_TABLE_SUBSET_LABEL;
+ public static String RESID_TABLE_SUBSET_ENTRY_TOOLTIP;
+
+ public static String RESID_TABLE_PRINTLIST_TITLE;
+
+ // TABLE view column selection
+ public static String RESID_TABLE_SELECT_COLUMNS_LABEL;
+ public static String RESID_TABLE_SELECT_COLUMNS_TOOLTIP;
+
+ public static String RESID_TABLE_SELECT_COLUMNS_ADD_LABEL;
+ public static String RESID_TABLE_SELECT_COLUMNS_ADD_TOOLTIP;
+
+ public static String RESID_TABLE_SELECT_COLUMNS_REMOVE_LABEL;
+ public static String RESID_TABLE_SELECT_COLUMNS_REMOVE_TOOLTIP;
+
+ public static String RESID_TABLE_SELECT_COLUMNS_UP_LABEL;
+ public static String RESID_TABLE_SELECT_COLUMNS_UP_TOOLTIP;
+
+ public static String RESID_TABLE_SELECT_COLUMNS_DOWN_LABEL;
+ public static String RESID_TABLE_SELECT_COLUMNS_DOWN_TOOLTIP;
+
+ public static String RESID_TABLE_SELECT_COLUMNS_AVAILABLE_LABEL;
+
+ public static String RESID_TABLE_SELECT_COLUMNS_DISPLAYED_LABEL;
+ public static String RESID_TABLE_SELECT_COLUMNS_DESCRIPTION_LABEL;
+
+ // MONITOR VIEW DIALGOS
+ public static String RESID_MONITOR_POLL_INTERVAL_LABEL;
+ public static String RESID_MONITOR_POLL_INTERVAL_TOOLTIP;
+ public static String RESID_MONITOR_POLL_LABEL;
+ public static String RESID_MONITOR_POLL_TOOLTIP;
+ public static String RESID_MONITOR_POLL_CONFIGURE_POLLING_LABEL;
+ public static String RESID_MONITOR_POLL_CONFIGURE_POLLING_EXPAND_TOOLTIP;
+ public static String RESID_MONITOR_POLL_CONFIGURE_POLLING_COLLAPSE_TOOLTIP;
+
+ // TEAM VIEW
+ public static String RESID_TEAMVIEW_SUBSYSFACTORY_VALUE;
+ public static String RESID_TEAMVIEW_USERACTION_VALUE;
+ public static String RESID_TEAMVIEW_CATEGORY_VALUE;
+
+ public static String RESID_TEAMVIEW_CATEGORY_CONNECTIONS_LABEL;
+ public static String RESID_TEAMVIEW_CATEGORY_CONNECTIONS_TOOLTIP;
+
+ public static String RESID_TEAMVIEW_CATEGORY_FILTERPOOLS_LABEL;
+ public static String RESID_TEAMVIEW_CATEGORY_FILTERPOOLS_TOOLTIP;
+
+ public static String RESID_TEAMVIEW_CATEGORY_USERACTIONS_LABEL;
+ public static String RESID_TEAMVIEW_CATEGORY_USERACTIONS_TOOLTIP;
+
+ public static String RESID_TEAMVIEW_CATEGORY_COMPILECMDS_LABEL;
+ public static String RESID_TEAMVIEW_CATEGORY_COMPILECMDS_TOOLTIP;
+
+ public static String RESID_TEAMVIEW_CATEGORY_TARGETS_LABEL;
+ public static String RESID_TEAMVIEW_CATEGORY_TARGETS_TOOLTIP;
+
+ // ------------------------------
+ // REUSABLE WIDGET STRINGS...
+ // ------------------------------
+ // SELECT MULTIPLE REMOTE FILES WIDGET...
+ public static String RESID_SELECTFILES_SELECTTYPES_BUTTON_ROOT_LABEL;
+ public static String RESID_SELECTFILES_SELECTTYPES_BUTTON_ROOT_TOOLTIP;
+
+ public static String RESID_SELECTFILES_SELECTALL_BUTTON_ROOT_LABEL;
+ public static String RESID_SELECTFILES_SELECTALL_BUTTON_ROOT_TOOLTIP;
+
+ public static String RESID_SELECTFILES_DESELECTALL_BUTTON_ROOT_LABEL;
+ public static String RESID_SELECTFILES_DESELECTALL_BUTTON_ROOT_TOOLTIP;
+
+
+ // ------------------------------
+ // PROPERTY PAGE STRINGS...
+ // ------------------------------
+ // SYSTEMREGISTRY PROPERTIES PAGE...
+ public static String RESID_SYSTEMREGISTRY_TEXT;
+
+ public static String RESID_SYSTEMREGISTRY_CONNECTIONS;
+
+ // SUBSYSTEM PROPERTIES PAGE...
+ public static String RESID_SUBSYSTEM_TITLE;
+ public static String RESID_SUBSYSTEM_TYPE_LABEL;
+ public static String RESID_SUBSYSTEM_TYPE_VALUE;
+ public static String RESID_SUBSYSTEM_VENDOR_LABEL;
+ public static String RESID_SUBSYSTEM_NAME_LABEL;
+ public static String RESID_SUBSYSTEM_CONNECTION_LABEL;
+ public static String RESID_SUBSYSTEM_PROFILE_LABEL;
+
+ public static String RESID_SUBSYSTEM_PORT_LABEL;
+ public static String RESID_SUBSYSTEM_PORT_TIP;
+ public static String RESID_SUBSYSTEM_PORT_INHERITBUTTON_TIP;
+ public static String RESID_SUBSYSTEM_PORT_INHERITBUTTON_INHERIT_TIP;
+ public static String RESID_SUBSYSTEM_PORT_INHERITBUTTON_LOCAL_TIP;
+
+ public static String RESID_SUBSYSTEM_USERID_LABEL;
+ public static String RESID_SUBSYSTEM_USERID_TIP;
+
+ public static String RESID_SUBSYSTEM_USERID_INHERITBUTTON_TIP;
+ public static String RESID_SUBSYSTEM_USERID_INHERITBUTTON_INHERIT_TIP;
+ public static String RESID_SUBSYSTEM_USERID_INHERITBUTTON_LOCAL_TIP;
+
+ public static String RESID_SUBSYSTEM_SSL_LABEL;
+ public static String RESID_SUBSYSTEM_SSL_TIP;
+
+ public static String RESID_SUBSYSTEM_ENVVAR_TITLE;
+ public static String RESID_SUBSYSTEM_ENVVAR_DESCRIPTION;
+ public static String RESID_SUBSYSTEM_ENVVAR_TOOLTIP;
+
+ public static String RESID_SUBSYSTEM_ENVVAR_NAME_TITLE;
+ public static String RESID_SUBSYSTEM_ENVVAR_NAME_LABEL;
+ public static String RESID_SUBSYSTEM_ENVVAR_NAME_TOOLTIP;
+
+ public static String RESID_SUBSYSTEM_ENVVAR_VALUE_TITLE;
+ public static String RESID_SUBSYSTEM_ENVVAR_VALUE_LABEL;
+ public static String RESID_SUBSYSTEM_ENVVAR_VALUE_TOOLTIP;
+
+ public static String RESID_SUBSYSTEM_ENVVAR_ADD_TOOLTIP;
+ public static String RESID_SUBSYSTEM_ENVVAR_REMOVE_TOOLTIP;
+ public static String RESID_SUBSYSTEM_ENVVAR_CHANGE_TOOLTIP;
+
+ public static String RESID_SUBSYSTEM_ENVVAR_MOVEUP_LABEL;
+ public static String RESID_SUBSYSTEM_ENVVAR_MOVEUP_TOOLTIP;
+ public static String RESID_SUBSYSTEM_ENVVAR_MOVEDOWN_LABEL;
+ public static String RESID_SUBSYSTEM_ENVVAR_MOVEDOWN_TOOLTIP;
+
+ public static String RESID_SUBSYSTEM_ENVVAR_ADD_TITLE;
+ public static String RESID_SUBSYSTEM_ENVVAR_CHANGE_TITLE;
+
+ // COMMON PROPERTIES PAGE UI...
+ public static String RESID_PP_PROPERTIES_TYPE_LABEL;
+ public static String RESID_PP_PROPERTIES_TYPE_TOOLTIP;
+
+ // FILTER POOL PROPERTIES PAGE...
+ public static String RESID_FILTERPOOL_TITLE;
+ public static String RESID_FILTERPOOL_TYPE_VALUE;
+
+ public static String RESID_FILTERPOOL_NAME_LABEL;
+ public static String RESID_FILTERPOOL_NAME_TOOLTIP;
+
+ public static String RESID_FILTERPOOL_PROFILE_LABEL;
+ public static String RESID_FILTERPOOL_PROFILE_TOOLTIP;
+
+ public static String RESID_FILTERPOOL_REFERENCECOUNT_LABEL;
+ public static String RESID_FILTERPOOL_REFERENCECOUNT_TOOLTIP;
+
+ public static String RESID_FILTERPOOL_RELATEDCONNECTION_LABEL;
+ public static String RESID_FILTERPOOL_RELATEDCONNECTION_TOOLTIP;
+
+ // FILTER POOL REFERENCE PROPERTIES PAGE...
+ public static String RESID_FILTERPOOLREF_TITLE;
+ public static String RESID_FILTERPOOLREF_TYPE_VALUE;
+
+ public static String RESID_FILTERPOOLREF_NAME_LABEL;
+ public static String RESID_FILTERPOOLREF_NAME_TOOLTIP;
+
+ public static String RESID_FILTERPOOLREF_SUBSYSTEM_LABEL;
+ public static String RESID_FILTERPOOLREF_SUBSYSTEM_TOOLTIP;
+
+ public static String RESID_FILTERPOOLREF_CONNECTION_LABEL;
+ public static String RESID_FILTERPOOLREF_CONNECTION_TOOLTIP;
+
+ public static String RESID_FILTERPOOLREF_PROFILE_LABEL;
+ public static String RESID_FILTERPOOLREF_PROFILE_TOOLTIP;
+
+ // FILTER PROPERTIES PAGE...
+ public static String RESID_PP_FILTER_TITLE_LABEL;
+ public static String RESID_PP_FILTER_TYPE_VALUE;
+
+ public static String RESID_PP_FILTER_TYPE_PROMPTABLE_VALUE;
+ public static String RESID_PP_FILTER_TYPE_PROMPTABLE_TOOLTIP;
+
+ public static String RESID_PP_FILTER_NAME_LABEL;
+ public static String RESID_PP_FILTER_NAME_TOOLTIP;
+
+ public static String RESID_PP_FILTER_STRINGCOUNT_LABEL;
+ public static String RESID_PP_FILTER_STRINGCOUNT_TOOLTIP;
+
+ public static String RESID_PP_FILTER_FILTERPOOL_LABEL;
+ public static String RESID_PP_FILTER_FILTERPOOL_TOOLTIP;
+
+ public static String RESID_PP_FILTER_PROFILE_LABEL;
+ public static String RESID_PP_FILTER_PROFILE_TOOLTIP;
+
+ public static String RESID_PP_FILTER_ISCONNECTIONPRIVATE_LABEL;
+ public static String RESID_PP_FILTER_ISCONNECTIONPRIVATE_TOOLTIP;
+
+ // FILTER STRING PROPERTIES PAGE...
+ public static String RESID_PP_FILTERSTRING_TITLE;
+ public static String RESID_PP_FILTERSTRING_TYPE_VALUE;
+
+ public static String RESID_PP_FILTERSTRING_STRING_LABEL;
+ public static String RESID_PP_FILTERSTRING_STRING_TOOLTIP;
+
+ public static String RESID_PP_FILTERSTRING_FILTER_LABEL;
+ public static String RESID_PP_FILTERSTRING_FILTER_TOOLTIP;
+
+ public static String RESID_PP_FILTERSTRING_FILTERPOOL_LABEL;
+ public static String RESID_PP_FILTERSTRING_FILTERPOOL_TOOLTIP;
+
+
+ public static String RESID_PP_FILTERSTRING_PROFILE_LABEL;
+ public static String RESID_PP_FILTERSTRING_PROFILE_TOOLTIP;
+
+ // SUBSYSTEM FACTORY PROPERTIES PAGE...
+ public static String RESID_PP_SUBSYSFACTORY_TITLE;
+ public static String RESID_PP_SUBSYSFACTORY_ID_LABEL;
+ public static String RESID_PP_SUBSYSFACTORY_ID_TOOLTIP;
+
+ public static String RESID_PP_SUBSYSFACTORY_VENDOR_LABEL;
+ public static String RESID_PP_SUBSYSFACTORY_VENDOR_TOOLTIP;
+
+ public static String RESID_PP_SUBSYSFACTORY_TYPES_LABEL;
+ public static String RESID_PP_SUBSYSFACTORY_TYPES_TOOLTIP;
+
+ public static String RESID_PP_SUBSYSFACTORY_VERBAGE;
+
+ // REMOTE SERVER LAUNCH PROPERTIES PAGE...
+ public static String RESID_PROP_SERVERLAUNCHER_MEANS;
+ public static String RESID_PROP_SERVERLAUNCHER_MEANS_LABEL;
+ public static String RESID_PROP_SERVERLAUNCHER_RADIO_DAEMON;
+ public static String RESID_PROP_SERVERLAUNCHER_RADIO_REXEC;
+ public static String RESID_PROP_SERVERLAUNCHER_RADIO_NONE;
+ public static String RESID_PROP_SERVERLAUNCHER_RADIO_DAEMON_TOOLTIP;
+ public static String RESID_PROP_SERVERLAUNCHER_RADIO_REXEC_TOOLTIP;
+ public static String RESID_PROP_SERVERLAUNCHER_RADIO_NONE_TOOLTIP;
+ public static String RESID_PROP_SERVERLAUNCHER_PATH;
+ public static String RESID_PROP_SERVERLAUNCHER_PATH_TOOLTIP;
+ public static String RESID_PROP_SERVERLAUNCHER_INVOCATION;
+ public static String RESID_PROP_SERVERLAUNCHER_INVOCATION_TOOLTIP;
+
+
+
+
+ // ---------------------------
+ // RE-USABLE WIDGET STRINGS...
+ // ---------------------------
+
+ // WIDGETS IN SYSTEMCONNECTIONCOMBO.JAVA
+ public static String WIDGET_CONNECTION_LABEL;
+ public static String WIDGET_CONNECTION_TOOLTIP;
+ public static String WIDGET_CONNECTION_NAME;
+
+ public static String WIDGET_BUTTON_NEWCONNECTION_LABEL;
+ public static String WIDGET_BUTTON_NEWCONNECTION_TOOLTIP;
+
+ // -------------------------
+ // PREFERENCES...
+ // -------------------------
+ public static String RESID_PREF_ROOT_PAGE;
+ public static String RESID_PREF_ROOT_TITLE;
+
+ public static String RESID_PREF_SYSTYPE_COLHDG_NAME;
+ public static String RESID_PREF_SYSTYPE_COLHDG_ENABLED;
+ public static String RESID_PREF_SYSTYPE_COLHDG_DESC;
+ public static String RESID_PREF_SYSTYPE_COLHDG_USERID;
+
+ //
+ // Signon Information Preferences Page
+ //
+ public static String RESID_PREF_SIGNON_DESCRIPTION;
+
+ public static String RESID_PREF_SIGNON_HOSTNAME_TITLE;
+ public static String RESID_PREF_SIGNON_HOSTNAME_LABEL;
+ public static String RESID_PREF_SIGNON_HOSTNAME_TOOLTIP;
+
+ public static String RESID_PREF_SIGNON_SYSTYPE_TITLE;
+ public static String RESID_PREF_SIGNON_SYSTYPE_LABEL;
+ public static String RESID_PREF_SIGNON_SYSTYPE_TOOLTIP;
+
+ public static String RESID_PREF_SIGNON_USERID_TITLE;
+ public static String RESID_PREF_SIGNON_USERID_LABEL;
+ public static String RESID_PREF_SIGNON_USERID_TOOLTIP;
+
+ public static String RESID_PREF_SIGNON_PASSWORD_LABEL;
+ public static String RESID_PREF_SIGNON_PASSWORD_TOOLTIP;
+
+ public static String RESID_PREF_SIGNON_PASSWORD_VERIFY_LABEL;
+ public static String RESID_PREF_SIGNON_PASSWORD_VERIFY_TOOLTIP;
+
+ public static String RESID_PREF_SIGNON_ADD_LABEL;
+ public static String RESID_PREF_SIGNON_ADD_TOOLTIP;
+
+ public static String RESID_PREF_SIGNON_REMOVE_LABEL;
+ public static String RESID_PREF_SIGNON_REMOVE_TOOLTIP;
+
+ public static String RESID_PREF_SIGNON_CHANGE_LABEL;
+ public static String RESID_PREF_SIGNON_CHANGE_TOOLTIP;
+
+ public static String RESID_PREF_SIGNON_ADD_DIALOG_TITLE;
+
+ public static String RESID_PREF_SIGNON_CHANGE_DIALOG_TITLE;
+
+ // Unable to load message
+ public static String RESID_MSG_UNABLETOLOAD;
+
+ // Default filter pool name
+ public static String RESID_DEFAULT_FILTERPOOL;
+
+ public static String RESID_PERCONNECTION_FILTERPOOL;
+
+ // RSE Communication Perferences
+ public static String RESID_PREF_COMMUNICATIONS_TITLE;
+ public static String RESID_PREF_DAEMON_PORT_LABEL;
+ public static String RESID_PREF_DAEMON_PORT_TOOLTIP;
+ public static String RESID_PREF_DAEMON_AUTOSTART_LABEL;
+ public static String RESID_PREF_DAEMON_AUTOSTART_TOOLTIP;
+
+ public static String RESID_PREF_IP_ADDRESS_LABEL;
+ public static String RESID_PREF_IP_AUTO_LABEL;
+ public static String RESID_PREF_IP_AUTO_TOOLTIP;
+ public static String RESID_PREF_IP_MANUAL_LABEL;
+ public static String RESID_PREF_IP_MANUAL_TOOLTIP;
+ public static String RESID_PREF_IP_MANUAL_ENTER_LABEL;
+ public static String RESID_PREF_IP_MANUAL_ENTER_TOOLTIP;
+
+ // Offline constants (yantzi:3.0)
+ public static String RESID_OFFLINE_LABEL;
+ public static String RESID_OFFLINE_WORKOFFLINE_LABEL;
+ public static String RESID_OFFLINE_WORKOFFLINE_TOOLTIP;
+ public static String RESID_OFFLINE_WORKOFFLINE_DESCRIPTION;
+
+ // -------------------------------------------
+ // remote search view constants
+ // -------------------------------------------
+
+ // Search view constants
+ public static String RESID_SEARCH_VIEW_DEFAULT_TITLE;
+
+ // Remove selected matches action
+ public static String RESID_SEARCH_REMOVE_SELECTED_MATCHES_LABEL;
+ public static String RESID_SEARCH_REMOVE_SELECTED_MATCHES_TOOLTIP;
+
+ // Remove all matches action
+ public static String RESID_SEARCH_REMOVE_ALL_MATCHES_LABEL;
+ public static String RESID_SEARCH_REMOVE_ALL_MATCHES_TOOLTIP;
+
+ // Clear history action
+ public static String RESID_SEARCH_CLEAR_HISTORY_LABEL;
+ public static String RESID_SEARCH_CLEAR_HISTORY_TOOLTIP;
+
+ /** ******************************************* */
+ /* Generated Vars */
+ /** ******************************************* */
+ public static String RESID_PREF_SYSTEMTYPE_PREFIX_LABEL;
+ public static String RESID_PREF_SYSTEMTYPE_PREFIX_TOOLTIP;
+
+ public static String RESID_PREF_USERID_PREFIX_LABEL;
+ public static String RESID_PREF_USERID_PREFIX_TOOLTIP;
+
+ public static String RESID_PREF_USERID_PERTYPE_PREFIX_LABEL;
+ public static String RESID_PREF_USERID_PERTYPE_PREFIX_TOOLTIP;
+
+ public static String RESID_PREF_SHOWFILTERPOOLS_PREFIX_LABEL;
+ public static String RESID_PREF_SHOWFILTERPOOLS_PREFIX_TOOLTIP;
+
+ public static String RESID_PREF_SHOWNEWCONNECTIONPROMPT_PREFIX_LABEL;
+ public static String RESID_PREF_SHOWNEWCONNECTIONPROMPT_PREFIX_TOOLTIP;
+
+ public static String RESID_PREF_QUALIFYCONNECTIONNAMES_PREFIX_LABEL;
+ public static String RESID_PREF_QUALIFYCONNECTIONNAMES_PREFIX_TOOLTIP;
+
+ public static String RESID_PREF_REMEMBERSTATE_PREFIX_LABEL;
+ public static String RESID_PREF_REMEMBERSTATE_PREFIX_TOOLTIP;
+
+ public static String RESID_PREF_USEDEFERREDQUERIES_PREFIX_LABEL;
+ public static String RESID_PREF_USEDEFERREDQUERIES_PREFIX_TOOLTIP;
+
+ public static String RESID_PREF_RESTOREFROMCACHE_PREFIX_LABEL;
+ public static String RESID_PREF_RESTOREFROMCACHE_PREFIX_TOOLTIP;
+
+
+
+ //
+ // Actions
+ //
+ // Browse with menu item
+ public static String ACTION_CASCADING_BROWSEWITH_LABEL;
+ public static String ACTION_CASCADING_BROWSEWITH_TOOLTIP;
+
+ // Compare with menu item
+ public static String ACTION_CASCADING_COMPAREWITH_LABEL;
+ public static String ACTION_CASCADING_COMPAREWITH_TOOLTIP;
+
+
+ // Replace with menu item
+ public static String ACTION_CASCADING_REPLACEWITH_LABEL;
+ public static String ACTION_CASCADING_REPLACEWITH_TOOLTIP;
+
+ public static String ACTION_RENAME_LABEL;
+ public static String ACTION_RENAME_TOOLTIP;
+
+ public static String ACTION_IMPORT_TO_PROJECT_LABEL;
+ public static String ACTION_IMPORT_TO_PROJECT_TOOLTIP;
+
+ public static String ACTION_EXPORT_FROM_PROJECT_LABEL;
+ public static String ACTION_EXPORT_FROM_PROJECT_TOOLTIP;
+
+ public static String ACTION_NEWFILE_LABEL;
+ public static String ACTION_NEWFILE_TOOLTIP;
+
+ public static String ACTION_DAEMON_START_LABEL;
+ public static String ACTION_DAEMON_START_TOOLTIP;
+
+ public static String ACTION_DAEMON_STOP_LABEL;
+ public static String ACTION_DAEMON_STOP_TOOLTIP;
+
+ public static String ACTION_CASCADING_NEW_LABEL;
+ public static String ACTION_CASCADING_NEW_TOOLTIP;
+
+ public static String ACTION_CASCADING_GOTO_LABEL;
+ public static String ACTION_CASCADING_GOTO_TOOLTIP;
+
+ public static String ACTION_CASCADING_GOINTO_LABEL;
+ public static String ACTION_CASCADING_GOINTO_TOOLTIP;
+
+ public static String ACTION_CASCADING_OPEN_LABEL;
+ public static String ACTION_CASCADING_OPEN_TOOLTIP;
+
+ public static String ACTION_CASCADING_OPENWITH_LABEL;
+ public static String ACTION_CASCADING_OPENWITH_TOOLTIP;
+
+ public static String ACTION_CASCADING_WORKWITH_LABEL;
+ public static String ACTION_CASCADING_WORKWITH_TOOLTIP;
+
+ public static String ACTION_CASCADING_REMOTESERVERS_LABEL;
+ public static String ACTION_CASCADING_REMOTESERVERS_TOOLTIP;
+
+ public static String ACTION_REMOTESERVER_START_LABEL;
+ public static String ACTION_REMOTESERVER_START_TOOLTIP;
+
+ public static String ACTION_REMOTESERVER_STOP_LABEL;
+ public static String ACTION_REMOTESERVER_STOP_TOOLTIP;
+
+ public static String ACTION_CASCADING_EXPAND_LABEL;
+ public static String ACTION_CASCADING_EXPAND_TOOLTIP;
+
+ public static String ACTION_CASCADING_EXPAND_TO_LABEL;
+ public static String ACTION_CASCADING_EXPAND_TO_TOOLTIP;
+
+ public static String ACTION_CASCADING_EXPAND_ALL_LABEL;
+ public static String ACTION_CASCADING_EXPAND_ALL_TOOLTIP;
+
+ public static String ACTION_CASCADING_EXPAND_BY_LABEL;
+ public static String ACTION_CASCADING_EXPAND_BY_TOOLTIP;
+
+ public static String ACTION_CASCADING_EXPAND_WORKWITH_LABEL;
+ public static String ACTION_CASCADING_EXPAND_WORKWITH_TOOLTIP;
+
+ public static String ACTION_CASCADING_VIEW_LABEL;
+ public static String ACTION_CASCADING_VIEW_TOOLTIP;
+
+ public static String ACTION_CASCADING_USERID_LABEL;
+ public static String ACTION_CASCADING_USERID_TOOLTIP;
+
+ public static String ACTION_CASCADING_PREFERENCES_LABEL;
+ public static String ACTION_CASCADING_PREFERENCES_TOOLTIP;
+
+ public static String ACTION_CASCADING_TEAM_LABEL;
+ public static String ACTION_CASCADING_TEAM_TOOLTIP;
+
+ public static String ACTION_TEAM_SYNC_LABEL;
+ public static String ACTION_TEAM_SYNC_TOOLTIP;
+
+ public static String ACTION_CASCADING_PULLDOWN_LABEL;
+ public static String ACTION_CASCADING_PULLDOWN_TOOLTIP;
+
+ public static String ACTION_CASCADING_FILTERPOOL_NEWREFERENCE_LABEL;
+ public static String ACTION_CASCADING_FILTERPOOL_NEWREFERENCE_TOOLTIP;
+
+ public static String ACTION_TEAM_RELOAD_LABEL;
+ public static String ACTION_TEAM_RELOAD_TOOLTIP;
+
+ public static String ACTION_PROFILE_ACTIVATE_LABEL;
+ public static String ACTION_PROFILE_ACTIVATE_TOOLTIP;
+
+ public static String ACTION_PROFILE_MAKEACTIVE_LABEL;
+ public static String ACTION_PROFILE_MAKEACTIVE_TOOLTIP;
+
+ public static String ACTION_PROFILE_MAKEINACTIVE_LABEL;
+ public static String ACTION_PROFILE_MAKEINACTIVE_TOOLTIP;
+
+ public static String ACTION_PROFILE_COPY_LABEL;
+ public static String ACTION_PROFILE_COPY_TOOLTIP;
+
+ public static String ACTION_NEWPROFILE_LABEL;
+ public static String ACTION_NEWPROFILE_TOOLTIP;
+
+ public static String ACTION_NEW_PROFILE_LABEL;
+ public static String ACTION_NEW_PROFILE_TOOLTIP;
+
+ public static String ACTION_QUALIFY_CONNECTION_NAMES_LABEL;
+ public static String ACTION_QUALIFY_CONNECTION_NAMES_TOOLTIP;
+
+ public static String ACTION_RESTORE_STATE_PREFERENCE_LABEL;
+ public static String ACTION_RESTORE_STATE_PREFERENCE_TOOLTIP;
+
+ public static String ACTION_PREFERENCE_SHOW_FILTERPOOLS_LABEL;
+ public static String ACTION_PREFERENCE_SHOW_FILTERPOOLS_TOOLTIP;
+
+ public static String ACTION_NEWCONN_LABEL;
+ public static String ACTION_NEWCONN_TOOLTIP;
+
+ public static String ACTION_ANOTHERCONN_LABEL;
+ public static String ACTION_ANOTHERCONN_TOOLTIP;
+
+ public static String ACTION_UPDATECONN_LABEL;
+ public static String ACTION_UPDATECONN_TOOLTIP;
+
+ public static String ACTION_NEWFILTERSTRING_LABEL;
+ public static String ACTION_NEWFILTERSTRING_TOOLTIP;
+
+ public static String ACTION_ADDFILTERSTRING_LABEL;
+ public static String ACTION_ADDFILTERSTRING_TOOLTIP;
+
+ public static String ACTION_UPDATEFILTERSTRING_LABEL;
+ public static String ACTION_UPDATEFILTERSTRING_TOOLTIP;
+
+ public static String ACTION_TESTFILTERSTRING_LABEL;
+ public static String ACTION_TESTFILTERSTRING_TOOLTIP;
+
+ public static String ACTION_NEWFILTER_LABEL;
+ public static String ACTION_NEWFILTER_TOOLTIP;
+
+ public static String ACTION_NEWNESTEDFILTER_LABEL;
+ public static String ACTION_NEWNESTEDFILTER_TOOLTIP;
+
+ public static String ACTION_UPDATEFILTER_LABEL;
+ public static String ACTION_UPDATEFILTER_TOOLTIP;
+
+ public static String ACTION_NEWFILTERPOOL_LABEL;
+ public static String ACTION_NEWFILTERPOOL_TOOLTIP;
+
+ public static String ACTION_ADDFILTERPOOLREF_LABEL;
+ public static String ACTION_ADDFILTERPOOLREF_TOOLTIP;
+
+ public static String ACTION_RMVFILTERPOOLREF_LABEL;
+ public static String ACTION_RMVFILTERPOOLREF_TOOLTIP;
+
+ public static String ACTION_SELECTFILTERPOOLS_LABEL;
+ public static String ACTION_SELECTFILTERPOOLS_TOOLTIP;
+
+ public static String ACTION_WORKWITH_FILTERPOOLS_LABEL;
+ public static String ACTION_WORKWITH_FILTERPOOLS_TOOLTIP;
+
+ public static String ACTION_WORKWITH_WWFILTERPOOLS_LABEL;
+ public static String ACTION_WORKWITH_WWFILTERPOOLS_TOOLTIP;
+
+ public static String ACTION_WORKWITH_PROFILES_LABEL;
+ public static String ACTION_WORKWITH_PROFILES_TOOLTIP;
+
+ public static String ACTION_RUN_LABEL;
+ public static String ACTION_RUN_TOOLTIP;
+
+ public static String ACTION_SIMPLERENAME_LABEL;
+ public static String ACTION_SIMPLERENAME_TOOLTIP;
+
+ public static String ACTION_REFRESH_ALL_LABEL;
+ public static String ACTION_REFRESH_ALL_TOOLTIP;
+
+ public static String ACTION_REFRESH_LABEL;
+ public static String ACTION_REFRESH_TOOLTIP;
+
+
+ public static String ACTION_DELETE_LABEL;
+ public static String ACTION_DELETE_TOOLTIP;
+
+ public static String ACTION_CLEAR_LABEL;
+ public static String ACTION_CLEAR_TOOLTIP;
+
+ public static String ACTION_CLEAR_ALL_LABEL;
+ public static String ACTION_CLEAR_ALL_TOOLTIP;
+
+ public static String ACTION_CLEAR_SELECTED_LABEL;
+ public static String ACTION_CLEAR_SELECTED_TOOLTIP;
+
+ public static String ACTION_MOVEUP_LABEL;
+ public static String ACTION_MOVEUP_TOOLTIP;
+
+ public static String ACTION_MOVEDOWN_LABEL;
+ public static String ACTION_MOVEDOWN_TOOLTIP;
+
+ public static String ACTION_CONNECT_LABEL;
+ public static String ACTION_CONNECT_TOOLTIP;
+
+ public static String ACTION_CLEARPASSWORD_LABEL;
+ public static String ACTION_CLEARPASSWORD_TOOLTIP;
+
+ public static String ACTION_DISCONNECT_LABEL;
+ public static String ACTION_DISCONNECT_TOOLTIP;
+
+ public static String ACTION_DISCONNECTALLSUBSYSTEMS_LABEL;
+ public static String ACTION_DISCONNECTALLSUBSYSTEMS_TOOLTIP;
+
+ public static String ACTION_CONNECT_ALL_LABEL;
+ public static String ACTION_CONNECT_ALL_TOOLTIP;
+
+ public static String ACTION_CLEARPASSWORD_ALL_LABEL;
+ public static String ACTION_CLEARPASSWORD_ALL_TOOLTIP;
+
+ public static String ACTION_SET_LABEL;
+ public static String ACTION_SET_TOOLTIP;
+
+ public static String ACTION_HISTORY_DELETE_LABEL;
+ public static String ACTION_HISTORY_DELETE_TOOLTIP;
+
+ public static String ACTION_HISTORY_CLEAR_LABEL;
+ public static String ACTION_HISTORY_CLEAR_TOOLTIP;
+
+ public static String ACTION_HISTORY_MOVEUP_LABEL;
+ public static String ACTION_HISTORY_MOVEUP_TOOLTIP;
+
+ public static String ACTION_HISTORY_MOVEDOWN_LABEL;
+ public static String ACTION_HISTORY_MOVEDOWN_TOOLTIP;
+
+ public static String ACTION_HISTORY_MOVEFORWARD_LABEL;
+ public static String ACTION_HISTORY_MOVEFORWARD_TOOLTIP;
+
+ public static String ACTION_HISTORY_MOVEBACKWARD_LABEL;
+ public static String ACTION_HISTORY_MOVEBACKWARD_TOOLTIP;
+
+
+ public static String ACTION_CONTENT_ASSIST;
+ public static String ACTION_SHOW_TOOLTIP_INFORMATION;
+
+
+ public static String ACTION_COPY_LABEL;
+ public static String ACTION_COPY_TOOLTIP;
+
+ public static String ACTION_CUT_LABEL;
+ public static String ACTION_CUT_TOOLTIP;
+
+ public static String ACTION_UNDO_LABEL;
+ public static String ACTION_UNDO_TOOLTIP;
+
+ public static String ACTION_PASTE_LABEL;
+ public static String ACTION_PASTE_TOOLTIP;
+
+ public static String ACTION_COPY_CONNECTION_LABEL;
+ public static String ACTION_COPY_CONNECTION_TOOLTIP;
+
+ public static String ACTION_COPY_FILTERPOOL_LABEL;
+ public static String ACTION_COPY_FILTERPOOL_TOOLTIP;
+
+ public static String ACTION_COPY_FILTER_LABEL;
+ public static String ACTION_COPY_FILTER_TOOLTIP;
+
+ public static String ACTION_COPY_FILTERSTRING_LABEL;
+ public static String ACTION_COPY_FILTERSTRING_TOOLTIP;
+
+ public static String ACTION_MOVE_LABEL;
+ public static String ACTION_MOVE_TOOLTIP;
+
+ public static String ACTION_MOVE_CONNECTION_LABEL;
+ public static String ACTION_MOVE_CONNECTION_TOOLTIP;
+
+ public static String ACTION_MOVE_FILTERPOOL_LABEL;
+ public static String ACTION_MOVE_FILTERPOOL_TOOLTIP;
+
+ public static String ACTION_MOVE_FILTER_LABEL;
+ public static String ACTION_MOVE_FILTER_TOOLTIP;
+
+ public static String ACTION_MOVE_FILTERSTRING_LABEL;
+ public static String ACTION_MOVE_FILTERSTRING_TOOLTIP;
+
+ public static String ACTION_TEAM_BROWSEHISTORY_LABEL;
+ public static String ACTION_TEAM_BROWSEHISTORY_TOOLTIP;
+
+ public static String ACTION_TABLE_LABEL;
+ public static String ACTION_TABLE_TOOLTIP;
+
+ public static String ACTION_MONITOR_LABEL;
+ public static String ACTION_MONITOR_TOOLTIP;
+
+ public static String ACTION_ERROR_LIST_LABEL;
+ public static String ACTION_ERROR_LIST_TOOLTIP;
+
+ public static String ACTION_FIND_FILES_LABEL;
+ public static String ACTION_FIND_FILES_TOOLTIP;
+
+ public static String ACTION_SEARCH_LABEL;
+ public static String ACTION_SEARCH_TOOLTIP;
+
+ public static String ACTION_CANCEL_FIND_FILES_LABEL;
+ public static String ACTION_CANCEL_FIND_FILES_TOOLTIP;
+
+ public static String ACTION_CANCEL_SEARCH_LABEL;
+ public static String ACTION_CANCEL_SEARCH_TOOLTIP;
+
+ public static String ACTION_LOCK_LABEL;
+ public static String ACTION_LOCK_TOOLTIP;
+
+ public static String ACTION_UNLOCK_LABEL;
+ public static String ACTION_UNLOCK_TOOLTIP;
+
+
+ public static String ACTION_POSITIONTO_LABEL;
+ public static String ACTION_POSITIONTO_TOOLTIP;
+
+ public static String ACTION_SUBSET_LABEL;
+ public static String ACTION_SUBSET_TOOLTIP;
+
+ public static String ACTION_PRINTLIST_LABEL;
+ public static String ACTION_PRINTLIST_TOOLTIP;
+
+ public static String ACTION_SELECTCOLUMNS_LABEL;
+ public static String ACTION_SELECTCOLUMNS_TOOLTIP;
+
+ public static String ACTION_OPENEXPLORER_CASCADE_LABEL;
+ public static String ACTION_OPENEXPLORER_CASCADE_TOOLTIP;
+
+ public static String ACTION_OPENEXPLORER_SAMEPERSP_LABEL;
+ public static String ACTION_OPENEXPLORER_SAMEPERSP_TOOLTIP;
+
+ public static String ACTION_OPENEXPLORER_DIFFPERSP_LABEL;
+ public static String ACTION_OPENEXPLORER_DIFFPERSP_TOOLTIP;
+
+ public static String ACTION_OPENEXPLORER_DIFFPERSP2_LABEL;
+ public static String ACTION_OPENEXPLORER_DIFFPERSP2_TOOLTIP;
+
+ public static String ACTION_REMOTE_PROPERTIES_LABEL;
+ public static String ACTION_REMOTE_PROPERTIES_TOOLTIP;
+
+ public static String ACTION_VIEWFORM_REFRESH_LABEL;
+ public static String ACTION_VIEWFORM_REFRESH_TOOLTIP;
+
+ public static String ACTION_VIEWFORM_GETLIST_LABEL;
+ public static String ACTION_VIEWFORM_GETLIST_TOOLTIP;
+
+ public static String ACTION_COMMANDSVIEW_SAVEASFILTER_LABEL;
+ public static String ACTION_COMMANDSVIEW_SAVEASFILTER_TOOLTIP;
+
+ public static String ACTION_EXPAND_SELECTED_LABEL;
+ public static String ACTION_EXPAND_SELECTED_TOOLTIP;
+
+ public static String ACTION_COLLAPSE_SELECTED_LABEL;
+ public static String ACTION_COLLAPSE_SELECTED_TOOLTIP;
+
+ public static String ACTION_COLLAPSE_ALL_LABEL;
+ public static String ACTION_COLLAPSE_ALL_TOOLTIP;
+
+ public static String ACTION_EXPAND_BY_LABEL;
+ public static String ACTION_EXPAND_BY_TOOLTIP;
+
+ public static String ACTION_EXPAND_ALL_LABEL;
+ public static String ACTION_EXPAND_ALL_TOOLTIP;
+
+ public static String ACTION_EXPAND_OTHER_LABEL;
+ public static String ACTION_EXPAND_OTHER_TOOLTIP;
+
+ public static String ACTION_SELECT_ALL_LABEL;
+ public static String ACTION_SELECT_ALL_TOOLTIP;
+
+ public static String ACTION_SELECT_INPUT_LABEL;
+ public static String ACTION_SELECT_INPUT_DLG;
+ public static String ACTION_SELECT_INPUT_TOOLTIP;
+
+ public static String ACTION_SELECTCONNECTION_LABEL;
+ public static String ACTION_SELECTCONNECTION_TOOLTIP;
+
+ public static String RESID_CHANGE_PREFIX_LABEL;
+ public static String RESID_CHANGE_PREFIX_TOOLTIP;
+
+ public static String RESID_CHANGEVIAENTRY_PREFIX_LABEL;
+ public static String RESID_CHANGEVIAENTRY_PREFIX_TOOLTIP;
+
+ public static String RESID_ADDVIAENTRY_PREFIX_LABEL;
+ public static String RESID_ADDVIAENTRY_PREFIX_TOOLTIP;
+
+ public static String RESID_COPYFROM_PREFIX_LABEL;
+ public static String RESID_COPYFROM_PREFIX_TOOLTIP;
+
+ public static String RESID_COPYTO_PREFIX_LABEL;
+ public static String RESID_COPYTO_PREFIX_TOOLTIP;
+
+ public static String RESID_DUPLICATE_PREFIX_LABEL;
+ public static String RESID_DUPLICATE_PREFIX_TOOLTIP;
+
+
+ // services and connector services property pages
+ public static String RESID_PROPERTIES_SERVICES_NAME;
+ public static String RESID_PROPERTIES_SERVICES_LABEL;
+ public static String RESID_PROPERTIES_SERVICES_TOOLTIP;
+ public static String RESID_PROPERTIES_DESCRIPTION_LABEL;
+ public static String RESID_PROPERTIES_CONNECTOR_SERVICES_LABEL;
+ public static String RESID_PROPERTIES_CONNECTOR_SERVICES_TOOLTIP;
+ public static String RESID_PROPERTIES_FACTORIES_LABEL;
+ public static String RESID_PROPERTIES_FACTORIES_TOOLTIP;
+ public static String RESID_PROPERTIES_PROPERTIES_LABEL;
+ public static String RESID_PROPERTIES_PROPERTIES_TOOLTIP;
+
+
+ public static String ACTION_COMPILE_NOPROMPT_LABEL;
+
+ // RSE Model Objects
+ public static String RESID_MODELOBJECTS_FILTERSTRING_DESCRIPTION;
+ public static String RESID_MODELOBJECTS_HOSTPOOL_DESCRIPTION;
+ public static String RESID_MODELOBJECTS_PROFILE_DESCRIPTION;
+ public static String RESID_MODELOBJECTS_SERVERLAUNCHER_DESCRIPTION;
+ public static String RESID_MODELOBJECTS_REFERENCINGOBJECT_DESCRIPTION;
+ public static String RESID_MODELOBJECTS_FILTER_DESCRIPTION;
+ public static String RESID_MODELOBJECTS_FILTERPOOL_DESCRIPTION;
+ public static String RESID_MODELOBJECTS_MODELOBJECT_DESCRIPTION;
+
+ // Services form
+ public static String RESID_SERVICESFORM_CONFIGURATION_TOOLTIP;
+ public static String RESID_SERVICESFORM_SERVICES_TOOLTIP;
+ public static String RESID_SERVICESFORM_CONNECTORSERVICES_TOOLTIP;
+ public static String RESID_SERVICESFORM_PROPERTIES_TOOLTIP;
+
+ static {
+ // load message values from bundle file
+ NLS.initializeMessages(BUNDLE_NAME, SystemResources.class);
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemResources.properties b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemResources.properties
new file mode 100644
index 00000000000..7970c6a294b
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemResources.properties
@@ -0,0 +1,1410 @@
+################################################################################
+# Copyright (c) 2000, 2006 IBM Corporation. All rights reserved.
+# This program and the accompanying materials are made available under the terms
+# of the Eclipse Public License v1.0 which accompanies this distribution, and is
+# available at http://www.eclipse.org/legal/epl-v10.html
+#
+# Initial Contributors:
+# The following IBM employees contributed to the Remote System Explorer
+# component that contains this file: David McKnight, Kushal Munir,
+# Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+# Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+#
+# Contributors:
+# {Name} (company) - description of contribution.
+################################################################################
+
+# NLS_MESSAGEFORMAT_NONE
+
+##############################################################
+# Button values. Mnemonics will be assigned automatically, don't set them here.
+##############################################################
+BUTTON_BROWSE=Browse...
+BUTTON_CLOSE=Close
+BUTTON_TEST=Test
+BUTTON_ADD=Add
+BUTTON_CREATE_LABEL=Create
+BUTTON_CREATE_TOOLTIP=Press to create the new resource
+BUTTON_APPLY_LABEL=Apply
+BUTTON_APPLY_TOOLTIP=Press to apply pending changes
+BUTTON_RESET_LABEL=Reset
+BUTTON_RESET_TOOLTIP=Press to reset to original values
+
+TERM_YES=Yes
+TERM_NO=No
+TERM_TRUE=True
+TERM_FALSE=False
+TERM_LOCAL=Local
+TERM_ALL=All
+
+#=============================================================
+# RE-USABLE COMPOSITE WIDGETS
+#=============================================================
+# RE-USABLE CONNECTION-SELECTION COMPOSITE WIDGETS
+WIDGET_CONNECTION_LABEL=Connection:
+WIDGET_CONNECTION_TOOLTIP=Select remote system connection
+WIDGET_CONNECTION_NAME=%1 in profile %2
+WIDGET_BUTTON_NEWCONNECTION_LABEL=New...
+WIDGET_BUTTON_NEWCONNECTION_TOOLTIP=Create a new remote system connection
+
+
+#=============================================================
+# MESSAGE LINE MRI
+#=============================================================
+RESID_MSGLINE_TIP=Press to see additional message details
+
+##############################################################
+# Preference pages
+##############################################################
+RESID_PREF_ROOT_PAGE=Remote Systems
+RESID_PREF_ROOT_TITLE=Remote Systems Overall Preferences
+RESID_PREF_SYSTEMTYPE_PREFIX_LABEL=Default System Type
+RESID_PREF_SYSTEMTYPE_PREFIX_TOOLTIP=Default for New Connection wizard
+RESID_PREF_USERID_PREFIX_LABEL=Overall Default User ID
+RESID_PREF_USERID_PREFIX_TOOLTIP=Overall default, overriddable per system type
+RESID_PREF_USERID_PERTYPE_PREFIX_LABEL=System type information
+RESID_PREF_USERID_PERTYPE_PREFIX_TOOLTIP=Set enablement state and default user ID for the selected system type. Press F1 for details.
+#RESID_PREF_USERID_PERTYPE_SYSTEMTYPES_LABEL=System Types
+#RESID_PREF_USERID_PERTYPE_USERID_LABEL=User ID
+RESID_PREF_SHOWFILTERPOOLS_PREFIX_LABEL=Show filter pools in Remote Systems view
+RESID_PREF_SHOWFILTERPOOLS_PREFIX_TOOLTIP=Show filter pools when expanding subsystems
+RESID_PREF_SHOWNEWCONNECTIONPROMPT_PREFIX_LABEL=Show "New Connection" prompt in Remote Systems view
+RESID_PREF_SHOWNEWCONNECTIONPROMPT_PREFIX_TOOLTIP=Show the prompt for a new connection in the Remote Systems view
+RESID_PREF_QUALIFYCONNECTIONNAMES_PREFIX_LABEL=Show connection names prefixed by profile name
+RESID_PREF_QUALIFYCONNECTIONNAMES_PREFIX_TOOLTIP=Select this if two connections or filter pools have the same name across different profiles
+RESID_PREF_REMEMBERSTATE_PREFIX_LABEL=Re-open Remote Systems view to previous state
+RESID_PREF_REMEMBERSTATE_PREFIX_TOOLTIP=Re-expand previously expanded connections when starting up
+RESID_PREF_USEDEFERREDQUERIES_PREFIX_LABEL=Use deferred queries in the Remote Systems view
+RESID_PREF_USEDEFERREDQUERIES_PREFIX_TOOLTIP=Select this if, when expanding nodes in the Remote Systems view, you would like queries to happen asynchronously
+RESID_PREF_RESTOREFROMCACHE_PREFIX_LABEL=Use cached information to restore the Remote Systems view
+RESID_PREF_RESTOREFROMCACHE_PREFIX_TOOLTIP=If cached information is available then it is used to restore the Remote Systems view instead of connecting to the remote system
+RESID_PREF_SYSTYPE_COLHDG_NAME=System Type
+RESID_PREF_SYSTYPE_COLHDG_ENABLED=Enabled
+RESID_PREF_SYSTYPE_COLHDG_DESC=Description
+RESID_PREF_SYSTYPE_COLHDG_USERID=Default User ID
+
+##############################################################
+# Preference pages for general communications
+##############################################################
+RESID_PREF_COMMUNICATIONS_TITLE=RSE Communications Preferences
+RESID_PREF_DAEMON_PORT_LABEL=RSE communications daemon port number (1 - 65536)
+RESID_PREF_DAEMON_PORT_TOOLTIP=Enter the local port number for the daemon to listen on
+RESID_PREF_DAEMON_AUTOSTART_LABEL=Start RSE communications daemon on Workbench startup
+RESID_PREF_DAEMON_AUTOSTART_TOOLTIP=Select the checkbox to start daemon on startup
+
+RESID_PREF_IP_ADDRESS_LABEL= Workstation network address
+RESID_PREF_IP_AUTO_LABEL= Automatically detect IP address of workstation
+RESID_PREF_IP_AUTO_TOOLTIP= Allow automatic detection of the IP address of your workstation. This setting should work in most cases
+RESID_PREF_IP_MANUAL_LABEL= Specify IP address or host name of workstation
+RESID_PREF_IP_MANUAL_TOOLTIP= Specify the IP address or host name of your workstation
+RESID_PREF_IP_MANUAL_ENTER_LABEL= IP address or host name:
+RESID_PREF_IP_MANUAL_ENTER_TOOLTIP= Enter the IP address or host name of your workstation
+
+##############################################################
+# Miscellaneous Actions that appear as either buttons and/or menu items.
+# Actions use the following keys:
+# xxx.label=Text shown on button or menu item
+# xxx.tooltip=Short help shown in hover help box
+##############################################################
+# Style popup menu (cascading) on common Work-With lists...
+# labels...
+#MENUITEM_WWSTYLE_LABEL=Style
+#MENUITEM_WWSTYLE_NEXT_LABEL=Next style
+#MENUITEM_WWSTYLE_1_LABEL=1. Entry field and buttons on side
+#MENUITEM_WWSTYLE_2_LABEL=2. Entry field and buttons on top
+#MENUITEM_WWSTYLE_3_LABEL=3. No entry field and buttons on top
+#MENUITEM_WWSTYLE_4_LABEL=4. No entry field and no buttons
+#MENUITEM_WWSTYLE_5_LABEL=5. No entry field and buttons on side
+#MENUITEM_WWSTYLE_6_LABEL=6. No entry field, Add buttons on top, other buttons on side
+# descriptions...
+#MENUITEM_WWSTYLE_DESCRIPTION=Switch to another style of work-with list
+#MENUITEM_WWSTYLE_NEXT_DESCRIPTION=Switch to the next style of work-with list
+#MENUITEM_WWSTYLE_1_DESCRIPTION=Switch to style 1
+#MENUITEM_WWSTYLE_2_DESCRIPTION=Switch to style 2
+#MENUITEM_WWSTYLE_3_DESCRIPTION=Switch to style 3
+#MENUITEM_WWSTYLE_4_DESCRIPTION=Switch to style 4
+#MENUITEM_WWSTYLE_5_DESCRIPTION=Switch to style 5
+#MENUITEM_WWSTYLE_6_DESCRIPTION=Switch to style 6
+
+##############################################################
+# Wizard and dialog resources
+##############################################################
+
+#=============================================================
+# SINGLE-SELECT RENAME DIALOG...
+#=============================================================
+RESID_RENAME_SINGLE_TITLE=Rename Resource
+RESID_SIMPLE_RENAME_PROMPT_LABEL=New name
+RESID_SIMPLE_RENAME_PROMPT_TOOLTIP=Enter unique new resource name
+RESID_SIMPLE_RENAME_RESOURCEPROMPT_LABEL=Resource type:
+RESID_SIMPLE_RENAME_RESOURCEPROMPT_TOOLTIP=Type of object being renamed
+RESID_SIMPLE_RENAME_RADIO_OVERWRITE_LABEL =Overwrite
+RESID_SIMPLE_RENAME_RADIO_OVERWRITE_TOOLTIP =Replace the existing file with the new one.
+RESID_SIMPLE_RENAME_RADIO_RENAME_LABEL =Rename
+RESID_SIMPLE_RENAME_RADIO_RENAME_TOOLTIP =Rename the file to something else.
+
+
+# SPECIALIZED PROMPTS FOR SPECIFIC TYPES OF RESOURCES...
+RESID_SIMPLE_RENAME_PROFILE_PROMPT_LABEL=New profile name:
+RESID_SIMPLE_RENAME_PROFILE_PROMPT_TIP=Enter unique new name for this profile
+
+
+
+
+#=============================================================
+# MULTI-SELECT RENAME DIALOG...
+#=============================================================
+RESID_RENAME_TITLE=Rename Resources
+RESID_RENAME_VERBAGE=Enter a unique new name for each resource. You can Tab between the names.
+#column headings...
+RESID_RENAME_COLHDG_OLDNAME=Resource
+RESID_RENAME_COLHDG_NEWNAME=New name
+RESID_RENAME_COLHDG_TYPE=Resource Type
+# SPECIALIZED PROMPTS FOR SPECIFIC TYPES OF RESOURCES...
+RESID_MULTI_RENAME_PROFILE_VERBAGE=Enter unique new names for each profile
+
+#=============================================================
+# GENERIC DELETE DIALOG...
+#=============================================================
+RESID_DELETE_TITLE=Delete Confirmation
+RESID_DELETE_PROMPT=Delete selected resources?
+RESID_DELETE_PROMPT_SINGLE=Delete selected resource?
+RESID_DELETE_COLHDG_OLDNAME=Resource
+RESID_DELETE_COLHDG_TYPE=Resource Type
+RESID_DELETE_BUTTON=Delete
+RESID_DELETE_TIP=Confirm delete request
+
+RESID_DELETE_RESOURCEPROMPT_LABEL=Selected resource(s) type:
+RESID_DELETE_RESOURCEPROMPT_TOOLTIP=Type of object(s) being deleted
+RESID_DELETE_WARNING_LABEL=WARNING! Remote objects are permanently deleted!
+RESID_DELETE_WARNING_TOOLTIP=You are confirming permanent deletion of the selected resource(s) from the remote system. This action cannot be undone
+RESID_DELETE_WARNINGLOCAL_LABEL=WARNING! Local objects are permanently deleted!
+RESID_DELETE_WARNINGLOCAL_TOOLTIP=You are confirming permanent deletion of the selected resource(s) from the local system. This action cannot be undone
+
+# SPECIALIZED PROMPTS FOR SPECIFIC TYPES OF RESOURCES...
+RESID_DELETE_PROFILES_PROMPT=Delete selected profiles, including their connections, filters and user actions?
+
+
+#=============================================================
+# GENERIC COPY DIALOG...
+#=============================================================
+RESID_COPY_SINGLE_TITLE=Copy Resource
+RESID_COPY_TITLE=Copy Resources
+RESID_COPY_PROMPT=Select the copy destination
+RESID_COPY_TARGET_PROFILE_PROMPT=Select the active profile to copy into
+RESID_COPY_TARGET_FILTERPOOL_PROMPT=Select the filter pool to copy into
+RESID_COPY_TARGET_FILTER_PROMPT=Select the filter to copy into
+
+#=============================================================
+# GENERIC MOVE DIALOG...
+#=============================================================
+RESID_MOVE_SINGLE_TITLE=Move Resource
+RESID_MOVE_TITLE=Move Resources
+RESID_MOVE_PROMPT=Select the move destination
+RESID_MOVE_TARGET_PROFILE_PROMPT=Select the active profile to move into
+RESID_MOVE_TARGET_FILTERPOOL_PROMPT=Select the filter pool to move into
+RESID_MOVE_TARGET_FILTER_PROMPT=Select the filter to move into
+
+#=============================================================
+# GENERIC COPY/MOVE NAME-COLLISION DIALOG...
+#=============================================================
+RESID_COLLISION_RENAME_TITLE=Duplicate Name Collision
+RESID_COLLISION_RENAME_VERBAGE=A resource named "&1" already exists.
+RESID_COLLISION_RENAME_LABEL=Rename to
+RESID_COLLISION_RENAME_TOOLTIP=Enter unique new resource name
+
+
+#=============================================================
+# USERID PER SYSTEMTYPE DIALOG...
+#=============================================================
+RESID_USERID_PER_SYSTEMTYPE_TITLE=Default User ID Preference
+RESID_USERID_PER_SYSTEMTYPE_SYSTEMTYPE_LABEL=System type:
+RESID_USERID_PER_SYSTEMTYPE_SYSTEMTYPE_TOOLTIP=The system type to set the default user ID for
+RESID_USERID_PER_SYSTEMTYPE_LABEL=User ID
+RESID_USERID_PER_SYSTEMTYPE_TOOLTIP=Enter default user ID to use for all connections of this system type
+
+
+#=============================================================
+# SELECT CONNECTION DIALOG...
+#=============================================================
+RESID_SELECTCONNECTION_TITLE=Select Connection
+RESID_SELECTCONNECTION_VERBAGE=Select a connection
+
+#=============================================================
+# NEW PROFILE WIZARD...
+#=============================================================
+RESID_NEWPROFILE_TITLE=New
+RESID_NEWPROFILE_PAGE1_TITLE=Remote System Profile
+RESID_NEWPROFILE_PAGE1_DESCRIPTION=Define profile to hold connections
+RESID_NEWPROFILE_VERBAGE=Profiles enable team support. They contain all the connections, filters, user actions and compile commands. Whenever these items are created, you are prompted for the profile to create them in. Whenever they are shown, the total from all active profiles are shown. By default, team members only have active their own profiles and the Team profile.
+RESID_NEWPROFILE_NAME_LABEL=Name
+RESID_NEWPROFILE_NAME_TOOLTIP=Unique profile name
+RESID_NEWPROFILE_MAKEACTIVE_LABEL=Make active
+RESID_NEWPROFILE_MAKEACTIVE_TOOLTIP=Show connections in this profile
+
+#======================================================================
+# NEW CONNECTION PROMPT ("New Connection..." SPECIAL CONNECTION IN RSE)
+#======================================================================
+RESID_NEWCONN_PROMPT_LABEL=New Connection
+RESID_NEWCONN_PROMPT_TOOLTIP=Expand to create a new connection to a remote system
+RESID_NEWCONN_PROMPT_VALUE=A prompt for a new connection
+RESID_NEWCONN_EXPANDABLEPROMPT_VALUE=An expandable prompt for a new connection
+
+#=============================================================
+# NEW CONNECTION WIZARD...
+#=============================================================
+RESID_NEWCONN_TITLE=New
+RESID_NEWCONN_PAGE1_TITLE=Remote System Connection
+RESID_NEWCONN_PAGE1_LOCAL_TITLE=Local System Connection
+RESID_NEWCONN_PAGE1_REMOTE_TITLE=Remote &1 System Connection
+RESID_NEWCONN_PAGE1_DESCRIPTION=Define connection information
+
+#=============================================================
+# NEW CONNECTION WIZARD INFORMATION PAGE FOR UNIX/LINUX/WINDOWS
+#=============================================================
+RESID_NEWCONN_SUBSYSTEMPAGE_DESCRIPTION=Define subsystem information
+RESID_NEWCONN_SUBSYSTEMPAGE_FILES_TITLE=Communications Server
+RESID_NEWCONN_SUBSYSTEMPAGE_FILES_DESCRIPTION=How to install server support
+RESID_NEWCONN_SUBSYSTEMPAGE_FILES_VERBAGE1=To connect to your remote system, you must first copy and expand the supplied Java server code jar file on that system, and either manually start that server or the supplied daemon. You will find the instructions for this in the Help.
+RESID_NEWCONN_SUBSYSTEMPAGE_FILES_VERBAGE2=If you manually start the communications server, you will need to set the port number property for this connection. To do this, expand your newly created connection in the Remote System Explorer perspective. Right click on the Files subsystem and select Properties. You can specify the port to match the port you specified or were assigned for the server.
+
+#=============================================================
+# RENAME PROFILE PAGE...
+#=============================================================
+RESID_RENAMEDEFAULTPROFILE_PAGE1_TITLE=Name personal profile
+RESID_RENAMEDEFAULTPROFILE_PAGE1_DESCRIPTION=Uniquely name user profile
+RESID_PROFILE_PROFILENAME_LABEL=Profile
+RESID_PROFILE_PROFILENAME_TIP=New name for the profile
+RESID_PROFILE_PROFILENAME_VERBAGE=Welcome to Remote Systems. Connections can be sharable by the team or private to you. Enter a profile name to uniquely identify you from your team members. You will decide for each new connection whether it is owned by the team profile or your profile.
+
+#=============================================================
+# DUPLICATE PROFILE DIALOG...
+#=============================================================
+RESID_COPY_PROFILE_TITLE=Duplicate Profile
+RESID_COPY_PROFILE_PROMPT_LABEL=New profile name
+RESID_COPY_PROFILE_PROMPT_TOOLTIP=Enter a unique name for the new profile
+
+
+#=============================================================
+# UPDATE CONNECTION DIALOG...
+#=============================================================
+RESID_CHGCONN_TITLE=Change Connection
+
+RESID_CONNECTION_TYPE_LABEL=Resource type
+RESID_CONNECTION_TYPE_VALUE=Connection to remote system
+
+RESID_CONNECTION_SYSTEMTYPE_LABEL=System type
+RESID_CONNECTION_SYSTEMTYPE_TIP=Operating system type of the remote host
+
+RESID_CONNECTION_SYSTEMTYPE_READONLY_LABEL=System type
+RESID_CONNECTION_SYSTEMTYPE_READONLY_TIP=Operating system type of the remote host
+
+RESID_CONNECTION_CONNECTIONNAME_LABEL=Connection name
+RESID_CONNECTION_CONNECTIONNAME_TIP=Arbitrary name for this connection, unique to this profile
+
+RESID_CONNECTION_HOSTNAME_LABEL=Host name
+RESID_CONNECTION_HOSTNAME_TIP=Hostname or IP address of target system
+
+RESID_CONNECTION_HOSTNAME_READONLY_LABEL=Host name
+RESID_CONNECTION_HOSTNAME_READONLY_TIP=Hostname or IP address of system this connects to
+
+RESID_CONNECTION_USERID_LABEL=User ID
+RESID_CONNECTION_USERID_TIP=User ID to use when connecting
+
+RESID_CONNECTION_DEFAULTUSERID_LABEL=Default User ID
+RESID_CONNECTION_DEFAULTUSERID_TIP=Default user ID for subsystems that don't specify a user ID
+RESID_CONNECTION_DEFAULTUSERID_INHERITBUTTON_TIP=Inherit from preferences, or set locally for this connection
+
+RESID_CONNECTION_PORT_LABEL=Port
+RESID_CONNECTION_PORT_TIP=Port number used to do the connection
+
+RESID_CONNECTION_DAEMON_PORT_LABEL=Daemon Port
+RESID_CONNECTION_DAEMON_PORT_TIP=Port number used to connect to the daemon that launches Remote Systems Explorer servers
+
+RESID_CONNECTION_DEFAULTPORT_LABEL=Default port
+RESID_CONNECTION_DEFAULTPORT_TIP=Default port for subsystems
+
+RESID_CONNECTION_DESCRIPTION_LABEL=Description
+RESID_CONNECTION_DESCRIPTION_TIP=Commentary description of the connection
+
+RESID_CONNECTION_PROFILE_LABEL=Parent profile
+RESID_CONNECTION_PROFILE_TIP=Select profile to contain this connection
+RESID_CONNECTION_PROFILE_READONLY_TIP=The profile containing this connection
+
+RESID_CONNECTION_VERIFYHOSTNAME_LABEL=Verify host name
+RESID_CONNECTION_VERIFYHOSTNAME_TOOLTIP=Verify a host of the given name or IP address exists
+
+
+
+#=============================================================
+# SYSTEMREGISTRY PROPERTY PAGE DIALOG...
+#=============================================================
+RESID_SYSTEMREGISTRY_TEXT=RemoteSystemsConnections project
+RESID_SYSTEMREGISTRY_CONNECTIONS=Connections
+
+#=============================================================
+# SUBSYSTEM PROPERTY PAGE DIALOG...
+#=============================================================
+RESID_SUBSYSTEM_TITLE=Properties for Subsystem
+RESID_SUBSYSTEM_NAME_LABEL=Name
+RESID_SUBSYSTEM_TYPE_LABEL=Resource type
+RESID_SUBSYSTEM_TYPE_VALUE=Subsystem
+RESID_SUBSYSTEM_VENDOR_LABEL=Vendor
+RESID_SUBSYSTEM_CONNECTION_LABEL=Parent connection
+RESID_SUBSYSTEM_PROFILE_LABEL=Parent profile
+RESID_SUBSYSTEM_PORT_LABEL=Port
+RESID_SUBSYSTEM_PORT_TIP=Port number to connect with
+RESID_SUBSYSTEM_PORT_INHERITBUTTON_TIP=Use first available port, or explicitly set the port number
+RESID_SUBSYSTEM_PORT_INHERITBUTTON_INHERIT_TIP=Click to explicitly set the port number
+RESID_SUBSYSTEM_PORT_INHERITBUTTON_LOCAL_TIP=Click to use first available port
+RESID_SUBSYSTEM_USERID_LABEL=User ID
+RESID_SUBSYSTEM_USERID_TIP=User ID to connect with
+RESID_SUBSYSTEM_USERID_INHERITBUTTON_TIP=Inherit user ID from connection, or set locally for this subsystem
+RESID_SUBSYSTEM_USERID_INHERITBUTTON_INHERIT_TIP=Click to explicitly set the user ID for this subsystem
+RESID_SUBSYSTEM_USERID_INHERITBUTTON_LOCAL_TIP=Click to inherit the user ID from the connection
+
+# Communications property page
+RESID_SUBSYSTEM_SSL_LABEL=Use SSL for network communications
+RESID_SUBSYSTEM_SSL_TIP=Use Secure Sockets Layer (SSL) for communicating with the server
+
+# Single signon (Kerberos) Properties Page
+
+# Environment Properties Page
+RESID_SUBSYSTEM_ENVVAR_TITLE= Environment Variables
+RESID_SUBSYSTEM_ENVVAR_DESCRIPTION= Specify the environment variables that will be set when a connection is established:
+RESID_SUBSYSTEM_ENVVAR_TOOLTIP= The environment variables that will be set when a connection is established
+
+RESID_SUBSYSTEM_ENVVAR_NAME_TITLE= Name
+RESID_SUBSYSTEM_ENVVAR_NAME_LABEL= Name:
+RESID_SUBSYSTEM_ENVVAR_NAME_TOOLTIP= Enter a name for the environment variable
+
+RESID_SUBSYSTEM_ENVVAR_VALUE_TITLE= Value
+RESID_SUBSYSTEM_ENVVAR_VALUE_LABEL= Value:
+RESID_SUBSYSTEM_ENVVAR_VALUE_TOOLTIP= Enter a value for the environment variable
+
+
+RESID_SUBSYSTEM_ENVVAR_ADD_TOOLTIP= Add a new environment variable
+RESID_SUBSYSTEM_ENVVAR_REMOVE_TOOLTIP= Remove the selected environment variable
+RESID_SUBSYSTEM_ENVVAR_CHANGE_TOOLTIP= Change the selected environment variable
+RESID_SUBSYSTEM_ENVVAR_MOVEUP_LABEL= Move Up
+RESID_SUBSYSTEM_ENVVAR_MOVEUP_TOOLTIP= Move the selected environment variable(s) up in the list
+RESID_SUBSYSTEM_ENVVAR_MOVEDOWN_LABEL= Move Down
+RESID_SUBSYSTEM_ENVVAR_MOVEDOWN_TOOLTIP= Move the selected environment variable(s) down in the list
+
+# Add / Change Environment Variable Dialog
+RESID_SUBSYSTEM_ENVVAR_ADD_TITLE= Add Environment Variable
+RESID_SUBSYSTEM_ENVVAR_CHANGE_TITLE= Change Environment Variable
+
+#=============================================================
+# PROPERTY PAGE DIALOG...
+#=============================================================
+RESID_PROP_SERVERLAUNCHER_MEANS=Indicate how the remote server should be launched
+RESID_PROP_SERVERLAUNCHER_MEANS_LABEL=Launcher
+RESID_PROP_SERVERLAUNCHER_RADIO_DAEMON=Remote daemon
+RESID_PROP_SERVERLAUNCHER_RADIO_REXEC=REXEC
+RESID_PROP_SERVERLAUNCHER_RADIO_NONE=Connect to running server
+RESID_PROP_SERVERLAUNCHER_RADIO_DAEMON_TOOLTIP=Launch the server using a daemon running on the host.
+RESID_PROP_SERVERLAUNCHER_RADIO_REXEC_TOOLTIP=Launch the server using REXEC.
+RESID_PROP_SERVERLAUNCHER_RADIO_NONE_TOOLTIP=Manually launch the server and then connect to it from RSE.
+RESID_PROP_SERVERLAUNCHER_PATH=Path to installed server on host
+RESID_PROP_SERVERLAUNCHER_PATH_TOOLTIP=Specify where the installed server is located on the host.
+RESID_PROP_SERVERLAUNCHER_INVOCATION=Server launch command
+RESID_PROP_SERVERLAUNCHER_INVOCATION_TOOLTIP=Specify the name of the command that invokes the server.
+
+#=============================================================
+# NEW FILTERPOOL WIZARD...
+#=============================================================
+RESID_NEWFILTERPOOL_TITLE=New Filter Pool
+RESID_NEWFILTERPOOL_PAGE1_TITLE=System Filter Pool
+RESID_NEWFILTERPOOL_PAGE1_DESCRIPTION=Define a new pool for filters
+#WIDGETS ON NEW FILTER POOL WIZARD
+RESID_FILTERPOOLNAME_LABEL=Pool name
+RESID_FILTERPOOLNAME_TIP=Enter unique name for the pool within profile
+RESID_FILTERPOOLMANAGERNAME_LABEL=Profile
+RESID_FILTERPOOLMANAGERNAME_TIP=Select profile to contain this pool
+
+#=============================================================
+# COMMON PROPERTIES PAGE WIDGETS...
+#=============================================================
+RESID_PP_PROPERTIES_TYPE_LABEL=Resource type
+RESID_PP_PROPERTIES_TYPE_TOOLTIP=What type of artifact is this?
+
+
+#=============================================================
+# FILTERPOOL PROPERTIES PAGE...
+#=============================================================
+RESID_FILTERPOOL_TITLE=Properties for Filter Pool
+RESID_FILTERPOOL_TYPE_VALUE=Filter pool
+
+RESID_FILTERPOOL_NAME_LABEL=Name
+RESID_FILTERPOOL_NAME_TOOLTIP=Name of this filter pool
+
+RESID_FILTERPOOL_PROFILE_LABEL=Parent profile
+RESID_FILTERPOOL_PROFILE_TOOLTIP=Profile that owns this filter pool
+
+RESID_FILTERPOOL_REFERENCECOUNT_LABEL=Reference count
+RESID_FILTERPOOL_REFERENCECOUNT_TOOLTIP=How many connections show the filters in this pool?
+
+RESID_FILTERPOOL_RELATEDCONNECTION_LABEL=Related connection
+RESID_FILTERPOOL_RELATEDCONNECTION_TOOLTIP=Name of the single connection this pool is private to
+
+#=============================================================
+# FILTERPOOL REFERENCE PROPERTIES PAGE...
+#=============================================================
+RESID_FILTERPOOLREF_TITLE=Properties for Filter Pool Reference
+RESID_FILTERPOOLREF_TYPE_VALUE=Reference to filter pool
+
+RESID_FILTERPOOLREF_NAME_LABEL=Name
+RESID_FILTERPOOLREF_NAME_TOOLTIP=Name of the referenced filter pool
+
+RESID_FILTERPOOLREF_SUBSYSTEM_LABEL=Parent subsystem
+RESID_FILTERPOOLREF_SUBSYSTEM_TOOLTIP=The subsystem which contains this reference
+
+RESID_FILTERPOOLREF_CONNECTION_LABEL=Parent connection
+RESID_FILTERPOOLREF_CONNECTION_TOOLTIP=The connection which owns the subsystem containing this reference
+
+RESID_FILTERPOOLREF_PROFILE_LABEL=Parent profile
+RESID_FILTERPOOLREF_PROFILE_TOOLTIP=The profile which owns the connection containing the subsystem with this reference
+
+#=============================================================
+# FILTER PROPERTIES PAGE...
+#=============================================================
+RESID_PP_FILTER_TITLE_LABEL=Properties for Filter
+RESID_PP_FILTER_TYPE_VALUE=Filter
+RESID_PP_FILTER_TYPE_PROMPTABLE_VALUE=Prompting filter
+RESID_PP_FILTER_TYPE_PROMPTABLE_TOOLTIP=Whether this is a filter that prompts the user when its expanded
+
+RESID_PP_FILTER_NAME_LABEL=Name
+RESID_PP_FILTER_NAME_TOOLTIP=The name of this filter
+
+RESID_PP_FILTER_STRINGCOUNT_LABEL=Number of filter strings
+RESID_PP_FILTER_STRINGCOUNT_TOOLTIP=The number of filter strings contained in this filter
+
+RESID_PP_FILTER_FILTERPOOL_LABEL=Parent filter pool
+RESID_PP_FILTER_FILTERPOOL_TOOLTIP=The filter pool which contains this filter
+
+RESID_PP_FILTER_PROFILE_LABEL=Parent profile
+RESID_PP_FILTER_PROFILE_TOOLTIP=The profile which contains the filter pool with this filter
+
+RESID_PP_FILTER_ISCONNECTIONPRIVATE_LABEL=Connection private
+RESID_PP_FILTER_ISCONNECTIONPRIVATE_TOOLTIP=Whether this is a filter contained in a filter pool that is private to a single connection
+
+#=============================================================
+# FILTERSTRING PROPERTIES PAGE...
+#=============================================================
+RESID_PP_FILTERSTRING_TITLE=Properties for Filter String
+RESID_PP_FILTERSTRING_TYPE_VALUE=Filter string
+
+#=============================================================
+# FILTERSTRING PROPERTIES PAGE...
+#=============================================================
+RESID_PP_FILTERSTRING_TITLE=Properties for Filter String
+
+RESID_PP_FILTERSTRING_TYPE_VALUE==Filter string
+
+RESID_PP_FILTERSTRING_STRING_LABEL=String
+RESID_PP_FILTERSTRING_STRING_TOOLTIP=The actual filter string
+
+RESID_PP_FILTERSTRING_FILTER_LABEL=Parent filter
+RESID_PP_FILTERSTRING_FILTER_TOOLTIP=The filter that contains this filter string
+
+RESID_PP_FILTERSTRING_FILTERPOOL_LABEL=Parent filter pool
+RESID_PP_FILTERSTRING_FILTERPOOL_TOOLTIP=The filter pool that contains the filter with this filter string
+
+RESID_PP_FILTERSTRING_PROFILE_LABEL=Parent profile
+RESID_PP_FILTERSTRING_PROFILE_TOOLTIP=The profile that contains the filter pool with this filter string's filter
+
+#=============================================================
+# SUBSYSTEMFACTORY PROPERTIES PAGE...
+#=============================================================
+RESID_PP_SUBSYSFACTORY_TITLE=Properties for SubSystem Factory
+RESID_PP_SUBSYSFACTORY_VERBAGE=A subsystem factory is responsible for creating and owning subsystem instances, one per connection typically. They may also contain, per profile, team-sharable artifacts.
+
+RESID_PP_SUBSYSFACTORY_ID_LABEL=Identifier
+RESID_PP_SUBSYSFACTORY_ID_TOOLTIP=Unique identifier for this subsystem factory
+
+RESID_PP_SUBSYSFACTORY_VENDOR_LABEL=Vendor
+RESID_PP_SUBSYSFACTORY_VENDOR_TOOLTIP=Vendor who created this subsystem factory
+
+RESID_PP_SUBSYSFACTORY_TYPES_LABEL=System types
+RESID_PP_SUBSYSFACTORY_TYPES_TOOLTIP=System types supported by this factory
+
+#=============================================================
+# NEW FILTER WIZARD...
+#=============================================================
+RESID_NEWFILTER_TITLE=New
+RESID_NEWFILTER_PAGE_TITLE=Filter
+# PAGE 1 OF NEW FILTER WIZARD...
+RESID_NEWFILTER_PAGE1_DESCRIPTION=Create a new filter
+# PAGE 2 OF NEW FILTER WIZARD...
+RESID_NEWFILTER_PAGE2_DESCRIPTION=Name the new filter
+RESID_NEWFILTER_PAGE2_NAME_VERBAGE=Filters are saved for easy re-use. Specify a unique name for this filter. This name will appear in the Remote Systems view, and will be expandable.
+RESID_NEWFILTER_PAGE2_POOL_VERBAGE=Filters are created in filter pools, which are re-usable in multiple connections. Select the pool to create this filter in. The pool names are qualified by their profile name.
+RESID_NEWFILTER_PAGE2_PROFILE_VERBAGE=Select a profile to own the new filter. This determines if it is unique to you, or sharable by the team. It will be placed in the default filter pool for that profile.
+RESID_NEWFILTER_PAGE2_POOL_VERBAGE_TIP=Tip: too many filters? Turn on "Show filter pools in Remote Systems view". Select Preferences from the Window pulldown, then Remote Systems
+
+# PAGE 3 OF NEW FILTER WIZARD...
+RESID_NEWFILTER_PAGE3_DESCRIPTION=Additional Information
+RESID_NEWFILTER_PAGE3_STRINGS_VERBAGE=Tip: Filters can contain multiple filter strings, although this wizard only prompts for one. To add more filter strings, select the filter in the Remote Systems view, and select the Change action from its pop-up menu.
+RESID_NEWFILTER_PAGE3_POOLS_VERBAGE=Tip: Too many filters? Turn on "Show filter pools in Remote Systems view." Select Preferences from the Window pulldown, then Remote Systems.
+
+RESID_FILTERALIAS_LABEL=Filter name:
+RESID_FILTERALIAS_TIP=Enter filter name unique for this filter pool
+RESID_FILTERPARENTPOOL_LABEL=Parent filter pool:
+RESID_FILTERPARENTPOOL_TIP=Filter pool in which this filter will be created
+RESID_FILTERSTRINGS_LABEL=Filter Strings
+RESID_FILTERSTRINGS_TIP=Strings to filter by. Use the pop-up menu for additional actions
+RESID_NEWFILTER_POOLTIP=Tip: too many filters? Turn on "Show filter pools in Remote Systems view." Select Preferences from the Windows pulldown, then Remote Systems.
+
+
+#=============================================================
+# CHANGE SYSTEM FILTER DIALOG...
+#=============================================================
+RESID_CHGFILTER_TITLE=Change System Filter
+RESID_CHGFILTER_LIST_NEWITEM=New filter string
+RESID_CHGFILTER_NAME_LABEL=Filter name:
+RESID_CHGFILTER_NAME_TOOLTIP=Name for this filter. A filter is a named collection of filter strings
+RESID_CHGFILTER_POOL_LABEL=Parent filter pool:
+RESID_CHGFILTER_POOL_TOOLTIP=Filter pool in which this filter exists
+RESID_CHGFILTER_LIST_LABEL=Filter strings:
+RESID_CHGFILTER_LIST_TOOLTIP=Strings to filter by. Use the pop-up menu for additional actions
+RESID_CHGFILTER_LIST_NEWITEM=New filter string
+RESID_CHGFILTER_FILTERSTRING_LABEL=Selected filter string:
+RESID_CHGFILTER_FILTERSTRING_TOOLTIP=Edit the filter string and press Apply to change it in the list
+RESID_CHGFILTER_NEWFILTERSTRING_LABEL=New filter string:
+RESID_CHGFILTER_NEWFILTERSTRING_TOOLTIP=Specify the new filter string, then press Create to add it to this filter
+RESID_CHGFILTER_BUTTON_TEST_LABEL=Test
+RESID_CHGFILTER_BUTTON_TEST_TOOLTIP=Press to test the currently selected filter string
+RESID_CHGFILTER_BUTTON_APPLY_LABEL=Apply
+RESID_CHGFILTER_BUTTON_APPLY_TOOLTIP=Press to apply the changes to the currently selected filter string
+RESID_CHGFILTER_BUTTON_REVERT_LABEL=Revert
+RESID_CHGFILTER_BUTTON_REVERT_TOOLTIP=Press to revert to the last saved values for the currently selected filter string
+RESID_CHGFILTER_BUTTON_CREATE_LABEL=Create
+RESID_CHGFILTER_BUTTON_CREATE_TOOLTIP=Press to create a new filter string in this filter
+
+#=============================================================
+# CREATE UNNAMED FILTER DIALOG...
+#=============================================================
+RESID_CRTFILTER_TITLE=Create Filter
+
+#=============================================================
+# RENAME FILTER DIALOG...
+#=============================================================
+RESID_RENAME_FILTER_TITLE=Rename Filter
+RESID_RENAME_FILTER_PROMPT=Enter the new filter name
+#=============================================================
+# COPY FILTER DIALOG...
+#=============================================================
+RESID_COPY_FILTER_TITLE=Copy Filter
+RESID_COPY_FILTER_PROMPT=Select system to copy to
+#=============================================================
+# NEW FILTER STRING ACTION AND WIZARD...
+#=============================================================
+RESID_NEWFILTERSTRING_TITLE=New System Filter
+RESID_NEWFILTERSTRING_ADD_TITLE=Add...
+RESID_NEWFILTERSTRING_PAGE1_TITLE=System Filter String
+RESID_NEWFILTERSTRING_PAGE1_DESCRIPTION=Create a new filter string
+
+RESID_NEWFILTERSTRING_PREFIX_LABEL=Add...
+RESID_NEWFILTERSTRING_PREFIX_TOOLTIP=Add a new filter string
+
+RESID_NEWFILTERSTRING_PREFIX_PROMPT=Enter a filter string
+
+RESID_FILTERSTRING_STRING_LABEL=Filter string:
+RESID_FILTERSTRING_STRING_TIP=Enter a filter string
+
+#=============================================================
+# CHANGE FILTER STRING ACTION AND DIALOG...
+#=============================================================
+RESID_CHGFILTERSTRING_PREFIX_LABEL=Change...
+RESID_CHGFILTERSTRING_PREFIX_TOOLTIP=Change selected filter string
+RESID_CHGFILTERSTRING_TITLE=Change Filter String
+RESID_CHGFILTERSTRING_PREFIX_PROMPT=Edit the filter string
+
+#=============================================================
+# TEST FILTER STRING DIALOG...
+#=============================================================
+RESID_TESTFILTERSTRING_TITLE=Test Filter String
+RESID_TESTFILTERSTRING_PROMPT_LABEL=Filter string:
+RESID_TESTFILTERSTRING_PROMPT_TOOLTIP=Filter string being tested
+RESID_TESTFILTERSTRING_TREE_TIP=Results of resolving the filter string
+
+
+#=============================================================
+# SELECT REMOTE OBJECT DIALOG...
+#=============================================================
+# unused
+#RESID_SELECTREMOTEOBJECT_PREFIX_QUICKFILTERSTRINGS_LABEL=Quick filter string:
+#RESID_SELECTREMOTEOBJECT_PREFIX_QUICKFILTERSTRINGS_TOOLTIP=Enter simple or generic name to change contents of tree view
+#RESID_SELECTREMOTEOBJECT_PREFIX_GETLISTBUTTON_LABEL=Get list
+#RESID_SELECTREMOTEOBJECT_PREFIX_GETLISTBUTTON_TOOLTIP=Resolves entered filter string and populates tree
+#RESID_SELECTREMOTEOBJECT_EXISTINGFILTERSTRINGS=Existing filter strings
+
+#=============================================================
+# PROMPT FOR PASSWORD DIALOG...
+#=============================================================
+RESID_PASSWORD_TITLE=Enter Password
+RESID_PASSWORD_LABEL=Password
+RESID_PASSWORD_TIP=Enter password for connecting
+RESID_PASSWORD_USERID_LABEL=User ID
+RESID_PASSWORD_USERID_TIP=Enter user ID. It will be remembered
+#NOTE TO TRANSLATER: FOLLOWING LABEL MUST HAVE 2 SPACES IN FRONT OF IT
+# yantzi: artemis 6.0, chagned to save user ID to be consistent with password prompt
+RESID_PASSWORD_USERID_ISPERMANENT_LABEL= Save user ID
+RESID_PASSWORD_USERID_ISPERMANENT_TIP=Select to make user ID change permanent
+RESID_PASSWORD_SAVE_LABEL= Save password
+RESID_PASSWORD_SAVE_TOOLTIP= Save the password for the specified hostname and user ID
+
+#=============================================================
+# SELECT FILTER POOL DIALOG...
+#=============================================================
+RESID_SELECTFILTERPOOLS_TITLE=Select Filter Pools
+RESID_SELECTFILTERPOOLS_PROMPT=Select filter pools to include in this connection
+
+#=============================================================
+# WORK WITH FILTER POOLS DIALOG...
+#=============================================================
+RESID_WORKWITHFILTERPOOLS_TITLE=Work With Filter Pools
+RESID_WORKWITHFILTERPOOLS_PROMPT=Work with filter pools
+
+#=============================================================
+# WORK WITH HISTORY DIALOG...
+#=============================================================
+RESID_WORKWITHHISTORY_TITLE=Work With History
+RESID_WORKWITHHISTORY_VERBAGE=Remove or re-order history for this GUI control
+RESID_WORKWITHHISTORY_PROMPT=History
+RESID_WORKWITHHISTORY_BUTTON_LABEL=...
+RESID_WORKWITHHISTORY_BUTTON_TIP=Bring up the Work With History dialog
+
+#=============================================================
+# Team View
+#=============================================================
+RESID_TEAMVIEW_SUBSYSFACTORY_VALUE=SubSystem factory
+RESID_TEAMVIEW_USERACTION_VALUE=User action
+RESID_TEAMVIEW_CATEGORY_VALUE=Category
+
+
+RESID_TEAMVIEW_CATEGORY_CONNECTIONS_LABEL=Connections
+RESID_TEAMVIEW_CATEGORY_CONNECTIONS_TOOLTIP=Lists all connections in this profile
+
+RESID_TEAMVIEW_CATEGORY_FILTERPOOLS_LABEL=Filter pools
+RESID_TEAMVIEW_CATEGORY_FILTERPOOLS_TOOLTIP=Lists all filter pools and filters in this profile, per subsystem type that contains them.
+
+RESID_TEAMVIEW_CATEGORY_USERACTIONS_LABEL=User actions
+RESID_TEAMVIEW_CATEGORY_USERACTIONS_TOOLTIP=Lists all user actions defined in this profile, per subsystem type that contains them.
+
+RESID_TEAMVIEW_CATEGORY_COMPILECMDS_LABEL=Compile commands
+RESID_TEAMVIEW_CATEGORY_COMPILECMDS_TOOLTIP=Lists all compile commands defined in this profile, per subsystem type that contains them.
+
+RESID_TEAMVIEW_CATEGORY_TARGETS_LABEL=Targets
+RESID_TEAMVIEW_CATEGORY_TARGETS_TOOLTIP=Lists all targets defined in this profile, per subsystem type that contains them. Targets are used in remote-enabled projects.
+
+
+#=============================================================
+# Specific actions. All actions support:
+# .label for button/menu-item text
+# .tooltip for hover help on pushbuttons
+#=============================================================
+##############################################################
+# ACTION LABELS AND DESCRIPTIONS...
+##############################################################
+ACTION_CASCADING_NEW_LABEL=New
+ACTION_CASCADING_NEW_TOOLTIP=Create a new resource
+
+ACTION_CASCADING_GOTO_LABEL=Go To
+ACTION_CASCADING_GOTO_TOOLTIP=Replace view with previous contents
+
+ACTION_CASCADING_GOINTO_LABEL=Go Into
+ACTION_CASCADING_GOINTO_TOOLTIP=Replace view with children of selected resource. Use Go To to return
+
+ACTION_CASCADING_OPEN_LABEL=Open
+ACTION_CASCADING_OPEN_TOOLTIP=Open in editor
+
+ACTION_CASCADING_OPENWITH_LABEL=Open With
+ACTION_CASCADING_OPENWITH_TOOLTIP=Open new view
+
+ACTION_CASCADING_WORKWITH_LABEL=Work With
+ACTION_CASCADING_WORKWITH_TOOLTIP=Work with resources
+
+ACTION_CASCADING_REMOTESERVERS_LABEL=Remote Servers
+ACTION_CASCADING_REMOTESERVERS_TOOLTIP=Start or stop a server/daemon on the remote system
+ACTION_REMOTESERVER_START_LABEL=Start
+ACTION_REMOTESERVER_START_TOOLTIP=Start this server/daemon on the remote system
+ACTION_REMOTESERVER_STOP_LABEL=Stop
+ACTION_REMOTESERVER_STOP_TOOLTIP=Stop this server/daemon on the remote system
+
+ACTION_CASCADING_EXPAND_LABEL=Expand
+ACTION_CASCADING_EXPAND_TOOLTIP=Expand children with or without subsetting criteria
+ACTION_CASCADING_EXPAND_TO_LABEL=Expand To
+ACTION_CASCADING_EXPAND_TO_TOOLTIP=Expand children with subsetting criteria
+ACTION_CASCADING_EXPAND_ALL_LABEL=All
+ACTION_CASCADING_EXPAND_ALL_TOOLTIP=Expand to show all children
+ACTION_CASCADING_EXPAND_BY_LABEL=By New Expansion Filter...
+ACTION_CASCADING_EXPAND_BY_TOOLTIP=Specify subsetting criteria for children
+ACTION_CASCADING_EXPAND_WORKWITH_LABEL=History...
+ACTION_CASCADING_EXPAND_WORKWITH_TOOLTIP=Work with history of expansion filters
+
+ACTION_CASCADING_VIEW_LABEL=View
+ACTION_CASCADING_VIEW_TOOLTIP=Set viewing options
+
+ACTION_CASCADING_USERID_LABEL=Default User ID
+ACTION_CASCADING_USERID_TOOLTIP=Set default user ID per remote system type
+
+ACTION_CASCADING_PREFERENCES_LABEL=Preferences
+ACTION_CASCADING_PREFERENCES_TOOLTIP=Go to the appropriate preferences page
+
+ACTION_CASCADING_TEAM_LABEL=Team
+ACTION_CASCADING_TEAM_TOOLTIP=Team repository related actions
+ACTION_TEAM_SYNC_LABEL=Synchronize with Stream
+ACTION_TEAM_SYNC_TOOLTIP=Send and receive changes to and from team repository
+
+ACTION_CASCADING_PULLDOWN_LABEL=Profile actions
+ACTION_CASCADING_PULLDOWN_TOOLTIP=Remote system profile actions
+
+ACTION_CASCADING_FILTERPOOL_NEWREFERENCE_LABEL=Filter Pool Reference
+ACTION_CASCADING_FILTERPOOL_NEWREFERENCE_TOOLTIP=Add new reference to existing filter pool
+
+ACTION_TEAM_RELOAD_LABEL=Reload Remote System Explorer
+ACTION_TEAM_RELOAD_TOOLTIP=Reload the Remote System Explorer contents, after synchronizing with a shared repository
+
+ACTION_PROFILE_ACTIVATE_LABEL=Active
+ACTION_PROFILE_ACTIVATE_TOOLTIP=Toggle profile between active and not active
+
+ACTION_PROFILE_MAKEACTIVE_LABEL=Make Active
+ACTION_PROFILE_MAKEACTIVE_TOOLTIP=Make the selected profile(s) active, so its connections, filters and so on are visible in the Remote Systems view.
+
+ACTION_PROFILE_MAKEINACTIVE_LABEL=Make Inactive
+ACTION_PROFILE_MAKEINACTIVE_TOOLTIP=Make the selected profile(s) inactive, so its connections, filters and so on are not visible in the Remote Systems view.
+
+ACTION_PROFILE_COPY_LABEL=Duplicate...
+ACTION_PROFILE_COPY_TOOLTIP=Create a copy of this profile, with a new name. Copies all connections, filters, user actions and compile commands.
+
+ACTION_NEWPROFILE_LABEL=Profile...
+ACTION_NEWPROFILE_TOOLTIP=Create a new profile
+
+ACTION_NEW_PROFILE_LABEL=New Profile...
+ACTION_NEW_PROFILE_TOOLTIP=Create a new profile
+
+ACTION_QUALIFY_CONNECTION_NAMES_LABEL=Qualify Connection Names
+ACTION_QUALIFY_CONNECTION_NAMES_TOOLTIP=Show connection and filter pool names qualified by their profile name
+
+ACTION_RESTORE_STATE_PREFERENCE_LABEL=Restore Previous State
+ACTION_RESTORE_STATE_PREFERENCE_TOOLTIP=If selected, the tree is re-expanded to its previous state, upon startup
+
+ACTION_PREFERENCE_SHOW_FILTERPOOLS_LABEL=Show Filter Pools
+ACTION_PREFERENCE_SHOW_FILTERPOOLS_TOOLTIP=Show filter pools when expanding subsystems
+
+ACTION_NEWCONN_LABEL=New Connection...
+ACTION_NEWCONN_TOOLTIP=Define a connection to remote system
+
+ACTION_ANOTHERCONN_LABEL=Connection...
+ACTION_ANOTHERCONN_TOOLTIP=Define another connection to the same or another remote system
+
+ACTION_UPDATECONN_LABEL=Change
+ACTION_UPDATECONN_TOOLTIP=Change information
+
+ACTION_NEWFILTERSTRING_LABEL=Filter String...
+ACTION_NEWFILTERSTRING_TOOLTIP=Create new filter string for this filter
+
+ACTION_ADDFILTERSTRING_LABEL=Add...
+ACTION_ADDFILTERSTRING_TOOLTIP=Create new filter string
+
+ACTION_UPDATEFILTER_LABEL=Change...
+ACTION_UPDATEFILTER_TOOLTIP=Change this filter's name or contents
+
+ACTION_UPDATEFILTERSTRING_LABEL=Change
+ACTION_UPDATEFILTERSTRING_TOOLTIP=Change this filter string
+
+ACTION_TESTFILTERSTRING_LABEL=Test
+ACTION_TESTFILTERSTRING_TOOLTIP=Test this filter string by resolving it
+
+ACTION_NEWFILTER_LABEL=Filter...
+ACTION_NEWFILTER_TOOLTIP=Create new filter for this filter pool
+
+ACTION_NEWNESTEDFILTER_LABEL=Nested Filter...
+ACTION_NEWNESTEDFILTER_TOOLTIP=Create new filter inside this filter
+
+ACTION_UPDATEFILTER_LABEL=Change...
+ACTION_UPDATEFILTER_TOOLTIP=Work with the filter strings in this filter
+
+ACTION_NEWFILTERPOOL_LABEL=Filter Pool...
+ACTION_NEWFILTERPOOL_TOOLTIP=Create new pool to hold filters
+
+ACTION_ADDFILTERPOOLREF_LABEL=Add Filter Pool Reference
+ACTION_ADDFILTERPOOLREF_TOOLTIP=Add a reference to another existing filter pool
+
+ACTION_RMVFILTERPOOLREF_LABEL=Remove Reference
+ACTION_RMVFILTERPOOLREF_TOOLTIP=Remove filter pool reference
+
+ACTION_SELECTFILTERPOOLS_LABEL=Select Filter Pools...
+ACTION_SELECTFILTERPOOLS_TOOLTIP=Add or remove filter pool references
+
+
+RESID_NEWFILTER_PAGE2_NAME_LABEL=Filter name:
+RESID_NEWFILTER_PAGE2_NAME_TOOLTIP=Enter a unique name for this filter, to show in the Remote Systems view
+RESID_NEWFILTER_PAGE2_PROFILE_LABEL=Owner profile:
+RESID_NEWFILTER_PAGE2_PROFILE_TOOLTIP=Select the profile whose default filter pool is to contain the new filter
+RESID_NEWFILTER_PAGE2_POOL_LABEL=Parent filter pool:
+RESID_NEWFILTER_PAGE2_POOL_TOOLTIP=Select the filter pool in which this filter will be created
+RESID_NEWFILTER_PAGE2_UNIQUE_LABEL=Only create filter in this connection
+RESID_NEWFILTER_PAGE2_UNIQUE_TOOLTIP=Select to create filter in this connection only, de-select to create filter in all applicable connections
+
+
+ACTION_WORKWITH_FILTERPOOLS_LABEL=Filter Pools...
+ACTION_WORKWITH_FILTERPOOLS_TOOLTIP=Create or manage filter pools
+
+ACTION_WORKWITH_WWFILTERPOOLS_LABEL=Work With Filter Pools...
+ACTION_WORKWITH_WWFILTERPOOLS_TOOLTIP=Create or manage filter pools
+
+
+ACTION_WORKWITH_PROFILES_LABEL=Work With Profiles
+ACTION_WORKWITH_PROFILES_TOOLTIP=Switch to the Team view to work with profiles
+
+ACTION_RUN_LABEL=Run
+ACTION_RUN_TOOLTIP=Run this prompt. Same as expanding it
+
+ACTION_SIMPLERENAME_LABEL=Rename...
+ACTION_SIMPLERENAME_TOOLTIP=Rename selected resources
+
+ACTION_IMPORT_TO_PROJECT_LABEL= Import To Project...
+ACTION_IMPORT_TO_PROJECT_TOOLTIP= Import contents of selected folder to a project
+
+ACTION_EXPORT_FROM_PROJECT_LABEL= Export From Project...
+ACTION_EXPORT_FROM_PROJECT_TOOLTIP= Export contents of project to the selected folder
+
+ACTION_REFRESH_ALL_LABEL=Refresh All
+ACTION_REFRESH_ALL_TOOLTIP=Refresh all resource information
+
+ACTION_REFRESH_LABEL=Refresh
+ACTION_REFRESH_TOOLTIP=Refresh information of selected resource
+
+
+ACTION_DELETE_LABEL=Delete...
+ACTION_DELETE_TOOLTIP=Prompts for confirmation to delete selected resources
+
+ACTION_RENAME_LABEL=Rename...
+ACTION_RENAME_TOOLTIP=Rename selected resources
+
+ACTION_NEWFILE_LABEL=File
+ACTION_NEWFILE_TOOLTIP=Create a new File
+
+ACTION_CLEAR_LABEL=Clear
+ACTION_CLEAR_TOOLTIP=Clear the default value for the selected key
+
+ACTION_CLEAR_ALL_LABEL=Remove All From View
+ACTION_CLEAR_ALL_TOOLTIP=Remove all items from the view
+
+ACTION_CLEAR_SELECTED_LABEL=Remove Selected From View
+ACTION_CLEAR_SELECTED_TOOLTIP=Remove the selection from the view
+
+ACTION_MOVEUP_LABEL=Move Up
+ACTION_MOVEUP_TOOLTIP=Move selected resources up by one
+
+ACTION_MOVEDOWN_LABEL=Move Down
+ACTION_MOVEDOWN_TOOLTIP=Move selected resources down by one
+
+ACTION_CONNECT_LABEL=Connect...
+ACTION_CONNECT_TOOLTIP=Connect to remote subsystem
+
+ACTION_CLEARPASSWORD_LABEL=Clear Password
+ACTION_CLEARPASSWORD_TOOLTIP=Clear password from memory and disk
+
+ACTION_DISCONNECT_LABEL=Disconnect
+ACTION_DISCONNECT_TOOLTIP=Disconnect from remote subsystem
+
+ACTION_DISCONNECTALLSUBSYSTEMS_LABEL=Disconnect
+ACTION_DISCONNECTALLSUBSYSTEMS_TOOLTIP=Disconnect all subsystems
+
+ACTION_CONNECT_ALL_LABEL=Connect
+ACTION_CONNECT_ALL_TOOLTIP=Connect all subsystems
+
+ACTION_CLEARPASSWORD_ALL_LABEL=Clear Passwords
+ACTION_CLEARPASSWORD_ALL_TOOLTIP=Clear passwords from memory and disk for all subsystems
+
+ACTION_SET_LABEL=Set
+ACTION_SET_TOOLTIP=Set the default value for the selected key
+
+ACTION_HISTORY_DELETE_LABEL=Remove
+ACTION_HISTORY_DELETE_TOOLTIP=Remove this item from the history
+
+ACTION_HISTORY_CLEAR_LABEL=Clear
+ACTION_HISTORY_CLEAR_TOOLTIP=Clear all items in this widget's history
+
+ACTION_HISTORY_MOVEUP_LABEL=Move Up
+ACTION_HISTORY_MOVEUP_TOOLTIP=Move selected item up in history
+
+ACTION_HISTORY_MOVEDOWN_LABEL=Move Down
+ACTION_HISTORY_MOVEDOWN_TOOLTIP=Move selected item down in history
+
+ACTION_HISTORY_MOVEFORWARD_LABEL=Move Forward
+ACTION_HISTORY_MOVEFORWARD_TOOLTIP=Move to the next item in history
+
+ACTION_HISTORY_MOVEBACKWARD_LABEL=Move Backward
+ACTION_HISTORY_MOVEBACKWARD_TOOLTIP=Move to the previous item in history
+
+ACTION_COPY_LABEL=Copy
+ACTION_COPY_TOOLTIP=Copy selected resources to same or different parent
+
+ACTION_CUT_LABEL=Cut
+ACTION_CUT_TOOLTIP=Copy selection to clipboard and delete
+
+ACTION_UNDO_LABEL=Undo
+ACTION_UNDO_TOOLTIP=Undo previous edit action
+
+ACTION_PASTE_LABEL=Paste
+ACTION_PASTE_TOOLTIP=Copy clipboard contents
+
+ACTION_COPY_CONNECTION_LABEL=Copy
+ACTION_COPY_CONNECTION_TOOLTIP=Copy selected connection to same or different profile
+
+ACTION_COPY_FILTERPOOL_LABEL=Copy
+ACTION_COPY_FILTERPOOL_TOOLTIP=Copy selected filter pool to same or different profile
+
+ACTION_COPY_FILTER_LABEL=Copy
+ACTION_COPY_FILTER_TOOLTIP=Copy selected filter to same or different filter pool
+
+ACTION_COPY_FILTERSTRING_LABEL=Copy
+ACTION_COPY_FILTERSTRING_TOOLTIP=Copy selected filter string to same or different filter
+
+ACTION_MOVE_LABEL=Move...
+ACTION_MOVE_TOOLTIP=Move selected resources to a different parent
+
+ACTION_MOVE_CONNECTION_LABEL=Move...
+ACTION_MOVE_CONNECTION_TOOLTIP=Move selected connection to a different profile
+
+ACTION_MOVE_FILTERPOOL_LABEL=Move...
+ACTION_MOVE_FILTERPOOL_TOOLTIP=Move selected filter pool to a different profile
+
+ACTION_MOVE_FILTER_LABEL=Move...
+ACTION_MOVE_FILTER_TOOLTIP=Move selected filter to a different filter pool
+
+ACTION_MOVE_FILTERSTRING_LABEL=Move...
+ACTION_MOVE_FILTERSTRING_TOOLTIP=Move selected filter string to a different filter
+
+ACTION_TEAM_BROWSEHISTORY_LABEL=Show in Resource History
+ACTION_TEAM_BROWSEHISTORY_TOOLTIP=Display the version history of this resource
+
+ACTION_TABLE_LABEL=Show in Table
+ACTION_TABLE_TOOLTIP=Display the contents of this resource in a table
+
+ACTION_MONITOR_LABEL=Monitor
+ACTION_MONITOR_TOOLTIP=Display the contents of this resource in a monitoring table
+
+ACTION_ERROR_LIST_LABEL=Show Subsequent Problems in Error List
+ACTION_ERROR_LIST_TOOLTIP=Display all errors, warnings and informational messages that appear from here on in this shell in the Remote Error List view.
+
+ACTION_FIND_FILES_LABEL=Find Files...
+ACTION_FIND_FILES_TOOLTIP=Search for files under the selected resource
+
+ACTION_SEARCH_LABEL=Search...
+ACTION_SEARCH_TOOLTIP=Opens a dialog to search for text and files
+
+ACTION_CANCEL_FIND_FILES_LABEL=Cancel Find Files
+ACTION_CANCEL_FIND_FILES_TOOLTIP=Terminate find files operation
+
+ACTION_CANCEL_SEARCH_LABEL=Cancel Search
+ACTION_CANCEL_SEARCH_TOOLTIP=Terminate search operation
+
+ACTION_LOCK_LABEL=Lock
+ACTION_LOCK_TOOLTIP=Disable the change of view input from another view.
+
+ACTION_UNLOCK_LABEL=Unlock
+ACTION_UNLOCK_TOOLTIP=Enable the change of view input from another view.
+
+ACTION_POSITIONTO_LABEL=Position To...
+ACTION_POSITIONTO_TOOLTIP=Specify objects for the view to scroll to and select
+
+ACTION_SUBSET_LABEL=Subset...
+ACTION_SUBSET_TOOLTIP=Specify objects for the view to show
+
+ACTION_PRINTLIST_LABEL=Print...
+ACTION_PRINTLIST_TOOLTIP=Print the current table
+
+ACTION_SELECTCOLUMNS_LABEL=Customize Table...
+ACTION_SELECTCOLUMNS_TOOLTIP=Select columns to display in the table
+
+ACTION_OPENEXPLORER_CASCADE_LABEL=Open Explorer
+ACTION_OPENEXPLORER_CASCADE_TOOLTIP=Explore this resource in its own view
+
+ACTION_OPENEXPLORER_SAMEPERSP_LABEL=In Same Perspective
+ACTION_OPENEXPLORER_SAMEPERSP_TOOLTIP=Open a new Remote Systems view rooted at this resource
+
+ACTION_OPENEXPLORER_DIFFPERSP_LABEL=In New Perspective
+ACTION_OPENEXPLORER_DIFFPERSP_TOOLTIP=Open a new Remote System Explorer perspective rooted at this resource
+
+ACTION_OPENEXPLORER_DIFFPERSP2_LABEL=Open in New Window
+ACTION_OPENEXPLORER_DIFFPERSP2_TOOLTIP=Open a new workbench window, with the Remote Systems view rooted at this resource
+
+ACTION_REMOTE_PROPERTIES_LABEL=Properties
+ACTION_REMOTE_PROPERTIES_TOOLTIP=Shows remote object properties
+
+ACTION_VIEWFORM_REFRESH_LABEL=Refresh
+ACTION_VIEWFORM_REFRESH_TOOLTIP=Refresh all resource information from disk
+
+ACTION_VIEWFORM_GETLIST_LABEL=Get List
+ACTION_VIEWFORM_GETLIST_TOOLTIP=Retrieve list and populate tree view
+
+
+ACTION_COMMANDSVIEW_SAVEASFILTER_LABEL=Save as Command Set
+ACTION_COMMANDSVIEW_SAVEASFILTER_TOOLTIP=Save the command as a new Command Set
+
+
+ACTION_EXPAND_SELECTED_LABEL=Expand
+ACTION_EXPAND_SELECTED_TOOLTIP=Expand selected elements. '+'
+
+ACTION_COLLAPSE_SELECTED_LABEL=Collapse
+ACTION_COLLAPSE_SELECTED_TOOLTIP=Collapse selected elements. '-'
+
+ACTION_COLLAPSE_ALL_LABEL=Collapse All
+ACTION_COLLAPSE_ALL_TOOLTIP=Collapse whole tree. Ctrl+-
+
+ACTION_EXPAND_BY_LABEL=Expand By
+ACTION_EXPAND_BY_TOOLTIP=Expand with subsetting
+
+ACTION_EXPAND_ALL_LABEL=All
+ACTION_EXPAND_ALL_TOOLTIP=Show all contents
+
+ACTION_EXPAND_OTHER_LABEL=All
+ACTION_EXPAND_OTHER_TOOLTIP=Specify subset criteria for expansion
+
+ACTION_SELECT_ALL_LABEL=Select All
+ACTION_SELECT_ALL_TOOLTIP=Select all child elements. '+'
+
+ACTION_SELECT_INPUT_LABEL=Select Input...
+ACTION_SELECT_INPUT_DLG=Select Input
+ACTION_SELECT_INPUT_TOOLTIP=Select the input for the view
+
+ACTION_DAEMON_START_LABEL=Start Communications Daemon
+ACTION_DAEMON_START_TOOLTIP=Start the RSE communications daemon
+ACTION_DAEMON_STOP_LABEL=Stop Communications Daemon
+ACTION_DAEMON_STOP_TOOLTIP=Stop the RSE communications daemon
+
+ACTION_SELECTCONNECTION_LABEL=Select Connection
+ACTION_SELECTCONNECTION_TOOLTIP=Bring up a dialog for selecting a connection
+
+RESID_USERID_PER_SYSTEMTYPE_LABEL=Default User ID
+RESID_USERID_PER_SYSTEMTYPE_TOOLTIP=Set default user ID per remote system type
+
+#=============================================================
+# Common actions OR menuitems. All actions support:
+# .label for button/menu-item text
+# .tooltip for hover help on pushbuttons
+#=============================================================
+RESID_CHANGE_PREFIX_LABEL=Change
+RESID_CHANGE_PREFIX_TOOLTIP=Change selected item
+
+RESID_CHANGEVIAENTRY_PREFIX_LABEL=Change
+RESID_CHANGEVIAENTRY_PREFIX_TOOLTIP=Replace selected list item with entry field contents
+
+RESID_ADDVIAENTRY_PREFIX_LABEL=Add
+RESID_ADDVIAENTRY_PREFIX_TOOLTIP=Add entry field contents to list
+
+RESID_COPYFROM_PREFIX_LABEL=Copy From...
+RESID_COPYFROM_PREFIX_TOOLTIP=Copy items here from another source
+
+RESID_COPYTO_PREFIX_LABEL=Copy To...
+RESID_COPYTO_PREFIX_TOOLTIP=Copy selected items
+
+RESID_DUPLICATE_PREFIX_LABEL=Duplicate
+RESID_DUPLICATE_PREFIX_TOOLTIP=Create copy of selected item
+
+
+##############################################################
+# Content Assist action
+##############################################################
+ACTION_CONTENT_ASSIST=Content Assist@Ctrl+SPACE
+ACTION_SHOW_TOOLTIP_INFORMATION=Show Tooltip Description@F2
+
+##############################################################
+# COMMON POPUP MENU ITEMS. MNEMONICS WILL BE ASSIGNED AUTOMATICALLY, DON'T SET THEM HERE.
+# THESE ARE MENU-ONLY ITEMS, VS MENU OR BUTTON ACTIONS.
+# THEY GENERALLY ARE USED IN THE SYSTEM TREE VIEW SOMEWHERE.
+##############################################################
+
+
+
+
+##############################################################
+# ERROR MESSAGES
+##############################################################
+
+RESID_MSG_UNABLETOLOAD=Unable to load message &1
+
+
+##############################################################
+# REMOTE FILE SYSTEM TRANSLATABLE STRINGS
+##############################################################
+#=============================================================
+# DEFAULT FILTERS...
+#=============================================================
+#=============================================================
+# NEW FILE FILTER WIZARD...
+#=============================================================
+
+#=============================================================
+# NEW FILE FILTER STRING WIZARD...
+#=============================================================
+
+
+#=============================================================
+# CHANGE FILE FILTER DIALOG...
+#=============================================================
+
+#=============================================================
+# CHANGE FILE FILTER STRING DIALOG...
+#=============================================================
+
+#=============================================================
+# SELECT DIRECTORY DIALOG...
+#=============================================================
+
+
+#=============================================================
+# SELECT FILE DIALOG...
+#=============================================================
+
+
+#=============================================================
+# SELECT FILE OR MEMBER DIALOG...
+#=============================================================
+
+
+#=============================================================
+# PROMPT FOR HOME FOLDER DIALOG...
+#=============================================================
+
+
+#=============================================================
+# FILE SUBSYSTEM ACTIONS...
+#=============================================================
+
+
+
+
+
+
+
+
+#=============================================================
+# REMOTE FILE SYSTEM PROPERTY VALUES
+#=============================================================
+
+#=============================================================
+# REMOTE FILE PROPERTIES PAGE...
+#=============================================================
+
+#=============================================================
+# RE-USABLE COMPOSITE FILE SYSTEM WIDGETS
+#=============================================================
+#=============================================================
+# REMOTE FILE SYSTEM EXCEPTION ERROR MESSAGES
+#=============================================================
+
+#=============================================================
+# REMOTE FILE SYSTEM ERROR MESSAGES
+#=============================================================
+
+# Remote editing progress monitor messages
+
+# Remote edit functionality
+
+# iSeries Editor Save As... Dialog
+
+# CODE editor
+
+# Default Filter Pool names
+RESID_DEFAULT_FILTERPOOL=%1 Filter Pool
+RESID_PERCONNECTION_FILTERPOOL=%1 Filter Pool for connection %2
+
+# Default Team profile name
+
+#==============================================================
+# Signon Information Preferences Page
+#==============================================================
+RESID_PREF_SIGNON_DESCRIPTION= The following user IDs have password information associated with them:
+
+RESID_PREF_SIGNON_HOSTNAME_TITLE= Host Name
+RESID_PREF_SIGNON_HOSTNAME_LABEL= Host name:
+RESID_PREF_SIGNON_HOSTNAME_TOOLTIP= Hostname or IP address of target system
+
+RESID_PREF_SIGNON_SYSTYPE_TITLE= System Type
+RESID_PREF_SIGNON_SYSTYPE_LABEL= System type:
+RESID_PREF_SIGNON_SYSTYPE_TOOLTIP= System type for the remote system
+
+RESID_PREF_SIGNON_USERID_TITLE= User ID
+RESID_PREF_SIGNON_USERID_LABEL= User ID:
+RESID_PREF_SIGNON_USERID_TOOLTIP= User ID used to signon to the remote system
+
+RESID_PREF_SIGNON_ADD_LABEL= Add...
+RESID_PREF_SIGNON_ADD_TOOLTIP= Add a new user ID and password
+
+RESID_PREF_SIGNON_REMOVE_LABEL= Remove
+RESID_PREF_SIGNON_REMOVE_TOOLTIP= Remove the selected user ID and password
+
+RESID_PREF_SIGNON_CHANGE_LABEL= Change...
+RESID_PREF_SIGNON_CHANGE_TOOLTIP= Change the password for the selected user ID
+
+RESID_PREF_SIGNON_PASSWORD_LABEL= Password:
+RESID_PREF_SIGNON_PASSWORD_TOOLTIP= Enter the password for the remote system
+
+RESID_PREF_SIGNON_PASSWORD_VERIFY_LABEL= Verify password:
+RESID_PREF_SIGNON_PASSWORD_VERIFY_TOOLTIP= Re-enter the password for the remote system
+
+RESID_PREF_SIGNON_ADD_DIALOG_TITLE= New Saved Password
+RESID_PREF_SIGNON_CHANGE_DIALOG_TITLE= Change Saved Password
+
+###################################################################################
+######################## Remote Search View ############################
+###################################################################################
+RESID_SEARCH_VIEW_DEFAULT_TITLE= Remote Search
+RESID_SEARCH_REMOVE_SELECTED_MATCHES_LABEL= Remove Selected Matches
+RESID_SEARCH_REMOVE_SELECTED_MATCHES_TOOLTIP= Remove selected matches
+RESID_SEARCH_REMOVE_ALL_MATCHES_LABEL= Remove All Matches
+RESID_SEARCH_REMOVE_ALL_MATCHES_TOOLTIP= Remove all matches
+RESID_SEARCH_CLEAR_HISTORY_LABEL= Clear History
+RESID_SEARCH_CLEAR_HISTORY_TOOLTIP= Clear all search results
+
+###################################################################################
+############################ Table View Dlgs ############################
+###################################################################################
+RESID_TABLE_SELECT_COLUMNS_AVAILABLE_LABEL= Available contents:
+RESID_TABLE_SELECT_COLUMNS_DISPLAYED_LABEL= Displayed contents:
+RESID_TABLE_SELECT_COLUMNS_DESCRIPTION_LABEL= Choose contents to display in the table view.
+
+
+
+###################################################################################
+############################ Monitor View ############################
+###################################################################################
+RESID_MONITOR_POLL_INTERVAL_LABEL=Wait Interval
+RESID_MONITOR_POLL_INTERVAL_TOOLTIP=Specify how long to wait before refreshing the view
+RESID_MONITOR_POLL_LABEL=Poll
+RESID_MONITOR_POLL_TOOLTIP=Periodically refresh the contents
+RESID_MONITOR_POLL_CONFIGURE_POLLING_LABEL=Poll Configuration
+RESID_MONITOR_POLL_CONFIGURE_POLLING_EXPAND_TOOLTIP=Expand to configure polling
+RESID_MONITOR_POLL_CONFIGURE_POLLING_COLLAPSE_TOOLTIP=Collapse to hide polling controls
+
+###################################################################################
+############################ Work With Compile Commands #####################
+###################################################################################
+
+
+##################################################################################
+############################ Browse menu item ##############################
+##################################################################################
+ACTION_CASCADING_BROWSEWITH_LABEL= Browse With
+ACTION_CASCADING_BROWSEWITH_TOOLTIP= Browse resource
+
+##################################################################################
+############################ Compare menu item #############################
+##################################################################################
+ACTION_CASCADING_COMPAREWITH_LABEL= Compare With
+ACTION_CASCADING_COMPAREWITH_TOOLTIP= Compare remote resources
+##################################################################################
+############################ Replace menu item #############################
+##################################################################################
+ACTION_CASCADING_REPLACEWITH_LABEL= Replace With
+ACTION_CASCADING_REPLACEWITH_TOOLTIP= Remote remote resources with local editions
+
+#=============================================================
+# SELECT REMOTE FILES RE-USABLE WIDGET...
+#=============================================================
+RESID_SELECTFILES_SELECTTYPES_BUTTON_ROOT_LABEL=Select Types
+RESID_SELECTFILES_SELECTTYPES_BUTTON_ROOT_TOOLTIP=Select file types to filter by
+RESID_SELECTFILES_SELECTALL_BUTTON_ROOT_LABEL=Select All
+RESID_SELECTFILES_SELECTALL_BUTTON_ROOT_TOOLTIP=Select all files
+RESID_SELECTFILES_DESELECTALL_BUTTON_ROOT_LABEL=Deselect All
+RESID_SELECTFILES_DESELECTALL_BUTTON_ROOT_TOOLTIP=Deselect all files
+
+
+
+
+# Additions May 15, 2003
+
+##################################################################################
+############################ Offline Support #########################
+##################################################################################
+RESID_OFFLINE_LABEL= Offline
+RESID_OFFLINE_WORKOFFLINE_LABEL= Work Offline
+RESID_OFFLINE_WORKOFFLINE_TOOLTIP= Switch the connection between offline and online modes
+RESID_OFFLINE_WORKOFFLINE_DESCRIPTION= Switch the connection between offline and online modes
+
+#=============================================================
+# ENTER OR SELECT FILE DIALOG...
+#=============================================================
+
+
+##===============================
+# Quick Open
+#================================
+
+#=============================================================
+# RE-USABLE COMPOSITE FILE SYSTEM WIDGETS
+#=============================================================
+
+#==========================
+# Generic Editor Actions
+#==========================
+
+
+###################################################################################
+############################ Table View Dlgs ############################
+###################################################################################
+
+
+RESID_TABLE_POSITIONTO_LABEL=Position To
+RESID_TABLE_POSITIONTO_ENTRY_TOOLTIP=Enter the name filter for the objects that the view is to locate
+RESID_TABLE_SUBSET_LABEL=Subset
+RESID_TABLE_SUBSET_ENTRY_TOOLTIP=Enter a filter pattern for the specified property.
+RESID_TABLE_PRINTLIST_TITLE=Remote Systems Details
+
+
+
+RESID_TABLE_SELECT_COLUMNS_LABEL=Customize Table
+RESID_TABLE_SELECT_COLUMNS_TOOLTIP=Select columns to display in the table
+
+RESID_TABLE_SELECT_COLUMNS_ADD_LABEL=Add>
+RESID_TABLE_SELECT_COLUMNS_ADD_TOOLTIP=Add the selected properties to be displayed as a column in the table
+
+RESID_TABLE_SELECT_COLUMNS_REMOVE_LABEL=
+ * Display.getDefault().syncExec(new DisplayDialogAction(myDialog));
+ *
+ */
+public class DisplayDialogAction implements Runnable {
+
+
+ private Dialog _dialog;
+
+ /**
+ * Constructor for DisplayDialogAction.
+ *
+ * @param dialog The dialog to be displayed.
+ */
+ public DisplayDialogAction(Dialog dialog) {
+ _dialog = dialog;
+ }
+
+ /**
+ * @see java.lang.Runnable#run()
+ */
+ public void run() {
+ boolean finished = false;
+
+ Shell[] shells = Display.getCurrent().getShells();
+ for (int loop = 0; loop < shells.length && !finished; loop++) {
+ if (shells[loop].isEnabled())
+ {
+ _dialog.open();
+ finished = true;
+ }
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/DisplaySystemMessageAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/DisplaySystemMessageAction.java
new file mode 100644
index 00000000000..b777be31142
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/DisplaySystemMessageAction.java
@@ -0,0 +1,64 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.messages.SystemMessageDialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * This class can be used to display SystemMessages via the Display.async
+ * and sync methods.
+ */
+public class DisplaySystemMessageAction implements Runnable {
+
+
+ private SystemMessage message;
+ private int rc;
+
+ public DisplaySystemMessageAction(SystemMessage message) {
+ this.message = message;
+ }
+
+
+ /**
+ * @see Runnable#run()
+ */
+ public void run() {
+ boolean finished = false;
+
+ Shell[] shells = Display.getCurrent().getShells();
+ for (int loop = 0; loop < shells.length && !finished; loop++) {
+ if (shells[loop].isEnabled() && shells[loop].isVisible()) {
+ SystemMessageDialog dialog = new SystemMessageDialog(shells[loop], message);
+ dialog.open();
+ rc = dialog.getButtonPressedId();
+ finished = true;
+ }
+ }
+ }
+
+ /**
+ * Retrieve the return code from displaying the SystemMessageDialog
+ */
+ public int getReturnCode() {
+ return rc;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemAction.java
new file mode 100644
index 00000000000..3ca7006fce0
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemAction.java
@@ -0,0 +1,111 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.widgets.Shell;
+/**
+ * Suggested interface for actions in popup menus of the remote systems explorer view.
+ * While suggested, it is not required to implement this interface.
+ * @see SystemBaseAction
+ */
+public interface ISystemAction extends IAction, ISelectionChangedListener
+{
+
+ // ------------------------
+ // CONFIGURATION METHODS...
+ // ------------------------
+ /**
+ * Set the help id for the action
+ */
+ public void setHelp(String id);
+ /**
+ * Set the context menu group this action is to go into, for popup menus. If not set,
+ * someone else will make this decision.
+ */
+ public void setContextMenuGroup(String group);
+ /**
+ * Is this action to be enabled or disabled when multiple items are selected.
+ */
+ public void allowOnMultipleSelection(boolean allow);
+ /**
+ * Specify whether this action is selection-sensitive. The default is true.
+ * This means the enabled state is tested and set when the selection is set.
+ */
+ public void setSelectionSensitive(boolean sensitive);
+
+ // -----------------------------------------------------------
+ // STATE METHODS CALLED BY VIEWER AT FILL CONTEXT MENU TIME...
+ // -----------------------------------------------------------
+ /**
+ * Set shell of parent window. Remote systems explorer will call this.
+ */
+ public void setShell(Shell shell);
+ /**
+ * Set the Viewer that called this action. It is good practice for viewers to call this
+ * so actions can directly access them if needed.
+ */
+ public void setViewer(Viewer v);
+ /**
+ * Sometimes we can't call selectionChanged() because we are not a selection provider.
+ * In this case, use this to set the selection.
+ */
+ public void setSelection(ISelection selection);
+ /**
+ * An optimization for performance reasons that allows all inputs to be set in one call
+ */
+ public void setInputs(Shell shell, Viewer v, ISelection selection);
+
+
+ // ----------------------------------------------------------------
+ // GET METHODS FOR RETRIEVING STATE OR CONFIGURATION INFORMATION...
+ // ----------------------------------------------------------------
+ /**
+ * Get the help id for this action
+ */
+ public String getHelpContextId();
+ /**
+ * Convenience method to get shell of parent window, as set via setShell.
+ */
+ public Shell getShell();
+ /**
+ * Get the Viewer that called this action. Not guaranteed to be set,
+ * depends if that viewer called setViewer or not. SystemView does.
+ */
+ public Viewer getViewer();
+ /**
+ * Retrieve selection as set by selectionChanged() or setSelection()
+ */
+ public IStructuredSelection getSelection();
+ /**
+ * Get the context menu group this action is to go into, for popup menus. By default is
+ * null, meaning there is no recommendation
+ */
+ public String getContextMenuGroup();
+ /**
+ * Return whether this action is selection-sensitive. The default is true.
+ * This means the enabled state is tested and set when the selection is set.
+ */
+ public boolean isSelectionSensitive();
+ /**
+ * Return if true if this is a dummy action
+ */
+ public boolean isDummy();
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemCopyTargetSelectionCallback.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemCopyTargetSelectionCallback.java
new file mode 100644
index 00000000000..e13e98b3233
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemCopyTargetSelectionCallback.java
@@ -0,0 +1,33 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
+
+
+/**
+ * Callback interface between copy-actions and copy select-target-parent dialogs
+ */
+public interface ISystemCopyTargetSelectionCallback
+{
+
+ /**
+ * This method is a callback from the select-target-parent dialog, allowing us to decide whether the current selected
+ * object is a valid parent object. This affects the enabling of the OK button on that dialog.
+ */
+ public boolean isValidTargetParent(SystemSimpleContentElement selectedElement);
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemDialogAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemDialogAction.java
new file mode 100644
index 00000000000..72f18109ac3
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemDialogAction.java
@@ -0,0 +1,57 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+/**
+ * Suggested interface for actions in popup menus of the remote systems explorer view,
+ * which put up dialogs.
+ * @see SystemBaseDialogAction
+ */
+public interface ISystemDialogAction extends ISystemAction
+{
+ /*
+ * Return the parent window/dialog of this action. Same as getShell()
+ *
+ public Shell getParent();*/
+
+ /*
+ * Set the parent window/dialog of this action. Same as setShell(Shell parent)
+ *
+ public void setParent(Shell parent);*/
+
+ /**
+ * Set the value used as input to the dialog. Usually for update mode.
+ * This is an alternative to selectionChanged or setSelection, as typically it is
+ * the selection that is used as the input to the dialog.
+ */
+ public void setValue(Object value);
+ /**
+ * If this action supports allowOnMultipleSelection, then whether the action is to
+ * be invoked once per selected item (false), or once for all selected items (true)
+ */
+ public void setProcessAllSelections(boolean all);
+
+ /**
+ * Get the output of the dialog.
+ */
+ public Object getValue();
+ /**
+ * Returns true if the user cancelled the dialog.
+ * The default way to guess at this is to test if the output from
+ * getDialogValue was null or not. Override if you need to refine this.
+ */
+ public boolean wasCancelled();
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemDynamicPopupMenuExtension.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemDynamicPopupMenuExtension.java
new file mode 100644
index 00000000000..fb197d33fdc
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemDynamicPopupMenuExtension.java
@@ -0,0 +1,44 @@
+/********************************************************************************
+ * Copyright (c) 2005, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * Required interface for use in making contributions view the
+ * adapter menu extension extension point (org.eclipse.rse.core.dynamicPopupMenuActions).
+ */
+public interface ISystemDynamicPopupMenuExtension
+{
+ /**
+ * Returns true if this menu extension supports the specified selection.
+ * @param selection the resources to contriubte menu items to
+ * @return true if the extension will be used for menu population
+ */
+ public boolean supportsSelection(IStructuredSelection selection);
+
+ /**
+ * Populates the menu with specialized actions.
+ * @param shell the shell
+ * @param menu the menu to contribute actions to
+ * @param menuGroup the defect menu group to add actions to
+ * @param selection the resources to contriubte menu items to
+ *
+ */
+ public void populateMenu(Shell shell, IMenuManager menu, IStructuredSelection selection, String menuGroup);
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemDynamicPopupMenuExtensionManager.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemDynamicPopupMenuExtensionManager.java
new file mode 100644
index 00000000000..4b7c976d85f
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemDynamicPopupMenuExtensionManager.java
@@ -0,0 +1,23 @@
+/********************************************************************************
+ * Copyright (c) 2004, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+/**
+ * @author dmcknigh
+ */
+public interface ISystemDynamicPopupMenuExtensionManager {
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemWizardAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemWizardAction.java
new file mode 100644
index 00000000000..815353eaddc
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemWizardAction.java
@@ -0,0 +1,25 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+/**
+ * Suggested interface for actions in popup menus of the remote systems explorer view,
+ * which put up wizards.
+ * @see SystemBaseWizardAction
+ */
+public interface ISystemWizardAction extends ISystemDialogAction
+{
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemAbstractPopupMenuExtensionAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemAbstractPopupMenuExtensionAction.java
new file mode 100644
index 00000000000..53878e750ff
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemAbstractPopupMenuExtensionAction.java
@@ -0,0 +1,393 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+
+import java.util.Iterator;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
+import org.eclipse.rse.model.IHost;
+import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IActionDelegate;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+
+
+/**
+ * This is a base class to simplify the creation of actions supplied via the
+ * org.eclipse.rse.core.popupMenus extension point.
+ *
+ *
+ * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter
+ * @see org.eclipse.rse.ui.dialogs.SystemPromptDialog
+ */
+public abstract class SystemAbstractPopupMenuExtensionAction implements IObjectActionDelegate
+{
+ protected IWorkbenchPart viewPart = null;
+ protected IStructuredSelection sel = null;
+ protected IAction proxyAction;
+ protected Shell shell;
+ protected static final Object[] EMPTY_ARRAY = new Object[0];
+
+ /**
+ * Constructor
+ */
+ public SystemAbstractPopupMenuExtensionAction()
+ {
+ super();
+ }
+
+ // ------------------------
+ // OVERRIDABLE METHODS...
+ // ------------------------
+
+ /**
+ * The user has selected this action. This is where the actual code for the action goes.
+ */
+ public abstract void run();
+
+ /**
+ * The user has selected one or more objects. This is an opportunity to enable/disable
+ * this action based on the current selection. By default, it is always enabled. Return
+ * false to disable it.
+ */
+ public boolean getEnabled(Object[] currentlySelected)
+ {
+ return true;
+ }
+
+ // ---------------------------------
+ // IOBJECTACTIONDELEGATE METHODS...
+ // ---------------------------------
+
+ /**
+ * @see IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart)
+ */
+ public void setActivePart(IAction action, IWorkbenchPart part)
+ {
+ this.viewPart = part;
+ this.proxyAction = action;
+ this.shell = part.getSite().getShell();
+ }
+ /**
+ * Get the current view part.
+ * Handy for things like getting the shell.
+ */
+ public IWorkbenchPart getActivePart()
+ {
+ return viewPart;
+ }
+
+ /**
+ * The Eclipse-supplied proxy action has been selected to run.
+ * This is the foreward to us, the actual action. This method's default
+ * implementation is to simply call {@link #run()}.
+ *
+ * @see IActionDelegate#run(IAction)
+ */
+ public void run(IAction action)
+ {
+ run();
+ }
+
+ /**
+ * Called by Eclipse when the user selects something. Our opportunity
+ * to enable or disable this menu item. The default implementation of this
+ * method calls getEnabled to determine if the proxy action should be enabled
+ * or not, then calls setEnabled on that proxy action with the result.
+ *
+ * @see IActionDelegate#selectionChanged(IAction, ISelection)
+ */
+ public void selectionChanged(IAction action, ISelection sel)
+ {
+ if (!action.isEnabled())
+ return; // defect 43471: we were overriding the enableFor attribute enablement
+ if (sel instanceof IStructuredSelection)
+ {
+ this.sel = (IStructuredSelection)sel;
+ action.setEnabled(getEnabled(getSelectedRemoteObjects()));
+ }
+ else
+ {
+ this.sel = null;
+ action.setEnabled(false);
+ }
+ }
+
+ // ---------------------------------------------
+ // CONVENIENCE METHODS FOR SUBCLASSES TO USE...
+ // ---------------------------------------------
+ /**
+ * For toggle actions (attribute state specified in action tag), set the toggle state
+ */
+ public void setChecked(boolean checked)
+ {
+ proxyAction.setChecked(checked);
+ }
+
+ /**
+ * Change the enabled state of the action
+ */
+ public void setEnabled(boolean enabled)
+ {
+ proxyAction.setEnabled(enabled);
+ }
+
+ /**
+ * Return the proxy action for this action delegate
+ */
+ public IAction getProxyAction()
+ {
+ return proxyAction;
+ }
+
+ /**
+ * Return the shell hosting this action
+ */
+ public Shell getShell()
+ {
+ return shell;
+ }
+
+ /**
+ * Retrieve the current selected objects as a structured selection
+ */
+ public IStructuredSelection getSelection()
+ {
+ return sel;
+ }
+ /**
+ * Retrieve the number of items currently selected
+ */
+ public int getSelectionCount()
+ {
+ return ((sel==null)?0:sel.size());
+ }
+
+ /**
+ * Retrieve the currently selected objects as an array of Object objects.
+ * Array may be length 0, but will never be null, for convenience.
+ * To do anything interesting with the object, you will also need to retrieve its adapter
+ * @see #getRemoteAdapter(Object)
+ */
+ public Object[] getSelectedRemoteObjects()
+ {
+ Object[] seld = new Object[(sel!=null) ? sel.size() : 0];
+ if (sel == null)
+ return seld;
+ Iterator i = sel.iterator();
+ int idx=0;
+ while (i.hasNext())
+ seld[idx++] = i.next();
+ return seld;
+ }
+ /**
+ * Retrieve the first selected object, for convenience.
+ * Will be null if there is nothing selected
+ * To do anything interesting with the object, you will also need to retrieve its adapter
+ * @see #getRemoteAdapter(Object)
+ */
+ public Object getFirstSelectedRemoteObject()
+ {
+ if (sel == null)
+ return null;
+ return sel.getFirstElement();
+ }
+ /**
+ * Retrieve the adapters of the currently selected objects as an array of ISystemRemoteElementAdapter objects.
+ * Array may be length 0, but will never be null, for convenience.
+ */
+ public ISystemRemoteElementAdapter[] getSelectedRemoteObjectAdapters()
+ {
+ ISystemRemoteElementAdapter[] seld = new ISystemRemoteElementAdapter[(sel!=null) ? sel.size() : 0];
+ if (sel == null)
+ return seld;
+ Iterator i = sel.iterator();
+ int idx=0;
+ while (i.hasNext())
+ seld[idx++] = getRemoteAdapter(i.next());
+ return seld;
+ }
+ /**
+ * Retrieve the adapter of the first selected object as an ISystemRemoteElementAdapter object, for convenience.
+ * Will be null if there is nothing selected
+ */
+ public ISystemRemoteElementAdapter getFirstSelectedRemoteObjectAdapter()
+ {
+ if (sel == null)
+ return null;
+ return getRemoteAdapter(sel.getFirstElement());
+ }
+
+ /**
+ * Returns the implementation of ISystemRemoteElementAdapter for the given
+ * object. Returns null if this object does not adaptable to this.
+ */
+ public ISystemRemoteElementAdapter getRemoteAdapter(Object o)
+ {
+ if (!(o instanceof IAdaptable))
+ return (ISystemRemoteElementAdapter)Platform.getAdapterManager().getAdapter(o,ISystemRemoteElementAdapter.class);
+ return (ISystemRemoteElementAdapter)((IAdaptable)o).getAdapter(ISystemRemoteElementAdapter.class);
+ }
+
+ /**
+ * Returns the name of the given remote object, given its remote object adapter.
+ * Same as adapter.getName(obj);
+ */
+ public String getRemoteObjectName(Object obj, ISystemRemoteElementAdapter adapter)
+ {
+ return adapter.getName(obj);
+ }
+ /**
+ * Returns the id of the subsystem factory of the given remote object, given its remote object adapter.
+ * Same as adapter.getSubSystemFactoryId(obj);
+ */
+ public String getRemoteObjectSubSystemFactoryId(Object obj, ISystemRemoteElementAdapter adapter)
+ {
+ return adapter.getSubSystemFactoryId(obj);
+ }
+ /**
+ * Returns the type category of the given remote object, given its remote object adapter.
+ * Same as adapter.getRemoteTypeCategory(obj);
+ */
+ public String getRemoteObjectTypeCategory(Object obj, ISystemRemoteElementAdapter adapter)
+ {
+ return adapter.getRemoteTypeCategory(obj);
+ }
+ /**
+ * Returns the type of the given remote object, given its remote object adapter.
+ * Same as adapter.getRemoteType(obj);
+ */
+ public String getRemoteObjectType(Object obj, ISystemRemoteElementAdapter adapter)
+ {
+ return adapter.getRemoteType(obj);
+ }
+ /**
+ * Returns the subtype of the given remote object, given its remote object adapter.
+ * Same as adapter.getRemoteSubType(obj);
+ */
+ public String getRemoteObjectSubType(Object obj, ISystemRemoteElementAdapter adapter)
+ {
+ return adapter.getRemoteSubType(obj);
+ }
+ /**
+ * Returns the sub-subtype of the given remote object, given its remote object adapter.
+ * Same as adapter.getRemoteSubSubType(obj);
+ */
+ public String getRemoteObjectSubSubType(Object obj, ISystemRemoteElementAdapter adapter)
+ {
+ return adapter.getRemoteSubSubType(obj);
+ }
+ /**
+ * Returns the subsystem from which the selected remote objects were resolved.
+ */
+ public ISubSystem getSubSystem()
+ {
+ ISystemRemoteElementAdapter ra = getFirstSelectedRemoteObjectAdapter();
+ if (ra != null)
+ return ra.getSubSystem(getFirstSelectedRemoteObject());
+ else
+ return null;
+ }
+ /**
+ * Returns the subsystem factory which owns the subsystem from which the selected remote objects were resolved
+ */
+ public ISubSystemConfiguration getSubSystemFactory()
+ {
+ ISubSystem ss = getSubSystem();
+ if (ss != null)
+ return ss.getSubSystemConfiguration();
+ else
+ return null;
+ }
+
+ /**
+ * Return the SystemConnection from which the selected remote objects were resolved
+ */
+ public IHost getSystemConnection()
+ {
+ IHost conn = null;
+ ISystemRemoteElementAdapter ra = getFirstSelectedRemoteObjectAdapter();
+ if (ra != null)
+ {
+ ISubSystem ss = ra.getSubSystem(getFirstSelectedRemoteObject());
+ if (ss != null)
+ conn = ss.getHost();
+ }
+ return conn;
+ }
+
+
+
+
+
+ /**
+ * Debug method to print out details of given selected object...
+ */
+ public void printTest()
+ {
+ System.out.println("Testing. Number of selected objects = "+getSelectionCount());
+ Object obj = getFirstSelectedRemoteObject();
+ if (obj == null)
+ System.out.println("selected obj is null");
+ else
+ {
+ ISystemRemoteElementAdapter adapter = getRemoteAdapter(obj);
+ System.out.println();
+ System.out.println("REMOTE INFORMATION FOR FIRST SELECTION");
+ System.out.println("--------------------------------------");
+ System.out.println("Remote object name................: " + getRemoteObjectName(obj,adapter));
+ System.out.println("Remote object subsystem factory id: " + getRemoteObjectSubSystemFactoryId(obj,adapter));
+ System.out.println("Remote object type category.......: " + getRemoteObjectTypeCategory(obj,adapter));
+ System.out.println("Remote object type ...............: " + getRemoteObjectType(obj,adapter));
+ System.out.println("Remote object subtype ............: " + getRemoteObjectSubType(obj,adapter));
+ System.out.println("Remote object subsubtype .........: " + getRemoteObjectSubSubType(obj,adapter));
+ System.out.println();
+ }
+ System.out.println();
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemBaseAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemBaseAction.java
new file mode 100644
index 00000000000..7bc7189f206
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemBaseAction.java
@@ -0,0 +1,818 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+import java.util.Iterator;
+import java.util.Vector;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.rse.core.SystemAdapterHelpers;
+import org.eclipse.rse.core.SystemBasePlugin;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.model.IHost;
+import org.eclipse.rse.ui.SystemWidgetHelpers;
+import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
+import org.eclipse.rse.ui.view.ISystemTree;
+import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * A suggested base class for remote systems related actions.
+ *
+ *
+ * There are many constructors but they can be broken down into permutations of the following info:
+ *
+ *
+ *
+ * AS_PUSH_BUTTON
, AS_CHECK_BOX
,
+ * AS_DROP_DOWN_MENU
, AS_RADIO_BUTTON
, and AS_UNSPECIFIED
.
+ * @param shell Shell of parent window. Can be null if you don't know it, but call setShell when you do.
+ */
+ public SystemBaseAction(String text, String tooltip, String description, ImageDescriptor image, int style, Shell shell)
+ {
+ super(text, style);
+ this.shell = shell;
+ if (image != null)
+ setImageDescriptor(image);
+ if (tooltip != null)
+ setToolTipText(tooltip);
+ if (description != null)
+ setDescription(description);
+ //setTracing("SystemFilterPoolReferenceSelectAction");
+ }
+
+
+ /**
+ * Used for actions with no image icon.
+ * Constructor for SystemBaseAction when translated label is known. You must separately
+ * call setToolTipText and setDescription to enable these if desired.
+ * @param text string to display in menu or toolbar
+ * @param shell Shell of parent window. Can be null if you don't know it, but call setShell when you do.
+ */
+ public SystemBaseAction(String text, Shell shell)
+ {
+ this(text, null, null, null, shell);
+ }
+ /**
+ * Used for actions with no image icon.
+ * Constructor for SystemBaseAction when translated label and tooltip are known. You must
+ * separately call setDescription to enable this if desired.
+ * @param text string to display in menu or toolbar
+ * @param tooltip string to display when user hovers mouse over action.
+ * @param shell Shell of parent window. Can be null if you don't know it, but call setShell when you do.
+ */
+ public SystemBaseAction(String text, String tooltip, Shell shell)
+ {
+ this(text, tooltip, null, null, shell);
+ }
+ /**
+ * Used for actions with no image icon.
+ * Constructor for SystemBaseAction when translated label and tooltip and description are
+ * all known.
+ * @param text string to display in menu or toolbar
+ * @param tooltip string to display when user hovers mouse over action.
+ * @param description string displayed in status bar of some displays. Longer than tooltip.
+ * @param shell Shell of parent window. Can be null if you don't know it, but call setShell when you do.
+ */
+ public SystemBaseAction(String text, String tooltip, String description, Shell shell)
+ {
+ this(text, tooltip, description, null, shell);
+ }
+
+
+ // ------------------------
+ // HELPER METHODS...
+ // ------------------------
+
+ /**
+ * Set the cursor to the wait cursor (true) or restores it to the normal cursor (false).
+ */
+ public void setBusyCursor(boolean setBusy)
+ {
+ if (setBusy)
+ {
+ // Set the busy cursor to all shells.
+ Display d = getShell().getDisplay();
+ waitCursor = new Cursor(d, SWT.CURSOR_WAIT);
+ setDisplayCursor(waitCursor);
+ }
+ else
+ {
+ setDisplayCursor(null);
+ if (waitCursor != null)
+ waitCursor.dispose();
+ waitCursor = null;
+ }
+ }
+ /**
+ * Sets the given cursor for all shells currently active
+ * for this window's display.
+ *
+ * @param c the cursor
+ */
+ protected void setDisplayCursor(Cursor c)
+ {
+ setDisplayCursor(getShell(), c);
+ }
+ /**
+ * Sets the given cursor for all shells currently active for the given shell's display.
+ *
+ * @param c the cursor
+ */
+ public static void setDisplayCursor(Shell shell, Cursor c)
+ {
+ if (c == null)
+ {
+ // attempt to fix problem that the busy cursor sometimes stays. Phil
+ shell.forceActive();
+ shell.forceFocus();
+ }
+ Shell[] shells = shell.getDisplay().getShells();
+ for (int i = 0; i < shells.length; i++)
+ {
+ shells[i].setCursor(c);
+ }
+ }
+ /**
+ * Turn on tracing for selections, shell and viewer to watch as it is set
+ */
+ protected void setTracing(boolean tracing)
+ {
+ traceSelections = tracing;
+ }
+ /**
+ * Turn on tracing for selections, shell and viewer to watch as it is set,
+ * scoped to a particular class name (will use indexOf('xxx') to match).
+ */
+ protected void setTracing(String tracingClassTarget)
+ {
+ traceSelections = true;
+ traceTarget = tracingClassTarget;
+ }
+ /**
+ * Issue trace message
+ */
+ protected void issueTraceMessage(String msg)
+ {
+ if (traceSelections)
+ {
+ String className = this.getClass().getName();
+ if ((traceTarget==null) || (className.indexOf(traceTarget)>=0))
+ SystemBasePlugin.logInfo(this.getClass().getName()+": "+getText()+": "+msg);
+ }
+ }
+
+ /**
+ * Returns the implementation of ISystemViewElement for the given
+ * object. Returns null if the adapter is not defined or the
+ * object is not adaptable.
+ */
+ protected ISystemViewElementAdapter getAdapter(Object o)
+ {
+ return SystemAdapterHelpers.getAdapter(o);
+ }
+ /**
+ * Returns the implementation of ISystemRemoteElement for the given
+ * object. Returns null if this object does not adaptable to this.
+ */
+ protected ISystemRemoteElementAdapter getRemoteAdapter(Object o)
+ {
+ return SystemAdapterHelpers.getRemoteAdapter(o);
+ }
+
+ // -----------------------------------------------------------
+ // CONFIGURATION METHODS...
+ // -----------------------------------------------------------
+
+ /**
+ * An optimization for performance reasons that allows all inputs to be set in one call
+ */
+ public void setInputs(Shell shell, Viewer v, ISelection selection)
+ {
+ if (traceSelections)
+ issueTraceMessage(" INSIDE SETINPUTS IN BASE ACTION CLASS");
+ setShell(shell);
+ setViewer(v);
+ setSelection(selection);
+ }
+
+ /**
+ * Sets the parent shell for this action. Usually context dependent.
+ */
+ public void setShell(Shell shell)
+ {
+ // in defect 42399 it was reported the shell for persistent actions gets reset in browse
+ // dialogs, on a right click, overriding the real shell with the browse dialog's shell.
+ // When the browse dialog is closed, we only retain the disposed shell. To solve this
+ // we have to return a stack of shells and on getShell peel back to the last non-disposed
+ // one...
+ this.previousShells.add(this.shell);
+ this.shell = shell;
+ if (traceSelections)
+ issueTraceMessage(" INSIDE SETSHELL. shell = " + shell);
+ }
+ /**
+ * Set the Viewer that called this action. It is good practice for viewers to call this
+ * so actions can directly access them if needed.
+ */
+ public void setViewer(Viewer v)
+ {
+ this.previousViewers.add(this.viewer); // see comment in setShell
+ this.viewer = v;
+ if (traceSelections)
+ issueTraceMessage(" INSIDE SETVIEWER. viewer = " + viewer);
+ }
+ /**
+ * This is called when the user selects something in the tree.
+ * This is your opportunity to disable the action based on the current selection.
+ * The default implementation of this method:
+ *
+ *
+ */
+ public void selectionChanged(SelectionChangedEvent event)
+ {
+ ISelection selection = event.getSelection();
+ if (traceSelections)
+ issueTraceMessage("INSIDE SELECTIONCHANGED. Selection null? " + (selection==null));
+ setSelection(selection);
+ }
+ /**
+ * This is called by the UI calling the action, if that UI is not a selection provider.
+ * That is, this is an alternative to calling selectionChanged when there is no SelectionChangedEvent.
+ * @see #selectionChanged(SelectionChangedEvent event)
+ */
+ public void setSelection(ISelection selection)
+ {
+ if (traceSelections)
+ issueTraceMessage(" INSIDE SETSELECTION. Selection null? " + (selection==null));
+ if ( !(selection instanceof IStructuredSelection) )
+ {
+ if (selectionSensitive)
+ setEnabled(false);
+ if (traceSelections)
+ System.out.println(this.getClass().getName() + ". Returning false in setSelection. selection= " + selection);
+ return;
+ }
+ if (selectionSensitive)
+ {
+ // see comment in setShell
+ //this.previousSelections.add(this.sSelection);
+ }
+ sSelection = (IStructuredSelection)selection;
+ if (!selectionSensitive || (selection == null))
+ {
+ if (traceSelections)
+ System.out.println(this.getClass().getName() + ". Returning. selectionSensitive = " + selectionSensitive);
+ return;
+ }
+ boolean multiSelect = (sSelection.size() > 1);
+ if (!allowOnMultipleSelection && multiSelect)
+ {
+ setEnabled(false);
+ if (traceSelections)
+ System.out.println(this.getClass().getName() + ". Returning false in setSelection. #selected = " + sSelection.size());
+ }
+ else
+ {
+ boolean enable = false;
+ /*
+ boolean debug = getText().equals("Copy");
+ if (debug)
+ enable = updateSelection(sSelection);
+ else */
+ enable = updateSelection(sSelection);
+ setEnabled(enable);
+ }
+ }
+ /**
+ * Identify the UI object that will be used to get the selection
+ * list from. Only call this if your action is displayed in a toolbar
+ * or non-popup menu, as it will impact performance. It results in your
+ * action getting called every time the user changes his selection in
+ * the given provider viewer.
+ */
+ public void setSelectionProvider(ISelectionProvider provider)
+ {
+ if (fSelectionProvider != null)
+ fSelectionProvider.removeSelectionChangedListener(this);
+
+ fSelectionProvider = provider;
+ if (traceSelections)
+ issueTraceMessage(" INSIDE SETSELECTIONPROVIDER. fSelectionProvider = " + fSelectionProvider);
+
+
+ if (fSelectionProvider != null)
+ fSelectionProvider.addSelectionChangedListener(this);
+ }
+
+
+ // ---------------------------------------------------------------------------
+ // CONFIGURATION METHODS CHILD CLASSES OR OTHERS CALL TO CONFIGURE THIS ACTION
+ // ---------------------------------------------------------------------------
+ /**
+ * Set the help id for the action
+ */
+ public void setHelp(String id)
+ {
+ SystemWidgetHelpers.setHelp(this, id);
+ this.helpId = id;
+ }
+
+ /**
+ * Set the context menu group this action is to go into, for popup menus. If not set,
+ * someone else will make this decision.
+ */
+ public void setContextMenuGroup(String group)
+ {
+ contextMenuGroup = group;
+ }
+ /**
+ * This method is supplied for actions that are to be enable even when more than
+ * one item is selected. The default is to only enable on single selections.
+ */
+ public void allowOnMultipleSelection(boolean allow)
+ {
+ allowOnMultipleSelection = allow;
+ }
+ /**
+ * Specify whether this action is selection-sensitive. The default is true.
+ * This means the enabled state is tested and set when the selection is set.
+ */
+ public void setSelectionSensitive(boolean sensitive)
+ {
+ selectionSensitive = sensitive;
+ }
+
+ // ---------------------------------------------------------------------------
+ // METHODS THAT CAN OR SHOULD BE OVERRIDDEN BY CHILD CLASSES...
+ // ---------------------------------------------------------------------------
+
+ /**
+ * First opportunity to decide if the action should be enabled or not based on the
+ * current selection. Called by default implementation of selectionChanged, which
+ * converts the ISelection to an IStructuredSelection, which is all we support. The
+ * return result is used to enable or disable this action.
+ *
+ *
+ * If desired, override this method for a different algorithm to decide enablement.
+ */
+ public boolean updateSelection(IStructuredSelection selection)
+ {
+ boolean enable = true;
+ Iterator e= ((IStructuredSelection) selection).iterator();
+ while (enable && e.hasNext())
+ {
+ enable = checkObjectType(e.next());
+ }
+ return enable;
+ }
+
+ /**
+ * Second and easiest opportunity to decide if the action should be enabled or not based
+ * on the current selection. Called by default implementation of updateSelection, once for
+ * each item in the selection. If any call to this returns false, the action is disabled.
+ * The default implementation returns true.
+ */
+ public boolean checkObjectType(Object selectedObject)
+ {
+ return true;
+ }
+
+
+ /**
+ * This is the method called when the user selects this action.
+ * Child classes need to override this. If you need the parent shell,
+ * call getShell. If you need to know the current selection, call
+ * getSelection(), or getFirstSelection() followed by getNextSelection()
+ * until null is returned.
+ * @see Action#run()
+ */
+ public void run()
+ {
+
+ }
+
+
+ // -----------------------------------------------------------
+ // GETTER METHODS RETURNING INFORMATION CAPTURED IN BASE CLASS
+ // -----------------------------------------------------------
+ /**
+ * Return if true if this is a dummy action
+ */
+ public boolean isDummy()
+ {
+ String label = getText();
+ if (label == null)
+ return false;
+ return label.equals("dummy");
+ }
+
+ /**
+ * Retrieve the help id for this action
+ */
+ public String getHelpContextId()
+ {
+ return helpId;
+ }
+
+ /**
+ * Retrieves the parent shell for this action. Will be null if setShell has not been called.
+ */
+ public Shell getShell()
+ {
+ return internalGetShell(true);
+ }
+ /**
+ * Retrieves the parent shell for this action. Will be null if setShell has not been called.
+ * Method for subclasses that want to call this and not do the test for null.
+ */
+ protected Shell getShell(boolean doTest)
+ {
+ return internalGetShell(doTest);
+ }
+ /**
+ * Abstraction
+ */
+ private Shell internalGetShell(boolean doTest)
+ {
+ // in defect 42399 it was reported the shell for persistent actions gets reset in browse
+ // dialogs, on a right click, overriding the real shell with the browse dialog's shell.
+ // When the browse dialog is closed, we only retain the disposed shell. To solve this
+ // we have to return a stack of shells and on getShell peel back to the last non-disposed
+ // one...
+ if ((shell!=null) && (shell.isDisposed()))
+ {
+ boolean found = false;
+ Vector disposedShells = new Vector();
+ for (int idx=previousShells.size()-1; !found && (idx>=0); idx--)
+ {
+ shell = (Shell)previousShells.elementAt(idx);
+ if (shell.isDisposed())
+ disposedShells.add(shell);
+ else
+ found = true;
+ }
+ if (!found)
+ shell = null;
+ for (int idx=0; idx
+ *
+ * If this action is to be enabled when multiple items are selected
+ * (the default) then the processing above is repeated once for every object
+ * selected. If your dialog actually processes all the selected items, then
+ * call setProcessAllSelections(true) to change the behaviour to only do all
+ * of this once. In this case setInputObject will be called with the
+ * entire IStructuredSelection object, and your dialog code can process each
+ * of the objects in it.
+ *
+ * @param menu The cascading menu, which is created for you. Add your actions to it.
+ * @return The given menu if you just populated it, or a new menu if you want to create the menu yourself.
+ */
+ public abstract IMenuManager populateSubMenu(IMenuManager menu);
+
+ /**
+ * Return the MenuManager object. It is this that is added to the primary popup menu.
+ */
+ public IMenuManager getSubMenu()
+ {
+ if ((subMenu == null) || createMenuEachTime)
+ {
+ if (menuID == null)
+ {
+ if (test)
+ subMenu = new SystemSubMenuManagerForTesting(this,actionLabel);
+ else
+ subMenu = new SystemSubMenuManager(this,actionLabel);
+ }
+ else
+ {
+ if (test)
+ subMenu = new SystemSubMenuManagerForTesting(this, actionLabel, menuID);
+ else
+ subMenu = new SystemSubMenuManager(this,actionLabel, menuID);
+ }
+ createStandardGroups(subMenu);
+ subMenu.setTracing(traceSelections, traceTarget);
+ populateSubMenu(subMenu);
+ if (traceSelections)
+ {
+ issueTraceMessage("*** INSIDE GETSUBMENU for "+actionLabel+". createMenuEachTime = " + createMenuEachTime);
+ }
+ subMenu.setToolTipText(getToolTipText());
+ //cascadeAllInputs(); no point in doing in now, setInputs will be called later by SV
+ subMenu.addMenuListener(createMnemonicsListener(!populateMenuEachTime));
+ }
+ else if (populateMenuEachTime)
+ {
+ subMenu.removeAll();
+ createStandardGroups(subMenu);
+ populateSubMenu(subMenu);
+ if (traceSelections)
+ {
+ issueTraceMessage("*** INSIDE GETSUBMENU for "+actionLabel+". populateMenuEachTime = " + populateMenuEachTime);
+ }
+ //cascadeAllInputs(); no point in doing in now, setInputs will be called later by SV
+ //Menu m = subMenu.getMenu();
+ //System.out.println("SubMenu's menu null? " + (m==null));
+ //if (m != null)
+ //m.addMenuListener(new SystemViewMenuListener());
+ }
+ else if (traceSelections)
+ {
+ issueTraceMessage("*** INSIDE GETSUBMENU for "+actionLabel+". SUBMENU ALREADY CREATED. ");
+ }
+
+ return subMenu;
+ }
+ /**
+ * Creates the standard groups for the context sub-menu.
+ */
+ protected void createStandardGroups(IMenuManager menu)
+ {
+ if (!menu.isEmpty())
+ return;
+ // simply sets partitions in the menu, into which actions can be directed.
+ // Each partition can be delimited by a separator (new Separator) or not (new GroupMarker).
+ // Deleted groups are not used yet.
+ //... decided it is better to let this get created when needed, else will be at the top of the menu.
+ //menu.add(new Separator(ISystemContextMenuConstants.GROUP_ADDITIONS)); // user or BP/ISV additions
+
+ }
+
+ /**
+ * Return the actions currently in the menu.
+ * Never returns null, but may return an empty array.
+ */
+ public IAction[] getActions()
+ {
+ //System.out.println("in getActions. subMenu null? "+(subMenu==null));
+ if (subMenu==null)
+ return EMPTY_ACTION_ARRAY;
+ else
+ {
+ IContributionItem[] items = subMenu.getItems();
+ //System.out.println("in getActions. #items "+items.length);
+ Vector v = new Vector();
+ for (int idx=0; idx
+ * menu.add(new MyAction1());
+ *
+ *
+ *
+ */
+ protected Dialog createDialog(Shell shell)
+ {
+ newWizard = createWizard();
+
+ if ((newWizard instanceof Wizard) && wasNeedsProgressMonitorSet())
+ ((Wizard)newWizard).setNeedsProgressMonitor(getNeedsProgressMonitor());
+
+ if (newWizard instanceof Wizard)
+ {
+ if (wizardTitle != null)
+ ((Wizard)newWizard).setWindowTitle(wizardTitle);
+ if (wizardImage != null)
+ ((Wizard)newWizard).setDefaultPageImageDescriptor(wizardImage);
+ }
+
+
+ WizardDialog dialog = null;
+
+ if (newWizard instanceof ISystemWizard)
+ {
+ ISystemWizard swizard = (ISystemWizard)newWizard;
+ if (pageTitle != null)
+ swizard.setWizardPageTitle(pageTitle);
+ swizard.setViewer(getViewer());
+ dialog = new SystemWizardDialog(shell,swizard);
+ int w = swizard.getMinimumPageWidth();
+ int h = swizard.getMinimumPageHeight();
+ if (minPageWidth > 0)
+ w = minPageWidth;
+ if (minPageHeight > 0)
+ h = minPageHeight;
+ //System.out.println("In SystemBaseWizardAction. minPageWidth = " + w + ", minPageHeight = " + h);
+ if ((w>0) && (h>0))
+ dialog.setMinimumPageSize(w,h);
+
+ /*
+ * Don't do the following here as it is redundant! The run method in the parent SystemBaseDialogAction
+ * does this already
+ Object wizardInputValue = null;
+ if (getValue() != null)
+ wizardInputValue = getValue();
+ else
+ wizardInputValue = getFirstSelection();
+ if (wizardInputValue != null)
+ ((SystemWizardDialog)dialog).setInputObject(wizardInputValue);
+ */
+ }
+ else
+ dialog = new WizardDialog(shell,newWizard);
+
+ return dialog;
+ }
+
+ /**
+ * The default processing for the run method calls createDialog, which
+ * we override in this class. The implementation of createDialog calls
+ * this method that you must override, to create the wizard. The result
+ * goes into a WizardDialog which is opened and hence displayed to the
+ * user.
+ */
+ protected abstract IWizard createWizard();
+
+ /**
+ * By default, we try to get the wizard's value by calling getOutputObject()
+ */
+ protected Object getDialogValue(Dialog dlg)
+ {
+ postProcessWizard(newWizard);
+ if (newWizard instanceof ISystemWizard)
+ {
+ ISystemWizard ourWizard = (ISystemWizard)newWizard;
+ return ourWizard.getOutputObject();
+ }
+ else
+ return null;
+ }
+
+ /**
+ * Typically, the wizard's performFinish method does the work required by
+ * a successful finish of the wizard. However, often we also want to be
+ * able to extract user-entered data from the wizard, by calling getters
+ * in this action. To enable this, override this method to populate your
+ * output instance variables from the completed wizard, which is passed
+ * as a parameter. This is only called after successful completion of the
+ * wizard.
+ */
+ protected void postProcessWizard(IWizard wizard)
+ {
+ }
+
+ /**
+ * Returns true if the user cancelled the wizard.
+ * This is an override of the parent method, since we can be more
+ * accurate with wizards than we can with dialogs.
+ */
+ public boolean wasCancelled()
+ {
+ if (newWizard instanceof ISystemWizard)
+ {
+ ISystemWizard ourWizard = (ISystemWizard)newWizard;
+ return ourWizard.wasCancelled();
+ }
+ else
+ return super.wasCancelled();
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingBrowseWithAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingBrowseWithAction.java
new file mode 100644
index 00000000000..6e2b73e3b3c
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingBrowseWithAction.java
@@ -0,0 +1,49 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.SystemResources;
+
+
+/**
+ * A cascading menu action for "Browse With->"
+ */
+public class SystemCascadingBrowseWithAction extends SystemBaseSubMenuAction
+{
+
+ /**
+ * Constructor
+ */
+ public SystemCascadingBrowseWithAction()
+ {
+ super(SystemResources.ACTION_CASCADING_BROWSEWITH_LABEL,SystemResources.ACTION_CASCADING_BROWSEWITH_TOOLTIP, null);
+ setMenuID(ISystemContextMenuConstants.MENU_BROWSEWITH);
+ setCreateMenuEachTime(false);
+ setPopulateMenuEachTime(true);
+ }
+
+ /**
+ * @see SystemBaseSubMenuAction#getSubMenu()
+ */
+ public IMenuManager populateSubMenu(IMenuManager menu)
+ {
+ // we don't populate it. SystemView populates it by calling each adapter and letting them populate it.
+ return menu;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingCompareWithAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingCompareWithAction.java
new file mode 100644
index 00000000000..ebf10a73d45
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingCompareWithAction.java
@@ -0,0 +1,49 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.SystemResources;
+
+
+/**
+ * A cascading menu action for "Compare With->"
+ */
+public class SystemCascadingCompareWithAction extends SystemBaseSubMenuAction
+{
+
+ /**
+ * Constructor
+ */
+ public SystemCascadingCompareWithAction()
+ {
+ super(SystemResources.ACTION_CASCADING_COMPAREWITH_LABEL, SystemResources.ACTION_CASCADING_COMPAREWITH_TOOLTIP, null);
+ setMenuID(ISystemContextMenuConstants.MENU_COMPAREWITH);
+ setCreateMenuEachTime(false);
+ setPopulateMenuEachTime(true);
+ }
+
+ /**
+ * @see SystemBaseSubMenuAction#getSubMenu()
+ */
+ public IMenuManager populateSubMenu(IMenuManager menu)
+ {
+ // we don't populate it. SystemView populates it by calling each adapter and letting them populate it.
+ return menu;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingExpandToAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingExpandToAction.java
new file mode 100644
index 00000000000..2bdbba0d45c
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingExpandToAction.java
@@ -0,0 +1,49 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.SystemResources;
+
+
+/**
+ * A cascading menu action for "Expand To->"
+ */
+public class SystemCascadingExpandToAction extends SystemBaseSubMenuAction
+{
+
+ /**
+ * Constructor
+ */
+ public SystemCascadingExpandToAction()
+ {
+ super(SystemResources.ACTION_CASCADING_EXPAND_TO_LABEL, SystemResources.ACTION_CASCADING_EXPAND_TO_TOOLTIP, null);
+ setMenuID(ISystemContextMenuConstants.MENU_EXPANDTO);
+ setCreateMenuEachTime(false);
+ setPopulateMenuEachTime(true);
+ }
+
+ /**
+ * @see SystemBaseSubMenuAction#getSubMenu()
+ */
+ public IMenuManager populateSubMenu(IMenuManager menu)
+ {
+ // we don't populate it. SystemView populates it by calling each adapter and letting them populate it.
+ return menu;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingGoToAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingGoToAction.java
new file mode 100644
index 00000000000..4e9389ed7c9
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingGoToAction.java
@@ -0,0 +1,81 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.view.SystemViewPart;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.views.framelist.BackAction;
+import org.eclipse.ui.views.framelist.ForwardAction;
+import org.eclipse.ui.views.framelist.FrameList;
+import org.eclipse.ui.views.framelist.UpAction;
+
+
+/**
+ * A cascading menu action for "Go To->"
+ */
+public class SystemCascadingGoToAction extends SystemBaseSubMenuAction
+{
+ //private IAdaptable pageInput;
+ //private IMenuManager parentMenuManager;
+ private boolean actionsMade = false;
+
+ private SystemViewPart fSystemViewPart;
+ private BackAction backAction;
+ private ForwardAction forwardAction;
+ private UpAction upAction;
+
+
+ /**
+ * Constructor
+ */
+ public SystemCascadingGoToAction(Shell shell, SystemViewPart systemViewPart)
+ {
+ super(SystemResources.ACTION_CASCADING_GOTO_LABEL, SystemResources.ACTION_CASCADING_GOTO_TOOLTIP, shell);
+ setMenuID(ISystemContextMenuConstants.MENU_GOTO);
+ this.fSystemViewPart = systemViewPart;
+ setCreateMenuEachTime(false);
+ setPopulateMenuEachTime(false);
+ allowOnMultipleSelection(false);
+ setContextMenuGroup(ISystemContextMenuConstants.GROUP_GOTO);
+ }
+
+ /**
+ * @see SystemBaseSubMenuAction#getSubMenu()
+ */
+ public IMenuManager populateSubMenu(IMenuManager gotoMenu)
+ {
+ if (!actionsMade)
+ makeActions();
+ gotoMenu.add(backAction);
+ gotoMenu.add(forwardAction);
+ gotoMenu.add(upAction);
+ return gotoMenu;
+ }
+
+ protected void makeActions()
+ {
+ FrameList frameList = fSystemViewPart.getFrameList();
+ backAction = new BackAction(frameList);
+ forwardAction = new ForwardAction(frameList);
+ upAction = new UpAction(frameList);
+
+ actionsMade = true;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingGotoActionOLD.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingGotoActionOLD.java
new file mode 100644
index 00000000000..b33b914342e
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingGotoActionOLD.java
@@ -0,0 +1,48 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.SystemResources;
+
+
+/**
+ * A cascading menu action for "View->"
+ */
+public class SystemCascadingGotoActionOLD extends SystemBaseSubMenuAction
+{
+
+ /**
+ * Constructor
+ */
+ public SystemCascadingGotoActionOLD()
+ {
+ super(SystemResources.ACTION_CASCADING_GOTO_LABEL, SystemResources.ACTION_CASCADING_GOTO_TOOLTIP, null);
+ setMenuID(ISystemContextMenuConstants.MENU_GOTO);
+ setCreateMenuEachTime(false);
+ setPopulateMenuEachTime(true);
+ }
+
+ /**
+ * @see SystemBaseSubMenuAction#getSubMenu()
+ */
+ public IMenuManager populateSubMenu(IMenuManager menu)
+ {
+ // we don't populate it. SystemView populates it by calling each adapter and letting them populate it.
+ return menu;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingNewAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingNewAction.java
new file mode 100644
index 00000000000..c11482cb189
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingNewAction.java
@@ -0,0 +1,48 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.SystemResources;
+
+
+/**
+ * A cascading menu action for "New->"
+ */
+public class SystemCascadingNewAction extends SystemBaseSubMenuAction
+{
+
+ /**
+ * Constructor for SystemCascadingNewAction
+ */
+ public SystemCascadingNewAction()
+ {
+ super(SystemResources.ACTION_CASCADING_NEW_LABEL, SystemResources.ACTION_CASCADING_NEW_TOOLTIP, null);
+ setMenuID(ISystemContextMenuConstants.MENU_NEW);
+ setCreateMenuEachTime(false);
+ setPopulateMenuEachTime(true);
+ }
+
+ /**
+ * @see SystemBaseSubMenuAction#getSubMenu()
+ */
+ public IMenuManager populateSubMenu(IMenuManager menu)
+ {
+ // we don't populate it. SystemView populates it by calling each adapter and letting them populate it.
+ return menu;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingOpenWithAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingOpenWithAction.java
new file mode 100644
index 00000000000..925c13ea700
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingOpenWithAction.java
@@ -0,0 +1,49 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.SystemResources;
+
+
+/**
+ * A cascading menu action for "Open With->"
+ */
+public class SystemCascadingOpenWithAction extends SystemBaseSubMenuAction
+{
+
+ /**
+ * Constructor
+ */
+ public SystemCascadingOpenWithAction()
+ {
+ super(SystemResources.ACTION_CASCADING_OPENWITH_LABEL, SystemResources.ACTION_CASCADING_OPENWITH_TOOLTIP, null);
+ setMenuID(ISystemContextMenuConstants.MENU_OPENWITH);
+ setCreateMenuEachTime(false);
+ setPopulateMenuEachTime(true);
+ }
+
+ /**
+ * @see SystemBaseSubMenuAction#getSubMenu()
+ */
+ public IMenuManager populateSubMenu(IMenuManager menu)
+ {
+ // we don't populate it. SystemView populates it by calling each adapter and letting them populate it.
+ return menu;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingPreferencesAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingPreferencesAction.java
new file mode 100644
index 00000000000..604b3a11940
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCascadingPreferencesAction.java
@@ -0,0 +1,85 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.swt.widgets.Shell;
+
+
+
+/**
+ * A cascading menu action for "Preferences->".
+ * @see org.eclipse.rse.ui.actions.SystemShowPreferencesPageAction
+ */
+public class SystemCascadingPreferencesAction
+ extends SystemBaseSubMenuAction implements IMenuListener
+{
+
+ /**
+ * Constructor
+ */
+ public SystemCascadingPreferencesAction(Shell shell)
+ {
+ super(SystemResources.ACTION_CASCADING_PREFERENCES_LABEL, SystemResources.ACTION_CASCADING_PREFERENCES_TOOLTIP, shell);
+ setMenuID(ISystemContextMenuConstants.MENU_PREFERENCES);
+ setCreateMenuEachTime(false);
+ setPopulateMenuEachTime(false);
+ setSelectionSensitive(false);
+
+ setHelp(SystemPlugin.HELPPREFIX+"actnpref");
+ }
+
+ /**
+ * @see SystemBaseSubMenuAction#getSubMenu()
+ */
+ public IMenuManager populateSubMenu(IMenuManager ourSubMenu)
+ {
+ // WE DON'T WANT TO FIRE UP ALL PLUGINS THAT USE OUR EXTENSION POINT,
+ // AT THE TIEM WE ARE CREATING OUR VIEW! SO WE DEFER IT UNTIL THIS CASCADING
+ // MENU IS FIRST EXPANDED...
+ ourSubMenu.addMenuListener(this);
+ ourSubMenu.setRemoveAllWhenShown(true);
+ //menu.setEnabled(true);
+ ourSubMenu.add(new SystemBaseAction("dummy",null));
+
+ return ourSubMenu;
+ }
+
+ /**
+ * Called when submenu is about to show
+ */
+ public void menuAboutToShow(IMenuManager ourSubMenu)
+ {
+ //System.out.println("In menuAboutToShow!");
+ setBusyCursor(true);
+ ourSubMenu.add(new Separator(ISystemContextMenuConstants.GROUP_ADDITIONS)); // user or BP/ISV additions
+ SystemShowPreferencesPageAction[] prefPageActions = SystemPlugin.getDefault().getShowPreferencePageActions();
+ if (prefPageActions!=null)
+ {
+ for (int idx=0; idx
+ *
+ *
+ *
+ * true
if there are property pages for the currently
+ * selected element, and false
otherwise
+ */
+ public boolean isApplicableForSelection()
+ {
+ return hasPropertyPagesFor(getFirstSelection());
+ }
+ /**
+ * The PropertyDialogAction
implementation of this
+ * IAction
method performs the action by opening the Property Page
+ * Dialog for the current selection. If no pages are found, an informative
+ * message dialog is presented instead.
+ */
+ public void run()
+ {
+ PropertyPageManager pageManager = new PropertyPageManager();
+ String title = "";//$NON-NLS-1$
+
+ // get selection
+ //Object element = getFirstSelection();
+ IAdaptable element = (IAdaptable)getFirstSelection();
+ if (element == null)
+ return;
+ ISystemRemoteElementAdapter adapter = getRemoteAdapter(element);
+ if (adapter == null)
+ return;
+
+ // load pages for the selection
+ // fill the manager with contributions from the matching contributors
+ getOurPropertyPageManager().contribute(pageManager, getRemoteAdapter(element), element);
+ //PropertyPageContributorManager.getManager().contribute(pageManager, element);
+
+ Shell shell = getShell();
+
+ // testing if there are pages in the manager
+ Iterator pages = pageManager.getElements(PreferenceManager.PRE_ORDER).iterator();
+ String name = getName(element);
+ if (!pages.hasNext()) {
+ MessageDialog.openInformation(
+ shell,
+ GenericMessages.PropertyDialog_messageTitle,
+ MessageFormat.format(GenericMessages.PropertyDialog_noPropertyMessage, new Object[] {name}));
+ return;
+ }
+ else
+ {
+ title = MessageFormat.format(GenericMessages.PropertyDialog_propertyMessage, new Object[] {name});
+ }
+
+ PropertyDialog propertyDialog = new PropertyDialog(shell, pageManager, getSelection());
+ propertyDialog.create();
+ propertyDialog.getShell().setText(title);
+
+
+
+ // TODO - hack to make this work in 3.1
+ String id = PlatformUI.PLUGIN_ID + ".property_dialog_context";
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(propertyDialog.getShell(), id);
+
+ propertyDialog.open();
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRemoteServerStartAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRemoteServerStartAction.java
new file mode 100644
index 00000000000..ddbf08c7bbb
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRemoteServerStartAction.java
@@ -0,0 +1,59 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.swt.widgets.Shell;
+
+
+
+/**
+ * This is the "Start" action that shows up under a remote server action
+ * within the Remote Servers cascading menu.
+ */
+public class SystemRemoteServerStartAction extends SystemBaseAction
+ implements ISystemMessages
+{
+ private SystemCascadingRemoteServerBaseAction parentAction;
+
+ /**
+ * Constructor.
+ * @param shell Shell of parent window, used as the parent for the dialog.
+ * Can be null, but be sure to call setParent before the action is used (ie, run).
+ * @param parentAction The action that cascades into this action.
+ */
+ public SystemRemoteServerStartAction(Shell shell, SystemCascadingRemoteServerBaseAction parentAction)
+ {
+ super(SystemResources.ACTION_REMOTESERVER_START_LABEL,SystemResources.ACTION_REMOTESERVER_START_TOOLTIP, shell);
+ this.parentAction = parentAction;
+ allowOnMultipleSelection(false);
+ //setContextMenuGroup(ISystemContextMenuConstants.GROUP_CONNECTION);
+ setHelp(SystemPlugin.HELPPREFIX+"actnstsv");
+ }
+
+ /**
+ * Called when this action is selection from the popup menu.
+ * Calls {@link SystemCascadingRemoteServerBaseAction#startServer()} in the parent action.
+ */
+ public void run()
+ {
+ boolean ok = parentAction.startServer();
+ setEnabled(!ok);
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRemoteServerStopAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRemoteServerStopAction.java
new file mode 100644
index 00000000000..5d6a5ac289d
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRemoteServerStopAction.java
@@ -0,0 +1,59 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.swt.widgets.Shell;
+
+
+
+/**
+ * This is the "Stop" action that shows up under a remote server action
+ * within the Remote Servers cascading menu.
+ */
+public class SystemRemoteServerStopAction extends SystemBaseAction
+ implements ISystemMessages
+{
+ private SystemCascadingRemoteServerBaseAction parentAction;
+
+ /**
+ * Constructor.
+ * @param shell Shell of parent window, used as the parent for the dialog.
+ * Can be null, but be sure to call setParent before the action is used (ie, run).
+ * @param parentAction The action that cascades into this action.
+ */
+ public SystemRemoteServerStopAction(Shell shell, SystemCascadingRemoteServerBaseAction parentAction)
+ {
+ super(SystemResources.ACTION_REMOTESERVER_STOP_LABEL,SystemResources.ACTION_REMOTESERVER_STOP_TOOLTIP, shell);
+ this.parentAction = parentAction;
+ allowOnMultipleSelection(false);
+ //setContextMenuGroup(ISystemContextMenuConstants.GROUP_CONNECTION);
+ setHelp(SystemPlugin.HELPPREFIX+"actnspsv");
+ }
+
+ /**
+ * Called when this action is selection from the popup menu.
+ * Calls {@link SystemCascadingRemoteServerBaseAction#stopServer()} in the parent action.
+ */
+ public void run()
+ {
+ boolean ok = parentAction.stopServer();
+ setEnabled(!ok);
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemResolveFilterStringAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemResolveFilterStringAction.java
new file mode 100644
index 00000000000..823d68187b8
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemResolveFilterStringAction.java
@@ -0,0 +1,76 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.actions;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.ui.dialogs.SystemResolveFilterStringDialog;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * The action for testing a given filter string by resolving it and showing the resolve results
+ */
+public class SystemResolveFilterStringAction extends SystemTestFilterStringAction
+{
+
+
+ /**
+ * Constructor when input subsystem and filter string are known already
+ */
+ public SystemResolveFilterStringAction(Shell shell, ISubSystem subsystem, String filterString)
+ {
+ super(shell, subsystem, filterString);
+ }
+
+ /**
+ * Constructor when input subsystem and filter string are not known already.
+ * @see #setSubSystem(ISubSystem)
+ * @see #setFilterString(String)
+ */
+ public SystemResolveFilterStringAction(Shell shell)
+ {
+ super(shell);
+ }
+
+
+ /**
+ * If you decide to use the supplied run method as is,
+ * then you must override this method to create and return
+ * the dialog that is displayed by the default run method
+ * implementation.
+ * org.eclipse.rse.core.remoteSystemsViewPreferencesActions
+ */
+ public SystemShowPreferencesPageAction()
+ {
+ super("temp label", null);
+ }
+
+ /**
+ * Set ID of the preference root page to show.
+ * @param preferencePageID The ID of the preference page root to show. All child nodes will also be shown.
+ */
+ public void setPreferencePageID(String preferencePageID)
+ {
+ setPreferencePageID(new String[] {preferencePageID});
+ }
+ /**
+ * Set IDs of the preference root pages to show.
+ * @param preferencePageIDs The IDs of the preference page roots to show. All child nodes will also be shown.
+ */
+ public void setPreferencePageID(String[] preferencePageIDs)
+ {
+ allowOnMultipleSelection(false);
+ setSelectionSensitive(false);
+ this.preferencePageIDs = preferencePageIDs;
+ }
+ /**
+ * Set the category of the pages to be shown. This only needs to be called
+ * for non-root pages. Note that the ID to give here is not of the immediate
+ * parent, but that of the root parent. It tells us which root subtree to
+ * search for the given page(s).
+ */
+ public void setPreferencePageCategory(String preferencePageCategory)
+ {
+ this.preferencePageCategory = preferencePageCategory;
+ }
+
+ /**
+ * @see IViewActionDelegate#init(IViewPart)
+ */
+ public void init(IViewPart view)
+ {
+ setShell(view.getSite().getShell());
+ }
+
+
+ /**
+ * @see IActionDelegate#run(IAction)
+ */
+ public void run(IAction action)
+ {
+ run();
+ }
+
+
+ /**
+ * @see IActionDelegate#selectionChanged(IAction, ISelection)
+ */
+ public void selectionChanged(IAction action, ISelection selection)
+ {
+ }
+
+ /**
+ * This is the method called when the user selects this action.
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ public void run()
+ {
+ // Bring up the preferences page
+ /*
+ PreferenceManager prefMgr = new PreferenceManager();
+ prefMgr.addToRoot(new PreferenceNode("tempid", new RemoteSystemsPreferencePage()));
+ PreferenceDialog dialog = new PreferenceDialog(shell, prefMgr);
+ dialog.open();
+ */
+ PreferenceManager pm = getPreferenceManager();
+
+ if (pm != null)
+ {
+ PreferenceDialog d = new WorkbenchPreferenceDialog(shell, pm);
+ d.create();
+ // TODO - hack to make this work in 3.1
+ String id = PlatformUI.PLUGIN_ID + ".preference_dialog_context";
+
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(d.getShell(), id);
+ d.open();
+ }
+ }
+ /*
+ * Get the preference manager.
+ */
+ public PreferenceManager getPreferenceManager()
+ {
+ if (preferenceManager == null)
+ {
+ preferenceManager = new PreferenceManager('/');
+
+ //Get the pages from the registry
+ //PreferencePageRegistryReader registryReader = new PreferencePageRegistryReader(PlatformUI.getWorkbench());
+
+ //List pageContributions = registryReader.getPreferenceContributions(Platform.getExtensionRegistry());
+
+ PreferenceManager workbenchMgr = PlatformUI.getWorkbench().getPreferenceManager();
+
+ List pageContributions = workbenchMgr.getElements(PreferenceManager.POST_ORDER);
+
+
+
+ //Add the contributions to the manager
+ Iterator iter = pageContributions.iterator();
+ while (iter.hasNext())
+ {
+ IPreferenceNode prefNode = (IPreferenceNode) iter.next();
+ //System.out.println("prefNode.getId() == "+prefNode.getId());
+ //System.out.println(" getLabelText() == "+prefNode.getLabelText());
+ boolean match = false;
+ String prefNodeID = prefNode.getId();
+ if (preferencePageCategory == null)
+ {
+ match = testForMatch(prefNodeID);
+ }
+ else if (prefNodeID.equals(preferencePageCategory))
+ {
+ //System.out.println("Made it here");
+ prefNode = searchForSubPage(prefNode, prefNodeID);
+ if (prefNode != null)
+ match = true;
+ }
+ if (match)
+ preferenceManager.addToRoot(prefNode);
+ }
+
+ }
+ return preferenceManager;
+ }
+
+ private IPreferenceNode searchForSubPage(IPreferenceNode parent, String prefNodeID)
+ {
+ IPreferenceNode match = null;
+
+ IPreferenceNode[] subNodes = parent.getSubNodes();
+ if (subNodes!=null)
+ for (int idx=0; (match==null) && (idxControl
);
+ * null
if none.
+ */
+ private List exceptions = null;
+
+ /**
+ * List of saved states (element type: ItemState
).
+ */
+ private List states;
+
+ /**
+ * Internal class for recording the enable/disable state of a
+ * single control.
+ */
+ private class ItemState
+ {
+ protected Control item;
+ protected boolean state;
+ public ItemState(Control item, boolean state)
+ {
+ this.item = item;
+ this.state = state;
+ }
+ public void restore()
+ {
+ if (item != null)
+ item.setEnabled(state);
+ }
+ }
+
+ /**
+ * Creates a new object and saves in it the current enable/disable
+ * state of the given control and its descendents; the controls
+ * that are saved are also disabled.
+ *
+ * @param w the control
+ */
+ protected SystemControlEnableState(Control w)
+ {
+ this(w, null);
+ }
+ /**
+ * Creates a new object and saves in it the current enable/disable
+ * state of the given control and its descendents except for the
+ * given list of exception cases; the controls that are saved
+ * are also disabled.
+ *
+ * @param w the control
+ * @param exceptions the list of controls to not disable
+ * (element type: Control
), or null
if none
+ */
+ protected SystemControlEnableState(Control w, List exceptions)
+ {
+ super();
+ states = new ArrayList();
+ this.exceptions = exceptions;
+ readStateForAndDisable(w);
+ }
+ /**
+ * Saves the current enable/disable state of the given control
+ * and its descendents in the returned object; the controls
+ * are all disabled.
+ *
+ * @param w the control
+ * @return an object capturing the enable/disable state
+ */
+ public static SystemControlEnableState disable(Control w)
+ {
+ return new SystemControlEnableState(w);
+ }
+ /**
+ * Saves the current enable/disable state of the given control
+ * and its descendents in the returned object except for the
+ * given list of exception cases; the controls that are saved
+ * are also disabled.
+ *
+ * @param w the control
+ * @param exceptions the list of controls to not disable
+ * (element type: Control
)
+ * @return an object capturing the enable/disable state
+ */
+ public static SystemControlEnableState disable(Control w, List exceptions)
+ {
+ return new SystemControlEnableState(w, exceptions);
+ }
+ /**
+ * Recursively reads the enable/disable state for the given window
+ * and disables all controls.
+ */
+ private void readStateForAndDisable(Control w)
+ {
+ if ((exceptions != null && exceptions.contains(w)))
+ return;
+
+ if ((w instanceof Composite) && !(w instanceof SystemViewForm) && !(w instanceof SystemPropertySheetForm))
+ {
+ Composite c = (Composite) w;
+ Control[] children = c.getChildren();
+ for (int i = 0; i < children.length; i++)
+ {
+ readStateForAndDisable(children[i]);
+ }
+ }
+ // XXX: Workaround for 1G2Q8SS: ITPUI:Linux - Combo box is not enabled in "File->New->Solution"
+ states.add(new ItemState(w, w.getEnabled()));
+ w.setEnabled(false);
+ }
+ /**
+ * Restores the window enable state saved in this object.
+ */
+ public void restore()
+ {
+ int size = states.size();
+ for (int i = 0; i < size; i++)
+ {
+ ((ItemState) states.get(i)).restore();
+ }
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemCopyProfileDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemCopyProfileDialog.java
new file mode 100644
index 00000000000..1137865983d
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemCopyProfileDialog.java
@@ -0,0 +1,280 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.dialogs;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.model.ISystemProfile;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.SystemWidgetHelpers;
+import org.eclipse.rse.ui.messages.ISystemMessageLine;
+import org.eclipse.rse.ui.validators.ISystemValidator;
+import org.eclipse.rse.ui.validators.ValidatorProfileName;
+import org.eclipse.rse.ui.view.ISystemPropertyConstants;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * Dialog for copying a system profile.
+ */
+public class SystemCopyProfileDialog extends SystemPromptDialog
+ implements ISystemMessages, ISystemPropertyConstants
+{
+ private Text newName;
+ private Button makeActiveCB;
+ private String newNameString, inputName;
+ private boolean makeActive = false;
+ private SystemMessage errorMessage;
+ private ISystemValidator nameValidator;
+ private boolean initialized = false;
+ private ISystemProfile profile;
+
+ /**
+ * Constructor when profile not already known
+ * @param shell The parent window hosting this dialog
+ */
+ public SystemCopyProfileDialog(Shell shell)
+ {
+ this(shell, null);
+ }
+ /**
+ * Constructor when profile known
+ * @param shell The parent window hosting this dialog
+ * @param profile The profile to be copied
+ */
+ public SystemCopyProfileDialog(Shell shell, ISystemProfile profile)
+ {
+ super(shell, SystemResources.RESID_COPY_PROFILE_TITLE);
+ this.profile = profile;
+ if (profile != null)
+ {
+ setInputObject(profile);
+ }
+ nameValidator = SystemPlugin.getTheSystemRegistry().getSystemProfileManager().getProfileNameValidator((String)null);
+ //pack();
+ setHelp(SystemPlugin.HELPPREFIX+"drnp0000");
+ }
+ /**
+ * Create message line. Intercept so we can set msg line of form.
+ */
+ protected ISystemMessageLine createMessageLine(Composite c)
+ {
+ ISystemMessageLine msgLine = super.createMessageLine(c);
+ //form.setMessageLine(msgLine);
+ return fMessageLine;
+ }
+
+
+ /**
+ * Return widget to set focus to initially
+ */
+ protected Control getInitialFocusControl()
+ {
+ return newName;
+ }
+
+ /**
+ * Set the name validator
+ */
+ public void setNameValidator(ISystemValidator nv)
+ {
+ nameValidator = nv;
+ }
+
+ /**
+ * Create widgets, and populate given composite with them
+ */
+ protected Control createInner(Composite parent)
+ {
+ // Inner composite
+ int nbrColumns = 2;
+ Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns);
+
+ // ENTRY FIELD
+ newName = SystemWidgetHelpers.createLabeledTextField(composite_prompts,null,
+ SystemResources.RESID_COPY_PROFILE_PROMPT_LABEL, SystemResources.RESID_COPY_PROFILE_PROMPT_TOOLTIP);
+ newName.setTextLimit(ValidatorProfileName.MAX_PROFILENAME_LENGTH); // defect 41816
+ // Make active
+ makeActiveCB = SystemWidgetHelpers.createCheckBox(
+ composite_prompts, nbrColumns, null, SystemResources.RESID_NEWPROFILE_MAKEACTIVE_LABEL, SystemResources.RESID_NEWPROFILE_MAKEACTIVE_TOOLTIP);
+
+ // SET HELP CONTEXT IDS...
+ //SystemWidgetHelpers.setHelp(newName, SystemPlugin.HELPPREFIX+"drnp0002", SystemPlugin.HELPPREFIX+"drnp0000");
+ SystemWidgetHelpers.setHelp(newName, SystemPlugin.HELPPREFIX+"drnp0002");
+ //SystemWidgetHelpers.setHelp(makeActiveCB, SystemPlugin.HELPPREFIX+"drnp0003", SystemPlugin.HELPPREFIX+"drnp0000");
+ SystemWidgetHelpers.setHelp(makeActiveCB, SystemPlugin.HELPPREFIX+"drnp0003");
+
+ initialize();
+
+ // add keystroke listeners...
+ newName.addModifyListener(
+ new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ validateNameInput();
+ }
+ }
+ );
+
+ return composite_prompts;
+ }
+
+
+ /**
+ * Override of parent. Must pass selected object onto the form for initializing fields.
+ * Called by SystemDialogAction's default run() method after dialog instantiated.
+ */
+ public void setInputObject(Object inputObject)
+ {
+ //System.out.println("INSIDE SETINPUTOBJECT: " + inputObject + ", "+inputObject.getClass().getName());
+ super.setInputObject(inputObject);
+ if (inputObject instanceof SystemSimpleContentElement)
+ {
+ SystemSimpleContentElement element = (SystemSimpleContentElement)inputObject;
+ inputName = element.getName();
+ }
+ else if (inputObject instanceof ISelection)
+ {
+ SystemSimpleContentElement element = (SystemSimpleContentElement)(((IStructuredSelection)inputObject).getFirstElement());
+ inputName = element.getName();
+ }
+ else if (inputObject instanceof ISystemProfile)
+ inputName = profile.getName();
+ initialize();
+ }
+
+ /**
+ * Initialize input fields from input
+ */
+ protected void initialize()
+ {
+ if (!initialized && (newName!=null) && (inputName!=null))
+ {
+ initialized = true;
+ newName.setText(inputName);
+ newName.selectAll();
+ if (makeActiveCB != null)
+ makeActiveCB.setSelection(true);
+ setPageComplete(false);
+ }
+ }
+ /**
+ * Called when user presses OK button.
+ * Return true to close dialog.
+ * Return false to not close dialog.
+ */
+ protected boolean processOK()
+ {
+ newNameString = newName.getText().trim();
+ boolean closeDialog = verify();
+ if (closeDialog)
+ {
+ if (makeActiveCB != null)
+ makeActive = makeActiveCB.getSelection();
+ setOutputObject(newNameString);
+ }
+ return closeDialog;
+ }
+ /**
+ * Verifies all input.
+ * @return true if there are no errors in the user input
+ */
+ public boolean verify()
+ {
+ clearErrorMessage();
+ errorMessage = validateNameInput();
+ if (errorMessage != null)
+ newName.setFocus();
+ return (errorMessage == null);
+ }
+
+ /**
+ * This hook method is called whenever the text changes in the input field.
+ * The default implementation delegates the request to an ISystemValidator
object.
+ * If the ISystemValidator
reports an error the error message is displayed
+ * in the Dialog's message line.
+ * @see #setNameValidator(ISystemValidator)
+ */
+ protected SystemMessage validateNameInput()
+ {
+ errorMessage = nameValidator.validate(newName.getText());
+ if (errorMessage != null)
+ setErrorMessage(errorMessage);
+ else
+ clearErrorMessage();
+ setPageComplete();
+ return errorMessage;
+ }
+
+
+ /**
+ * This method can be called by the dialog or wizard page host, to decide whether to enable
+ * or disable the next, final or ok buttons. It returns true if the minimal information is
+ * available and is correct.
+ */
+ public boolean isPageComplete()
+ {
+ boolean pageComplete = false;
+ if (errorMessage == null)
+ {
+ String theNewName = newName.getText().trim();
+ pageComplete = (theNewName.length() > 0) && !(theNewName.equalsIgnoreCase(inputName));
+ }
+ return pageComplete;
+ }
+
+ /**
+ * Inform caller of page-complete status of this form
+ */
+ public void setPageComplete()
+ {
+ setPageComplete(isPageComplete());
+ }
+
+ /**
+ * Returns the user-entered new name
+ */
+ public String getNewName()
+ {
+ return newNameString;
+ }
+ /**
+ * Returns the make-active checkbox state
+ */
+ public boolean getMakeActive()
+ {
+ return makeActive;
+ }
+
+
+ /**
+ * Returns the user-entered new name as an array for convenience to ISystemRenameTarget hosts.
+ */
+ public String[] getNewNameArray()
+ {
+ String[] newNames = new String[1];
+ newNames[0] = newNameString;
+ return newNames;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemDeleteDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemDeleteDialog.java
new file mode 100644
index 00000000000..8470d6f54e0
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemDeleteDialog.java
@@ -0,0 +1,293 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.dialogs;
+import org.eclipse.jface.viewers.ColumnLayoutData;
+import org.eclipse.jface.viewers.ColumnPixelData;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.IBasicPropertyConstants;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableLayout;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.rse.core.SystemAdapterHelpers;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.SystemWidgetHelpers;
+import org.eclipse.rse.ui.messages.ISystemMessageLine;
+import org.eclipse.rse.ui.view.ISystemPropertyConstants;
+import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+
+/**
+ * Dialog for confirming resource deletion.
+ * ISystemValidator
object.
+ * If the ISystemValidator
reports an error the error message is displayed
+ * in the Dialog's message line.
+ * @see #setUserIdValidator(ISystemValidator)
+ */
+ protected SystemMessage validateUserIdInput()
+ {
+ if (noValidate)
+ return null;
+ clearErrorMessage();
+ errorMessage= null;
+ String userId = internalGetUserId();
+ userIdChanged = !userId.equals(originalUserId);
+ userIdPermanentCB.setEnabled(userIdChanged);
+ if (userIdValidator != null)
+ errorMessage= userIdValidator.validate(userId);
+ else if (userId.equals(""))
+ errorMessage = SystemPlugin.getPluginMessage(MSG_VALIDATE_USERID_EMPTY);
+ userIdOK = (errorMessage == null);
+ if (!userIdOK)
+ {
+ okButton.setEnabled(false);
+ setErrorMessage(errorMessage);
+ }
+ else
+ okButton.setEnabled(passwordOK);
+ return errorMessage;
+ }
+
+ /**
+ * This hook method is called whenever the text changes in the password input field.
+ * The default implementation delegates the request to an ISystemValidator
object.
+ * If the ISystemValidator
reports an error the error message is displayed
+ * in the Dialog's message line.
+ * @see #setPasswordValidator(ISystemValidator)
+ */
+ protected SystemMessage validatePasswordInput()
+ {
+ // yantzi: artemis 6.0, disable save checkbox when blank
+ savePasswordCB.setEnabled(!internalGetPassword().equals(""));
+
+ if (noValidate)
+ return null;
+ clearErrorMessage();
+ errorMessage= null;
+ String password = internalGetPassword();
+ if (passwordValidator != null)
+ errorMessage= passwordValidator.validate(password);
+ else if (password.equals(""))
+ errorMessage = SystemPlugin.getPluginMessage(MSG_VALIDATE_PASSWORD_EMPTY);
+ passwordOK = (errorMessage == null);
+ if (!passwordOK)
+ {
+ setErrorMessage(errorMessage);
+ okButton.setEnabled(false);
+ }
+ else
+ okButton.setEnabled(userIdOK);
+ return errorMessage;
+ }
+
+ /**
+ * Return the userId entered by user
+ */
+ public String getUserId()
+ {
+ return userId;
+ }
+
+ /**
+ * Return the password entered by user
+ */
+ public String getPassword()
+ {
+ return password;
+ }
+
+ /**
+ * Sets the password
+ */
+ public void setPassword(String password)
+ {
+ this.password = password;
+ }
+ /**
+ * Return true if the user changed the user id
+ */
+ public boolean getIsUserIdChanged()
+ {
+ return userIdChanged;
+ }
+ /**
+ * Return true if the user elected to make the changed user Id a permanent change.
+ */
+ public boolean getIsUserIdChangePermanent()
+ {
+ return userIdPermanent;
+ }
+ /**
+ * Return true if the user elected to make the changed user Id a permanent change.
+ */
+ public boolean getIsSavePassword()
+ {
+ return savePassword;
+ }
+ /**
+ * Preselect the save password checkbox. Default value is to not
+ * select the save password checkbox.
+ */
+ public void setSavePassword(boolean save)
+ {
+ savePassword = save;
+ }
+ /**
+ * Verifies all input.
+ * @return true if there are no errors in the user input
+ */
+ protected boolean verify()
+ {
+ SystemMessage errMsg = null;
+ Control controlInError = null;
+ clearErrorMessage();
+ errorMessage = null;
+ errMsg = validateUserIdInput();
+ if (errMsg != null)
+ controlInError = textUserId;
+ else
+ {
+ errMsg = validatePasswordInput();
+ if (errMsg != null)
+ controlInError = textPassword;
+ }
+ if (errMsg != null)
+ controlInError.setFocus(); // validate methods already displayed error message
+ return (errMsg == null);
+ }
+
+ /**
+ * Called when user presses OK button.
+ * Return true to close dialog.
+ * Return false to not close dialog.
+ */
+ protected boolean processOK()
+ {
+ //busyCursor = new Cursor(getShell().getDisplay(), SWT.CURSOR_WAIT);
+ //getShell().setCursor(busyCursor);
+ setBusyCursor(true); // phil
+
+ password = internalGetPassword();
+ userId = internalGetUserId();
+ userIdPermanent = internalGetIsUserIdChangePermanent();
+ savePassword = internalGetIsSavePassword();
+ if (forceToUpperCase)
+ {
+ userId = userId.toUpperCase();
+ password = password.toUpperCase();
+ noValidate = true;
+ textUserId.setText(userId);
+ textPassword.setText(password);
+ noValidate = false;
+ }
+
+ boolean closeDialog = verify();
+
+ //getShell().setCursor(null);
+ //busyCursor.dispose();
+ setBusyCursor(false); // phil
+
+ // If all inputs are OK then verify signon
+ if (closeDialog && (signonValidator != null))
+ {
+ SystemMessage msg = signonValidator.isValid(this, userId, password);
+ if (msg != null)
+ {
+ closeDialog = false;
+ setErrorMessage(msg);
+ }
+ }
+
+ return closeDialog;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemPromptDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemPromptDialog.java
new file mode 100644
index 00000000000..9d59615b30a
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemPromptDialog.java
@@ -0,0 +1,1709 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.dialogs;
+import java.lang.reflect.InvocationTargetException;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.operation.IRunnableContext;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.operation.ModalContext;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.wizard.ProgressMonitorPart;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.Mnemonics;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.SystemWidgetHelpers;
+import org.eclipse.rse.ui.messages.ISystemMessageLine;
+import org.eclipse.rse.ui.messages.SystemMessageDialog;
+import org.eclipse.rse.ui.messages.SystemMessageLine;
+import org.eclipse.rse.ui.validators.ISystemValidator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.graphics.Image;
+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.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * Base dialog class. Use this whenever more than a simple string
+ * prompt is needed (which InputDialog gives you).
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ */
+public abstract class SystemPromptDialog
+ extends org.eclipse.jface.dialogs.Dialog
+ implements Listener, IDialogConstants, ISystemPromptDialog,
+ ISystemMessageLine, org.eclipse.jface.dialogs.IDialogPage, IRunnableContext, Runnable
+{
+
+ protected boolean okPressed = false;
+ protected boolean showBrowseButton = false;
+ protected boolean showTestButton = false;
+ protected boolean showAddButton = false;
+ protected boolean showDetailsButton = false;
+ protected boolean pack = false;
+ protected boolean initialOKButtonEnabledState = true;
+ protected boolean initialAddButtonEnabledState = false;
+ protected boolean initialDetailsButtonEnabledState = true;
+ protected boolean detailsButtonHideMode = false;
+ protected boolean showOkButton = true;
+ protected Shell overallShell = null;
+ protected Composite parentComposite, dialogAreaComposite;
+ protected Composite buttonsComposite;
+ protected Button okButton, cancelButton, testButton, browseButton, addButton, detailsButton;
+ protected String title, labelOk, labelBrowse, labelTest, labelCancel, labelAdd, labelDetailsShow, labelDetailsHide;
+ protected String tipOk, tipBrowse, tipTest, tipCancel, tipAdd, tipDetailsShow, tipDetailsHide;
+ protected String detailsShowLabel;
+ protected String detailsHideLabel;
+ protected String helpId;
+ //protected Hashtable helpIdPerControl;
+ protected Image titleImage;
+ protected Object inputObject, outputObject; // input and output objects
+ protected SystemMessageLine fMessageLine;
+ protected SystemMessage pendingMessage, pendingErrorMessage;
+ protected int minWidth, minHeight;
+ protected int marginWidth = 3;
+ protected int marginHeight = 3;
+ protected int verticalSpacing = 2;
+ protected int horizontalSpacing = 3;
+
+ //protected Composite parent;
+ //protected Composite contentsComposite, buttonsComposite;
+ protected Mnemonics dialogMnemonics; // list of all unique mnemonics used in this dialog
+ protected ISystemValidator outputObjectValidator;
+
+ protected long activeRunningOperations = 0;
+ protected boolean operationCancelableState;
+ protected boolean needsProgressMonitor;
+ protected ProgressMonitorPart progressMonitorPart;
+ protected Cursor waitCursor;
+ protected Cursor arrowCursor;
+ protected MessageDialog windowClosingDialog;
+ protected SelectionAdapter cancelListener;
+
+ private static final String FOCUS_CONTROL = "focusControl";//$NON-NLS-1$
+
+ protected static final int BROWSE_ID = 50;
+ protected static final int TEST_ID = 60;
+ protected static final int ADD_ID = 70;
+ protected static final int DETAILS_ID = 80;
+ protected static final boolean BROWSE_BUTTON_YES = true;
+ protected static final boolean BROWSE_BUTTON_NO = false;
+ protected static final boolean TEST_BUTTON_YES = true;
+ protected static final boolean TEST_BUTTON_NO = false;
+ protected static final boolean ADD_BUTTON_YES = true;
+ protected static final boolean ADD_BUTTON_NO = false;
+ protected static final boolean DETAILS_BUTTON_YES = true;
+ protected static final boolean DETAILS_BUTTON_NO = false;
+
+ /**
+ * Constructor one: ok and cancel buttons
+ * @param shell - parent window this dialog is modal to.
+ * @param title - the title for the dialog. Typically translated.
+ * @see #setInputObject(Object)
+ */
+ public SystemPromptDialog(Shell shell, String title)
+ {
+ this(shell, title, null, false);
+ }
+ /**
+ * Constructor two: ok and cancel buttons and an icon for the dialog title area
+ * @param shell - parent window this dialog is modal to.
+ * @param title - the title for the dialog. Typically translated.
+ * @param titleImage - the icon for the dialog's title area.
+ * @see #setInputObject(Object)
+ */
+ public SystemPromptDialog(Shell shell, String title, Image titleImage)
+ {
+ this(shell, title, null, false, titleImage);
+ }
+ /**
+ * Constructor three: ok and cancel buttons, plus explicit setting of input object
+ * @param shell - parent window this dialog is modal to.
+ * @param title - the title for the dialog. Typically translated.
+ * @param inputObject - the contextual input data, which can be queried via {@link #getInputObject()}.
+ */
+ public SystemPromptDialog(Shell shell, String title, Object inputObject)
+ {
+ this(shell, title, inputObject, false);
+ }
+ /**
+ * Constructor four: ok, browse and cancel buttons
+ * @param shell - parent window this dialog is modal to.
+ * @param title - the title for the dialog. Typically translated.
+ * @param browse - true if to show a Browse button, false if no Browse button desired.
+ * @see #setInputObject(Object)
+ */
+ public SystemPromptDialog(Shell shell, String title, boolean browse)
+ {
+ this(shell, title, null, browse);
+ }
+ /**
+ * Constructor five: ok, browse and cancel buttons, plus explicit setting of input object
+ * @param shell - parent window this dialog is modal to.
+ * @param title - the title for the dialog. Typically translated.
+ * @param inputObject - the contextual input data, which can be queried via {@link #getInputObject()}.
+ * @param browse - true if to show a Browse button, false if no Browse button desired.
+ */
+ public SystemPromptDialog(Shell shell, String title, Object inputObject, boolean browse)
+ {
+ this(shell, title, inputObject, browse, null);
+ }
+ /**
+ * Constructor six: ok, browse and cancel buttons, plus explicit setting of input object and
+ * an icon for the dialog title area
+ * @param shell - parent window this dialog is modal to.
+ * @param title - the title for the dialog. Typically translated.
+ * @param inputObject - the contextual input data, which can be queried via {@link #getInputObject()}.
+ * @param browse - true if to show a Browse button, false if no Browse button desired.
+ * @param titleImage - the icon for the dialog's title area.
+ */
+ public SystemPromptDialog(Shell shell, String title, Object inputObject, boolean browse,
+ Image titleImage)
+ {
+ super(shell);
+ setShellStyle(SWT.RESIZE | getShellStyle()); // dwd
+ this.title = title;
+ this.titleImage = titleImage;
+ this.inputObject = inputObject;
+ this.showBrowseButton = browse;
+ super.setBlockOnOpen(true);
+ }
+ /**
+ * Constructor six: an input object. true/false for browse button, true/false for test button, a title image
+ */
+ public SystemPromptDialog(Shell shell, String title, Object inputObject, boolean browse, boolean test,
+ Image titleImage)
+ {
+ super(shell);
+ setShellStyle(SWT.RESIZE | getShellStyle()); // dwd
+ this.title = title;
+ this.titleImage = titleImage;
+ this.inputObject = inputObject;
+ this.showBrowseButton = browse;
+ this.showTestButton = test;
+ super.setBlockOnOpen(true);
+ }
+
+
+ /* (non-Javadoc)
+ * Method declared in Window.
+ */
+ protected void configureShell(Shell shell)
+ {
+ super.configureShell(shell);
+ overallShell = shell;
+ if (title != null)
+ shell.setText(title);
+ //if (titleImage != null)
+ // shell.setImage(titleImage); // ?correct method?
+ //shell.setSize(300,200); // default w,h
+ }
+
+ /**
+ * Specify if a progress monitor is desired in this dialog. Should be called right after instantiation.
+ * The default is false. If true is specified, area on the dialog is reserved for the progress monitor,
+ * and the monitor can be retrieved via {@link #getProgressMonitor()}.
+ * null
is returned.
+ */
+ public String getErrorMessage()
+ {
+ if (fMessageLine != null)
+ return fMessageLine.getErrorMessage();
+ else
+ return null;
+ }
+ /**
+ * Get the currently displayed error text.
+ * @return The error message. If no error message is displayed null
is returned.
+ */
+ public SystemMessage getSystemErrorMessage()
+ {
+ if (fMessageLine != null)
+ return fMessageLine.getSystemErrorMessage();
+ else
+ return null;
+ }
+ /**
+ * Get the currently displayed message.
+ * @return The message. If no message is displayed null
object.
+ * If the is returned.
+ */
+ public String getMessage()
+ {
+ if (fMessageLine != null)
+ return fMessageLine.getMessage();
+ else
+ return null;
+ }
+ /**
+ * Display the given error message. A currently displayed message
+ * is saved and will be redisplayed when the error message is cleared.
+ */
+ public void setErrorMessage(String message)
+ {
+ if (fMessageLine != null)
+ fMessageLine.setErrorMessage(message);
+ else
+ SystemMessageDialog.displayErrorMessage(getShell(),message);
+ }
+
+ /**
+ * Display the given error message. A currently displayed message
+ * is saved and will be redisplayed when the error message is cleared.
+ */
+ public void setErrorMessage(SystemMessage message)
+ {
+ if (fMessageLine != null)
+ {
+ if (message != null)
+ fMessageLine.setErrorMessage(message);
+ else
+ fMessageLine.clearErrorMessage();
+ }
+ else //if (message != null)
+ {
+ //(new SystemMessageDialog(getShell(),message)).open();
+ pendingErrorMessage = message;
+ }
+ }
+ /**
+ * Set the message text. If the message line currently displays an error,
+ * the message is stored and will be shown after a call to clearErrorMessage
+ */
+ public void setMessage(String message)
+ {
+ if (fMessageLine != null)
+ {
+ if (message != null)
+ fMessageLine.setMessage(message);
+ else
+ fMessageLine.clearMessage();
+ }
+ }
+
+ /**
+ *If the message line currently displays an error,
+ * the message is stored and will be shown after a call to clearErrorMessage
+ */
+ public void setMessage(SystemMessage message)
+ {
+ if (fMessageLine != null)
+ fMessageLine.setMessage(message);
+ else if (message != null)
+ //(new SystemMessageDialog(getShell(),message)).open();
+ pendingMessage = message;
+ }
+
+
+ /**
+ * Convenience method to set an error message from an exception
+ */
+ public void setErrorMessage(Throwable exc)
+ {
+ if (fMessageLine != null)
+ fMessageLine.setErrorMessage(exc);
+ else
+ {
+ SystemMessage msg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_ERROR_UNEXPECTED);
+ msg.makeSubstitution(exc);
+ (new SystemMessageDialog(getShell(),msg)).open();
+ }
+ }
+
+ // -------------------------------------------------------------------------------
+ // IDialogPage interface methods, which we only implement to enable dialog help...
+ // -------------------------------------------------------------------------------
+ public void setDescription(String description) {}
+ public String getDescription() {return null;}
+ public Image getImage() {return titleImage;}
+ public void performHelp() {}
+ public void setVisible(boolean visible) {}
+ public void dispose() {}
+ public Control getControl() {return parentComposite;}
+ public void setControl(Control c) {}
+ public void createControl(Composite parent) {}
+ public void setImageDescriptor(ImageDescriptor id) {}
+ /**
+ * Get the dialog's title
+ */
+ public String getTitle()
+ {
+ return title;
+ }
+ /**
+ * Set the dialog's title
+ */
+ public void setTitle(String title)
+ {
+ this.title = title;
+ if (overallShell != null)
+ overallShell.setText(title);
+ }
+
+
+ // --------------------------------------------
+ // Methods to support a progress monitor...
+ // using WizardDialog as an example.
+ // --------------------------------------------
+
+ /**
+ * Returns the progress monitor for this dialog (if it has one).
+ *
+ * @return the progress monitor, or
object.
+ * If the null
if
+ * this dialog does not have one
+ */
+ public IProgressMonitor getProgressMonitor()
+ {
+ return progressMonitorPart;
+ }
+
+ /**
+ * About to start a long running operation tiggered through
+ * the dialog. Shows the progress monitor and disables the dialog's
+ * buttons and controls.
+ *
+ * @param enableCancelButton true
if the Cancel button should
+ * be enabled, and false
if it should be disabled
+ * @return the saved UI state
+ */
+ protected Object aboutToStart(boolean enableCancelButton)
+ {
+ Map savedState = null;
+ operationCancelableState = enableCancelButton;
+ if ((getShell() != null) && (activeRunningOperations <= 0))
+ {
+ // Save focus control
+ Control focusControl = getShell().getDisplay().getFocusControl();
+ if (focusControl != null && focusControl.getShell() != getShell())
+ focusControl = null;
+ cancelButton.removeSelectionListener(cancelListener);
+ // Set the busy cursor to all shells.
+ Display d = getShell().getDisplay();
+ waitCursor = new Cursor(d, SWT.CURSOR_WAIT);
+ setDisplayCursor(waitCursor);
+
+ // Set the arrow cursor to the cancel component.
+ arrowCursor= new Cursor(d, SWT.CURSOR_ARROW);
+ cancelButton.setCursor(arrowCursor);
+
+ // Set the cancel button label to "Cancel" if it isn't already
+ if (labelCancel != null)
+ cancelButton.setText("&" + IDialogConstants.CANCEL_LABEL);
+
+ // Deactivate shell
+ savedState = saveUIState(needsProgressMonitor && enableCancelButton);
+ if (focusControl != null)
+ savedState.put(FOCUS_CONTROL, focusControl);
+
+ // Attach the progress monitor part to the cancel button
+ if (needsProgressMonitor)
+ {
+ progressMonitorPart.attachToCancelComponent(cancelButton);
+ progressMonitorPart.setVisible(true);
+ }
+ }
+ return savedState;
+ }
+
+ /**
+ * Creates and returns a new wizard closing dialog without opening it.
+ */
+ protected MessageDialog createWizardClosingDialog()
+ {
+ MessageDialog result= new MessageDialog(getShell(),
+ JFaceResources.getString("WizardClosingDialog.title"),//$NON-NLS-1$
+ null,
+ JFaceResources.getString("WizardClosingDialog.message"),//$NON-NLS-1$
+ MessageDialog.QUESTION,
+ new String[] {IDialogConstants.OK_LABEL}, 0 );
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * Method declared on Dialog.
+ */
+ public boolean close()
+ {
+ if (okToClose())
+ return hardClose();
+ else
+ return false;
+ }
+ /**
+ * Checks whether it is alright to close this wizard dialog
+ * and perform standard cancel processing. If there is a
+ * long running operation in progress, this method posts an
+ * alert message saying that the wizard cannot be closed.
+ *
+ * @return true
if it is alright to close this dialog, and
+ * false
if it is not
+ */
+ protected boolean okToClose()
+ {
+ if (activeRunningOperations > 0)
+ {
+ synchronized (this)
+ {
+ windowClosingDialog = createWizardClosingDialog();
+ }
+ windowClosingDialog.open();
+ synchronized (this)
+ {
+ windowClosingDialog = null;
+ }
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Closes this window. Really closes it. Calls super.close()
+ *
+ * @return true
if the window is (or was already) closed,
+ * and false
if it is still open
+ */
+ protected boolean hardClose()
+ {
+ return super.close();
+ }
+
+ /**
+ * Restores the enabled/disabled state of the given control.
+ *
+ * @param w the control
+ * @param h the map (key type: String
, element type:
+ * Boolean
)
+ * @param key the key
+ * @see #saveEnableStateAndSet
+ */
+ protected void restoreEnableState(Control w, Map h, String key)
+ {
+ if (w != null) {
+ Boolean b = (Boolean) h.get(key);
+ if (b != null)
+ w.setEnabled(b.booleanValue());
+ }
+ }
+ /**
+ * Restores the enabled/disabled state of the wizard dialog's
+ * buttons and the tree of controls for the currently showing page.
+ *
+ * @param state a map containing the saved state as returned by
+ * saveUIState
+ * @see #saveUIState
+ */
+ protected void restoreUIState(Map state)
+ {
+ //protected Button okButton, cancelButton, testButton, browseButton, addButton, detailsButton;
+ restoreEnableState(okButton, state, "ok");
+ restoreEnableState(testButton, state, "test");
+ restoreEnableState(browseButton, state, "browse");
+ restoreEnableState(cancelButton, state, "cancel");
+ restoreEnableState(addButton, state, "add");
+ restoreEnableState(detailsButton,state, "details");
+ SystemControlEnableState pageState = (SystemControlEnableState) state.get("page");//$NON-NLS-1$
+ pageState.restore();
+ }
+
+ /**
+ * Captures and returns the enabled/disabled state of the wizard dialog's
+ * buttons and the tree of controls for the currently showing page. All
+ * these controls are disabled in the process, with the possible excepton of
+ * the Cancel button.
+ *
+ * @param keepCancelEnabled true
if the Cancel button should
+ * remain enabled, and false
if it should be disabled
+ * @return a map containing the saved state suitable for restoring later
+ * with restoreUIState
+ * @see #restoreUIState
+ */
+ protected Map saveUIState(boolean keepCancelEnabled)
+ {
+ Map savedState= new HashMap(10);
+ saveEnableStateAndSet(okButton, savedState, "ok", false);
+ saveEnableStateAndSet(testButton, savedState, "test", false);
+ saveEnableStateAndSet(browseButton, savedState, "browse", false);
+ saveEnableStateAndSet(cancelButton, savedState, "cancel", keepCancelEnabled);
+ saveEnableStateAndSet(addButton, savedState, "add", false);
+ saveEnableStateAndSet(detailsButton,savedState, "details",false);
+ //savedState.put("page", ControlEnableState.disable(getControl()));
+ savedState.put("page", SystemControlEnableState.disable(dialogAreaComposite));
+ return savedState;
+ }
+
+ /**
+ * Saves the enabled/disabled state of the given control in the
+ * given map, which must be modifiable.
+ *
+ * @param w the control, or null
if none
+ * @param h the map (key type: String
, element type:
+ * Boolean
)
+ * @param key the key
+ * @param enabled true
to enable the control,
+ * and false
to disable it
+ * @see #restoreEnableState(Control,Map,String)
+ */
+ protected void saveEnableStateAndSet(Control w, Map h, String key, boolean enabled)
+ {
+ if (w != null) {
+ h.put(key, new Boolean(w.isEnabled()));
+ w.setEnabled(enabled);
+ }
+ }
+
+ /**
+ * Sets the given cursor for all shells currently active
+ * for this window's display.
+ *
+ * @param c the cursor
+ */
+ protected void setDisplayCursor(Cursor c)
+ {
+ setDisplayCursor(getShell(), c);
+ }
+ /**
+ * Sets the given cursor for all shells currently active for the given shell's display.
+ *
+ * @param c the cursor
+ */
+ public static void setDisplayCursor(Shell shell, Cursor c)
+ {
+ if (c == null)
+ {
+ // attempt to fix problem that the busy cursor sometimes stays. Phil
+ // DKM - commenting this out since the attempt to fix problem didn't work
+ // and it causes accessibility problems when expanding a system via keyboard
+ // shell.forceActive();
+ // shell.forceFocus();
+ }
+ if (shell != null && shell.getDisplay() != null)
+ {
+ Shell[] shells = shell.getDisplay().getShells();
+ for (int i = 0; i < shells.length; i++)
+ {
+ shells[i].setCursor(c);
+ }
+ }
+ }
+
+
+ /**
+ * For IRunnableContext.
+ */
+ public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable)
+ throws InvocationTargetException, InterruptedException
+ {
+ // The operation can only be canceled if it is executed in a separate thread.
+ // Otherwise the UI is blocked anyway.
+ Object state = aboutToStart(fork && cancelable);
+ activeRunningOperations++;
+ if (activeRunningOperations > 1)
+ {
+ //System.out.println("Nested operation!");
+ //(new Exception()).fillInStackTrace().printStackTrace();
+ }
+ try {
+ ModalContext.run(runnable, fork, getProgressMonitor(), getShell().getDisplay());
+ } finally {
+ activeRunningOperations--;
+ stopped(state);
+ }
+ }
+ /**
+ * A long running operation triggered through the wizard
+ * was stopped either by user input or by normal end.
+ * Hides the progress monitor and restores the enable state
+ * wizard's buttons and controls.
+ *
+ * @param savedState the saved UI state as returned by aboutToStart
+ * @see #aboutToStart
+ */
+ private void stopped(Object savedState)
+ {
+ if ((getShell() != null) && (activeRunningOperations <= 0))
+ {
+ if (needsProgressMonitor)
+ {
+ progressMonitorPart.setVisible(false);
+ progressMonitorPart.removeFromCancelComponent(cancelButton);
+ }
+ Map state = (Map)savedState;
+ restoreUIState(state);
+ cancelButton.addSelectionListener(cancelListener);
+ setDisplayCursor(null);
+ cancelButton.setCursor(null);
+ if (labelCancel != null)
+ cancelButton.setText(labelCancel);
+ waitCursor.dispose();
+ waitCursor = null;
+ arrowCursor.dispose();
+ arrowCursor = null;
+ Control focusControl = (Control)state.get(FOCUS_CONTROL);
+ if (focusControl != null)
+ focusControl.setFocus();
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemRemoteResourceDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemRemoteResourceDialog.java
new file mode 100644
index 00000000000..8cee80b90c2
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemRemoteResourceDialog.java
@@ -0,0 +1,256 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.dialogs;
+
+import org.eclipse.rse.model.IHost;
+import org.eclipse.rse.ui.messages.ISystemMessageLine;
+import org.eclipse.rse.ui.validators.IValidatorRemoteSelection;
+import org.eclipse.rse.ui.view.SystemActionViewerFilter;
+import org.eclipse.rse.ui.view.SystemResourceSelectionForm;
+import org.eclipse.rse.ui.view.SystemResourceSelectionInputProvider;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+
+public abstract class SystemRemoteResourceDialog extends SystemPromptDialog
+{
+ private SystemResourceSelectionForm _form;
+ private SystemResourceSelectionInputProvider _inputProvider;
+ private Object _preSelection;
+ private IValidatorRemoteSelection _selectionValidator;
+ private boolean _multipleSelectionMode;
+ private boolean _showPropertySheet = false;
+ private IHost _outputConnection;
+ private SystemActionViewerFilter _customViewerFilter;
+
+
+ public SystemRemoteResourceDialog(Shell shell, String title, SystemResourceSelectionInputProvider inputProvider)
+ {
+ super(shell, title);
+ _inputProvider = inputProvider;
+ }
+
+ protected Control createInner(Composite parent)
+ {
+ _form = new SystemResourceSelectionForm(getShell(), parent, this, _inputProvider, getVerbage(), _multipleSelectionMode, getMessageLine());
+ initForm();
+ createMessageLine(parent);
+ return _form.getInitialFocusControl();
+ }
+
+ /**
+ * Create message line. Intercept so we can set msg line of form.
+ */
+ protected ISystemMessageLine createMessageLine(Composite c)
+ {
+ ISystemMessageLine msgLine = super.createMessageLine(c);
+ _form.setMessageLine(msgLine);
+ return fMessageLine;
+ }
+
+ public void initForm()
+ {
+ _form.setPreSelection(_preSelection);
+ if (_customViewerFilter != null)
+ {
+ _form.applyViewerFilter(_customViewerFilter);
+ }
+ else
+ {
+ _form.applyViewerFilter(getViewerFilter());
+ }
+ _form.setSelectionValidator(_selectionValidator);
+ _form.setShowPropertySheet(_showPropertySheet);
+ _form.setSelectionTreeToolTipText(getTreeTip());
+ }
+
+ public void setDefaultSystemConnection(IHost connection, boolean onlyConnection)
+ {
+ _inputProvider.setSystemConnection(connection, onlyConnection);
+ }
+
+ public void setSystemTypes(String[] types)
+ {
+ _inputProvider.setSystemTypes(types);
+ }
+
+ protected Control getInitialFocusControl()
+ {
+ return _form.getInitialFocusControl();
+ }
+
+ public void setPreSelection(Object selection)
+ {
+ _preSelection = selection;
+ if (_form != null)
+ {
+ _form.setPreSelection(selection);
+ }
+ }
+
+ public void setSelectionValidator(IValidatorRemoteSelection validator)
+ {
+ _selectionValidator = validator;
+ }
+
+ public void setCustomViewerFilter(SystemActionViewerFilter viewerFilter)
+ {
+ _customViewerFilter = viewerFilter;
+ }
+
+ /**
+ * Set multiple selection mode. Default is single selection mode
+ * ISystemValidator
reports an error the error message is displayed
+ * in the Dialog's message line.
+ * @see #setNameValidator(ISystemValidator)
+ */
+ protected SystemMessage validateNameInput()
+ {
+ errorMessage= null;
+ if (errorMessage == null)
+ clearErrorMessage();
+ else
+ setErrorMessage(errorMessage);
+ setPageComplete();
+ return errorMessage;
+ }
+
+
+ /**
+ * This method can be called by the dialog or wizard page host, to decide whether to enable
+ * or disable the next, final or ok buttons. It returns true if the minimal information is
+ * available and is correct.
+ */
+ public boolean isPageComplete()
+ {
+ boolean pageComplete = false;
+ if (errorMessage == null)
+ pageComplete = true;
+ return pageComplete;
+ }
+
+ /**
+ * Inform caller of page-complete status of this form
+ */
+ public void setPageComplete()
+ {
+ setPageComplete(isPageComplete());
+ }
+
+ /**
+ * Required by TraverseListener.
+ * We want to know when the tab key is pressed so we can give edit focus to the next name
+ */
+ public void keyTraversed(TraverseEvent e)
+ {
+ int detail = e.detail;
+ //System.out.println("in keyTraversed: " + keycode + ", " + detail + ", " + doit);
+ e.doit = false;
+ ignoreSelection = true;
+
+ Control focusControl = Display.getCurrent().getFocusControl();
+
+ //System.out.println("...Key pressed. currRow = "+currRow);
+
+ // DEFECT 41807 STATED USERS SHOULD BE ALLOWED TO TAB TO THE BUTTONS
+ if (detail == SWT.TRAVERSE_TAB_NEXT)
+ {
+ if (currRow != getRows().length-1)
+ {
+ ++currRow;
+ //System.out.println("...D TAB pressed. currRow = "+currRow);
+ //tableViewer.setSelection(new StructuredSelection(getRows()[currRow]),true);
+ tableViewer.editElement(getRows()[currRow], COLUMN_NEWNAME);
+ }
+ else
+ {
+ tableViewer.editElement(getRows()[0], COLUMN_NEWNAME);
+ currRow = 0;
+ e.doit = true;
+ }
+ }
+ else if (detail == SWT.TRAVERSE_TAB_PREVIOUS)
+ {
+ if (currRow != 0)
+ {
+ if (currRow > 0)
+ --currRow;
+ else
+ currRow = 0;
+ //System.out.println("...D BACKTAB pressed. currRow = "+currRow);
+ //tableViewer.setSelection(new StructuredSelection(getRows()[currRow]),true);
+ tableViewer.editElement(getRows()[currRow], COLUMN_NEWNAME);
+ }
+ else
+ {
+ tableViewer.editElement(getRows()[getRows().length-1], COLUMN_NEWNAME);
+ currRow = getRows().length-1;
+ e.doit = true;
+ }
+ }
+ else
+ e.doit = true;
+ ignoreSelection = false;
+ }
+
+ /**
+ * Returns the rows of rename items.
+ */
+ public SystemRenameTableRow[] getRows()
+ {
+ return (SystemRenameTableRow[])srtp.getElements(getInputObject());
+ }
+
+ /**
+ * Returns an array of the new names.
+ */
+ public String[] getNewNames()
+ {
+ SystemRenameTableRow[] rows = getRows();
+ String[] names = new String[rows.length];
+ for (int idx=0; idx
+ *
+ *
+ *
+ *
+ *
+ *
+ * @see com.ibm.etools.systems.files.ui.actions.SystemSelectRemoteFileAction
+ * @see com.ibm.etools.systems.files.ui.actions.SystemSelectRemoteFolderAction
+ */
+public class SystemSelectConnectionDialog
+ extends SystemPromptDialog implements ISystemPageCompleteListener
+{
+ public static final boolean FILE_MODE = true;
+ public static final boolean FOLDER_MODE = false;
+ private SystemSelectConnectionForm form;
+
+
+ /**
+ * Constructor
+ *
+ * @param shell The shell to hang the dialog off of
+ *
+ */
+ public SystemSelectConnectionDialog(Shell shell)
+ {
+ this(shell, SystemResources.RESID_SELECTCONNECTION_TITLE);
+ }
+ /**
+ * Constructor when you want to supply your own title.
+ *
+ * @param shell The shell to hang the dialog off of
+ * @param title The title to give the dialog
+ */
+ public SystemSelectConnectionDialog(Shell shell, String title)
+ {
+ super(shell, title);
+ super.setBlockOnOpen(true); // always modal
+ form = getForm(shell);
+ setShowPropertySheet(true, false); // default
+ }
+
+ // ------------------
+ // PUBLIC METHODS...
+ // ------------------
+ /**
+ * Set the connection to default the selection to
+ */
+ public void setDefaultConnection(IHost conn)
+ {
+ form.setDefaultConnection(conn);
+ }
+ /**
+ * Restrict to certain system types
+ * @param systemTypes the system types to restrict what connections are shown and what types of connections
+ * the user can create
+ * @see org.eclipse.rse.core.ISystemTypes
+ */
+ public void setSystemTypes(String[] systemTypes)
+ {
+ form.setSystemTypes(systemTypes);
+ }
+ /**
+ * Restrict to a certain system type
+ * @param systemType the system type to restrict what connections are shown and what types of connections
+ * the user can create
+ * @see org.eclipse.rse.core.ISystemTypes
+ */
+ public void setSystemType(String systemType)
+ {
+ form.setSystemType(systemType);
+ }
+ /**
+ * Set to true if a "New Connection..." special connection is to be shown for creating new connections
+ */
+ public void setShowNewConnectionPrompt(boolean show)
+ {
+ form.setShowNewConnectionPrompt(show);
+ }
+ /**
+ * Set the instruction label shown at the top of the dialog
+ */
+ public void setInstructionLabel(String message)
+ {
+ form.setMessage(message);
+ }
+
+ /**
+ * Show the property sheet on the right hand side, to show the properties of the
+ * selected object.
+ * null
if
+ * the selection was canceled.
+ *
+ * @param the list of selected elements, or null
if Cancel was
+ * pressed
+ */
+ protected void setResult(java.util.List newResult)
+ {
+ if (newResult == null)
+ {
+ result = null;
+ }
+ else
+ {
+ result = new Object[newResult.size()];
+ newResult.toArray(result);
+ }
+ }
+
+ /**
+ * Validate the user input for a file type
+ */
+ protected boolean validateFileType(String filename)
+ {
+ // We need kernel api to validate the extension or a filename
+
+ // check for empty name and extension
+ if (filename.length() == 0)
+ {
+ clearErrorMessage();
+ return true;
+ }
+
+ // check for empty extension if there is no name
+ int index = filename.indexOf('.');
+ if (index == filename.length() - 1)
+ {
+ if (index == 0 || (index == 1 && filename.charAt(0) == '*'))
+ {
+ // TODO: Cannot use WorkbenchMessages -- it's internal
+ setErrorMessage(GenericMessages.FileExtension_extensionEmptyMessage);
+ return false;
+ }
+ }
+
+ int startScan = 0;
+ if (filename.startsWith("*."))
+ startScan = 2;
+
+ // check for characters before *
+ // or no other characters
+ // or next character not '.'
+ index = filename.indexOf('*', startScan);
+ if (index > -1)
+ {
+ if (filename.length() == 1)
+ {
+ // TODO: Cannot use WorkbenchMessages -- it's internal
+ setErrorMessage(GenericMessages.FileExtension_extensionEmptyMessage);
+ return false;
+ }
+ if (index != 0 || filename.charAt(1) != '.')
+ {
+ // TODO: Cannot use WorkbenchMessages -- it's internal
+ setErrorMessage(GenericMessages.FileExtension_fileNameInvalidMessage);
+ return false;
+ }
+ }
+
+ clearErrorMessage();
+ return true;
+ }
+
+ /**
+ * Returns the list of selections made by the user, or null
if
+ * the selection was canceled.
+ *
+ * @return the array of selected elements, or null
if Cancel was
+ * pressed
+ */
+ public Object[] getResult()
+ {
+ return result;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSimpleContentElement.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSimpleContentElement.java
new file mode 100644
index 00000000000..7ae1b409a81
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSimpleContentElement.java
@@ -0,0 +1,331 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.dialogs;
+import java.util.Vector;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.ui.ISystemIconConstants;
+
+/**
+ * When we populate a TreeViewer in a dialog, we need a simple
+ * representation of the objects to populate the tree.
+ *
+ *
+ *
+ *
+ *
+ *
+ * Set the contextual system filter pool reference manager provider. Will be non-null if the
+ * current selection is a reference to a filter pool or filter, or a reference manager
+ * provider.
+ *
+ * Set the contextual system filter pool manager provider. Will be non-null if the
+ * current selection is a filter pool or filter, or reference to them, or a manager provider.
+ * Generally this is called when the setSystemFilterPoolReferenceManagerProvider can't be called
+ * for some reason.
+ *
+ * Set the Parent Filter Pool prompt label and tooltip text.
+ */
+ public void setParentPoolPromptLabel(String label, String tip)
+ {
+ this.poolPromptLabel = label;
+ this.poolPromptTip = tip;
+ }
+ /**
+ * Return the parent filter pool prompt label, as set by {@link #setParentPoolPromptLabel(String, String)}
+ */
+ public String getParentPoolPromptLabel()
+ {
+ return poolPromptLabel;
+ }
+ /**
+ * Return the parent filter pool prompt tip, as set by {@link #setParentPoolPromptLabel(String, String)}
+ */
+ public String getParentPoolPromptTip()
+ {
+ return poolPromptTip;
+ }
+
+ /**
+ * Configuration method
+ * Set the name prompt label and tooltip text.
+ */
+ public void setNamePromptLabel(String label, String tip)
+ {
+ this.namePromptLabel = label;
+ this.namePromptTip = tip;
+ }
+ /**
+ * Return the name prompt label as set by {@link #setNamePromptLabel(String, String)}
+ */
+ public String getNamePromptLabel()
+ {
+ return namePromptLabel;
+ }
+ /**
+ * Return the name prompt tip as set by {@link #setNamePromptLabel(String, String)}
+ */
+ public String getNamePromptTip()
+ {
+ return namePromptTip;
+ }
+
+ /**
+ * Configuration method
+ * Set the label shown in group box around the filter string list, and the tooltip text for the
+ * list box.
+ */
+ public void setListLabel(String label, String tip)
+ {
+ this.listPromptLabel = label;
+ this.listPromptTip = tip;
+ }
+ /**
+ * Return list label as set by {@link #setListLabel(String, String)}
+ */
+ public String getListLabel()
+ {
+ return listPromptLabel;
+ }
+ /**
+ * Return list tip as set by {@link #setListLabel(String, String)}
+ */
+ public String getListTip()
+ {
+ return listPromptTip;
+ }
+
+ /**
+ * Set the string to show as the first item in the list.
+ * The default is "New filter string"
+ */
+ public void setNewListItemText(String label)
+ {
+ this.newEntryLabel = label;
+ }
+ /**
+ * Return the text for the list item, as set by {@link #setNewListItemText(String)},
+ * or the default if not set.
+ */
+ public String getNewListItemText()
+ {
+ return (newEntryLabel != null) ? newEntryLabel : SystemResources.RESID_CHGFILTER_LIST_NEWITEM;
+ }
+
+ /**
+ * Configuration method
+ * Call this to specify a validator for the filter string. It will be called per keystroke.
+ * A default validator is supplied otherwise: ValidatorFilterString.
+ *
+ * Set the error message to use when the user is editing or creating a filter string, and the
+ * Apply processing detects a duplicate filter string in the list.
+ */
+ public void setDuplicateFilterStringErrorMessage(SystemMessage msg)
+ {
+ this.duplicateFilterStringMsg = msg;
+ }
+ /**
+ * Return results of {@link #setDuplicateFilterStringErrorMessage(SystemMessage)}
+ */
+ public SystemMessage getDuplicateFilterStringErrorMessage()
+ {
+ return duplicateFilterStringMsg;
+ }
+ /**
+ * Configuration method
+ * Specify if you want to include a test button or not. Appears with "Apply" and "Reset"
+ */
+ public void setWantTestButton(boolean wantTestButton)
+ {
+ this.wantTestButton = wantTestButton;
+ }
+ /**
+ * Return whether a test button is wanted or not, as set by {@link #setWantTestButton(boolean)}
+ */
+ public boolean getWantTestButton()
+ {
+ return wantTestButton;
+ }
+
+ /**
+ * Set if the edit pane is not to be editable
+ */
+ public void setEditable(boolean editable)
+ {
+ this.editable = editable;
+ this.showingNew = editable;
+ }
+ /**
+ * Return whether the edit pane is editable, as set by {@link #setEditable(boolean)}
+ */
+ public boolean getEditable()
+ {
+ return editable;
+ }
+ /**
+ * Set if the user is to be allowed to create multiple filter strings or not. Default is true
+ */
+ public void setSupportsMultipleStrings(boolean multi)
+ {
+ this.showingNew = multi;
+ this.supportsMultipleStrings = multi;
+ }
+ /**
+ * Return whether the user is to be allowed to create multiple filter strings or not. Default is true
+ */
+ public boolean getSupportsMultipleStrings()
+ {
+ return supportsMultipleStrings;
+ //return (!showingNew && editable);
+ }
+
+ // LIFECYCLE
+ /**
+ * Intercept of parent so we can set the input filter, and deduce whether
+ * strings are case sensitive and if duplicates are allowed.
+ * Not typically overridden, but if you do, be sure to call super!
+ */
+ public void setInputObject(Object inputObject)
+ {
+ //System.out.println("INSIDE SETINPUTOBJECT: " + inputObject);
+ super.setInputObject(inputObject);
+ inputFilter = getSystemFilter(inputObject);
+ caseSensitiveStrings = inputFilter.areStringsCaseSensitive();
+ allowDuplicateStrings = inputFilter.supportsDuplicateFilterStrings();
+ }
+
+ /**
+ * Returns the control (the list view) to recieve initial focus control
+ */
+ public Control getInitialFocusControl()
+ {
+ return listView;
+ }
+ /**
+ * Populates the content area
+ */
+ public Control createContents(Composite parent)
+ {
+ SystemWidgetHelpers.setHelp(parent, SystemPlugin.HELPPREFIX+"dufr0000");
+
+ if (getShell()==null)
+ setShell(parent.getShell());
+ SystemFilterStringEditPane editpane = getFilterStringEditPane(getShell());
+ editpane.setSystemFilterPoolReferenceManagerProvider(refProvider);
+ editpane.setSystemFilterPoolManagerProvider(provider);
+ editpane.setChangeFilterMode(true);
+
+ // Inner composite
+ int nbrColumns = 2;
+ Composite composite = SystemWidgetHelpers.createComposite(parent, nbrColumns);
+
+ // composite at top to hold readonly info
+ //Composite topComposite = SystemWidgetHelpers.createFlushComposite(composite, 2);
+ //((GridData)topComposite.getLayoutData()).horizontalSpan = nbrColumns;
+ Composite topComposite = composite;
+ // filter name
+ SystemWidgetHelpers.createLabel(topComposite, namePromptLabel);
+ filterNameLabel = SystemWidgetHelpers.createLabel(topComposite, "");
+ filterNameLabel.setToolTipText(namePromptTip);
+ filterNameLabel.setText(inputFilter.getName());
+ // filter pool
+ SystemWidgetHelpers.createLabel(topComposite, poolPromptLabel);
+ filterPoolNameLabel = SystemWidgetHelpers.createLabel(topComposite, "");
+ filterPoolNameLabel.setToolTipText(namePromptTip);
+ ISystemFilterPool parentPool = inputFilter.getParentFilterPool();
+ filterPoolNameLabel.setText(parentPool.getName());
+
+ addFillerLine(composite, nbrColumns);
+
+ // create list view on left
+ if (supportsMultipleStrings)
+ {
+ listView = SystemWidgetHelpers.createListBox(composite, listPromptLabel, null, false, 1);
+ //listView.setToolTipText(listPromptTip); VERY ANNOYING
+ GridData data = (GridData)listView.getLayoutData();
+ data.grabExcessHorizontalSpace = false;
+ data.horizontalAlignment = GridData.FILL;
+ data.grabExcessVerticalSpace = true;
+ data.verticalAlignment = GridData.FILL;
+ data.widthHint = 130;
+ }
+ String[] strings = inputFilter.getFilterStrings();
+ if (strings == null)
+ strings = new String[] {};
+ int delta = (showingNew ? 1 : 0);
+ listItems = new String[delta+strings.length];
+ if (showingNew)
+ listItems[0] = getNewListItemText(); // "New filter string" or caller-supplied
+ for (int idx=0; idx
+ *
+ * So what is the "contract" the edit pane has to fulfill?
+ *
+ *
+ * Contractually, here are the methods called by the main page of the new filter wizard:
+ *
+ *
+ */
+public class SystemFilterStringEditPane implements SelectionListener
+{
+ // inputs
+ protected Shell shell;
+ protected String inputFilterString;
+ protected Vector listeners = new Vector();
+ protected ISystemFilterPoolReferenceManagerProvider refProvider = null;
+ protected ISystemFilterPoolManagerProvider provider = null;
+ protected String type;
+ protected boolean newMode = true;
+ protected boolean changeFilterMode = false;
+ protected boolean ignoreChanges;
+ //protected boolean editable = true;
+
+ // default GUI
+ protected Label labelString;
+ protected Text textString;
+ protected Button dlgTestButton;
+ // state
+ protected SystemMessage errorMessage;
+ protected boolean skipEventFiring;
+ protected int currentSelectionIndex;
+
+ /**
+ * Constructor for SystemFilterStringEditPane.
+ * @param shell - the shell of the wizard or dialog host this
+ */
+ public SystemFilterStringEditPane(Shell shell)
+ {
+ super();
+ this.shell = shell;
+
+ }
+
+ // ------------------------------
+ // HELPER METHODS...
+ // ------------------------------
+
+ /**
+ * Helper method. Do not override.
+ * Return the shell given us in the ctor
+ */
+ protected Shell getShell()
+ {
+ return shell;
+ }
+ /**
+ * Helper method. Do not override.
+ * Return the input filter string as given us in setFilterString
+ */
+ protected String getInputFilterString()
+ {
+ return inputFilterString;
+ }
+
+ /**
+ * Helper method. Do not override.
+ * Add a separator line. This is a physically visible line.
+ */
+ protected void addSeparatorLine(Composite parent, int nbrColumns)
+ {
+ Label separator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
+ GridData data = new GridData();
+ data.horizontalSpan = nbrColumns;
+ data.horizontalAlignment = GridData.FILL;
+ separator.setLayoutData(data);
+ }
+ /**
+ * Helper method. Do not override.
+ * Add a spacer line
+ */
+ protected void addFillerLine(Composite parent, int nbrColumns)
+ {
+ Label filler = new Label(parent, SWT.LEFT);
+ GridData data = new GridData();
+ data.horizontalSpan = nbrColumns;
+ data.horizontalAlignment = GridData.FILL;
+ filler.setLayoutData(data);
+ }
+ /**
+ * Helper method. Do not override.
+ * Add a spacer line that grows in height to absorb extra space
+ */
+ protected void addGrowableFillerLine(Composite parent, int nbrColumns)
+ {
+ Label filler = new Label(parent, SWT.LEFT);
+ GridData data = new GridData();
+ data.horizontalSpan = nbrColumns;
+ data.horizontalAlignment = GridData.FILL;
+ data.verticalAlignment = GridData.FILL;
+ data.grabExcessVerticalSpace = true;
+ filler.setLayoutData(data);
+ }
+ // ------------------------------
+ // CONFIGURATION/INPUT METHODS...
+ // ------------------------------
+ /**
+ * Configuration method, called from Change Filter dialog and New Filter wizard. Do not override.
+ * Set the input filter string, in edit mode.
+ * Or pass null if reseting to new mode.
+ * @param filterString - the filter string to edit or null if new mode
+ * @param selectionIndex - the index of the currently selected filter string. Only used for getCurrentSelectionIndex().
+ */
+ public void setFilterString(String filterString, int selectionIndex)
+ {
+ this.inputFilterString = filterString;
+ this.currentSelectionIndex = selectionIndex;
+ newMode = (filterString == null);
+ setIgnoreChanges(true);
+ resetFields();
+ clearErrorsPending();
+ if (inputFilterString != null)
+ doInitializeFields();
+ setIgnoreChanges(false);
+ }
+
+ /**
+ * Configuration method, called from Change Filter dialog and New Filter wizard. Do not override.
+ * Set the input filter string only without any initialzing.
+ */
+ public void setInputFilterString(String filterString)
+ {
+ this.inputFilterString = filterString;
+ }
+
+
+ /**
+ * Lifecyle method. Call, but do not override.
+ * Turn on ignore changes mode. Subclasses typically can just query the inherited
+ * field ignoreChanges, unless they need to set the ignoreChanges mode in their
+ * own composite widgets, in which case they can override and intercept this.
+ */
+ protected void setIgnoreChanges(boolean ignoreChanges)
+ {
+ this.ignoreChanges = ignoreChanges;
+ }
+
+ /**
+ * Configuration method, called from Change Filter dialog and New Filter wizard. Do not override.
+ * Identify a listener interested in any changes made to the filter string,
+ * as they happen
+ */
+ public void addChangeListener(ISystemFilterStringEditPaneListener l)
+ {
+ listeners.add(l);
+ }
+ /**
+ * Configuration method, called from Change Filter dialog and New Filter wizard. Do not override.
+ * Remove a listener interested in any changes made to the filter string,
+ * as they happen
+ */
+ public void removeChangeListener(ISystemFilterStringEditPaneListener l)
+ {
+ listeners.remove(l);
+ }
+ /**
+ * Configuration method, called from Change Filter dialog and New Filter wizard. Do not override.
+ * Sets the contextual system filter pool reference manager provider. That is, it will
+ * be the currently selected subsystem if New Filter is launched from a subsystem.
+ *
+ * Sets the contextual system filter pool manager provider. That is, it will
+ * be the subsystem factory of the given subsystem, filter pool or filter. Used
+ * when there is no way to set setSystemFilterPoolReferenceManagerProvider, because
+ * there isn't one derivable from the selection.
+ *
+ * Return the contextual system filter pool reference manager provider (ie subsystem) that
+ * this was launched from. Will be null if not launched from a subsystem, or reference to a
+ * filter pool or filter.
+ *
+ * Return the contextual system filter pool manager provider (ie subsystemFactory) that
+ * this was launched from. Will be null if not launched from a subsystem factory, or
+ * a filter pool or filter (or reference).
+ *
+ * Set the type of filter we are creating. Types are not used by the base filter
+ * framework but are a way for tools to create typed filters and have unique
+ * actions per filter type.
+ *
+ * Called by Change Filter dialog to set on our changeFilterMode flag in case we wish to
+ * distinguish between new filter and change filter modes
+ */
+ public void setChangeFilterMode(boolean changeMode)
+ {
+ this.changeFilterMode = changeMode;
+ }
+ /**
+ * Configuration method, called from Change Filter dialog and New Filter wizard. Do not override.
+ * Called by Change Filter dialog or New Filter wizard when caller has indicated
+ * they want a test button. This is used to set the testButton instance variable.
+ * Subclasses show enable/disable it as changes are made, according to valid state.
+ */
+ public void setTestButton(Button button)
+ {
+ this.dlgTestButton = button;
+ }
+ /**
+ * Overridable method, if subclass supports a Test button.
+ * Called by owning dialog when common Test button is pressed.
+ * Does nothing by default.
+ */
+ public void processTest(Shell shell)
+ {
+ System.out.println("Someone forgot to override processTest in SystemFilterStringEditPane!");
+ }
+
+ /*
+ * Set if the edit pane is not to be editable
+ *
+ public void setEditable(boolean editable)
+ {
+ this.editable = editable;
+ }*/
+ /*
+ * Return whether the edit pane is editable, as set by {@link #setEditable(boolean)}
+ *
+ public boolean getEditable()
+ {
+ return editable;
+ }*/
+
+ // ------------------------------
+ // DATA EXTRACTION METHODS
+ // ------------------------------
+
+ /**
+ * Overridable getter method.
+ * Get the filter string in its current form.
+ * This should be overridden if createContents is overridden.
+ *
+ * Get the selection index of the filter string we are currently editing.
+ * Used in Change Filter dialog.
+ */
+ public int getCurrentSelectionIndex()
+ {
+ return currentSelectionIndex;
+ }
+
+ /**
+ * Overridable getter method.
+ * For page 2 of the New Filter wizard, if it is possible to
+ * deduce a reasonable default name from the user input here,
+ * then return it here. Else, just return null (the default).
+ */
+ public String getDefaultFilterName()
+ {
+ return null;
+ }
+
+ /**
+ * Overridable configuration method, called from Change Filter dialog and New Filter wizard.
+ * YOU MUST TEST IF THE GIVEN LABEL IS NULL!
+ * In the Change Filter dialog, this edit pane is shown on the right side, beside
+ * the filter string selection list. Above it is a label, that shows something
+ * like "Selected Filter String" in edit mode, or "New Filter String" in new mode.
+ *
+ * Populate the pane with the GUI widgets. This is where we populate the client area.
+ * @param parent - the composite that will be the parent of the returned client area composite
+ * @return Control - a client-area composite populated with widgets.
+ *
+ * @see org.eclipse.rse.ui.SystemWidgetHelpers
+ */
+ public Control createContents(Composite parent)
+ {
+
+ // Inner composite
+ int nbrColumns = 1;
+ Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns);
+ ((GridLayout)composite_prompts.getLayout()).marginWidth = 0;
+
+ // FILTER STRING PROMPT
+ textString = SystemWidgetHelpers.createLabeledTextField(composite_prompts,null,getFilterStringPromptLabel(), getFilterStringPromptTooltip());
+ labelString = SystemWidgetHelpers.getLastLabel();
+ ((GridData)textString.getLayoutData()).widthHint=300;
+
+ resetFields();
+ doInitializeFields();
+
+ textString.setFocus();
+
+ // add keystroke listeners...
+ textString.addModifyListener(
+ new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ validateStringInput();
+ }
+ }
+ );
+ return composite_prompts;
+ }
+ /**
+ * Overridable lifecycle method.
+ * Return the control to recieve initial focus. Should be overridden if you override createContents
+ */
+ public Control getInitialFocusControl()
+ {
+ return textString;
+ }
+
+
+
+
+ protected String getFilterStringPromptLabel()
+ {
+ return SystemResources.RESID_FILTERSTRING_STRING_LABEL;
+ }
+
+ protected String getFilterStringPromptTooltip()
+ {
+ return SystemResources.RESID_FILTERSTRING_STRING_TIP;
+ }
+
+ /**
+ * Overridable lifecycle method.
+ * Initialize the input fields based on the inputFilterString, and perhaps refProvider.
+ * This can be called before createContents, so test for null widgets first!
+ * Prior to this being called, resetFields is called to set the initial default state prior to input
+ */
+ protected void doInitializeFields()
+ {
+ if (textString == null)
+ return; // do nothing
+ if (inputFilterString != null)
+ textString.setText(inputFilterString);
+ }
+ /**
+ * Overridable lifecycle method.
+ * This is called in the change filter dialog when the user selects "new", or selects another string.
+ * You must override this if you override createContents. Be sure to test if the contents have even been created yet!
+ */
+ protected void resetFields()
+ {
+ if (textString != null)
+ {
+ textString.setText("");
+ }
+ }
+ /**
+ * Lifecycle method. Do not override.
+ * Instead, override {@link #areFieldsComplete()}.
+ *
+ * Must be overridden if createContents is overridden.
+ *
+ * Are errors pending? Used in Change Filter dialog to prevent changing the filter string selection
+ */
+ public boolean areErrorsPending()
+ { // d45795
+ return (errorMessage != null);
+ }
+ /**
+ * Lifecycle method. Do not override.
+ * Clear any errors pending. Called when Reset is pressed.
+ */
+ public void clearErrorsPending()
+ {
+ errorMessage = null;
+ }
+
+ // ------------------------------
+ // PRIVATE METHODS
+ // ------------------------------
+ /**
+ * Private method. Do not call or override.
+ * Fire an event to all registered listeners, that the user has changed the
+ * filter string. Include the error message, if in error, so it can be displayed to the user.
+ *
+ * Tell interested callers to restore changes-pending state, as we are done
+ * firing a change event and in this case we don't want that state change side effect.
+ */
+ protected void fireRestoreChangeEvent()
+ {
+ for (int idx=0; idx
+ * Validates filter string as entered so far in the text field.
+ * Not called if you override createContents() and verify()
+ */
+ protected SystemMessage validateStringInput()
+ {
+ if (ignoreChanges)
+ return errorMessage;
+ errorMessage= null;
+ //if (validator != null)
+ // errorMessage = validateFilterString(textString.getText());
+ if ((textString!=null) && (textString.getText().trim().length() == 0))
+ errorMessage = SystemPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_FILTERSTRING_EMPTY);
+ fireChangeEvent(errorMessage);
+ //setPageComplete();
+ //setErrorMessage(errorMessage);
+ return errorMessage;
+ }
+
+ /*
+ * Validates filter string using the supplied generic validator.
+ * Child classes who do their own syntax validation can call this method
+ * to also do uniqueness validation. They are responsible for calling fireChangeEvent though.
+ * @see #setFilterStringValidator(ISystemValidator)
+ *
+ protected SystemMessage validateFilterString(String filterString)
+ {
+ if (validator != null)
+ return validator.validate(filterString);
+ else
+ return null;
+ }*/
+
+ // ---------------------------------
+ // METHODS FOR VERIFICATION...
+ // ---------------------------------
+
+ /**
+ * Overridable lifecycle method.
+ * Does complete verification of input fields. If this
+ * method returns null, there are no errors and the dialog or wizard can close.
+ *
+ * User has selected something
+ */
+ public void widgetSelected(SelectionEvent event)
+ {
+ }
+ /**
+ * Overridable lifecycle method.
+ * User has selected something via enter/dbl-click
+ */
+ public void widgetDefaultSelected(SelectionEvent event)
+ {
+ }
+
+
+ // -----------------------
+ // Saving related method
+ // -----------------------
+ /**
+ * Returns whether filter string can be saved implicitly. This is called in the Change dialog
+ * and property page to check whether filter string can be saved if the user does not
+ * explicitly click on Create/Apply button. So, for example, if this method returns false
,
+ * and the user has pending changes when he clicks on another entry in the filter string list, we will
+ * not ask user to save pending changes.
+ * By default, returns true
+ * @return true
to query user to save pending changes, false
otherwise.
+ */
+ public boolean canSaveImplicitly() {
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterUIHelpers.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterUIHelpers.java
new file mode 100644
index 00000000000..901a8e23af9
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterUIHelpers.java
@@ -0,0 +1,170 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.filters;
+import java.util.Vector;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.subsystems.util.ISubsystemConfigurationAdapter;
+import org.eclipse.rse.filters.ISystemFilter;
+import org.eclipse.rse.filters.ISystemFilterPool;
+import org.eclipse.rse.filters.ISystemFilterPoolManager;
+import org.eclipse.rse.filters.ISystemFilterPoolManagerProvider;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
+
+
+/**
+ *
+ */
+public class SystemFilterUIHelpers
+{
+
+ /**
+ * Find element corresponding to given data
+ */
+ public static SystemSimpleContentElement getDataElement(SystemSimpleContentElement root, Object data)
+ {
+ SystemSimpleContentElement[] children = root.getChildren();
+ SystemSimpleContentElement match = null;
+ if ((children!=null)&&(children.length>0))
+ {
+ for (int idx=0; (match==null)&&(idx
+ *
+ */
+ public ISystemFilterPoolManager[] getFilterPoolManagers()
+ {
+ ISystemFilterPoolManager[] mgrs = null;
+ ISystemFilterPoolManagerProvider provider = getFilterPoolManagerProvider();
+ if (mgrs == null)
+ mgrs = dlgInputs.poolManagers;
+ if ((mgrs==null) && (provider != null))
+ mgrs = provider.getSystemFilterPoolManagers(); // get it in real time.
+ if (mgrs == null)
+ {
+ ISystemFilterPoolReferenceManager refmgr = getFilterPoolReferenceManager();
+ if (refmgr != null)
+ mgrs = refmgr.getSystemFilterPoolManagers();
+ }
+ if (mgrs == null)
+ {
+ ISystemFilterPoolReferenceManagerProvider sfprmp = getReferenceManagerProviderSelection();
+ if (sfprmp != null)
+ mgrs = sfprmp.getSystemFilterPoolReferenceManager().getSystemFilterPoolManagers();
+ }
+ return mgrs;
+ }
+ /**
+ * Return the current selection if it implements SystemFilterPoolReferenceManagerProvider
+ */
+ protected ISystemFilterPoolReferenceManagerProvider getReferenceManagerProviderSelection()
+ {
+ Object obj = getFirstSelection();
+ if ((obj instanceof ISystemFilterPoolReferenceManagerProvider))
+ return (ISystemFilterPoolReferenceManagerProvider)obj;
+ else
+ return null;
+ }
+ /**
+ * Set the zero-based index of the manager name to preselect.
+ * The default is zero.
+ * Either call this or override getFilterPoolManagerNameSelectionIndex or call setFilterPoolManagerNamePreSelection(String)
+ */
+ public void setFilterPoolManagerNameSelectionIndex(int index)
+ {
+ dlgInputs.mgrSelection = index;
+ }
+ /**
+ * Returns the zero-based index of the manager name to preselect.
+ * Returns what was set in setFilterPoolManagerNamePreSelection or setFilterPoolManagerNameSelectionIndex by default.
+ */
+ public int getFilterPoolManagerNameSelectionIndex()
+ {
+ int pos = -1;
+ if (mgrNamePreselect != null)
+ {
+ ISystemFilterPoolManager[] mgrs = getFilterPoolManagers();
+ if (mgrs != null)
+ {
+ for (int idx=0; (pos<0) && (idxPreselects the filter pools currently referenced by one or more reference objects
+ * in the filter pool reference manager.
+ *
+ *
+ * You can either supply the label, dialog title, dialog prompt, filter pool image,
+ * input filter pool managers and filter pool reference manager by calling the
+ * appropriate setXXX methods, or by overriding the related getXXX methods.
+ */
+public class SystemFilterSelectFilterPoolsAction
+ extends SystemFilterAbstractFilterPoolAction
+
+{
+
+
+ /**
+ * Constructor when default label desired.
+ */
+ public SystemFilterSelectFilterPoolsAction(Shell parent)
+ {
+ super(parent,
+ SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_SELECTFILTERPOOLS_ID),
+ SystemResources.ACTION_SELECTFILTERPOOLS_LABEL, SystemResources.ACTION_SELECTFILTERPOOLS_TOOLTIP);
+ setContextMenuGroup(ISystemContextMenuConstants.GROUP_CHANGE);
+ // set default help for action and dialog
+ setHelp(SystemPlugin.HELPPREFIX + "actn0043");
+ setDialogHelp(SystemPlugin.HELPPREFIX + "dsfp0000");
+ }
+ /**
+ * Constructor when given the translated action label
+ */
+ public SystemFilterSelectFilterPoolsAction(Shell parent, String title)
+ {
+ super(parent, title);
+ setContextMenuGroup(ISystemContextMenuConstants.GROUP_CHANGE);
+ // set default help for action and dialog
+ setHelp(SystemPlugin.HELPPREFIX + "actn0043");
+ setDialogHelp(SystemPlugin.HELPPREFIX + "dsfp0000");
+ }
+
+
+ /**
+ * Constructor when given the translated action label
+ */
+ public SystemFilterSelectFilterPoolsAction(Shell parent, String title, String tooltip)
+ {
+ super(parent, title, tooltip);
+ setContextMenuGroup(ISystemContextMenuConstants.GROUP_CHANGE);
+ // set default help for action and dialog
+ setHelp(SystemPlugin.HELPPREFIX + "actn0043");
+ setDialogHelp(SystemPlugin.HELPPREFIX + "dsfp0000");
+ }
+
+
+ /**
+ * Override of init in parent
+ */
+ protected void init()
+ {
+ super.init();
+ dlgInputs.prompt = SystemResources.RESID_SELECTFILTERPOOLS_PROMPT;
+ dlgInputs.title = SystemResources.RESID_SELECTFILTERPOOLS_TITLE;
+ }
+
+ /**
+ * Creates our select-filter-pools dialog, and populates it with the list of
+ * filter pools to select from.
+ *
+ * Call this to defer expensive configuration until the user runs the action
+ * @param caller - an implementor of the callback interface
+ * @param data - any data the callback needs. It will be passed back on the callback.
+ */
+ public void setCallBackConfigurator(ISystemNewFilterActionConfigurator caller, Object data)
+ {
+ this.callbackConfigurator = caller;
+ this.callbackData = data;
+ this.callbackConfiguratorCalled = false;
+ }
+ /**
+ * Configuration method. Do not override.
+ * Set the help context Id (infoPop) for this action. This must be fully qualified by
+ * plugin ID.
+ *
+ * Set the parent filter pool that the new-filter actions need.
+ * Typically this is set at constructor time but it can be set later if re-using the action.
+ */
+ public void setParentFilterPool(ISystemFilterPool parentPool)
+ {
+ this.parentPool = parentPool;
+ }
+ /**
+ * Configuration method. Do not override.
+ * If you want to prompt the user for the parent filter pool to create this filter in,
+ * call this with the list of filter pools. In this case, the filter pool passed into
+ * the constructor will be used as the initial selection.
+ */
+ public void setAllowFilterPoolSelection(ISystemFilterPool[] poolsToSelectFrom)
+ {
+ this.poolsToSelectFrom = poolsToSelectFrom;
+ }
+ /**
+ * Configuration method. Do not override.
+ * This is an alternative to {@link #setAllowFilterPoolSelection(ISystemFilterPool[])}
+ *
+ * Set the type of filter we are creating. Results in a call to setType(String) on the new filter.
+ * Types are not used by the base filter framework but are a way for tools to create typed
+ * filters and have unique actions per filter type.
+ *
+ * Get the type of filter as set by {@link #setType(String)}
+ */
+ public String getType()
+ {
+ return type;
+ }
+ /**
+ * Configuration method. Do not override.
+ * Set whether to show, or hide, the first page that prompts for a filter string. Default is true.
+ * @see #setDefaultFilterStrings(String[])
+ */
+ public void setShowFilterStrings(boolean show)
+ {
+ showFilterStrings = show;
+ }
+ /**
+ * Configuration method. Do not override.
+ * Call this if you want the new filter to have some default filter strings.
+ */
+ public void setDefaultFilterStrings(String[] defaultFilterStrings)
+ {
+ this.defaultFilterStrings = defaultFilterStrings;
+ }
+ /**
+ * Configuration method. Do not override.
+ * Call in order to not prompt the user for a filter name. This also implies we will not
+ * be prompting for a parent filter pool! Default is true.
+ *
+ * Call in order to not show the final info-only page of the wizard. Default is true.
+ * @see #setVerbage(String)
+ */
+ public void setShowInfoPage(boolean show)
+ {
+ showInfoPage = show;
+ }
+ /**
+ * Configuration method. Do not override.
+ * Set the verbage to show on the final page. By default, it shows a tip about creating multiple
+ * filter strings via the Change action. Use this method to change that default.
+ */
+ public void setVerbage(String verbage)
+ {
+ this.verbage = verbage;
+ }
+ /**
+ * Configuration method. Do not override.
+ * Set the description to display on the first page of the wizard
+ */
+ public void setPage1Description(String description)
+ {
+ this.page1Description = description;
+ }
+ /**
+ * Configuration method. Do not override.
+ * Set if we are creating a filter for use in the RSE or not. This affects the
+ * tips and help.
+ *
+ * Set the validator to call when the user selects a filter pool. Optional.
+ * Only valid in create mode.
+ */
+ public void setFilterPoolSelectionValidator(ISystemFilterPoolSelectionValidator validator)
+ {
+ this.filterPoolSelectionValidator = validator;
+ }
+
+ /**
+ * Configuration method. Do not override.
+ * Specify an edit pane that prompts the user for the contents of a filter string.
+ */
+ public void setFilterStringEditPane(SystemFilterStringEditPane editPane)
+ {
+ this.editPane = editPane;
+ }
+
+ /**
+ * Configuration method. Do not override.
+ * Specify the help to show for the name page (page 2)
+ */
+ public void setNamePageHelp(String helpId)
+ {
+ this.namePageHelp = helpId;
+ }
+
+ // ----------------------
+ // OVERRIDABLE METHODS...
+ // ----------------------
+ /**
+ * Overridable configuration method.
+ * Overridable extension. For those cases when you don't want to create your
+ * own wizard subclass, but prefer to simply configure the default wizard.
+ *
+ * Configure the new filter created by the wizard. This is only called after
+ * successful completion of the wizard
+ *
+ * The default processing for the run method calls createDialog, which
+ * in turn calls this method to return an instance of our wizard.
+ * Our default implementation is to call createNewFilterWizard.
+ *
+ * Create and return the actual wizard.
+ * By default this returns an instance of {@link org.eclipse.rse.filters.ui.wizards.SystemNewFilterWizard}.
+ *
+ * Intercept of parent method so we can allow overrides opportunity to
+ * configure the new filter.
+ * This simply calls configureNewFilter.
+ */
+ protected void postProcessWizard(IWizard wizard)
+ {
+ SystemNewFilterWizard newFilterWizard = (SystemNewFilterWizard)wizard;
+ ISystemFilter newFilter = newFilterWizard.getSystemFilter();
+ if (newFilter != null)
+ configureNewFilter(newFilter);
+ }
+
+ /**
+ * Lifecyle method. No need to override.
+ * Decide whether to enable this action based on selected object's type.
+ * Returns false unless selected object is a filter pool or subsystem.
+ */
+ public boolean checkObjectType(Object selectedObject)
+ {
+ return ((selectedObject instanceof ISystemFilterContainer) ||
+ (selectedObject instanceof ISystemFilterContainerReference) ||
+ (selectedObject instanceof ISystemFilterPoolReferenceManagerProvider));
+ }
+
+ // -----------------
+ // OUTPUT METHODS...
+ // -----------------
+
+ /**
+ * Output method. Do not override.
+ * Get the contextual system filter pool reference manager provider. Will return non-null if the
+ * current selection is a reference to a filter pool or filter, or a reference manager
+ * provider.
+ */
+ public ISystemFilterPoolReferenceManagerProvider getSystemFilterPoolReferenceManagerProvider()
+ {
+ Object firstSelection = getFirstSelection();
+ if (firstSelection != null)
+ {
+ if (firstSelection instanceof ISystemFilterReference)
+ return ((ISystemFilterReference)firstSelection).getProvider();
+ else if (firstSelection instanceof ISystemFilterPoolReference)
+ return ((ISystemFilterPoolReference)firstSelection).getProvider();
+ else if (firstSelection instanceof ISystemFilterPoolReferenceManagerProvider)
+ return (ISystemFilterPoolReferenceManagerProvider)firstSelection;
+ else
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * Output method. Do not override.
+ * Convenience method to return the newly created filter after running the action.
+ * Will be null if the user cancelled. Will also be null if you called setShowNamePrompt(false),
+ * in which case you should call getNewFilterStrings().
+ *
+ * When prompting for an unnamed filter, no filter is created. Instead, the user is prompted
+ * for a single filter string. This method returns that string. However, if you happened to
+ * call setDefaultFilterStrings(...) then those are also returned, hence the need for an
+ * array. If not, this will be an array of one, or null if the user cancelled the wizard.
+ *
+ * Shortcut to getFilterStrings()[0].
+ */
+ public String getFilterString()
+ {
+ String[] strings = getFilterStrings();
+ if ((strings!=null) && (strings.length>0))
+ return strings[0];
+ else
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/ISystemFilterWizard.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/ISystemFilterWizard.java
new file mode 100644
index 00000000000..16cfab45ade
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/ISystemFilterWizard.java
@@ -0,0 +1,26 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.filters.dialogs;
+
+import org.eclipse.rse.ui.filters.SystemFilterDialogInterface;
+import org.eclipse.rse.ui.wizards.ISystemWizard;
+
+
+public interface ISystemFilterWizard
+ extends ISystemWizard, SystemFilterDialogInterface
+{
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/ISystemNewFilterWizardConfigurator.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/ISystemNewFilterWizardConfigurator.java
new file mode 100644
index 00000000000..5b7ff29e868
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/ISystemNewFilterWizardConfigurator.java
@@ -0,0 +1,121 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.filters.dialogs;
+
+/**
+ * Much of the new filter wizard is configurable, especially with respect to translated strings.
+ * While there exists setters and overridable methods for most of it, sometimes that gets overwhelming.
+ * This interface is designed to capture all the configurable attributes that are not likely to change
+ * from usage to usage of the wizard (eg, not context sensitive) such that for convenience you can
+ * implement it in a class and instantiate a singleton instance of that class to re-use for your
+ * wizard.
+ *
+ * We do not typically override this to produce our own change filter dialog ... rather we usually
+ * call the configuration methods to affect it. At a minimum, we usually want to set the {@link #setFilterStringEditPane(SystemFilterStringEditPane) editpane},
+ * which is used to prompt for a new filter string or change an existing one. We usually share the
+ * same edit pane with the {@link SystemNewFilterWizard} wizard.
+ */
+public class SystemChangeFilterDialog extends SystemPromptDialog
+ implements ISystemPageCompleteListener, ISystemChangeFilterPaneEditPaneSupplier
+{
+
+ protected SystemChangeFilterPane changeFilterPane;
+ protected SystemFilterStringEditPane editPane;
+
+ /**
+ * Constructor
+ */
+ public SystemChangeFilterDialog(Shell shell)
+ {
+ this(shell, SystemResources.RESID_CHGFILTER_TITLE);
+ }
+ /**
+ * Constructor, when unique title desired
+ */
+ public SystemChangeFilterDialog(Shell shell, String title)
+ {
+ super(shell, title);
+ changeFilterPane = new SystemChangeFilterPane(shell, this, this);
+ changeFilterPane.addPageCompleteListener(this);
+ setHelp();
+ }
+
+ /**
+ * Overridable extension point for setting dialog help
+ */
+ protected void setHelp()
+ {
+ setHelp(SystemPlugin.HELPPREFIX+"dufr0000");
+ }
+
+ // INPUT/CONFIGURATION
+ /**
+ * Configuration method
+ * Specify an edit pane that prompts the user for the contents of a filter string.
+ */
+ public void setFilterStringEditPane(SystemFilterStringEditPane editPane)
+ {
+ this.editPane = editPane;
+ }
+ /**
+ * Configuration method
+ * Set the contextual system filter pool reference manager provider. Will be non-null if the
+ * current selection is a reference to a filter pool or filter, or a reference manager
+ * provider.
+ *
+ * Set the contextual system filter pool manager provider. Will be non-null if the
+ * current selection is a filter pool or filter, or reference to them, or a manager provider.
+ * Generally this is called when the setSystemFilterPoolReferenceManagerProvider can't be called
+ * for some reason.
+ *
+ * Set the Parent Filter Pool prompt label and tooltip text.
+ */
+ public void setParentPoolPromptLabel(String label, String tip)
+ {
+ changeFilterPane.setParentPoolPromptLabel(label, tip);
+ }
+ /**
+ * Return the parent filter pool prompt label, as set by {@link #setParentPoolPromptLabel(String, String)}
+ */
+ public String getParentPoolPromptLabel()
+ {
+ return changeFilterPane.getParentPoolPromptLabel();
+ }
+ /**
+ * Return the parent filter pool prompt tip, as set by {@link #setParentPoolPromptLabel(String, String)}
+ */
+ public String getParentPoolPromptTip()
+ {
+ return changeFilterPane.getParentPoolPromptTip();
+ }
+
+ /**
+ * Configuration method
+ * Set the name prompt label and tooltip text.
+ */
+ public void setNamePromptLabel(String label, String tip)
+ {
+ changeFilterPane.setNamePromptLabel(label, tip);
+ }
+ /**
+ * Return the name prompt label as set by {@link #setNamePromptLabel(String, String)}
+ */
+ public String getNamePromptLabel()
+ {
+ return changeFilterPane.getNamePromptLabel();
+ }
+ /**
+ * Return the name prompt tip as set by {@link #setNamePromptLabel(String, String)}
+ */
+ public String getNamePromptTip()
+ {
+ return changeFilterPane.getNamePromptTip();
+ }
+
+ /**
+ * Configuration method
+ * Set the label shown in group box around the filter string list, and the tooltip text for the
+ * list box.
+ */
+ public void setListLabel(String label, String tip)
+ {
+ changeFilterPane.setListLabel(label, tip);
+ }
+ /**
+ * Return list label as set by {@link #setListLabel(String, String)}
+ */
+ public String getListLabel()
+ {
+ return changeFilterPane.getListLabel();
+ }
+ /**
+ * Return list tip as set by {@link #setListLabel(String, String)}
+ */
+ public String getListTip()
+ {
+ return changeFilterPane.getListTip();
+ }
+
+ /**
+ * Set the string to show as the first item in the list.
+ * The default is "New filter string"
+ */
+ public void setNewListItemText(String label)
+ {
+ changeFilterPane.setNewListItemText(label);
+ }
+ /**
+ * Return the text for the list item, as set by {@link #setNewListItemText(String)},
+ * or the default if not set.
+ */
+ public String getNewListItemText()
+ {
+ return changeFilterPane.getNewListItemText();
+ }
+
+ /**
+ * Configuration method
+ * Call this to specify a validator for the filter string. It will be called per keystroke.
+ * A default validator is supplied otherwise: ValidatorFilterString.
+ *
+ * Set the error message to use when the user is editing or creating a filter string, and the
+ * Apply processing detects a duplicate filter string in the list.
+ */
+ public void setDuplicateFilterStringErrorMessage(SystemMessage msg)
+ {
+ changeFilterPane.setDuplicateFilterStringErrorMessage(msg);
+ }
+ /**
+ * Return results of {@link #setDuplicateFilterStringErrorMessage(SystemMessage)}
+ */
+ public SystemMessage getDuplicateFilterStringErrorMessage()
+ {
+ return changeFilterPane.getDuplicateFilterStringErrorMessage();
+ }
+
+ /**
+ * Configuration method
+ * Specify if you want to include a test button or not. Appears with "Apply" and "Reset"
+ */
+ public void setWantTestButton(boolean wantTestButton)
+ {
+ changeFilterPane.setWantTestButton(wantTestButton);
+ }
+ /**
+ * Return whether a test button is wanted or not, as set by {@link #setWantTestButton(boolean)}
+ */
+ public boolean getWantTestButton()
+ {
+ return changeFilterPane.getWantTestButton();
+ }
+
+ /**
+ * Set if the edit pane is not to be editable
+ */
+ public void setEditable(boolean editable)
+ {
+ changeFilterPane.setEditable(editable);
+ }
+ /**
+ * Return whether the edit pane is editable, as set by {@link #setEditable(boolean)}
+ */
+ public boolean getEditable()
+ {
+ return changeFilterPane.getEditable();
+ }
+
+ /**
+ * Set if the user is to be allowed to create multiple filter strings or not. Default is true
+ */
+ public void setSupportsMultipleStrings(boolean multi)
+ {
+ changeFilterPane.setSupportsMultipleStrings(multi);
+ }
+ /**
+ * Return whether the user is to be allowed to create multiple filter strings or not. Default is true
+ */
+ public boolean getSupportsMultipleStrings()
+ {
+ return changeFilterPane.getSupportsMultipleStrings();
+ }
+
+ // LIFECYCLE
+ /**
+ * Intercept of parent so we can set the input filter, and deduce whether
+ * strings are case sensitive and if duplicates are allowed.
+ * Not typically overridden, but if you do, be sure to call super!
+ */
+ public void setInputObject(Object inputObject)
+ {
+ changeFilterPane.setInputObject(inputObject);
+ }
+
+ /**
+ * Returns the control (the list view) to recieve initial focus control
+ */
+ protected Control getInitialFocusControl()
+ {
+ return changeFilterPane.getInitialFocusControl();
+ }
+ /**
+ * Populates the content area
+ */
+ protected Control createInner(Composite parent)
+ {
+ return changeFilterPane.createContents(parent);
+ }
+ /**
+ * Intercept of parent so we can reset the default button
+ */
+ protected void createButtonsForButtonBar(Composite parent)
+ {
+ super.createButtonsForButtonBar(parent);
+ getShell().setDefaultButton(changeFilterPane.getApplyButton()); // defect 46129
+ }
+ /**
+ * Return our edit pane. Overriding this is an alternative to calling setEditPane.
+ * Method is declared in {@link ISystemChangeFilterPaneEditPaneSupplier}.
+ */
+ public SystemFilterStringEditPane getFilterStringEditPane(Shell shell)
+ {
+ if (editPane == null)
+ editPane = new SystemFilterStringEditPane(shell);
+ return editPane;
+ }
+
+ /**
+ * Parent override.
+ * Called when user presses OK button.
+ * This is when we save all the changes the user made.
+ */
+ protected boolean processOK()
+ {
+ return changeFilterPane.processOK();
+ }
+
+ /**
+ * Parent override.
+ * Called when user presses CLOSE button. We simply blow away all their changes!
+ */
+ protected boolean processCancel()
+ {
+ return changeFilterPane.processCancel();
+ }
+
+
+ /**
+ * The comleteness of the page has changed.
+ * This is a callback from SystemChangeFilterPane.
+ */
+ public void setPageComplete(boolean complete)
+ {
+ super.setPageComplete(complete);
+ }
+
+ /**
+ * Returns parent shell, under which this window's shell is created.
+ *
+ * @return the parent shell, or null
if there is no parent shell
+ */
+ public Shell getParentShell()
+ {
+ return super.getParentShell();
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterNewFilterPoolWizard.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterNewFilterPoolWizard.java
new file mode 100644
index 00000000000..8bf37f441a7
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterNewFilterPoolWizard.java
@@ -0,0 +1,197 @@
+/********************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.filters.dialogs;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.filters.ISystemFilterPool;
+import org.eclipse.rse.filters.ISystemFilterPoolManager;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.filters.SystemFilterPoolDialogOutputs;
+import org.eclipse.rse.ui.filters.actions.SystemFilterAbstractFilterPoolAction;
+import org.eclipse.rse.ui.messages.SystemMessageDialog;
+import org.eclipse.rse.ui.validators.ValidatorFolderName;
+import org.eclipse.rse.ui.wizards.AbstractSystemWizard;
+
+
+/**
+ * Wizard for creating a new system filter pool.
+ */
+public class SystemFilterNewFilterPoolWizard
+ extends AbstractSystemWizard
+ implements SystemFilterPoolWizardInterface
+{
+ protected SystemFilterNewFilterPoolWizardMainPageInterface mainPage;
+ protected ValidatorFolderName usv;
+ protected SystemFilterPoolDialogOutputs output;
+ protected SystemFilterAbstractFilterPoolAction caller;
+ protected ISystemFilterPoolManager[] mgrs;
+
+ /**
+ * Constructor that uses a default title and image
+ */
+ public SystemFilterNewFilterPoolWizard()
+ {
+ this(SystemResources.RESID_NEWFILTERPOOL_TITLE,
+ SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_NEWFILTERPOOLWIZARD_ID));
+ }
+ /**
+ * Constructor
+ * @param label The title for this wizard
+ * @param image The image for this wizard
+ */
+ public SystemFilterNewFilterPoolWizard(String title, ImageDescriptor image)
+ {
+ super(title, image);
+ }
+
+ /**
+ * Set the help context Id (infoPop) for this wizard. This must be fully qualified by
+ * plugin ID.
+ */
+ public void setHelpContextId(String id)
+ {
+ super.setHelp(id);
+ }
+
+ /**
+ * Creates the wizard pages.
+ * This method is an override from the parent Wizard class.
+ */
+ public void addPages()
+ {
+ try {
+ mainPage = createMainPage();
+ addPage((WizardPage)mainPage);
+ //super.addPages();
+ } catch (Exception exc)
+ {
+ System.out.println("Unexpected error in addPages of NewFilterPoolWizard: "+exc.getMessage() + ", " + exc.getClass().getName());
+ }
+ }
+
+
+ /**
+ * Creates the wizard's main page.
+ */
+ protected SystemFilterNewFilterPoolWizardMainPageInterface createMainPage()
+ {
+ mainPage = new SystemFilterNewFilterPoolWizardDefaultMainPage(this,
+ caller.getDialogTitle(), caller.getDialogPrompt());
+ mgrs = caller.getFilterPoolManagers();
+ if (mgrs != null)
+ {
+ mainPage.setFilterPoolManagers(mgrs);
+ mainPage.setFilterPoolManagerNameSelectionIndex(caller.getFilterPoolManagerNameSelectionIndex());
+ }
+ return mainPage;
+ }
+
+ /**
+ * Completes processing of the wizard. If this
+ * method returns true, the wizard will close;
+ * otherwise, it will stay active.
+ * This method is an override from the parent Wizard class.
+ *
+ * @return whether the wizard finished successfully
+ */
+ public boolean performFinish()
+ {
+ if (mainPage.performFinish())
+ {
+ output = mainPage.getFilterPoolDialogOutputs();
+ String mgrName = output.filterPoolManagerName;
+ ISystemFilterPoolManager mgr = null;
+ try
+ {
+ if (mgrName != null)
+ {
+ for (int idx=0; (mgr==null)&&(idxISystemValidator
reports an error the error message is displayed
+ * in the Dialog's message line.
+ * @see #setNameValidator(ISystemValidator)
+ */
+ protected SystemMessage validateNameInput()
+ {
+ int mgrIndex = 0;
+ if (mgrCombo != null)
+ mgrIndex = mgrCombo.getSelectionIndex();
+ if (mgrIndex < 0)
+ mgrIndex = 0;
+ ISystemValidator iiv = validatorsByManager[mgrIndex];
+ SystemMessage errorMessage= null;
+ if (iiv != null)
+ errorMessage= iiv.validate(textName.getText());
+ if (errorMessage != null)
+ setErrorMessage(errorMessage);
+ else
+ clearErrorMessage();
+ setPageComplete(errorMessage == null);
+ return errorMessage;
+ }
+
+ /**
+ * Set the name length for the filter pool based on the
+ * currently selected manager
+ */
+ protected void setPoolNameTextLimit(int mgrIndex)
+ {
+ if (mgrIndex < 0)
+ return;
+ ISystemValidator iiv = validatorsByManager[mgrIndex];
+ if (iiv != null)
+ {
+ int limit = -1;
+ if (iiv instanceof ISystemValidator)
+ limit = ((ISystemValidator)iiv).getMaximumNameLength();
+ if (limit == -1)
+ limit = ValidatorFilterPoolName.MAX_FILTERPOOLNAME_LENGTH; // default is 50
+ textName.setTextLimit(limit);
+ }
+ }
+
+ // --------------------------------- //
+ // METHODS FOR EXTRACTING USER DATA ...
+ // --------------------------------- //
+ /**
+ * Return user-entered pool name.
+ * Call this after finish ends successfully.
+ */
+ public String getPoolName()
+ {
+ return textName.getText().trim();
+ }
+ /**
+ * Return user-selected pool manager name.
+ * Call this after finish ends successfully.
+ */
+ public String getPoolManagerName()
+ {
+ if (mgrCombo!=null)
+ return mgrCombo.getText();
+ else
+ return null;
+ }
+
+ /**
+ * Return an object containing user-specified information pertinent to filter pool actions
+ */
+ public SystemFilterPoolDialogOutputs getFilterPoolDialogOutputs()
+ {
+ SystemFilterPoolDialogOutputs output = new SystemFilterPoolDialogOutputs();
+ output.filterPoolName = getPoolName();
+ output.filterPoolManagerName = getPoolManagerName();
+ return output;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterNewFilterPoolWizardMainPageInterface.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterNewFilterPoolWizardMainPageInterface.java
new file mode 100644
index 00000000000..e7e3f092414
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterNewFilterPoolWizardMainPageInterface.java
@@ -0,0 +1,71 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.filters.dialogs;
+
+import org.eclipse.rse.filters.ISystemFilterPoolManager;
+import org.eclipse.rse.ui.filters.SystemFilterPoolDialogOutputs;
+import org.eclipse.rse.ui.validators.ISystemValidator;
+import org.eclipse.rse.ui.wizards.ISystemWizardPage;
+
+
+
+/**
+ * Interface for new Filter wizard main page classes
+ */
+public interface SystemFilterNewFilterPoolWizardMainPageInterface extends ISystemWizardPage
+{
+ /**
+ * Call this to specify a validator for the pool name. It will be called per keystroke.
+ * Only call this if you do not call setFilterPoolManagers!
+ */
+ public void setNameValidator(ISystemValidator v);
+ /**
+ * Even if you call setFilterPoolManagers and you really want your own validators,
+ * then call this. Otherwise, FolderNameValidator will be called for you.
+ * The input must be an array of validators that is the same length as the array
+ * of filter pool managers. Call this AFTER setFilterPoolManagers!
+ */
+ public void setNameValidators(ISystemValidator[] v);
+ /**
+ * Call this to specify the list of filter pool managers to allow the user to select from.
+ * Either call this or override getFilterPoolManagerNames, or leave null and this prompt will
+ * not show.
+ */
+ public void setFilterPoolManagers(ISystemFilterPoolManager[] mgrs);
+ /**
+ * Set the zero-based index of the manager name to preselect.
+ * The default is zero.
+ * Either call this or override getFilterPoolManagerNameSelectionIndex.
+ */
+ public void setFilterPoolManagerNameSelectionIndex(int index);
+
+ /**
+ * Return user-entered pool name.
+ * Call this after finish ends successfully.
+ */
+ public String getPoolName();
+ /**
+ * Return user-selected pool manager name.
+ * Call this after finish ends successfully.
+ */
+ public String getPoolManagerName();
+ /**
+ * Return an object containing user-specified information pertinent to filter pool actions
+ */
+ public SystemFilterPoolDialogOutputs getFilterPoolDialogOutputs();
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterPoolWizardDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterPoolWizardDialog.java
new file mode 100644
index 00000000000..78dc6791a3f
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterPoolWizardDialog.java
@@ -0,0 +1,83 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.filters.dialogs;
+import org.eclipse.rse.ui.dialogs.SystemWizardDialog;
+import org.eclipse.rse.ui.filters.SystemFilterPoolDialogInterface;
+import org.eclipse.rse.ui.filters.SystemFilterPoolDialogOutputs;
+import org.eclipse.rse.ui.filters.actions.SystemFilterAbstractFilterPoolAction;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * Extends WizardDialog to support ability to pass data in from the
+ * common wizard action class, and get data out.
+ * This is deferred to the actual wizard, which in turn defers to the wizard's first page.
+ */
+public class SystemFilterPoolWizardDialog
+ extends SystemWizardDialog
+ implements SystemFilterPoolDialogInterface
+{
+ // all ctors are from parent...
+ /**
+ * Constructor
+ */
+ public SystemFilterPoolWizardDialog(Shell shell, SystemFilterPoolWizardInterface wizard)
+ {
+ super(shell, wizard);
+ }
+ /**
+ * Constructor two. Use when you have an input object at instantiation time.
+ */
+ public SystemFilterPoolWizardDialog(Shell shell, SystemFilterPoolWizardInterface wizard, Object inputObject)
+ {
+ super(shell,wizard,inputObject);
+ }
+
+ /**
+ * Return wrapped filter pool wizard
+ */
+ public SystemFilterPoolWizardInterface getFilterPoolWizard()
+ {
+ return (SystemFilterPoolWizardInterface)getWizard();
+ }
+
+ /**
+ * Return an object containing user-specified information pertinent to filter pool actions
+ */
+ public SystemFilterPoolDialogOutputs getFilterPoolDialogOutputs()
+ {
+ return getFilterPoolWizard().getFilterPoolDialogOutputs();
+ }
+
+ /**
+ * Allow base action to pass instance of itself for callback to get info
+ */
+ public void setFilterPoolDialogActionCaller(SystemFilterAbstractFilterPoolAction caller)
+ {
+ getFilterPoolWizard().setFilterPoolDialogActionCaller(caller);
+ }
+
+ /**
+ * Set the help context id for this wizard
+ */
+ public void setHelpContextId(String id)
+ {
+ super.setHelp(id);
+ }
+
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterPoolWizardInterface.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterPoolWizardInterface.java
new file mode 100644
index 00000000000..155cd6a453b
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterPoolWizardInterface.java
@@ -0,0 +1,27 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.filters.dialogs;
+import org.eclipse.rse.ui.filters.SystemFilterPoolDialogInterface;
+import org.eclipse.rse.ui.wizards.ISystemWizard;
+
+/**
+ * An interface for filter pool wizards to implement
+ */
+public interface SystemFilterPoolWizardInterface
+ extends ISystemWizard, SystemFilterPoolDialogInterface
+{
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterWizardDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterWizardDialog.java
new file mode 100644
index 00000000000..69f4db33897
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterWizardDialog.java
@@ -0,0 +1,75 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.filters.dialogs;
+import org.eclipse.rse.ui.dialogs.SystemWizardDialog;
+import org.eclipse.rse.ui.filters.SystemFilterDialogInterface;
+import org.eclipse.rse.ui.filters.SystemFilterDialogOutputs;
+import org.eclipse.rse.ui.filters.actions.SystemFilterAbstractFilterAction;
+import org.eclipse.swt.widgets.Shell;
+
+
+
+/**
+ * Extends WizardDialog to support ability to pass data in from the
+ * common wizard action class, and get data out.
+ * This is deferred to the actual wizard, which in turn defers to the wizard's first page.
+ */
+public class SystemFilterWizardDialog
+ extends SystemWizardDialog
+ implements SystemFilterDialogInterface
+{
+
+ // all ctors are from parent...
+ /**
+ * Constructor
+ */
+ public SystemFilterWizardDialog(Shell shell, ISystemFilterWizard wizard)
+ {
+ super(shell, wizard);
+ }
+ /**
+ * Constructor two. Use when you have an input object at instantiation time.
+ */
+ public SystemFilterWizardDialog(Shell shell, ISystemFilterWizard wizard, Object inputObject)
+ {
+ super(shell,wizard,inputObject);
+ }
+
+ /**
+ * Return wrapped filter wizard
+ */
+ public ISystemFilterWizard getFilterWizard()
+ {
+ return (ISystemFilterWizard)getWizard();
+ }
+
+ /**
+ * Return an object containing user-specified information pertinent to filter actions
+ */
+ public SystemFilterDialogOutputs getFilterDialogOutputs()
+ {
+ return getFilterWizard().getFilterDialogOutputs();
+ }
+
+ /**
+ * Allow base action to pass instance of itself for callback to get info
+ */
+ public void setFilterDialogActionCaller(SystemFilterAbstractFilterAction caller)
+ {
+ getFilterWizard().setFilterDialogActionCaller(caller);
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterWorkWithFilterPoolsDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterWorkWithFilterPoolsDialog.java
new file mode 100644
index 00000000000..2e4758b4b76
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterWorkWithFilterPoolsDialog.java
@@ -0,0 +1,657 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.filters.dialogs;
+import java.util.Vector;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.ToolBarManager;
+import org.eclipse.jface.viewers.AbstractTreeViewer;
+import org.eclipse.jface.viewers.IBasicPropertyConstants;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.filters.ISystemFilterPool;
+import org.eclipse.rse.filters.ISystemFilterPoolManager;
+import org.eclipse.rse.filters.ISystemFilterPoolReferenceManager;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
+import org.eclipse.rse.ui.ISystemDeleteTarget;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.ISystemRenameTarget;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.SystemWidgetHelpers;
+import org.eclipse.rse.ui.actions.ISystemAction;
+import org.eclipse.rse.ui.actions.SystemCommonDeleteAction;
+import org.eclipse.rse.ui.actions.SystemCommonRenameAction;
+import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
+import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
+import org.eclipse.rse.ui.dialogs.SystemSimpleContentProvider;
+import org.eclipse.rse.ui.filters.SystemFilterPoolDialogInterface;
+import org.eclipse.rse.ui.filters.SystemFilterPoolDialogOutputs;
+import org.eclipse.rse.ui.filters.SystemFilterPoolManagerUIProvider;
+import org.eclipse.rse.ui.filters.SystemFilterUIHelpers;
+import org.eclipse.rse.ui.filters.SystemFilterWorkWithFilterPoolsTreeViewer;
+import org.eclipse.rse.ui.filters.actions.SystemFilterAbstractFilterPoolAction;
+import org.eclipse.rse.ui.filters.actions.SystemFilterCopyFilterPoolAction;
+import org.eclipse.rse.ui.filters.actions.SystemFilterMoveFilterPoolAction;
+import org.eclipse.rse.ui.filters.actions.SystemFilterNewFilterPoolAction;
+import org.eclipse.rse.ui.filters.actions.SystemFilterWorkWithFilterPoolsRefreshAllAction;
+import org.eclipse.rse.ui.messages.ISystemMessageLine;
+import org.eclipse.rse.ui.messages.SystemMessageDialog;
+import org.eclipse.rse.ui.validators.ValidatorFilterPoolName;
+import org.eclipse.rse.ui.view.ISystemPropertyConstants;
+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.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.Tree;
+
+/**
+ * Dialog for working with filter pools.
+ */
+public class SystemFilterWorkWithFilterPoolsDialog
+ extends SystemPromptDialog
+ implements ISystemMessages, ISystemPropertyConstants,
+ ISelectionChangedListener,
+ ISystemDeleteTarget, ISystemRenameTarget,
+ SystemFilterPoolDialogInterface
+ //,ISystemResourceChangeListener
+{
+
+ private String promptString;
+ private Label prompt;
+ private SystemFilterWorkWithFilterPoolsTreeViewer tree;
+ private ToolBar toolbar = null;
+ private ToolBarManager toolbarMgr = null;
+ private SystemSimpleContentProvider provider = new SystemSimpleContentProvider();
+ private SystemSimpleContentElement filterPoolContent;
+ private SystemSimpleContentElement preSelectedRoot = null;
+ private ISystemFilterPoolManager[] filterPoolManagers;
+ private SystemFilterPoolManagerUIProvider caller = null;
+ private boolean initializing = false;
+
+ //private ActionContributionItem newActionItem, deleteActionItem, renameActionItem;
+ private SystemFilterWorkWithFilterPoolsRefreshAllAction refreshAction = null;
+ private SystemFilterNewFilterPoolAction newAction = null;
+ //private SystemSimpleDeleteAction dltAction = null;
+ private SystemCommonDeleteAction dltAction = null;
+ //private SystemSimpleRenameAction rnmAction = null;
+ private SystemCommonRenameAction rnmAction = null;
+ private SystemFilterCopyFilterPoolAction cpyAction = null;
+ private SystemFilterMoveFilterPoolAction movAction = null;
+ private IAction[] contextMenuActions = null;
+
+
+ /**
+ * Constructor
+ */
+ public SystemFilterWorkWithFilterPoolsDialog(Shell shell, String title, String prompt,
+ SystemFilterPoolManagerUIProvider caller)
+ //SystemFilterPoolManager[] filterPoolManagers,
+ //SystemSimpleContentElement filterPoolContent)
+ {
+ super(shell, title);
+ this.caller = caller;
+ promptString = prompt;
+ this.filterPoolContent = caller.getTreeModel();
+ this.filterPoolManagers = caller.getFilterPoolManagers();
+ this.preSelectedRoot = caller.getTreeModelPreSelection(filterPoolContent);
+ setCancelButtonLabel(SystemResources.BUTTON_CLOSE);
+ setShowOkButton(false);
+ //pack();
+ }
+
+ /**
+ * Set the root to preselect
+ */
+ public void setRootToPreselect(SystemSimpleContentElement preSelectedRoot)
+ {
+ this.preSelectedRoot = preSelectedRoot;
+ }
+
+ /**
+ * Create message line. Intercept so we can set msg line of form.
+ */
+ protected ISystemMessageLine createMessageLine(Composite c)
+ {
+ ISystemMessageLine msgLine = super.createMessageLine(c);
+ return fMessageLine;
+ }
+
+ /**
+ * @see SystemPromptDialog#getInitialFocusControl()
+ */
+ protected Control getInitialFocusControl()
+ {
+ return tree.getControl();
+ }
+
+ /**
+ * Set the pool name validator for the rename action.
+ * The work-with dialog automatically calls setExistingNamesList on it for each selection.
+ */
+ public void setFilterPoolNameValidator(ValidatorFilterPoolName pnv)
+ {
+ }
+
+ /**
+ * @see SystemPromptDialog#createInner(Composite)
+ */
+ protected Control createInner(Composite parent)
+ {
+ //System.out.println("INSIDE CREATEINNER");
+ /*
+ // top level composite
+ Composite composite = new Composite(parent,SWT.NONE);
+ composite.setLayout(new GridLayout());
+ GridData data = new GridData();
+ data.verticalAlignment = GridData.FILL;
+ data.horizontalAlignment = GridData.FILL;
+ data.grabExcessHorizontalSpace = true;
+ composite.setLayoutData(data);
+ */
+
+ // Inner composite
+ Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, 1);
+
+ // PROMPT
+ prompt = SystemWidgetHelpers.createLabel(composite_prompts, promptString);
+
+ // TOOLBAR
+ createToolBar(composite_prompts);
+
+ // WORK-WITH TREE
+ initializing = true;
+ tree = new SystemFilterWorkWithFilterPoolsTreeViewer(getShell(), this, new Tree(composite_prompts, SWT.SINGLE | SWT.BORDER));
+ GridData treeData = new GridData();
+ treeData.horizontalAlignment = GridData.FILL;
+ treeData.grabExcessHorizontalSpace = true;
+ treeData.widthHint = 300;
+ treeData.heightHint= 300;
+ treeData.verticalAlignment = GridData.CENTER;
+ treeData.grabExcessVerticalSpace = true;
+ tree.getTree().setLayoutData(treeData);
+
+ tree.setContentProvider(provider);
+ tree.setLabelProvider(provider);
+
+ // populate tree
+ if (filterPoolContent != null)
+ {
+ filterPoolContent.setData(tree); // so actions can refresh our tree
+ tree.setInput(filterPoolContent);
+ }
+
+ if (preSelectedRoot != null)
+ tree.setSelection(new StructuredSelection(preSelectedRoot), true);
+
+ // expand and pre-check
+ tree.expandAll();
+ tree.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS);
+
+ // add selection listener to tree
+ tree.addSelectionChangedListener(this);
+
+ // populate toolbar
+ populateToolBar(getShell(), tree);
+
+ initializing = false;
+
+ return composite_prompts;
+ }
+
+ /**
+ * Callback from tree when refresh is done
+ */
+ public boolean refreshTree()
+ {
+ if (initializing)
+ return false;
+ this.filterPoolContent = caller.getTreeModel();
+ this.filterPoolManagers = caller.getFilterPoolManagers();
+ this.preSelectedRoot = caller.getTreeModelPreSelection(filterPoolContent);
+ filterPoolContent.setData(tree); // so actions can refresh our tree
+ tree.setInput(filterPoolContent); // hmm, hope we don't go into a loop!
+ //System.out.println("in refreshTree");
+ return true;
+ }
+
+ /**
+ * Create the toolbar displayed at the top of the dialog
+ */
+ protected void createToolBar(Composite parent)
+ {
+ toolbar = new ToolBar(parent, SWT.FLAT | SWT.WRAP);
+ toolbarMgr = new ToolBarManager(toolbar);
+ }
+ /**
+ * Populate the toolbar displayed at the top of the dialog
+ */
+ protected void populateToolBar(Shell shell, SystemFilterWorkWithFilterPoolsTreeViewer tree)
+ {
+ newAction = new SystemFilterNewFilterPoolAction(shell,this);
+ //dltAction = new SystemSimpleDeleteAction(shell,this);
+ dltAction = new SystemCommonDeleteAction(shell,this);
+ rnmAction = new SystemCommonRenameAction(shell,this);
+ // undo typical settings...
+ rnmAction.allowOnMultipleSelection(false);
+ rnmAction.setProcessAllSelections(false);
+ //rnmAction = new SystemSimpleRenameAction(shell,this);
+ //poolNameValidator = new ValidatorFilterPoolName((Vector)null);
+ //rnmAction.setNameValidator(poolNameValidator);
+ cpyAction = new SystemFilterCopyFilterPoolAction(shell);
+ cpyAction.setSelectionProvider(this);
+ movAction = new SystemFilterMoveFilterPoolAction(shell);
+ movAction.setSelectionProvider(this);
+ refreshAction = new SystemFilterWorkWithFilterPoolsRefreshAllAction(tree, shell);
+
+ contextMenuActions = new IAction[6];
+ contextMenuActions[0] = newAction;
+ contextMenuActions[1] = rnmAction;
+ contextMenuActions[2] = cpyAction;
+ contextMenuActions[3] = movAction;
+ contextMenuActions[4] = dltAction;
+ contextMenuActions[5] = refreshAction;
+
+ for (int idx=0; idx
+ *
+ * clearErrorMessage
is called.
+ */
+public interface ISystemMessageLine
+{
+
+ /**
+ * Clears the currently displayed error message and redisplayes
+ * the message which was active before the error message was set.
+ */
+ public void clearErrorMessage();
+ /**
+ * Clears the currently displayed message.
+ */
+ public void clearMessage();
+ /**
+ * Get the currently displayed error text.
+ * @return The error message. If no error message is displayed null
is returned.
+ */
+ public String getErrorMessage();
+
+ /**
+ * Get the currently displayed error text.
+ * @return The error message. If no error message is displayed null
is returned.
+ */
+ public SystemMessage getSystemErrorMessage();
+ /**
+ * Get the currently displayed message.
+ * @return The message. If no message is displayed null
if the container must be a direct ancestor of the child item,
+ * is returned.
+ */
+ public String getMessage();
+
+ /**
+ * Display the given error message. A currently displayed message
+ * is saved and will be redisplayed when the error message is cleared.
+ */
+ public void setErrorMessage(String message);
+
+ /**
+ * Display the given error message. A currently displayed message
+ * is saved and will be redisplayed when the error message is cleared.
+ */
+ public void setErrorMessage(SystemMessage message);
+ /**
+ * Display the given exception as an error message. This is a convenience
+ * method... a generic SystemMessage is used for exceptions.
+ */
+ public void setErrorMessage(Throwable exc);
+ /**
+ * Set the message text. If the message line currently displays an error,
+ * the message is stored and will be shown after a call to clearErrorMessage
+ */
+ public void setMessage(String message);
+
+ /**
+ *If the message line currently displays an error,
+ * the message is stored and will be shown after a call to clearErrorMessage
+ */
+ public void setMessage(SystemMessage message);
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/ISystemMessageLineTarget.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/ISystemMessageLineTarget.java
new file mode 100644
index 00000000000..5dfa239664d
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/ISystemMessageLineTarget.java
@@ -0,0 +1,33 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.messages;
+/**
+ * Implemented by any class that supports being passed an ISystemMessageLine to
+ * target messages to. This is useful in re-usable forms so that the parent dialog
+ * or wizard can pass in "this" in order to allow the form to issue messages.
+ */
+public interface ISystemMessageLineTarget
+{
+ /**
+ * Set the message line to use for issuing messages
+ */
+ public void setMessageLine(ISystemMessageLine msgLine);
+ /**
+ * Get the message line to use for issuing messages
+ */
+ public ISystemMessageLine getMessageLine();
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/StatusLineManagerAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/StatusLineManagerAdapter.java
new file mode 100644
index 00000000000..4fadeb73bc7
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/StatusLineManagerAdapter.java
@@ -0,0 +1,123 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.messages;
+
+import org.eclipse.jface.action.IStatusLineManager;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+
+
+/**
+ * This class adapts the eclipse IStatusLineManager to an ISystemMessageLine.
+ *
+ * @author yantzi
+ */
+public class StatusLineManagerAdapter implements ISystemMessageLine {
+
+ private IStatusLineManager statusLine;
+ private String message, errorMessage;
+ private SystemMessage sysErrorMessage;
+
+ /**
+ * Constructor
+ *
+ * @param statusLineManager the status line manager to adapt to an ISystemMessageLine
+ */
+ public StatusLineManagerAdapter(IStatusLineManager statusLineManager)
+ {
+ this.statusLine = statusLineManager;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.core.ui.messages.ISystemMessageLine#clearErrorMessage()
+ */
+ public void clearErrorMessage() {
+ errorMessage = null;
+ sysErrorMessage = null;
+ if (statusLine != null)
+ statusLine.setErrorMessage(errorMessage);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.core.ui.messages.ISystemMessageLine#clearMessage()
+ */
+ public void clearMessage() {
+ message = null;
+ if (statusLine != null)
+ statusLine.setMessage(message);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.core.ui.messages.ISystemMessageLine#getErrorMessage()
+ */
+ public String getErrorMessage() {
+ return errorMessage;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.core.ui.messages.ISystemMessageLine#getSystemErrorMessage()
+ */
+ public SystemMessage getSystemErrorMessage() {
+ return sysErrorMessage;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.core.ui.messages.ISystemMessageLine#getMessage()
+ */
+ public String getMessage() {
+ return message;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.core.ui.messages.ISystemMessageLine#setErrorMessage(java.lang.String)
+ */
+ public void setErrorMessage(String message) {
+ this.errorMessage = message;
+ if (statusLine != null)
+ statusLine.setErrorMessage(message);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.core.ui.messages.ISystemMessageLine#setErrorMessage(org.eclipse.rse.core.ui.messages.SystemMessage)
+ */
+ public void setErrorMessage(SystemMessage message) {
+ sysErrorMessage = message;
+ setErrorMessage(message.getLevelOneText());
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.core.ui.messages.ISystemMessageLine#setErrorMessage(java.lang.Throwable)
+ */
+ public void setErrorMessage(Throwable exc) {
+ setErrorMessage(exc.getMessage());
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.core.ui.messages.ISystemMessageLine#setMessage(java.lang.String)
+ */
+ public void setMessage(String message) {
+ this.message = message;
+ if (statusLine != null)
+ statusLine.setMessage(message);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.core.ui.messages.ISystemMessageLine#setMessage(org.eclipse.rse.core.ui.messages.SystemMessage)
+ */
+ public void setMessage(SystemMessage message) {
+ setMessage(message.getLevelOneText());
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemDialogPageMessageLine.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemDialogPageMessageLine.java
new file mode 100644
index 00000000000..d862bcaa516
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemDialogPageMessageLine.java
@@ -0,0 +1,391 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.messages;
+
+import org.eclipse.jface.dialogs.DialogPage;
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.rse.core.SystemBasePlugin;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.dialogs.PropertyPage;
+
+
+/**
+ * @deprecated
+ *
implementation of this
+ * null
is returned.
+ */
+ public SystemMessage getSystemErrorMessage() {
+ return sysErrorMessage;
+ }
+
+ /**
+ * Clears the currently displayed error message and redisplayes
+ * the message which was active before the error message was set.
+ */
+ public void clearErrorMessage() {
+ sysErrorMessage = null;
+ stringErrorMessageShowing = false;
+ dlgPage.setErrorMessage(null);
+ setIconToolTipText();
+ }
+
+ /**
+ * Clears the currently displayed non-error message.
+ */
+ public void clearMessage() {
+ dlgPage.setMessage(null);
+ sysMessage = null;
+ setIconToolTipText();
+ }
+
+ /**
+ * Get the currently displayed error text.
+ * @return The error message. If no error message is displayed null
is returned.
+ */
+ public String getErrorMessage() {
+ return dlgPage.getErrorMessage();
+ }
+
+ /**
+ * Get the currently displayed message.
+ * @return The message. If no message is displayed null
property) provided that the old and
+ * new values are different.
+ * is returned.
+ */
+ public String getMessage() {
+ return dlgPage.getMessage();
+ }
+
+ /**
+ * DO NOT CALL THIS METHOD! IT IS ONLY HERE BECAUSE THE INTERFACE NEEDS IT.
+ * RATHER, CALL THE SAME MSG THAT DIALOGPAGE NOW SUPPORTS, AND THEN CALL
+ * setInternalErrorMessage HERE. WE HAVE TO AVOID INFINITE LOOPS.
+ */
+ public void setErrorMessage(String emessage) {
+ internalSetErrorMessage(emessage);
+ //dlgPage.setErrorMessage(emessage);
+ }
+
+ /**
+ * Display the given error message. A currently displayed message
+ * is saved and will be redisplayed when the error message is cleared.
+ */
+ public void setErrorMessage(SystemMessage emessage) {
+ // I removed @deprecated... I think it was a mistake! What would be the replacement? Phil
+ if (emessage == null)
+ clearErrorMessage();
+ else {
+ dlgPage.setErrorMessage(getMessageText(emessage));
+ stringErrorMessageShowing = false;
+ sysErrorMessage = emessage;
+ logMessage(emessage);
+ }
+ setIconToolTipText();
+ }
+
+ /**
+ * Convenience method to set an error message from an exception
+ */
+ public void setErrorMessage(Throwable exc) {
+ SystemMessage msg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_ERROR_UNEXPECTED);
+ msg.makeSubstitution(exc);
+ setErrorMessage(msg);
+ }
+
+ /**
+ * DO NOT CALL THIS METHOD! IT IS ONLY HERE BECAUSE THE INTERFACE NEEDS IT.
+ * RATHER, CALL THE SAME MSG THAT DIALOGPAGE NOW SUPPORTS, AND THEN CALL
+ * setInternalMessage HERE. WE HAVE TO AVOID INFINITE LOOPS.
+ */
+ public void setMessage(String msg) {
+ internalSetMessage(msg);
+ dlgPage.setMessage(msg);
+ }
+
+ /**
+ * Set a non-error message to display.
+ * If the message line currently displays an error,
+ * the message is stored and will be shown after a call to clearErrorMessage
+ */
+ public void setMessage(SystemMessage smessage) {
+ if (smessage == null) {
+ clearMessage(); // phil
+ return;
+ }
+ sysMessage = smessage;
+ int msgType = IMessageProvider.NONE;
+ if ((smessage.getIndicator() == SystemMessage.ERROR) || (smessage.getIndicator() == SystemMessage.UNEXPECTED))
+ msgType = IMessageProvider.ERROR;
+ else if (smessage.getIndicator() == SystemMessage.WARNING)
+ msgType = IMessageProvider.WARNING;
+ else if (smessage.getIndicator() == SystemMessage.INFORMATION || (smessage.getIndicator() == SystemMessage.COMPLETION)) msgType = IMessageProvider.INFORMATION;
+ dlgPage.setMessage(getMessageText(smessage), msgType);
+ logMessage(smessage);
+ setIconToolTipText();
+ }
+
+ /**
+ * logs the message in the appropriate log
+ */
+ private void logMessage(SystemMessage message) {
+ Object[] subList = message.getSubVariables();
+ for (int i = 0; subList != null && i < subList.length; i++) {
+ String msg = message.getFullMessageID() + ": SUB#" + new Integer(i).toString() + ":" + message.getSubValue(subList[i]);
+ if (message.getIndicator() == SystemMessage.INFORMATION || message.getIndicator() == SystemMessage.INQUIRY || message.getIndicator() == SystemMessage.COMPLETION)
+ SystemBasePlugin.logInfo(msg);
+ else if (message.getIndicator() == SystemMessage.WARNING)
+ SystemBasePlugin.logWarning(msg);
+ else if (message.getIndicator() == SystemMessage.ERROR)
+ SystemBasePlugin.logError(msg, null);
+ else if (message.getIndicator() == SystemMessage.UNEXPECTED) {
+ if (i == subList.length - 1)
+ SystemBasePlugin.logError(msg, new Exception());
+ else
+ SystemBasePlugin.logError(msg, null);
+ }
+ }
+ if (subList == null) {
+ String msg = message.getFullMessageID();
+ if (message.getIndicator() == SystemMessage.INFORMATION || message.getIndicator() == SystemMessage.INQUIRY || message.getIndicator() == SystemMessage.COMPLETION)
+ SystemBasePlugin.logInfo(msg);
+ else if (message.getIndicator() == SystemMessage.WARNING)
+ SystemBasePlugin.logWarning(msg);
+ else if (message.getIndicator() == SystemMessage.ERROR)
+ SystemBasePlugin.logError(msg, null);
+ else if (message.getIndicator() == SystemMessage.UNEXPECTED) SystemBasePlugin.logError(msg, new Exception());
+ }
+ }
+
+ // METHODS THAT NEED TO BE CALLED BY DIALOGPAGE IN THEIR OVERRIDE OF SETMESSAGE OR SETERRORMESSAGE
+ /**
+ * Someone has called setMessage(String) on the dialog page. It needs to then call this method
+ * after calling super.setMessage(String) so we can keep track of what is happening.
+ */
+ public void internalSetMessage(String msg) {
+ sysMessage = null; // overrides it if it was set
+ setIconToolTipText();
+ }
+
+ /**
+ * Someone has called setErrorMessage(String) on the dialog page. It needs to then call this method
+ * after calling super.setErrorMessage(String) so we can keep track of what is happening.
+ */
+ public void internalSetErrorMessage(String msg) {
+ sysErrorMessage = null; // overrides if it was set
+ stringErrorMessageShowing = (msg != null);
+ setIconToolTipText();
+ }
+
+ // MOUSeListener INTERFACE METHODS...
+ /**
+ * User double clicked with the mouse
+ */
+ public void mouseDoubleClick(MouseEvent event) {
+ }
+
+ /**
+ * User pressed the mouse button
+ */
+ public void mouseDown(MouseEvent event) {
+ }
+
+ /**
+ * User released the mouse button after pressing it
+ */
+ public void mouseUp(MouseEvent event) {
+ displayMessageDialog();
+ }
+
+ /**
+ * Method to return the current system message to display. If error message is set, return it,
+ * else return message.
+ */
+ public SystemMessage getCurrentMessage() {
+ if (sysErrorMessage != null)
+ return sysErrorMessage;
+ else if (!stringErrorMessageShowing)
+ return sysMessage;
+ else
+ return null;
+ }
+
+ /**
+ * Method to display an error message when the msg button is clicked
+ */
+ private void displayMessageDialog() {
+ SystemMessage currentMessage = getCurrentMessage();
+ if (currentMessage != null) {
+ SystemMessageDialog msgDlg = new SystemMessageDialog(dlgPage.getShell(), currentMessage);
+ msgDlg.openWithDetails();
+ }
+ }
+
+ /**
+ * Method to set the tooltip text on the msg icon to tell the user they can press it for more details
+ */
+ private void setIconToolTipText() {
+ SystemMessage msg = getCurrentMessage();
+ String tip = "";
+ if (msg != null) {
+ //String levelTwo = msg.getLevelTwoText();
+ //if ((levelTwo!=null) && (levelTwo.length()>0))
+ tip = msg.getFullMessageID() + " " + SystemResources.RESID_MSGLINE_TIP;
+ }
+ if (msgIconLabel != null) msgIconLabel.setToolTipText(tip);
+ if (msgTextLabel != null)
+ msgTextLabel.setToolTipText(tip);
+ else
+ msgIconCLabel.setToolTipText(tip);
+ }
+
+ /**
+ * Return the message text to display in the title area, given a system message
+ */
+ private String getMessageText(SystemMessage msg) {
+ //return msg.getFullMessageID()+" " + msg.getLevelOneText();
+ return msg.getLevelOneText();
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemMessageDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemMessageDialog.java
new file mode 100644
index 00000000000..780fa2be892
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemMessageDialog.java
@@ -0,0 +1,727 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.messages;
+
+import java.util.Arrays;
+import java.util.Iterator;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.rse.core.SystemBasePlugin;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.services.clientserver.messages.IndicatorException;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+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.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+
+
+/**
+ */
+public class SystemMessageDialog extends ErrorDialog {
+
+ /**
+ * Reserve room for this many list items.
+ */
+ private static final int LIST_ITEM_COUNT = 5;
+
+ /**
+ * The Details button.
+ */
+ private Button detailsButton=null;
+ /**
+ * The title of the dialog.
+ */
+ private String title;
+
+ /**
+ * The message to display.
+ */
+ private SystemMessage message;
+
+ /**
+ * Exception being reported and logged
+ */
+ private Throwable exc;
+
+
+ /**
+ * The SWT list control that displays the error details.
+ */
+ private Text list;
+
+
+ /**
+ * Indicates whether the error details viewer is currently created.
+ */
+ private boolean listCreated = false;
+
+
+ /**
+ * Filter mask for determining which status items to display.
+ */
+ private int displayMask = 0xFFFF;
+
+
+ /**
+ * The main status object.
+ */
+ private IStatus status;
+
+
+ /**
+ * List of the main error object's detailed errors
+ * (element type:
if no scheduling rule is to be obtained.
+ * @return the scheduling rule to be obtained or IStatus
).
+ */
+ private java.util.List statusList;
+
+ /**
+ * the image to use when displaying the message
+ */
+ // private String imageName;
+ private int imageId;
+
+ /**
+ * show the details panel
+ */
+ private boolean showDetails=false;
+
+ /**
+ * buttons for button area
+ */
+ private String []buttons=null;
+
+ /**
+ * default button
+ */
+ private int defaultIndex=0;
+
+ /**
+ * button id number for the first button in the button bar.clearErrorMessage
is called.
+ */
+public class SystemMessageLine
+ extends Composite
+ implements ISystemMessageLine
+{
+
+ private Button moreButton;
+ private Label image;
+ private Text widget;
+ private Stack messageStack = new Stack();
+ private static final int ERROR = 3;
+ private static final int WARNING = 2;
+ private static final int INFO = 1;
+ private static final int NONE = 0;
+
+ private abstract class MyMessage {
+ /**
+ * @return The Image of the message based on its type.
+ */
+ Image getImage() {
+ int type = getType();
+ switch (type) {
+ case ERROR:
+ return JFaceResources.getImage(org.eclipse.jface.dialogs.Dialog.DLG_IMG_MESSAGE_ERROR);
+ case WARNING:
+ return JFaceResources.getImage(org.eclipse.jface.dialogs.Dialog.DLG_IMG_MESSAGE_WARNING);
+ case INFO:
+ return JFaceResources.getImage(org.eclipse.jface.dialogs.Dialog.DLG_IMG_MESSAGE_INFO);
+ default:
+ return JFaceResources.getImage(org.eclipse.jface.dialogs.Dialog.DLG_IMG_MESSAGE_INFO);
+ }
+ }
+
+ Color getColor() {
+ int type = getType();
+ switch (type) {
+ case ERROR:
+ return getColor(ISystemThemeConstants.MESSAGE_ERROR_COLOR);
+ case WARNING:
+ return getColor(ISystemThemeConstants.MESSAGE_WARNING_COLOR);
+ case INFO:
+ return getColor(ISystemThemeConstants.MESSAGE_INFORMATION_COLOR);
+ default:
+ return getColor(ISystemThemeConstants.MESSAGE_INFORMATION_COLOR);
+ }
+ }
+
+ /**
+ * @param symbolicName the name of the color in the current theme's color registry.
+ * @return an SWT Color or null.
+ */
+ private Color getColor(String symbolicName)
+ {
+ ColorRegistry registry = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry();
+ Color result = registry.get(symbolicName);
+ return result;
+ }
+
+ boolean isError() {
+ return getType() == ERROR;
+ }
+
+ /**
+ * @return The id of the message or null if there is none.
+ */
+ abstract String getID();
+
+ /**
+ * @return The full text of the message to be shown in the message line.
+ */
+ abstract String getText();
+
+ /**
+ * @return The tooltip for the message, to be shown when hovering over the message line.
+ */
+ abstract String getTooltip();
+
+ /**
+ * @return true if there is more text that can be shown in a message details pane.
+ */
+ abstract boolean hasMore();
+
+ /**
+ * @return The SystemMessage version of the message.
+ */
+ abstract SystemMessage toSystemMessage();
+
+ /**
+ * @return The type of the message. One of NONE, INFO, WARNING, or ERROR.
+ */
+ abstract int getType();
+
+ /**
+ * @return The data values associated with this message.
+ */
+ abstract Object[] getData();
+
+ /**
+ * @return true if the message resulted form a strange occurence.
+ */
+ abstract boolean isStrange();
+ }
+
+ private class MySystemMessage extends MyMessage {
+
+ private SystemMessage message = null;
+
+ /**
+ * @param message
+ */
+ MySystemMessage(SystemMessage message) {
+ this.message = message;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#toSystemMessage()
+ */
+ SystemMessage toSystemMessage() {
+ return message;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#getID()
+ */
+ String getID() {
+ return message.getFullMessageID();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#getText()
+ */
+ String getText() {
+ return message.getLevelOneText();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#getTooltip()
+ */
+ String getTooltip() {
+ return message.getFullMessageID() + ": " + getText();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#hasMore()
+ */
+ boolean hasMore() {
+ String text2 = message.getLevelTwoText();
+ return (text2 != null) && (text2.length() > 0);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#wasStrange()
+ */
+ boolean isStrange() {
+ return message.getIndicator() == SystemMessage.UNEXPECTED;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#getData()
+ */
+ Object[] getData() {
+ Object[] result = message.getSubVariables();
+ if (result == null) result = new Object[0];
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#getType()
+ */
+ int getType() {
+ int result = NONE;
+ if (message != null) {
+ switch (message.getIndicator()) {
+ case SystemMessage.COMPLETION:
+ case SystemMessage.INFORMATION:
+ case SystemMessage.INQUIRY:
+ result = INFO;
+ break;
+ case SystemMessage.ERROR:
+ case SystemMessage.UNEXPECTED:
+ result = ERROR;
+ break;
+ case SystemMessage.WARNING:
+ result = WARNING;
+ break;
+ default: result = NONE;
+ }
+ }
+ return result;
+ }
+ }
+
+ private class MyImpromptuMessage extends MyMessage {
+
+ private int type = NONE;
+ private String text1 = "";
+ private String text2 = null;
+
+ /**
+ * @param type The type of the message.
+ * @param text1 The first-level text of the message.
+ */
+ MyImpromptuMessage(int type, String text1) {
+ this.type = type;
+ this.text1 = text1;
+ }
+
+ /**
+ * @param type The type of the message.
+ * @param text1 The first-level text of the message.
+ * @param text2 the second-level text of the message.
+ */
+ MyImpromptuMessage(int type, String text1, String text2) {
+ this.type = type;
+ this.text1 = text1;
+ this.text2 = text2;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#toSystemMessage()
+ */
+ public SystemMessage toSystemMessage() {
+ String id = null;
+ Object[] data = null;
+ if (text2 == null) {
+ id = isError() ? ISystemMessages.MSG_GENERIC_E : ISystemMessages.MSG_GENERIC_I;
+ data = new Object[] {text1};
+ } else {
+ id = isError() ? ISystemMessages.MSG_GENERIC_E_HELP : ISystemMessages.MSG_GENERIC_I_HELP;
+ data = new Object[] {text1, text2};
+ }
+ SystemMessage result = SystemPlugin.getPluginMessage(id, data);
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#getID()
+ */
+ String getID() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#getText()
+ */
+ String getText() {
+ return text1;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#getTooltip()
+ */
+ String getTooltip() {
+ return text1;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#hasMore()
+ */
+ boolean hasMore() {
+ return text2 != null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#wasStrange()
+ */
+ boolean isStrange() {
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#getData()
+ */
+ Object[] getData() {
+ return new Object[0];
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#getType()
+ */
+ int getType() {
+ return type;
+ }
+ }
+
+ /**
+ * Creates a new message line as a child of the given parent.
+ */
+ public SystemMessageLine(Composite parent)
+ {
+ super(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 3;
+ layout.verticalSpacing = 0;
+ layout.horizontalSpacing = 5;
+ layout.marginHeight = 2;
+ layout.marginWidth = 3;
+ setLayout(layout);
+
+ image = new Label(this, SWT.NONE);
+ image.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
+
+ // this is a read-only text field so it is tab enabled and readable by a screen reader.
+ widget = new Text(this, SWT.READ_ONLY | SWT.SINGLE);
+ widget.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, true, false));
+ widget.setBackground(parent.getBackground());
+
+ moreButton = new Button(this, SWT.NONE);
+ moreButton.setImage(SystemPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_HELP_ID));
+ moreButton.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
+ moreButton.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ if (e.getSource().equals(moreButton)) {
+ MyMessage message = getTopMessage();
+ if (message != null) {
+ SystemMessage m = message.toSystemMessage();
+ Shell shell = getShell();
+ SystemMessageDialog dialog = new SystemMessageDialog(shell, m);
+ dialog.openWithDetails();
+ }
+ }
+ }
+ });
+ // add accessibility information to the "more" button
+ moreButton.setToolTipText(SystemResources.RESID_MSGLINE_TIP);
+ moreButton.getAccessible().addAccessibleListener(new AccessibleAdapter() {
+ public void getName(AccessibleEvent e) {
+ getHelp(e);
+ }
+ public void getHelp(AccessibleEvent e) {
+ e.result = moreButton.getToolTipText();
+ }
+ });
+
+ addControlListener(new ControlListener() {
+ public void controlMoved(ControlEvent e) {
+ }
+ public void controlResized(ControlEvent e) {
+ adjustText();
+ layout();
+ }
+ });
+ addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent e) {
+ widget.dispose();
+ moreButton.dispose();
+ image.dispose();
+ }
+ });
+
+ showTopMessage();
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.ui.messages.ISystemMessageLine#clearErrorMessage()
+ */
+ public void clearErrorMessage() {
+ MyMessage message = getTopMessage();
+ if (message != null && message.isError()) {
+ popMessage();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.ui.messages.ISystemMessageLine#clearMessage()
+ */
+ public void clearMessage() {
+ MyMessage message = getTopMessage();
+ if (message != null && !message.isError()) {
+ popMessage();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.ui.messages.ISystemMessageLine#getErrorMessage()
+ */
+ public String getErrorMessage() {
+ MyMessage message = getTopMessage();
+ if (message != null && message.isError()) return message.getText();
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.ui.messages.ISystemMessageLine#getMessage()
+ */
+ public String getMessage() {
+ MyMessage message = getTopMessage();
+ if (message != null && !message.isError()) return message.getText();
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.ui.messages.ISystemMessageLine#getSystemErrorMessage()
+ */
+ public SystemMessage getSystemErrorMessage() {
+ MyMessage message = getTopMessage();
+ if (message != null && message.isError()) return message.toSystemMessage();
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.ui.messages.ISystemMessageLine#setErrorMessage(java.lang.String)
+ */
+ public void setErrorMessage(String message) {
+ MyMessage temp = new MyImpromptuMessage(ERROR, message);
+ pushMessage(temp);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.ui.messages.ISystemMessageLine#setErrorMessage(org.eclipse.rse.services.clientserver.messages.SystemMessage)
+ */
+ public void setErrorMessage(SystemMessage message) {
+ MyMessage temp = new MySystemMessage(message);
+ pushMessage(temp);
+ logMessage(message);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.ui.messages.ISystemMessageLine#setErrorMessage(java.lang.Throwable)
+ */
+ public void setErrorMessage(Throwable throwable)
+ {
+ SystemMessage message = SystemPlugin.getPluginMessage(ISystemMessages.MSG_ERROR_UNEXPECTED);
+ message.makeSubstitution(throwable);
+ setErrorMessage(message);
+ }
+
+ /**
+ * Set the message text. If the message line currently displays an error,
+ * the message is stored and will be shown after a call to clearErrorMessage.
+ */
+ public void setMessage(String message) {
+ MyMessage temp = new MyImpromptuMessage(INFO, message);
+ pushMessage(temp);
+ }
+
+ /**
+ * Set the non-error message text, using a SystemMessage object.
+ * If the message line currently displays an error,
+ * the message is stored and will be shown after a call to clearMessage.
+ * The SystemMessage text is always shown as a "non-error".
+ */
+ public void setMessage(SystemMessage message) {
+ MyMessage temp = new MySystemMessage(message);
+ if (temp.isError()) {
+ temp = new MyImpromptuMessage(NONE, message.getLevelOneText(), message.getLevelTwoText());
+ }
+ pushMessage(temp);
+ }
+
+ /**
+ * Pushes a new message onto the stack and shows it.
+ * @param message The MyMessage to push on the stack.
+ */
+ private void pushMessage(MyMessage message) {
+ messageStack.push(message);
+ showTopMessage();
+ }
+
+ /**
+ * Pops a message off the message stack and shows the new top message.
+ */
+ private void popMessage() {
+ if (!messageStack.isEmpty()) messageStack.pop();
+ showTopMessage();
+ }
+
+ /**
+ * Retrieves the top MyMessage from the stack
+ * @return A MyMessage or null if the stack is empty.
+ */
+ private MyMessage getTopMessage() {
+ if (messageStack.isEmpty()) return null;
+ return (MyMessage) messageStack.peek();
+ }
+
+ /**
+ * Shows the top message on the stack. If the stack is empty it will "show" nothing.
+ */
+ private void showTopMessage() {
+ MyMessage message = getTopMessage();
+ setIcon(message);
+ setText(message);
+ setMoreButton(message);
+ layout();
+ }
+
+ /**
+ * Sets the icon field of the widget to the appropriate symbol depending on the
+ * type of message.
+ * @param message the message used to determine the icon type.
+ */
+ private void setIcon(MyMessage message) {
+ Image t = (message == null) ? null : message.getImage();
+ image.setImage(t);
+ }
+
+ /**
+ * Write the text from a MyMessage to the widget.
+ * @param message the message from which to get the text.
+ */
+ private void setText(MyMessage message) {
+ String text = "";
+ String toolTip = null;
+ Color color = null;
+ if (message != null) {
+ text = message.getText();
+ toolTip = message.getTooltip();
+ color = message.getColor();
+ }
+ widget.setToolTipText(toolTip);
+ widget.setForeground(color);
+ widget.setText(text);
+ widget.setData(text);
+ adjustText();
+ }
+
+ /**
+ * Hide or show the "more" button. If the message has second level text then
+ * the more button is shown.
+ */
+ private void setMoreButton(MyMessage message) {
+ boolean visible = message != null && message.hasMore();
+ moreButton.setVisible(visible);
+ }
+
+ /**
+ * Adjusts the text in the widget. The full text is stored in the data field of the
+ * Text widget. The partial text is shown if the width of the containing control
+ * is too small to hold it.
+ */
+ private void adjustText() {
+ GC gc = new GC(widget);
+ int maxWidth = getSize().x;
+ maxWidth -= moreButton.getSize().x;
+ maxWidth -= image.getSize().x;
+ maxWidth -= 17; // a guess at the padding between controls
+ maxWidth = (maxWidth >= 0) ? maxWidth : 0;
+ String text = (String) widget.getData();
+ if (text != null) {
+ if (gc.stringExtent(text).x > maxWidth) {
+ StringBuffer head = new StringBuffer(text);
+ int n = head.length();
+ head.append("...");
+ while (n > 0) {
+ text = head.toString();
+ if (gc.stringExtent(text).x <= maxWidth) break;
+ head.deleteCharAt(--n);
+ }
+ if (n == 0) text = "";
+ }
+ widget.setText(text);
+ }
+ gc.dispose();
+ }
+
+ /**
+ * Logs a message in the appropriate log according to the current preferences.
+ * @param message The SystemMessage to be logged.
+ */
+ private void logMessage(SystemMessage message) {
+ MyMessage m = new MySystemMessage(message);
+ Object[] data = m.getData();
+ for (int i = 0; i < data.length; i++) {
+ Object object = data[i];
+ StringBuffer buffer = new StringBuffer(200);
+ buffer.append(m.getID());
+ buffer.append(": SUB#");
+ buffer.append(Integer.toString(i));
+ buffer.append(":");
+ buffer.append(object.toString());
+ logMessage(m.getType(), buffer.toString(), false);
+ }
+ logMessage(m.getType(), m.getID(), m.isStrange());
+ }
+
+ /**
+ * Sends a text message to the log.
+ * @param type The type of the message - NONE, INFO, WARNING or ERROR.
+ * @param text The text to log.
+ * @param stackTrace If true then generate a stack trace in the log. Ignored if the
+ * type is not ERROR.
+ */
+ private void logMessage(int type, String text, boolean stackTrace) {
+ switch (type) {
+ case ERROR:
+ Exception e = stackTrace ? new Exception("Stack Trace") : null;
+ SystemBasePlugin.logError(text, e);
+ break;
+ case WARNING:
+ SystemBasePlugin.logWarning(text);
+ break;
+ case INFO:
+ case NONE:
+ default:
+ SystemBasePlugin.logInfo(text);
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemMessageStatus.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemMessageStatus.java
new file mode 100644
index 00000000000..c8d176eb931
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemMessageStatus.java
@@ -0,0 +1,153 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.messages;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.rse.core.SystemBasePlugin;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
+
+
+/**
+ * A SystemMessageStatus object encapsulates a SystemMessage or a
+ * SystemMessageException as a Status object. Could be used when creating a
+ * CoreException from a SystemMessageException.
+ */
+public class SystemMessageStatus implements IStatus {
+ private SystemMessage message;
+ private SystemMessageException exception;
+ public SystemMessageStatus(SystemMessage message) {
+ this.message = message;
+ }
+
+ public SystemMessageStatus(SystemMessageException exception) {
+ this.message = exception.getSystemMessage();
+ this.exception = exception;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.IStatus#isOK()
+ */
+ public boolean isOK() {
+ int severity = getSeverity();
+ return severity <= IStatus.OK;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.IStatus#getPlugin()
+ */
+ public String getPlugin() {
+ String id = SystemBasePlugin.getBaseDefault().getBundle().getSymbolicName();
+ return id;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.IStatus#getChildren()
+ */
+ public IStatus[] getChildren() {
+ return new IStatus[0];
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.IStatus#getCode()
+ */
+ public int getCode() {
+ String codeString = message.getMessageNumber();
+ int code = 0;
+ try {
+ code = Integer.parseInt(codeString);
+ } catch (NumberFormatException e) {
+ }
+ return code;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.IStatus#getException()
+ */
+ public Throwable getException() {
+ return exception;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.IStatus#getMessage()
+ */
+ public String getMessage() {
+ return message.getLevelOneText();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.IStatus#getSeverity()
+ */
+ public int getSeverity() {
+ char ind = message.getIndicator();
+ switch (ind) {
+ case SystemMessage.COMPLETION:
+ return IStatus.OK;
+ case SystemMessage.INFORMATION:
+ return IStatus.INFO;
+ case SystemMessage.INQUIRY:
+ return IStatus.INFO;
+ case SystemMessage.WARNING:
+ return IStatus.WARNING;
+ case SystemMessage.UNEXPECTED:
+ return IStatus.WARNING;
+ case SystemMessage.ERROR:
+ return IStatus.ERROR;
+ default:
+ return IStatus.OK;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IStatus#isMultiStatus()
+ */
+ public boolean isMultiStatus() {
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IStatus#matches(int)
+ */
+ public boolean matches(int severityMask) {
+ int severity = getSeverity();
+ int matching = severity & severityMask;
+ return matching > 0;
+ }
+
+ /**
+ * @return the SystemMessage encapsulated by this status.
+ */
+ public SystemMessage getSystemMessage() {
+ return message;
+ }
+
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemUIMessage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemUIMessage.java
new file mode 100644
index 00000000000..ccfabb6a5a8
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemUIMessage.java
@@ -0,0 +1,93 @@
+/********************************************************************************
+ * Copyright (c) 2004, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.messages;
+import java.util.Arrays;
+import java.util.Iterator;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.rse.services.clientserver.messages.IndicatorException;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+
+
+
+public class SystemUIMessage extends SystemMessage
+{
+ protected static final int displayMask = IStatus.OK | IStatus.INFO | IStatus.WARNING | IStatus.ERROR; // for IStatus substitution variables
+
+ public SystemUIMessage(String comp, String sub, String number, char ind, String l1, String l2) throws IndicatorException
+ {
+ super(comp,sub,number,ind,l1,l2);
+ }
+
+/**
+ * used to determine the string value of the object
+ * it calls toString for all object types except for Exceptions
+ * where the stack is also rendered
+ * @param sub the substitution object
+ * @return the string value for the object
+ */
+ public String getSubValue(Object sub)
+ {
+ if (sub == null)
+ return "";
+
+ if (sub instanceof IStatus)
+ {
+ return populateList("", (IStatus)sub);
+ }
+ else
+ {
+ return super.getSubValue(sub);
+ }
+ }
+
+/**
+ * Populates the list using this error dialog's status object.
+ * This walks the child stati of the status object and
+ * displays them in a list. The format for each entry is
+ * status_path : status_message
+ * If the status's path was null then it (and the colon)
+ * are omitted.
+ */
+ private static String populateList(String list, IStatus status) {
+ java.util.List statusList = Arrays.asList(status.getChildren());
+ Iterator enumer = statusList.iterator();
+ while (enumer.hasNext()) {
+ IStatus childStatus = (IStatus) enumer.next();
+ list = populateList(list, childStatus, 0);
+ }
+ return list;
+ }
+ private static String populateList(String list, IStatus status, int nesting) {
+ if (!status.matches(displayMask)) {
+ return list;
+ }
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < nesting; i++) {
+ sb.append(NESTING_INDENT);
+ }
+ sb.append(status.getMessage());
+ //list.add(sb.toString());
+ list = list + sb.toString() + "\n";
+ IStatus[] children = status.getChildren();
+ for (int i = 0; i < children.length; i++) {
+ list = populateList(list, children[i], nesting + 1);
+ }
+ return list;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemUIMessageFile.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemUIMessageFile.java
new file mode 100644
index 00000000000..46c3fb20bc8
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemUIMessageFile.java
@@ -0,0 +1,52 @@
+/********************************************************************************
+ * Copyright (c) 2004, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.messages;
+import org.eclipse.rse.services.clientserver.messages.IndicatorException;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.services.clientserver.messages.SystemMessageFile;
+
+/**
+ * @author dmcknigh
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class SystemUIMessageFile extends SystemMessageFile
+{
+ public SystemUIMessageFile(String messageFileName,
+ String defaultMessageFileLocation)
+ {
+ super(messageFileName, defaultMessageFileLocation);
+ }
+
+ /**
+ * Override this to provide different extended SystemMessage implementation
+ * @param componentAbbr
+ * @param subComponentAbbr
+ * @param msgNumber
+ * @param msgIndicator
+ * @param msgL1
+ * @param msgL2
+ * @return The SystemMessage for the given message information
+ * @throws IndicatorException
+ */
+ protected SystemMessage loadSystemMessage(String componentAbbr, String subComponentAbbr, String msgNumber, char msgIndicator,
+ String msgL1, String msgL2) throws IndicatorException
+ {
+ return new SystemUIMessage(componentAbbr, subComponentAbbr, msgNumber, msgIndicator, msgL1, msgL2);
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/ISystemQuickOpenPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/ISystemQuickOpenPage.java
new file mode 100644
index 00000000000..5071debd1ac
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/ISystemQuickOpenPage.java
@@ -0,0 +1,50 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.open;
+
+import org.eclipse.jface.dialogs.IDialogPage;
+
+/**
+ * Defines a page inside the quick open dialog.
+ * Clients can contribute their own quick open page to the
+ * dialog by implementing this interface, typically as a subclass
+ * of DialogPage
.
+ * performAction
method when the Ok
+ * button is pressed.
+ * true
if the dialog can be closed after execution.
+ */
+ public boolean performAction();
+
+ /**
+ * Sets the container of this page.
+ * The quick open dialog calls this method to initialize this page.
+ * Implementations may store the reference to the container.
+ * @param container the container for this page.
+ */
+ public void setContainer(ISystemQuickOpenPageContainer container);
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/ISystemQuickOpenPageContainer.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/ISystemQuickOpenPageContainer.java
new file mode 100644
index 00000000000..fb0fb2d1d7f
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/ISystemQuickOpenPageContainer.java
@@ -0,0 +1,46 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.open;
+
+import org.eclipse.jface.operation.IRunnableContext;
+import org.eclipse.jface.viewers.ISelection;
+
+public interface ISystemQuickOpenPageContainer {
+
+ /**
+ * Returns the selection with which this container was opened.
+ *
+ * @return the selection passed to this container when it was opened
+ */
+ public ISelection getSelection();
+
+ /**
+ * Returns the context for the search operation.
+ * This context allows progress to be shown inside the search dialog.
+ *
+ * @return the IRunnableContext
for the search operation
+ */
+ public IRunnableContext getRunnableContext();
+
+ /**
+ * Sets the enable state of the perform action button
+ * of this container.
+ *
+ * @param state true
to enable the button which performs the action
+ */
+ public void setPerformActionEnabled(boolean state);
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemOpenQuickOpenDialogAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemOpenQuickOpenDialogAction.java
new file mode 100644
index 00000000000..0d49a592ac3
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemOpenQuickOpenDialogAction.java
@@ -0,0 +1,126 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.open;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.rse.core.SystemBasePlugin;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+
+
+public class SystemOpenQuickOpenDialogAction extends Action implements IWorkbenchWindowActionDelegate {
+
+ private IWorkbenchWindow window;
+ private String pageId;
+
+ /**
+ * Constructor for the action.
+ * @param text the text.
+ * @param tooltip the tooltip.
+ * @param image the image.
+ * @param parent the parent shell.
+ */
+ public SystemOpenQuickOpenDialogAction(String text, String tooltip, ImageDescriptor image) {
+ super(text, image);
+ setToolTipText(tooltip);
+ }
+
+ /**
+ * Constructor for the action.
+ * @param text the text.
+ * @param tooltip the tooltip.
+ * @param parent the parent shell.
+ */
+ public SystemOpenQuickOpenDialogAction(String text, String tooltip) {
+ this(text, tooltip, null);
+ }
+
+ /**
+ * @param window the workbench window
+ */
+ public SystemOpenQuickOpenDialogAction(IWorkbenchWindow window, String pageId) {
+ this((String)null, (String)null);
+ this.window = window;
+ this.pageId = pageId;
+ }
+
+ /**
+ * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
+ */
+ public void dispose() {
+ }
+
+ /**
+ * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
+ */
+ public void init(IWorkbenchWindow window) {
+ this.window = window;
+ }
+
+ /**
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+ public void run(IAction action) {
+ run();
+ }
+
+ /**
+ * @see org.eclipse.jface.action.IAction#run()
+ */
+ public void run() {
+
+ // if there is no active page, then beep
+ if (getWindow().getActivePage() == null) {
+ SystemBasePlugin.getActiveWorkbenchWindow().getShell().getDisplay().beep();
+ return;
+ }
+
+ SystemQuickOpenDialog dialog = new SystemQuickOpenDialog(getWindow().getShell(), getSelection(), pageId);
+ dialog.open();
+ }
+
+ /**
+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ }
+
+ /**
+ * Gets the current selection.
+ * @return the current selection.
+ */
+ private ISelection getSelection() {
+ return getWindow().getSelectionService().getSelection();
+ }
+
+ /**
+ * Gets the window. If the current window is null
, the current window is set to the active
+ * workbench window, and then returned.
+ * @return the current workench window, or the active workbench window if the current window is null
.
+ */
+ private IWorkbenchWindow getWindow() {
+
+ if (window == null) {
+ window = SystemBasePlugin.getActiveWorkbenchWindow();
+ }
+
+ return window;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemQuickOpenDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemQuickOpenDialog.java
new file mode 100644
index 00000000000..e704923d0c3
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemQuickOpenDialog.java
@@ -0,0 +1,802 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.open;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.HashMap;
+import java.util.List;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.ControlEnableState;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.operation.IRunnableContext;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.operation.ModalContext;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.wizard.ProgressMonitorPart;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+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.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Layout;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+
+public class SystemQuickOpenDialog extends Dialog implements ISystemQuickOpenPageContainer, IRunnableContext {
+
+ // the tab folder layout
+ private class TabFolderLayout extends Layout {
+
+ /**
+ * @see org.eclipse.swt.widgets.Layout#computeSize(org.eclipse.swt.widgets.Composite, int, int, boolean)
+ */
+ protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) {
+
+ if (wHint != SWT.DEFAULT && hHint != SWT.DEFAULT) {
+ return new Point(wHint, hHint);
+ }
+
+ int x = 0;
+ int y = 0;
+
+ Control[] children = composite.getChildren();
+
+ for (int i= 0; i < children.length; i++) {
+ Point size = children[i].computeSize(SWT.DEFAULT, SWT.DEFAULT, flushCache);
+ x = Math.max(x, size.x);
+ y = Math.max(y, size.y);
+ }
+
+ Point minSize = getMinSize();
+ x = Math.max(x, minSize.x);
+ y = Math.max(y, minSize.y);
+
+ if (wHint != SWT.DEFAULT) {
+ x = wHint;
+ }
+
+ if (hHint != SWT.DEFAULT) {
+ y = hHint;
+ }
+
+ return new Point(x, y);
+ }
+
+
+ /**
+ * @see org.eclipse.swt.widgets.Layout#layout(org.eclipse.swt.widgets.Composite, boolean)
+ */
+ protected void layout(Composite composite, boolean flushCache) {
+ Rectangle rect = composite.getClientArea();
+
+ Control[] children = composite.getChildren();
+
+ for (int i = 0; i < children.length; i++) {
+ children[i].setBounds(rect);
+ }
+ }
+ }
+
+ // contents and buttons
+ private Control contents;
+ private Button cancelButton;
+ private Button openButton;
+
+ private String performActionLabel = JFaceResources.getString("finish");
+
+ // the number of long running operations being executed from the dialog
+ private long activeRunningOperations;
+
+ // cursors during operation
+ private Cursor waitCursor;
+ private Cursor arrowCursor;
+
+ // progress monitor
+ private ProgressMonitorPart progressMonitorPart;
+
+ // window closing dialog
+ private MessageDialog windowClosingDialog;
+
+ // minimum size for tab folder
+ private Point minSize;
+
+ private ISelection selection;
+ private String initialPageId;
+ private ISystemQuickOpenPage currentPage;
+ private int currentIndex;
+ private List descriptors;
+
+ /**
+ * The constructor for the quick open dialog.
+ * @param shell the shell.
+ * @param selection the current selection.
+ * @param pageId the initial page id.
+ */
+ public SystemQuickOpenDialog(Shell shell, ISelection selection, String pageId) {
+ super(shell);
+ this.selection = selection;
+ this.initialPageId = pageId;
+ this.descriptors = SystemQuickOpenUtil.getInstance().getQuickOpenPageDescriptors(initialPageId);
+ }
+
+
+ // ------------------------------- UI creation and handling ---------------------------------------
+
+ /**
+ * @see org.eclipse.jface.window.Window#create()
+ */
+ public void create() {
+ super.create();
+
+ if (currentPage != null) {
+ currentPage.setVisible(true);
+ }
+ }
+
+ /**
+ * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+ */
+ protected void configureShell(Shell shell) {
+ super.configureShell(shell);
+ shell.setText("Open");
+ // TODO: add image and F1 help
+ }
+
+ /**
+ * Creates a page area, a progress monitor and a separator.
+ * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createDialogArea(Composite parent) {
+
+ // call super to get a standard composite
+ Composite composite = (Composite)(super.createDialogArea(parent));
+
+ // create a grid layout
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ layout.horizontalSpacing = 0;
+ layout.verticalSpacing = 0;
+
+ // set layout for composite
+ composite.setLayout(layout);
+
+ // set layout data for composite
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ // create the page area
+ contents = createPageArea(composite);
+
+ // create a progress monitor and make it invisible initially
+ GridLayout pmlayout = new GridLayout();
+ pmlayout.numColumns = 1;
+ progressMonitorPart = new ProgressMonitorPart(composite, pmlayout, SWT.DEFAULT);
+ progressMonitorPart.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ progressMonitorPart.setVisible(false);
+
+ // add a separator
+ Label separator = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
+ separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ // apply dialog font
+ applyDialogFont(composite);
+
+ return composite;
+ }
+
+ /**
+ * Creates the page area.
+ * @param parent the parent composite.
+ * @return the page area control.
+ */
+ protected Control createPageArea(Composite parent) {
+
+ int numPages = descriptors.size();
+
+ // if number of pages is 0, then just show a label
+ if (numPages == 0) {
+ Label label = new Label(parent, SWT.CENTER | SWT.WRAP);
+ // TODO: set text
+ //label.setText(SearchMessages.getString("SearchDialog.noSearchExtension")); //$NON-NLS-1$
+ return label;
+ }
+
+ // get the preferred index, which is the index of the page with the initial page id, or depends on
+ // the current selection
+ currentIndex = getPreferredPageIndex();
+
+ // get the current page from the index
+ BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
+ public void run() {
+ currentPage = getDescriptorAt(currentIndex).createObject();
+ }
+ });
+
+ // set the current page container
+ currentPage.setContainer(this);
+
+ // if number of pages is 1, simple get the control representing the page and return it
+ if (numPages == 1) {
+ return getControl(currentPage, parent);
+ }
+ // if number of pages is more than 1, then we create a tab folder
+ else {
+
+ // create a border composite
+ Composite border = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginWidth= 7;
+ layout.marginHeight= 7;
+ border.setLayout(layout);
+
+ // create a tab folder
+ TabFolder folder = new TabFolder(border, SWT.NONE);
+ folder.setLayoutData(new GridData(GridData.FILL_BOTH));
+ folder.setLayout(new TabFolderLayout());
+
+ // go through all descriptors
+ for (int i = 0; i < numPages; i++) {
+ SystemQuickOpenPageDescriptor descriptor = (SystemQuickOpenPageDescriptor)(descriptors.get(i));
+
+ // create a tab item for each descriptor
+ final TabItem item = new TabItem(folder, SWT.NONE);
+
+ // set the text of the tab item to the label of the descriptor
+ item.setText(descriptor.getLabel());
+
+ // add a dispose listener which destroys the image
+ item.addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent e) {
+ item.setData(null);
+
+ if (item.getImage() != null) {
+ item.getImage().dispose();
+ }
+ }
+ });
+
+ // get the image descriptor from the page descriptor
+ ImageDescriptor imageDesc = descriptor.getImage();
+
+ // if image descriptor exists, create image and set it for the tab item
+ if (imageDesc != null) {
+ item.setImage(imageDesc.createImage());
+ }
+
+ // set item data to the descriptor
+ item.setData(descriptor);
+
+ // now if index is the current index (i.e. the preferred index)
+ if (i == currentIndex) {
+
+ // get control corresponding to current page with folder as the parent
+ item.setControl(getControl(currentPage, folder));
+
+ // set the data to the actual page
+ item.setData(currentPage);
+ }
+ }
+
+ // add a selection listener to the folder
+ folder.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ turnToPage(event);
+ }
+ });
+
+ // set the selection to the current index
+ folder.setSelection(currentIndex);
+
+ // finally, return the border
+ return border;
+ }
+ }
+
+ /**
+ * Returns the index of the page to be displayed. If a particular page id was requested, then the index
+ * of the page that has that id is returned. Otherwise the index depends on the page most appropriate for
+ * the current selection.
+ * @return the index of the page to be displayed.
+ */
+ private int getPreferredPageIndex() {
+
+ // TODO: calculate the most appropriate page depending on the selection
+ int result = 0;
+
+ int size = descriptors.size();
+
+ for (int i = 0; i < size; i++) {
+
+ SystemQuickOpenPageDescriptor descriptor = (SystemQuickOpenPageDescriptor)(descriptors.get(i));
+
+ // if we have an initial page id then we must return the index
+ if (initialPageId != null && initialPageId.equals(descriptor.getId())) {
+ return i;
+ }
+
+ // TODO: find out the most appropriate page and return its index
+ }
+
+ return result;
+ }
+
+ /**
+ * Gets the page descriptor at the specified index.
+ * @param index the index.
+ * @return the page descriptor at the specified index.
+ */
+ private SystemQuickOpenPageDescriptor getDescriptorAt(int index) {
+ return (SystemQuickOpenPageDescriptor)(descriptors.get(index));
+ }
+
+ /**
+ * Returns the control representing the given page.
+ * If the control for the page hasn't been created yet, it is created.
+ * The parent of the page control is returned, i.e. we have a wrapper for a page and that is what is returned.
+ * @param page the quick open page.
+ * @param parent the parent in which to create the page wrapper where the page control will be created.
+ * @return the parent of the page control, i.e. a wrapper for the page. The wrapper's parent is the given parent.
+ */
+ private Control getControl(ISystemQuickOpenPage page, Composite parent) {
+
+ // if the page control is null, create it
+ if (page.getControl() == null) {
+
+ // create a wrapper for the page
+ Composite pageWrapper = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ pageWrapper.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ pageWrapper.setLayout(layout);
+
+ // create the page in the wrapper
+ page.createControl(pageWrapper);
+ }
+
+ // returns the wrapper
+ return page.getControl().getParent();
+ }
+
+ /**
+ * Turns to the page which has been selected.
+ * @param event the selection event.
+ */
+ private void turnToPage(SelectionEvent event) {
+ final TabItem item = (TabItem)(event.item);
+
+ // if control for tab item hasn't been created yet
+ if (item.getControl() == null) {
+
+ // get the data which is the descriptor
+ final SystemQuickOpenPageDescriptor descriptor = (SystemQuickOpenPageDescriptor)(item.getData());
+
+ // set the data to be the actual quick open page
+ BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
+ public void run() {
+ item.setData(descriptor.createObject());
+ }
+ });
+
+ // now get the data, which is the quick open page
+ ISystemQuickOpenPage page = (ISystemQuickOpenPage)(item.getData());
+
+ // set the container of the page
+ page.setContainer(this);
+
+ // get the control represeting the page
+ // note that the widget for the event is the tab folder
+ Control newControl = getControl(page, (Composite)(event.widget));
+
+ // set the item control
+ item.setControl(newControl);
+ }
+
+ // get the item data and check whether it is an instance of quick open page
+ if (item.getData() instanceof ISystemQuickOpenPage) {
+
+ // the item data is the new current page
+ currentPage = (ISystemQuickOpenPage)(item.getData());
+
+ // the current index is the selection index of the item parent (i.e. the tab folder)
+ currentIndex = item.getParent().getSelectionIndex();
+
+ // resize dialog if needed and pass in the page wrapper
+ // that method will test if the control in the page is smaller than the wrapper (i.e. its parent)
+ resizeDialogIfNeeded(item.getControl());
+
+ // make the current page visible
+ currentPage.setVisible(true);
+ }
+ }
+
+ /**
+ * Resizes dialog if needed. Tests the given control size with the size of the current page control.
+ * If the current page control is smaller, then resize.
+ * @param newControl the control whose size we want to test against the size of the page control.
+ */
+ private void resizeDialogIfNeeded(Control newControl) {
+ Point currentSize = currentPage.getControl().getSize();
+ Point newSize = newControl.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
+
+ // if we must resize, then compute size of shell again, and set it
+ if (mustResize(currentSize, newSize)) {
+ Shell shell = getShell();
+ shell.setSize(shell.computeSize(SWT.DEFAULT, SWT.DEFAULT, true));
+ }
+ }
+
+ /**
+ * Returns whether we must resize.
+ * @param currentSize the current size.
+ * @param newSize the new size.
+ * @return true
if current size is smaller than new size, false
otherwise.
+ */
+ private boolean mustResize(Point currentSize, Point newSize) {
+ return currentSize.x < newSize.x || currentSize.y < newSize.y;
+ }
+
+ /**
+ * Gets the minimum size for the tab folder.
+ * @return
+ */
+ private Point getMinSize() {
+
+ if (minSize != null) {
+ return minSize;
+ }
+
+ int x = 0;
+ int y = 0;
+ int length = descriptors.size();
+
+ for (int i = 0; i < length; i++) {
+ Point size = getDescriptorAt(i).getPreferredSize();
+
+ if (size.x != SWT.DEFAULT) {
+ x = Math.max(x, size.x);
+ }
+ if (size.y != SWT.DEFAULT) {
+ y = Math.max(y, size.y);
+ }
+ }
+
+ minSize = new Point(x, y);
+ return minSize;
+ }
+
+ /**
+ * Calls the super class method if there are no running operations.
+ * @see org.eclipse.jface.dialogs.Dialog#cancelPressed()
+ */
+ protected void cancelPressed() {
+
+ if (activeRunningOperations == 0) {
+ super.cancelPressed();
+ }
+ }
+
+ /**
+ * Calls performAction
. If the result of calling this method is true
+ * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+ */
+ protected void okPressed() {
+ boolean result = performAction();
+
+ if (result) {
+ super.okPressed();
+ }
+ }
+
+ /**
+ * Returns whether ok to close. Asks the current page, if any, whether it is ok to close.
+ * @return true
if the dialog can be closed, false
otherwise.
+ */
+ protected boolean performAction() {
+
+ if (currentPage == null) {
+ return true;
+ }
+
+ return currentPage.performAction();
+ }
+
+
+ // ----------------------------------------- Interface methods ----------------------------------
+
+ /**
+ * @see org.eclipse.rse.ui.open.ISystemQuickOpenPageContainer#getRunnableContext()
+ */
+ public IRunnableContext getRunnableContext() {
+ return this;
+ }
+
+ /**
+ * @see org.eclipse.rse.ui.open.ISystemQuickOpenPageContainer#getSelection()
+ */
+ public ISelection getSelection() {
+ return selection;
+ }
+
+ /**
+ * @see org.eclipse.rse.ui.open.ISystemQuickOpenPageContainer#setPerformActionEnabled(boolean)
+ */
+ public void setPerformActionEnabled(boolean state) {
+
+ if (openButton != null) {
+ openButton.setEnabled(state);
+ }
+ }
+
+
+ // ----------------------------- Operation related methods --------------------------
+
+ /**
+ * @see org.eclipse.jface.operation.IRunnableContext#run(boolean, boolean, org.eclipse.jface.operation.IRunnableWithProgress)
+ */
+ public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
+
+ // The operation can only be canceled if it is executed in a separate thread.
+ // Otherwise the UI is blocked anyway.
+ HashMap state = null;
+
+ try {
+ activeRunningOperations++;
+ state = aboutToStart(fork && cancelable);
+ ModalContext.run(runnable, fork, getProgressMonitor(), getShell().getDisplay());
+ }
+ finally {
+
+ if (state != null) {
+ stopped(state);
+ }
+
+ activeRunningOperations--;
+ }
+ }
+
+ /**
+ * Returns the progress monitor. If the dialog doesn't
+ * have a progress monitor, null
is returned.
+ */
+ protected IProgressMonitor getProgressMonitor() {
+ return progressMonitorPart;
+ }
+
+ /**
+ * About to start a long running operation tiggered through the dialog.
+ * Shows the progress monitor and disables the dialog.
+ * @param enableCancelButton true
if cancel button should be enabled, false
otherwise.
+ * @return the saved UI state.
+ * @see #stopped(HashMap);
+ */
+ protected synchronized HashMap aboutToStart(boolean enableCancelButton) {
+ HashMap savedState = null;
+
+ Shell shell = getShell();
+
+ if (shell != null) {
+ Display d = shell.getDisplay();
+
+ // get focus control
+ Control focusControl = d.getFocusControl();
+
+ if (focusControl != null && focusControl.getShell() != shell) {
+ focusControl = null;
+ }
+
+ // set the busy cursor to all shells
+ waitCursor = new Cursor(d, SWT.CURSOR_WAIT);
+ setDisplayCursor(d, waitCursor);
+
+ // set the arrow cursor to the cancel component
+ arrowCursor = new Cursor(d, SWT.CURSOR_ARROW);
+ cancelButton.setCursor(arrowCursor);
+
+ // deactivate shell
+ savedState = saveUIState(enableCancelButton);
+
+ // save focus control
+ if (focusControl != null) {
+ savedState.put("focusControl", focusControl);
+ }
+
+ // attach the progress monitor part to the cancel button and make it visible
+ progressMonitorPart.attachToCancelComponent(cancelButton);
+ progressMonitorPart.setVisible(true);
+ }
+
+ return savedState;
+ }
+
+ /**
+ * A long running operation triggered through the wizard
+ * was stopped either by user input or by normal end.
+ * @param savedState The saveState returned by aboutToStart
.
+ * @see #aboutToStart(boolean)
+ */
+ protected synchronized void stopped(HashMap state) {
+
+ Shell shell = getShell();
+
+ if (shell != null) {
+
+ progressMonitorPart.setVisible(false);
+ progressMonitorPart.removeFromCancelComponent(cancelButton);
+
+ restoreUIState(state);
+
+ setDisplayCursor(shell.getDisplay(), null);
+ cancelButton.setCursor(null);
+ waitCursor.dispose();
+ waitCursor = null;
+ arrowCursor.dispose();
+ arrowCursor = null;
+ Control focusControl = (Control)(state.get("focusControl"));
+
+ if (focusControl != null && ! focusControl.isDisposed()) {
+ focusControl.setFocus();
+ }
+ }
+ }
+
+ /**
+ * Sets a cursor for all shells in a display.
+ * @param d the display.
+ * @param c the cursor.
+ */
+ private void setDisplayCursor(Display d, Cursor c) {
+
+ Shell[] shells = d.getShells();
+
+ for (int i= 0; i < shells.length; i++) {
+ shells[i].setCursor(c);
+ }
+ }
+
+
+ //------------------------ UI state save and restoring -------------------------------------
+
+ /**
+ * Restores the enable state of the UI, i.e. all dialog contents.
+ * @param state the hashmap that contains the enable state of the UI.
+ */
+ private void restoreUIState(HashMap state) {
+ restoreEnableState(cancelButton, state, "cancel");
+ restoreEnableState(openButton, state, "open");
+ ControlEnableState pageState = (ControlEnableState)state.get("tabForm");
+ pageState.restore();
+ }
+
+ /**
+ * Restores the enable state of a control.
+ * @param w the control whose state needs to be restored.
+ * @param h the hashmap containing the enable state of the control.
+ * @param key the key to use to retrieve the enable state.
+ */
+ protected void restoreEnableState(Control w, HashMap h, String key) {
+
+ if (!w.isDisposed()) {
+ Boolean b = (Boolean)h.get(key);
+
+ if (b != null) {
+ w.setEnabled(b.booleanValue());
+ }
+ }
+ }
+
+ /**
+ * Disables all dialog contents, except maybe the cancel button, depending on the given boolean.
+ * @param keepCancelEnabled true
if cancel button is enabled, false
otherwise.
+ * @return the saved state.
+ */
+ private HashMap saveUIState(boolean keepCancelEnabled) {
+ HashMap savedState = new HashMap();
+
+ saveEnableStateAndSet(cancelButton, savedState, "cancel", keepCancelEnabled);
+ saveEnableStateAndSet(openButton, savedState, "open", false);
+ savedState.put("tabForm", ControlEnableState.disable(contents));
+
+ return savedState;
+ }
+
+ /**
+ * Saves the enable state of a control and sets it as well.
+ * @param w the control whose enable state we want to set and save.
+ * @param h the hashmap where the enable state of the control will be saved.
+ * @param key the key with which to save the enable state.
+ * @param enabled true
if control is to be enabled, false
otherwise.
+ */
+ private void saveEnableStateAndSet(Control w, HashMap h, String key, boolean enabled) {
+
+ if (!w.isDisposed()) {
+ h.put(key, new Boolean(w.isEnabled()));
+ w.setEnabled(enabled);
+ }
+ }
+
+
+ // ------------------------------- Handle shell closing ------------------------------
+
+ /**
+ * Checks to see if there are any long running operations. If there are, a dialog is shown
+ * @see org.eclipse.jface.window.Window#handleShellCloseEvent()
+ */
+ protected void handleShellCloseEvent() {
+
+ if (okToClose()) {
+ super.handleShellCloseEvent();
+ }
+ }
+
+ /**
+ * Checks if any operations are running. If so, shows a message dialog alerting the user, and returns false
+ * indicating the dialog should not be closed.
+ * @param true
if it is ok to close the dialog, false
otherwise.
+ */
+ public boolean okToClose() {
+
+ if (activeRunningOperations > 0) {
+
+ // get closing dialog
+ synchronized (this) {
+ windowClosingDialog = createClosingDialog();
+ }
+
+ // open it
+ windowClosingDialog.open();
+
+ // make it null
+ synchronized (this) {
+ windowClosingDialog = null;
+ }
+
+ // indicate that operations are running, so not ok to close
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Creates a dialog with the message that the quick open dialog is closing.
+ * @return the message dialog.
+ */
+ private MessageDialog createClosingDialog() {
+ MessageDialog result = new MessageDialog(getShell(), JFaceResources.getString("WizardClosingDialog.title"),
+ null, JFaceResources.getString("WizardClosingDialog.message"),
+ MessageDialog.QUESTION, new String[] {IDialogConstants.OK_LABEL}, 0);
+ return result;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemQuickOpenPageDescriptor.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemQuickOpenPageDescriptor.java
new file mode 100644
index 00000000000..dad35d6d9e1
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemQuickOpenPageDescriptor.java
@@ -0,0 +1,186 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.open;
+
+import java.net.URL;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.StringConverter;
+import org.eclipse.rse.core.SystemBasePlugin;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.osgi.framework.Bundle;
+
+
+public class SystemQuickOpenPageDescriptor implements Comparable {
+
+ public final static String PAGE_TAG = "page";
+ private final static String ID_ATTRIBUTE = "id";
+ private final static String ICON_ATTRIBUTE = "icon";
+ private final static String CLASS_ATTRIBUTE = "class";
+ private final static String LABEL_ATTRIBUTE = "label";
+ private final static String SIZE_ATTRIBUTE = "sizeHint";
+ private final static String TAB_POSITION_ATTRIBUTE = "tabPosition";
+ // private final static String SSF_ID = "ssfid";
+
+ public final static Point UNKNOWN_SIZE = new Point(SWT.DEFAULT, SWT.DEFAULT);
+
+ private IConfigurationElement element;
+
+ /**
+ * Constructor for quick open page descriptor.
+ * @param a configuration element.
+ */
+ public SystemQuickOpenPageDescriptor(IConfigurationElement element) {
+ this.element = element;
+ }
+
+ /**
+ * Creates a new quick open page from the descriptor.
+ */
+ public ISystemQuickOpenPage createObject() {
+ ISystemQuickOpenPage result = null;
+
+ try {
+ result = (ISystemQuickOpenPage)(element.createExecutableExtension(CLASS_ATTRIBUTE));
+ }
+ catch (CoreException e) {
+ SystemBasePlugin.logError("Error trying to create a quick open page from configuration element", e);
+ return null;
+ }
+ catch (ClassCastException e) {
+ SystemBasePlugin.logError("Error trying to create a quick open page from configuration element", e);
+ return null;
+ }
+
+ if (result != null) {
+ result.setTitle(getLabel());
+ }
+
+ return result;
+ }
+
+
+ // --------------------------------------------------------------
+ // XML attributes
+ // --------------------------------------------------------------
+
+ /**
+ * Returns the id of the page.
+ * @return the id of the page.
+ */
+ public String getId() {
+ return element.getAttribute(ID_ATTRIBUTE);
+ }
+
+ /**
+ * Returns the label of the page.
+ */
+ public String getLabel() {
+ return element.getAttribute(LABEL_ATTRIBUTE);
+ }
+
+ /**
+ * Returns the image for the page.
+ */
+ public ImageDescriptor getImage() {
+
+ String imageName = element.getAttribute(ICON_ATTRIBUTE);
+
+ if (imageName == null) {
+ return null;
+ }
+
+ URL url = null;
+
+ try {
+ String nameSpace = element.getDeclaringExtension().getNamespace();
+ Bundle bundle = Platform.getBundle(nameSpace);
+ url = new URL(bundle.getEntry("/"), imageName);
+ }
+ catch (java.net.MalformedURLException e) {
+ SystemBasePlugin.logError("Error trying to get image", e);
+ return null;
+ }
+
+ return ImageDescriptor.createFromURL(url);
+ }
+
+ /**
+ * Returns the page's preferred size
+ */
+ public Point getPreferredSize() {
+ return StringConverter.asPoint(element.getAttribute(SIZE_ATTRIBUTE), UNKNOWN_SIZE);
+ }
+
+ /**
+ * Returns the page's tab position relative to the other tabs.
+ * @return the tab position or Integer.MAX_VALUE
if not defined in
+ the plugins.xml file
+ *
+ */
+ public int getTabPosition() {
+
+ int position = Integer.MAX_VALUE / 2;
+
+ String str = element.getAttribute(TAB_POSITION_ATTRIBUTE);
+
+ if (str != null) {
+
+ try {
+ position = Integer.parseInt(str);
+ }
+ catch (NumberFormatException e) {
+ SystemBasePlugin.logError("Error trying to get tab position", e);
+ }
+ }
+
+ return position;
+ }
+
+ /**
+ * Returns whether the page is enabled.
+ * @return true
if the page is enabled, false
otherwise.
+ */
+ public boolean isEnabled() {
+ return true;
+ }
+
+
+ // -----------------------------------------------------------
+ // compare
+ // -----------------------------------------------------------
+
+ /**
+ * @see java.lang.Comparable#compareTo(java.lang.Object)
+ */
+ public int compareTo(Object o) {
+
+ int myPos = getTabPosition();
+ int objsPos = ((SystemQuickOpenPageDescriptor)o).getTabPosition();
+
+ if (myPos == Integer.MAX_VALUE && objsPos == Integer.MAX_VALUE || myPos == objsPos) {
+ return getLabel().compareTo(((SystemQuickOpenPageDescriptor)o).getLabel());
+ }
+ else {
+ return myPos - objsPos;
+ }
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemQuickOpenUI.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemQuickOpenUI.java
new file mode 100644
index 00000000000..aa225a649e9
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemQuickOpenUI.java
@@ -0,0 +1,50 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.open;
+
+import org.eclipse.rse.core.SystemBasePlugin;
+import org.eclipse.ui.IWorkbenchWindow;
+
+
+public class SystemQuickOpenUI {
+
+ /**
+ * Constructor.
+ */
+ public SystemQuickOpenUI() {
+ super();
+ }
+
+ /**
+ * Opens the quick open dialog in the active workbench window.
+ * If pageId
is specified and a corresponding page is found then it is brought to top.
+ * @param pageId the page to select or null
if the best fitting page should be selected.
+ */
+ public static void openSearchDialog(String pageId) {
+ openSearchDialog(SystemBasePlugin.getActiveWorkbenchWindow(), pageId);
+ }
+
+ /**
+ * Opens the quick open dialog.
+ * If pageId
is specified and a corresponding page is found then it is brought to top.
+ * @param window the workbench window to open the dialog in.
+ * @param pageId the page to select or null
if the best fitting page should be selected.
+ */
+ public static void openSearchDialog(IWorkbenchWindow window, String pageId) {
+ new SystemOpenQuickOpenDialogAction(window, pageId).run();
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemQuickOpenUtil.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemQuickOpenUtil.java
new file mode 100644
index 00000000000..86f7cca955e
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemQuickOpenUtil.java
@@ -0,0 +1,120 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.open;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.rse.core.SystemPlugin;
+
+
+/**
+ * A utility class for quick open. It is a singleton.
+ */
+public class SystemQuickOpenUtil {
+
+ public static final String QUICK_OPEN_PAGE_EXTENSION_POINT= "quickOpenPages";
+
+ // singleton instance
+ private static SystemQuickOpenUtil instance;
+
+ // a list of page descriptors
+ private List pageDescriptors;
+
+ /**
+ * Constructor for the utility.
+ */
+ private SystemQuickOpenUtil() {
+ super();
+ }
+
+ /**
+ * Returns the singleton instance.
+ * @return the singleton instance.
+ */
+ public static SystemQuickOpenUtil getInstance() {
+
+ if (instance == null) {
+ instance = new SystemQuickOpenUtil();
+ }
+
+ return instance;
+ }
+
+ /**
+ * Returns all quick open pages contributed to the workbench.
+ * @param pageId a page id for which a descriptor must be returned.
+ * @return a list of quick open page descriptors.
+ */
+ public List getQuickOpenPageDescriptors(String pageId) {
+ Iterator iter = getQuickOpenPageDescriptors().iterator();
+ List enabledDescriptors = new ArrayList();
+
+ while (iter.hasNext()) {
+ SystemQuickOpenPageDescriptor desc = (SystemQuickOpenPageDescriptor)(iter.next());
+
+ if (desc.isEnabled() || desc.getId().equals(pageId)) {
+ enabledDescriptors.add(desc);
+ }
+ }
+
+ return enabledDescriptors;
+ }
+
+ /**
+ * Returns all quick open pages contributed to the workbench.
+ * @return a list of quick open pages.
+ */
+ public List getQuickOpenPageDescriptors() {
+
+ if (pageDescriptors == null) {
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IConfigurationElement[] elements = registry.getConfigurationElementsFor(SystemPlugin.PLUGIN_ID, QUICK_OPEN_PAGE_EXTENSION_POINT);
+ pageDescriptors = createQuickOpenPageDescriptors(elements);
+ }
+
+ return pageDescriptors;
+ }
+
+ /**
+ * Creates quick open page descriptors.
+ * @param an array of elements.
+ * @return a list of descriptors that correspond to the given elements.
+ */
+ private List createQuickOpenPageDescriptors(IConfigurationElement[] elements) {
+ List result = new ArrayList();
+
+ for (int i = 0; i < elements.length; i++) {
+ IConfigurationElement element = elements[i];
+
+ if (SystemQuickOpenPageDescriptor.PAGE_TAG.equals(element.getName())) {
+ SystemQuickOpenPageDescriptor desc = new SystemQuickOpenPageDescriptor(element);
+ result.add(desc);
+ }
+ }
+
+ // sort the list of descriptors
+ Collections.sort(result);
+
+ return result;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/ISystemRunnableContext.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/ISystemRunnableContext.java
new file mode 100644
index 00000000000..f363cf59520
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/ISystemRunnableContext.java
@@ -0,0 +1,41 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.operations;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * Interface for a system runnable context.
+ */
+public interface ISystemRunnableContext {
+
+ /**
+ * Runs the given runnable in the context of the receiver. By default, the
+ * progress is provided by the active workbench window but subclasses may
+ * override this to provide progress in some other way (through Progress view using Eclipse Job support).
+ */
+ public abstract void run(IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException;
+
+ /**
+ * Returns a shell that can be used to prompt the user.
+ * @return a shell.
+ */
+ public abstract Shell getShell();
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/Policy.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/Policy.java
new file mode 100644
index 00000000000..56c53b718b1
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/Policy.java
@@ -0,0 +1,121 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.operations;
+
+
+import java.text.MessageFormat;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.SubProgressMonitor;
+//import org.eclipse.team.internal.core.InfiniteSubProgressMonitor;
+
+public class Policy {
+
+
+ protected static ResourceBundle bundle = null;
+
+ /**
+ * Creates a NLS catalog for the given locale.
+ */
+ public static void localize(String bundleName) {
+ bundle = ResourceBundle.getBundle(bundleName);
+ }
+
+ /**
+ * Lookup the message with the given ID in this catalog and bind its
+ * substitution locations with the given string.
+ */
+ public static String bind(String id, String binding) {
+ return bind(id, new String[] { binding });
+ }
+
+ /**
+ * Lookup the message with the given ID in this catalog and bind its
+ * substitution locations with the given strings.
+ */
+ public static String bind(String id, String binding1, String binding2) {
+ return bind(id, new String[] { binding1, binding2 });
+ }
+
+ /**
+ * Gets a string from the resource bundle. We don't want to crash because of a missing String.
+ * Returns the key if not found.
+ */
+ public static String bind(String key) {
+ try {
+ return bundle.getString(key);
+ } catch (MissingResourceException e) {
+ return key;
+ } catch (NullPointerException e) {
+ return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ /**
+ * Gets a string from the resource bundle and binds it with the given arguments. If the key is
+ * not found, return the key.
+ */
+ public static String bind(String key, Object[] args) {
+ try {
+ return MessageFormat.format(bind(key), args);
+ } catch (MissingResourceException e) {
+ return key;
+ } catch (NullPointerException e) {
+ return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ /**
+ * Progress monitor helpers
+ */
+ public static void checkCanceled(IProgressMonitor monitor) {
+ if (monitor.isCanceled())
+ cancelOperation();
+ }
+ public static void cancelOperation() {
+ throw new OperationCanceledException();
+ }
+ public static IProgressMonitor monitorFor(IProgressMonitor monitor) {
+ if (monitor == null)
+ return new NullProgressMonitor();
+ return monitor;
+ }
+ public static IProgressMonitor subMonitorFor(IProgressMonitor monitor, int ticks) {
+ if (monitor == null)
+ return new NullProgressMonitor();
+ if (monitor instanceof NullProgressMonitor)
+ return monitor;
+ return new SubProgressMonitor(monitor, ticks);
+ }
+ public static IProgressMonitor subMonitorFor(IProgressMonitor monitor, int ticks, int style) {
+ if (monitor == null)
+ return new NullProgressMonitor();
+ if (monitor instanceof NullProgressMonitor)
+ return monitor;
+ return new SubProgressMonitor(monitor, ticks, style);
+ }
+
+
+
+ public static ResourceBundle getBundle() {
+ return bundle;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemFetchOperation.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemFetchOperation.java
new file mode 100644
index 00000000000..77aaff938a6
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemFetchOperation.java
@@ -0,0 +1,270 @@
+/********************************************************************************
+ * Copyright (c) 2004, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.operations;
+import java.lang.reflect.InvocationTargetException;
+import java.net.URL;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.operation.IRunnableContext;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.rse.core.SystemBasePlugin;
+import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchSite;
+import org.eclipse.ui.progress.IElementCollector;
+
+
+/**
+ * @author dmcknigh
+ */
+public class SystemFetchOperation extends JobChangeAdapter implements IRunnableWithProgress
+{
+ protected IWorkbenchPart _part;
+ protected IAdaptable _remoteObject;
+ protected IElementCollector _collector;
+ private IRunnableContext context;
+ protected ISystemViewElementAdapter _adapter;
+ protected boolean _canRunAsJob;
+
+ public SystemFetchOperation(IWorkbenchPart part, IAdaptable remoteObject, ISystemViewElementAdapter adapter, IElementCollector collector)
+ {
+ _part = part;
+ _remoteObject = remoteObject;
+ _collector = collector;
+ _adapter = adapter;
+ _canRunAsJob = false;
+ }
+
+ public SystemFetchOperation(IWorkbenchPart part, IAdaptable remoteObject, ISystemViewElementAdapter adapter, IElementCollector collector, boolean canRunAsJob)
+ {
+ _part = part;
+ _remoteObject = remoteObject;
+ _collector = collector;
+ _adapter = adapter;
+ _canRunAsJob = canRunAsJob;
+ }
+
+ /**
+ * Return the part that is associated with this operation.
+ *
+ * @return Returns the part or null
+ */
+ public IWorkbenchPart getPart() {
+ return _part;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public final void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ startOperation();
+ try {
+ monitor = Policy.monitorFor(monitor);
+ monitor.beginTask(null, 100);
+ monitor.setTaskName(getTaskName());
+ execute(Policy.subMonitorFor(monitor, 100));
+ endOperation();
+ } catch (Exception e) {
+ // TODO: errors may not be empty (i.e. endOperation has not been executed)
+ throw new InvocationTargetException(e);
+ } finally {
+ monitor.done();
+ }
+ }
+
+ protected void startOperation() {
+ //statusCount = 0;
+ //resetErrors();
+ //confirmOverwrite = true;
+ }
+
+ protected void endOperation() {
+ //handleErrors((IStatus[]) errors.toArray(new IStatus[errors.size()]));
+ }
+
+ /**
+ * Subclasses must override this method to perform the operation.
+ * Clients should never call this method directly.
+ *
+ * @param monitor
+ * @throws Exception
+ * @throws InterruptedException
+ */
+ protected void execute(IProgressMonitor monitor) throws Exception, InterruptedException
+ {
+ Object[] children = _adapter.getChildren(monitor, _remoteObject);
+ _collector.add(children, monitor);
+ monitor.done();
+ }
+
+ protected String getTaskName()
+ {
+ return "RSE test task!";
+ }
+
+ /**
+ * Run the operation in a context that is determined by the {@link #canRunAsJob()}
+ * hint. If this operation can run as a job then it will be run in a background thread.
+ * Otherwise it will run in the foreground and block the caller.
+ */
+ public final void run() throws InvocationTargetException, InterruptedException {
+ if (shouldRun()) {
+ getRunnableContext().run(this);
+ }
+ }
+
+ /**
+ * This method is invoked from the run()
method before
+ * the operation is run in the operation's context. Subclasses may
+ * override in order to perform prechecks to determine if the operation
+ * should run. This may include prompting the user for information, etc.
+ *
+ * @return whether the operation should be run.
+ */
+ protected boolean shouldRun() {
+ return true;
+ }
+
+ /**
+ * Returns the scheduling rule that is to be obtained before this
+ * operation is executed by it's context or null
if
+ * no scheduling rule is to be obtained. If the operation is run
+ * as a job, the schdulin rule is used as the schduling rule of the
+ * job. Otherwise, it is obtained before execution of the operation
+ * occurs.
+ * null
.
+ */
+ protected ISchedulingRule getSchedulingRule() {
+ return null;
+ }
+
+ /**
+ * Return whether the auto-build should be postponed until after
+ * the operation is complete. The default is to postpone the auto-build.
+ * subclas can override.
+ *
+ * @return whether to postpone the auto-build while the operation is executing.
+ */
+ protected boolean isPostponeAutobuild() {
+ return true;
+ }
+
+
+ /**
+ * If this operation can safely be run in the background, then subclasses can
+ * override this method and return true
. This will make their
+ * action run in a {@link org.eclipse.core.runtime.Job}.
+ * Subsclass that override this method should
+ * also override the getJobName()
method.
+ *
+ * @return true
if this action can be run in the background and
+ * false
otherwise.
+ */
+ protected boolean canRunAsJob() {
+ return _canRunAsJob;
+ }
+
+ /**
+ * Return the job name to be used if the action can run as a job. (i.e.
+ * if canRunAsJob()
returns true
).
+ *
+ * @return the string to be used as the job name
+ */
+ protected String getJobName() {
+ return ""; //$NON-NLS-1$
+ }
+
+ /**
+ * This method is called to allow subclasses to configure an action that could be run to show
+ * the results of the action to the user. Default is to return null.
+ *
+ * @return an action that could be run to see the results of this operation
+ */
+ protected IAction getGotoAction() {
+ return null;
+ }
+
+ /**
+ * This method is called to allow subclasses to configure an icon to show when running this
+ * operation.
+ *
+ * @return an URL to an icon
+ */
+ protected URL getOperationIcon() {
+ return null;
+ }
+
+ /**
+ * This method is called to allow subclasses to have the operation remain in the progress
+ * indicator even after the job is done.
+ *
+ * @return true
to keep the operation and false
otherwise.
+ */
+ protected boolean getKeepOperation() {
+ return false;
+ }
+
+ /**
+ * Return a shell that can be used by the operation to display dialogs, etc.
+ *
+ * @return a shell
+ */
+ protected Shell getShell()
+ {
+ return SystemBasePlugin.getActiveWorkbenchShell();
+ }
+
+ private ISystemRunnableContext getRunnableContext() {
+ if (context == null && canRunAsJob()) {
+ SystemJobRunnableContext context = new SystemJobRunnableContext(getJobName(), getOperationIcon(), getGotoAction(), getKeepOperation(), this, getSite());
+ context.setPostponeBuild(isPostponeAutobuild());
+ context.setSchedulingRule(getSchedulingRule());
+ return context;
+ } else {
+ SystemProgressDialogRunnableContext context = new SystemProgressDialogRunnableContext(getShell());
+ context.setPostponeBuild(isPostponeAutobuild());
+ context.setSchedulingRule(getSchedulingRule());
+ if (this.context != null) {
+ context.setRunnableContext(this.context);
+ }
+ return context;
+ }
+ }
+
+
+
+
+ private IWorkbenchSite getSite() {
+ IWorkbenchSite site = null;
+ if(_part != null) {
+ site = _part.getSite();
+ }
+ return site;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemJobRunnableContext.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemJobRunnableContext.java
new file mode 100644
index 00000000000..39a92ab40a5
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemJobRunnableContext.java
@@ -0,0 +1,283 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.operations;
+
+import java.lang.reflect.InvocationTargetException;
+import java.net.URL;
+
+import org.eclipse.core.resources.WorkspaceJob;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.IJobChangeListener;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.rse.core.SystemBasePlugin;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchSite;
+import org.eclipse.ui.progress.IProgressConstants;
+import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
+
+
+/**
+ * This runnable context executes its operation in the context of a background job.
+ */
+public final class SystemJobRunnableContext implements ISystemRunnableContext {
+
+ private IJobChangeListener listener;
+ private IWorkbenchSite site;
+ private String jobName;
+ private ISchedulingRule schedulingRule;
+ private boolean postponeBuild;
+ private boolean isUser;
+ private URL icon;
+ private boolean keep;
+ private IAction action;
+
+ /**
+ * Constructor.
+ * @param jobName the name of the job.
+ */
+ public SystemJobRunnableContext(String jobName) {
+ this(jobName, null, null, false, null, null);
+ }
+
+ /**
+ * Constructor.
+ * @param jobName the name of the job.
+ * @param icon the icon for the job.
+ * @param action the action for the job.
+ * @param keep keep the job in the UI even after it is finished.
+ * @param listener listener for job changes.
+ * @param site the workbench site.
+ */
+ public SystemJobRunnableContext(String jobName, URL icon, IAction action, boolean keep, IJobChangeListener listener, IWorkbenchSite site) {
+ this.jobName = jobName;
+ this.listener = listener;
+ this.site = site;
+ this.isUser = true;
+ this.action = action;
+ this.icon = icon;
+ this.keep = keep;
+ }
+
+ /**
+ * @see org.eclipse.rse.ui.operations.ISystemRunnableContext#run(org.eclipse.jface.operation.IRunnableWithProgress)
+ */
+ public void run(IRunnableWithProgress runnable) {
+
+ // the job
+ Job job;
+
+ // if there is no scheduling rule, and auto-builds do not have to be postponed
+ // then use a basic job
+ if (schedulingRule == null && !postponeBuild) {
+ job = getBasicJob(runnable);
+ }
+ // otherwise we need a workspace job for which a scheduling rule needs to be set
+ else {
+ job = getWorkspaceJob(runnable);
+
+ // set scheduling rule if it exists
+ if (schedulingRule != null) {
+ job.setRule(schedulingRule);
+ }
+ }
+
+ // add a job change listener if there is one
+ if (listener != null) {
+ job.addJobChangeListener(listener);
+ }
+
+ // sets whether the job is user initiated
+ job.setUser(isUser());
+
+ // configure the job
+ configureJob(job);
+
+ // schedult the job
+ schedule(job, site);
+ }
+
+ /**
+ * Configures the properties of the given job.
+ * @param job the job to configure.
+ */
+ private void configureJob(Job job) {
+
+ // whether to keep the job in the UI after the job has finished to report results
+ // back to the user
+ if(keep) {
+ job.setProperty(IProgressConstants.KEEP_PROPERTY, Boolean.TRUE);
+ }
+
+ // an action associated with the job if any
+ if(action != null) {
+ job.setProperty(IProgressConstants.ACTION_PROPERTY, action);
+ }
+
+ // an icon associated with the job if any
+ if(icon != null) {
+ job.setProperty(IProgressConstants.ICON_PROPERTY, icon);
+ }
+ }
+
+ /**
+ * Returns the shell.
+ * @see org.eclipse.rse.ui.operations.ISystemRunnableContext#getShell()
+ */
+ public Shell getShell() {
+ return SystemBasePlugin.getActiveWorkbenchShell();
+ }
+
+ /**
+ * Returns whether auto-builds will be postponed while this
+ * context is executing a runnable.
+ * @return true
if auto-builds will be postponed while this
+ * context is executing a runnable, false
otherwise.
+ */
+ public boolean isPostponeBuild() {
+ return postponeBuild;
+ }
+
+ /**
+ * Sets whether auto-builds will be postponed while this
+ * context is executing a runnable.
+ * @param postponeBuild true
to postpone auto-builds, false
otherwise.
+ */
+ public void setPostponeBuild(boolean postponeBuild) {
+ this.postponeBuild = postponeBuild;
+ }
+
+ /**
+ * Returns the scheduling rule that will be obtained before the context
+ * executes a runnable, or null
if no scheduling rule is to be obtained.
+ * @return the schedulingRule to be used or null
.
+ */
+ public ISchedulingRule getSchedulingRule() {
+ return schedulingRule;
+ }
+
+ /**
+ * Returns whether the job created by this runnable context is user initiated.
+ * @return true
if the job is a result of user initiated actions, false
otherwise.
+ */
+ public boolean isUser() {
+ return isUser;
+ }
+
+ /**
+ * Sets wheter the job created by this runnable context is user initiated.
+ * By default, the job is a user initiated job.
+ * @param isUser true
if the job is a result of user initiated actions, false
otherwise.
+ */
+ public void setUser(boolean isUser) {
+ this.isUser = isUser;
+ }
+
+ /**
+ * Sets the scheduling rule that will be obtained before the context
+ * executes a runnable, or null
if no scheduling rule is to be obtained.
+ * @param schedulingRule the scheduling rule to be used or null
.
+ */
+ public void setSchedulingRule(ISchedulingRule schedulingRule) {
+ this.schedulingRule = schedulingRule;
+ }
+
+ /**
+ * Runs the runnable with the given monitor.
+ * @param runnable the runnable.
+ * @param monitor the progress monitor.
+ * @return the status of running the runnable.
+ */
+ IStatus run(IRunnableWithProgress runnable, IProgressMonitor monitor) {
+
+ // run the runnable
+ try {
+ runnable.run(monitor);
+ }
+ catch (InvocationTargetException e) {
+ Throwable target = e.getTargetException();
+ String msg = "";
+
+ if (target != null) {
+ msg = target.getMessage();
+ }
+
+ // return an error status
+ return new Status(IStatus.ERROR, SystemPlugin.getDefault().getSymbolicName(), 0, msg, target);
+ }
+ catch (InterruptedException e) {
+ return Status.OK_STATUS;
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * Returns a basic job which simply runs the runnable.
+ * @param runnable the runnable.
+ * @return the basic job.
+ */
+ private Job getBasicJob(final IRunnableWithProgress runnable) {
+ return new Job(jobName) {
+ public IStatus run(IProgressMonitor monitor) {
+ return SystemJobRunnableContext.this.run(runnable, monitor);
+ }
+ };
+ }
+
+ /**
+ * Returns a workspace job which simply runs the runnable.
+ * @param runnable the runnable.
+ * @return the workspace job.
+ */
+ private Job getWorkspaceJob(final IRunnableWithProgress runnable) {
+ return new WorkspaceJob(jobName) {
+ public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
+ return SystemJobRunnableContext.this.run(runnable, monitor);
+ }
+ };
+ }
+
+ /**
+ * Schedules the job.
+ * @param job the job to schedule.
+ * @param site the workbench site.
+ */
+ public static void schedule(Job job, IWorkbenchSite site) {
+
+ if (site != null) {
+
+ // get the site progress service
+ IWorkbenchSiteProgressService siteProgress = (IWorkbenchSiteProgressService)(site.getAdapter(IWorkbenchSiteProgressService.class));
+
+ // if there is one, schedule the job with a half-busy cursor
+ if (siteProgress != null) {
+ siteProgress.schedule(job, 0, true);
+ return;
+ }
+ }
+
+ // if no site progress service, just schedule the job in the job queue
+ job.schedule();
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemProgressDialogRunnableContext.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemProgressDialogRunnableContext.java
new file mode 100644
index 00000000000..02c827f98f8
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemProgressDialogRunnableContext.java
@@ -0,0 +1,200 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.operations;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.jface.operation.IRunnableContext;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.progress.IProgressService;
+
+/**
+ * This runnable context blocks the UI and can therefore have a shell assigned to
+ * it (since the shell won't be closed by the user before the runnable completes).
+ */
+public class SystemProgressDialogRunnableContext implements ISystemRunnableContext {
+
+ private Shell shell;
+ private IRunnableContext runnableContext;
+ private ISchedulingRule schedulingRule;
+ private boolean postponeBuild;
+
+ /**
+ * Constructor.
+ * @param shell the shell for the runnable context.
+ */
+ public SystemProgressDialogRunnableContext(Shell shell) {
+ this.shell = shell;
+ }
+
+ /**
+ * Returns whether the auto-build will be postponed while this
+ * context is executing a runnable.
+ * @return true
if the auto-build will be postponed while this
+ * context is executing a runnable, false
otherwise.
+ */
+ public boolean isPostponeBuild() {
+ return postponeBuild;
+ }
+
+ /**
+ * Sets whether the auto-build will be postponed while this
+ * context is executing a runnable.
+ * @param postponeBuild true
to postpone the auto-build, false
nullnull
.
+ */
+ public ISchedulingRule getSchedulingRule() {
+ return schedulingRule;
+ }
+
+ /**
+ * Sets the scheduling rule that will be obtained before the context
+ * executes a runnable or null
if no scheduling rule is to be obtained.
+ * @param schedulingRule the scheduling rule to be obtained or null
.
+ */
+ public void setSchedulingRule(ISchedulingRule schedulingRule) {
+ this.schedulingRule = schedulingRule;
+ }
+
+ /**
+ * Returns the shell.
+ * @see org.eclipse.rse.ui.operations.ISystemRunnableContext#getShell()
+ */
+ public Shell getShell() {
+ return shell;
+ }
+
+ /**
+ * Sets the runnable context that is used to execute the runnable. By default,
+ * the workbench's progress service is used, but clients can provide their own.
+ * @param runnableContext the runnable contenxt used to execute runnables.
+ */
+ public void setRunnableContext(IRunnableContext runnableContext) {
+ this.runnableContext = runnableContext;
+ }
+
+ /**
+ * Runs the runnable.
+ * @see org.eclipse.rse.ui.operations.ISystemRunnableContext#run(org.eclipse.jface.operation.IRunnableWithProgress)
+ */
+ public void run(IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
+ // fork and cancellable
+ getRunnableContext().run(true, true, wrapRunnable(runnable));
+ }
+
+ /**
+ * Returns the runnable context. If a runnable context was not set, the default is to use the workbench
+ * progress service.
+ * @return the runnable context.
+ */
+ private IRunnableContext getRunnableContext() {
+
+ // no runnable context set, so we create our default
+ if (runnableContext == null) {
+
+ return new IRunnableContext() {
+
+ public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
+
+ // get the workbench progress service
+ IProgressService manager = PlatformUI.getWorkbench().getProgressService();
+
+ // run the runnable in a non-UI thread and set the cursor to busy
+ manager.busyCursorWhile(runnable);
+ }
+ };
+ }
+
+ return runnableContext;
+ }
+
+ /**
+ * Wraps the runnable as required and returns the wrapper runnable. If there is no scheduling rule, and
+ * auto-builds do not have to be postponed, then the wrapper simply defers to the runnable. Otherwise,
+ * we execute the runnable as an atomic workspace operation.
+ * @param runnable the runnable to wrap.
+ * @return the wrapper runnable.
+ */
+ private IRunnableWithProgress wrapRunnable(final IRunnableWithProgress runnable) {
+
+ // wrap the runnable in another runnable
+ return new IRunnableWithProgress() {
+
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+
+ try {
+
+ // if there is no scheduling rule, and if auto-build does not have to be postponed
+ // then simply use the given runnable
+ if (schedulingRule == null && !postponeBuild) {
+ runnable.run(monitor);
+ }
+ // otherwise, we need to run taking into account the scheduling rule
+ else {
+
+ // array for holding exceptions
+ final Exception[] exception = new Exception[] { null };
+
+ // we run as an atomic workspace operation with a scheduling rule and allow updates
+ // create a workspace runnable
+ ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
+ public void run(IProgressMonitor pm) throws CoreException {
+ try {
+ // just use the given runnable
+ runnable.run(pm);
+ }
+ catch (InvocationTargetException e) {
+ exception[0] = e;
+ }
+ catch (InterruptedException e) {
+ exception[0] = e;
+ }
+ }
+ }, schedulingRule, 0, monitor);
+
+ if (exception[0] != null) {
+ if (exception[0] instanceof InvocationTargetException) {
+ throw (InvocationTargetException)exception[0];
+ }
+ else if (exception[0] instanceof InterruptedException) {
+ throw (InterruptedException)exception[0];
+ }
+ }
+ }
+ }
+ catch (CoreException e) {
+ throw new InvocationTargetException(e);
+ }
+ }
+ };
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemSchedulingRule.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemSchedulingRule.java
new file mode 100644
index 00000000000..6b2bbb675bf
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemSchedulingRule.java
@@ -0,0 +1,46 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.operations;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+
+/**
+ * A simple job scheduling rule for serializing jobs for an ICVSRepositoryLocation
+ */
+public class SystemSchedulingRule implements ISchedulingRule {
+ IAdaptable _location;
+
+ public SystemSchedulingRule(IAdaptable location)
+ {
+ _location = location;
+ }
+
+ public boolean isConflicting(ISchedulingRule rule)
+ {
+ if(rule instanceof SystemSchedulingRule)
+ {
+ return ((SystemSchedulingRule)rule)._location.equals(_location);
+ }
+ return false;
+ }
+
+ public boolean contains(ISchedulingRule rule)
+ {
+ return isConflicting(rule);
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/AbstractSystemSubSystemPropertyPageCoreForm.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/AbstractSystemSubSystemPropertyPageCoreForm.java
new file mode 100644
index 00000000000..badc89e9ba7
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/AbstractSystemSubSystemPropertyPageCoreForm.java
@@ -0,0 +1,221 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.propertypages;
+import java.util.ResourceBundle;
+
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.SystemWidgetHelpers;
+import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
+import org.eclipse.rse.ui.messages.ISystemMessageLine;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.dialogs.PropertyPage;
+
+/**
+ * The form for the property page for core subsystem properties.
+ */
+public abstract class AbstractSystemSubSystemPropertyPageCoreForm
+ implements ISystemMessages, ISystemSubSystemPropertyPageCoreForm
+{
+
+ protected Label labelTypePrompt, labelVendorPrompt, labelNamePrompt, labelConnectionPrompt, labelProfilePrompt;
+
+ protected Label labelType, labelVendor, labelName, labelConnection, labelProfile;
+
+ protected SystemMessage errorMessage;
+ protected ResourceBundle rb;
+ protected boolean initDone = false;
+ protected String xlatedNotApplicable = null;
+ // Inputs from caller
+ protected ISystemMessageLine msgLine;
+ protected Object inputElement;
+ protected Shell shell;
+ protected Object caller;
+ protected boolean callerInstanceOfWizardPage, callerInstanceOfSystemPromptDialog, callerInstanceOfPropertyPage;
+
+ /**
+ * Constructor
+ */
+ public AbstractSystemSubSystemPropertyPageCoreForm(ISystemMessageLine msgLine, Object caller)
+ {
+ super();
+ this.msgLine = msgLine;
+ this.caller = caller;
+ callerInstanceOfWizardPage = (caller instanceof WizardPage);
+ callerInstanceOfSystemPromptDialog = (caller instanceof SystemPromptDialog);
+ callerInstanceOfPropertyPage = (caller instanceof PropertyPage);
+ SystemPlugin sp = SystemPlugin.getDefault();
+ }
+ /**
+ * Get the input element
+ */
+ private Object getElement()
+ {
+ return inputElement;
+ }
+ /**
+ * Get the shell
+ */
+ protected Shell getShell()
+ {
+ return shell;
+ }
+
+
+
+ /**
+ * Create the GUI contents.
+ */
+ public Control createContents(Composite parent, Object inputElement, Shell shell)
+ {
+ this.shell = shell;
+ this.inputElement = inputElement;
+ String labelText = null;
+ // Inner composite
+ Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, 2);
+
+ // Type display
+ labelText = SystemWidgetHelpers.appendColon(SystemResources.RESID_SUBSYSTEM_TYPE_LABEL);
+ labelTypePrompt = SystemWidgetHelpers.createLabel(composite_prompts, labelText);
+ labelType = SystemWidgetHelpers.createLabel(composite_prompts, SystemResources.RESID_SUBSYSTEM_TYPE_VALUE);
+
+ // Vendor display
+ labelText = SystemWidgetHelpers.appendColon(SystemResources.RESID_SUBSYSTEM_VENDOR_LABEL);
+ labelVendorPrompt = SystemWidgetHelpers.createLabel(composite_prompts, labelText);
+ labelVendor = SystemWidgetHelpers.createLabel(composite_prompts, " ");
+
+ // Name display
+ labelText = SystemWidgetHelpers.appendColon(SystemResources.RESID_SUBSYSTEM_NAME_LABEL);
+ labelNamePrompt = SystemWidgetHelpers.createLabel(composite_prompts, labelText);
+ labelName = SystemWidgetHelpers.createLabel(composite_prompts, " ");
+
+ // Connection display
+ labelText = SystemWidgetHelpers.appendColon(SystemResources.RESID_SUBSYSTEM_CONNECTION_LABEL);
+ labelConnectionPrompt = SystemWidgetHelpers.createLabel(composite_prompts, labelText);
+ labelConnection = SystemWidgetHelpers.createLabel(composite_prompts, " ");
+
+ // Profile display
+ labelText = SystemWidgetHelpers.appendColon(SystemResources.RESID_SUBSYSTEM_PROFILE_LABEL);
+ labelProfilePrompt = SystemWidgetHelpers.createLabel(composite_prompts, labelText);
+ labelProfile = SystemWidgetHelpers.createLabel(composite_prompts, " ");
+
+ createInner(composite_prompts, inputElement, shell);
+
+ return composite_prompts;
+ }
+
+ /**
+ * Return control to recieve initial focus
+ */
+ public Control getInitialFocusControl()
+ {
+ return null;
+ }
+ /**
+ * Get the input subsystem object
+ */
+ protected ISubSystem getSubSystem()
+ {
+ Object element = getElement();
+ if (element instanceof ISubSystem)
+ return (ISubSystem)element;
+ else
+ return null;
+ }
+
+
+ /**
+ * Initialize values of input fields based on input
+ */
+ protected void doInitializeFields()
+ {
+ initDone = true;
+ ISubSystem ss = getSubSystem();
+ ISubSystemConfiguration ssFactory = ss.getSubSystemConfiguration();
+
+ //getPortValidator();
+ // vendor
+ labelVendor.setText(ssFactory.getVendor());
+ // name
+ labelName.setText(ss.getName());
+ // connection
+ labelConnection.setText(ss.getHostAliasName());
+ // profile
+ labelProfile.setText(ss.getSystemProfileName());
+
+ doInitializeInnerFields();
+ }
+
+
+
+
+
+
+ /**
+ * This method can be called by the dialog or wizard page host, to decide whether to enable
+ * or disable the next, final or ok buttons. It returns true if the minimal information is
+ * available and is correct.
+ */
+ public boolean isPageComplete()
+ {
+ boolean pageComplete = false;
+ return pageComplete;
+ }
+ /**
+ * Inform caller of page-complete status of this form
+ */
+ public void setPageComplete()
+ {
+ boolean complete = isPageComplete();
+ if (callerInstanceOfWizardPage)
+ {
+ ((WizardPage)caller).setPageComplete(complete);
+ }
+ else if (callerInstanceOfSystemPromptDialog)
+ {
+ ((SystemPromptDialog)caller).setPageComplete(complete);
+ }
+ else if (callerInstanceOfPropertyPage)
+ {
+ ((PropertyPage)caller).setValid(complete);
+ }
+ }
+
+
+
+
+
+
+ /*
+ * Create the inner portion of the contents. These include any additional fields for the subsystem
+ */
+ protected abstract Control createInner(Composite parent, Object inputElement, Shell shell);
+
+ /*
+ * Initialize the inner portion of the contents. These include any additional fields for the subsystem
+ */
+ protected abstract void doInitializeInnerFields();
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/ISystemConnectionWizardErrorUpdater.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/ISystemConnectionWizardErrorUpdater.java
new file mode 100644
index 00000000000..9391d4d6111
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/ISystemConnectionWizardErrorUpdater.java
@@ -0,0 +1,28 @@
+/********************************************************************************
+ * Copyright (c) 2005, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.propertypages;
+import org.eclipse.rse.ui.ISystemVerifyListener;
+
+/**
+ * @author mjberger
+ */
+public interface ISystemConnectionWizardErrorUpdater
+{
+ public boolean isPageComplete();
+ public void addVerifyListener(ISystemVerifyListener listener);
+ public String getTheErrorMessage();
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/ISystemConnectionWizardPropertyPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/ISystemConnectionWizardPropertyPage.java
new file mode 100644
index 00000000000..09c86635a80
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/ISystemConnectionWizardPropertyPage.java
@@ -0,0 +1,32 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.propertypages;
+
+
+import org.eclipse.rse.core.subsystems.IConnectorService;
+import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
+
+/**
+ * interface for a property page that can be shown in the new connection wizard
+ */
+public interface ISystemConnectionWizardPropertyPage
+{
+ public boolean applyValues(IConnectorService subsystem);
+ public void setSubSystemFactory(ISubSystemConfiguration factory);
+ public void setHostname(String hostname);
+ public void setSystemType(String systemType);
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/ISystemSubSystemPropertyPageCoreForm.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/ISystemSubSystemPropertyPageCoreForm.java
new file mode 100644
index 00000000000..d72999205b3
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/ISystemSubSystemPropertyPageCoreForm.java
@@ -0,0 +1,48 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.propertypages;
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+
+
+/**
+ * interface for a property page that can be shown in the new connection wizard
+ */
+public interface ISystemSubSystemPropertyPageCoreForm
+{
+ /**
+ * Create the GUI contents.
+ */
+ public Control createContents(Composite parent, Object inputElement, Shell shell);
+
+
+ /**
+ * Called by parent when user presses OK
+ */
+ public boolean performOk();
+
+ /**
+ * Validate the form
+ *
+ * To get these benefits though, you must override {@link #createContentArea(Composite)} versus the
+ * usual createContents(Composite) method..
+ *
+ *
+ * If your property page is for a file-system file or folder, use {@link SystemAbstractRemoteFilePropertyPageExtensionAction}.
+ */
+public abstract class SystemAbstractPropertyPageExtensionAction
+ //extends PropertyPage implements IWorkbenchPropertyPage
+ extends SystemBasePropertyPage implements IWorkbenchPropertyPage
+{
+ protected static final Object[] EMPTY_ARRAY = new Object[0];
+
+ /**
+ * Constructor
+ */
+ public SystemAbstractPropertyPageExtensionAction()
+ {
+ super();
+ // ensure the page has no special buttons
+ noDefaultAndApplyButton();
+ }
+
+ // ------------------------
+ // OVERRIDABLE METHODS...
+ // ------------------------
+ /**
+ * Abstract. You must override.
+ * This is where child classes create their content area versus createContent,
+ * in order to have the message line configured for them and mnemonics assigned.
+ */
+ protected abstract Control createContentArea(Composite parent);
+
+ /**
+ * You may override if your page has input fields. By default returns true.
+ * Validate all the widgets on the page. Based on this, the Eclipse framework will know whether
+ * to veto any user attempt to select another property page from the list on the left in the
+ * Properties dialog.
+ *
+ *
+ *
+ *
+ * @return true if there are no errors, false if any errors were found.
+ */
+ protected boolean verifyPageContents()
+ {
+ return true;
+ }
+
+ // ---------------------------------------------
+ // CONVENIENCE METHODS FOR SUBCLASSES TO USE...
+ // ---------------------------------------------
+ /**
+ * Retrieve the input remote object
+ * @see #getRemoteAdapter(Object)
+ */
+ public Object getRemoteObject()
+ {
+ return getElement();
+ }
+ /**
+ * Retrieve the adapter of the input remote object as an ISystemRemoteElementAdapter object, for convenience.
+ * Will be null if there is nothing selected
+ */
+ public ISystemRemoteElementAdapter getRemoteAdapter()
+ {
+ return getRemoteAdapter(getElement());
+ }
+ /**
+ * Returns the implementation of ISystemRemoteElementAdapter for the given
+ * object. Returns null if this object does not adaptable to this.
+ */
+ protected ISystemRemoteElementAdapter getRemoteAdapter(Object o)
+ {
+ if (!(o instanceof IAdaptable))
+ return (ISystemRemoteElementAdapter)Platform.getAdapterManager().getAdapter(o,ISystemRemoteElementAdapter.class);
+ return (ISystemRemoteElementAdapter)((IAdaptable)o).getAdapter(ISystemRemoteElementAdapter.class);
+ }
+
+ /**
+ * Returns the name of the input remote object
+ */
+ public String getRemoteObjectName()
+ {
+ return getRemoteAdapter().getName(getRemoteObject());
+ }
+ /**
+ * Returns the id of the subsystem factory of the input remote object.
+ */
+ public String getRemoteObjectSubSystemFactoryId()
+ {
+ return getRemoteAdapter().getSubSystemFactoryId(getRemoteObject());
+ }
+ /**
+ * Returns the type category of the input remote object
+ */
+ public String getRemoteObjectTypeCategory()
+ {
+ return getRemoteAdapter().getRemoteTypeCategory(getRemoteObject());
+ }
+ /**
+ * Returns the type of the input remote object
+ */
+ public String getRemoteObjectType()
+ {
+ return getRemoteAdapter().getRemoteType(getRemoteObject());
+ }
+ /**
+ * Returns the subtype of the input remote object
+ */
+ public String getRemoteObjectSubType()
+ {
+ return getRemoteAdapter().getRemoteSubType(getRemoteObject());
+ }
+ /**
+ * Returns the sub-subtype of the input remote object
+ */
+ public String getRemoteObjectSubSubType()
+ {
+ return getRemoteAdapter().getRemoteSubSubType(getRemoteObject());
+ }
+ /**
+ * Returns the subsystem from which the input remote object was resolved
+ */
+ public ISubSystem getSubSystem()
+ {
+ return getRemoteAdapter().getSubSystem(getRemoteObject());
+ }
+ /**
+ * Returns the subsystem factory which owns the subsystem from which the input remote object was resolved
+ */
+ public ISubSystemConfiguration getSubSystemFactory()
+ {
+ ISubSystem ss = getSubSystem();
+ if (ss != null)
+ return ss.getSubSystemConfiguration();
+ else
+ return null;
+ }
+
+ /**
+ * Return the SystemConnection from which the selected remote objects were resolved
+ */
+ public IHost getSystemConnection()
+ {
+ IHost conn = null;
+ ISubSystem ss = getRemoteAdapter().getSubSystem(getRemoteObject());
+ if (ss != null)
+ conn = ss.getHost();
+ return conn;
+ }
+
+
+
+ /**
+ * Debug method to print out details of given selected object, in a composite GUI widget...
+ */
+ protected Composite createTestComposite(Composite parent)
+ {
+ // Inner composite
+ int nbrColumns = 2;
+ Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns);
+
+ //System.out.println("Remote object name................: " + getRemoteObjectName());
+ //System.out.println("Remote object subsystem factory id: " + getRemoteObjectSubSystemFactoryId());
+ //System.out.println("Remote object type category.......: " + getRemoteObjectTypeCategory());
+ //System.out.println("Remote object type ...............: " + getRemoteObjectType());
+ //System.out.println("Remote object subtype ............: " + getRemoteObjectSubType());
+ //System.out.println("Remote object subsubtype .........: " + getRemoteObjectSubSubType());
+
+ SystemWidgetHelpers.createLabel(composite_prompts, "Remote object name: ");
+ SystemWidgetHelpers.createLabel(composite_prompts, checkForNull(getRemoteObjectName()));
+
+ SystemWidgetHelpers.createLabel(composite_prompts, "Remote object subsystem factory id: ");
+ SystemWidgetHelpers.createLabel(composite_prompts, checkForNull(getRemoteObjectSubSystemFactoryId()));
+
+ SystemWidgetHelpers.createLabel(composite_prompts, "Remote object type category: ");
+ SystemWidgetHelpers.createLabel(composite_prompts, checkForNull(getRemoteObjectTypeCategory()));
+
+ SystemWidgetHelpers.createLabel(composite_prompts, "Remote object type: ");
+ SystemWidgetHelpers.createLabel(composite_prompts, checkForNull(getRemoteObjectType()));
+
+ SystemWidgetHelpers.createLabel(composite_prompts, "Remote object subtype: ");
+ SystemWidgetHelpers.createLabel(composite_prompts, checkForNull(getRemoteObjectSubType()));
+
+ SystemWidgetHelpers.createLabel(composite_prompts, "Remote object subsubtype: ");
+ SystemWidgetHelpers.createLabel(composite_prompts, checkForNull(getRemoteObjectSubSubType()));
+
+ return composite_prompts;
+ }
+
+ /**
+ * Check for null, and if so, return ""
+ */
+ private String checkForNull(String input)
+ {
+ if (input == null)
+ return "";
+ else
+ return input;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemBasePropertyPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemBasePropertyPage.java
new file mode 100644
index 00000000000..5d88db78604
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemBasePropertyPage.java
@@ -0,0 +1,536 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.propertypages;
+import java.util.ResourceBundle;
+
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.Mnemonics;
+import org.eclipse.rse.ui.SystemWidgetHelpers;
+import org.eclipse.rse.ui.messages.ISystemMessageLine;
+import org.eclipse.rse.ui.messages.ISystemMessageLineTarget;
+import org.eclipse.rse.ui.messages.SystemDialogPageMessageLine;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.dialogs.PropertyPage;
+
+/**
+ * A base class for property pages that offers value over the base Eclipse PropertyPage
+ * class:
+ *
+ *
+ *
To do on-the-fly validation, in your handler calling setErrorMessage/clearErrorMessage automatically calls setValid, although
+ * you can call it directly too if you desire.
+ *
verifyPageContents is called by default by performOk (be sure to call super.performOk if you override), and
+ * for multiple property pages, is called when another one is selected.
+ *
+ * Our base implementation of createContents configures them message line and then calls
+ * {@link #createContentArea(Composite)} and then assigns mnemonics to the content area.
+ * Also calls {@link #noDefaultAndApplyButton()} if {@link #wantDefaultAndApplyButton()} returns false.
+ *
+ * @see org.eclipse.jface.preference.PreferencePage#createContents(Composite)
+ * @see #createContentArea(Composite)
+ */
+ protected Control createContents(Composite parent)
+ {
+ // TODO - redesign message line so it works in Eclipse 3.0
+ // DKM commenting this out for now to avoid exceptions
+ //configureMessageLine();
+ if (!wantDefaultAndApplyButton())
+ noDefaultAndApplyButton();
+ Control c = createContentArea(parent);
+ if ((c != null) && (c instanceof Composite))
+ {
+ contentArea = (Composite)c;
+ if (helpId != null)
+ SystemWidgetHelpers.setHelp(contentArea, helpId);
+ if (wantMnemonics())
+ (new Mnemonics()).setOnPreferencePage(true).setMnemonics(contentArea);
+ }
+ configureMessageLine();
+ return c;
+ }
+
+ /**
+ * Configuration method. Override only to change the default.
+ * Return true if you want to see Apply and Restore Defaults buttons. This is queried by
+ * the default implementation of createContents and the default is false, we don't want
+ * to see them. Default is false.
+ */
+ protected boolean wantDefaultAndApplyButton()
+ {
+ return false;
+ }
+
+ /**
+ * Configuration method. Override only to change the default.
+ * Return false if you don't want to have mnemonics automatically applied to your page
+ * by this parent class. Default is true.
+ */
+ protected boolean wantMnemonics()
+ {
+ return true;
+ }
+ /**
+ * Configuration method. Override only to change the default.
+ * Return false if you don't want to automatically set whether the page is valid based
+ * on error message status. Default is true
+ */
+ protected boolean wantAutomaticValidManagement()
+ {
+ return true;
+ }
+
+ /**
+ * For setting the default overall help for the dialog.
+ * This can be overridden per control by calling {@link #setHelp(Control, String)}.
+ */
+ public void setHelp(String helpId)
+ {
+ if (contentArea != null)
+ {
+ SystemWidgetHelpers.setHelp(contentArea, helpId);
+ SystemWidgetHelpers.setHelp(contentArea, helpId);
+ //SystemWidgetHelpers.setCompositeHelp(parentComposite, helpId, helpIdPerControl);
+ //SystemWidgetHelpers.setCompositeHelp(buttonsComposite, helpId, helpIdPerControl);
+ }
+ this.helpId = helpId;
+ }
+
+ /**
+ * Abstract. You must override.
+ * This is where child classes create their content area versus createContent,
+ * in order to have the message line configured for them and mnemonics assigned.
+ */
+ protected abstract Control createContentArea(Composite parent);
+
+
+ /**
+ * Private. No need to call or override.
+ * Configure the message line if not already. Called for you if you override createContentArea
+ * versus createContents, else you might choose to call it yourself.
+ */
+ protected void configureMessageLine()
+ {
+// if (msgLine == null)
+ //msgLine = SystemPropertiesMessageLine.configureMessageLine(this);
+ // msgLine = SystemDialogPageMessageLine.createPropertyPageMsgLine(this);
+ }
+
+ /**
+ * Private. No need to call or override.
+ * Override of parent to delete the button bar since we don't use it, and to make this
+ * page fit on a 800x600 display
+ */
+ protected void contributeButtons(Composite buttonBar)
+ {
+ this.buttonsComposite = buttonBar;
+ if (helpId != null)
+ SystemWidgetHelpers.setHelp(buttonsComposite, helpId);
+
+ if (wantDefaultAndApplyButton())
+ super.contributeButtons(buttonBar);
+ else
+ {
+ // see createControl method in org.eclipse.jface.preference.PreferencePage
+ Composite content = buttonBar.getParent();
+ Composite pageContainer = content.getParent();
+ //DY The parent PreferencePage class handles this now for us
+ //DY buttonBar.setVisible(false);
+ //DY buttonBar.dispose();
+
+ if ((contentArea != null) && (contentArea.getLayout() != null) &&
+ (contentArea.getLayout() instanceof GridLayout))
+ {
+ ((GridLayout)contentArea.getLayout()).marginHeight = 0;
+ if (contentArea.getLayoutData() instanceof GridData)
+ ((GridData)contentArea.getLayoutData()).grabExcessVerticalSpace = false;
+ contentArea.pack();
+ }
+ if (content != null)
+ {
+ if (content.getLayout() instanceof GridLayout)
+ {
+ GridLayout layout = (GridLayout)content.getLayout();
+ //layout.marginHeight= 0; layout.marginWidth= 0;
+ }
+ content.pack();
+ }
+ }
+ }
+
+ /**
+ * Parent intercept. No need to call or override.
+ * The PreferencePage
implementation of this
+ * IPreferencePage
method returns true
+ * if the page is valid.
+ *
+ * Validate all the widgets on the page. Based on this, the Eclipse framework will know whether
+ * to veto any user attempt to select another property page from the list on the left in the
+ * Properties dialog.
+ *
+ *
+ *
+ *
+ * @return true if there are no errors, false if any errors were found.
+ */
+ protected abstract boolean verifyPageContents();
+ /*
+ {
+ return true;
+ }*/
+
+ /**
+ * Method declared on IPreferencePage.
+ * Our implementation is to call okToLeave(), which in turn calls verifyPageContents,
+ * returning true iff they do.
+ * If you override, call super.performOk() to get default processing, and return false if that returns false.
+ * @return true if all is well, false if there is an error.
+ */
+ public boolean performOk()
+ {
+ boolean oldValid = isValid();
+ boolean newValid = okToLeave();
+ setValid(oldValid);
+ return newValid;
+ }
+ // -----------------------------------
+ // ISystemMessageLineTarget methods...
+ // -----------------------------------
+ /**
+ * ISystemMessageLineTarget method.
+ * Set the message line to use for issuing messages
+ */
+ public void setMessageLine(ISystemMessageLine msgLine)
+ {
+ //System.out.println("Inside setMessageLine");
+ this.msgLine = msgLine;
+ msgLineSet = (msgLine != null);
+ }
+ /**
+ * ISystemMessageLineTarget method.
+ * Get the message line to use for issuing messages
+ */
+ public ISystemMessageLine getMessageLine()
+ {
+ //if (msgLineSet)
+ // return msgLine;
+ //else
+ return this;
+ }
+
+ // -----------------------------
+ // Helper methods...
+ // -----------------------------
+ /**
+ * Helper method.
+ * Set the cursor to the wait cursor (true) or restores it to the normal cursor (false).
+ */
+ public void setBusyCursor(boolean setBusy)
+ {
+ if (setBusy)
+ {
+ // Set the busy cursor to all shells.
+ Display d = getShell().getDisplay();
+ waitCursor = new Cursor(d, SWT.CURSOR_WAIT);
+ org.eclipse.rse.ui.dialogs.SystemPromptDialog.setDisplayCursor(getShell(), waitCursor);
+ }
+ else
+ {
+ org.eclipse.rse.ui.dialogs.SystemPromptDialog.setDisplayCursor(getShell(), null);
+ if (waitCursor != null)
+ waitCursor.dispose();
+ waitCursor = null;
+ }
+ }
+
+ /**
+ * Helper method.
+ * Add a separator line. This is a physically visible line.
+ */
+ protected Label addSeparatorLine(Composite parent, int nbrColumns)
+ {
+ Label separator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
+ GridData data = new GridData();
+ data.horizontalSpan = nbrColumns;
+ data.horizontalAlignment = GridData.FILL;
+ separator.setLayoutData(data);
+ return separator;
+ }
+ /**
+ * Helper method.
+ * Add a spacer line
+ */
+ protected Label addFillerLine(Composite parent, int nbrColumns)
+ {
+ Label filler = new Label(parent, SWT.LEFT);
+ GridData data = new GridData();
+ data.horizontalSpan = nbrColumns;
+ data.horizontalAlignment = GridData.FILL;
+ filler.setLayoutData(data);
+ return filler;
+ }
+
+ /**
+ * Sets this control to grab any excess horizontal space
+ * left in the window. This is useful to do in a property page
+ * to force all the labels on the right to not be squished up on the left.
+ *
+ * @param control the control for which to grab excess space
+ */
+ protected Control grabExcessSpace(Control control)
+ {
+ GridData gd = (GridData) control.getLayoutData();
+ if (gd != null)
+ gd.grabExcessHorizontalSpace = true;
+ return control;
+ }
+
+ /**
+ * Create a labeled label, where the label on the right grabs excess space and has an indent so it
+ * isn't smashed up against the prompt on the left.
+ * @see SystemWidgetHelpers#createLabeledLabel(Composite, ResourceBundle, String, boolean)
+ * @see #grabExcessSpace(Control)
+ */
+ protected Label createLabeledLabel(Composite c, String label, String tooltip)
+ {
+ Label l = SystemWidgetHelpers.createLabeledLabel(c, label, tooltip, false);
+ GridData gd = (GridData)l.getLayoutData();
+ if (gd != null)
+ {
+ gd.grabExcessHorizontalSpace = true;
+ gd.horizontalIndent = 10;
+ }
+ return l;
+ }
+ /**
+ * Create a labeled combo, where the combo on the right grabs excess space and has an indent so it
+ * isn't smashed up against the prompt on the left.
+ * @see SystemWidgetHelpers#createLabeledCombo(Composite, Listener, ResourceBundle, String)
+ * @see #grabExcessSpace(Control)
+ */
+ protected Combo createLabeledCombo(Composite c, String label, String tooltip)
+ {
+ Combo combo = SystemWidgetHelpers.createLabeledCombo(c, null, label, tooltip);
+ GridData gd = (GridData)combo.getLayoutData();
+ if (gd != null)
+ {
+ gd.grabExcessHorizontalSpace = true;
+ gd.horizontalIndent = 10;
+ }
+ return combo;
+ }
+ /**
+ * Create a labeled entry field, where the field on the right grabs excess space and has an indent so it
+ * isn't smashed up against the prompt on the left.
+ * @see SystemWidgetHelpers#createLabeledTextField(Composite, Listener, ResourceBundle, String)
+ * @see #grabExcessSpace(Control)
+ */
+ protected Text createLabeledText(Composite c, String label, String tooltip)
+ {
+ Text field = SystemWidgetHelpers.createLabeledTextField(c, null, label, tooltip);
+ GridData gd = (GridData)field.getLayoutData();
+ if (gd != null)
+ {
+ gd.grabExcessHorizontalSpace = true;
+ gd.horizontalIndent = 10;
+ }
+ return field;
+ }
+ /**
+ * Create a labeled verbage field, where the field on the right grabs excess space and has an indent so it
+ * isn't smashed up against the prompt on the left.
+ * @see SystemWidgetHelpers#createLabeledTextField(Composite, Listener, ResourceBundle, String)
+ * @see #grabExcessSpace(Control)
+ */
+ protected Label createLabeledVerbage(Composite c, String label, String tooltip)
+ {
+ Label verbage = SystemWidgetHelpers.createLabeledVerbage(c, label, tooltip, 1, false, 200);
+ GridData gd = (GridData)verbage.getLayoutData();
+ if (gd != null)
+ {
+ gd.grabExcessHorizontalSpace = true;
+ gd.horizontalIndent = 10;
+ }
+ return verbage;
+ }
+ // -----------------------------
+ // ISystemMessageLine methods...
+ // -----------------------------
+ /**
+ * ISystemMessageLine method.
+ * Clears the currently displayed error message and redisplayes
+ * the message which was active before the error message was set.
+ */
+ public void clearErrorMessage()
+ {
+ if (msgLine!=null)
+ msgLine.clearErrorMessage();
+ else
+ super.setErrorMessage(null);
+ if (wantAutomaticValidManagement())
+ setValid(true);
+ }
+ /**
+ * ISystemMessageLine method.
+ * Clears the currently displayed message.
+ */
+ public void clearMessage()
+ {
+ if (msgLine!=null)
+ msgLine.clearMessage();
+ else
+ super.setMessage(null);
+ }
+ /**
+ * ISystemMessageLine method.
+ * Get the currently displayed error text.
+ * @return The error message. If no error message is displayed null
is returned.
+ */
+ public SystemMessage getSystemErrorMessage()
+ {
+ if (msgLine!=null)
+ return msgLine.getSystemErrorMessage();
+ else
+ return null;
+ }
+ /**
+ * ISystemMessageLine method.
+ * Display the given error message. A currently displayed message
+ * is saved and will be redisplayed when the error message is cleared.
+ */
+ public void setErrorMessage(String message)
+ {
+ super.setErrorMessage(message);
+ if (wantAutomaticValidManagement())
+ setValid(message == null);
+ if (msgLine != null)
+ ((SystemDialogPageMessageLine)msgLine).internalSetErrorMessage(message);
+ }
+
+ /**
+ * ISystemMessageLine method.
+ * Display the given error message. A currently displayed message
+ * is saved and will be redisplayed when the error message is cleared.
+ */
+ public void setErrorMessage(SystemMessage message)
+ {
+ if (msgLine!=null)
+ msgLine.setErrorMessage(message);
+ else
+ super.setErrorMessage(message.getLevelOneText());
+ if (wantAutomaticValidManagement())
+ setValid(message == null);
+ }
+ /**
+ * ISystemMessageLine method.
+ * Convenience method to set an error message from an exception
+ */
+ public void setErrorMessage(Throwable exc)
+ {
+ if (msgLine != null)
+ msgLine.setErrorMessage(exc);
+ }
+
+ /**
+ * ISystemMessageLine method.
+ * Set the error message text. If the message line currently displays an error,
+ * the message is stored and will be shown after a call to clearErrorMessage
+ */
+ public void setMessage(SystemMessage message)
+ {
+ if (msgLine!=null)
+ msgLine.setMessage(message);
+ else
+ super.setMessage(message.getLevelOneText());
+ }
+ /**
+ * ISystemMessageLine method.
+ * Set the non-error message text. If the message line currently displays an error,
+ * the message is stored and will be shown after a call to clearErrorMessage
+ */
+ public void setMessage(String message)
+ {
+ super.setMessage(message);
+ if (msgLine!=null)
+ ((SystemDialogPageMessageLine)msgLine).internalSetMessage(message);
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemBooleanFieldEditor.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemBooleanFieldEditor.java
new file mode 100644
index 00000000000..c8ebc67c413
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemBooleanFieldEditor.java
@@ -0,0 +1,109 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.propertypages;
+import java.util.ResourceBundle;
+
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * Thin subclass so we can support setToolTipText!!
+ */
+public class SystemBooleanFieldEditor extends BooleanFieldEditor
+{
+ private Button button;
+ private String tip;
+
+ /**
+ * Constructor for SystemBooleanFieldEditor
+ */
+ protected SystemBooleanFieldEditor()
+ {
+ super();
+ }
+
+ /**
+ * Constructor for SystemBooleanFieldEditor
+ * @param name the preference-store-key of the preference this field editor works on
+ * @param labelText the label text of the field editor
+ * @param style the style, either DEFAULT
or
+ * SEPARATE_LABEL
+ * @param parent the parent of the field editor's control
+ * @see #DEFAULT
+ * @see #SEPARATE_LABEL
+ */
+ public SystemBooleanFieldEditor(String name, String labelText, int style, Composite parent)
+ {
+ super(name, labelText, style, parent);
+ }
+
+ /**
+ * Constructor for SystemBooleanFieldEditor, using DEFAULT for the style
+ * @param name the preference-store-key of the preference this field editor works on
+ * @param labelText the label text of the field editor
+ * @param parent the parent of the field editor's control
+ */
+ public SystemBooleanFieldEditor(String name, String labelText, Composite parent)
+ {
+ super(name, labelText, parent);
+ }
+ /**
+ * Constructor for SystemBooleanFieldEditor, using DEFAULT for the style, and
+ * specifying a resource bundle and key from which the label (_LABEL and
+ * tooltip text (_TOOLTIP are retrieved.
+ * @param name the preference-store-key of the preference this field editor works on
+ * @param rb the ResourceBundle we will query the label and tooltip from
+ * @param labelKey the resource bundle key from which we get the label (_LABEL and tooltip (_TOOLTIP
+ * @param parent the parent of the field editor's control
+ */
+ public SystemBooleanFieldEditor(String name, ResourceBundle rb, String labelKey, Composite parent)
+ {
+ super(name, rb.getString(labelKey+"label"), parent);
+ setToolTipText(rb.getString(labelKey+"tooltip"));
+ }
+
+ /**
+ * Returns the change button for this field editor.
+ * This is an override of our parent's method because this is the
+ * only way for us to gain access to the checkbox so that we can
+ * apply our tooltip text.
+ */
+ protected Button getChangeControl(Composite parent)
+ {
+ button = super.getChangeControl(parent);
+ if (tip != null)
+ button.setToolTipText(tip);
+ return button;
+ }
+ /**
+ * Set the tooltip text
+ */
+ public void setToolTipText(String tip)
+ {
+ if (button != null)
+ button.setToolTipText(tip);
+ this.tip = tip;
+ }
+ /**
+ * Get the tooltip text
+ */
+ public String getToolTipText()
+ {
+ return tip;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemChangeFilterPropertyPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemChangeFilterPropertyPage.java
new file mode 100644
index 00000000000..1efc2805ff3
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemChangeFilterPropertyPage.java
@@ -0,0 +1,316 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.propertypages;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
+import org.eclipse.rse.core.subsystems.SubSystemConfiguration;
+import org.eclipse.rse.core.subsystems.SubSystemHelpers;
+import org.eclipse.rse.core.subsystems.util.ISubsystemConfigurationAdapter;
+import org.eclipse.rse.filters.ISystemFilter;
+import org.eclipse.rse.filters.ISystemFilterPoolManagerProvider;
+import org.eclipse.rse.filters.ISystemFilterPoolReferenceManagerProvider;
+import org.eclipse.rse.filters.ISystemFilterReference;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.ISystemPageCompleteListener;
+import org.eclipse.rse.ui.SystemPropertyResources;
+import org.eclipse.rse.ui.SystemWidgetHelpers;
+import org.eclipse.rse.ui.filters.ISystemChangeFilterPaneEditPaneSupplier;
+import org.eclipse.rse.ui.filters.SystemChangeFilterPane;
+import org.eclipse.rse.ui.filters.SystemFilterStringEditPane;
+import org.eclipse.rse.ui.validators.ISystemValidator;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * This is the property page for changing filters. This page used to be the Change dialog.
+ * The plugin.xml file registers this for objects of class com.ibm.etools.systems.filters.SystemFilter or
+ * com.ibm.systems.filters.SystemFilterReference.
+ *
+ * Specify an edit pane that prompts the user for the contents of a filter string.
+ */
+ public void setFilterStringEditPane(SystemFilterStringEditPane editPane)
+ {
+ this.editPane = editPane;
+ }
+ /**
+ * Configuration method
+ * Set the contextual system filter pool reference manager provider. Will be non-null if the
+ * current selection is a reference to a filter pool or filter, or a reference manager
+ * provider itself (eg subsystem)
+ *
+ * Set the contextual system filter pool manager provider. Will be non-null if the
+ * current selection is a filter pool or filter or reference to either, or a manager
+ * provider itself (eg subsystemconfiguration)
+ *
+ * Set the Parent Filter Pool prompt label and tooltip text.
+ */
+ public void setParentPoolPromptLabel(String label, String tip)
+ {
+ changeFilterPane.setParentPoolPromptLabel(label, tip);
+ }
+ /**
+ * Configuration method
+ * Set the name prompt label and tooltip text.
+ */
+ public void setNamePromptLabel(String label, String tip)
+ {
+ changeFilterPane.setNamePromptLabel(label, tip);
+ }
+ /**
+ * Configuration method
+ * Set the label shown in group box around the filter string list, and the tooltip text for the
+ * list box.
+ */
+ public void setListLabel(String label, String tip)
+ {
+ changeFilterPane.setListLabel(label, tip);
+ }
+ /**
+ * Set the string to show as the first item in the list.
+ * The default is "New filter string"
+ */
+ public void setNewListItemText(String label)
+ {
+ changeFilterPane.setNewListItemText(label);
+ }
+ /**
+ * Configuration method
+ * Call this to specify a validator for the filter string. It will be called per keystroke.
+ * A default validator is supplied otherwise: ValidatorFilterString.
+ *
+ * Set the error message to use when the user is editing or creating a filter string, and the
+ * Apply processing detects a duplicate filter string in the list.
+ */
+ public void setDuplicateFilterStringErrorMessage(SystemMessage msg)
+ {
+ changeFilterPane.setDuplicateFilterStringErrorMessage(msg);
+ }
+ /**
+ * Configuration method
+ * Specify if you want to include a test button or not. Appears with "Apply" and "Reset"
+ */
+ public void setWantTestButton(boolean wantTestButton)
+ {
+ changeFilterPane.setWantTestButton(wantTestButton);
+ }
+
+ /**
+ * Set if the edit pane is not to be editable
+ */
+ public void setEditable(boolean editable)
+ {
+ changeFilterPane.setEditable(editable);
+ }
+
+ /**
+ * Set if the user is to be allowed to create multiple filter strings or not. Default is true
+ */
+ public void setSupportsMultipleStrings(boolean multi)
+ {
+ changeFilterPane.setSupportsMultipleStrings(multi);
+ }
+
+ // OVERRIDABLE METHODS...
+
+ /**
+ * Create the page's GUI contents.
+ * @see org.eclipse.jface.preference.PreferencePage#createContents(Composite)
+ */
+ protected Control createContentArea(Composite parent)
+ {
+ Shell shell = getShell();
+ if (shell == null)
+ {
+ System.out.println("Damn, shell is still null!");
+
+ }
+ changeFilterPane.setShell(shell);
+
+ ISystemFilter selectedFilter = getFilter();
+ if (selectedFilter.isPromptable())
+ {
+ int nbrColumns = 1;
+ Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns);
+ Label test = SystemWidgetHelpers.createLabel(composite_prompts, SystemPropertyResources.RESID_TERM_NOTAPPLICABLE, nbrColumns, false);
+ return composite_prompts;
+ }
+
+ if (getElement() instanceof ISystemFilterReference)
+ {
+ ISystemFilterReference filterRef = (ISystemFilterReference)getElement();
+ changeFilterPane.setSystemFilterPoolReferenceManagerProvider(filterRef.getProvider());
+ }
+ changeFilterPane.setSystemFilterPoolManagerProvider(selectedFilter.getProvider());
+
+ ISubSystemConfiguration ssf = SubSystemHelpers.getParentSubSystemFactory(selectedFilter);
+ ISubsystemConfigurationAdapter adapter = (ISubsystemConfigurationAdapter)ssf.getAdapter(ISubsystemConfigurationAdapter.class);
+ adapter.customizeChangeFilterPropertyPage(ssf, this, selectedFilter, shell);
+
+ changeFilterPane.setInputObject(getElement());
+
+ /*
+ // ensure the page has no special buttons
+ noDefaultAndApplyButton();
+
+ // Inner composite
+ int nbrColumns = 2;
+ Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns);
+
+ Label test = SystemWidgetHelpers.createLabel(composite_prompts, "Testing", nbrColumns);
+
+
+ if (!initDone)
+ doInitializeFields();
+
+ return composite_prompts;
+ */
+ return changeFilterPane.createContents(parent);
+ }
+ /**
+ * Intercept of parent so we can reset the default button
+ */
+ protected void contributeButtons(Composite parent)
+ {
+ super.contributeButtons(parent);
+ getShell().setDefaultButton(changeFilterPane.getApplyButton()); // defect 46129
+ }
+
+ /**
+ * Parent-required method.
+ * Do full page validation.
+ * Return true if ok, false if there is an error.
+ */
+ protected boolean verifyPageContents()
+ {
+ return true;
+ }
+
+ /**
+ * Get the input filter object
+ */
+ protected ISystemFilter getFilter()
+ {
+ Object element = getElement();
+ if (element instanceof ISystemFilter)
+ return (ISystemFilter)element;
+ else
+ return ((ISystemFilterReference)element).getReferencedFilter();
+ }
+
+ /**
+ * Called by parent when user presses OK
+ */
+ public boolean performOk()
+ {
+ if (!super.performOk())
+ return false;
+ else
+ return changeFilterPane.processOK();
+ }
+ /**
+ * Called by parent when user presses Cancel
+ */
+ public boolean performCancel()
+ {
+ return changeFilterPane.processCancel();
+ }
+
+ /**
+ * The comleteness of the page has changed.
+ * This is a callback from SystemChangeFilterPane.
+ */
+ public void setPageComplete(boolean complete)
+ {
+ //super.setPageComplete(complete);
+ super.setValid(complete); // we'll see if this is the right thing to do
+ }
+
+ /**
+ * Return our edit pane. Overriding this is an alternative to calling setEditPane.
+ * Method is declared in {@link ISystemChangeFilterPaneEditPaneSupplier}.
+ */
+ public SystemFilterStringEditPane getFilterStringEditPane(Shell shell)
+ {
+ // this method is called from SystemChangeFilterPane via callback
+ if (editPane == null)
+ editPane = new SystemFilterStringEditPane(shell);
+ return editPane;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemComboBoxFieldEditor.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemComboBoxFieldEditor.java
new file mode 100644
index 00000000000..dac346064f2
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemComboBoxFieldEditor.java
@@ -0,0 +1,497 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.propertypages;
+import java.util.ResourceBundle;
+import java.util.Vector;
+
+import org.eclipse.jface.preference.FieldEditor;
+import org.eclipse.rse.ui.ISystemMassager;
+import org.eclipse.rse.ui.SystemWidgetHelpers;
+import org.eclipse.rse.ui.validators.ISystemValidator;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.FocusAdapter;
+import org.eclipse.swt.events.FocusEvent;
+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.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Widget;
+
+
+/**
+ * For string properties that have a discrete list of possibilities.
+ */
+public class SystemComboBoxFieldEditor extends FieldEditor
+{
+
+ private Combo textField;
+ private String[] contentArray;
+ private boolean contentInited = false;
+ private boolean readOnly = true;
+ private boolean isValid = true;
+ private String tip;
+ private SelectionListener selectionListener = null;
+ private ModifyListener modifyListener = null;
+ private boolean ignoreSelection = false;
+ private ISystemValidator validator = null;
+ private ISystemMassager massager = null;
+ private Composite parentComposite;
+ private String oldValue;
+ private int numColumnsInParentComposite;
+
+
+ /**
+ * Constructor for SystemComboBoxFieldEditor
+ */
+ private SystemComboBoxFieldEditor()
+ {
+ super();
+ }
+
+ /**
+ * Constructor for SystemComboBoxFieldEditor, using a Vector for the contents
+ * @param name - the unique ID for this editor. Used as index in preference store
+ * @param labelText - the label to show as the prompt preceding the dropdown
+ * @param contents - the list of strings to show in the dropdown, as a vector
+ * @param readOnly - true if the user is to be prevented from entering text into the combo
+ * @param parent - the parent composite to host this editor
+ */
+ public SystemComboBoxFieldEditor(String name, String labelText, Vector contents, boolean readOnly, Composite parent)
+ {
+ super(name, labelText, parent);
+ this.readOnly = readOnly;
+ this.oldValue = "";
+ contentArray = new String[contents.size()];
+ for (int idx=0; idxIPreferencePage
method returns true
+ * if the page is valid.
+ *
+ * Specify an edit pane that prompts the user for the contents of a filter string.
+ */
+ public void setFilterStringEditPane(SystemFilterStringEditPane editPane)
+ {
+ this.editPane = editPane;
+ }
+ /**
+ * Configuration method
+ * Set the contextual system filter pool reference manager provider. Will be non-null if the
+ * current selection is a reference to a filter pool or filter, or a reference manager
+ * provider itself (eg subsystem)
+ *
+ * Set the contextual system filter pool manager provider. Will be non-null if the
+ * current selection is a filter pool or filter or reference to either, or a manager
+ * provider itself (eg subsystemconfiguration)
+ *
+ * Call this to specify a validator for the filter string. It will be called per keystroke.
+ * A default validator is supplied otherwise: ValidatorFilterString.
+ *
+ * Set the error message to use when the user is editing or creating a filter string, and the
+ * Apply processing detects a duplicate filter string in the list.
+ */
+ public void setDuplicateFilterStringErrorMessage(SystemMessage msg)
+ {
+ dupeFilterStringMessage = msg;
+ }
+ /**
+ * Set if the edit pane is not to be editable
+ */
+ public void setEditable(boolean editable)
+ {
+ editable = false;
+ }
+
+ // lifecyle methods...
+
+ /**
+ * Create the page's GUI contents.
+ * @see org.eclipse.jface.preference.PreferencePage#createContents(Composite)
+ */
+ protected Control createContentArea(Composite parent)
+ {
+ // Inner composite
+ composite_prompts = SystemWidgetHelpers.createComposite(parent, 2);
+
+ // Type display
+ labelType = createLabeledLabel(composite_prompts, SystemResources.RESID_PP_PROPERTIES_TYPE_LABEL, SystemResources.RESID_PP_PROPERTIES_TYPE_TOOLTIP);
+ labelType.setText(SystemResources.RESID_PP_FILTERSTRING_TYPE_VALUE);
+
+ // String display
+ //labelString = createLabeledLabel(composite_prompts, SystemResources.RESID_PP_FILTERSTRING_STRING_ROOT);
+
+ // Parent Filter display
+ labelFilter = createLabeledLabel(composite_prompts, SystemResources.RESID_PP_FILTERSTRING_FILTER_LABEL, SystemResources.RESID_PP_FILTERSTRING_FILTER_TOOLTIP);
+
+ // Parent Filter Pool display
+ labelFilterPool = createLabeledLabel(composite_prompts, SystemResources.RESID_PP_FILTERSTRING_FILTERPOOL_LABEL, SystemResources.RESID_PP_FILTERSTRING_FILTERPOOL_TOOLTIP);
+
+ // Parent Profile display
+ labelProfile = createLabeledLabel(composite_prompts, SystemResources.RESID_PP_FILTERSTRING_PROFILE_LABEL, SystemResources.RESID_PP_FILTERSTRING_PROFILE_TOOLTIP);
+
+ if (!initDone)
+ doInitializeFields();
+
+ return composite_prompts;
+ }
+ /**
+ * From parent: do full page validation
+ */
+ protected boolean verifyPageContents()
+ {
+ boolean ok = false;
+ clearErrorMessage();
+ errorMessage = editPane.verify();
+ if (errorMessage == null)
+ {
+ ok = true;
+ String editedFilterString = editPane.getFilterString();
+ if (filterStringValidator != null)
+ {
+ errorMessage = filterStringValidator.validate(editedFilterString);
+ }
+ }
+ if (errorMessage != null)
+ {
+ ok = false;
+ setErrorMessage(errorMessage);
+ }
+ //System.out.println("Inside verifyPageContents. errorMessage = "+errorMessage);
+ return ok;
+ }
+
+ /**
+ * Get the input filter string object
+ */
+ protected ISystemFilterString getFilterString()
+ {
+ Object element = getElement();
+ return ((ISystemFilterString)element);
+ }
+
+ /**
+ * Initialize values of input fields based on input
+ */
+ protected void doInitializeFields()
+ {
+ initDone = true;
+ ISystemFilterString filterstring = getFilterString();
+ ISystemFilter filter = filterstring.getParentSystemFilter();
+ // string
+ //labelString.setText(filterstring.getString());
+ // filter
+ labelFilter.setText(filter.getName());
+ // pool
+ ISystemFilterPool pool = filter.getParentFilterPool();
+ labelFilterPool.setText(pool.getName());
+ // profile
+ ISubSystemConfiguration ssFactory = (ISubSystemConfiguration)(pool.getProvider());
+ String profileName = ssFactory.getSystemProfile(pool).getName();
+ labelProfile.setText( profileName );
+
+ // edit pane
+ ISubSystemConfiguration factory = (ISubSystemConfiguration)filter.getProvider();
+ ISubsystemConfigurationAdapter adapter = (ISubsystemConfigurationAdapter)factory.getAdapter(ISubsystemConfigurationAdapter.class);
+ adapter.customizeFilterStringPropertyPage(factory, this, filterstring, getShell());
+ if (editPane == null)
+ {
+ Shell shell = getShell();
+ //System.out.println("Shell is: "+shell);
+ editPane = new SystemFilterStringEditPane(shell);
+ }
+ editPane.setSystemFilterPoolManagerProvider(filter.getProvider());
+ editPane.setChangeFilterMode(true);
+ editPane.addChangeListener(this);
+ Control editPaneComposite = editPane.createContents(composite_prompts);
+ ((GridData)editPaneComposite.getLayoutData()).horizontalSpan = 2;
+
+ editPane.setFilterString(filterstring.getString(), 0);
+ if (!editable || filter.isNonChangable())
+ editPaneComposite.setEnabled(false);
+ else if (filterStringValidator == null)
+ {
+ Vector existingStrings = filter.getFilterStringsVector();
+ existingStrings.remove(filterstring);
+ filterStringValidator = new ValidatorFilterString(existingStrings, filter.isStringsCaseSensitive());
+ if (dupeFilterStringMessage != null)
+ ((ValidatorFilterString)filterStringValidator).setDuplicateFilterStringErrorMessage(dupeFilterStringMessage);
+ }
+ }
+
+ /**
+ * Called by parent when user presses OK
+ */
+ public boolean performOk()
+ {
+ boolean ok = super.performOk();
+ if (!ok)
+ return false;
+ ISystemFilterString filterstring = getFilterString();
+ ISystemFilter filter = filterstring.getParentSystemFilter();
+ ISystemFilterPool pool = filter.getParentFilterPool(); // recurses for nested filter
+ ISystemFilterPoolManager mgr = pool.getSystemFilterPoolManager();
+ try
+ {
+ mgr.updateSystemFilterString(filterstring, editPane.getFilterString());
+ }
+ catch (SystemMessageException e)
+ {
+ SystemBasePlugin.logError("Error updating filter string from property page", e);
+ e.printStackTrace();
+ SystemMessageDialog.displayMessage(getShell(), e);
+ ok = false;
+ }
+ catch (Exception e)
+ {
+ SystemBasePlugin.logError("Error updating filter string from property page", e);
+ e.printStackTrace();
+ SystemMessageDialog.displayExceptionMessage(getShell(), e);
+ ok = false;
+ }
+
+ /*
+ String[] listItems = listView.getItems();
+ String[] filterStrings = new String[listItems.length - 1];
+ for (int idx=0; idxISystemValidator
object.
+ * If the ISystemValidator
reports an error the error message is displayed
+ * in the PreferencePage's message line.
+ * @see #setValueValidator(ISystemValidator)
+ */
+ protected SystemMessage validateValueInput()
+ {
+ errorMessage= null;
+ String valueInput = valueField.getText().trim();
+ if (valueValidator != null)
+ errorMessage = valueValidator.validate(valueInput);
+ else if (defaultValueValidator != null)
+ errorMessage = defaultValueValidator.validate(valueInput);
+ if (errorMessage != null)
+ showErrorMessage(errorMessage.getLevelOneText());
+ else
+ clearErrorMessage();
+ setButton.setEnabled((errorMessage == null) && (valueInput.length()>0));
+ //clearButton.setEnabled(true);
+ return errorMessage;
+ }
+
+ /**
+ * Notifies that the Set button has been pressed.
+ */
+ private void setPressed()
+ {
+ setPresentsDefaultValue(false);
+ int index = keysField.getSelectionIndex();
+ if (index >= 0)
+ {
+ String value = valueField.getText().trim();
+ valueField.setText(value);
+ if (value.length() == 0)
+ keyValues.remove(contentArray[index]);
+ else
+ keyValues.put(contentArray[index],value);
+ selectionChanged();
+ }
+ else
+ setButton.setEnabled(false);
+ }
+
+ /**
+ * Notifies that the Clear button has been pressed.
+ */
+ private void clearPressed()
+ {
+ setPresentsDefaultValue(false);
+ int index = keysField.getSelectionIndex();
+ if (index >= 0)
+ {
+ //valueField.setText("");
+ keyValues.remove(contentArray[index]);
+ selectionChanged();
+ }
+ else
+ clearButton.setEnabled(false);
+ }
+ /**
+ * Notifies that the list selection has changed.
+ */
+ private void selectionChanged()
+ {
+ int index = keysField.getSelectionIndex();
+ if (index >= 0)
+ {
+ String key = contentArray[index];
+ String value = (String)keyValues.get(key);
+ if (value == null)
+ {
+ valueField.setText("");
+ clearButton.setEnabled(false);
+ }
+ else
+ {
+ valueField.setText(value);
+ clearButton.setEnabled(true);
+ }
+ }
+ else
+ {
+ clearButton.setEnabled(false);
+ }
+ setButton.setEnabled(false);
+ }
+
+ /**
+ * Change the height hint for this composite.
+ * Default is 100 pixels.
+ */
+ public void setHeightHint(int hint)
+ {
+ if (keysComposite != null)
+ ((GridData)keysComposite.getLayoutData()).heightHint = hint;
+ if (valueComposite != null)
+ ((GridData)valueComposite.getLayoutData()).heightHint = hint;
+
+ }
+ /**
+ * Change the width hint for the keys list
+ * Default is 150 pixels.
+ */
+ public void setKeysWidthHint(int hint)
+ {
+ if (keysComposite != null)
+ ((GridData)keysComposite.getLayoutData()).widthHint = hint;
+ }
+ /**
+ * Change the width hint for the values fields on the right
+ * Default is not set
+ */
+ public void setValuesWidthHint(int hint)
+ {
+ if (valueComposite != null)
+ ((GridData)valueComposite.getLayoutData()).widthHint = hint;
+ }
+
+ /**
+ * Set the tooltip text
+ */
+ public void setToolTipText(String tip)
+ {
+ if (boxFlavor)
+ boxComposite.setToolTipText(tip);
+ else
+ {
+ keysComposite.setToolTipText(tip);
+ valueComposite.setToolTipText(tip);
+ }
+ }
+ /**
+ * Get the tooltip text
+ */
+ public String getToolTipText()
+ {
+ if (boxFlavor)
+ return boxComposite.getToolTipText();
+ else
+ return keysComposite.getToolTipText();
+ }
+
+ /*
+ * Override to return null!
+ *
+ public Label getLabelControl(Composite parent)
+ {
+ System.out.println("Inside getLabelControl");
+ return super.getLabelControl(parent);
+ }*/
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemLoggingPreferencePage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemLoggingPreferencePage.java
new file mode 100644
index 00000000000..f328db9fcf4
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemLoggingPreferencePage.java
@@ -0,0 +1,35 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.propertypages;
+
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.logging.LoggingPreferencePage;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * The logging preference page for Remote Systems.
+ */
+public class SystemLoggingPreferencePage extends LoggingPreferencePage {
+
+ /**
+ * @see com.ibm.etools.systems.logging.LoggingPreferencePage#getPlugin()
+ */
+ protected AbstractUIPlugin getPlugin() {
+ return SystemPlugin.getDefault();
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemPreferenceInitializer.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemPreferenceInitializer.java
new file mode 100644
index 00000000000..341ffa27406
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemPreferenceInitializer.java
@@ -0,0 +1,41 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.propertypages;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.rse.core.SystemPlugin;
+
+
+/**
+ * This class initializes the preferences for this plugin.
+ */
+public class SystemPreferenceInitializer extends AbstractPreferenceInitializer {
+
+ /**
+ * Constructor.
+ */
+ public SystemPreferenceInitializer() {
+ super();
+ }
+
+ /**
+ * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
+ */
+ public void initializeDefaultPreferences() {
+ SystemPlugin.getDefault().initializeDefaultPreferences();
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemRemotePropertyPageNode.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemRemotePropertyPageNode.java
new file mode 100644
index 00000000000..945bd1680e2
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemRemotePropertyPageNode.java
@@ -0,0 +1,90 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.propertypages;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.preference.PreferenceNode;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.rse.core.SystemPropertyPageExtension;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IWorkbenchPropertyPage;
+
+
+/**
+ * Our version of PropertyPageNode that does not require a RegistryPageContributor input.
+ */
+public class SystemRemotePropertyPageNode extends PreferenceNode
+{
+
+ private SystemPropertyPageExtension contributor;
+ private IWorkbenchPropertyPage page;
+ private Image icon;
+ private IAdaptable element;
+ /**
+ * Constructor.
+ */
+ public SystemRemotePropertyPageNode(SystemPropertyPageExtension contributor, IAdaptable element)
+ {
+ super(contributor.getId());
+ this.contributor = contributor;
+ this.element = element;
+ }
+ /**
+ * Creates the preference page this node stands for. If the page is null,
+ * it will be created by loading the class. If loading fails,
+ * empty filler page will be created instead.
+ */
+ public void createPage()
+ {
+ page = contributor.createPage(element);
+ setPage(page);
+ }
+ /** (non-Javadoc)
+ * Method declared on IPreferenceNode.
+ */
+ public void disposeResources()
+ {
+ page = null;
+ if (icon != null)
+ {
+ icon.dispose();
+ icon = null;
+ }
+ }
+ /**
+ * Returns page icon, if defined.
+ */
+ public Image getLabelImage()
+ {
+ if (icon==null)
+ {
+ ImageDescriptor desc = contributor.getImage();
+ if (desc != null)
+ {
+ icon = desc.createImage();
+ }
+ }
+ return icon;
+ }
+ /**
+ * Returns page label as defined in the registry.
+ */
+ public String getLabelText()
+ {
+ return contributor.getName();
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemStringFieldEditor.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemStringFieldEditor.java
new file mode 100644
index 00000000000..79bbcd72c0f
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemStringFieldEditor.java
@@ -0,0 +1,371 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.propertypages;
+import java.util.ResourceBundle;
+
+import org.eclipse.jface.preference.FieldEditor;
+import org.eclipse.rse.ui.ISystemMassager;
+import org.eclipse.rse.ui.SystemWidgetHelpers;
+import org.eclipse.rse.ui.validators.ISystemValidator;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.FocusAdapter;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.Widget;
+
+
+/**
+ * A preference page field editor that prompts for a string.
+ * Unlike the eclipse-supplied StringFieldEditor, this one allows
+ * use of RSE validators and massagers for error checking and
+ * massaging of the user-entered input prior to persisting.
+ */
+public class SystemStringFieldEditor extends FieldEditor
+{
+
+ private Text textField;
+ private String tip;
+ private boolean isValid = true;
+ private ModifyListener modifyListener = null;
+ private boolean ignoreSelection = false;
+ private ISystemValidator validator = null;
+ private ISystemMassager massager = null;
+ private Composite parentComposite;
+ private String oldValue;
+ private int numColumnsInParentComposite;
+
+
+ /**
+ * Default constructor for SystemStringFieldEditor.
+ * Not permitted to be used.
+ */
+ private SystemStringFieldEditor()
+ {
+ super();
+ }
+
+ /**
+ * Constructor for SystemStringFieldEditor
+ * @param name - the unique ID for this editor. Used as index in preference store
+ * @param rb - the resource bundle from which to retrieve the mri
+ * @param rbKey - the key into the resource bundle, to get the label (_LABEL and tooltip text (_TOOLTIP
+ * @param parent - the parent composite to host this editor
+ */
+ public SystemStringFieldEditor(String name, ResourceBundle rb, String rbKey, Composite parent)
+ {
+ super(name, rb.getString(rbKey+"label"), parent);
+ this.oldValue = "";
+ //createControl(parent);
+ doOurFillIntoGrid();
+ setToolTipText(rb.getString(rbKey+"tooltip"));
+ }
+
+ /**
+ * Set the validator to use per keystroke. If not set, no validation is done
+ */
+ public void setValidator(ISystemValidator validator)
+ {
+ this.validator = validator;
+ if (textField != null)
+ textField.setTextLimit(validator.getMaximumNameLength());
+ }
+
+ /**
+ * Set the massager that is used to affect the user-entered text before
+ * saving it to the preference store.
+ */
+ public void setMassager(ISystemMassager massager)
+ {
+ this.massager = massager;
+ }
+
+ /**
+ * Return number of columns we need. We return 2.
+ * @see org.eclipse.jface.preference.FieldEditor#getNumberOfControls()
+ */
+ public int getNumberOfControls()
+ {
+ return 2;
+ }
+
+ /**
+ * Save the user-entered value to the preference store.
+ * @see org.eclipse.jface.preference.FieldEditor#doStore()
+ */
+ protected void doStore()
+ {
+ String text = textField.getText();
+ if (massager != null)
+ {
+ text = massager.massage(text);
+ ignoreSelection = true;
+ textField.setText(text);
+ ignoreSelection = false;
+ }
+ getPreferenceStore().setValue(getPreferenceName(), text);
+ }
+
+ /**
+ * Load the entry field contents from the preference store default value
+ * @see org.eclipse.jface.preference.FieldEditor#doLoadDefault()
+ */
+ protected void doLoadDefault()
+ {
+ if (textField != null)
+ {
+ String value = getPreferenceStore().getDefaultString(getPreferenceName());
+ initSelection(value);
+ }
+ }
+
+ /**
+ * Load the entry field contents from the preference store current value
+ * @see org.eclipse.jface.preference.FieldEditor#doLoad()
+ */
+ protected void doLoad()
+ {
+ if (textField != null)
+ {
+ String value = getPreferenceStore().getString(getPreferenceName());
+ initSelection(value);
+ }
+ }
+
+ private void initSelection(String value)
+ {
+ if (value != null)
+ {
+ ignoreSelection = true;
+ textField.setText(value);
+ oldValue = value;
+ ignoreSelection = false;
+ }
+ else
+ oldValue = "";
+ }
+
+ /**
+ * This is called by our parent's constructor, which is too soon for us!
+ * So, we do nothing here and then call doOurFillIntoGrid later within our own
+ * constructor.
+ * @see org.eclipse.jface.preference.FieldEditor#doFillIntoGrid(Composite, int)
+ */
+ protected void doFillIntoGrid(Composite parent, int numColumns)
+ {
+ parentComposite = parent;
+ numColumnsInParentComposite = numColumns;
+ }
+
+ /**
+ * Create controls
+ */
+ protected void doOurFillIntoGrid()
+ {
+ getLabelControl(parentComposite);
+
+ textField = getTextControl(parentComposite);
+ GridData gd = (GridData)textField.getLayoutData();
+ gd.horizontalSpan = numColumnsInParentComposite - 1;
+ gd.horizontalAlignment = GridData.FILL;
+ gd.grabExcessHorizontalSpace = true;
+ textField.setLayoutData(gd);
+ }
+
+ /**
+ * Adjust grid data to support the number of columns, after all field editors
+ * have been added to the page.
+ *
+ * @see org.eclipse.jface.preference.FieldEditor#adjustForNumColumns(int)
+ */
+ protected void adjustForNumColumns(int numColumns)
+ {
+ GridData gd = (GridData)textField.getLayoutData();
+ gd.horizontalSpan = numColumns - 1;
+ // We only grab excess space if we have to
+ // If another field editor has more columns then
+ // we assume it is setting the width.
+ gd.grabExcessHorizontalSpace = gd.horizontalSpan == 1;
+ }
+
+ /**
+ * Returns this field editor's Text control.
+ */
+ protected Text getTextControl()
+ {
+ return textField;
+ }
+
+ /**
+ * Returns this field editor's text control.
+ * VALUE
property) provided that the old and
+ * new values are different.
+ *
+ */
+ public SystemMessage validate(String text);
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ISystemValidatorUniqueString.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ISystemValidatorUniqueString.java
new file mode 100644
index 00000000000..d6cbc438ad5
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ISystemValidatorUniqueString.java
@@ -0,0 +1,45 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.validators;
+
+import java.util.Vector;
+
+/**
+ * This interface is implemented by any validator that
+ * does uniqueness checking. Allows common code that will set the
+ * list of string to check against.
+ */
+public interface ISystemValidatorUniqueString
+{
+
+ /**
+ * Reset whether this is a case-sensitive list or not
+ */
+ public void setCaseSensitive(boolean caseSensitive);
+ /**
+ * Reset the existing names list.
+ */
+ public void setExistingNamesList(String[] existingList);
+ /**
+ * Reset the existing names list.
+ */
+ public void setExistingNamesList(Vector existingList);
+ /**
+ * Return the existing names list. This will be a case-normalized and sorted list.
+ */
+ public String[] getExistingNamesList();
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/IValidatorRemoteSelection.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/IValidatorRemoteSelection.java
new file mode 100644
index 00000000000..6794660be4f
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/IValidatorRemoteSelection.java
@@ -0,0 +1,40 @@
+/********************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.validators;
+import org.eclipse.rse.model.IHost;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
+
+
+/**
+ * On remote selection dialogs, you can pass an implementation of this interface to validate that
+ * it is ok to enable the OK button when the user selects a remote object. If you return
+ * a SystemMessage, ok will be disabled and the message will be shown on the message line.
+ * Return a SystemMessage with blank in the first level text to disable OK without showing
+ * an error message.
+ *
+ * if (isValid(text) != null)
+ * msg = getSystemMessage();
+ *
+ */
+ public SystemMessage validate(String text)
+ {
+ if (isValid(text) != null)
+ return currentMessage;
+ else
+ return null;
+ }
+
+ /**
+ * If validation is true, you can call this to get the input as a number
+ */
+ public int getNumber()
+ {
+ return number;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorIntegerRangeInput.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorIntegerRangeInput.java
new file mode 100644
index 00000000000..8b3167509f6
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorIntegerRangeInput.java
@@ -0,0 +1,115 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.validators;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemMessages;
+
+
+/**
+ * For editable integer numbers that must be within a certain range to be valid
+ */
+public class ValidatorIntegerRangeInput extends ValidatorIntegerInput
+{
+ private int minRange, maxRange;
+ private int orgMinRange, orgMaxRange;
+ private Integer minRangeInt, maxRangeInt;
+ private SystemMessage msg_InvalidRange;
+
+ /**
+ * Constructor when an empty field is not allowed (will result in an error message)
+ * @param minRange - the lowest valid number
+ * @param maxRange - the highest valid number
+ */
+ public ValidatorIntegerRangeInput(int minRange, int maxRange)
+ {
+ this(minRange, maxRange, false);
+ }
+ /**
+ * Constructor when an empty field is allowed.
+ * @param minRange - the lowest valid number
+ * @param maxRange - the highest valid number
+ * @param allowBlank - true if blanks allowed, false if not
+ */
+ public ValidatorIntegerRangeInput(int minRange, int maxRange, boolean allowBlank)
+ {
+ super(SystemPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NUMBER_EMPTY),
+ SystemPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NUMBER_NOTVALID));
+ msg_InvalidRange = SystemPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NUMBER_OUTOFRANGE);
+ this.orgMinRange = minRange;
+ this.orgMaxRange = maxRange;
+ super.setBlankAllowed(allowBlank);
+ setRange(minRange, maxRange);
+ }
+
+ /**
+ * Reset the range
+ */
+ public void setRange(int minRange, int maxRange)
+ {
+ this.minRange = minRange;
+ this.maxRange = maxRange;
+ minRangeInt = new Integer(minRange);
+ maxRangeInt = new Integer(maxRange);
+ }
+ /**
+ * Restore the range originally specified in the constructor
+ */
+ public void restoreRange()
+ {
+ setRange(orgMinRange, orgMaxRange);
+ }
+ /**
+ * Set the error messages, overriding the defaults
+ */
+ public void setErrorMessages(SystemMessage emptyMsg, SystemMessage invalidMsg, SystemMessage outOfRangeMsg)
+ {
+ super.setErrorMessages(emptyMsg, invalidMsg);
+ msg_InvalidRange = outOfRangeMsg;
+ }
+
+ /**
+ * Return the max length for this name, or -1 if no max.
+ * We return a max length that just allows the largest number in the range to be set, plus the sign if negative
+ */
+ public int getMaximumNameLength()
+ {
+ int maxlen = Integer.toString(Math.abs(maxRange)).length();
+ if (maxRange < 0)
+ ++maxlen;
+ return maxlen;
+ }
+
+ /**
+ * Intercept of parent to also add range checking
+ */
+ public String isValid(String input)
+ {
+ String msg = super.isValid(input);
+ if ((msg == null) && (input != null) && (input.length()>0))
+ {
+ if ((number < minRange) || (number > maxRange))
+ {
+ currentMessage = msg_InvalidRange;
+ currentMessage.makeSubstitution(input, minRangeInt, maxRangeInt);
+ msg = currentMessage.getLevelOneText();
+ }
+ }
+ return msg;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorLocalPath.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorLocalPath.java
new file mode 100644
index 00000000000..0b57ba755d3
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorLocalPath.java
@@ -0,0 +1,95 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.validators;
+import java.io.File;
+import java.util.Vector;
+
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+
+
+/**
+ * This class is used in dialogs that prompt for a local directory path.
+ *
+ * The IInputValidator interface is used by jface's
+ * InputDialog class and numerous other platform and system classes.
+ */
+public class ValidatorLocalPath extends ValidatorPathName
+{
+
+
+ public static final boolean WINDOWS = System.getProperty("os.name").toLowerCase().indexOf("windows") >= 0;
+ public static final char SEPCHAR = File.separatorChar;
+
+ /**
+ * Constructor for ValidatorLocalPath
+ */
+ public ValidatorLocalPath(Vector existingNameList)
+ {
+ super(existingNameList);
+ }
+
+ /**
+ * Constructor for ValidatorLocalPath
+ */
+ public ValidatorLocalPath(String[] existingNameList)
+ {
+ super(existingNameList);
+ }
+
+ /**
+ * Constructor for ValidatorLocalPath
+ */
+ public ValidatorLocalPath()
+ {
+ super();
+ }
+
+ /**
+ * Validate each character.
+ * Override of parent method.
+ */
+ public SystemMessage isSyntaxOk(String newText)
+ {
+ SystemMessage msg = super.isSyntaxOk(newText);
+ if (msg == null)
+ {
+ boolean ok = true;
+ if (WINDOWS)
+ {
+ if (newText.length()<3)
+ ok = false;
+ else if (newText.charAt(1) != ':')
+ ok = false;
+ else if (newText.charAt(2) != SEPCHAR)
+ ok = false;
+ else if (!Character.isLetter(newText.charAt(0)))
+ ok = false;
+ }
+ else
+ {
+ if (newText.length()<1)
+ ok = false;
+ else if (newText.charAt(0) != SEPCHAR)
+ ok = false;
+ }
+ if (!ok)
+ msg = msg_Invalid;
+ }
+ return msg;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorLongInput.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorLongInput.java
new file mode 100644
index 00000000000..9cce9ba54f0
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorLongInput.java
@@ -0,0 +1,162 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.validators;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemMessages;
+
+
+
+/**
+ * For editable large numeric properties.
+ * Ensures only digits are entered.
+ */
+public class ValidatorLongInput implements ISystemValidator
+{
+ protected boolean allowBlank = false;
+ protected long number;
+ protected SystemMessage emptyMsg, invalidMsg, currentMessage;
+
+ /**
+ * Constructor to use when the default error messages are ok
+ * @see #setBlankAllowed(boolean)
+ */
+ public ValidatorLongInput()
+ {
+ this(SystemPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_ENTRY_EMPTY));
+ }
+ /**
+ * Constructor to use when wanting to specify the "value required" error message,
+ * but use the default for the "Value not valid" error message
+ * @see #setBlankAllowed(boolean)
+ */
+ public ValidatorLongInput(SystemMessage emptyMsg)
+ {
+ this(emptyMsg, SystemPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NOT_NUMERIC));
+ }
+ /**
+ * Constructor to use when wanting to specify both error messages
+ * @see #setBlankAllowed(boolean)
+ */
+ public ValidatorLongInput(SystemMessage emptyMsg, SystemMessage invalidMsg)
+ {
+ setErrorMessages(emptyMsg, invalidMsg);
+ }
+
+ /**
+ * Specify if an empty field is ok or not. The default is not, and will result in an error message.
+ */
+ public void setBlankAllowed(boolean allowBlank)
+ {
+ this.allowBlank = allowBlank;
+ }
+
+ /**
+ * Set the error messages, overriding the defaults
+ */
+ public void setErrorMessages(SystemMessage emptyMsg, SystemMessage invalidMsg)
+ {
+ this.emptyMsg = emptyMsg;
+ this.invalidMsg = invalidMsg;
+ }
+
+ // ---------------------------
+ // ISystemValidator methods...
+ // ---------------------------
+
+ /**
+ * @see org.eclipse.jface.viewers.ICellEditorValidator#isValid(java.lang.Object)
+ */
+ public String isValid(Object input)
+ {
+ currentMessage = null;
+ if (!(input instanceof String))
+ {
+ //return "Unknown input";
+ number = 1;
+ return null;
+ }
+ else
+ return isValid((String)input);
+ }
+ /**
+ * @see org.eclipse.jface.dialogs.IInputValidator#isValid(java.lang.String)
+ * @see #getSystemMessage()
+ */
+ public String isValid(String input)
+ {
+ currentMessage = null;
+ if ((input==null)||(input.length()==0))
+ {
+ if (!allowBlank)
+ currentMessage = emptyMsg;
+ }
+ else
+ {
+ try
+ {
+ number = Long.parseLong(input);
+ }
+ catch (NumberFormatException exc)
+ {
+ currentMessage = invalidMsg;
+ currentMessage.makeSubstitution(input);
+ }
+ }
+ return (currentMessage==null) ? null : currentMessage.getLevelOneText();
+ }
+
+ /**
+ * When isValid returns non-null, call this to get the SystemMessage object for the error
+ * versus the simple string message.
+ */
+ public SystemMessage getSystemMessage()
+ {
+ return currentMessage;
+ }
+
+ /**
+ * Return the max length for this name. For us, we return 20.
+ */
+ public int getMaximumNameLength()
+ {
+ return 20;
+ }
+
+ /**
+ * For convenience, this is a shortcut to calling:
+ *
+ * if (isValid(text) != null)
+ * msg = getSystemMessage();
+ *
+ */
+ public SystemMessage validate(String text)
+ {
+ if (isValid(text) != null)
+ return currentMessage;
+ else
+ return null;
+ }
+
+ /**
+ * If validation is true, you can call this to get the input as a number
+ */
+ public long getNumber()
+ {
+ return number;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorLongRangeInput.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorLongRangeInput.java
new file mode 100644
index 00000000000..def59e06d0a
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorLongRangeInput.java
@@ -0,0 +1,113 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.validators;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemMessages;
+
+
+/**
+ * For editable long numbers that must be within a certain range to be valid
+ */
+public class ValidatorLongRangeInput extends ValidatorLongInput
+{
+ private long minRange, maxRange;
+ private long orgMinRange, orgMaxRange;
+ private Long minRangeLong, maxRangeLong;
+ private SystemMessage msg_InvalidRange;
+
+ /**
+ * Constructor when an empty field is not allowed (will result in an error message)
+ * @param minRange - the lowest valid number
+ * @param maxRange - the highest valid number
+ */
+ public ValidatorLongRangeInput(long minRange, long maxRange)
+ {
+ this(minRange, maxRange, false);
+ }
+ /**
+ * Constructor when an empty field is allowed.
+ * @param minRange - the lowest valid number
+ * @param maxRange - the highest valid number
+ * @param allowBlank - true if blanks allowed, false if not
+ */
+ public ValidatorLongRangeInput(long minRange, long maxRange, boolean allowBlank)
+ {
+ super(SystemPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NUMBER_EMPTY),
+ SystemPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NUMBER_NOTVALID));
+ msg_InvalidRange = SystemPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NUMBER_OUTOFRANGE);
+ this.orgMinRange = minRange;
+ this.orgMaxRange = maxRange;
+ super.setBlankAllowed(allowBlank);
+ setRange(minRange, maxRange);
+ }
+
+ /**
+ * Reset the range
+ */
+ public void setRange(long minRange, long maxRange)
+ {
+ this.minRange = minRange;
+ this.maxRange = maxRange;
+ minRangeLong = new Long(minRange);
+ maxRangeLong = new Long(maxRange);
+ }
+ /**
+ * Restore the range originally specified in the constructor
+ */
+ public void restoreRange()
+ {
+ setRange(orgMinRange, orgMaxRange);
+ }
+ /**
+ * Set the error messages, overriding the defaults
+ */
+ public void setErrorMessages(SystemMessage emptyMsg, SystemMessage invalidMsg, SystemMessage outOfRangeMsg)
+ {
+ super.setErrorMessages(emptyMsg, invalidMsg);
+ msg_InvalidRange = outOfRangeMsg;
+ }
+ /**
+ * Return the max length for this name, or -1 if no max.
+ * We return a max length that just allows the largest number in the range to be set, plus the sign if negative
+ */
+ public int getMaximumNameLength()
+ {
+ int maxlen = Long.toString(Math.abs(maxRange)).length();
+ if (maxRange < 0)
+ ++maxlen;
+ return maxlen;
+ }
+ /**
+ * Intercept of parent to also add range checking
+ */
+ public String isValid(String input)
+ {
+ String msg = super.isValid(input);
+ if ((msg == null) && (input != null) && (input.length()>0))
+ {
+ if ((number < minRange) || (number > maxRange))
+ {
+ currentMessage = msg_InvalidRange;
+ currentMessage.makeSubstitution(input, minRangeLong, maxRangeLong);
+ msg = currentMessage.getLevelOneText();
+ }
+ }
+ return msg;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorPathName.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorPathName.java
new file mode 100644
index 00000000000..e4eb81942ea
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorPathName.java
@@ -0,0 +1,124 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.validators;
+import java.util.Vector;
+
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+
+
+/**
+ * This class is used in dialogs that prompt for a name that eventually needs to become a folder path.
+ * Simply checks for a few obviously bad characters.
+ *
+ * The IInputValidator interface is used by jface's
+ * InputDialog class and numerous other platform and system classes.
+ */
+public class ValidatorPathName
+ extends ValidatorUniqueString
+{
+
+ protected boolean fUnique;
+ protected SystemMessage msg_Invalid;
+ protected StringBuffer specialChars;
+ private int nbrSpecialChars;
+
+ /**
+ * Use this constructor when the name must be unique. Give the
+ * ctor a vector containing a list of existing names to compare against.
+ */
+ public ValidatorPathName(Vector existingNameList)
+ {
+ super(existingNameList, CASE_INSENSITIVE); // case insensitive uniqueness
+ init();
+ }
+ /**
+ * Use this constructor when the name must be unique. Give the
+ * ctor a string array of existing names to compare against.
+ */
+ public ValidatorPathName(String existingNameList[])
+ {
+ super(existingNameList, CASE_INSENSITIVE); // case sensitive uniqueness
+ init();
+ }
+
+ /**
+ * Use this constructor when the name need not be unique, and you just want
+ * the syntax checking.
+ */
+ public ValidatorPathName()
+ {
+ super(new String[0], CASE_INSENSITIVE);
+ init();
+ fUnique = false;
+ }
+
+ protected void init()
+ {
+ super.setErrorMessages(SystemPlugin.getPluginMessage(MSG_VALIDATE_PATH_EMPTY),
+ SystemPlugin.getPluginMessage(MSG_VALIDATE_PATH_NOTUNIQUE));
+ fUnique = true;
+ msg_Invalid = SystemPlugin.getPluginMessage(MSG_VALIDATE_PATH_NOTVALID);
+ specialChars = new StringBuffer("*?;'<>|");
+ nbrSpecialChars = specialChars.length();
+ }
+ /**
+ * Supply your own error message text. By default, messages from SystemPlugin resource bundle are used.
+ * @param error message when entry field is empty
+ * @param error message when value entered is not unique
+ * @param error message when syntax is not valid
+ */
+ public void setErrorMessages(SystemMessage msg_Empty, SystemMessage msg_NonUnique, SystemMessage msg_Invalid)
+ {
+ super.setErrorMessages(msg_Empty, msg_NonUnique);
+ this.msg_Invalid = msg_Invalid;
+ }
+
+ /**
+ * Validate each character.
+ * Override of parent method.
+ * Override yourself to refine the error checking.
+ */
+ public SystemMessage isSyntaxOk(String newText)
+ {
+ //IStatus rc = workspace.validatePath(newText, IResource.FOLDER);
+ //if (rc.getCode() != IStatus.OK)
+ //return msg_Invalid;
+ boolean ok = !containsSpecialCharacters(newText);
+ if (!ok)
+ return msg_Invalid;
+ return null;
+ }
+
+ protected boolean containsSpecialCharacters(String newText)
+ {
+ boolean contains = false;
+ int newLen = newText.length();
+ for (int idx=0; !contains && (idx
+ * if (isValid(text) != null)
+ * msg = getSystemMessage();
+ *
+ * if (isValid(text) != null)
+ * msg = getSystemMessage();
+ *
+ */
+ public SystemMessage validate(String text)
+ {
+ if (isValid(text) != null)
+ return currentMessage;
+ else
+ return null;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorSystemName.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorSystemName.java
new file mode 100644
index 00000000000..d2eb65f7433
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorSystemName.java
@@ -0,0 +1,119 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.validators;
+import java.util.Vector;
+
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+
+
+/**
+ * This class is used in dialogs that prompt for an alias name.
+ * The rules used are the same as for Java names, for simplicity.
+ * Depending on the constructor used, this will also check for duplicates.
+ *
+ * The IInputValidator interface is used by jface's
+ * InputDialog class and numerous other platform and system classes.
+ */
+public class ValidatorSystemName
+ extends ValidatorUniqueString
+{
+
+ //protected String[] existingNames;
+ protected boolean fUnique;
+ //protected String msg_Empty;
+ //protected String msg_NonUnique;
+ protected SystemMessage msg_Invalid;
+
+ /**
+ * Use this constructor when the name must be unique. Give the
+ * ctor a vector containing a list of existing names to compare against.
+ */
+ public ValidatorSystemName(Vector existingNameList)
+ {
+ super(existingNameList, true); // case sensitive uniqueness
+ super.setErrorMessages(SystemPlugin.getPluginMessage(MSG_VALIDATE_NAME_EMPTY),
+ SystemPlugin.getPluginMessage(MSG_VALIDATE_NAME_NOTUNIQUE));
+ fUnique = true;
+ msg_Invalid = SystemPlugin.getPluginMessage(MSG_VALIDATE_NAME_NOTVALID);
+ }
+ /**
+ * Use this constructor when the name must be unique. Give the
+ * ctor a string array of existing names to compare against.
+ */
+ public ValidatorSystemName(String existingNameList[])
+ {
+ super(existingNameList, true); // case sensitive uniqueness
+ super.setErrorMessages(SystemPlugin.getPluginMessage(MSG_VALIDATE_NAME_EMPTY),
+ SystemPlugin.getPluginMessage(MSG_VALIDATE_NAME_NOTUNIQUE));
+ fUnique = true;
+ msg_Invalid = SystemPlugin.getPluginMessage(MSG_VALIDATE_NAME_NOTVALID);
+ }
+
+ /**
+ * Use this constructor when the name need not be unique, and you just want
+ * the syntax checking.
+ */
+ public ValidatorSystemName()
+ {
+ super(new String[0], true);
+ super.setErrorMessages(SystemPlugin.getPluginMessage(MSG_VALIDATE_NAME_EMPTY),
+ SystemPlugin.getPluginMessage(MSG_VALIDATE_NAME_NOTUNIQUE));
+ fUnique = false;
+ msg_Invalid = SystemPlugin.getPluginMessage(MSG_VALIDATE_NAME_NOTVALID);
+ }
+ /**
+ * Supply your own error message text. By default, messages from SystemPlugin resource bundle are used.
+ * @param error message when entry field is empty
+ * @param error message when value entered is not unique
+ * @param error message when syntax is not valid
+ */
+ public void setErrorMessages(SystemMessage msg_Empty, SystemMessage msg_NonUnique, SystemMessage msg_Invalid)
+ {
+ super.setErrorMessages(msg_Empty, msg_NonUnique);
+ this.msg_Invalid = msg_Invalid;
+ }
+
+ public String toString()
+ {
+ return "SystemNameValidator class";
+ }
+
+ // -------------------
+ // Parent overrides...
+ // -------------------
+
+ /**
+ * Validate each character.
+ * Override of parent method.
+ * Override yourself to refine the error checking.
+ */
+ public SystemMessage isSyntaxOk(String newText)
+ {
+ char currChar = newText.charAt(0);
+ if (!Character.isJavaIdentifierStart(currChar))
+ return msg_Invalid;
+ for (int idx=1; idxnull
or a string of length zero indicates
+ * that the value is valid.
+ * Note this is called per keystroke, by the platform.
+ * @deprecated You should be using {@link #validate(String)} and SystemMessage objects
+ */
+ public String isValid(String newText)
+ {
+ currentMessage = null;
+ newText = newText.trim();
+ if (newText.length() == 0)
+ currentMessage = msg_Empty;
+ else
+ {
+ if (!caseSensitive && (existingList!=null))
+ {
+ if (newText.indexOf(QUOTE)!=-1)
+ newText = quotedToLowerCase(newText);
+ else
+ newText = newText.toLowerCase();
+ }
+ /*
+ if (!caseSensitive && (existingList!=null) && (Arrays.binarySearch(existingList,newText) >= 0))
+ return msg_NonUnique.getLevelOneText();
+ else if (caseSensitive && (existingList!=null) && (Arrays.binarySearch(existingList,newText) >= 0))
+ return msg_NonUnique.getLevelOneText();
+ */
+ if ((existingList!=null) && (Arrays.binarySearch(existingList,newText) >= 0))
+ currentMessage = msg_NonUnique;
+ else if (syntaxValidator!=null)
+ {
+ String msg = syntaxValidator.isValid(newText);
+ if (msg != null)
+ {
+ currentMessage = syntaxValidator.getSystemMessage();
+ if (currentMessage == null) // tsk, tsk
+ return msg;
+ }
+ }
+ else
+ currentMessage = isSyntaxOk(newText);
+ }
+ return (currentMessage == null) ? null : doMessageSubstitution(currentMessage, newText);
+ }
+
+ /**
+ * As required by ICellEditor
+ */
+ public String isValid(Object newValue)
+ {
+ if (newValue instanceof String)
+ return isValid((String)newValue);
+ else
+ {
+ currentMessage = null;
+ return null;
+ }
+ }
+
+ /**
+ * Return the max length for this name, or -1 if no max
+ */
+ public int getMaximumNameLength()
+ {
+ return -1;
+ }
+
+ /**
+ * When isValid returns non-null, call this to get the SystemMessage object for the error
+ * versus the simple string message.
+ */
+ public SystemMessage getSystemMessage()
+ {
+ return currentMessage;
+ }
+
+ /**
+ * For convenience, this is a shortcut to calling:
+ *
+ */
+ public SystemMessage validate(String text)
+ {
+ if (isValid(text) != null)
+ return currentMessage;
+ else
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUserActionCommand.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUserActionCommand.java
new file mode 100644
index 00000000000..0a14bf53b47
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUserActionCommand.java
@@ -0,0 +1,120 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.validators;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemMessages;
+
+
+/**
+ * This class is used to verify a user defined action's command
+ */
+public class ValidatorUserActionCommand
+ implements ISystemMessages, ISystemValidator
+{
+ public static final int MAX_UDACMD_LENGTH = 512; // max command for an action
+
+ protected SystemMessage emptyMsg, invalidMsg, currentMessage;
+
+ /**
+ * Constructor to use when wanting to specify the "value required" error message,
+ * but use the default for the "Value not valid" error message
+ */
+ public ValidatorUserActionCommand()
+ {
+ setErrorMessages(SystemPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_UDACMD_EMPTY),
+ SystemPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_UDACMD_NOTVALID));
+ }
+
+ /**
+ * Set the error messages, overriding the defaults
+ */
+ public void setErrorMessages(SystemMessage emptyMsg, SystemMessage invalidMsg)
+ {
+ this.emptyMsg = emptyMsg;
+ this.invalidMsg = invalidMsg;
+ }
+
+ // ---------------------------
+ // ISystemValidator methods...
+ // ---------------------------
+
+ /**
+ * @see org.eclipse.jface.viewers.ICellEditorValidator#isValid(java.lang.Object)
+ */
+ public String isValid(Object input)
+ {
+ currentMessage = null;
+ if (!(input instanceof String))
+ {
+ return null;
+ }
+ else
+ return isValid((String)input);
+ }
+ /**
+ * @see org.eclipse.jface.dialogs.IInputValidator#isValid(java.lang.String)
+ * @see #getSystemMessage()
+ */
+ public String isValid(String input)
+ {
+ currentMessage = null;
+ if ((input==null)||(input.length()==0))
+ {
+ currentMessage = emptyMsg;
+ }
+ else
+ {
+ if (input.length() > MAX_UDACMD_LENGTH)
+ currentMessage = invalidMsg;
+ }
+ return (currentMessage==null) ? null : currentMessage.getLevelOneText();
+ }
+
+ /**
+ * When isValid returns non-null, call this to get the SystemMessage object for the error
+ * versus the simple string message.
+ */
+ public SystemMessage getSystemMessage()
+ {
+ return currentMessage;
+ }
+
+ /**
+ * Return the max length for comments
+ */
+ public int getMaximumNameLength()
+ {
+ return MAX_UDACMD_LENGTH;
+ }
+
+ /**
+ * For convenience, this is a shortcut to calling:
+ *
+ * if (isValid(text) != null)
+ * msg = getSystemMessage();
+ *
+ */
+ public SystemMessage validate(String text)
+ {
+ if (isValid(text) != null)
+ return currentMessage;
+ else
+ return null;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUserActionComment.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUserActionComment.java
new file mode 100644
index 00000000000..ed05126303b
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUserActionComment.java
@@ -0,0 +1,120 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.validators;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemMessages;
+
+
+/**
+ * This class is used to verify a user defined action's comment
+ */
+public class ValidatorUserActionComment
+ implements ISystemMessages, ISystemValidator
+{
+ public static final int MAX_UDACMT_LENGTH = 256; // max comment for an action
+
+ protected SystemMessage emptyMsg, invalidMsg, currentMessage;
+
+ /**
+ * Constructor to use when wanting to specify the "value required" error message,
+ * but use the default for the "Value not valid" error message
+ */
+ public ValidatorUserActionComment()
+ {
+ setErrorMessages(SystemPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_UDACMT_EMPTY),
+ SystemPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_UDACMT_NOTVALID));
+ }
+
+ /**
+ * Set the error messages, overriding the defaults
+ */
+ public void setErrorMessages(SystemMessage emptyMsg, SystemMessage invalidMsg)
+ {
+ this.emptyMsg = emptyMsg;
+ this.invalidMsg = invalidMsg;
+ }
+
+ // ---------------------------
+ // ISystemValidator methods...
+ // ---------------------------
+
+ /**
+ * @see org.eclipse.jface.viewers.ICellEditorValidator#isValid(java.lang.Object)
+ */
+ public String isValid(Object input)
+ {
+ currentMessage = null;
+ if (!(input instanceof String))
+ {
+ return null;
+ }
+ else
+ return isValid((String)input);
+ }
+ /**
+ * @see org.eclipse.jface.dialogs.IInputValidator#isValid(java.lang.String)
+ * @see #getSystemMessage()
+ */
+ public String isValid(String input)
+ {
+ currentMessage = null;
+ if ((input==null)||(input.length()==0))
+ {
+ //currentMessage = emptyMsg;
+ }
+ else
+ {
+ if (input.length() > MAX_UDACMT_LENGTH)
+ currentMessage = invalidMsg;
+ }
+ return (currentMessage==null) ? null : currentMessage.getLevelOneText();
+ }
+
+ /**
+ * When isValid returns non-null, call this to get the SystemMessage object for the error
+ * versus the simple string message.
+ */
+ public SystemMessage getSystemMessage()
+ {
+ return currentMessage;
+ }
+
+ /**
+ * Return the max length for comments
+ */
+ public int getMaximumNameLength()
+ {
+ return MAX_UDACMT_LENGTH;
+ }
+
+ /**
+ * For convenience, this is a shortcut to calling:
+ *
+ * if (isValid(text) != null)
+ * msg = getSystemMessage();
+ *
+ */
+ public SystemMessage validate(String text)
+ {
+ if (isValid(text) != null)
+ return currentMessage;
+ else
+ return null;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUserActionName.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUserActionName.java
new file mode 100644
index 00000000000..8fbbcb7f1f2
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUserActionName.java
@@ -0,0 +1,133 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.validators;
+import java.util.Vector;
+
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemMessages;
+
+
+/**
+ * This class is used to verify a user defined action's name.
+ */
+public class ValidatorUserActionName extends ValidatorUniqueString
+ implements ISystemMessages, ISystemValidator
+{
+ public static final int MAX_UDANAME_LENGTH = 256; // max name for an action
+
+ protected boolean fUnique;
+ protected SystemMessage msg_Invalid;
+ protected IWorkspace workspace = ResourcesPlugin.getWorkspace();
+
+ /**
+ * Use this constructor when the name must be unique. Give the
+ * ctor a vector containing a list of existing names to compare against.
+ */
+ public ValidatorUserActionName(Vector existingNameList)
+ {
+ super(existingNameList, CASE_SENSITIVE); // case sensitive uniqueness
+ init();
+ }
+ /**
+ * Use this constructor when the name must be unique. Give the
+ * ctor a string array of existing names to compare against.
+ */
+ public ValidatorUserActionName(String existingNameList[])
+ {
+ super(existingNameList, CASE_SENSITIVE); // case sensitive uniqueness
+ init();
+ }
+
+ /**
+ * Use this constructor when the name need not be unique, and you just want
+ * the syntax checking.
+ */
+ public ValidatorUserActionName()
+ {
+ super(new String[0], CASE_SENSITIVE);
+ init();
+ }
+
+ private void init()
+ {
+ super.setErrorMessages(SystemPlugin.getPluginMessage(MSG_VALIDATE_UDANAME_EMPTY),
+ SystemPlugin.getPluginMessage(MSG_VALIDATE_UDANAME_NOTUNIQUE));
+ fUnique = true;
+ msg_Invalid = SystemPlugin.getPluginMessage(MSG_VALIDATE_UDANAME_NOTVALID);
+ }
+ /**
+ * Supply your own error message text. By default, messages from SystemPlugin resource bundle are used.
+ * @param error message when entry field is empty
+ * @param error message when value entered is not unique
+ * @param error message when syntax is not valid
+ */
+ public void setErrorMessages(SystemMessage msg_Empty, SystemMessage msg_NonUnique, SystemMessage msg_Invalid)
+ {
+ super.setErrorMessages(msg_Empty, msg_NonUnique);
+ this.msg_Invalid = msg_Invalid;
+ }
+
+ /**
+ * Overridable method for invalidate character check, beyond what this class offers
+ * @return true if valid, false if not
+ */
+ protected boolean checkForBadCharacters(String newText)
+ {
+ return ((newText.indexOf('&') == -1) && // causes problems in menu popup as its a mnemonic character
+ (newText.indexOf('@') == -1)); // defect 43950
+ }
+
+ public String toString()
+ {
+ return "UserActionNameValidator class";
+ }
+
+ // ---------------------------
+ // Parent Overrides...
+ // ---------------------------
+ /**
+ * Validate each character.
+ * Override of parent method.
+ * Override yourself to refine the error checking.
+ */
+ public SystemMessage isSyntaxOk(String newText)
+ {
+ if (newText.length() > getMaximumNameLength())
+ currentMessage = msg_Invalid;
+ else
+ currentMessage = checkForBadCharacters(newText) ? null: msg_Invalid;
+ return currentMessage;
+ }
+
+
+ // ---------------------------
+ // ISystemValidator methods...
+ // ---------------------------
+
+ /**
+ * Return the max length for folder names: 256
+ */
+ public int getMaximumNameLength()
+ {
+ return MAX_UDANAME_LENGTH;
+ }
+
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUserId.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUserId.java
new file mode 100644
index 00000000000..ca9074362f3
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUserId.java
@@ -0,0 +1,51 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.validators;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemMessages;
+
+
+/**
+ * This class is used in dialogs that prompt for a userId.
+ * This does very basic userId validation, just to ensure there are no problems when the
+ * user Id is saved in the preferences. This means restricting use of a couple special characters
+ * that would mess up the key/value processing of the preference data.
+ *
+ * The IInputValidator interface is used by jface's
+ * InputDialog class and numerous other platform and system classes.
+ */
+public class ValidatorUserId
+ extends ValidatorSpecialChar implements ISystemMessages
+{
+ /**
+ * Constructor
+ */
+ public ValidatorUserId(boolean isEmptyAllowed)
+ {
+ super("=;", isEmptyAllowed, SystemPlugin.getPluginMessage(MSG_VALIDATE_USERID_NOTVALID), SystemPlugin.getPluginMessage(MSG_VALIDATE_USERID_EMPTY));
+ }
+
+ /**
+ * We could do additional syntax checking here if we decide to.
+ * This method is called by parent class if all other error checking passes.
+ */
+ public SystemMessage isSyntaxOk(String newText)
+ {
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUserTypeName.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUserTypeName.java
new file mode 100644
index 00000000000..985c99e8b71
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUserTypeName.java
@@ -0,0 +1,106 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.validators;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemMessages;
+
+
+/**
+ * This class is used to verify a user defined type's name.
+ */
+public class ValidatorUserTypeName extends ValidatorUniqueString
+ implements ISystemMessages, ISystemValidator
+{
+ public static final int MAX_UDTNAME_LENGTH = 50; // max name for a file type
+
+ protected SystemMessage msg_Invalid;
+
+ /**
+ * Use this constructor when the name need not be unique, and you just want the syntax checking.
+ */
+ public ValidatorUserTypeName()
+ {
+ super(new String[0], CASE_INSENSITIVE);
+ init();
+ }
+
+ private void init()
+ {
+ super.setErrorMessages(SystemPlugin.getPluginMessage(MSG_VALIDATE_UDTNAME_EMPTY),
+ SystemPlugin.getPluginMessage(MSG_VALIDATE_UDTNAME_NOTUNIQUE));
+ msg_Invalid = SystemPlugin.getPluginMessage(MSG_VALIDATE_UDTNAME_NOTVALID);
+ }
+
+ /**
+ * Supply your own error message text. By default, messages from SystemPlugin resource bundle are used.
+ * @param error message when entry field is empty
+ * @param error message when value entered is not unique
+ * @param error message when syntax is not valid
+ */
+ public void setErrorMessages(SystemMessage msg_Empty, SystemMessage msg_NonUnique, SystemMessage msg_Invalid)
+ {
+ super.setErrorMessages(msg_Empty, msg_NonUnique);
+ this.msg_Invalid = msg_Invalid;
+ }
+
+ /**
+ * Overridable method for invalidate character check, beyond what this class offers
+ * @return true if valid, false if not
+ */
+ protected boolean checkForBadCharacters(String newText)
+ {
+ return true;
+ }
+
+ public String toString()
+ {
+ return "UserTypeNameValidator class";
+ }
+
+ // ---------------------------
+ // Parent Overrides...
+ // ---------------------------
+ /**
+ * Validate each character.
+ * Override of parent method.
+ * Override yourself to refine the error checking.
+ */
+ public SystemMessage isSyntaxOk(String newText)
+ {
+ if (newText.length() > getMaximumNameLength())
+ currentMessage = msg_Invalid;
+ else
+ currentMessage = checkForBadCharacters(newText) ? null: msg_Invalid;
+ return currentMessage;
+ }
+
+
+ // ---------------------------
+ // ISystemValidator methods...
+ // ---------------------------
+
+ /**
+ * Return the max length for folder names: 50
+ */
+ public int getMaximumNameLength()
+ {
+ return MAX_UDTNAME_LENGTH;
+ }
+
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUserTypeTypes.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUserTypeTypes.java
new file mode 100644
index 00000000000..848c4e71cc3
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUserTypeTypes.java
@@ -0,0 +1,120 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.validators;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemMessages;
+
+
+/**
+ * This class is used to verify a user defined action's comment
+ */
+public class ValidatorUserTypeTypes
+ implements ISystemMessages, ISystemValidator
+{
+ public static final int MAX_UDTTYPES_LENGTH = 512;
+
+ protected SystemMessage emptyMsg, invalidMsg, currentMessage;
+
+ /**
+ * Constructor to use when wanting to specify the "value required" error message,
+ * but use the default for the "Value not valid" error message
+ */
+ public ValidatorUserTypeTypes()
+ {
+ setErrorMessages(SystemPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_UDTTYPES_EMPTY),
+ SystemPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_UDTTYPES_NOTVALID));
+ }
+
+ /**
+ * Set the error messages, overriding the defaults
+ */
+ public void setErrorMessages(SystemMessage emptyMsg, SystemMessage invalidMsg)
+ {
+ this.emptyMsg = emptyMsg;
+ this.invalidMsg = invalidMsg;
+ }
+
+ // ---------------------------
+ // ISystemValidator methods...
+ // ---------------------------
+
+ /**
+ * @see org.eclipse.jface.viewers.ICellEditorValidator#isValid(java.lang.Object)
+ */
+ public String isValid(Object input)
+ {
+ currentMessage = null;
+ if (!(input instanceof String))
+ {
+ return null;
+ }
+ else
+ return isValid((String)input);
+ }
+ /**
+ * @see org.eclipse.jface.dialogs.IInputValidator#isValid(java.lang.String)
+ * @see #getSystemMessage()
+ */
+ public String isValid(String input)
+ {
+ currentMessage = null;
+ if ((input==null)||(input.length()==0))
+ {
+ currentMessage = emptyMsg;
+ }
+ else
+ {
+ if (input.length() > MAX_UDTTYPES_LENGTH)
+ currentMessage = invalidMsg;
+ }
+ return (currentMessage==null) ? null : currentMessage.getLevelOneText();
+ }
+
+ /**
+ * When isValid returns non-null, call this to get the SystemMessage object for the error
+ * versus the simple string message.
+ */
+ public SystemMessage getSystemMessage()
+ {
+ return currentMessage;
+ }
+
+ /**
+ * Return the max length for comments
+ */
+ public int getMaximumNameLength()
+ {
+ return MAX_UDTTYPES_LENGTH;
+ }
+
+ /**
+ * For convenience, this is a shortcut to calling:
+ *
+ * if (isValid(text) != null)
+ * msg = getSystemMessage();
+ *
+ */
+ public SystemMessage validate(String text)
+ {
+ if (isValid(text) != null)
+ return currentMessage;
+ else
+ return null;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/AbstractSystemRemoteAdapterFactory.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/AbstractSystemRemoteAdapterFactory.java
new file mode 100644
index 00000000000..e86fd21fb8a
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/AbstractSystemRemoteAdapterFactory.java
@@ -0,0 +1,47 @@
+/********************************************************************************
+ * Copyright (c) 2003, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.ui.IActionFilter;
+import org.eclipse.ui.model.IWorkbenchAdapter;
+import org.eclipse.ui.progress.IDeferredWorkbenchAdapter;
+import org.eclipse.ui.views.properties.IPropertySource;
+
+/**
+ * Abstraction of the work needed to create an adapter factory for an adapter
+ * that extends {@link AbstractSystemViewAdapter}.
+ */
+public abstract class AbstractSystemRemoteAdapterFactory implements IAdapterFactory
+{
+
+
+
+ /**
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(Object, Class)
+ */
+ public abstract Object getAdapter(Object adaptableObject, Class adapterType);
+
+ /**
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
+ */
+ public Class[] getAdapterList()
+ {
+ return new Class[] {ISystemViewElementAdapter.class, ISystemDragDropAdapter.class, ISystemRemoteElementAdapter.class,
+ IPropertySource.class, IWorkbenchAdapter.class, IActionFilter.class, IDeferredWorkbenchAdapter.class};
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/AbstractSystemViewAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/AbstractSystemViewAdapter.java
new file mode 100644
index 00000000000..d0816a29162
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/AbstractSystemViewAdapter.java
@@ -0,0 +1,1808 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.List;
+import java.util.ResourceBundle;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.rse.core.SystemAdapterHelpers;
+import org.eclipse.rse.core.SystemBasePlugin;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.internal.subsystems.AbstractResource;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
+import org.eclipse.rse.core.subsystems.util.ISubsystemConfigurationAdapter;
+import org.eclipse.rse.model.IHost;
+import org.eclipse.rse.model.ISystemMessageObject;
+import org.eclipse.rse.model.ISystemPromptableObject;
+import org.eclipse.rse.model.ISystemResourceSet;
+import org.eclipse.rse.model.SystemMessageObject;
+import org.eclipse.rse.model.SystemRemoteResourceSet;
+import org.eclipse.rse.model.SystemWorkspaceResourceSet;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.SystemMenuManager;
+import org.eclipse.rse.ui.SystemPropertyResources;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.actions.SystemDynamicPopupMenuExtensionManager;
+import org.eclipse.rse.ui.operations.Policy;
+import org.eclipse.rse.ui.operations.SystemFetchOperation;
+import org.eclipse.rse.ui.operations.SystemSchedulingRule;
+import org.eclipse.rse.ui.validators.ISystemValidator;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Item;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.swt.widgets.Widget;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.model.IWorkbenchAdapter;
+import org.eclipse.ui.progress.IDeferredWorkbenchAdapter;
+import org.eclipse.ui.progress.IElementCollector;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.eclipse.ui.views.properties.PropertyDescriptor;
+
+
+/**
+ * Base class for adapters needed for the SystemView viewer.
+ * It implements the ISystemViewElementAdapter interface.
+ * @see AbstractSystemRemoteAdapterFactory
+ */
+public abstract class AbstractSystemViewAdapter
+ implements ISystemViewElementAdapter, IPropertySource, ISystemPropertyConstants, IWorkbenchAdapter,
+ ISystemViewActionFilter, IDeferredWorkbenchAdapter
+{
+ //protected boolean isEditable = false;
+
+ protected String filterString = null;
+
+ /**
+ * Current viewer. Set by content provider
+ */
+ protected Viewer viewer = null;
+ /**
+ * Current input provider. Set by content provider
+ */
+ protected Object propertySourceInput = null;
+ /**
+ * Current shell, set by the content provider
+ */
+ protected Shell shell;
+ private ISystemViewInputProvider input;
+ private String xlatedYes = null;
+ private String xlatedNo = null;
+ private String xlatedTrue = null;
+ private String xlatedFalse = null;
+ private String xlatedNotApplicable = null;
+ private String xlatedNotAvailable = null;
+ /**
+ * For returning an empty list from getChildren: new Object[0]
+ */
+ protected Object[] emptyList = new Object[0];
+ /**
+ * For returning a msg object from getChildren. Will be an array with one item,
+ * one of nullObject, canceledObject or errorObject
+ */
+ protected Object[] msgList = new Object[1];
+ /**
+ * Frequently returned msg object from getChildren: "empty list"
+ */
+ protected SystemMessageObject nullObject = null;
+ /**
+ * Frequently returned msg object from getChildren: "operation canceled"
+ */
+ protected SystemMessageObject canceledObject = null;
+ /**
+ * Frequently returned msg object from getChildren: "operation ended in error"
+ */
+ protected SystemMessageObject errorObject = null;
+
+ /**
+ * Message substitution prefix: "&"
+ */
+ protected static final String MSG_SUB_PREFIX = "&";
+ /**
+ * Message substitution variable 1: "&1"
+ */
+ protected static final String MSG_SUB1 = MSG_SUB_PREFIX+"1";
+ /**
+ * Message substitution variable 2: "&2"
+ */
+ protected static final String MSG_SUB2 = MSG_SUB_PREFIX+"2";
+
+ /**
+ * Delimiter for each object's key in a memento, used to persist tree view expansion state: "///"
+ */
+ public static final String MEMENTO_DELIM = SystemViewPart.MEMENTO_DELIM;
+
+ /**
+ * A handy constant of "new String[0]"
+ */
+ protected static final String[] EMPTY_STRING_LIST = new String[0];
+
+ // -------------------
+ // default descriptors
+ // -------------------
+ private static PropertyDescriptor[] propertyDescriptorArray = null;
+
+ // DKM: temporary memory caching stuff - we should replace this with something
+ // more comprehensive later
+ /**
+ * A variable that can be used in getChildren to cache last returned results, if desired
+ */
+ protected Object[] _lastResults = null;
+ /**
+ * A variable that can be used to cache last selection, if desired
+ */
+ protected Object _lastSelected = null;
+
+ // ------------------------------------------------------------------
+ // Configuration methods, called by the label and content provider...
+ // ------------------------------------------------------------------
+
+ /**
+ * Configuration method. Typically called by content provider, viewer or action. Do not override.
+ * if (isValid(text) != null)
+ * msg = getSystemMessage();
+ *
+ * Set the viewer that is driving this adapter
+ * Called by label and content provider.
+ */
+ public void setViewer(Viewer viewer)
+ {
+ this.viewer = viewer;
+ }
+ /**
+ * Configuration method. Typically called by content provider, viewer or action. Do not override.
+ * Set the shell to be used by any method that requires it.
+ */
+ public void setShell(Shell shell)
+ {
+ this.shell = shell;
+ }
+ /**
+ * Configuration method. Typically called by content provider, viewer or action. Do not override.
+ * Set the input object used to populate the viewer with the roots.
+ * May be used by an adapter to retrieve context-sensitive information.
+ * This is set by the Label and Content providers that retrieve this adapter.
+ */
+ public void setInput(ISystemViewInputProvider input)
+ {
+ this.input = input;
+ }
+
+ // ------------------------------------------------------------------
+ // Getter methods, for use by subclasses and actions...
+ // ------------------------------------------------------------------
+
+ /**
+ * Getter method. Callable by subclasses. Do not override.
+ * Get the shell currently hosting the objects in this adapter
+ */
+ public Shell getShell()
+ {
+ if (shell == null || shell.isDisposed() || !shell.isVisible() || !shell.isEnabled())
+ {
+ // get a new shell
+ Shell[] shells = Display.getCurrent().getShells();
+ Shell lshell = null;
+ for (int i = 0; i < shells.length && lshell == null; i++)
+ {
+ if (!shells[i].isDisposed() && shells[i].isEnabled() && shells[i].isVisible())
+ {
+ lshell = shells[i];
+ }
+ }
+ if (lshell == null)
+ lshell = SystemBasePlugin.getActiveWorkbenchShell();
+ shell = lshell;
+ }
+ return shell;
+ }
+ /**
+ * Getter method. Callable by subclasses. Do not override.
+ * Return the current viewer, as set via setViewer or its deduced from the
+ * setInput input object if set. May be null so test it.
+ */
+ public Viewer getViewer()
+ {
+ if (viewer == null)
+ {
+ ISystemViewInputProvider ip = getInput();
+ if (ip != null)
+ {
+ return ip.getViewer();
+ }
+ else
+ {
+ IWorkbenchPart currentPart = SystemBasePlugin.getActiveWorkbenchWindow().getActivePage().getActivePart();
+ if (currentPart instanceof IRSEViewPart)
+ {
+ return ((IRSEViewPart)currentPart).getRSEViewer();
+ }
+ }
+
+ }
+ return viewer;
+ }
+ /**
+ * Getter method. Callable by subclasses. Do not override.
+ * Return the current viewer as an ISystemTree if it is one, or null otherwise
+ */
+ protected ISystemTree getCurrentTreeView()
+ {
+ Viewer v = getViewer();
+ if (v instanceof ISystemTree)
+ return (ISystemTree)v;
+ else
+ return null;
+ }
+
+ /**
+ * Getter method. Callable by subclasses. Do not override.
+ * Get the input object used to populate the viewer with the roots.
+ * May be used by an adapter to retrieve context-sensitive information.
+ */
+ public ISystemViewInputProvider getInput()
+ {
+ return input;
+ }
+
+ /**
+ * Overridable by subclasses. You should override if not using AbstractResource.
+ * Returns the subsystem that contains this object. By default, if the
+ * given element is instanceof {@link org.eclipse.rse.core.internal.subsystems.AbstractResource AbstractResource},
+ * it calls getSubSystem on it, else returns null.
+ */
+ public ISubSystem getSubSystem(Object element)
+ {
+ if (element instanceof AbstractResource)
+ return ((AbstractResource)element).getSubSystem();
+ else
+ return null;
+ }
+
+ /**
+ * Called by SystemView viewer. No need to override or call.
+ * Returns any framework-supplied remote object actions that should be contributed to the popup menu
+ * for the given selection list. This does nothing if this adapter does not implement ISystemViewRemoteElementAdapter,
+ * else it potentially adds menu items for "User Actions" and Compile", for example. It queries the subsystem
+ * factory of the selected objects to determine if these actions are appropriate to add.
+ *
+ * @param menu The menu to contribute actions to
+ * @param selection The window's current selection.
+ * @param shell of viewer calling this. Most dialogs require a shell.
+ * @param menuGroup recommended menu group to add actions to. If added to another group, you must be sure to create that group first.
+ */
+ public void addCommonRemoteActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup)
+ {
+ if (this instanceof ISystemRemoteElementAdapter)
+ {
+ ISystemRemoteElementAdapter rmtAdapter = (ISystemRemoteElementAdapter)this;
+ Object firstSelection = getFirstSelection(selection);
+ ISubSystem ss = rmtAdapter.getSubSystem(firstSelection);
+ if (ss != null)
+ {
+ ISubSystemConfiguration ssf = ss.getSubSystemConfiguration();
+ ISubsystemConfigurationAdapter adapter = (ISubsystemConfigurationAdapter)ssf.getAdapter(ISubsystemConfigurationAdapter.class);
+ adapter.addCommonRemoteActions(ssf, menu, selection, shell, menuGroup, ss);
+ }
+ }
+
+ }
+
+
+ /**
+ * Called by system viewers. No need to override or call.
+ * Contributes actions provided via the dynamicPopupMenuExtensions
extension point. Unlike
+ * addCommonRemoteActions(), these contributions are for any artifact in the RSE views and are contributed
+ * independently of subsystem factories.
+ *
+ * @param menu The menu to contribute actions to
+ * @param selection The window's current selection.
+ * @param shell of viewer calling this. Most dialogs require a shell.
+ * @param menuGroup recommended menu group to add actions to. If added to another group, you must be sure to create that group first.
+ */
+ public void addDynamicPopupMenuActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup)
+ {
+ // system view adapter menu extensions
+ // these extensions are independent of subsystem factories and are contributed via extension point
+ SystemDynamicPopupMenuExtensionManager.getInstance().populateMenu(shell, menu.getMenuManager(), selection, menuGroup);
+ }
+
+ /**
+ * This is your opportunity to add actions to the popup menu for the given selection.
+ *
+ *
+ *
+ * @param menu the popup menu you can contribute to
+ * @param selection the current selection in the calling tree or table view
+ * @param parent the shell of the calling tree or table view
+ * @param menuGroup the default menu group to place actions into if you don't care where they. Pass this to the SystemMenuManager {@link org.eclipse.rse.ui.SystemMenuManager#add(String,IAction) add} method.
+ *
+ * @see org.eclipse.rse.ui.view.ISystemViewElementAdapter#addActions(SystemMenuManager, IStructuredSelection, Shell, String)
+ */
+ public abstract void addActions(SystemMenuManager menu,IStructuredSelection selection,Shell parent,String menuGroup);
+
+ /**
+ * Abstract. Must be overridden by subclasses.
+ * IWorkbenchAdapter method. Returns an image descriptor for the image.
+ * More efficient than getting the image.
+ * @param element The element for which an image is desired
+ */
+ public abstract ImageDescriptor getImageDescriptor(Object element);
+
+
+ /**
+ * Abstract. Must be overridden by subclasses.
+ * Return the label for this object.
+ * @see #getName(Object)
+ * @see #getAbsoluteName(Object)
+ */
+ public abstract String getText(Object element);
+
+ /**
+ * Return the alternate label for this object. By default this
+ * just returns the regular label. If a custom label is required,
+ * this provides the means to it.
+ * @see #getName(Object)
+ * @see #getAbsoluteName(Object)
+ */
+ public String getAlternateText(Object element)
+ {
+ return getText(element);
+ }
+
+ /**
+ * Overridable by subclasses, but rarely needs to be.
+ * Return the name of this object, which may be different than the display text ({#link #getText(Object)}.
+ * By default, returns getText(element);, but child classes can override if display name doesn't equal real name.
+ *
.
+ * Return the fully-qualified name, versus just the displayable name, for this object.
+ * For remote objects, this should be sufficient to uniquely identify this object within its
+ * subsystem.
+ * @see #getText(Object)
+ * @see #getName(Object)
+ */
+ public abstract String getAbsoluteName(Object object);
+
+ /**
+ * Internal use. Can be safely ignored.
+ * Return the name for this object. Unique requirement for IWorkbenchAdapter.
+ * We map to getText(element).
+ */
+ public String getLabel(Object element)
+ {
+ return getText(element);
+ }
+
+ /**
+ * Abstract. Must be overridden by subclasses.
+ * Return the type label for this object.
+ */
+ public abstract String getType(Object element);
+
+ /**
+ * Overridable by subclasses, but rarely needs to be.
+ * Return the string to display in the status line when the given object is selected.
+ * The default is:
+ *
+ * getType(): getName()
+ *
+ */
+ public String getStatusLineText(Object element)
+ {
+ return getType(element) + ": " + getName(element);
+ }
+
+ /**
+ * Abstract. Must be overridden by subclasses.
+ * Return the parent of this object. This is required by eclipse UI adapters, but
+ * we try desperately not to use in the RSE. So, you are probably safe returning null,
+ * but if can return a parent, why not, go for it.
+ */
+ public abstract Object getParent(Object element);
+
+ /**
+ * Abstract. Must be overridden by subclasses.
+ * Return true if this object has children.
+ */
+ public abstract boolean hasChildren(Object element);
+
+ /**
+ * Abstract. Must be overridden by subclasses.
+ * Return the children of this object. Return null if children not supported.
+ */
+ public abstract Object[] getChildren(Object element);
+
+ /**
+ * This should be overridden by subclasses in order to provide
+ * deferred query support via the Eclipse Jobs mechanism
+ * Return the children of this object. Return null if children not supported.
+ */
+ public Object[] getChildren(IProgressMonitor monitor, Object element)
+ {
+ return getChildren(element);
+ }
+
+
+ /**
+ * Overridable by subclasses, but rarely needs to be.
+ * Return the children of this object, using the given Expand-To filter.
+ * By default, this calls getChildren(element). Override only if you support Expand-To menu actions.
+ */
+ public Object[] getChildrenUsingExpandToFilter(Object element, String expandToFilter)
+ {
+ return getChildren(element);
+ }
+
+ /**
+ * Callable by subclasses.
+ * Return the default descriptors for all system elements.
+ */
+ protected static IPropertyDescriptor[] getDefaultDescriptors()
+ {
+ if (propertyDescriptorArray == null)
+ {
+ propertyDescriptorArray = new PropertyDescriptor[3];
+ // The following determine what properties will be displayed in the PropertySheet
+ // resource type
+ int idx = 0;
+ propertyDescriptorArray[idx++] = createSimplePropertyDescriptor(P_TYPE, SystemPropertyResources.RESID_PROPERTY_TYPE_LABEL, SystemPropertyResources.RESID_PROPERTY_TYPE_TOOLTIP);
+ // resource name
+ propertyDescriptorArray[idx++] = createSimplePropertyDescriptor(P_TEXT, SystemPropertyResources.RESID_PROPERTY_NAME_LABEL, SystemPropertyResources.RESID_PROPERTY_NAME_TOOLTIP);
+ // number of children in tree currently
+ propertyDescriptorArray[idx++] = createSimplePropertyDescriptor(P_NBRCHILDREN, SystemViewResources.RESID_PROPERTY_NBRCHILDREN_LABEL, SystemViewResources.RESID_PROPERTY_NBRCHILDREN_TOOLTIP);
+
+ }
+ //System.out.println("In getDefaultDescriptors() in AbstractSystemViewAdapter");
+ return propertyDescriptorArray;
+ }
+
+ /**
+ * Callable by subclasses.
+ * Create and return a simple string readonly property descriptor.
+ * @param propertyKey Key for this property, sent back in getPropertyValue.
+ * @param label
+ * @param description
+ */
+ protected static PropertyDescriptor createSimplePropertyDescriptor(String propertyKey, String label, String description)
+ {
+ PropertyDescriptor pd = new PropertyDescriptor(propertyKey, label);
+ pd.setDescription(description);
+ return pd;
+ }
+
+
+ /**
+ * Needed by framework for property sheet. No need to call or override.
+ * Returns a value for this object that can be edited in a property sheet.
+ *
+ * @return a value that can be editted
+ */
+ public Object getEditableValue()
+ {
+ return this;
+ }
+ /**
+ * Implemented. Do not override typically. See {@link #internalGetPropertyDescriptors()}.
+ * Returns the property descriptors defining what properties are seen in the property sheet.
+ * By default returns descriptors for name, type and number-of-children only plus whatever
+ * is returned from internalGetPropertyDescriptors().
+ *
+ * @return an array containing all descriptors.
+ *
+ * @see #internalGetPropertyDescriptors()
+ */
+ public IPropertyDescriptor[] getPropertyDescriptors()
+ {
+ IPropertyDescriptor[] addl = internalGetPropertyDescriptors();
+ if ((addl == null) || (addl.length==0))
+ return getDefaultDescriptors();
+ else
+ {
+ IPropertyDescriptor[] defaults = getDefaultDescriptors();
+ IPropertyDescriptor[] all = new IPropertyDescriptor[defaults.length+addl.length];
+ int allIdx=0;
+ for (int idx=0; idx
+ * Implement this to return the property descriptors for the
+ * properties in the property sheet. This is beyond the Name, Type and NbrOfChildren
+ * properties which already implemented and done for you.
+ *
+ *
+ *
+ *
+ *
+ * @return an array containing all descriptors to be added to the default set of descriptors, or null
+ * if no additional properties desired.
+ * @see #createSimplePropertyDescriptor(String,ResourceBundle,String)
+ */
+ protected abstract IPropertyDescriptor[] internalGetPropertyDescriptors();
+
+
+ /**
+ * Callable by subclasses. Do not override.
+ * Returns the list of property descriptors that are unique for this
+ * particular adapter - that is the difference between the default
+ * property descriptors and the total list of property descriptors.
+ *
+ * Similar to getPropertyValue(Object key) but takes an argument
+ * for determining whether to return a raw value or formatted value.
+ *
+ * By default, simply calls getPropertyValue(key).
+ *
+ * Returns the current value for the named property.
+ * By default handles ISystemPropertyConstants.P_TEXT, P_TYPE and P_NBRCHILDREN only, then defers to {@link #internalGetPropertyValue(Object)} for
+ * subclasses.
+ *
Note: you will need to reference propertySourceInput
, which is the currently selected object. Just case it to what you expect the selected object's type to be.
+ *
+ * @param key the name of the property as named by its property descriptor
+ * @return the current value of the property
+ */
+ public Object getPropertyValue(Object key)
+ {
+ String name = (String)key;
+ if (name.equals(P_TEXT))
+ //return getText(propertySourceInput);
+ return getName(propertySourceInput);
+ else if (name.equals(P_TYPE))
+ return getType(propertySourceInput);
+ else if (name.equals(P_NBRCHILDREN))
+ {
+ ISystemTree tree = getSystemTree();
+ if (tree != null)
+ return Integer.toString(tree.getChildCount(propertySourceInput));
+ else
+ {
+ if ((viewer != null) && (viewer instanceof TreeViewer))
+ return Integer.toString(getChildCount((TreeViewer)viewer, propertySourceInput));
+ else
+ return "0";
+ }
+ }
+ else
+ return internalGetPropertyValue(key);
+ }
+ /**
+ * Abstract.
+ * Implement this to return the property descriptors for the
+ * properties in the property sheet. This is beyond the Name, Type and NbrOfChildren
+ * properties which already implemented and done for you.
+ *
+ * @param key the name of the property as named by its property descriptor
+ * @return the current value of the property or null if not a known property.
+ */
+ protected abstract Object internalGetPropertyValue(Object key);
+
+
+ /**
+ * Return the number of immediate children in the tree, for the given tree node
+ */
+ private int getChildCount(TreeViewer viewer, Object element)
+ {
+ if (viewer.getControl().isDisposed())
+ return 0;
+ if (viewer.getExpandedState(element) == false)
+ return 0;
+
+ Widget w = findItemInTree(viewer, element);
+ if (w != null)
+ {
+ if (w instanceof TreeItem)
+ return ((TreeItem)w).getItemCount();
+ else if (w instanceof Tree)
+ return ((Tree)w).getItemCount();
+ }
+ return 0;
+ }
+
+ private Widget findItemInTree(TreeViewer tree, Object element)
+ {
+ Item[] items = getChildren(tree.getControl());
+ if (items != null)
+ {
+ for (int i= 0; i < items.length; i++)
+ {
+ Widget o = internalFindItem(tree.getTree(), items[i], element);
+ if (o != null)
+ return o;
+ }
+ }
+ return null;
+ }
+
+ private Widget internalFindItem(Tree tree, Item parent, Object element)
+ {
+ // compare with node
+ Object data= parent.getData();
+ if (data != null)
+ {
+ if (data.equals(element))
+ return parent;
+ }
+ // recurse over children
+ Item[] items= getChildren(parent);
+ for (int i= 0; i < items.length; i++)
+ {
+ Item item= items[i];
+ Widget o = internalFindItem(tree, item, element);
+ if (o != null)
+ return o;
+ }
+ return null;
+ }
+ private Item[] getChildren(Widget o)
+ {
+ if (o instanceof TreeItem)
+ return ((TreeItem) o).getItems();
+ if (o instanceof Tree)
+ return ((Tree) o).getItems();
+ return null;
+ }
+
+
+ /**
+ * Overridable by subclasses. Must be iff editable properties are supported.
+ * Returns whether the property value has changed from the default.
+ * Only applicable for editable properties.
+ *
RETURNS FALSE BY DEFAULT.
+ * @return true
if the value of the specified property has changed
+ * from its original default value; false
otherwise.
+ */
+ public boolean isPropertySet(Object key)
+ {
+ return false;
+ }
+ /**
+ * Overridable by subclasses. Must be iff editable properties are supported.
+ * Resets the specified property's value to its default value.
+ * Called on editable property when user presses reset button in property sheet viewer.
+ * DOES NOTHING BY DEFAULT.
+ *
+ * @param key the key identifying property to reset
+ */
+ public void resetPropertyValue(Object key)
+ {
+ }
+ /**
+ * Overridable by subclasses. Must be iff editable properties are supported.
+ * Sets the named property to the given value.
+ * Called after an editable property is changed by the user.
+ *
+ * DOES NOTHING BY DEFAULT.
+ *
+ * @param key the key identifying property to reset
+ * @param value the new value for the property
+ */
+ public void setPropertyValue(Object key, Object value)
+ {
+ }
+
+ /**
+ * Called from adapter factories. Do not override.
+ * Set input object for property source queries. This must be called by your
+ * XXXAdaptorFactory before returning this adapter object.
+ */
+ public void setPropertySourceInput(Object propertySourceInput)
+ {
+ this.propertySourceInput = propertySourceInput;
+ }
+
+ /**
+ * Overridable by subclasses, but usually is not.
+ * User has double clicked on an object. If you want to do something special,
+ * do it and return true. Otherwise return false to have the viewer do the default behaviour.
+ */
+ public boolean handleDoubleClick(Object element)
+ {
+ return false;
+ }
+
+ // ------------------------------------------
+ // METHODS TO SUPPORT GLOBAL DELETE ACTION...
+ // ------------------------------------------
+
+ /**
+ * Overridable by subclasses, but usually is not.
+ * Return true if we should show the delete action in the popup for the given element.
+ * If true, then canDelete will be called to decide whether to enable delete or not.
+ *
+ * Return true if this object is deletable by the user. If so, when selected,
+ * the Edit->Delete menu item will be enabled.
+ *
+ * Perform the delete action. By default does nothing. Override if your object is deletable.
+ * Return true if this was successful. Return false if it failed and you issued a msg.
+ * Throw an exception if it failed and you want to use the generic msg.
+ * @see #showDelete(Object)
+ * @see #canDelete(Object)
+ */
+ public boolean doDelete(Shell shell, Object element, IProgressMonitor monitor) throws Exception
+ {
+ return doDelete(shell, element);
+ }
+
+ /**
+ * Overridable by subclasses, and usually is.
+ * Perform the delete action. By default just calls the doDelete method for each item in the resourceSet.
+ * Override if you wish to perform some sort of optimization for the batch delete.
+ * Return true if this was successful. Return false if ANY delete op failed and a msg was issued.
+ * Throw an exception if ANY failed and you want to use the generic msg.
+ */
+ public boolean doDeleteBatch(Shell shell, List resourceSet, IProgressMonitor monitor) throws Exception
+ {
+ boolean ok = true;
+ for (int i = 0; i < resourceSet.size(); i++)
+ {
+ ok = ok && doDelete(shell, resourceSet.get(i), monitor);
+ }
+ return ok;
+ }
+
+ /**
+ * Overridable by subclasses, and usually is.
+ * Perform the delete action. By default does nothing. Override if your object is deletable.
+ * Return true if this was successful. Return false if it failed and you issued a msg.
+ * Throw an exception if it failed and you want to use the generic msg.
+ * @see #showDelete(Object)
+ * @see #canDelete(Object)
+ * @deprecated use the one with the monitor
+ */
+ public boolean doDelete(Shell shell, Object element) throws Exception
+ {
+ return false;
+ }
+
+ // ------------------------------------------
+ // METHODS TO SUPPORT COMMON RENAME ACTION...
+ // ------------------------------------------
+
+ /**
+ * Overridable by subclasses, but usually is not.
+ * Return true if we should show the rename action in the popup for the given element.
+ * If true, then canRename will be called to decide whether to enable rename or not.
+ *
+ * Return true if this object is renamable by the user. If so, when selected,
+ * the Rename popup menu item will be enabled.
+ * By default, returns false. Override if your object is renamable.
+ * @return true if this object is renamable by the user
+ * @see #showRename(Object)
+ * @see #doRename(Shell,Object,String)
+ * @see #getNameValidator(Object)
+ * @see #getCanonicalNewName(Object,String)
+ * @see #namesAreEqual(Object,String)
+ */
+ public boolean canRename(Object element)
+ {
+ return false;
+ }
+
+ /**
+ * Overridable by subclasses, and usually is.
+ * Perform the rename action. By default does nothing. Override if your object is renamable.
+ * Return true if this was successful. Return false if it failed and you issued a msg.
+ * Throw an exception if it failed and you want to use the generic msg.
+ * @return true if the rename was successful
+ * @see #showRename(Object)
+ * @see #canRename(Object)
+ */
+ public boolean doRename(Shell shell, Object element, String name) throws Exception
+ {
+ //org.eclipse.rse.core.ui.SystemMessage.displayErrorMessage("INSIDE DORENAME");
+ return false;
+ }
+
+ /**
+ * Overridable by subclasses, and usually is iff canRename is.
+ * Return a validator for verifying the new name is correct.
+ * If you return null, no error checking is done on the new name in the common rename dialog!!
+ *
+ * Form and return a new canonical (unique) name for this object, given a candidate for the new
+ * name. This is called by the generic multi-rename dialog to test that all new names are unique.
+ * To do this right, sometimes more than the raw name itself is required to do uniqueness checking.
+ *
+ * Compare the name of the given element to the given new name to decide if they are equal.
+ * Allows adapters to consider case and quotes as appropriate.
+ *
+ * Return true if we should show the refresh action in the popup for the given element.
+ * Note the actual work to do the refresh is handled for you.
+ *
+ * Return true if we should show the Go Into; and Open In New Window
+ * and Go To actions in the popup for the given element.
+ *
+ * Return true if we should show the generic show in table action in the popup for the given element.
+ */
+ public boolean showGenericShowInTableAction(Object element)
+ {
+ return true;
+ }
+
+
+ // ------------------------------------------
+ // METHODS TO SUPPORT COMMON DRAG AND DROP FUNCTION...
+ // ------------------------------------------
+ /**
+ * Overridable by subclasses, and is iff drag and drop supported.
+ * Return true if this object can be copied to another location. By default,
+ * we return false. Extenders may decide whether or not
+ * certain objects can be dragged with this method.
+ * @see #doDrag(Object,boolean,IProgressMonitor)
+ * @see #canDrop(Object)
+ * @see #doDrop(Object,Object,boolean,boolean,IProgressMonitor)
+ * @see #validateDrop(Object,Object,boolean)
+ */
+ public boolean canDrag(Object element)
+ {
+ return false;
+ }
+
+ /**
+ * Overridable by subclasses, and is iff drag and drop supported.
+ * Return true if this object can be copied to another location. By default,
+ * we return false. Extenders may decide whether or not
+ * certain objects can be dragged with this method.
+ * Return true if these objects can be copied to another location via drag and drop, or clipboard copy.
+ */
+ public boolean canDrag(SystemRemoteResourceSet elements)
+ {
+ return false;
+ }
+
+ /**
+ * Overridable by subclasses, and is iff drag and drop supported.
+ * Perform the drag on the given object. By default this does nothing
+ * and returns nothing. Extenders supporting DnD are expected to implement
+ * this method to perform a copy to a temporary object, the return value.
+ * @see #canDrag(Object)
+ * @see #canDrop(Object)
+ * @see #doDrop(Object,Object,boolean,boolean,IProgressMonitor)
+ * @see #validateDrop(Object,Object,boolean)
+ */
+ public Object doDrag(Object element, boolean sameSystemType, IProgressMonitor monitor)
+ {
+ return null;
+ }
+
+ /**
+ * Overridable by subclasses, and is iff drag and drop supported.
+ * Return true if another object can be copied into this object. By default
+ * we return false. Extenders may decide whether or not certain objects can
+ * accept other objects with this method.
+ * @see #canDrag(Object)
+ * @see #doDrag(Object,boolean,IProgressMonitor)
+ * @see #doDrop(Object,Object,boolean,boolean,IProgressMonitor)
+ * @see #validateDrop(Object,Object,boolean)
+ */
+ public boolean canDrop(Object element)
+ {
+ return false;
+
+ }
+
+ /**
+ * Overridable by subclasses, and is iff drag and drop supported.
+ * Perform the drag on the given objects. This default implementation simply iterates through the
+ * set. For optimal performance, this should be overridden.
+ *
+ * @param set the set of objects to copy
+ * @param sameSystemType indication of whether the source and target reside on the same type of system
+ * @param monitor the progress monitor
+ * @return a temporary workspace copies of the object that was copied
+ *
+ */
+ public ISystemResourceSet doDrag(SystemRemoteResourceSet set, IProgressMonitor monitor)
+ {
+ SystemWorkspaceResourceSet results = new SystemWorkspaceResourceSet();
+ List resources = set.getResourceSet();
+ for (int i = 0; i < resources.size(); i++)
+ {
+ results.addResource(doDrag(resources.get(i), true, monitor));
+ }
+ return results;
+ }
+
+ /**
+ * Overridable by subclasses, and is iff drag and drop supported.
+ * Perform drop from the "fromSet" of objects to the "to" object
+ * @param from the source objects for the drop
+ * @param to the target object for the drop
+ * @param sameSystemType indication of whether the source and target reside of the same type of system
+ * @param sameSystem indication of whether the source and target are on the same system
+ * @param srcType the type of objects to be dropped
+ * @param monitor the progress monitor
+ *
+ * @return the set of new objects created from the drop
+ *
+ */
+ public ISystemResourceSet doDrop(ISystemResourceSet fromSet, Object to, boolean sameSystemType, boolean sameSystem, int srcType, IProgressMonitor monitor)
+ {
+ SystemRemoteResourceSet results = new SystemRemoteResourceSet(getSubSystem(to), this);
+
+ List resources = fromSet.getResourceSet();
+ for (int i = 0; i < resources.size(); i++)
+ {
+ results.addResource(doDrop(resources.get(i), to, sameSystemType, sameSystem, srcType, monitor));
+ }
+
+ return results;
+ }
+
+ /**
+ * Sets filter context for querying. Override to provide specialized
+ * behaviour.
+ */
+ public void setFilterString(String filterString)
+ {
+ this.filterString = filterString;
+ }
+
+ /**
+ * Gets filter context for querying. Override to provide specialized
+ * behaviour.
+ */
+ public String getFilterString()
+ {
+ return filterString;
+ }
+
+ /**
+ * Overridable by subclasses, and is iff drag and drop supported.
+ * Perform drop from the "from" object to the "to" object. By default this does
+ * nothing and we return false. Extenders supporting DnD are expected to implement
+ * this method to perform a "paste" into an object.
+ *
+ * @return the new object that was copied
+ *
+ * @see #canDrag(Object)
+ * @see #doDrag(Object,boolean,IProgressMonitor)
+ * @see #canDrop(Object)
+ * @see #validateDrop(Object,Object,boolean)
+ */
+ public Object doDrop(Object from, Object to, boolean sameSystemType, boolean sameSystem, int srcType, IProgressMonitor monitor)
+ {
+ // for backward compatability
+ return doDrop(from, to, sameSystemType, sameSystem, monitor);
+ }
+
+ /**
+ * Overridable by subclasses, and is iff drag and drop supported.
+ * Perform drop from the "from" object to the "to" object. By default this does
+ * nothing and we return false. Extenders supporting DnD are expected to implement
+ * this method to perform a "paste" into an object.
+ *
+ * @return the new object that was copied
+ *
+ * @see #canDrag(Object)
+ * @see #doDrag(Object,boolean,IProgressMonitor)
+ * @see #canDrop(Object)
+ * @see #validateDrop(Object,Object,boolean)
+ *
+ * @deprecated use doDrop(Object from, Object to, boolean sameSystemType, boolean sameSystem, int srcType, IProgressMonitor monitor) instead
+ */
+ public Object doDrop(Object from, Object to, boolean sameSystemType, boolean sameSystem, IProgressMonitor monitor)
+ {
+ return null;
+ }
+
+ /**
+ * Overridable by subclasses, and usually is iff drag and drop supported..
+ * Return true if it is valid for the src object to be dropped in the target. We return false by default.
+ * @param src the object to drop
+ * @param target the object which src is dropped in
+ * @param sameSystem whether this is the same system or not
+ * @return whether this is a valid operation
+ *
+ * @see #canDrag(Object)
+ * @see #doDrag(Object,boolean,IProgressMonitor)
+ * @see #canDrop(Object)
+ * @see #doDrop(Object,Object,boolean,boolean,IProgressMonitor)
+ */
+ public boolean validateDrop(Object src, Object target, boolean sameSystem)
+ {
+ return false;
+ }
+
+ public boolean validateDrop(ISystemResourceSet set, Object target, boolean sameSystem)
+ {
+ boolean valid = true;
+ List resources = set.getResourceSet();
+ for (int i = 0; i < resources.size() && valid; i++)
+ {
+ valid = validateDrop(resources.get(i), target, sameSystem);
+ }
+ return valid;
+ }
+
+ // ------------------------------------------------------------
+ // METHODS FOR SAVING AND RESTORING EXPANSION STATE OF VIEWER...
+ // ------------------------------------------------------------
+ /**
+ * Overridable by subclasses, but usually is not.
+ * Return what to save to disk to identify this element in the persisted list of expanded elements.
+ * This just defaults to getName, but if that is not sufficient override it here.
+ */
+ public String getMementoHandle(Object element)
+ {
+ if (this instanceof ISystemRemoteElementAdapter)
+ return ((ISystemRemoteElementAdapter)this).getAbsoluteName(element);
+ else
+ return getName(element);
+ }
+ /**
+ * Overridable by subclasses, but usually is not.
+ * Return what to save to disk to identify this element when it is the input object to a secondary
+ * Remote Systems Explorer perspective. Defaults to getMementoHandle(element).
+ */
+ public String getInputMementoHandle(Object element)
+ {
+ return getMementoHandle(element);
+ }
+ /**
+ * Overridable by subclasses, but usually is not.
+ * Return a short string to uniquely identify the type of resource. Eg "conn" for connection.
+ * This just defaults to getType, but if that is not sufficient override it here, since that is
+ * a translated string.
+ */
+ public String getMementoHandleKey(Object element)
+ {
+ if (this instanceof ISystemRemoteElementAdapter)
+ return ISystemMementoConstants.MEMENTO_KEY_REMOTE;
+ else
+ return getType(element);
+ }
+
+ /**
+ * Overridable by subclasses, but usually is not.
+ * Somtimes we don't want to remember an element's expansion state, such as for temporarily inserted
+ * messages. In these cases return false from this method. The default is true
+ */
+ public boolean saveExpansionState(Object element)
+ {
+ return true;
+ }
+
+ /**
+ * Overridable by subclasses, but usually is not.
+ * Return true if this object is a "prompting" object that prompts the user when expanded.
+ * For such objects, we do not try to save and restore their expansion state on F5 or between
+ * sessions.
+ *
+ * Selection has changed in the Remote Systems view. Empty by default, but override if you need
+ * to track selection changed. For example, this is used to drive table views that respond to
+ * selection.
+ * @param element - first selected object
+ */
+ public void selectionChanged(Object element) // d40615
+ {
+ }
+
+ /**
+ * Overridable by subclasses, typically if additional properties are supported.
+ * From IActionFilter so the popupMenus extension point can use <filter>, <enablement>
+ * or <visibility>. The support is for the following:
+ *
+ *
+ *
+ * From {@link org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteSubSubType(Object)}.
+ * Pre-supplied for convenience for subclasses that want to implement this interface for
+ * remote object adapters.
+ *
+ * From {@link org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteSubSubType(Object)}.
+ * Pre-supplied for convenience for subclasses that want to implement this interface for
+ * remote object adapters.
+ *
+ * Return the remote edit wrapper for this object.
+ * @param object the object to edit
+ * @return the editor wrapper for this object
+ */
+ public ISystemEditableRemoteObject getEditableRemoteObject(Object object)
+ {
+ return null;
+ }
+
+ /**
+ * Overridable by subclasses, and must be for editable objects.
+ * Indicates whether the specified object can be edited or not.
+ * @param object the object to edit
+ * @return true if the object can be edited. Returns false by default.
+ */
+ public boolean canEdit(Object object)
+ {
+ return false;
+ }
+
+ // ------------------
+ // HELPER METHODS...
+ // ------------------
+ /**
+ * Callable by subclasses.
+ * Returns the implementation of ISystemViewElement for the given
+ * object. Returns null if the adapter is not defined or the
+ * object is not adaptable.
+ *
+ * Returns the implementation of ISystemRemoteElement for the given
+ * object. Returns null if this object does not adaptable to this.
+ *
+ * Do message variable substitution. Using you are replacing &1 (say) with
+ * a string.
+ * @param message containing substitution variable. Eg "Connect failed with return code &1"
+ * @param substitution variable. Eg "%1"
+ * @param substitution data. Eg "001"
+ * @return message with all occurrences of variable substituted with data.
+ */
+ public static String sub(String msg, String subOld, String subNew)
+ {
+ StringBuffer temp = new StringBuffer();
+ int lastHit = 0;
+ int newHit = 0;
+ for (newHit = msg.indexOf(subOld,lastHit); newHit != -1;
+ lastHit = newHit, newHit = msg.indexOf(subOld,lastHit))
+ {
+ if (newHit >= 0)
+ temp.append(msg.substring(lastHit,newHit));
+ temp.append(subNew);
+ newHit += subOld.length();
+ }
+ if (lastHit >= 0)
+ temp.append(msg.substring(lastHit));
+ return temp.toString();
+ }
+
+ /**
+ * Callable by subclasses. Do not override
+ * Return the current viewer as an ISystemTree if the viewer is set and
+ * it implements this interface (SystemView does). May be null so test it.
+ */
+ protected ISystemTree getSystemTree()
+ {
+ Viewer v = getViewer();
+ if ((v != null) && (v instanceof ISystemTree))
+ return (ISystemTree)v;
+ else
+ return null;
+ }
+
+ /**
+ * Callable by subclasses. Do not override
+ * Return "Yes" translated
+ */
+ public String getTranslatedYes()
+ {
+ if (xlatedYes == null)
+ xlatedYes = SystemResources.TERM_YES;
+ return xlatedYes;
+ }
+
+ /**
+ * Callable by subclasses. Do not override
+ * Return "No" translated
+ */
+ protected String getTranslatedNo()
+ {
+ if (xlatedNo == null)
+ xlatedNo = SystemResources.TERM_NO;
+ return xlatedNo;
+ }
+
+ /**
+ * Callable by subclasses. Do not override
+ * Return "True" translated
+ */
+ protected String getTranslatedTrue()
+ {
+ if (xlatedTrue == null)
+ xlatedTrue = SystemResources.TERM_TRUE;
+ return xlatedTrue;
+ }
+ /**
+ * Callable by subclasses. Do not override
+ * Return "False" translated
+ */
+ protected String getTranslatedFalse()
+ {
+ if (xlatedFalse == null)
+ xlatedFalse = SystemResources.TERM_FALSE;
+ return xlatedFalse;
+ }
+ /**
+ * Callable by subclasses. Do not override
+ * Return "Not application" translated
+ */
+ protected String getTranslatedNotApplicable()
+ {
+ if (xlatedNotApplicable == null)
+ xlatedNotApplicable = SystemPropertyResources.RESID_TERM_NOTAPPLICABLE;
+ return xlatedNotApplicable;
+ }
+ /**
+ * Callable by subclasses. Do not override
+ * Return "Not available" translated
+ */
+ protected String getTranslatedNotAvailable()
+ {
+ if (xlatedNotAvailable == null)
+ xlatedNotAvailable = SystemPropertyResources.RESID_TERM_NOTAVAILABLE;
+ return xlatedNotAvailable;
+ }
+
+ /**
+ * Internal use. Do not override
+ */
+ protected void initMsgObjects()
+ {
+ nullObject = new SystemMessageObject(SystemPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_EMPTY),ISystemMessageObject.MSGTYPE_EMPTY, null);
+ canceledObject = new SystemMessageObject(SystemPlugin.getPluginMessage(ISystemMessages.MSG_LIST_CANCELLED),ISystemMessageObject.MSGTYPE_CANCEL, null);
+ errorObject = new SystemMessageObject(SystemPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_FAILED),ISystemMessageObject.MSGTYPE_ERROR, null);
+ }
+
+ /**
+ * Callable by subclasses. Do not override
+ * In getChildren, return checkForNull(children, true/false)<.samp> versus your array directly.
+ * This method checks for a null array which is not allowed and replaces it with an empty array.
+ * If true is passed then it returns the "Empty list" message object if the array is null or empty
+ */
+ protected Object[] checkForNull(Object[] children, boolean returnNullMsg)
+ {
+ if ((children == null) || (children.length==0))
+ {
+ if (!returnNullMsg)
+ return emptyList;
+ else
+ {
+ if (nullObject == null)
+ initMsgObjects();
+ msgList[0] = nullObject;
+ return msgList;
+ }
+ }
+ else
+ return children;
+ }
+
+ /**
+ * Callable by subclasses. Do not override
+ * Return the "Operation cancelled by user" msg as an object array so can be used to answer getChildren()
+ */
+ protected Object[] getCancelledMessageObject()
+ {
+ if (canceledObject == null)
+ initMsgObjects();
+ msgList[0] = canceledObject;
+ return msgList;
+ }
+ /**
+ * Callable by subclasses. Do not override
+ * Return the "Operation failed" msg as an object array so can be used to answer getChildren()
+ */
+ protected Object[] getFailedMessageObject()
+ {
+ if (errorObject == null)
+ initMsgObjects();
+ msgList[0] = errorObject;
+ return msgList;
+ }
+ /**
+ * Callable by subclasses. Do not override
+ * Return the "Empty list" msg as an object array so can be used to answer getChildren()
+ */
+ protected Object[] getEmptyMessageObject()
+ {
+ if (nullObject == null)
+ initMsgObjects();
+ msgList[0] = nullObject;
+ return msgList;
+ }
+
+ /**
+ * Callable by subclasses. Do not override
+ * Get the first selected object of the given selection
+ */
+ protected Object getFirstSelection(IStructuredSelection selection)
+ {
+ return selection.getFirstElement();
+ }
+
+ /**
+ * Return a filter string that corresponds to this object.
+ * @param object the object to obtain a filter string for
+ * @return the corresponding filter string if applicable
+ */
+ public String getFilterStringFor(Object object)
+ {
+ return null;
+ }
+
+
+ /**
+ * these methods are for deferred fetch operations
+ */
+
+ /*
+ * Return whether deferred queries are supported. By default
+ * they are not supported. Subclasses must override this to
+ * return true if they are to support this.
+ */
+ public boolean supportsDeferredQueries()
+ {
+ return false;
+ }
+
+
+ public void fetchDeferredChildren(Object o, IElementCollector collector, IProgressMonitor monitor)
+ {
+ try
+ {
+ monitor = Policy.monitorFor(monitor);
+ monitor.beginTask(Policy.bind("RemoteFolderElement.fetchingRemoteChildren", getLabel(o)), 100); //$NON-NLS-1$
+ SystemFetchOperation operation = getSystemFetchOperation(o, collector);
+ operation.run(Policy.subMonitorFor(monitor, 100));
+ }
+ catch (InvocationTargetException e)
+ {
+ e.printStackTrace();
+ }
+ catch (InterruptedException e)
+ {
+ // Cancelled by the user;
+ }
+ finally
+ {
+ monitor.done();
+ }
+ }
+
+
+ /**
+ * Returns the SystemFetchOperation to be used in performing a query. Adapters should override
+ * this to provide customizations where appropriate.
+ * @param o
+ * @param collector
+ * @return the fetch operation. By default it returns the base implementation
+ */
+ protected SystemFetchOperation getSystemFetchOperation(Object o, IElementCollector collector)
+ {
+ return new SystemFetchOperation(null, (IAdaptable)o, this, collector);
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.progress.IDeferredWorkbenchAdapter#isContainer()
+ */
+ public boolean isContainer()
+ {
+ return true;
+ }
+
+ public ISchedulingRule getRule(Object element) {
+ IAdaptable location = (IAdaptable)element;
+ return new SystemSchedulingRule(location);
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/IRSEViewPart.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/IRSEViewPart.java
new file mode 100644
index 00000000000..e854d327bdf
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/IRSEViewPart.java
@@ -0,0 +1,24 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+
+import org.eclipse.jface.viewers.Viewer;
+
+public interface IRSEViewPart
+{
+ Viewer getRSEViewer();
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemDragDropAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemDragDropAdapter.java
new file mode 100644
index 00000000000..cd013a28684
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemDragDropAdapter.java
@@ -0,0 +1,117 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.rse.core.subsystems.IRemoteObjectIdentifier;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.model.ISystemResourceSet;
+import org.eclipse.rse.model.SystemRemoteResourceSet;
+
+
+public interface ISystemDragDropAdapter extends IRemoteObjectIdentifier
+{
+
+ // ------------------------------------------
+ // METHODS TO SUPPORT COMMON DRAG AND DROP FUNCTION...
+ // ------------------------------------------
+ /**
+ * Return true if this object can be copied to another location via drag and drop, or clipboard copy.
+ */
+ public boolean canDrag(Object element);
+
+ /**
+ * Return true if these objects can be copied to another location via drag and drop, or clipboard copy.
+ */
+ public boolean canDrag(SystemRemoteResourceSet elements);
+
+ /**
+ * Perform the drag on the given object.
+ * @param element the object to copy
+ * @param sameSystemType indication of whether the source and target reside on the same type of system
+ * @param monitor the progress monitor
+ * @return a temporary local copy of the object that was copied
+ */
+ public Object doDrag(Object element, boolean sameSystemType, IProgressMonitor monitor);
+
+
+ /**
+ * Perform the drag on the given objects.
+ * @param set the set of objects to copy
+ * @param monitor the progress monitor
+ * @return a set of temporary files of the object that was copied
+ */
+ public ISystemResourceSet doDrag(SystemRemoteResourceSet set, IProgressMonitor monitor);
+
+ /**
+ * Return true if another object can be copied into this object
+ * @param element the target of a drop operation
+ * @return whether this object may be dropped on
+ */
+ public boolean canDrop(Object element);
+
+ /**
+ * Perform drop from the "from" object to the "to" object
+ * @param from the source object for the drop
+ * @param to the target object for the drop
+ * @param sameSystemType indication of whether the source and target reside of the same type of system
+ * @param sameSystem indication of whether the source and target are on the same system
+ * @param srcType the type of object to be dropped.
+ * @param monitor the progress monitor
+ * @return the new copy of the object that was dropped
+ */
+ public Object doDrop(Object from, Object to, boolean sameSystemType, boolean sameSystem, int srcType, IProgressMonitor monitor);
+
+ /**
+ * Perform drop from the "fromSet" of objects to the "to" object
+ * @param from the source objects for the drop
+ * @param to the target object for the drop
+ * @param sameSystemType indication of whether the source and target reside of the same type of system
+ * @param sameSystem indication of whether the source and target are on the same system
+ * @param srcType the type of objects to be dropped
+ * @param monitor the progress monitor
+ *
+ * @return the set of new objects created from the drop
+ *
+ */
+ public ISystemResourceSet doDrop(ISystemResourceSet fromSet, Object to, boolean sameSystemType, boolean sameSystem, int srcType, IProgressMonitor monitor);
+
+
+ /**
+ * Return true if it is valid for the src object to be dropped in the target
+ * @param src the object to drop
+ * @param target the object which src is dropped in
+ * @param sameSystem whether this is the same system
+ * @return whether this is a valid operation
+ */
+ public boolean validateDrop(Object src, Object target, boolean sameSystem);
+
+ /**
+ * Return true if it is valid for the src objects to be dropped in the target
+ * @param srcSet set of resources to drop on the target
+ * @param target the object which src is dropped in
+ * @param sameSystem whether this is the same system
+ * @return whether this is a valid operation
+ */
+ public boolean validateDrop(ISystemResourceSet srcSet, Object target, boolean sameSystem);
+
+ /**
+ * Get the subsystem that corresponds to this object if one exists.
+ *
+ */
+ public ISubSystem getSubSystem(Object element);
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemEditableRemoteObject.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemEditableRemoteObject.java
new file mode 100644
index 00000000000..aedb522c257
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemEditableRemoteObject.java
@@ -0,0 +1,159 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PartInitException;
+
+/**
+ * This interface defines some common functionality required from all remote
+ * resources for edit, irrespective of whether the remote system is an
+ * OS/400, Windows, Linux or Unix operating system.
+ */
+public interface ISystemEditableRemoteObject
+{
+
+ public static final int NOT_OPEN = -1;
+ public static final int OPEN_IN_SAME_PERSPECTIVE = 0;
+ public static final int OPEN_IN_DIFFERENT_PERSPECTIVE = 1;
+
+ /**
+ * Check if user has write authority to the file.
+ * @return true if user has write authority to the file, false otherwise
+ */
+ public boolean isReadOnly();
+
+ /**
+ * Indicate whether the file can be edited
+ */
+ public void setReadOnly(boolean isReadOnly);
+
+ /**
+ * Set the editor variable given an exiting editor part
+ * @param editorPart the editor
+ */
+ public void setEditor(IEditorPart editorPart);
+
+ /**
+ * Download the file.
+ * @param if the shell is null, no progress monitor will be shown
+ * @return true if successful, false if cancelled
+ */
+ public boolean download(Shell shell) throws Exception;
+
+ /**
+ * Download the file.
+ * @param the progress monitor
+ * @returns true if the operation was successful. false if the user cancels.
+ */
+ public boolean download(IProgressMonitor monitor) throws Exception;
+
+ /**
+ * Saves the local file and uploads it to the host immediately, rather than, in response to a resource change
+ * event.
+ * @returns true if the operation was successful. false if the upload fails.
+ */
+ public boolean doImmediateSaveAndUpload();
+
+ /**
+ * Get the local resource
+ */
+ public IFile getLocalResource();
+
+ /**
+ * Is the local file open in an editor
+ */
+ public int checkOpenInEditor() throws CoreException;
+
+ /**
+ * Returns the open IEditorPart for this remote object if there is one.
+ */
+ public IEditorPart getEditorPart();
+
+ /**
+ * Returns the remote object that is editable
+ */
+ public IAdaptable getRemoteObject();
+
+
+
+ /**
+ * Open in editor
+ */
+ public void open(Shell shell);
+
+ /**
+ * Open in editor
+ */
+ public void open(Shell shell, boolean readOnly);
+
+
+ /**
+ * Set local resource properties
+ */
+ public void setLocalResourceProperties() throws Exception;
+
+ /**
+ * Register as listener for various events
+ */
+ public void addAsListener();
+
+ /**
+ * Open the editor
+ */
+ public void openEditor() throws PartInitException;
+
+ /**
+ * Update the editor dirty indicator
+ */
+ public void updateDirtyIndicator();
+
+ /**
+ * Check if the file is dirty
+ */
+ public boolean isDirty();
+
+
+ /**
+ * Return the absolute path on the remote system
+ * @return
+ */
+ public String getAbsolutePath();
+
+ /**
+ * Return the subsystem for the edited object
+ * @return
+ */
+ public ISubSystem getSubSystem();
+
+ /**
+ * Returns whether the edited object exists
+ * @return
+ */
+ public boolean exists();
+
+ /**
+ * Returns whether the underlying resource needs to be updated from the host
+ */
+ public boolean isStale();
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemLongRunningRequestListener.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemLongRunningRequestListener.java
new file mode 100644
index 00000000000..0a082e930a2
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemLongRunningRequestListener.java
@@ -0,0 +1,33 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+/**
+ * This interface allows listeners to be kept informed when a long
+ * running request starts and stops.
+ */
+public interface ISystemLongRunningRequestListener
+{
+
+ /**
+ * A long running request is starting
+ */
+ public void startingLongRunningRequest(SystemLongRunningRequestEvent event);
+ /**
+ * A long running request is finishing
+ */
+ public void endingLongRunningRequest(SystemLongRunningRequestEvent event);
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemMementoConstants.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemMementoConstants.java
new file mode 100644
index 00000000000..701b9c98928
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemMementoConstants.java
@@ -0,0 +1,50 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+public interface ISystemMementoConstants
+{
+
+ /**
+ * Memento ID for profiles
+ */
+ public static final String MEMENTO_KEY_PROFILE = "Profile";
+ /**
+ * Memento ID for connections
+ */
+ public static final String MEMENTO_KEY_CONNECTION = "Conn";
+ /**
+ * Memento ID for subsystems
+ */
+ public static final String MEMENTO_KEY_SUBSYSTEM = "Subs";
+ /**
+ * Memento ID for filter pool references
+ */
+ public static final String MEMENTO_KEY_FILTERPOOLREFERENCE = "FPoolRef";
+ /**
+ * Memento ID for filter references
+ */
+ public static final String MEMENTO_KEY_FILTERREFERENCE = "FRef";
+ /**
+ * Memento ID for filter string references
+ */
+ public static final String MEMENTO_KEY_FILTERSTRINGREFERENCE = "FSRef";
+ /**
+ * Memento ID for remote objects
+ */
+ public static final String MEMENTO_KEY_REMOTE = "Remote";
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemPropertyConstants.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemPropertyConstants.java
new file mode 100644
index 00000000000..7d93dc5b9e6
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemPropertyConstants.java
@@ -0,0 +1,107 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+import org.eclipse.jface.viewers.IBasicPropertyConstants;
+/**
+ * Constants that are the key values used to identify properties that populate the
+ * Property Sheet viewer.
+ */
+public interface ISystemPropertyConstants extends IBasicPropertyConstants
+{
+ public static final String P_PREFIX = org.eclipse.rse.ui.ISystemIconConstants.PREFIX;
+ // GENERIC / COMMON
+ public static final String P_TYPE = P_PREFIX+"type";
+ public static final String P_NEWNAME = P_PREFIX+"newName";
+ public static final String P_ERROR = P_PREFIX+"error";
+ public static final String P_OK = P_PREFIX+"ok";
+ public static final String P_FILTERSTRING = P_PREFIX+"filterString";
+ public static final String P_NBRCHILDREN = P_PREFIX+"nbrChildren";
+
+ // CONNECTION PROPERTIES
+ public static final String P_PROFILE = P_PREFIX+"profile";
+ public static final String P_SYSTEMTYPE = P_PREFIX+"systemType";
+ public static final String P_HOSTNAME = P_PREFIX+"hostname";
+ public static final String P_DEFAULTUSERID = P_PREFIX+"defaultuserid";
+ public static final String P_DESCRIPTION = P_PREFIX+"description";
+
+ // FILTER POOL PROPERTIES
+ //public static final String P_IS_SHARABLE = P_PREFIX+"sharable"; // transient
+
+ // FILTER PROPERTIES
+ public static final String P_FILTERSTRINGS = P_PREFIX+"filterstrings";
+ public static final String P_FILTERSTRINGS_COUNT = P_PREFIX+"filterstringsCount";
+ public static final String P_PARENT_FILTER = P_PREFIX+"filterParent";
+ public static final String P_PARENT_FILTERPOOL = P_PREFIX+"filterParentPool";
+ public static final String P_RELATED_CONNECTION = P_PREFIX+"filterRelatedConnection";
+ public static final String P_IS_CONNECTION_PRIVATE = P_PREFIX+"filterConnectionPrivate";
+
+ // FILE PROPERTIES
+ public static final String P_FILE_LASTMODIFIED = P_PREFIX+"file.lastmodified";
+ public static final String P_FILE_SIZE = P_PREFIX+"file.size";
+ public static final String P_FILE_PATH = P_PREFIX+"file.path";
+ public static final String P_FILE_CANONICAL_PATH = P_PREFIX+"file.canonicalpath";
+ public static final String P_FILE_CLASSIFICATION= P_PREFIX+"file.classification";
+ public static final String P_FILE_READONLY = P_PREFIX+"file.readonly";
+ public static final String P_FILE_READABLE = P_PREFIX+"file.readable";
+ public static final String P_FILE_WRITABLE = P_PREFIX+"file.writable";
+ public static final String P_FILE_HIDDEN = P_PREFIX+"file.hidden";
+
+ // SEARCH LOCATION PROPERTIES
+ public static final String P_SEARCH_LINE = P_PREFIX+"search.line";
+ //public static final String P_SEARCH_CHAR_END = P_PREFIX+"search.char.end";
+
+ // ARCHIVE FILE PROPERTIES
+ public static final String P_ARCHIVE_EXPANDEDSIZE = P_PREFIX+"archive.expandedsize";
+ public static final String P_ARCHIVE_COMMENT = P_PREFIX+"archive.comment";
+
+ // VIRTUAL FILE PROPERTIES
+ public static final String P_VIRTUAL_COMPRESSEDSIZE = P_PREFIX+"virtual.compressedsize";
+ public static final String P_VIRTUAL_COMMENT = P_PREFIX+"virtual.comment";
+ public static final String P_VIRTUAL_COMPRESSIONRATIO = P_PREFIX+"virtual.compressionratio";
+ public static final String P_VIRTUAL_COMPRESSIONMETHOD = P_PREFIX+"virtual.compressionmethod";
+
+ // SHELL PROPERTIES
+ public static final String P_SHELL_STATUS = P_PREFIX+"shell.status";
+ public static final String P_SHELL_CONTEXT = P_PREFIX+"shell.context";
+
+ // ERROR PROPERTIES
+ public static final String P_ERROR_FILENAME = P_PREFIX+"error.filename";
+ public static final String P_ERROR_LINENO = P_PREFIX+"error.lineno";
+
+ // USER ACTION PROPERTIES
+ public static final String P_USERACTION_DOMAIN = P_PREFIX+"action.domain";
+
+ // COMPILE TYPE PROPERTIES
+ public static final String P_COMPILETYPE_TYPES = P_PREFIX+"compiletypes.types";
+
+ // MISCELLANEOUS PROPERTIES
+ public static final String P_USERID = P_PREFIX+"userid";
+ public static final String P_PASSWORD = P_PREFIX+"password";
+ public static final String P_CCSID = P_PREFIX+"ccsid";
+ public static final String P_VRM = P_PREFIX+"vrm";
+ public static final String P_ENVLIST = P_PREFIX+"envlist"; // indexed
+ public static final String P_FILTERS = P_PREFIX+"filters"; // indexed
+ public static final String P_FILTER = P_PREFIX+"filter"; // scalar
+ public static final String P_IS_CONNECTED = P_PREFIX+"connected"; // transient
+ public static final String P_IS_ACTIVE = P_PREFIX+"active"; // for profiles
+ public static final String P_HAS_CHILDREN = P_PREFIX+"hasChildren"; // see SystemElementViewerAdapter
+ public static final String P_PORT = P_PREFIX+"port";
+ public static final String P_ORIGIN = P_PREFIX+"origin";
+ public static final String P_VENDOR = P_PREFIX+"vendor";
+ public static final String P_COMMAND = P_PREFIX+"command";
+ public static final String P_COMMENT = P_PREFIX+"comment";
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemRemoteElementAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemRemoteElementAdapter.java
new file mode 100644
index 00000000000..fde3c9b6646
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemRemoteElementAdapter.java
@@ -0,0 +1,160 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+
+import org.eclipse.rse.core.subsystems.IRemoteObjectIdentifier;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.swt.widgets.Shell;
+
+
+
+
+/**
+ * This is an interface that only remote system objects supply adapters for.
+ *
+ * Now imagine one of the references is selected by the user and renamed via the rename action. This
+ * might only update the selected reference. What about the other objects which refer to the same
+ * remote resource... they need to update their in-memory "name" variable too.
+ * That is what this method. Every reference to the same remote resource is found (they have the
+ * same absolute name and come from a system with the same hostname) and this method is called
+ * on those other references. This is your opportunity to copy the attributes from the new element
+ * to the old element.
+ * true
if the object supports user defined actions, false
otherwise.
+ */
+ public boolean supportsUserDefinedActions(Object object);
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemRemoveElementAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemRemoveElementAdapter.java
new file mode 100644
index 00000000000..3d0b7d2179b
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemRemoveElementAdapter.java
@@ -0,0 +1,42 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+
+/**
+ * This interface must be implemented by adapters who must remove elements from
+ * their list of children (not necessarily immediate children).
+ */
+public interface ISystemRemoveElementAdapter {
+
+ /**
+ * Remove all children from the element.
+ * @param element the element.
+ * @return true
if the children have been removed, false
+ * otherwise.
+ */
+ public boolean removeAllChildren(Object element);
+
+ /**
+ * Remove a child from the element.
+ * @param element the element.
+ * @param child the child to remove. Does not have to be an immediate child
+ * of the element.
+ * @return true
if the child has been removed, false
+ * otherwise.
+ */
+ public boolean remove(Object element, Object child);
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemSelectAllTarget.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemSelectAllTarget.java
new file mode 100644
index 00000000000..5071c1da1a7
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemSelectAllTarget.java
@@ -0,0 +1,43 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+import org.eclipse.jface.viewers.IStructuredSelection;
+
+/**
+ * This interface is implemented by all viewers that wish to support
+ * the global select all action. To do so, they implement this interface,
+ * then instantiate SystemCommonSelectAllAction, and call setGlobalActionHandler.
+ * See SystemViewPart for an example.
+ */
+public interface ISystemSelectAllTarget
+{
+
+
+ /**
+ * Return true if select all should be enabled for the given object.
+ * For a tree view, you should return true if and only if the selected object has children.
+ * You can use the passed in selection or ignore it and query your own selection.
+ */
+ public boolean enableSelectAll(IStructuredSelection selection);
+ /**
+ * When this action is run via Edit->Select All or via Ctrl+A, perform the
+ * select all action. For a tree view, this should select all the children
+ * of the given selected object. You can use the passed in selected object
+ * or ignore it and query the selected object yourself.
+ */
+ public void doSelectAll(IStructuredSelection selection);
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemSelectRemoteObjectAPIProviderCaller.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemSelectRemoteObjectAPIProviderCaller.java
new file mode 100644
index 00000000000..091431137fd
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemSelectRemoteObjectAPIProviderCaller.java
@@ -0,0 +1,39 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+import org.eclipse.rse.filters.ISystemFilter;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * This is the interface that callers of the SystemSelectRemoteObjectAPIProviderCaller
+ * can optionally implement to be called back for events such as the expansion of a
+ * promptable, transient filter.
+ */
+public interface ISystemSelectRemoteObjectAPIProviderCaller
+{
+
+ /**
+ * Prompt the user to create a new filter as a result of the user expanding a promptable
+ * transient filter.
+ *
+ * @return the filter created by the user or null if they cancelled the prompting
+ */
+ public ISystemFilter createFilterByPrompting(ISystemFilter filterPrompt, Shell shell)
+ throws Exception;
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemShellProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemShellProvider.java
new file mode 100644
index 00000000000..2f3fdef584c
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemShellProvider.java
@@ -0,0 +1,27 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IActionBars;
+/**
+ * Abstraction of any parent window that can supply sub-windows with a Shell object
+ */
+public interface ISystemShellProvider
+{
+ public Shell getShell();
+ public IActionBars getActionBars();
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemTree.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemTree.java
new file mode 100644
index 00000000000..28e5d0e5d8e
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemTree.java
@@ -0,0 +1,99 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+import org.eclipse.swt.widgets.Item;
+/**
+ * To drive our GUI we find ourselves adding additional useful methods on top of the
+ * JFace tree viewer, in our subclasses. We capture those here in an interface so they
+ * can be implemented by other viewers that wish to fully drive our UI. Typically this
+ * is for interesting properties in the property sheet.
+ *
+ *
+ */
+public interface ISystemViewActionFilter extends IActionFilter
+{
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewDropDestination.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewDropDestination.java
new file mode 100644
index 00000000000..569c54d8623
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewDropDestination.java
@@ -0,0 +1,34 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+
+/**
+ * An adapter can elect to suppot this interface and answer
+ * whether it support copy/move/drop from the source (given adapter
+ * type) to the specified destination.
+ * @author A.Kent Hawley
+ */
+public interface ISystemViewDropDestination
+{
+
+ /**
+ * ask source adapter if it supports drop of its type on this target
+ * @parm resource (type) in question
+ * @returns true if copy/move/drop is supported
+ */
+ public boolean supportDropDestination(Object target);
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewElementAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewElementAdapter.java
new file mode 100644
index 00000000000..32b50bba543
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewElementAdapter.java
@@ -0,0 +1,346 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.SystemMenuManager;
+import org.eclipse.rse.ui.validators.ISystemValidator;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.IPropertySource;
+
+
+
+/**
+ * This is the interface for an adapter on objects in the system viewer.
+ * Any input into the system viewer must register an adapter that implements this interface.
+ *
+ *
+ * isve = object.getAdapter(ISystemViewElementAdapter.class);
+ * interestingInfo = isve.getXXXX(object);
+ *
+ *
+ *
+ * @param menu the popup menu you can contribute to
+ * @param selection the current selection in the calling tree or table view
+ * @param parent the shell of the calling tree or table view
+ * @param menuGroup the default menu group to place actions into if you don't care where they. Pass this to the SystemMenuManager {@link org.eclipse.rse.ui.SystemMenuManager#add(String,IAction) add} method.
+ */
+ public void addActions(SystemMenuManager menu, IStructuredSelection selection, Shell parent, String menuGroup);
+ /**
+ * Returns an image descriptor for the image. More efficient than getting the image.
+ * @param element The element for which an image is desired
+ */
+ public ImageDescriptor getImageDescriptor(Object element);
+ /**
+ * Return the label for this object
+ */
+ public String getText(Object element);
+ /**
+ * Return the alternate label for this object
+ */
+ public String getAlternateText(Object element);
+ /**
+ * Return the name of this object, which may be different than the display text ({#link #getText(Object)}.
+ */
+ public String getName(Object element);
+ /**
+ * Return a value for the type property for this object
+ */
+ public String getType(Object element);
+ /**
+ * Return the string to display in the status line when the given object is selected
+ */
+ public String getStatusLineText(Object element);
+ /**
+ * Return the parent of this object
+ */
+ public Object getParent(Object element);
+ /**
+ * Return the children of this object
+ */
+ public Object[] getChildren(Object element);
+
+ /**
+ * Return the children of this object. This version (with monitor) is used when the
+ * request happens on a modal thread. The implementation needs to take this into
+ * account so that SWT thread exceptions are avoided.
+ */
+ public Object[] getChildren(IProgressMonitor monitor, Object element);
+
+ /**
+ * Return the children of this object, using the given Expand-To filter
+ */
+ public Object[] getChildrenUsingExpandToFilter(Object element, String expandToFilter);
+ /**
+ * Return true if this object has children
+ */
+ public boolean hasChildren(Object element);
+ /**
+ * Return true if this object is a "prompting" object that prompts the user when expanded.
+ * For such objects, we do not try to save and restore their expansion state on F5 or between
+ * sessions
+ */
+ public boolean isPromptable(Object element);
+
+ /**
+ * Set input object for property source queries. This is called by the
+ * SystemViewAdaptorFactory before returning this adapter object.
+ * Handled automatically if you start with AbstractSystemViewAdaptor.
+ */
+ public void setPropertySourceInput(Object propertySourceInput);
+
+ /**
+ * User has double clicked on an object. If you want to do something special,
+ * do it and return true. Otherwise return false to have the viewer do the default behaviour.
+ */
+ public boolean handleDoubleClick(Object element);
+
+ // ------------------------------------------
+ // METHODS TO SUPPORT GLOBAL DELETE ACTION...
+ // ------------------------------------------
+ /**
+ * Return true if we should show the delete action in the popup for the given element.
+ * If true, then canDelete will be called to decide whether to enable delete or not.
+ */
+ public boolean showDelete(Object element);
+ /**
+ * Return true if this object is deletable by the user. If so, when selected,
+ * the Edit->Delete menu item will be enabled.
+ */
+ public boolean canDelete(Object element);
+ /**
+ * Perform the delete on the given item. This is after the user has been asked to confirm deletion.
+ * @deprecated use the one with the monitor
+ */
+ public boolean doDelete(Shell shell, Object element)
+ throws Exception;
+
+ /**
+ * Perform the delete on the given item. This is after the user has been asked to confirm deletion.
+ */
+ public boolean doDelete(Shell shell, Object element, IProgressMonitor monitor)
+ throws Exception;
+
+ /**
+ * Perform the delete on the given set of items. This is after the user has been asked to confirm deletion.
+ */
+ public boolean doDeleteBatch(Shell shell, List resourceSet, IProgressMonitor monitor)
+ throws Exception;
+
+ // ------------------------------------------
+ // METHODS TO SUPPORT COMMON RENAME ACTION...
+ // ------------------------------------------
+ /**
+ * Return true if we should show the rename action in the popup for the given element.
+ * If true, then canRename will be called to decide whether to enable rename or not.
+ */
+ public boolean showRename(Object element);
+ /**
+ * Return true if this object is renamable by the user. If so, when selected,
+ * the Rename popup menu item will be enabled.
+ */
+ public boolean canRename(Object element);
+ /**
+ * Perform the rename on the given item.
+ */
+ public boolean doRename(Shell shell, Object element, String name)
+ throws Exception;
+
+
+
+ /**
+ * Return a validator for verifying the new name is correct.
+ * If you return null, no error checking is done on the new name!!
+ * Suggest you use at least UniqueStringValidator or a subclass to ensure
+ * new name is at least unique.
+ */
+ public ISystemValidator getNameValidator(Object element);
+ /**
+ * Form and return a new canonical (unique) name for this object, given a candidate for the new
+ * name. This is called by the generic multi-rename dialog to test that all new names are unique.
+ * To do this right, sometimes more than the raw name itself is required to do uniqueness checking.
+ * true
if it supports deferred queries, false
otherwise.
+ */
+ public boolean supportsDeferredQueries();
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewInputProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewInputProvider.java
new file mode 100644
index 00000000000..0915b4805d0
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewInputProvider.java
@@ -0,0 +1,97 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.rse.model.IHost;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * Abstraction for any object that wishes to be a roots-provider for the SystemView tree viewer.
+ *
+ */
+public interface ISystemViewInputProvider extends IAdaptable
+{
+ /**
+ * Return the children objects to consistute the root elements in the system view tree
+ */
+ public Object[] getSystemViewRoots();
+ /**
+ * Return true if {@link #getSystemViewRoots()} will return a non-empty list
+ */
+ public boolean hasSystemViewRoots();
+ /**
+ * Return true if we are listing connections or not, so we know whether we are interested in
+ * connection-add events
+ */
+ public boolean showingConnections();
+ /**
+ * This method is called by the connection adapter when the user expands
+ * a connection. This method must return the child objects to show for that
+ * connection.
+ */
+ public Object[] getConnectionChildren(IHost selectedConnection);
+ /**
+ * This method is called by the connection adapter when deciding to show a plus-sign
+ * or not beside a connection. Return true if this connection has children to be shown.
+ */
+ public boolean hasConnectionChildren(IHost selectedConnection);
+ /**
+ * This is the method required by the IAdaptable interface.
+ * Given an adapter class type, return an object castable to the type, or
+ * null if this is not possible.
+ */
+ public Object getAdapter(Class adapterType);
+
+ /**
+ * Set the shell in case it is needed for anything.
+ * The label and content provider will call this.
+ */
+ public void setShell(Shell shell);
+ /**
+ * Return the shell of the viewer we are currently associated with
+ */
+ public Shell getShell();
+ /**
+ * Set the viewer in case it is needed for anything.
+ * The label and content provider will call this.
+ */
+ public void setViewer(Viewer viewer);
+ /**
+ * Return the viewer we are currently associated with
+ */
+ public Viewer getViewer();
+
+ /**
+ * Return true to show the action bar (ie, toolbar) above the viewer.
+ * The action bar contains connection actions, predominantly.
+ */
+ public boolean showActionBar();
+ /**
+ * Return true to show the button bar above the viewer.
+ * The tool bar contains "Get List" and "Refresh" buttons and is typicall
+ * shown in dialogs that list only remote system objects.
+ */
+ public boolean showButtonBar();
+ /**
+ * Return true to show right-click popup actions on objects in the tree.
+ */
+ public boolean showActions();
+
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewRunnableObject.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewRunnableObject.java
new file mode 100644
index 00000000000..fdae9ddf0c8
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewRunnableObject.java
@@ -0,0 +1,29 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+import org.eclipse.swt.widgets.Shell;
+/**
+ * This interface is for any object in the system views that want to
+ * support the SystemRunAction action in their popup. It will
+ * call that object's run(Shell) method when invoked
+ */
+public interface ISystemViewRunnableObject
+{
+
+
+ public Object[] run(Shell shell);
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SubsystemFactoryAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SubsystemFactoryAdapter.java
new file mode 100644
index 00000000000..5a2f2989a13
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SubsystemFactoryAdapter.java
@@ -0,0 +1,1440 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Vector;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.rse.core.SystemBasePlugin;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.servicesubsystem.IServiceSubSystemConfiguration;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
+import org.eclipse.rse.core.subsystems.SubSystemConfiguration;
+import org.eclipse.rse.core.subsystems.util.ISubsystemConfigurationAdapter;
+import org.eclipse.rse.filters.ISystemFilter;
+import org.eclipse.rse.filters.ISystemFilterPool;
+import org.eclipse.rse.filters.ISystemFilterPoolManager;
+import org.eclipse.rse.filters.ISystemFilterPoolReference;
+import org.eclipse.rse.filters.ISystemFilterPoolReferenceManager;
+import org.eclipse.rse.filters.ISystemFilterReference;
+import org.eclipse.rse.filters.ISystemFilterString;
+import org.eclipse.rse.filters.SystemFilterPoolWrapperInformation;
+import org.eclipse.rse.model.IHost;
+import org.eclipse.rse.model.ISystemProfile;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.SystemMenuManager;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.actions.ISystemAction;
+import org.eclipse.rse.ui.actions.SystemClearPasswordAction;
+import org.eclipse.rse.ui.actions.SystemConnectAction;
+import org.eclipse.rse.ui.actions.SystemDisconnectAction;
+import org.eclipse.rse.ui.actions.SystemPasteFromClipboardAction;
+import org.eclipse.rse.ui.filters.SystemFilterStringEditPane;
+import org.eclipse.rse.ui.filters.actions.ISystemNewFilterActionConfigurator;
+import org.eclipse.rse.ui.filters.actions.SystemChangeFilterAction;
+import org.eclipse.rse.ui.filters.actions.SystemFilterAbstractFilterPoolAction;
+import org.eclipse.rse.ui.filters.actions.SystemFilterCascadingNewFilterPoolReferenceAction;
+import org.eclipse.rse.ui.filters.actions.SystemFilterCopyFilterAction;
+import org.eclipse.rse.ui.filters.actions.SystemFilterCopyFilterPoolAction;
+import org.eclipse.rse.ui.filters.actions.SystemFilterMoveDownFilterAction;
+import org.eclipse.rse.ui.filters.actions.SystemFilterMoveDownFilterPoolReferenceAction;
+import org.eclipse.rse.ui.filters.actions.SystemFilterMoveFilterAction;
+import org.eclipse.rse.ui.filters.actions.SystemFilterMoveFilterPoolAction;
+import org.eclipse.rse.ui.filters.actions.SystemFilterMoveUpFilterAction;
+import org.eclipse.rse.ui.filters.actions.SystemFilterMoveUpFilterPoolReferenceAction;
+import org.eclipse.rse.ui.filters.actions.SystemFilterNewFilterPoolAction;
+import org.eclipse.rse.ui.filters.actions.SystemFilterRemoveFilterPoolReferenceAction;
+import org.eclipse.rse.ui.filters.actions.SystemFilterSelectFilterPoolsAction;
+import org.eclipse.rse.ui.filters.actions.SystemFilterWorkWithFilterPoolsAction;
+import org.eclipse.rse.ui.filters.actions.SystemNewFilterAction;
+import org.eclipse.rse.ui.filters.dialogs.SystemChangeFilterDialog;
+import org.eclipse.rse.ui.messages.ISystemMessageLine;
+import org.eclipse.rse.ui.propertypages.ISystemSubSystemPropertyPageCoreForm;
+import org.eclipse.rse.ui.propertypages.SystemChangeFilterPropertyPage;
+import org.eclipse.rse.ui.propertypages.SystemFilterStringPropertyPage;
+import org.eclipse.rse.ui.propertypages.SystemSubSystemPropertyPageCoreForm;
+import org.eclipse.rse.ui.validators.ISystemValidator;
+import org.eclipse.rse.ui.widgets.IBMServerLauncherForm;
+import org.eclipse.rse.ui.widgets.IServerLauncherForm;
+import org.eclipse.rse.ui.wizards.ISystemNewConnectionWizardPage;
+import org.eclipse.rse.ui.wizards.SubSystemServiceWizardPage;
+import org.eclipse.rse.ui.wizards.SystemSubSystemsPropertiesWizardPage;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.dialogs.PropertyPage;
+
+
+public class SubsystemFactoryAdapter implements ISubsystemConfigurationAdapter, ISystemNewFilterActionConfigurator
+{
+ protected Hashtable imageTable = null;
+
+ // actions stuff...
+ private IAction[] subSystemActions = null;
+ private IAction[] filterPoolActions = null;
+ private IAction[] filterPoolReferenceActions = null;
+ private IAction[] filterActions = null;
+ public SubsystemFactoryAdapter()
+ {
+ }
+
+
+ /**
+ * Returns any framework-supplied actions remote objects that should be contributed to the popup menu
+ * for the given selection list. This does nothing if this adapter does not implement ISystemRemoteElementAdapter,
+ * else it potentially adds menu items for "User Actions" and Compile", for example. It queries the subsystem
+ * factory of the selected objects to determine if these actions are appropriate to add.
+ *
+ *
+ *
+ * Tip: consider extending {@link org.eclipse.rse.ui.wizards.AbstractSystemNewConnectionWizardPage} for your wizard page class.
+ */
+ public ISystemNewConnectionWizardPage[] getNewConnectionWizardPages(ISubSystemConfiguration factory, IWizard wizard)
+ {
+ if (factory instanceof IServiceSubSystemConfiguration)
+ {
+ SubSystemServiceWizardPage page = new SubSystemServiceWizardPage(wizard, factory);
+ return new ISystemNewConnectionWizardPage[] {page};
+ }
+ else
+ {
+ List pages = getSubSystemPropertyPages(factory);
+ if (pages != null && pages.size() > 0)
+ {
+ SystemSubSystemsPropertiesWizardPage page = new SystemSubSystemsPropertiesWizardPage(wizard, factory, pages);
+ return new ISystemNewConnectionWizardPage[] {page};
+ }
+ }
+ return new ISystemNewConnectionWizardPage[0];
+ }
+
+
+
+
+ /*
+ * Return the form used in the subsyste property page. This default implementation returns Syste
+ */
+ public ISystemSubSystemPropertyPageCoreForm getSubSystemPropertyPageCoreFrom(ISubSystemConfiguration factory, ISystemMessageLine msgLine, Object caller)
+ {
+ return new SystemSubSystemPropertyPageCoreForm(msgLine, caller);
+ }
+
+ /**
+ * Gets the list of property pages applicable for a subsystem associated with this factory
+ * @return the list of subsystem property pages
+ */
+ protected List getSubSystemPropertyPages(ISubSystemConfiguration factory)
+ {
+ List propertyPages= new ArrayList();
+ // Get reference to the plug-in registry
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+
+ // Get configured property page extenders
+ IConfigurationElement[] propertyPageExtensions =
+ registry.getConfigurationElementsFor("org.eclipse.ui", "propertyPages");
+
+ for (int i = 0; i < propertyPageExtensions.length; i++)
+ {
+ IConfigurationElement configurationElement = propertyPageExtensions[i];
+ String objectClass = configurationElement.getAttribute("objectClass");
+ String name = configurationElement.getAttribute("name");
+ Class objCls = null;
+ try
+ {
+ ClassLoader loader = getClass().getClassLoader();
+ objCls = Class.forName(objectClass, false, loader);
+ }
+ catch (Exception e)
+ {
+ }
+
+
+ if (objCls != null && ISubSystem.class.isAssignableFrom(objCls) && factory.isFactoryFor(objCls))
+ {
+ try
+ {
+ PropertyPage page = (PropertyPage) configurationElement.createExecutableExtension("class");
+ page.setTitle(name);
+ propertyPages.add(page);
+ }
+ catch (Exception e)
+ {
+ }
+ }
+ }
+ return propertyPages;
+ }
+
+ // FIXME - UDAs no longer coupled with factory in core
+// // ---------------------------------
+// // USER-DEFINED ACTIONS METHODS...
+// // ---------------------------------
+//
+// /**
+// * Get the action subsystem object for this subsystemconfiguration,
+// * and set its current subsystem to the given subsystem instance.
+// * Will ensure the user action subsystem is only ever instantiated once.
+// *
+ *
+ */
+ public void customizeChangeFilterPropertyPage(ISubSystemConfiguration factory, SystemChangeFilterPropertyPage page, ISystemFilter selectedFilter, Shell shell)
+ {
+ // default behaviour is a total hack! We want to preserve all the configuration done on the
+ // Change dialog, so we instantiate it merely so that we can copy the configuration information...
+ IAction changeAction = getChangeFilterAction(factory, selectedFilter, shell);
+ if (changeAction instanceof SystemChangeFilterAction)
+ {
+ SystemChangeFilterAction changeFilterAction = (SystemChangeFilterAction)changeAction;
+ changeFilterAction.setSelection(new StructuredSelection(selectedFilter));
+ org.eclipse.jface.dialogs.Dialog dlg = changeFilterAction.createDialog(shell);
+ if (dlg instanceof SystemChangeFilterDialog)
+ {
+ SystemChangeFilterDialog changeFilterDlg = (SystemChangeFilterDialog)dlg;
+ //changeFilterAction.callConfigureFilterDialog(changeFilterDlg); createDialog calls this already!
+ page.setDuplicateFilterStringErrorMessage(changeFilterDlg.getDuplicateFilterStringErrorMessage());
+ page.setFilterStringEditPane(changeFilterDlg.getFilterStringEditPane(shell));
+ page.setFilterStringValidator(changeFilterDlg.getFilterStringValidator());
+ page.setListLabel(changeFilterDlg.getListLabel(), changeFilterDlg.getListTip());
+ page.setParentPoolPromptLabel(changeFilterDlg.getParentPoolPromptLabel(), changeFilterDlg.getParentPoolPromptTip());
+ page.setNamePromptLabel(changeFilterDlg.getNamePromptLabel(), changeFilterDlg.getNamePromptTip());
+ page.setNewListItemText(changeFilterDlg.getNewListItemText());
+
+ page.setDescription(changeFilterDlg.getTitle());
+ }
+ }
+ if (selectedFilter.isNonChangable())
+ page.setEditable(false);
+ //System.out.println("Selected filter: "+selectedFilter.getName()+", isSingleFilterStringOnly: "+selectedFilter.isSetSingleFilterStringOnly());
+ boolean singleFilterString = selectedFilter.isSingleFilterStringOnly() || (selectedFilter.isNonChangable() && (selectedFilter.getFilterStringCount() == 1));
+ if (singleFilterString)
+ page.setSupportsMultipleStrings(false);
+ }
+
+ /**
+ * In addition to a change filter action, we now also support the same functionality
+ * via a Properties page for filter strings, in the Team View. When this page is activated,
+ * this method is called to enable customization of the page, given the selected filter string.
+ *
+ *
+ *
+ */
+ public void customizeFilterStringPropertyPage(ISubSystemConfiguration factory, SystemFilterStringPropertyPage page, ISystemFilterString selectedFilterString, Shell shell)
+ {
+ // default behaviour is a total hack! We want to preserve all the configuration done on the
+ // Change dialog, so we instantiate it merely so that we can copy the configuration information...
+ ISystemFilter selectedFilter = selectedFilterString.getParentSystemFilter();
+ IAction changeAction = getChangeFilterAction(factory, selectedFilter, shell);
+ if (changeAction instanceof SystemChangeFilterAction)
+ {
+ SystemChangeFilterAction changeFilterAction = (SystemChangeFilterAction)changeAction;
+ changeFilterAction.setSelection(new StructuredSelection(selectedFilter));
+ org.eclipse.jface.dialogs.Dialog dlg = changeFilterAction.createDialog(shell);
+ if (dlg instanceof SystemChangeFilterDialog)
+ {
+ SystemChangeFilterDialog changeFilterDlg = (SystemChangeFilterDialog)dlg;
+ //changeFilterAction.callConfigureFilterDialog(changeFilterDlg); createDialog calls this!
+ page.setDuplicateFilterStringErrorMessage(changeFilterDlg.getDuplicateFilterStringErrorMessage());
+ page.setFilterStringEditPane(changeFilterDlg.getFilterStringEditPane(shell));
+ page.setFilterStringValidator(changeFilterDlg.getFilterStringValidator());
+ page.setDescription(changeFilterDlg.getTitle());
+ }
+ }
+ if (selectedFilter.isNonChangable())
+ page.setEditable(false);
+ }
+
+ // ---------------------------------
+ // FILTER POOL REFERENCE METHODS...
+ // ---------------------------------
+
+
+ /**
+ * Returns a list of actions for the popup menu when user right clicks on a
+ * filter pool reference object within a subsystem of this factory. Note,
+ * these are added to the list returned by getFilterPoolActions().
+ * Only supported by subsystems that support filters.
+ * @param selectedPoolRef the currently selected pool reference
+ * @param shell parent shell of viewer where the popup menu is being constructed
+ */
+ public IAction[] getFilterPoolReferenceActions(ISubSystemConfiguration factory, ISystemFilterPoolReference selectedPoolRef, Shell shell)
+ {
+ ISystemFilterPool selectedPool = selectedPoolRef.getReferencedFilterPool();
+ Vector childActions = getAdditionalFilterPoolReferenceActions(factory, selectedPool, shell);
+ int nbrChildActions = 0;
+ if (childActions != null)
+ nbrChildActions = childActions.size();
+ int fpIdx = 0;
+ if (filterPoolReferenceActions == null)
+ {
+ int nbr = 3;
+ filterPoolReferenceActions = new IAction[nbr + nbrChildActions];
+ filterPoolReferenceActions[fpIdx++] = getRemoveFilterPoolReferenceAction(factory, selectedPool, shell);
+ filterPoolReferenceActions[fpIdx] = new SystemFilterMoveUpFilterPoolReferenceAction(shell);
+ ((ISystemAction) filterPoolReferenceActions[fpIdx++]).setHelp(SystemPlugin.HELPPREFIX + "actn0063");
+ filterPoolReferenceActions[fpIdx] = new SystemFilterMoveDownFilterPoolReferenceAction(shell);
+ ((ISystemAction) filterPoolReferenceActions[fpIdx++]).setHelp(SystemPlugin.HELPPREFIX + "actn0064");
+ }
+
+ if (childActions != null)
+ for (int idx = 0; idx < nbrChildActions; idx++)
+ filterPoolReferenceActions[fpIdx++] = (IAction) childActions.elementAt(idx);
+
+ return filterPoolReferenceActions;
+ }
+ /**
+ * Overridable entry for child classes to contribute filter pool reference actions beyond the
+ * default supplied actions.
+ * null
if no type was
+ * found.
+ */
+ private Class isInstance(Object obj) {
+
+ // get set of types
+ Set keySet = map.keySet();
+
+ // get the iterator
+ Iterator iter = keySet.iterator();
+
+ // go through iterator
+ while (iter.hasNext()) {
+ Class objType = (Class)(iter.next());
+
+ // check if object is an instance of the object type
+ if (objType.isInstance(obj)) {
+ return objType;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+ */
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+
+ // check if the object is an instance of one of the object types we want to filter
+ Class objType = isInstance(element);
+
+ // no object type found, so let it through
+ if (objType == null) {
+ return true;
+ }
+
+ ISystemViewElementAdapter adapter = null;
+
+ // get adapter
+ if (element instanceof IAdaptable) {
+ IAdaptable adaptable = (IAdaptable)element;
+
+ adapter = (ISystemViewElementAdapter)(adaptable.getAdapter(ISystemViewElementAdapter.class));
+
+ // get list of criteria
+ List criteria = (List)(map.get(objType));
+
+ // get iterator
+ Iterator iter = criteria.iterator();
+
+ // go through list of criterion, make sure one of them matches
+ while (iter.hasNext()) {
+ FilterCriterion criterion = (FilterCriterion)(iter.next());
+
+ boolean testResult = adapter.testAttribute(element, criterion.getName(), criterion.getValue());
+
+ if (testResult) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemComboBoxCellEditor.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemComboBoxCellEditor.java
new file mode 100644
index 00000000000..88c388e4ef9
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemComboBoxCellEditor.java
@@ -0,0 +1,207 @@
+/********************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+import java.text.MessageFormat;
+
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.TraverseEvent;
+import org.eclipse.swt.events.TraverseListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+/**
+ * A slight variation of the Eclipse-supplied ComboBoxCellEditor class,
+ * which allows the input array to be changed dynamically.
+ * ComboBoxCellEditor
implementation of
+ * this CellEditor
framework method returns
+ * the zero-based index of the current selection.
+ *
+ * @return the zero-based index of the current selection wrapped
+ * as an Integer
+ */
+ protected Object doGetValue()
+ {
+ System.out.println("Inside doGetValue");
+ return new Integer(selection);
+ }
+ /* (non-Javadoc)
+ * Method declared on CellEditor.
+ */
+ protected void doSetFocus()
+ {
+ comboBox.setFocus();
+ }
+ /**
+ * The ComboBoxCellEditor
implementation of
+ * this CellEditor
framework method
+ * accepts a zero-based index of a selection.
+ *
+ * @param value the zero-based index of the selection wrapped
+ * as an Integer
+ */
+ protected void doSetValue(Object value)
+ {
+ System.out.println("in doSetValue: " + comboBox + ", " + value);
+ if (!(value instanceof Integer))
+ {
+ return;
+ }
+ //Assert.isTrue(comboBox != null && (value instanceof Integer));
+ selection = ((Integer) value).intValue();
+ comboBox.select(selection);
+ }
+ /**
+ * Add the items to the combo box.
+ */
+ private void populateComboBoxItems()
+ {
+ if (comboBox != null && items != null)
+ {
+ comboBox.removeAll();
+ for (int i = 0; i < items.length; i++)
+ comboBox.add(items[i], i);
+ setValueValid(true);
+ }
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemComboBoxPropertyDescriptor.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemComboBoxPropertyDescriptor.java
new file mode 100644
index 00000000000..eb06f625e32
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemComboBoxPropertyDescriptor.java
@@ -0,0 +1,89 @@
+/********************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.views.properties.PropertyDescriptor;
+/**
+ * A variation of the Eclipse-supplied ComboBoxPropertyDescriptor for
+ * displaying properties are a list. This list will be different for each
+ * selected object, hence we need the ability to change that list as each
+ * object is selected.
+ */
+public class SystemComboBoxPropertyDescriptor
+ extends PropertyDescriptor
+{
+ private SystemComboBoxCellEditor editor;
+
+ /**
+ * The list of possible values to display in the combo box
+ */
+ protected String[] values;
+ /**
+ * Creates an property descriptor with the given id, display name, and list
+ * of value labels to display in the combo box cell editor.
+ *
+ * @param id the id of the property
+ * @param displayName the name to display for the property
+ * @param valuesArray the list of possible values to display in the combo box
+ */
+ public SystemComboBoxPropertyDescriptor(Object id, String displayName, String[] valuesArray)
+ {
+ super(id, displayName);
+ values = valuesArray;
+ }
+ /**
+ * Creates an property descriptor with the given id, display name, but no list.
+ * You must call setValues.
+ *
+ * @param id the id of the property
+ * @param displayName the name to display for the property
+ */
+ public SystemComboBoxPropertyDescriptor(Object id, String displayName)
+ {
+ super(id, displayName);
+ }
+ /**
+ * The ComboBoxPropertyDescriptor
implementation of this
+ * IPropertyDescriptor
method creates and returns a new
+ * ComboBoxCellEditor
.
+ * TextCellEditor
implementation of
+ * this CellEditor
framework method accepts
+ * a SystemInheritablePropertyData data object.
+ *
+ * @param value a SystemInheritablePropertyData object
+ */
+ protected void doSetValue(Object value)
+ {
+ Assert.isTrue(text != null && (value instanceof SystemInheritablePropertyData));
+ textField.removeModifyListener(getModifyListener());
+ data = (SystemInheritablePropertyData)value;
+ textField.setLocalText(data.getLocalValue());
+ textField.setInheritedText(data.getInheritedValue());
+ textField.setLocal(data.getIsLocal());
+ textField.addModifyListener(getModifyListener());
+ }
+ /**
+ * Processes a modify event that occurred in this text cell editor.
+ * This framework method performs validation and sets the error message
+ * accordingly, and then reports a change via fireEditorValueChanged
.
+ * Subclasses should call this method at appropriate times. Subclasses
+ * may extend or reimplement.
+ *
+ * @param e the SWT modify event
+ */
+ protected void editOccured(ModifyEvent e)
+ {
+ String value = text.getText();
+ if (value == null)
+ value = "";
+ Object typedValue = value;
+ boolean oldValidState = isValueValid();
+ boolean newValidState = isCorrect(typedValue);
+ if (!newValidState)
+ {
+ // try to insert the current value into the error message.
+ setErrorMessage(MessageFormat.format(getErrorMessage(), new Object[] {value}));
+ }
+ valueChanged(oldValidState, newValidState);
+ }
+ /**
+ * Since a text editor field is scrollable we don't
+ * set a minimumSize.
+ */
+ public LayoutData getLayoutData()
+ {
+ return new LayoutData();
+ }
+ /**
+ * Return the modify listener.
+ */
+ private ModifyListener getModifyListener()
+ {
+ if (modifyListener == null)
+ {
+ modifyListener = new ModifyListener() {
+ public void modifyText(ModifyEvent e)
+ {
+ editOccured(e);
+ }
+ };
+ }
+ return modifyListener;
+ }
+ /**
+ * The TextCellEditor
implementation of this
+ * CellEditor
method returns true
if
+ * the current selection is not empty.
+ */
+ public boolean isCopyEnabled()
+ {
+ if (text == null || text.isDisposed() || !text.isEnabled())
+ return false;
+ return text.getSelectionCount() > 0;
+ }
+ /**
+ * The TextCellEditor
implementation of this
+ * CellEditor
method returns true
if
+ * the current selection is not empty.
+ */
+ public boolean isCutEnabled()
+ {
+ if (text == null || text.isDisposed() || !text.isEnabled())
+ return false;
+ return text.getSelectionCount() > 0;
+ }
+ /**
+ * The TextCellEditor
implementation of this
+ * CellEditor
method returns true
+ * if there is a selection or if the caret is not positioned
+ * at the end of the text.
+ */
+ public boolean isDeleteEnabled()
+ {
+ if (text == null || text.isDisposed() || !text.isEnabled())
+ return false;
+ return text.getSelectionCount() > 0 || text.getCaretPosition() < text.getCharCount();
+ }
+ /**
+ * The TextCellEditor
implementation of this
+ * CellEditor
method always returns true
.
+ */
+ public boolean isPasteEnabled()
+ {
+ if (text == null || text.isDisposed() || !text.isEnabled())
+ return false;
+ return true;
+ }
+ /**
+ * The TextCellEditor
implementation of this
+ * CellEditor
method always returns true
.
+ */
+ public boolean isSaveAllEnabled()
+ {
+ if (text == null || text.isDisposed() || !text.isEnabled())
+ return false;
+ return true;
+ }
+ /**
+ * Returns true
if this cell editor is
+ * able to perform the select all action.
+ * false
.
+ * true
if select all is possible,
+ * false
otherwise
+ */
+ public boolean isSelectAllEnabled()
+ {
+ if (text == null || text.isDisposed() || !text.isEnabled())
+ return false;
+ return text.getText().length() > 0;
+ }
+ /**
+ * The TextCellEditor
implementation of this
+ * CellEditor
method copies the
+ * current selection to the clipboard.
+ */
+ public void performCopy()
+ {
+ text.copy();
+ }
+ /**
+ * The TextCellEditor
implementation of this
+ * CellEditor
method cuts the
+ * current selection to the clipboard.
+ */
+ public void performCut()
+ {
+ text.cut();
+ checkSelection();
+ checkDeleteable();
+ checkSelectable();
+ }
+ /**
+ * The TextCellEditor
implementation of this
+ * CellEditor
method deletes the
+ * current selection or, if there is no selection,
+ * the character next character from the current position.
+ */
+ public void performDelete()
+ {
+ if (text.getSelectionCount() > 0)
+ // remove the contents of the current selection
+ text.insert("");
+ else
+ {
+ // remove the next character
+ int pos = text.getCaretPosition();
+ if (pos < text.getCharCount())
+ {
+ text.setSelection(pos, pos + 1);
+ text.insert("");
+ }
+ }
+ checkSelection();
+ checkDeleteable();
+ checkSelectable();
+ }
+ /**
+ * The TextCellEditor
implementation of this
+ * CellEditor
method pastes the
+ * the clipboard contents over the current selection.
+ */
+ public void performPaste()
+ {
+ text.paste();
+ checkSelection();
+ checkDeleteable();
+ checkSelectable();
+ }
+ /**
+ * The TextCellEditor
implementation of this
+ * CellEditor
method selects all of the
+ * current text.
+ */
+ public void performSelectAll()
+ {
+ text.selectAll();
+ checkSelection();
+ checkDeleteable();
+ }
+
+ // Selection Listener methods for InheritableTextCellEditor toggle switches
+ public void widgetDefaultSelected(SelectionEvent e)
+ {
+ }
+ public void widgetSelected(SelectionEvent e)
+ {
+ //System.out.println("Got widget selected event. isLocal() = " + textField.isLocal()+", text='"+textField.getText()+"'");
+ boolean isLocal = textField.isLocal();
+ String value = text.getText();
+ data.setIsLocal(isLocal);
+ boolean oldValidState = isValueValid();
+ boolean newValidState = isLocal?isCorrect(value):true; //isCorrect(typedValue);
+ if (!newValidState)
+ {
+ // try to insert the current value into the error message.
+ setErrorMessage(MessageFormat.format(getErrorMessage(), new Object[] {value}));
+ }
+ valueChanged(oldValidState, newValidState);
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemInheritableTextPropertyDescriptor.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemInheritableTextPropertyDescriptor.java
new file mode 100644
index 00000000000..d3893b9d0fb
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemInheritableTextPropertyDescriptor.java
@@ -0,0 +1,113 @@
+/********************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.views.properties.PropertyDescriptor;
+/**
+ * A variation of the Eclipse-supplied TextPropertyDescriptor for
+ * displaying text string properties that are inheritable.
+ */
+public class SystemInheritableTextPropertyDescriptor
+ extends PropertyDescriptor
+{
+ private SystemInheritableTextCellEditor editor;
+ private String toggleButtonToolTipText, entryFieldToolTipText;
+ private boolean editable = true;
+
+ /**
+ * Creates a property descriptor with the given id, display name
+ *
+ * @param id the id of the property
+ * @param displayName the name to display for the property
+ */
+ public SystemInheritableTextPropertyDescriptor(Object id, String displayName)
+ {
+ super(id, displayName);
+ }
+ /**
+ * Call this with false in special circumstances to user's disable ability to edit this value.
+ * Default is true
+ * @see #getEditable()
+ */
+ public void setEditable(boolean allow)
+ {
+ editable = allow;
+ }
+ /**
+ * Query the allow-editing value. Default is true.
+ */
+ public boolean getEditable()
+ {
+ return editable;
+ }
+
+ /**
+ * Return an instance of SystemInheritableTextCellEditor, unless
+ * our editable property is false, in which case we return null;
+ */
+ public CellEditor createPropertyEditor(Composite parent)
+ {
+ if (!editable)
+ return null;
+ editor = new SystemInheritableTextCellEditor(parent);
+ if (getValidator() != null)
+ editor.setValidator(getValidator());
+ if (toggleButtonToolTipText != null)
+ editor.setToggleButtonToolTipText(toggleButtonToolTipText);
+ if (entryFieldToolTipText != null)
+ editor.setEntryFieldToolTipText(entryFieldToolTipText);
+ return editor;
+ }
+
+
+ /**
+ * Gets the toggleButtonToolTipText
+ * @return Returns a String
+ */
+ public String getToggleButtonToolTipText()
+ {
+ return toggleButtonToolTipText;
+ }
+ /**
+ * Sets the toggleButtonToolTipText
+ * @param toggleButtonToolTipText The toggleButtonToolTipText to set
+ */
+ public void setToggleButtonToolTipText(String toggleButtonToolTipText)
+ {
+ this.toggleButtonToolTipText = toggleButtonToolTipText;
+ }
+
+ /**
+ * Gets the entryFieldToolTipText
+ * @return Returns a String
+ */
+ public String getEntryFieldToolTipText()
+ {
+ return entryFieldToolTipText;
+ }
+ /**
+ * Sets the entryFieldToolTipText
+ * @param entryFieldToolTipText The entryFieldToolTipText to set
+ */
+ public void setEntryFieldToolTipText(String entryFieldToolTipText)
+ {
+ this.entryFieldToolTipText = entryFieldToolTipText;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemLongRunningRequestEvent.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemLongRunningRequestEvent.java
new file mode 100644
index 00000000000..4c620cd8b35
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemLongRunningRequestEvent.java
@@ -0,0 +1,34 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+import org.eclipse.swt.widgets.Event;
+
+/**
+ * An event object as passed for ISystemLongRunningRequestListener methods.
+ */
+public class SystemLongRunningRequestEvent extends Event
+{
+
+ /**
+ * Constructor for SystemLongRunningRequestEvent
+ */
+ public SystemLongRunningRequestEvent()
+ {
+ super();
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemPerspectiveLayout.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemPerspectiveLayout.java
new file mode 100644
index 00000000000..0a7a1729c9b
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemPerspectiveLayout.java
@@ -0,0 +1,91 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+
+
+
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.rse.ui.view.scratchpad.SystemScratchpadViewPart;
+import org.eclipse.rse.ui.view.team.SystemTeamViewPart;
+import org.eclipse.ui.IFolderLayout;
+import org.eclipse.ui.IPageLayout;
+import org.eclipse.ui.IPerspectiveFactory;
+
+
+/**
+ * This class is responsible for laying out the views in the RSE perspective
+ */
+public class SystemPerspectiveLayout implements IPerspectiveFactory
+{
+
+ public static final String ID = "org.eclipse.rse.ui.view.SystemPerspective"; // matches id in plugin.xml, layout tag
+ /**
+ * Defines the initial layout for a perspective.
+ * This method is only called when a new perspective is created. If
+ * an old perspective is restored from a persistence file then
+ * this method is not called.
+ *
+ * @param factory the factory used to add views to the perspective
+ */
+ public void createInitialLayout(IPageLayout layout)
+ {
+ String editorArea = layout.getEditorArea();
+
+ IFolderLayout folder= layout.createFolder("org.eclipse.rse.ui.view.NavFolder", IPageLayout.LEFT,
+ (float)0.25, editorArea);
+ //folder.addView(IPageLayout.ID_RES_NAV);
+ folder.addView(SystemViewPart.ID);
+ folder.addView(SystemTeamViewPart.ID);
+
+ folder= layout.createFolder("org.eclipse.rse.ui.view.MiscFolder", IPageLayout.BOTTOM,
+ (float).60, editorArea);
+
+ folder.addView(SystemTableViewPart.ID);
+ //folder.addView(SystemMonitorViewPart.ID);
+ folder.addView(IPageLayout.ID_TASK_LIST); // put in the desktop-supplied task list view
+
+
+ folder= layout.createFolder("org.eclipse.rse.ui.view.OutlineFolder", IPageLayout.RIGHT,
+ (float).80, editorArea);
+
+ folder.addView(IPageLayout.ID_OUTLINE); // put in desktop-supplied outline view
+ // unfortunately we can't do the following as snippets aren't in wswb, according to DKM
+ //folder.addView("com.ibm.sed.library.libraryView"); // NEW FOR 5.1.2: SNIPPETS VIEW. PSC
+
+ folder= layout.createFolder("org.eclipse.rse.ui.view.PropertiesFolder", IPageLayout.BOTTOM,
+ (float).75, "org.eclipse.rse.ui.view.NavFolder");
+ //layout.addView(IPageLayout.ID_PROP_SHEET, IPageLayout.BOTTOM,
+ // (float)0.75, "org.eclipse.rse.ui.view.NavFolder"); // put in desktop-supplied property sheet view
+ folder.addView(IPageLayout.ID_PROP_SHEET);
+ folder.addView(SystemScratchpadViewPart.ID);
+
+ // update Show View menu with our views
+ layout.addShowViewShortcut(SystemViewPart.ID);
+ layout.addShowViewShortcut(SystemTableViewPart.ID);
+
+ layout.addShowViewShortcut(SystemTableViewPart.ID);
+ layout.addShowViewShortcut(SystemViewPart.ID);
+ layout.addShowViewShortcut(IPageLayout.ID_PROP_SHEET);
+ // update Perspective Open menu with our perspective
+ layout.addPerspectiveShortcut(ID);
+
+ // Add action sets to the tool bar.
+ layout.addActionSet(IDebugUIConstants.LAUNCH_ACTION_SET);
+ layout.addActionSet(IDebugUIConstants.DEBUG_ACTION_SET);
+
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemPropertySheetForm.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemPropertySheetForm.java
new file mode 100644
index 00000000000..6e0740cfa0d
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemPropertySheetForm.java
@@ -0,0 +1,227 @@
+/********************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.rse.ui.messages.ISystemMessageLine;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+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.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.views.properties.PropertySheetPage;
+
+
+
+/**
+ * This re-usable widget is for a property-sheet widget that is imbeddable in dialogs.
+ * It is similar to the workbench property sheet but there are some important differences.
+ */
+public class SystemPropertySheetForm extends Composite
+{
+
+ private PropertySheetPage tree = null;
+ private boolean enabledMode = true;
+ //private ISystemViewInputProvider inputProvider = null;
+ //private ISystemViewInputProvider emptyProvider = new SystemEmptyListAPIProviderImpl();
+ public static final int DEFAULT_WIDTH = 300;
+ public static final int DEFAULT_HEIGHT = 250;
+
+ /**
+ * Constructor
+ * @param shell The owning window
+ * @param parent The owning composite
+ * @param style The swt style to apply to the overall composite. Typically SWT.NULL
+ * @param msgLine where to show messages and tooltip text
+ */
+ public SystemPropertySheetForm(Shell shell, Composite parent, int style, ISystemMessageLine msgLine)
+ {
+ this(shell, parent, style, msgLine, 1, 1);
+ }
+ /**
+ * Constructor when you want to span more than one column or row
+ * @param shell The owning window
+ * @param parent The owning composite
+ * @param style The swt style to apply to the overall composite. Typically SWT.NULL
+ * @param horizontalSpan how many columns in parent composite to span
+ * @param verticalSpan how many rows in parent composite to span
+ * @param msgLine where to show messages and tooltip text
+ */
+ public SystemPropertySheetForm(Shell shell, Composite parent, int style, ISystemMessageLine msgLine, int horizontalSpan, int verticalSpan)
+ {
+ super(parent, style);
+ prepareComposite(1, horizontalSpan, verticalSpan);
+ createPropertySheetView(shell);
+ addOurSelectionListener();
+ addOurMouseListener();
+ addOurKeyListener();
+ }
+
+ /**
+ * Return the system view tree viewer
+ */
+ public PropertySheetPage getPropertySheetView()
+ {
+ return tree;
+ }
+ /**
+ * Return the underlying control
+ */
+ public Control getControl()
+ {
+ return tree.getControl();
+ }
+
+ /**
+ * Set the tree's tooltip text
+ */
+ public void setToolTipText(String tip)
+ {
+ tree.getControl().setToolTipText(tip);
+ }
+ /**
+ * Refresh contents
+ */
+ public void refresh()
+ {
+ tree.refresh();
+ }
+
+ /**
+ * Method declared on ISelectionListener.
+ */
+ public void selectionChanged(ISelection selection)
+ {
+ tree.selectionChanged(null, selection);
+ }
+
+ /**
+ * Disable/Enable all the child controls.
+ */
+ public void setEnabled(boolean enabled)
+ {
+ enabledMode = enabled;
+ }
+
+ // -----------------------
+ // INTERNAL-USE METHODS...
+ // -----------------------
+ /**
+ * Prepares this composite control and sets the default layout data.
+ * @param Number of columns the new group will contain.
+ */
+ protected Composite prepareComposite(int numColumns,
+ int horizontalSpan, int verticalSpan)
+ {
+ Composite composite = this;
+ //GridLayout
+ GridLayout layout = new GridLayout();
+ layout.numColumns = numColumns;
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ layout.horizontalSpacing = 0;
+ layout.verticalSpacing = 0;
+ composite.setLayout(layout);
+ //GridData
+ GridData data = new GridData();
+ data.verticalAlignment = GridData.FILL;
+ data.horizontalAlignment = GridData.FILL;
+ data.grabExcessHorizontalSpace = true;
+ data.grabExcessVerticalSpace = true;
+ data.widthHint = DEFAULT_WIDTH;
+ data.heightHint = DEFAULT_HEIGHT;
+ data.horizontalSpan = horizontalSpan;
+ data.verticalSpan = verticalSpan;
+ composite.setLayoutData(data);
+ return composite;
+ }
+
+ protected void createPropertySheetView(Shell shell)
+ {
+ tree = new PropertySheetPage();
+ tree.createControl(this);
+ Control c = tree.getControl();
+ GridData treeData = new GridData();
+ treeData.horizontalAlignment = GridData.FILL;
+ treeData.verticalAlignment = GridData.FILL;
+ treeData.grabExcessHorizontalSpace = true;
+ treeData.grabExcessVerticalSpace = true;
+ treeData.widthHint = 220;
+ treeData.heightHint= 200;
+ c.setLayoutData(treeData);
+ //tree.setShowActions(showActions);
+
+ }
+
+
+ protected void addOurSelectionListener()
+ {
+ // Add the button listener
+ SelectionListener selectionListener = new SelectionListener()
+ {
+ public void widgetDefaultSelected(SelectionEvent event)
+ {
+ };
+ public void widgetSelected(SelectionEvent event)
+ {
+ if (!enabledMode)
+ return;
+ Object src = event.getSource();
+ };
+ };
+ //tree.getControl().addSelectionListener(selectionListener);
+ }
+
+ protected void addOurMouseListener()
+ {
+ MouseListener mouseListener = new MouseAdapter()
+ {
+ public void mouseDown(MouseEvent e)
+ {
+ if (!enabledMode)
+ return;
+ //requestActivation();
+ }
+ };
+ tree.getControl().addMouseListener(mouseListener);
+ }
+
+ protected void addOurKeyListener()
+ {
+ KeyListener keyListener = new KeyAdapter()
+ {
+ public void keyPressed(KeyEvent e)
+ {
+ if (!enabledMode)
+ {
+ //e.doit = false;
+ return;
+ }
+ //handleKeyPressed(e);
+ }
+ };
+ tree.getControl().addKeyListener(keyListener);
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemResolveFilterStringAPIProviderImpl.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemResolveFilterStringAPIProviderImpl.java
new file mode 100644
index 00000000000..eb3bdc0914b
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemResolveFilterStringAPIProviderImpl.java
@@ -0,0 +1,50 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+
+/**
+ * This class is a provider of root nodes to the remote systems tree viewer part.
+ * It is used when the contents are used to show the resolution of a single filter string.
+ */
+public class SystemResolveFilterStringAPIProviderImpl extends SystemTestFilterStringAPIProviderImpl
+{
+
+
+
+ /**
+ * Constructor
+ * @param subsystem The subsystem that will resolve the filter string
+ * @param filterString The filter string to test
+ */
+ public SystemResolveFilterStringAPIProviderImpl(ISubSystem subsystem, String filterString)
+ {
+ super(subsystem, filterString);
+ } // end constructor
+
+
+ /**
+ * Return true to show the button bar above the viewer.
+ * The tool bar contains "Get List" and "Refresh" buttons and is typicall
+ * shown in dialogs that list only remote system objects.
+ */
+ public boolean showButtonBar()
+ {
+ return false;
+ } // end showButtonBar()
+
+} // end class SystemResolveFilterStringAPIProviderImpl
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemResourceSelectionForm.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemResourceSelectionForm.java
new file mode 100644
index 00000000000..e19abeb66d9
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemResourceSelectionForm.java
@@ -0,0 +1,610 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.rse.core.SystemAdapterHelpers;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.filters.ISystemFilterReference;
+import org.eclipse.rse.model.IHost;
+import org.eclipse.rse.model.ISystemRegistry;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.SystemWidgetHelpers;
+import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
+import org.eclipse.rse.ui.messages.ISystemMessageLine;
+import org.eclipse.rse.ui.validators.IValidatorRemoteSelection;
+import org.eclipse.rse.ui.widgets.SystemHostCombo;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Point;
+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.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+
+public class SystemResourceSelectionForm implements ISelectionChangedListener
+{
+ private Shell _shell;
+ private boolean _multipleSelection = true;
+ protected static final int PROMPT_WIDTH = 400; // The maximum width of the dialog's prompt, in pixels.
+
+ private SystemResourceSelectionInputProvider _inputProvider;
+ private SystemHostCombo _connectionCombo;
+ private SystemViewForm _systemViewForm;
+ private Composite _propertySheetContainer;
+ protected SystemPropertySheetForm _ps;
+
+ private Text _pathText;
+ private boolean _isValid;
+ private ISystemMessageLine _msgLine;
+ protected Object previousSelection = null;
+ private IValidatorRemoteSelection _selectionValidator = null;
+ private boolean showPropertySheet = false;
+
+
+ protected Object caller;
+ protected boolean callerInstanceOfWizardPage, callerInstanceOfSystemPromptDialog;
+
+ protected String _verbage = null;
+ protected Label verbageLabel;
+ private Composite _container;
+
+ // history
+ private HashMap _history;
+
+ // outputs
+ protected IHost outputConnection = null;
+ protected Object[] outputObjects = null;
+
+
+ public SystemResourceSelectionForm(Shell shell, Composite parent, Object caller,
+ SystemResourceSelectionInputProvider inputProvider, String verbage,
+ boolean multipleSelection,
+ ISystemMessageLine msgLine)
+ {
+ _msgLine= msgLine;
+ _history = new HashMap();
+ _inputProvider = inputProvider;
+ _multipleSelection = multipleSelection;
+ _shell = shell;
+ _verbage = verbage;
+ this.caller = caller;
+ callerInstanceOfWizardPage = (caller instanceof WizardPage);
+ callerInstanceOfSystemPromptDialog = (caller instanceof SystemPromptDialog);
+
+ createControls(parent);
+ }
+
+ public void setMessageLine(ISystemMessageLine msgLine)
+ {
+ _msgLine = msgLine;
+ }
+
+ /**
+ * Return first selected object
+ */
+ public Object getSelectedObject()
+ {
+ if ((outputObjects != null) && (outputObjects.length>=1))
+ return outputObjects[0];
+ else
+ return null;
+ }
+ /**
+ * Return all selected objects.
+ * @see #setMultipleSelectionMode(boolean)
+ */
+ public Object[] getSelectedObjects()
+ {
+ return outputObjects;
+ }
+
+ public void createControls(Composite parent)
+ {
+ _container = SystemWidgetHelpers.createComposite(parent, showPropertySheet ? 2 : 1);
+ //Composite container = new Composite(parent, SWT.NULL);
+
+
+ // INNER COMPOSITE
+ int gridColumns = 2;
+ Composite composite_prompts = SystemWidgetHelpers.createFlushComposite(_container, gridColumns);
+
+ // PROPERTY SHEET COMPOSITE
+ if (showPropertySheet)
+ {
+ createPropertySheet(_container, _shell);
+ }
+
+
+ // MESSAGE/VERBAGE TEXT AT TOP
+ verbageLabel = (Label) SystemWidgetHelpers.createVerbage(composite_prompts, _verbage, gridColumns, false, PROMPT_WIDTH);
+
+
+ boolean allowMultipleConnnections = _inputProvider.allowMultipleConnections();
+ if (!allowMultipleConnnections)
+ {
+ //Label connectionLabel = SystemWidgetHelpers.createLabel(composite_prompts, _inputProvider.getSystemConnection().getHostName());
+ }
+ else
+ {
+ String[] systemTypes = _inputProvider.getSystemTypes();
+ if (systemTypes != null)
+ {
+ _connectionCombo = new SystemHostCombo(composite_prompts, SWT.NULL, _inputProvider.getSystemTypes(), _inputProvider.getSystemConnection(), _inputProvider.allNewConnection());
+ }
+ else
+ {
+ _connectionCombo = new SystemHostCombo(composite_prompts, SWT.NULL, "*", _inputProvider.getSystemConnection(), _inputProvider.allNewConnection());
+
+ }
+ _connectionCombo.addSelectionListener(new SelectionAdapter()
+ {
+ public void widgetSelected(SelectionEvent evt)
+ {
+ IHost connection = _connectionCombo.getHost();
+ connectionChanged(connection);
+ }}
+ );
+ }
+
+ _pathText = SystemWidgetHelpers.createReadonlyTextField(composite_prompts);
+ _systemViewForm = new SystemViewForm(_shell, composite_prompts, SWT.NULL, _inputProvider, !_multipleSelection, _msgLine);
+ _systemViewForm.addSelectionChangedListener(this);
+
+
+ GridLayout layout = new GridLayout();
+ GridData gdata = new GridData(GridData.FILL_BOTH);
+ composite_prompts.setLayout(layout);
+ composite_prompts.setLayoutData(gdata);
+
+ doInitializeFields();
+ }
+
+ private void doInitializeFields()
+ {
+ setPageComplete();
+ return;
+ }
+
+ /**
+ * Create the property sheet viewer
+ */
+ private void createPropertySheet(Composite outerParent, Shell shell)
+ {
+ _propertySheetContainer = SystemWidgetHelpers.createFlushComposite(outerParent, 1);
+ ((GridData)_propertySheetContainer.getLayoutData()).grabExcessVerticalSpace = true;
+ ((GridData)_propertySheetContainer.getLayoutData()).verticalAlignment = GridData.FILL;
+
+ // PROPERTY SHEET VIEWER
+ _ps = new SystemPropertySheetForm(shell,_propertySheetContainer, SWT.BORDER, _msgLine);
+ }
+
+ public Control getInitialFocusControl()
+ {
+ return _systemViewForm.getTreeControl();
+ }
+
+ public void applyViewerFilter(SystemActionViewerFilter filter)
+ {
+ if (filter != null)
+ {
+ _systemViewForm.getSystemView().addFilter(filter);
+ }
+ }
+
+ /**
+ * Completes processing of the wizard page or dialog. If this
+ * method returns true, the wizard/dialog will close;
+ * otherwise, it will stay active.
+ *
+ * @return true if no errors
+ */
+ public boolean verify()
+ {
+ if (_isValid)
+ {
+ if (_msgLine != null)
+ {
+ _msgLine.clearErrorMessage();
+ }
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ protected ISystemViewElementAdapter getAdapter(Object selection)
+ {
+ if (selection != null && selection instanceof IAdaptable)
+ {
+ return (ISystemViewElementAdapter)((IAdaptable)selection).getAdapter(ISystemViewElementAdapter.class);
+ }
+ return null;
+ }
+
+ protected ISystemRemoteElementAdapter getRemoteAdapter(Object selection)
+ {
+ if (selection != null && selection instanceof IAdaptable)
+ {
+ return SystemAdapterHelpers.getRemoteAdapter(selection);
+ }
+ return null;
+ }
+
+ protected ISystemRemoteElementAdapter[] getRemoteAdapters(ISelection selection)
+ {
+ Object[] selectedObjects = getSelections(selection);
+ ISystemRemoteElementAdapter[] adapters = new ISystemRemoteElementAdapter[selectedObjects.length];
+ for (int idx=0; idx
+ *
+ * false
otherwise.
+ * @return true
if there is an ancestry relationship, false
otherwise.
+ */
+ private boolean isAncestorOf(TreeItem container, TreeItem item, boolean direct)
+ {
+ TreeItem[] children = null;
+
+ // does not have to be a direct ancestor
+ if (!direct) {
+ // get the children of the container's parent, i.e. the container's siblings
+ // as well as itself
+ TreeItem parent = container.getParentItem();
+
+ // check if parent is null
+ // parent is null if the container is a root item
+ if (parent != null) {
+ children = parent.getItems();
+ }
+ else {
+ children = getTree().getItems();
+ }
+ }
+ // must be a direct ancestor
+ else {
+ // get the children of the container
+ children = container.getItems();
+ }
+
+ // go through all the children
+ for (int i = 0; i < children.length; i++) {
+
+ TreeItem child = children[i];
+
+ // if one of the children matches the child item, return true
+ if (child == item && direct) {
+ return true;
+ }
+ // otherwise, go through children, and see if any of those are ancestors of
+ // the child item
+ else if (child.getItemCount() > 0) {
+
+ // we check for direct ancestry
+ if (isAncestorOf(child, item, true)) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * --------------------------------------------------------------------------------
+ * For many actions we have to walk the selection list and examine each selected
+ * object to decide if a given common action is supported or not.
+ * null
is returned.
+ */
+ public String getErrorMessage()
+ {
+ return _errorMessage;
+ }
+ /**
+ * Get the currently displayed message.
+ * @return The message. If no message is displayed null
is returned.
+ */
+ public String getMessage()
+ {
+ return _message;
+ }
+ /**
+ * Display the given error message. A currently displayed message
+ * is saved and will be redisplayed when the error message is cleared.
+ */
+ public void setErrorMessage(String message)
+ {
+ this._errorMessage = message;
+ if (_statusLine != null)
+ _statusLine.setErrorMessage(message);
+ }
+ /**
+ * Get the currently displayed error text.
+ * @return The error message. If no error message is displayed
if structural changes are to be picked up,
+ * and null
is returned.
+ */
+ public SystemMessage getSystemErrorMessage()
+ {
+ return sysErrorMessage;
+ }
+
+ /**
+ * Display the given error message. A currently displayed message
+ * is saved and will be redisplayed when the error message is cleared.
+ */
+ public void setErrorMessage(SystemMessage message)
+ {
+ sysErrorMessage = message;
+ setErrorMessage(message.getLevelOneText());
+ }
+ /**
+ * Display the given error message. A currently displayed message
+ * is saved and will be redisplayed when the error message is cleared.
+ */
+ public void setErrorMessage(Throwable exc)
+ {
+ setErrorMessage(exc.getMessage());
+ }
+
+ /**
+ * Set the message text. If the message line currently displays an error,
+ * the message is stored and will be shown after a call to clearErrorMessage
+ */
+ public void setMessage(String message)
+ {
+ this._message = message;
+ if (_statusLine != null)
+ _statusLine.setMessage(message);
+ }
+ /**
+ *If the message line currently displays an error,
+ * the message is stored and will be shown after a call to clearErrorMessage
+ */
+ public void setMessage(SystemMessage message)
+ {
+ setMessage(message.getLevelOneText());
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableViewProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableViewProvider.java
new file mode 100644
index 00000000000..37473ae3641
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableViewProvider.java
@@ -0,0 +1,354 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.util.ListenerList;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.rse.core.SystemAdapterHelpers;
+import org.eclipse.rse.model.ISystemContainer;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+
+
+
+/**
+ * This is the content and label provider for the SystemTableView.
+ * This class is used both to populate the SystemTableView but also
+ * to resolve the icon and labels for the cells in the table.
+ *
+ */
+public class SystemTableViewProvider implements ILabelProvider, ITableLabelProvider, ITreeContentProvider
+{
+
+
+ private ListenerList listeners = new ListenerList(1);
+
+ protected Object[] _lastResults = null;
+ protected Object _lastObject = null;
+ protected SimpleDateFormat _dateFormat = new SimpleDateFormat();
+ protected Viewer _viewer = null;
+ protected int _maxCharsInColumnZero = 0;
+
+ /**
+ * The cache of images that have been dispensed by this provider.
+ * Maps ImageDescriptor->Image.
+ */
+ private Map imageTable = new Hashtable(40);
+ private SystemTableViewColumnManager _columnManager;
+ private HashMap cache;
+ /**
+ * Constructor for table view provider where a column manager is present.
+ * In this case, the columns are customizable by the user.
+ * @param columnManager
+ */
+ public SystemTableViewProvider(SystemTableViewColumnManager columnManager)
+ {
+ super();
+ _columnManager= columnManager;
+ cache = new HashMap();
+ }
+
+ /**
+ * Constructor for table view provider where a column manager is not present.
+ * In this case, the column can not be customized
+ * @param columnManager
+ */
+ public SystemTableViewProvider()
+ {
+ super();
+ _columnManager= null;
+ }
+
+
+ public void inputChanged(Viewer visualPart, Object oldInput, Object newInput)
+ {
+ _viewer = visualPart;
+ }
+
+
+
+
+
+
+ public boolean isDeleted(Object element)
+ {
+ return false;
+ }
+
+ public Object[] getChildren(Object object)
+ {
+ return getElements(object);
+ }
+
+ public Object getParent(Object object)
+ {
+ return getAdapterFor(object).getParent(object);
+ }
+
+ public boolean hasChildren(Object object)
+ {
+ return false;
+ }
+
+ public Object getElementAt(Object object, int i)
+ {
+
+ return null;
+ }
+
+ protected ISystemViewElementAdapter getAdapterFor(Object object)
+ {
+ ISystemViewElementAdapter result = null;
+ if (_viewer != null)
+ {
+ result = SystemAdapterHelpers.getAdapter(object, _viewer);
+ }
+ else
+ {
+ result = SystemAdapterHelpers.getAdapter(object);
+ }
+ result.setPropertySourceInput(object);
+ return result;
+ }
+
+ public Object[] getElements(Object object)
+ {
+ Object[] results = null;
+ if (object == _lastObject && _lastResults != null)
+ {
+ return _lastResults;
+ }
+ else
+ if (object instanceof IAdaptable)
+ {
+ ISystemViewElementAdapter adapter = getAdapterFor(object);
+ if (adapter != null)
+ {
+ adapter.setViewer(_viewer);
+ results = adapter.getChildren(object);
+ if (adapter instanceof SystemViewRootInputAdapter)
+ {
+ ArrayList filterredResults = new ArrayList();
+ for (int i = 0; i < results.length; i++)
+ {
+ Object result = results[i];
+ ISystemViewElementAdapter cadapter = getAdapterFor(result);
+ if (!(cadapter instanceof SystemViewPromptableAdapter))
+ {
+ filterredResults.add(result);
+ }
+ }
+ results = filterredResults.toArray();
+ }
+
+ _lastResults = results;
+ _lastObject = object;
+ }
+ }
+ if (results == null)
+ {
+ return new Object[0];
+ }
+
+ return results;
+ }
+
+ public String getText(Object object)
+ {
+ String result = getAdapterFor(object).getText(object);
+ int len = result.length();
+ if (len > _maxCharsInColumnZero)
+ {
+ _maxCharsInColumnZero = len;
+ }
+ return result;
+ }
+
+ public int getMaxCharsInColumnZero()
+ {
+ return _maxCharsInColumnZero;
+ }
+
+ public Image getImage(Object object)
+ {
+ ImageDescriptor descriptor = getAdapterFor(object).getImageDescriptor(object);
+
+ Image image = null;
+ if (descriptor != null)
+ {
+ Object iobj = imageTable.get(descriptor);
+ if (iobj == null)
+ {
+ image = descriptor.createImage();
+ imageTable.put(descriptor, image);
+ }
+ else
+ {
+ image = (Image) iobj;
+ }
+ }
+ return image;
+ }
+
+ public String getColumnText(Object obj, int index)
+ {
+ if (index == 0)
+ {
+ // get the first descriptor
+ return getText(obj);
+ }
+ else
+ {
+
+ index = index - 1;
+ ISystemViewElementAdapter adapter = getAdapterFor(obj);
+
+ IPropertyDescriptor[] descriptors = null;
+ if (_columnManager != null)
+ {
+ descriptors = _columnManager.getVisibleDescriptors(adapter);
+ }
+ else
+ {
+ descriptors = adapter.getUniquePropertyDescriptors();
+ }
+
+ if (descriptors.length > index)
+ {
+ IPropertyDescriptor descriptor = descriptors[index];
+
+ try
+ {
+ Object key = descriptor.getId();
+
+ Object propertyValue = adapter.getPropertyValue(key);
+
+ if (propertyValue instanceof String)
+ {
+ return (String) propertyValue;
+ }
+ else if (propertyValue instanceof Date)
+ {
+ return _dateFormat.format((Date)propertyValue);
+ }
+ else
+ if (propertyValue != null)
+ {
+ return propertyValue.toString();
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ return "";
+ }
+
+ }
+
+ public Image getColumnImage(Object obj, int i)
+ {
+ if (i == 0)
+ {
+ return getImage(obj);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public void addListener(ILabelProviderListener listener)
+ {
+ listeners.add(listener);
+ }
+
+ public boolean isLabelProperty(Object element, String property)
+ {
+ return true;
+ }
+
+ public void removeListener(ILabelProviderListener listener)
+ {
+ listeners.remove(listener);
+ }
+
+ /**
+ * Cache the objects for the given parent.
+ * @param parent the parent object.
+ * @param children the children to cache.
+ */
+ public void setCachedObjects(Object parent, Object[] children) {
+ cache.put(parent, children);
+ }
+
+ /**
+ * Returns the cached objects for the given parent.
+ * @param parent the parent object.
+ * @return the cached children.
+ */
+ public Object[] getCachedObjects(Object parent) {
+ return (Object[])(cache.get(parent));
+ }
+
+
+ public void setCache(Object[] newCache)
+ {
+ _lastResults = newCache;
+ }
+
+ public Object[] getCache()
+ {
+ return _lastResults;
+ }
+
+ public boolean flushCache()
+ {
+ if (_lastResults == null)
+ {
+ return false;
+ }
+ if (_lastObject instanceof ISystemContainer)
+ {
+ ((ISystemContainer)_lastObject).markStale(true);
+ }
+
+ _lastResults = null;
+ return true;
+ }
+
+ public void dispose()
+ {
+ // TODO Auto-generated method stub
+
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableViewSorter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableViewSorter.java
new file mode 100644
index 00000000000..4f56981f241
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableViewSorter.java
@@ -0,0 +1,184 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+
+import java.util.Date;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.swt.widgets.Widget;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+
+/**
+ * This class is used for sorting in the SystemTableView. The sorter
+ * determines what and how to sort based on property descriptors.
+ *
+ */
+public class SystemTableViewSorter extends ViewerSorter
+{
+
+
+ private boolean _reverseSort;
+
+ private int _columnNumber;
+
+ private StructuredViewer _view;
+ private SystemTableViewColumnManager _columnManager;
+
+ public SystemTableViewSorter(int columnNumber, StructuredViewer view, SystemTableViewColumnManager columnManager)
+ {
+ super();
+ _reverseSort = false;
+ _columnNumber = columnNumber;
+ _view = view;
+ _columnManager = columnManager;
+ }
+
+ public boolean isSorterProperty(java.lang.Object element, java.lang.Object property)
+ {
+ return true;
+ }
+
+ public int category(Object element)
+ {
+ return 0;
+ }
+
+ public int getColumnNumber()
+ {
+ return _columnNumber;
+ }
+
+ public boolean isReversed()
+ {
+ return _reverseSort;
+ }
+
+ public void setReversed(boolean newReversed)
+ {
+ _reverseSort = newReversed;
+ }
+
+ public int compare(Viewer v, Object e1, Object e2)
+ {
+ Object name1 = getValueFor(e1, _columnNumber);
+ Object name2 = getValueFor(e2, _columnNumber);
+
+ try
+ {
+ Object n1 = name1;
+ Object n2 = name2;
+
+ if (n1.toString().length() == 0)
+ return 1;
+
+ if (isReversed())
+ {
+ n1 = name2;
+ n2 = name1;
+ }
+
+ if (n1 instanceof String)
+ {
+ return ((String) n1).compareTo((String) n2);
+ }
+ else if (n1 instanceof Date)
+ {
+ return ((Date) n1).compareTo((Date) n2);
+ }
+ else if (n1 instanceof Long)
+ {
+ return ((Long) n1).compareTo((Long) n2);
+ }
+ else if (n1 instanceof Integer)
+ {
+ return ((Integer) n1).compareTo((Integer) n2);
+ }
+ else
+ {
+ return collator.compare(n1, n2);
+ }
+ }
+ catch (Exception e)
+ {
+ return 0;
+ }
+
+ }
+
+ private Object getValueFor(Object obj, int index)
+ {
+ ISystemViewElementAdapter adapter = getAdapterFor(obj);
+ if (index == 0)
+ {
+ return adapter.getText(obj);
+ }
+
+ Widget widget = _view.testFindItem(obj);
+ if (widget != null)
+ {
+
+ }
+
+ index = index - 1;
+ IPropertyDescriptor[] descriptors = null;
+ if (_columnManager != null)
+ {
+ descriptors = _columnManager.getVisibleDescriptors(adapter);
+ }
+ else
+ {
+ descriptors = adapter.getUniquePropertyDescriptors();
+ }
+ if (descriptors.length > index)
+ {
+ IPropertyDescriptor descriptor = descriptors[index];
+
+ try
+ {
+ Object key = descriptor.getId();
+
+ Object propertyValue = adapter.getPropertyValue(key, false);
+ return propertyValue;
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ return "";
+ }
+
+ private ISystemViewElementAdapter getAdapterFor(Object object)
+ {
+ IAdaptable adapt = (IAdaptable) object;
+ if (adapt != null)
+ {
+ ISystemViewElementAdapter result = (ISystemViewElementAdapter) adapt.getAdapter(ISystemViewElementAdapter.class);
+ result.setPropertySourceInput(object);
+
+ return result;
+ }
+
+ return null;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTestFilterStringAPIProviderImpl.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTestFilterStringAPIProviderImpl.java
new file mode 100644
index 00000000000..58a70927a83
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTestFilterStringAPIProviderImpl.java
@@ -0,0 +1,175 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+import org.eclipse.rse.core.SystemBasePlugin;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.model.IHost;
+import org.eclipse.rse.model.ISystemMessageObject;
+import org.eclipse.rse.model.SystemMessageObject;
+import org.eclipse.rse.ui.ISystemMessages;
+
+
+/**
+ * This class is a provider of root nodes to the remote systems tree viewer part.
+ * It is used when the contents are used to show the resolution of a single filter string.
+ */
+public class SystemTestFilterStringAPIProviderImpl
+ extends SystemAbstractAPIProvider
+ implements ISystemViewInputProvider, ISystemMessages
+{
+
+
+ protected String filterString = null;
+ protected ISubSystem subsystem = null;
+ protected Object[] emptyList = new Object[0];
+ protected Object[] msgList = new Object[1];
+ protected SystemMessageObject nullObject = null;
+ protected SystemMessageObject canceledObject = null;
+ protected SystemMessageObject errorObject = null;
+ /**
+ * Constructor
+ * @param subsystem The subsystem that will resolve the filter string
+ * @param filterString The filter string to test
+ */
+ public SystemTestFilterStringAPIProviderImpl(ISubSystem subsystem, String filterString)
+ {
+ super();
+ this.subsystem = subsystem;
+ this.filterString = filterString;
+ }
+
+ private void initMsgObjects()
+ {
+ nullObject = new SystemMessageObject(SystemPlugin.getPluginMessage(MSG_EXPAND_EMPTY),ISystemMessageObject.MSGTYPE_EMPTY, null);
+ canceledObject = new SystemMessageObject(SystemPlugin.getPluginMessage(MSG_LIST_CANCELLED),ISystemMessageObject.MSGTYPE_CANCEL, null);
+ errorObject = new SystemMessageObject(SystemPlugin.getPluginMessage(MSG_EXPAND_FAILED),ISystemMessageObject.MSGTYPE_ERROR, null);
+ }
+
+ /**
+ * Change the input subsystem
+ */
+ public void setSubSystem(ISubSystem subsystem)
+ {
+ this.subsystem = subsystem;
+ }
+ /**
+ * Change the input filter string
+ */
+ public void setFilterString(String filterString)
+ {
+ this.filterString = filterString;
+ }
+
+ // ----------------------------------
+ // SYSTEMVIEWINPUTPROVIDER METHODS...
+ // ----------------------------------
+ /**
+ * Return the children objects to consistute the root elements in the system view tree.
+ * We return the result of asking the subsystem to resolve the filter string.
+ */
+ public Object[] getSystemViewRoots()
+ {
+ Object[] children = emptyList;
+ if (subsystem == null)
+ return children;
+ try
+ {
+ children = subsystem.resolveFilterString(filterString, shell);
+ if ((children == null) || (children.length==0))
+ {
+ if (nullObject == null)
+ initMsgObjects();
+ msgList[0] = nullObject;
+ children = msgList;
+ }
+ } catch (InterruptedException exc)
+ {
+ if (canceledObject == null)
+ initMsgObjects();
+ msgList[0] = canceledObject;
+ children = msgList;
+ } catch (Exception exc)
+ {
+ if (errorObject == null)
+ initMsgObjects();
+ msgList[0] = errorObject;
+ children = msgList;
+ SystemBasePlugin.logError("Error in SystemTestFilterStringAPIProviderImpl#getSystemViewRoots()",exc);
+ }
+ return children;
+ }
+ /**
+ * Return true if {@link #getSystemViewRoots()} will return a non-empty list
+ * We return true on the assumption the filter string will resolve to something.
+ */
+ public boolean hasSystemViewRoots()
+ {
+ return true;
+ }
+ /**
+ * This method is called by the connection adapter when the user expands
+ * a connection. This method must return the child objects to show for that
+ * connection.
+ * false
if only label provider changes are of interest
+ */
+ protected void ourInternalRefresh(Widget widget, Object element, boolean doStruct, boolean forceRemote, boolean doTimings)
+ {
+ final Widget fWidget = widget;
+ final Object fElement = element;
+ final boolean fDoStruct = doStruct;
+
+ // we have to take special care if one of our kids are selected and it is a remote object...
+ if (forceRemote || (isSelectionRemote() && isTreeItemSelectedOrChildSelected(widget)))
+ {
+ if (!isTreeItemSelected(widget)) // it is one of our kids that is selected
+ {
+ clearSelection(); // there is nothing much else we can do. Calling code will restore it anyway hopefully
+ doOurInternalRefresh(fWidget, fElement, fDoStruct, doTimings);
+ }
+ else // it is us that is selected. This might be a refresh selected operation. TreeItem address won't change
+ {
+ doOurInternalRefresh(fWidget, fElement, fDoStruct, doTimings);
+ }
+ }
+ else
+ {
+ final boolean finalDoTimings = doTimings;
+ preservingSelection(new Runnable()
+ {
+ public void run()
+ {
+ doOurInternalRefresh(fWidget, fElement, fDoStruct, finalDoTimings);
+ }
+ });
+ }
+ }
+ protected boolean isSelectionRemote()
+ {
+ ISelection s = getSelection();
+ if ((s!=null)&&(s instanceof IStructuredSelection))
+ {
+ IStructuredSelection ss = (IStructuredSelection)s;
+ Object firstSel = ss.getFirstElement();
+ if ((firstSel != null) && (getRemoteAdapter(firstSel) != null))
+ return true;
+ }
+ return false;
+ }
+ protected void doOurInternalRefresh(Widget widget, Object element, boolean doStruct, boolean doTimings)
+ {
+ if (debug)
+ {
+ logDebugMsg("in doOurInternalRefresh on " + getAdapter(element).getName(element));
+ logDebugMsg("...current selection is " + getFirstSelectionName(getSelection()));
+ }
+ SystemElapsedTimer timer = null;
+ if (doTimings)
+ timer = new SystemElapsedTimer();
+ if (widget instanceof Item)
+ {
+ //System.out.println("Inside doOurInternalRefresh. widget = " + ((TreeItem)widget).handle);
+ if (doStruct) {
+ updatePlus((Item)widget, element);
+ }
+ updateItem((Item)widget, element);
+ if (doTimings)
+ {
+ System.out.println("doOurInternalRefresh timer 1: time to updatePlus and updateItem:" + timer.setEndTime());
+ timer.setStartTime();
+ }
+ }
+
+ if (doStruct) {
+ // pass null for children, to allow updateChildren to get them only if needed
+ Object[] newChildren = null;
+ if ((widget instanceof Item) && getExpanded((Item)widget))
+ {
+ // DKM - get raw children does a query but so does internalRefresh()
+ // newChildren = getRawChildren(widget);
+ if (doTimings)
+ {
+ System.out.println("doOurInternalRefresh timer 2: time to getRawChildren:" + timer.setEndTime());
+ timer.setStartTime();
+ }
+ }
+ // DKM - without the else we get duplicate queries on expanded folder
+ // uncommented - seems new results after query aren't showing up
+ //else
+ {
+ internalRefresh(element);
+ }
+
+ if (doTimings)
+ {
+ System.out.println("doOurInternalRefresh timer 3: time to updateChildren:" + timer.setEndTime());
+ timer.setStartTime();
+ }
+ }
+ // recurse
+ Item[] children= getChildren(widget);
+ if (children != null)
+ {
+ //SystemElapsedTimer timer2 = null;
+ //int intervalCount = 0;
+ //if (doTimings)
+ //timer2 = new SystemElapsedTimer();
+ for (int i= 0; i < children.length; i++)
+ {
+ Widget item= children[i];
+ Object data= item.getData();
+ if (data != null)
+ doOurInternalRefresh(item, data, doStruct, false);
+ /*
+ if (doTimings)
+ {
+ ++intervalCount;
+ if (intervalCount == 1000)
+ {
+ System.out.println("...time to recurse next 1000 children: " + timer2.setEndTime());
+ intervalCount = 0;
+ timer2.setStartTime();
+ }
+ }*/
+ }
+ }
+ if (doTimings)
+ {
+ System.out.println("doOurInternalRefresh timer 4: time to recurse children:" + timer.setEndTime());
+ timer.setStartTime();
+ }
+ }
+ protected Object[] getRawChildren(Widget w)
+ {
+ Object parent = w.getData();
+ if (w != null)
+ {
+ if (parent.equals(getRoot()))
+ return super.getRawChildren(parent);
+ Object[] result = ((ITreeContentProvider) getContentProvider()).getChildren(parent);
+ if (result != null)
+ return result;
+ }
+ return new Object[0];
+ }
+
+ /*
+ protected void preservingSelection(Runnable updateCode)
+ {
+ super.preservingSelection(updateCode);
+ System.out.println("After preservingSelection: new selection = "+getFirstSelectionName(getSelection()));
+ }
+ protected void handleInvalidSelection(ISelection invalidSelection, ISelection newSelection)
+ {
+ System.out.println("Inside handleInvalidSelection: old = "+getFirstSelectionName(invalidSelection)+", new = "+getFirstSelectionName(newSelection));
+ updateSelection(newSelection);
+ }
+ */
+ protected String getFirstSelectionName(ISelection s)
+ {
+ if ((s!=null) && (s instanceof IStructuredSelection))
+ {
+ IStructuredSelection ss = (IStructuredSelection)s;
+ Object firstSel = ss.getFirstElement();
+ String name = null;
+ if (firstSel != null)
+ {
+ ISystemRemoteElementAdapter ra = getRemoteAdapter(firstSel);
+ if (ra != null)
+ name = ra.getAbsoluteName(firstSel);
+ else
+ name = getAdapter(firstSel).getName(firstSel);
+ }
+ return name;
+ }
+ else
+ return null;
+ }
+
+ /**
+ * Expand a remote object within the tree. Must be given its parent element within the tree,
+ * in order to uniquely find it. If not given this, we expand the first occurrence we find!
+ * @param remoteObject - either a remote object or a remote object absolute name
+ * @param subsystem - the subsystem that owns the remote objects, to optimize searches.
+ * @param parentobject - the parent that owns the remote objects, to optimize searches. Can
+ * be an object or the absolute name of a remote object.
+ * @return the tree item of the remote object if found and expanded, else null
+ */
+ public Item expandRemoteObject(Object remoteObject, ISubSystem subsystem, Object parentObject)
+ {
+ // given the parent? Should be easy
+ Item remoteItem = null;
+ if (parentObject != null)
+ {
+ Item parentItem = null;
+ if (parentObject instanceof Item)
+ parentItem = (Item)parentObject;
+ else if (parentObject instanceof String) // given absolute name of remote object
+ parentItem = findFirstRemoteItemReference((String)parentObject, subsystem, (Item)null); // search all roots for the parent
+ else // given actual remote object
+ {
+ ISystemRemoteElementAdapter ra = getRemoteAdapter(parentObject);
+ if (ra != null)
+ {
+ if (subsystem == null)
+ subsystem = ra.getSubSystem(parentObject);
+ parentItem = findFirstRemoteItemReference(ra.getAbsoluteName(parentObject), subsystem, (Item)null); // search all roots for the parent
+ }
+ else // else parent is not a remote object. Probably its a filter
+ {
+ Widget parentWidget = findItem(parentObject);
+ if (parentWidget instanceof Item)
+ parentItem = (Item)parentWidget;
+ }
+ }
+ // ok, we have the parent item! Hopefully!
+ if (remoteObject instanceof String)
+ remoteItem = findFirstRemoteItemReference((String)remoteObject, subsystem, parentItem);
+ else
+ remoteItem = findFirstRemoteItemReference(remoteObject, parentItem);
+ if (remoteItem == null)
+ return null;
+ setExpandedState(remoteItem.getData(), true);
+ }
+ else // not given a parent to refine search with. Better have a subsystem!!
+ {
+ remoteItem = null;
+ if (remoteObject instanceof String)
+ remoteItem = findFirstRemoteItemReference((String)remoteObject, subsystem, (Item)null);
+ else
+ {
+ ISystemRemoteElementAdapter ra = getRemoteAdapter(remoteObject);
+ if (ra != null)
+ {
+ if (subsystem == null)
+ subsystem = ra.getSubSystem(remoteObject);
+ remoteItem = findFirstRemoteItemReference(ra.getAbsoluteName(remoteObject), subsystem, (Item)null);
+ }
+ }
+ if (remoteItem == null)
+ return null;
+ setExpandedState(remoteItem.getData(), true);
+ }
+ return remoteItem;
+ }
+
+ /**
+ * Select a remote object or objects given the parent remote object (can be null) and subsystem (can be null)
+ * @param src - either a remote object, a remote object absolute name, or a vector of remote objects or remote object absolute names
+ * @param subsystem - the subsystem that owns the remote objects, to optimize searches.
+ * @param parentobject - the parent that owns the remote objects, to optimize searches.
+ * @return true if found and selected
+ */
+ public boolean selectRemoteObjects(Object src, ISubSystem subsystem, Object parentObject)
+ {
+ //String parentName = null;
+ // given a parent object? That makes it easy...
+ if (parentObject != null)
+ {
+ ISystemRemoteElementAdapter ra = getRemoteAdapter(parentObject);
+ if (ra != null)
+ {
+ //parentName = ra.getAbsoluteName(parentObject);
+ if (subsystem == null)
+ subsystem = ra.getSubSystem(parentObject);
+ Item parentItem = (Item)findFirstRemoteItemReference(parentObject, (Item)null); // search all roots for the parent
+ return selectRemoteObjects(src, subsystem, parentItem);
+ }
+ else // else parent is not a remote object. Probably its a filter
+ {
+ Item parentItem = null;
+ if (parentObject instanceof Item)
+ parentItem = (Item)parentObject;
+ else
+ {
+ Widget parentWidget = findItem(parentObject);
+ if (parentWidget instanceof Item)
+ parentItem = (Item)parentWidget;
+ }
+ if (parentItem != null)
+ return selectRemoteObjects(src, (ISubSystem)null, parentItem);
+ else
+ return false;
+ }
+ }
+ else
+ //return selectRemoteObjects(src, (SubSystem)null, (Item)null); // Phil test
+ return selectRemoteObjects(src, subsystem, (Item)null);
+ }
+ /**
+ * Select a remote object or objects given the parent remote object (can be null) and subsystem (can be null) and parent TreeItem to
+ * start the search at (can be null)
+ * @param src - either a remote object, a remote object absolute name, or a vector of remote objects or remote object absolute names
+ * @param subsystem - the subsystem that owns the remote objects, to optimize searches.
+ * @param parentItem - the parent at which to start the search to find the remote objects. Else, starts at the roots.
+ * @return true if found and selected
+ */
+ protected boolean selectRemoteObjects(Object src, ISubSystem subsystem, Item parentItem)
+ {
+ clearSelection();
+ Item selItem = null;
+
+ if (parentItem != null && parentItem.isDisposed()) {
+ return false;
+ }
+
+ if ((parentItem!=null) && !getExpanded(parentItem))
+ //setExpanded(parentItem, true);
+ setExpandedState(parentItem.getData(), true);
+
+ //System.out.println("SELECT_REMOTE: PARENT = " + parent + ", PARENTITEM = " + parentItem);
+ if (src instanceof Vector)
+ {
+ String elementName = null;
+ Vector selVector = (Vector)src;
+ ArrayList selItems = new ArrayList();
+ // our goal here is to turn the vector of names or remote objects into a collection of
+ // actual TreeItems we matched them on...
+ for (int idx=0; idxtrue
if the value of the specified property has changed
+ * from its original default value; false
otherwise.
+ */
+ public boolean isPropertySet(Object propertyObject)
+ {
+ String property = (String)propertyObject;
+ boolean changed = false;
+ if (property.equals(P_DEFAULTUSERID))
+ changed = changed_userId;
+ else if (property.equals(P_HOSTNAME))
+ changed = changed_hostName;
+ else if (property.equals(P_DESCRIPTION))
+ changed = changed_description;
+ return changed;
+ }
+
+ /**
+ * Called when user selects the reset button in property sheet.
+ */
+ public void resetPropertyValue(Object propertyObject)
+ {
+ //System.out.println("Inside resetPropertyValue in adapter");
+ String property = (String)propertyObject;
+ IHost conn = (IHost)propertySourceInput;
+ ISystemRegistry sr = SystemPlugin.getDefault().getSystemRegistry();
+
+ if (property.equals(P_DEFAULTUSERID))
+ {
+ //sr.updateConnection(null, conn, conn.getSystemType(), conn.getAliasName(),
+ // conn.getHostName(), conn.getDescription(), original_userId, USERID_LOCATION_CONNECTION);
+ updateDefaultUserId(conn, original_userIdData);
+ }
+ else if (property.equals(P_HOSTNAME))
+ {
+ sr.updateHost(null, conn, conn.getSystemType(), conn.getAliasName(),
+ original_hostName, conn.getDescription(), conn.getDefaultUserId(), USERID_LOCATION_NOTSET);
+ }
+ else if (property.equals(P_DESCRIPTION))
+ {
+ sr.updateHost(null, conn, conn.getSystemType(), conn.getAliasName(),
+ conn.getHostName(), original_description, conn.getDefaultUserId(), USERID_LOCATION_NOTSET);
+ }
+ }
+ /**
+ * Change the default user Id value
+ */
+ private void updateDefaultUserId(IHost conn, SystemInheritablePropertyData data)
+ {
+ int whereToUpdate = USERID_LOCATION_CONNECTION;
+ //if (!data.getIsLocal())
+ //whereToUpdate = USERID_LOCATION_DEFAULT_SYSTEMTYPE;
+ String userId = data.getLocalValue(); // will be "" if !data.getIsLocal(), which results in wiping out local override
+ ISystemRegistry sr = SystemPlugin.getDefault().getSystemRegistry();
+ sr.updateHost(null, conn, conn.getSystemType(), conn.getAliasName(),
+ conn.getHostName(), conn.getDescription(), userId, whereToUpdate);
+ }
+
+ /**
+ * Called when user changes property via property sheet.
+ */
+ public void setPropertyValue(Object property, Object value)
+ {
+ String name = (String)property;
+ IHost conn = (IHost)propertySourceInput;
+ ISystemRegistry sr = SystemPlugin.getDefault().getSystemRegistry();
+
+ if (name.equals(P_DEFAULTUSERID))
+ {
+ //System.out.println("Testing setPropertyValue: " + value);
+ //sr.updateConnection(null, conn, conn.getSystemType(), conn.getAliasName(),
+ // conn.getHostName(), conn.getDescription(), (String)value, USERID_LOCATION_CONNECTION);
+ updateDefaultUserId(conn, (SystemInheritablePropertyData)value);
+ changed_userId = true;
+ }
+ else if (name.equals(P_HOSTNAME))
+ {
+ // DKM - don't update unless it really changed
+ // defect 57739
+ if (!((String)value).equalsIgnoreCase(conn.getHostName()))
+ {
+ sr.updateHost(null, conn, conn.getSystemType(), conn.getAliasName(),
+ (String)value, conn.getDescription(), conn.getDefaultUserId(), USERID_LOCATION_NOTSET);
+ changed_hostName = true;
+ }
+ }
+ else if (name.equals(P_DESCRIPTION))
+ {
+ // DKM - don't update unless it really changed
+ // defect 57739
+ if (!((String)value).equalsIgnoreCase(conn.getDescription()))
+ {
+ sr.updateHost(null, conn, conn.getSystemType(), conn.getAliasName(),
+ conn.getHostName(), (String)value, conn.getDefaultUserId(), USERID_LOCATION_NOTSET);
+ changed_description = true;
+ }
+ }
+ }
+
+ // FOR COMMON DELETE ACTIONS
+ /**
+ * Return true if this object is deletable by the user. If so, when selected,
+ * the Edit->Delete menu item will be enabled.
+ */
+ public boolean canDelete(Object element)
+ {
+ if (element instanceof IHost)
+ {
+ IHost sysCon = (IHost) element;
+ if (sysCon.getSystemType().equals(ISystemTypes.SYSTEMTYPE_LOCAL)) return existsMoreThanOneLocalConnection();
+ ISystemRegistry sr = SystemPlugin.getDefault().getSystemRegistry();
+ return !sr.isAnySubSystemConnected((IHost)element);
+ }
+ return true;
+ }
+
+ protected boolean existsMoreThanOneLocalConnection()
+ {
+ IHost[] localCons = SystemPlugin.getDefault().getSystemRegistry().getHostsBySystemType(ISystemTypes.SYSTEMTYPE_LOCAL);
+ return localCons.length > 1;
+ }
+
+ /**
+ * Perform the delete action.
+ */
+ public boolean doDelete(Shell shell, Object element, IProgressMonitor monitor)
+ {
+ boolean ok = true;
+ IHost conn = (IHost)element;
+ ISystemRegistry sr = SystemPlugin.getDefault().getSystemRegistry();
+ sr.deleteHost(conn);
+ return ok;
+ }
+
+ // FOR COMMON RENAME ACTIONS
+ /**
+ * Return true if this object is renamable by the user. If so, when selected,
+ * the Rename popup menu item will be enabled.
+ */
+ public boolean canRename(Object element)
+ {
+ return true; // all connections are renamable
+ }
+ /**
+ * Perform the rename action.
+ */
+ public boolean doRename(Shell shell, Object element, String name) throws Exception
+ {
+ boolean ok = true;
+ IHost conn = (IHost)element;
+ ISystemRegistry sr = SystemPlugin.getDefault().getSystemRegistry();
+ sr.renameHost(conn,name); // renames and saves to disk
+ return ok;
+ }
+ /**
+ * Return a validator for verifying the new name is correct.
+ */
+ public ISystemValidator getNameValidator(Object element)
+ {
+ IHost conn = (IHost)element;
+ //return org.eclipse.rse.core.ui.SystemConnectionForm.getConnectionNameValidator(conn); defect 42117
+ return org.eclipse.rse.ui.SystemConnectionForm.getConnectionNameValidator(conn.getSystemProfile());
+ }
+ /**
+ * Parent override.
+ *
+ * Used in the {@link org.eclipse.rse.ui.widgets.SystemSelectConnectionForm} class.
+ */
+public class SystemViewConnectionSelectionInputProvider extends SystemAbstractAPIProvider
+{
+ private boolean showNew = true;
+ private SystemNewConnectionPromptObject newConnPrompt;
+ private Object[] newConnPromptArray;
+ private String[] systemTypes;
+
+ /**
+ * Constructor
+ */
+ public SystemViewConnectionSelectionInputProvider()
+ {
+ super();
+ }
+
+ /**
+ * Specify if the New Connection prompt is to be shown.
+ * Default is true.
+ */
+ public void setShowNewConnectionPrompt(boolean show)
+ {
+ this.showNew = show;
+ }
+ /**
+ * Query whether the New Connection prompt is to be shown or not.
+ */
+ public boolean getShowNewConnectionPrompt()
+ {
+ return showNew;
+ }
+ /**
+ * Set the system types to restrict by
+ */
+ public void setSystemTypes(String[] systemTypes)
+ {
+ this.systemTypes = systemTypes;
+ }
+ /**
+ * Return the system types we are restricted by
+ */
+ public String[] getSystemTypes()
+ {
+ return systemTypes;
+ }
+
+ // REQUIRED METHODS...
+
+ /**
+ * @see org.eclipse.rse.ui.view.ISystemViewInputProvider#getSystemViewRoots()
+ */
+ public Object[] getSystemViewRoots()
+ {
+ //System.out.println("Inside getSystemViewRoots. showNew = "+showNew);
+ IHost[] conns = null;
+ if (systemTypes == null)
+ conns = SystemPlugin.getTheSystemRegistry().getHosts();
+ else
+ conns = SystemPlugin.getTheSystemRegistry().getHostsBySystemTypes(systemTypes);
+ if (showNew)
+ {
+ if ((conns == null) || (conns.length == 0))
+ {
+ return getNewConnectionPromptObjectAsArray();
+ }
+ else
+ {
+ Object[] allChildren = new Object[conns.length+1];
+ allChildren[0] = getNewConnectionPromptObject();
+ for (int idx=0; idx
+ * From IActionFilter so the popupMenus extension point can use <filter>, <enablement>
+ * or <visibility>. We add support is for the following:
+ *
+ *
+ */
+ public boolean testAttribute(Object target, String name, String value)
+ {
+ if (name.equalsIgnoreCase("filterType"))
+ {
+ ISystemFilter filter = getFilter(target);
+ String type = filter.getType();
+ if ((type == null) || (type.length() == 0))
+ return false;
+ else
+ return value.equals(type);
+ }
+ else if (name.equalsIgnoreCase("showChangeFilterStringPropertyPage"))
+ {
+ ISystemFilter filter = getFilter(target);
+ ISubSystemConfiguration ssf = SubSystemHelpers.getParentSubSystemFactory(filter);
+ if (value.equals("true"))
+ return ssf.showChangeFilterStringsPropertyPage(filter);
+ else
+ return !ssf.showChangeFilterStringsPropertyPage(filter);
+ }
+ else
+ return super.testAttribute(target, name, value);
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewFilterPoolAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewFilterPoolAdapter.java
new file mode 100644
index 00000000000..7b417b972d2
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewFilterPoolAdapter.java
@@ -0,0 +1,286 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+import java.util.Vector;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
+import org.eclipse.rse.core.subsystems.SubSystemHelpers;
+import org.eclipse.rse.core.subsystems.util.ISubsystemConfigurationAdapter;
+import org.eclipse.rse.filters.ISystemFilterPool;
+import org.eclipse.rse.filters.ISystemFilterPoolManager;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.SystemMenuManager;
+import org.eclipse.rse.ui.validators.ISystemValidator;
+import org.eclipse.rse.ui.validators.ValidatorFilterPoolName;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.PropertyDescriptor;
+
+
+/**
+ * Adapter for displaying SystemFilterPool objects in tree views.
+ * These are the masters, and only shown in work-with for the master.
+ * These are children of SubSystemFactory objects
+ */
+public class SystemViewFilterPoolAdapter extends AbstractSystemViewAdapter implements ISystemViewElementAdapter
+{
+ protected String translatedType;
+ //protected Object parent;
+
+ // for reset property support
+ //private String original_userId, original_port;
+ // -------------------
+ // property descriptors
+ // -------------------
+ private static PropertyDescriptor[] propertyDescriptorArray = null;
+
+ /**
+ * Returns any actions that should be contributed to the popup menu
+ * for the given subsystem object.
+ * Calls the method getActions on the subsystem's factory, and places
+ * all action objects returned from the call, into the menu.
+ * @param menu The menu to contribute actions to
+ * @param selection The window's current selection.
+ * @param shell Shell of viewer
+ * @param menuGroup recommended menu group to add actions to. If added to another group, you must be sure to create that group first.
+ */
+ public void addActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup)
+ {
+ //if (selection.size() != 1)
+ // return; // does not make sense adding unique actions per multi-selection
+ ISystemFilterPool pool = ((ISystemFilterPool)selection.getFirstElement());
+ ISubSystemConfiguration ssFactory = SubSystemHelpers.getParentSubSystemFactory(pool);
+ ISubsystemConfigurationAdapter adapter = (ISubsystemConfigurationAdapter)ssFactory.getAdapter(ISubsystemConfigurationAdapter.class);
+ IAction[] actions = adapter.getFilterPoolActions(ssFactory, pool, shell);
+ if (actions != null)
+ {
+ for (int idx=0; idx
+ * Returns the subsystem that contains this object.
+ */
+ public ISubSystem getSubSystem(Object element)
+ {
+ return ((ISubSystem)getFilterPoolReference(element).getProvider());
+ }
+
+
+ /**
+ * Returns an image descriptor for the image. More efficient than getting the image.
+ * @param element The element for which an image is desired
+ */
+ public ImageDescriptor getImageDescriptor(Object element)
+ {
+ ImageDescriptor poolImage = null;
+ ISystemFilterPool pool = getFilterPool(element);
+ if (pool.getProvider() != null)
+ {
+ ISubsystemConfigurationAdapter adapter = (ISubsystemConfigurationAdapter)pool.getProvider().getAdapter(ISubsystemConfigurationAdapter.class);
+ poolImage = adapter.getSystemFilterPoolImage(pool);
+ }
+ if (poolImage == null)
+ poolImage = SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_FILTERPOOL_ID);
+ return poolImage;
+ }
+
+ private ISystemFilterPoolReference getFilterPoolReference(Object element)
+ {
+ return (ISystemFilterPoolReference)element; // get referenced object
+ }
+
+ private ISystemFilterPool getFilterPool(Object element)
+ {
+ return getFilterPoolReference(element).getReferencedFilterPool(); // get master object
+ }
+
+
+ /**
+ * Return the label for this object. Uses getName() on the filter pool object.
+ */
+ public String getText(Object element)
+ {
+ boolean qualifyNames = SystemPlugin.getTheSystemRegistry().getQualifiedHostNames();
+ if (!qualifyNames)
+ return getFilterPool(element).getName();
+ else
+ return SubSystemHelpers.getParentSystemProfile(getFilterPool(element))+"." + getFilterPool(element).getName();
+ }
+ /**
+ * Return the name of this object, which may be different than the display text ({#link #getText(Object)}.
+ *
+ * Returns the subsystem that contains this object.
+ */
+ public ISubSystem getSubSystem(Object element)
+ {
+ if (element instanceof ISystemFilterReference)
+ return (ISubSystem) (((ISystemFilterReference) element).getProvider());
+ else
+ return null;
+ }
+ /**
+ * Returns an image descriptor for the image. More efficient than getting the image.
+ * @param element The element for which an image is desired
+ */
+ public ImageDescriptor getImageDescriptor(Object element)
+ {
+ //return SystemPlugin.getDefault().getImageDescriptor(ISystemConstants.ICON_SYSTEM_FILTER_ID);
+ ImageDescriptor filterImage = null;
+ ISystemFilter filter = getFilter(element);
+ if (filter.getProvider() != null) // getProvider() returns the subsystem factory
+ {
+
+ ISubsystemConfigurationAdapter adapter = (ISubsystemConfigurationAdapter)filter.getProvider().getAdapter(ISubsystemConfigurationAdapter.class);
+ filterImage = adapter.getSystemFilterImage(filter);
+ }
+ if (filterImage == null)
+ filterImage = SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_FILTER_ID);
+ return filterImage;
+ }
+
+ private ISystemFilterReference getFilterReference(Object element)
+ {
+ return (ISystemFilterReference) element; // get referenced object
+ }
+ private ISystemFilter getFilter(Object element)
+ {
+ return getFilterReference(element).getReferencedFilter(); // get master object
+ }
+
+ /**
+ * Return the label for this object. Uses getName() on the filter pool object.
+ */
+ public String getText(Object element)
+ {
+ return getFilter(element).getName();
+ }
+ /**
+ * Return the name of this object, which may be different than the display text ({#link #getText(Object)}.
+ *
+ *
+ */
+ public Object[] getChildren(IProgressMonitor monitor, Object element)
+ {
+ return internalGetChildren(monitor, element);
+ }
+
+ /**
+ * Return the children of this object.
+ * For filters, this is one or more of:
+ *
+ *
+ */
+ public Object[] getChildren(Object element)
+ {
+ return internalGetChildren(null, element);
+ }
+
+ /*
+ * Returns the children of the specified element. If a monitor is passed in then
+ * the context is assumed to be modal and, as such, the modal version of ss.resolveFilterStrings
+ * is called rather than the main thread version.
+ */
+ protected Object[] internalGetChildren(IProgressMonitor monitor, Object element)
+ {
+ Object[] children = null;
+ ISystemFilterReference fRef = getFilterReference(element);
+ ISystemFilter referencedFilter = fRef.getReferencedFilter();
+ boolean promptable = referencedFilter.isPromptable();
+
+ ISubSystem ss = fRef.getSubSystem();
+ ISubSystemConfiguration ssf = SubSystemHelpers.getParentSubSystemFactory(referencedFilter);
+
+ // PROMPTING FILTER?...
+ if (promptable)
+ {
+ children = new SystemMessageObject[1];
+ try
+ {
+ ISubsystemConfigurationAdapter adapter = (ISubsystemConfigurationAdapter)ssf.getAdapter(ISubsystemConfigurationAdapter.class);
+
+ ISystemFilter newFilter = adapter.createFilterByPrompting(ssf, fRef, getShell());
+ if (newFilter == null)
+ {
+ children[0] = new SystemMessageObject(SystemPlugin.getPluginMessage(MSG_EXPAND_CANCELLED), ISystemMessageObject.MSGTYPE_CANCEL, element);
+ }
+ else // filter successfully created!
+ {
+ // return "filter created successfully" message object for this node
+ children[0] = new SystemMessageObject(SystemPlugin.getPluginMessage(MSG_EXPAND_FILTERCREATED), ISystemMessageObject.MSGTYPE_OBJECTCREATED, element);
+ // select the new filter reference...
+ ISystemFilterReference sfr = fRef.getParentSystemFilterReferencePool().getExistingSystemFilterReference(ss, newFilter);
+ ISystemViewInputProvider inputProvider = getInput();
+ if ((sfr != null) && (inputProvider != null) && (inputProvider.getViewer() != null))
+ {
+ ISystemRegistry sr = SystemPlugin.getTheSystemRegistry();
+ SystemResourceChangeEvent event = new SystemResourceChangeEvent(sfr, ISystemResourceChangeEvents.EVENT_SELECT_EXPAND, null);
+ Viewer v = inputProvider.getViewer();
+ if (v instanceof ISystemResourceChangeListener)
+ {
+ //sr.fireEvent((ISystemResourceChangeListener)v, event); // only expand in the current viewer, not all viewers!
+ sr.postEvent((ISystemResourceChangeListener) v, event); // only expand in the current viewer, not all viewers!
+ }
+ }
+ }
+ }
+ catch (Exception exc)
+ {
+ children[0] = new SystemMessageObject(SystemPlugin.getPluginMessage(MSG_EXPAND_FAILED), ISystemMessageObject.MSGTYPE_ERROR, element);
+ SystemBasePlugin.logError("Exception prompting for filter ", exc);
+ }
+ //SystemPlugin.logDebugMessage(this.getClass().getName(),"returning children");
+ return children;
+ }
+
+ // NON-PROMPTING FILTER?...
+ Object[] nestedFilterReferences = fRef.getSystemFilterReferences(ss);
+ int nbrFilterStrings = referencedFilter.getFilterStringCount();
+ if (nbrFilterStrings == 0)
+ return nestedFilterReferences;
+ else
+ {
+ /*
+ // show filter strings
+ if (ssf.showFilterStrings())
+ {
+ SystemFilterStringReference[] refFilterStrings = fRef.getSystemFilterStringReferences();
+ if ((nestedFilterReferences == null) || (nestedFilterReferences.length == 0))
+ return refFilterStrings;
+ if ((refFilterStrings == null) || (refFilterStrings.length == 0))
+ return nestedFilterReferences;
+ int nbrChildren = nestedFilterReferences.length + refFilterStrings.length;
+ children = new Object[nbrChildren];
+ int idx=0;
+ for (idx=0; idx
+ * From IActionFilter so the popupMenus extension point can use <filter>, <enablement>
+ * or <visibility>. We add support is for the following:
+ *
+ *
+ */
+ public boolean testAttribute(Object target, String name, String value)
+ {
+ if (name.equalsIgnoreCase("filterType"))
+ {
+ ISystemFilterReference ref = getFilterReference(target);
+ String type = ref.getReferencedFilter().getType();
+ if ((type == null) || (type.length() == 0))
+ return false;
+ else
+ return value.equals(type);
+ }
+ else if (name.equalsIgnoreCase("showChangeFilterStringPropertyPage"))
+ {
+ ISystemFilterReference ref = getFilterReference(target);
+ ISubSystemConfiguration ssf = SubSystemHelpers.getParentSubSystemFactory(ref.getReferencedFilter());
+ if (value.equals("true"))
+ return ssf.showChangeFilterStringsPropertyPage(ref.getReferencedFilter());
+ else
+ return !ssf.showChangeFilterStringsPropertyPage(ref.getReferencedFilter());
+ }
+ else
+ return super.testAttribute(target, name, value);
+ }
+
+ // Property sheet descriptors defining all the properties we expose in the Property Sheet
+ /**
+ * Return our unique property descriptors
+ */
+ protected IPropertyDescriptor[] internalGetPropertyDescriptors()
+ {
+ if (propertyDescriptorArray == null)
+ {
+ int nbrOfProperties = 4;
+ propertyDescriptorArray = new PropertyDescriptor[nbrOfProperties];
+ int idx = 0;
+ // parent filter pool
+ propertyDescriptorArray[idx] = createSimplePropertyDescriptor(P_PARENT_FILTERPOOL, SystemViewResources.RESID_PROPERTY_FILTERPARENTPOOL_LABEL, SystemViewResources.RESID_PROPERTY_FILTERPARENTPOOL_TOOLTIP);
+ // parent filter
+ propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(P_PARENT_FILTER, SystemViewResources.RESID_PROPERTY_FILTERPARENTFILTER_LABEL, SystemViewResources.RESID_PROPERTY_FILTERPARENTFILTER_TOOLTIP);
+ // number filter strings
+ propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(P_FILTERSTRINGS_COUNT, SystemViewResources.RESID_PROPERTY_FILTERSTRINGS_COUNT_LABEL, SystemViewResources.RESID_PROPERTY_FILTERSTRINGS_COUNT_TOOLTIP);
+ // Related connection
+ propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(P_IS_CONNECTION_PRIVATE, SystemViewResources.RESID_PROPERTY_FILTERPOOLREFERENCE_IS_CONNECTIONPRIVATE_LABEL, SystemViewResources.RESID_PROPERTY_FILTERPOOLREFERENCE_IS_CONNECTIONPRIVATE_TOOLTIP);
+ }
+ return propertyDescriptorArray;
+ }
+ /**
+ * Return our unique property values
+ */
+ protected Object internalGetPropertyValue(Object key)
+ {
+ String name = (String) key;
+ ISystemFilter filter = getFilter(propertySourceInput);
+ if (name.equals(ISystemPropertyConstants.P_FILTERSTRINGS_COUNT))
+ {
+ int nbrFilterStrings = filter.getFilterStringCount();
+ return Integer.toString(nbrFilterStrings);
+ }
+ else if (name.equals(ISystemPropertyConstants.P_PARENT_FILTER))
+ {
+ ISystemFilter parent = filter.getParentFilter();
+ if (parent != null)
+ return parent.getName();
+ else
+ return getTranslatedNotApplicable();
+ }
+ else if (name.equals(ISystemPropertyConstants.P_PARENT_FILTERPOOL))
+ {
+ ISystemFilterPool parent = filter.getParentFilterPool();
+ if (parent != null)
+ return parent.getName();
+ else
+ return getTranslatedNotApplicable();
+ }
+ else if (name.equals(ISystemPropertyConstants.P_IS_CONNECTION_PRIVATE))
+ {
+ ISystemFilterPool parent = filter.getParentFilterPool();
+ return (parent.getOwningParentName()==null) ? getTranslatedNo() : getTranslatedYes();
+ }
+ else
+ return null;
+ }
+
+ // FOR COMMON DELETE ACTIONS
+ /**
+ * Return true if this object is deletable by the user. If so, when selected,
+ * the Edit->Delete menu item will be enabled.
+ */
+ public boolean canDelete(Object element)
+ {
+ ISystemFilter filter = getFilter(element);
+ return !filter.isNonDeletable(); // defect 43190
+ //return true;
+ }
+
+ /**
+ * Perform the delete action.
+ * This physically deletes the filter pool and all references.
+ */
+ public boolean doDelete(Shell shell, Object element, IProgressMonitor monitor) throws Exception
+ {
+ ISystemFilter filter = getFilter(element);
+ ISystemFilterPoolManager fpMgr = filter.getSystemFilterPoolManager();
+ fpMgr.deleteSystemFilter(filter);
+ return true;
+ }
+
+ // FOR COMMON RENAME ACTIONS
+ /**
+ * Return true if this object is renamable by the user. If so, when selected,
+ * the Rename menu item will be enabled.
+ */
+ public boolean canRename(Object element)
+ {
+ ISystemFilter filter = getFilter(element);
+ return !filter.isNonRenamable(); // defect 43190
+ //return true;
+ }
+
+ /**
+ * Perform the rename action. Assumes uniqueness checking was done already.
+ */
+ public boolean doRename(Shell shell, Object element, String name) throws Exception
+ {
+ ISystemFilter filter = getFilter(element);
+ ISystemFilterPoolManager fpMgr = filter.getSystemFilterPoolManager();
+ fpMgr.renameSystemFilter(filter, name);
+ return true;
+ }
+
+ /**
+ * Return a validator for verifying the new name is correct.
+ * @param either a filter for a rename action, or a filter pool for a "new" action.
+ */
+ public ISystemValidator getNameValidator(Object element)
+ {
+ ISystemFilter filter = null;
+ ISystemFilterPool pool = null;
+ Vector filterNames = null;
+ if (element instanceof ISystemFilterReference)
+ {
+ filter = getFilter(element);
+ pool = filter.getParentFilterPool();
+ if (pool != null)
+ filterNames = pool.getSystemFilterNames();
+ else
+ {
+ ISystemFilter parentFilter = filter.getParentFilter();
+ filterNames = parentFilter.getSystemFilterNames();
+ }
+ }
+ else if (element instanceof ISystemFilter)
+ {
+ filter = (ISystemFilter) element;
+ pool = filter.getParentFilterPool();
+ if (pool != null)
+ filterNames = pool.getSystemFilterNames();
+ else
+ {
+ ISystemFilter parentFilter = filter.getParentFilter();
+ filterNames = parentFilter.getSystemFilterNames();
+ }
+ }
+ else
+ {
+ pool = (ISystemFilterPool) element;
+ filterNames = pool.getSystemFilterNames();
+ }
+ /*
+ if (filter != null)
+ {
+ filterNames.removeElement(filter.getName()); // remove current filter's name
+ System.out.println("Existing names for " + filter.getName());
+ for (int idx=0; idxnull
is returned.
+ */
+ public String getErrorMessage()
+ {
+ return errorMessage;
+ }
+ /**
+ * Get the currently displayed message.
+ * @return The message. If no message is displayed null
is returned.
+ */
+ public String getMessage()
+ {
+ return message;
+ }
+ /**
+ * Display the given error message. A currently displayed message
+ * is saved and will be redisplayed when the error message is cleared.
+ */
+ public void setErrorMessage(String message)
+ {
+ this.errorMessage = message;
+ if (statusLine != null)
+ statusLine.setErrorMessage(message);
+ }
+ /**
+ * Get the currently displayed error text.
+ * @return The error message. If no error message is displayed
.
+ * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#supportsUserDefinedActions(java.lang.Object)
+ */
+ public boolean supportsUserDefinedActions(Object object) {
+ return false;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewSubSystemAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewSubSystemAdapter.java
new file mode 100644
index 00000000000..f090fc9fa1b
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewSubSystemAdapter.java
@@ -0,0 +1,728 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.core.ISystemUserIdConstants;
+import org.eclipse.rse.core.SystemBasePlugin;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.subsystems.IConnectorService;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
+import org.eclipse.rse.core.subsystems.util.ISubsystemConfigurationAdapter;
+import org.eclipse.rse.model.ISystemRegistry;
+import org.eclipse.rse.ui.SystemMenuManager;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.validators.ISystemValidator;
+import org.eclipse.rse.ui.validators.ValidatorPortInput;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.PropertyDescriptor;
+import org.eclipse.ui.views.properties.TextPropertyDescriptor;
+
+
+
+/**
+ * Adapter for displaying SubSystem objects in tree views.
+ * These are children of SystemConnection objects
+ */
+public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
+ implements ISystemViewElementAdapter, ISystemPropertyConstants, ISystemUserIdConstants
+{
+ protected String translatedType;
+ // for reset property support
+ private String original_portData;
+ private SystemInheritablePropertyData original_userIdData = new SystemInheritablePropertyData();
+ //private SystemInheritablePropertyData original_portData = new SystemInheritablePropertyData();
+ private TextPropertyDescriptor propertyPortDescriptor;
+ private boolean changed_userId, changed_port;
+ private boolean port_editable = true;
+ // -------------------
+ // property descriptors
+ // -------------------
+ private PropertyDescriptor[] propertyDescriptorArray = null;
+ //private SystemInheritablePropertyData portData = new SystemInheritablePropertyData();
+ //private SystemInheritableTextPropertyDescriptor portDescriptor;
+ private SystemInheritablePropertyData userIdData = new SystemInheritablePropertyData();
+ private SystemInheritableTextPropertyDescriptor userIdDescriptor = null;
+
+ /**
+ * Returns any actions that should be contributed to the popup menu
+ * for the given subsystem object.
+ * Calls the method getActions on the subsystem's factory, and places
+ * all action objects returned from the call, into the menu.
+ * @param menu The menu to contribute actions to
+ * @param selection The window's current selection.
+ * @param shell Shell of viewer
+ * @param menuGroup recommended menu group to add actions to. If added to another group, you must be sure to create that group first.
+ */
+ public void addActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup)
+ {
+ if (selection.size() != 1)
+ return; // does not make sense adding unique actions per multi-selection
+ Object element = selection.getFirstElement();
+ ISubSystem ss = (ISubSystem)element;
+ ISubSystemConfiguration ssFactory = SystemPlugin.getDefault().getSystemRegistry().getSubSystemConfiguration(ss);
+ ISubsystemConfigurationAdapter adapter = (ISubsystemConfigurationAdapter)ssFactory.getAdapter(ISubsystemConfigurationAdapter.class);
+
+ IAction[] actions = adapter.getSubSystemActions(ssFactory, ss,shell);
+ if (actions != null)
+ {
+ for (int idx=0; idxnull
is returned.
+ */
+ public SystemMessage getSystemErrorMessage()
+ {
+ return sysErrorMessage;
+ }
+
+ /**
+ * Display the given error message. A currently displayed message
+ * is saved and will be redisplayed when the error message is cleared.
+ */
+ public void setErrorMessage(SystemMessage message)
+ {
+ sysErrorMessage = message;
+ setErrorMessage(message.getLevelOneText());
+ }
+ /**
+ * Display the given error message. A currently displayed message
+ * is saved and will be redisplayed when the error message is cleared.
+ */
+ public void setErrorMessage(Throwable exc)
+ {
+ setErrorMessage(exc.getMessage());
+ }
+
+ /**
+ * Set the message text. If the message line currently displays an error,
+ * the message is stored and will be shown after a call to clearErrorMessage
+ */
+ public void setMessage(String message)
+ {
+ this.message = message;
+ if (statusLine != null)
+ statusLine.setMessage(message);
+ }
+ /**
+ *If the message line currently displays an error,
+ * the message is stored and will be shown after a call to clearErrorMessage
+ */
+ public void setMessage(SystemMessage message)
+ {
+ setMessage(message.getLevelOneText());
+ }
+
+ // -------------------------------------------
+ // MEMENTO SUPPORT (SAVING/RESTORING STATE)...
+ // -------------------------------------------
+ /**
+ * Initializes this view with the given view site. A memento is passed to
+ * the view which contains a snapshot of the views state from a previous
+ * session. Where possible, the view should try to recreate that state
+ * within the part controls.
+ * true
if the value of the specified property has changed
+ * from its original default value; false
otherwise.
+ */
+ public boolean isPropertySet(Object propertyObject)
+ {
+ String property = (String)propertyObject;
+ boolean changed = false;
+ if (property.equals(P_USERID))
+ changed = changed_userId;
+ else if (property.equals(P_PORT))
+ changed = changed_port && port_editable;
+ return changed;
+ }
+
+ /**
+ * Change the subsystem user Id value
+ */
+ private void updateUserId(ISubSystem subsys, SystemInheritablePropertyData data)
+ {
+ //int whereToUpdate = USERID_LOCATION_SUBSYSTEM;
+ String userId = data.getLocalValue(); // will be "" if !data.getIsLocal(), which results in wiping out local override
+ ISubSystemConfiguration ssFactory = subsys.getSubSystemConfiguration();
+ // unlike with connection objects, we don't ever allow the user to change the parent's
+ // userId value, even if it is empty, when working with subsystems. There is too much
+ // ambiquity as the parent could be the connnection or the user preferences setting for this
+ // system type. Because of this decision, we don't need to tell updateSubSystem(...) where
+ // to update, as it always the local subsystem.
+ ssFactory.updateSubSystem((Shell)null, subsys, true, userId, false, subsys.getConnectorService().getPort());
+ }
+ /**
+ * Change the subsystem port value
+ *
+ private void updatePort(SubSystem subsys, SystemInheritablePropertyData data)
+ {
+ String port = data.getLocalValue(); // will be "" if !data.getIsLocal(), which results in wiping out local override
+ Integer portInteger = null;
+ if (data.getIsLocal() && (port.length()>0))
+ portInteger = new Integer(port);
+ else
+ portInteger = new Integer(0);
+ SubSystemFactory ssFactory = subsys.getParentSubSystemFactory();
+ ssFactory.updateSubSystem((Shell)null, subsys, false, subsys.getLocalUserId(), true, portInteger);
+ }
+ */
+ /**
+ * Change the subsystem port value
+ */
+ private void updatePort(ISubSystem subsys, String data)
+ {
+ if (!port_editable)
+ return;
+ String port = (String)data;
+ Integer portInteger = null;
+ if (port.length()>0)
+ {
+ try
+ {
+ portInteger = new Integer(port);
+ }
+ catch (Exception exc)
+ {
+ return;
+ }
+ }
+ else
+ {
+ portInteger = new Integer(0);
+ }
+ int portInt = portInteger.intValue();
+ ISubSystemConfiguration ssFactory = subsys.getSubSystemConfiguration();
+ ssFactory.updateSubSystem((Shell)null, subsys, false, subsys.getLocalUserId(), true, portInt);
+ }
+
+
+ /**
+ * Called when user selects the reset button in property sheet.
+ */
+ public void resetPropertyValue(Object propertyObject)
+ {
+ String property = (String)propertyObject;
+ ISubSystem ss = (ISubSystem)propertySourceInput;
+ ISubSystemConfiguration ssFactory = ss.getSubSystemConfiguration();
+ if (property.equals(P_USERID))
+ {
+ updateUserId(ss, original_userIdData);
+ changed_userId = false;
+ }
+ else if (property.equals(P_PORT))
+ {
+ //updatePort(ss, original_portData);
+ updatePort(ss, original_portData);
+ changed_port = false;
+ }
+ }
+ /**
+ * Called when user changes property via property sheet.
+ */
+ public void setPropertyValue(Object property, Object value)
+ {
+ String name = (String)property;
+ ISubSystem ss = (ISubSystem)propertySourceInput;
+ ISubSystemConfiguration ssFactory = ss.getSubSystemConfiguration();
+ //System.out.println("inside setPropVal: " + property + ", value: " + value);
+ if (name.equals(P_USERID))
+ {
+ updateUserId(ss, (SystemInheritablePropertyData)value);
+ changed_userId = true;
+ }
+ else if (name.equals(P_PORT))
+ {
+ //System.out.println("inside setPropVal: " + property + ", value: " + value);
+ //updatePort(ss, (SystemInheritablePropertyData)value);
+ updatePort(ss, (String)value);
+ changed_port = true;
+ }
+ }
+
+ /**
+ * Override of {@link AbstractSystemViewAdapter#testAttribute(Object, String, String)}. We add
+ * one more attribute for subsystems:
+ *
+ *
+ *
+ * This property is used to filter the existence of the Server Launch Settings property page.
+ *
+ * @see org.eclipse.ui.IActionFilter#testAttribute(Object, String, String)
+ */
+ public boolean testAttribute(Object target, String name, String value)
+ {
+ if (target instanceof ISubSystem)
+ {
+ if (name.equalsIgnoreCase("serverLaunchPP"))
+ {
+ ISubSystem ss = (ISubSystem)target;
+ boolean supports = ss.getSubSystemConfiguration().supportsServerLaunchProperties(ss.getHost());
+ return supports ? value.equals("true") : value.equals("false");
+ }
+ else if (name.equalsIgnoreCase("envVarPP"))
+ {
+ /** FIXME can't access specific subsystems from core anymore
+ boolean supports = false;
+ if (ss instanceof IRemoteFileSubSystem)
+ supports = ((IRemoteFileSubSystemFactory)ss.getParentSubSystemFactory()).supportsEnvironmentVariablesPropertyPage();
+ else
+ supports = ((IRemoteCmdSubSystemFactory)ss.getParentSubSystemFactory()).supportsEnvironmentVariablesPropertyPage();
+ */
+ boolean supports = false;
+ return supports ? value.equals("true") : value.equals("false");
+ }
+ else if (name.equalsIgnoreCase("isConnectionError"))
+ {
+ ISubSystem ss = (ISubSystem) target;
+ boolean error = ss.isConnectionError();
+ return error ? value.equals("true") : value.equals("false");
+ }
+ }
+ return super.testAttribute(target, name, value);
+ }
+
+ // FOR COMMON DELETE ACTIONS
+ /**
+ * Return true if we should show the delete action in the popup for the given element.
+ * If true, then canDelete will be called to decide whether to enable delete or not.
+ */
+ public boolean showDelete(Object element)
+ {
+ return canDelete(element);
+ }
+
+ /**
+ * Return true if this object is deletable by the user. If so, when selected,
+ * the Edit->Delete menu item will be enabled.
+ */
+ public boolean canDelete(Object element)
+ {
+ //System.out.println("INSIDE ISDELETABLE FOR SUBSYSTEM VIEW ADAPTER: "+element);
+ ISubSystem ss = (ISubSystem)element;
+ ISubSystemConfiguration ssFactory = ss.getSubSystemConfiguration();
+ return ssFactory.isSubSystemsDeletable();
+ }
+
+ /**
+ * Perform the delete action.
+ */
+ public boolean doDelete(Shell shell, Object element, IProgressMonitor monitor)
+ {
+ //System.out.println("INSIDE DODELETE FOR SUBSYSTEM VIEW ADAPTER: "+element);
+ ISubSystem ss = (ISubSystem)element;
+ ISystemRegistry sr = SystemPlugin.getDefault().getSystemRegistry();
+ sr.deleteSubSystem(ss);
+ return true;
+ }
+
+ // FOR COMMON RENAME ACTIONS
+ /**
+ * Return true if we should show the rename action in the popup for the given element.
+ * If true, then canRename will be called to decide whether to enable delete or not.
+ */
+ public boolean showRename(Object element)
+ {
+ return canRename(element);
+ }
+ /**
+ * Return true if this object is renamable by the user. If so, when selected,
+ * the Rename menu item will be enabled.
+ */
+ public boolean canRename(Object element)
+ {
+ return canDelete(element); // same rules for both delete and rename
+ }
+
+ /**
+ * Perform the rename action. Assumes uniqueness checking was done already.
+ */
+ public boolean doRename(Shell shell, Object element, String name)
+ {
+ ISubSystem ss = (ISubSystem)element;
+ ISubSystemConfiguration parentSSFactory = ss.getSubSystemConfiguration();
+ parentSSFactory.renameSubSystem(ss,name); // renames, and saves to disk
+ return true;
+ }
+
+ /**
+ * Return a validator for verifying the new name is correct on a rename action.
+ * The default implementation is not to support rename hence this method returns
+ * null. Override if appropriate.
+ */
+ public ISystemValidator getNameValidator(Object element)
+ {
+ return null;
+ }
+
+ // FOR COMMON DRAG AND DROP ACTIONS
+ /**
+ * Indicates whether the subsystem can be dragged.
+ * Can't be used for physical copies but rather
+ * for views (like the Scratchpad)
+ */
+ public boolean canDrag(Object element)
+ {
+ return true;
+ }
+
+ /**
+ * Returns the subsystem (no phyiscal operation required to drag and subsystem (because it's local)
+ */
+ public Object doDrag(Object element, boolean sameSystemType, IProgressMonitor monitor)
+ {
+ return element;
+ }
+
+
+
+
+ // ------------------------------------------------------------
+ // METHODS FOR SAVING AND RESTORING EXPANSION STATE OF VIEWER...
+ // ------------------------------------------------------------
+
+ /**
+ * Return what to save to disk to identify this element in the persisted list of expanded elements.
+ * This just defaults to getName, but if that is not sufficient override it here.
+ */
+ public String getMementoHandle(Object element)
+ {
+ ISubSystem ss = (ISubSystem)element;
+ ISubSystemConfiguration ssf = ss.getSubSystemConfiguration();
+ return ssf.getId()+"="+ss.getName();
+ }
+ /**
+ * Return what to save to disk to identify this element when it is the input object to a secondary
+ * Remote Systems Explorer perspective.
+ */
+ public String getInputMementoHandle(Object element)
+ {
+ Object parent = getParent(element);
+ return getAdapter(parent).getInputMementoHandle(parent) + MEMENTO_DELIM + getMementoHandle(element);
+ }
+ /**
+ * Return a short string to uniquely identify the type of resource. Eg "conn" for connection.
+ * This just defaults to getType, but if that is not sufficient override it here, since that is
+ * a translated string.
+ */
+ public String getMementoHandleKey(Object element)
+ {
+ return ISystemMementoConstants.MEMENTO_KEY_SUBSYSTEM;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/BrowseAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/BrowseAction.java
new file mode 100644
index 00000000000..c773e65d3cf
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/BrowseAction.java
@@ -0,0 +1,54 @@
+/********************************************************************************
+ * Copyright (c) 2004, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view.monitor;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.resource.ImageDescriptor;
+
+class BrowseAction extends Action
+{
+ protected final SystemMonitorViewPart part;
+
+ public BrowseAction(SystemMonitorViewPart part)
+ {
+ super();
+ this.part = part;
+ }
+
+ public BrowseAction(SystemMonitorViewPart part, String label, ImageDescriptor des)
+ {
+ super(label, des);
+ this.part = part;
+
+ setToolTipText(label);
+ }
+
+ public void checkEnabledState()
+ {
+ if (this.part._folder != null && this.part._folder.getInput() != null)
+ {
+ setEnabled(true);
+ }
+ else
+ {
+ setEnabled(false);
+ }
+ }
+
+ public void run()
+ {
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/ClearAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/ClearAction.java
new file mode 100644
index 00000000000..a58cf969d1e
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/ClearAction.java
@@ -0,0 +1,52 @@
+/********************************************************************************
+ * Copyright (c) 2004, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view.monitor;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.SystemResources;
+
+
+
+public class ClearAction extends BrowseAction
+{
+
+ public ClearAction(SystemMonitorViewPart view)
+ {
+ super(view, SystemResources.ACTION_CLEAR_ALL_LABEL,
+ SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_CLEAR_ALL_ID));
+
+
+ // TODO DKM - get help for this!
+ //PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.CLEAR_CONSOLE_ACTION);
+ }
+
+ public void checkEnabledState()
+ {
+ setEnabled(part.getViewer() != null);
+ }
+
+ public void run()
+ {
+ clear();
+ }
+
+ // clear contents of the current command viewer
+ private void clear()
+ {
+ part.removeAllItemsToMonitor();
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/ClearSelectedAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/ClearSelectedAction.java
new file mode 100644
index 00000000000..015de1ec92d
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/ClearSelectedAction.java
@@ -0,0 +1,58 @@
+/********************************************************************************
+ * Copyright (c) 2004, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view.monitor;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.SystemResources;
+
+
+
+
+
+public class ClearSelectedAction extends BrowseAction
+{
+ public ClearSelectedAction(SystemMonitorViewPart view)
+ {
+ super(view, SystemResources.ACTION_CLEAR_SELECTED_LABEL,
+ SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_CLEAR_SELECTED_ID));
+
+ // TODO DKM - get help for this!
+ //PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.CLEAR_CONSOLE_ACTION);
+ }
+
+ public void checkEnabledState()
+ {
+ if (part.getViewer() != null)
+ {
+ setEnabled(true);
+ return;
+ }
+
+ setEnabled(false);
+ }
+
+ public void run()
+ {
+ clear();
+ }
+
+ private void clear()
+ {
+ part.removeItemToMonitor((IAdaptable)part.getViewer().getInput());
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/MonitorViewPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/MonitorViewPage.java
new file mode 100644
index 00000000000..99c241f075e
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/MonitorViewPage.java
@@ -0,0 +1,568 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view.monitor;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.model.ISystemContainer;
+import org.eclipse.rse.model.ISystemRegistry;
+import org.eclipse.rse.model.ISystemResourceChangeEvents;
+import org.eclipse.rse.model.SystemResourceChangeEvent;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.ISystemThemeConstants;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.SystemWidgetHelpers;
+import org.eclipse.rse.ui.actions.SystemCopyToClipboardAction;
+import org.eclipse.rse.ui.actions.SystemPasteFromClipboardAction;
+import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
+import org.eclipse.rse.ui.view.SystemTableTreeView;
+import org.eclipse.rse.ui.view.SystemTableTreeViewProvider;
+import org.eclipse.rse.ui.widgets.ISystemCollapsableSectionListener;
+import org.eclipse.rse.ui.widgets.SystemCollapsableSection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CTabFolder;
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.FocusListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Color;
+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.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Scale;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.Widget;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.part.CellEditorActionHandler;
+import org.eclipse.ui.texteditor.ITextEditorActionConstants;
+
+
+
+/**
+ * Class for a remote shell session on a connection
+ */
+public class MonitorViewPage implements SelectionListener, ISystemThemeConstants, IPropertyChangeListener, ISelectionChangedListener, Listener,
+FocusListener
+{
+ private static SystemMessage _queryMessage = SystemPlugin.getPluginMessage(ISystemMessages.MSG_QUERY_PROGRESS);
+
+ class PollingThread extends Thread
+ {
+ private boolean _querying = false;
+ private ISystemViewElementAdapter _adapter;
+ private Object _inputObject;
+ private SystemTableTreeView _viewer;
+
+ public PollingThread()
+ {
+ _viewer = getViewer();
+ _inputObject = _viewer.getInput();
+ _adapter = (ISystemViewElementAdapter)((IAdaptable)_inputObject).getAdapter(ISystemViewElementAdapter.class);
+ }
+
+ public void run()
+ {
+ while (isPollingEnabled())
+ {
+ int interval = getPollingInterval() * 1000;
+ try
+ {
+ Thread.sleep(interval);
+ doQuery();
+ while (_querying)
+ {
+ Thread.sleep(100);
+ }
+ doRedraw();
+ }
+ catch (InterruptedException e)
+ {
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ protected void doQuery()
+ {
+ Display display = Display.getDefault();
+ if (display != null && !_querying)
+ {
+ _querying= true;
+ if (_inputObject instanceof ISystemContainer)
+ {
+ ((ISystemContainer)_inputObject).markStale(true);
+ }
+
+ String name = _adapter.getName(_inputObject);
+ _queryMessage.makeSubstitution(name);
+ String txt = _queryMessage.getLevelOneText();
+ Job job = new Job(txt)
+ {
+ public IStatus run(IProgressMonitor monitor)
+ {
+ Object[] children = _adapter.getChildren(monitor, _inputObject);
+ if (children != null)
+ {
+ SystemTableTreeViewProvider provider = (SystemTableTreeViewProvider)_viewer.getContentProvider();
+ provider.setCache(children);
+
+ }
+
+ _querying = false;
+ return Status.OK_STATUS;
+ }
+ };
+
+ job.schedule();
+ }
+ }
+
+ protected void doRedraw()
+ {
+ Display display = Display.getDefault();
+ if (display != null)
+ {
+ display.asyncExec(
+ new Runnable()
+ {
+ public void run()
+ {
+ ISystemRegistry registry = SystemPlugin.getTheSystemRegistry();
+ registry.fireEvent(new SystemResourceChangeEvent(_inputObject, ISystemResourceChangeEvents.EVENT_REFRESH, _inputObject));
+ //getViewer().refresh();
+ }
+ });
+ }
+ }
+ }
+
+ class SelectAllAction extends Action
+ {
+ public SelectAllAction()
+ {
+ super(SystemResources.ACTION_SELECT_ALL_LABEL, null);
+ setToolTipText(SystemResources.ACTION_SELECT_ALL_TOOLTIP);
+ }
+
+ public void checkEnabledState()
+ {
+ setEnabled(true);
+ }
+
+ public void run()
+ {
+ SystemTableTreeView view = _viewer;
+ view.getTree().selectAll();
+ view.setSelection(view.getSelection());
+ }
+ }
+
+
+ private SystemTableTreeView _viewer;
+
+ private boolean _isPolling = false;
+ private int _pollingInterval;
+
+ private Group _tabFolderPage;
+ private Button _pollCheckbox;
+ private Scale _scale;
+ private Text _scaleValue;
+
+ private PollingThread _pollingThread;
+
+ private SystemMonitorViewPart _viewPart;
+
+ private String _title;
+
+ private SystemCopyToClipboardAction _copyAction;
+ private SystemPasteFromClipboardAction _pasteAction;
+ private SelectAllAction _selectAllAction;
+ private IActionBars _actionBars;
+
+ public MonitorViewPage(SystemMonitorViewPart viewPart)
+ {
+ _viewPart = viewPart;
+ _actionBars = _viewPart.getViewSite().getActionBars();
+ }
+
+
+
+ public Composite createTabFolderPage(CTabFolder tabFolder, CellEditorActionHandler editorActionHandler)
+ {
+ _tabFolderPage = new Group(tabFolder, SWT.NULL);
+ GridLayout gridLayout = new GridLayout();
+ _tabFolderPage.setLayout(gridLayout);
+
+ createControl(_tabFolderPage);
+
+
+
+ ISystemRegistry registry = SystemPlugin.getTheSystemRegistry();
+
+ // global actions
+ Clipboard clipboard = registry.getSystemClipboard();
+ _copyAction = new SystemCopyToClipboardAction(_viewer.getShell(), clipboard);
+ _copyAction.setEnabled(false);
+
+ _pasteAction = new SystemPasteFromClipboardAction(_viewer.getShell(), clipboard);
+ _pasteAction.setEnabled(false);
+
+ editorActionHandler.setCopyAction(_copyAction);
+ editorActionHandler.setPasteAction(_pasteAction);
+
+ _selectAllAction = new SelectAllAction();
+ _selectAllAction.setEnabled(false);
+ editorActionHandler.setSelectAllAction(_selectAllAction);
+
+
+ _viewer.addSelectionChangedListener(this);
+ _viewer.getControl().addFocusListener(this);
+
+ return _tabFolderPage;
+ }
+
+ public void setFocus()
+ {
+ _viewPart.getSite().setSelectionProvider(_viewer);
+ }
+
+ public IActionBars getActionBars()
+ {
+ return _actionBars;
+ }
+
+ public void selectionChanged(SelectionChangedEvent e)
+ {
+ IStructuredSelection sel = (IStructuredSelection) e.getSelection();
+ _copyAction.setEnabled(_copyAction.updateSelection(sel));
+ _pasteAction.setEnabled(_pasteAction.updateSelection(sel));
+ _selectAllAction.setEnabled(true);
+
+ //setActionHandlers();
+ }
+
+ public int getPollingInterval()
+ {
+ return _pollingInterval;
+ }
+
+ public boolean isPollingEnabled()
+ {
+ if (_isPolling)
+ {
+ return true;
+ }
+ return false;
+ }
+
+
+ public void setEnabled(boolean flag)
+ {
+ if (!flag)
+ {
+ Tree tree = _viewer.getTree();
+
+ Display display = _viewer.getShell().getDisplay();
+ Color bgcolour = _tabFolderPage.getBackground();
+
+ tree.setBackground(bgcolour);
+ }
+ }
+
+ protected void createPollControls(Composite parent)
+ {
+
+ SystemCollapsableSection collapsable = new SystemCollapsableSection(parent);
+ collapsable.setText(SystemResources.RESID_MONITOR_POLL_CONFIGURE_POLLING_LABEL);
+ collapsable.setToolTips(SystemResources.RESID_MONITOR_POLL_CONFIGURE_POLLING_COLLAPSE_TOOLTIP,
+ SystemResources.RESID_MONITOR_POLL_CONFIGURE_POLLING_EXPAND_TOOLTIP
+ );
+
+ Composite inputContainer = collapsable.getPageComposite();
+
+
+ _pollCheckbox = SystemWidgetHelpers.createCheckBox(inputContainer, this, SystemResources.RESID_MONITOR_POLL_LABEL, SystemResources.RESID_MONITOR_POLL_TOOLTIP);
+ GridData pg = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
+ _pollCheckbox.setLayoutData(pg);
+
+ _pollingInterval = 100;
+ Label label = SystemWidgetHelpers.createLabel(inputContainer, SystemResources.RESID_MONITOR_POLL_INTERVAL_LABEL);
+
+ _scale = new Scale(inputContainer, SWT.NULL);
+ _scale.setMaximum(200);
+ _scale.setMinimum(5);
+ _scale.setSelection(_pollingInterval);
+
+ _scale.addSelectionListener(
+ new SelectionListener()
+ {
+
+ public void widgetDefaultSelected(SelectionEvent e)
+ {
+ widgetSelected(e);
+ }
+
+ public void widgetSelected(SelectionEvent e)
+ {
+ _pollingInterval = _scale.getSelection();
+ _scaleValue.setText(_pollingInterval + "s");
+
+ if (_pollingThread != null)
+ _pollingThread.interrupt();
+ }
+
+ });
+
+ _scale.setToolTipText(SystemResources.RESID_MONITOR_POLL_INTERVAL_TOOLTIP);
+ GridData sd = new GridData(GridData.FILL_HORIZONTAL);
+ _scale.setLayoutData(sd);
+
+ _scaleValue = SystemWidgetHelpers.createReadonlyTextField(inputContainer);
+ _scaleValue.setTextLimit(5);
+ GridData scgd = new GridData(GridData.HORIZONTAL_ALIGN_END);
+ _scaleValue.setLayoutData(scgd);
+ _scaleValue.setText(_pollingInterval + "s");
+
+
+
+ GridLayout ilayout = new GridLayout();
+ ilayout.numColumns = 4;GridData gridData1 = new GridData(GridData.FILL_HORIZONTAL);
+ inputContainer.setLayout(ilayout);
+ inputContainer.setLayoutData(gridData1);
+
+
+ // defaults
+ _scale.setEnabled(_isPolling);
+ _scaleValue.setEnabled(_isPolling);
+
+ collapsable.addCollapseListener(new CollapsableListener(inputContainer));
+ }
+
+ class CollapsableListener implements ISystemCollapsableSectionListener
+ {
+ Composite _child;
+ public CollapsableListener(Composite child)
+ {
+ _child = child;
+ }
+
+ public void sectionCollapsed(boolean collapsed)
+ {
+ //System.out.println("collapsed");
+ }
+ }
+
+ public void createControl(Composite parent)
+ {
+ GridLayout gridLayout = new GridLayout();
+ gridLayout.numColumns = 1;
+ parent.setLayout(gridLayout);
+
+ // create table portion
+ //Table table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION | SWT.HIDE_SELECTION);
+ //_viewer = new SystemTableView(table, _viewPart);
+
+ Tree tree = new Tree(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION | SWT.HIDE_SELECTION);
+ _viewer = new SystemTableTreeView(tree, _viewPart);
+ _viewer.setWorkbenchPart(_viewPart);
+
+ _viewer.addDoubleClickListener(new IDoubleClickListener()
+ {
+ public void doubleClick(DoubleClickEvent event)
+ {
+ handleDoubleClick(event);
+ }
+ });
+
+
+ SystemWidgetHelpers.setHelp(_viewer.getControl(), SystemPlugin.HELPPREFIX + "ucmd0000");
+
+ //TableLayout layout = new TableLayout();
+ //tree.setLayout(layout);
+ //tree.setLayout(new GridLayout())
+ tree.setHeaderVisible(false);
+ tree.setLinesVisible(false);
+
+ GridData gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
+ tree.setLayoutData(gridData);
+
+ createPollControls(_tabFolderPage);
+ }
+
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ }
+
+
+ private void handleDoubleClick(DoubleClickEvent event)
+ {
+ IStructuredSelection s = (IStructuredSelection) event.getSelection();
+ Object element = s.getFirstElement();
+ if (element == null)
+ return;
+
+ ISystemViewElementAdapter adapter = (ISystemViewElementAdapter) ((IAdaptable) element).getAdapter(ISystemViewElementAdapter.class);
+ boolean alreadyHandled = false;
+ if (adapter != null)
+ {
+ alreadyHandled = adapter.handleDoubleClick(element);
+ }
+ }
+
+ public void dispose()
+ {
+ _viewer.dispose();
+ _tabFolderPage.dispose();
+ }
+
+
+
+
+ public Object getInput()
+ {
+ return _viewer.getInput();
+ }
+
+ public void setInput(IAdaptable object)
+ {
+ setInput(object, true);
+ updateTitle(object);
+ }
+
+ public void updateTitle(IAdaptable object)
+ {
+ ISystemViewElementAdapter adapter = (ISystemViewElementAdapter)object.getAdapter(ISystemViewElementAdapter.class);
+
+ String title = adapter.getText(object);
+ _tabFolderPage.setText(title);
+ }
+
+ public String getTitle()
+ {
+ return _title;
+ }
+
+ public void setInput(IAdaptable object, boolean updateHistory)
+ {
+ if (_viewer != null && object != null)
+ {
+ _viewer.setInput(object);
+ }
+ }
+
+ public void clearInput()
+ {
+ if (_viewer != null)
+ {
+ _viewer.setInput(null);
+ }
+ }
+
+ public SystemTableTreeView getViewer()
+ {
+ return _viewer;
+ }
+
+
+
+ public void updateActionStates()
+ {
+ Object input = _viewer.getInput();
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e)
+ {
+ widgetSelected(e);
+ }
+
+ public void widgetSelected(SelectionEvent e)
+ {
+ }
+
+
+
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.events.FocusListener#focusGained(org.eclipse.swt.events.FocusEvent)
+ */
+ public void focusGained(FocusEvent arg0)
+ {
+ IActionBars actionBars = getActionBars();
+ if (actionBars != null)
+ {
+ if (arg0.widget == _viewer.getControl())
+ {
+ actionBars.setGlobalActionHandler(ITextEditorActionConstants.COPY, _copyAction);
+ actionBars.setGlobalActionHandler(ITextEditorActionConstants.PASTE, _pasteAction);
+ actionBars.setGlobalActionHandler(ITextEditorActionConstants.SELECT_ALL, _selectAllAction);
+ actionBars.updateActionBars();
+
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.events.FocusListener#focusLost(org.eclipse.swt.events.FocusEvent)
+ */
+ public void focusLost(FocusEvent arg0)
+ {
+
+ }
+
+ public void handleEvent(Event event)
+ {
+ Widget w = event.widget;
+ if (w == _pollCheckbox)
+ {
+ boolean wasPolling = _isPolling;
+ _isPolling = _pollCheckbox.getSelection();
+ _scale.setEnabled(_isPolling);
+ _scaleValue.setEnabled(_isPolling);
+ if (wasPolling != _isPolling && _isPolling)
+ {
+ _pollingThread = new PollingThread();
+ _pollingThread.start();
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/MonitorViewWorkbook.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/MonitorViewWorkbook.java
new file mode 100644
index 00000000000..928ebcf9196
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/MonitorViewWorkbook.java
@@ -0,0 +1,277 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view.monitor;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
+import org.eclipse.rse.ui.view.SystemTableTreeView;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CTabFolder;
+import org.eclipse.swt.custom.CTabItem;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+
+
+
+/**
+ * This is the desktop view wrapper of the System View viewer.
+ * ViewPart is from com.ibm.itp.ui.support.parts
+ */
+public class MonitorViewWorkbook extends Composite
+{
+
+
+ private CTabFolder _folder;
+ private SystemMonitorViewPart _viewPart;
+
+ public MonitorViewWorkbook(Composite parent, SystemMonitorViewPart viewPart)
+ {
+ super(parent, SWT.NONE);
+
+ _folder = new CTabFolder(this, SWT.NONE);
+ _folder.setLayout(new TabFolderLayout());
+ _folder.setLayoutData(new GridData(GridData.FILL_BOTH));
+ setLayout(new FillLayout());
+ _viewPart = viewPart;
+ }
+
+ public void dispose()
+ {
+ if (!_folder.isDisposed())
+ {
+ for (int i = 0; i < _folder.getItemCount(); i++)
+ {
+ CTabItem item = _folder.getItem(i);
+ if (!item.isDisposed())
+ {
+ MonitorViewPage page = (MonitorViewPage) item.getData();
+ page.dispose();
+ }
+ }
+ _folder.dispose();
+ }
+ super.dispose();
+ }
+
+ public CTabFolder getFolder()
+ {
+ return _folder;
+ }
+
+ public void remove(Object root)
+ {
+ for (int i = 0; i < _folder.getItemCount(); i++)
+ {
+ CTabItem item = _folder.getItem(i);
+ if (!item.isDisposed())
+ {
+ MonitorViewPage page = (MonitorViewPage) item.getData();
+
+ if (page != null && root == page.getInput())
+ {
+ item.dispose();
+ page.dispose();
+
+ page = null;
+ item = null;
+
+ _folder.redraw();
+
+ return;
+ }
+ }
+ }
+ }
+
+ public void removeDisconnected()
+ {
+ for (int i = 0; i < _folder.getItemCount(); i++)
+ {
+ CTabItem item = _folder.getItem(i);
+ if (!item.isDisposed())
+ {
+ MonitorViewPage page = (MonitorViewPage) item.getData();
+ if (page != null)
+ {
+ IAdaptable input = (IAdaptable)page.getInput();
+ ISystemViewElementAdapter adapter = (ISystemViewElementAdapter)input.getAdapter(ISystemViewElementAdapter.class);
+ if (adapter != null)
+ {
+ ISubSystem subSystem = adapter.getSubSystem(input);
+ if (subSystem != null)
+ {
+ if (!subSystem.isConnected())
+ {
+ item.dispose();
+ page.dispose();
+
+ page = null;
+ item = null;
+
+ _folder.redraw();
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+
+
+ public CTabItem getSelectedTab()
+ {
+ if (_folder.getItemCount() > 0)
+ {
+ int index = _folder.getSelectionIndex();
+ CTabItem item = _folder.getItem(index);
+ return item;
+ }
+
+ return null;
+ }
+
+ public MonitorViewPage getCurrentTabItem()
+ {
+ if (_folder.getItemCount() > 0)
+ {
+ int index = _folder.getSelectionIndex();
+ CTabItem item = _folder.getItem(index);
+ return (MonitorViewPage) item.getData();
+ }
+ return null;
+ }
+
+ public void showCurrentPage()
+ {
+ _folder.setFocus();
+ }
+
+ public Object getInput()
+ {
+ MonitorViewPage page = getCurrentTabItem();
+ if (page != null)
+ {
+ page.setFocus();
+ return page.getInput();
+ }
+
+ return null;
+ }
+
+ public SystemTableTreeView getViewer()
+ {
+ if (getCurrentTabItem() != null)
+ {
+ return getCurrentTabItem().getViewer();
+ }
+ return null;
+ }
+
+ public void addItemToMonitor(IAdaptable root, boolean createTab)
+ {
+ if (!_folder.isDisposed())
+ {
+ for (int i = 0; i < _folder.getItemCount(); i++)
+ {
+ CTabItem item = _folder.getItem(i);
+ MonitorViewPage page = (MonitorViewPage) item.getData();
+ if (page != null && root == page.getInput())
+ {
+ page.getViewer().refresh();
+
+ if (_folder.getSelectionIndex() != i)
+ {
+ _folder.setSelection(item);
+ }
+ updateActionStates();
+ //page.setFocus();
+ return;
+ }
+ }
+
+ if (createTab)
+ {
+ // never shown this, so add it
+ createTabItem((IAdaptable) root);
+ }
+ }
+ }
+
+ private void createTabItem(IAdaptable root)
+ {
+ MonitorViewPage monitorViewPage = new MonitorViewPage(_viewPart);
+
+ CTabItem titem = new CTabItem(_folder, SWT.NULL);
+ setTabTitle(root, titem);
+
+ titem.setData(monitorViewPage);
+ titem.setControl(monitorViewPage.createTabFolderPage(_folder, _viewPart.getEditorActionHandler()));
+ _folder.setSelection(titem );
+
+ monitorViewPage.setInput(root);
+
+ SystemTableTreeView viewer = monitorViewPage.getViewer();
+ _viewPart.getSite().setSelectionProvider(viewer);
+ _viewPart.getSite().registerContextMenu(viewer.getContextMenuManager(), viewer);
+
+ monitorViewPage.setFocus();
+ }
+
+ private void setTabTitle(IAdaptable root, CTabItem titem)
+ {
+ ISystemViewElementAdapter va = (ISystemViewElementAdapter) root.getAdapter(ISystemViewElementAdapter.class);
+ if (va != null)
+ {
+ titem.setText(va.getName(root));
+ titem.setImage(va.getImageDescriptor(root).createImage());
+ }
+ }
+
+ public void setInput(IAdaptable root)
+ {
+ for (int i = 0; i < _folder.getItemCount(); i++)
+ {
+ CTabItem item = _folder.getItem(i);
+ MonitorViewPage page = (MonitorViewPage) item.getData();
+ if (root == page.getInput())
+ {
+ _folder.setSelection(i);
+ page.getViewer().refresh();
+ return;
+ }
+ }
+ }
+
+ public void updateActionStates()
+ {
+ for (int i = 0; i < _folder.getItemCount(); i++)
+ {
+ CTabItem item = _folder.getItem(i);
+ if (!item.isDisposed())
+ {
+ MonitorViewPage page = (MonitorViewPage) item.getData();
+ if (page != null)
+ {
+ page.updateActionStates();
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/SystemMonitorUI.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/SystemMonitorUI.java
new file mode 100644
index 00000000000..6f174a60fb1
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/SystemMonitorUI.java
@@ -0,0 +1,78 @@
+/********************************************************************************
+ * Copyright (c) 2003, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view.monitor;
+
+import org.eclipse.rse.core.SystemBasePlugin;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+
+
+/**
+ * A singleton class for dealing with remote commands
+ */
+public class SystemMonitorUI
+{
+
+
+ // singleton instance
+ private static SystemMonitorUI instance;
+ private static SystemMonitorViewPart _viewPart;
+
+ public static final String MONITOR_VIEW_ID = "org.eclipse.rse.ui.view.monitorView";
+
+ private SystemMonitorUI()
+ {
+ super();
+ }
+
+ /**
+ * Get the singleton instance.
+ * @return the singleton object of this type
+ */
+ public static SystemMonitorUI getInstance()
+ {
+ if (instance == null)
+ {
+ instance = new SystemMonitorUI();
+ }
+
+ return instance;
+ }
+
+
+ public SystemMonitorViewPart activateCommandsView()
+ {
+ try
+ {
+ IWorkbenchPage page = SystemBasePlugin.getActiveWorkbenchWindow().getActivePage();
+ _viewPart = (SystemMonitorViewPart) page.showView(SystemMonitorUI.MONITOR_VIEW_ID);
+ page.bringToTop(_viewPart);
+ }
+ catch (PartInitException e)
+ {
+ SystemBasePlugin.logError("Can not open commands view", e);
+ }
+
+ return _viewPart;
+ }
+
+
+ public static SystemMonitorViewPart getMonitorView()
+ {
+ return _viewPart;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/SystemMonitorViewPart.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/SystemMonitorViewPart.java
new file mode 100644
index 00000000000..eaf3cd3fff0
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/SystemMonitorViewPart.java
@@ -0,0 +1,1034 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view.monitor;
+
+import java.util.ArrayList;
+import java.util.Vector;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IStatusLineManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.window.Window;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.model.ISystemContainer;
+import org.eclipse.rse.model.ISystemRegistry;
+import org.eclipse.rse.model.ISystemRemoteChangeEvent;
+import org.eclipse.rse.model.ISystemRemoteChangeEvents;
+import org.eclipse.rse.model.ISystemRemoteChangeListener;
+import org.eclipse.rse.model.ISystemResourceChangeEvent;
+import org.eclipse.rse.model.ISystemResourceChangeEvents;
+import org.eclipse.rse.model.ISystemResourceChangeListener;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.SystemPropertyResources;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.SystemWidgetHelpers;
+import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
+import org.eclipse.rse.ui.messages.ISystemMessageLine;
+import org.eclipse.rse.ui.view.IRSEViewPart;
+import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
+import org.eclipse.rse.ui.view.SystemTableTreeView;
+import org.eclipse.rse.ui.view.SystemTableViewColumnManager;
+import org.eclipse.rse.ui.view.SystemTableViewProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.List;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.Widget;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.ISelectionListener;
+import org.eclipse.ui.ISelectionService;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.part.CellEditorActionHandler;
+import org.eclipse.ui.part.ViewPart;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+
+
+
+
+
+/**
+ * This is the desktop view wrapper of the System View viewer.
+ * ViewPart is from com.ibm.itp.ui.support.parts
+ */
+public class SystemMonitorViewPart
+ extends ViewPart
+ implements
+ ISelectionListener,
+ SelectionListener,
+ ISelectionChangedListener,
+ ISystemResourceChangeListener,
+ ISystemRemoteChangeListener,
+ ISystemMessageLine,
+ IRSEViewPart
+{
+
+
+ class RestoreStateRunnable implements Runnable
+ {
+ public void run()
+ {
+ }
+ }
+ class PositionToAction extends BrowseAction
+ {
+ class PositionToDialog extends SystemPromptDialog
+ {
+ private String _name;
+ private Combo _cbName;
+
+
+ public PositionToDialog(Shell shell, String title)
+ {
+ super(shell, title);
+ }
+
+ public String getPositionName()
+ {
+ return _name;
+ }
+
+ protected void buttonPressed(int buttonId)
+ {
+ setReturnCode(buttonId);
+ _name = _cbName.getText();
+ close();
+ }
+
+ protected Control getInitialFocusControl()
+ {
+ return _cbName;
+ }
+
+ public Control createInner(Composite parent)
+ {
+ Composite c = SystemWidgetHelpers.createComposite(parent, 2);
+
+ Label aLabel = new Label(c, SWT.NONE);
+ aLabel.setText(SystemPropertyResources.RESID_PROPERTY_NAME_LABEL);
+
+ _cbName = SystemWidgetHelpers.createCombo(c, null);
+ GridData textData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
+ _cbName.setLayoutData(textData);
+ _cbName.setText("*");
+ _cbName.setToolTipText(SystemResources.RESID_TABLE_POSITIONTO_ENTRY_TOOLTIP);
+
+ this.getShell().setText(SystemResources.RESID_TABLE_POSITIONTO_LABEL);
+ setHelp();
+ return c;
+ }
+
+ private void setHelp()
+ {
+ setHelp(SystemPlugin.HELPPREFIX + "gnpt0000");
+ }
+ }
+
+ public PositionToAction()
+ {
+ super(SystemMonitorViewPart.this, SystemResources.ACTION_POSITIONTO_LABEL, null);
+ setToolTipText(SystemResources.ACTION_POSITIONTO_TOOLTIP);
+ }
+
+ public void run()
+ {
+
+ PositionToDialog posDialog = new PositionToDialog(getViewer().getShell(), getTitle());
+ if (posDialog.open() == Window.OK)
+ {
+ String name = posDialog.getPositionName();
+
+ getViewer().positionTo(name);
+ }
+ }
+ }
+
+class SubSetAction extends BrowseAction
+ {
+ class SubSetDialog extends SystemPromptDialog
+ {
+ private String[] _filters;
+ private Text[] _controls;
+ private IPropertyDescriptor[] _uniqueDescriptors;
+
+
+ public SubSetDialog(Shell shell, IPropertyDescriptor[] uniqueDescriptors)
+ {
+ super(shell, SystemResources.RESID_TABLE_SUBSET_LABEL);
+ _uniqueDescriptors = uniqueDescriptors;
+ }
+
+ public String[] getFilters()
+ {
+ return _filters;
+ }
+
+ protected void buttonPressed(int buttonId)
+ {
+ setReturnCode(buttonId);
+
+ for (int i = 0; i < _controls.length; i++)
+ {
+ _filters[i] = _controls[i].getText();
+ }
+
+ close();
+ }
+
+ protected Control getInitialFocusControl()
+ {
+ return _controls[0];
+ }
+
+ public Control createInner(Composite parent)
+ {
+ Composite c = SystemWidgetHelpers.createComposite(parent, 2);
+
+ int numberOfFields = _uniqueDescriptors.length;
+ _controls = new Text[numberOfFields + 1];
+ _filters = new String[numberOfFields + 1];
+
+ Label nLabel = new Label(c, SWT.NONE);
+ nLabel.setText(SystemPropertyResources.RESID_PROPERTY_NAME_LABEL);
+
+
+ _controls[0] = SystemWidgetHelpers.createTextField(c, null);
+ GridData textData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
+ _controls[0].setLayoutData(textData);
+ _controls[0].setText("*");
+ _controls[0].setToolTipText(SystemResources.RESID_TABLE_SUBSET_ENTRY_TOOLTIP);
+
+
+
+ for (int i = 0; i < numberOfFields; i++)
+ {
+ IPropertyDescriptor des = _uniqueDescriptors[i];
+
+ Label aLabel = new Label(c, SWT.NONE);
+ aLabel.setText(des.getDisplayName());
+
+ _controls[i + 1] = SystemWidgetHelpers.createTextField(c, null);
+ GridData textData3 = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
+ _controls[i + 1].setLayoutData(textData3);
+ _controls[i + 1].setText("*");
+ }
+
+ setHelp();
+ return c;
+ }
+
+ private void setHelp()
+ {
+ setHelp(SystemPlugin.HELPPREFIX + "gnss0000");
+ }
+ }
+
+ public SubSetAction()
+ {
+ super(SystemMonitorViewPart.this, SystemResources.ACTION_SUBSET_LABEL, null);
+ setToolTipText(SystemResources.ACTION_SUBSET_TOOLTIP);
+ }
+
+ public void run()
+ {
+ SubSetDialog subsetDialog = new SubSetDialog(getViewer().getShell(), getViewer().getVisibleDescriptors(getViewer().getInput()));
+ if (subsetDialog.open() == Window.OK)
+ {
+ String[] filters = subsetDialog.getFilters();
+ getViewer().setViewFilters(filters);
+
+ }
+ }
+ }
+
+
+
+ class RefreshAction extends BrowseAction
+ {
+ public RefreshAction()
+ {
+ super(SystemMonitorViewPart.this, SystemResources.ACTION_REFRESH_LABEL,
+ //SystemPlugin.getDefault().getImageDescriptor(ICON_SYSTEM_REFRESH_ID));
+ SystemPlugin.getDefault().getImageDescriptorFromIDE(ISystemIconConstants.ICON_IDE_REFRESH_ID));
+ setTitleToolTip(SystemResources.ACTION_REFRESH_TOOLTIP);
+ }
+
+ public void run()
+ {
+ Object inputObject = getViewer().getInput();
+ if (inputObject instanceof ISystemContainer)
+ {
+ ((ISystemContainer)inputObject).markStale(true);
+ }
+ ((SystemTableViewProvider) getViewer().getContentProvider()).flushCache();
+ getViewer().refresh();
+
+ // refresh layout too
+ //_viewer.computeLayout(true);
+
+ }
+ }
+ private class SelectColumnsAction extends BrowseAction
+ {
+
+ class SelectColumnsDialog extends SystemPromptDialog
+ {
+ private ISystemViewElementAdapter _adapter;
+ private SystemTableViewColumnManager _columnManager;
+ private IPropertyDescriptor[] _uniqueDescriptors;
+ private ArrayList _currentDisplayedDescriptors;
+ private ArrayList _availableDescriptors;
+
+ private List _availableList;
+ private List _displayedList;
+
+ private Button _addButton;
+ private Button _removeButton;
+ private Button _upButton;
+ private Button _downButton;
+
+
+ public SelectColumnsDialog(Shell shell, ISystemViewElementAdapter viewAdapter, SystemTableViewColumnManager columnManager)
+ {
+ super(shell, SystemResources.RESID_TABLE_SELECT_COLUMNS_LABEL);
+ _adapter = viewAdapter;
+ _columnManager = columnManager;
+ _uniqueDescriptors = viewAdapter.getUniquePropertyDescriptors();
+ IPropertyDescriptor[] initialDisplayedDescriptors = _columnManager.getVisibleDescriptors(_adapter);
+ _currentDisplayedDescriptors = new ArrayList(initialDisplayedDescriptors.length);
+ for (int i = 0; i < initialDisplayedDescriptors.length;i++)
+ {
+ if (!_currentDisplayedDescriptors.contains(initialDisplayedDescriptors[i]))
+ _currentDisplayedDescriptors.add(initialDisplayedDescriptors[i]);
+ }
+ _availableDescriptors = new ArrayList(_uniqueDescriptors.length);
+ for (int i = 0; i < _uniqueDescriptors.length;i++)
+ {
+ if (!_currentDisplayedDescriptors.contains(_uniqueDescriptors[i]))
+ {
+ _availableDescriptors.add(_uniqueDescriptors[i]);
+ }
+ }
+ }
+
+
+ public void handleEvent(Event e)
+ {
+ Widget source = e.widget;
+ if (source == _addButton)
+ {
+ int[] toAdd = _availableList.getSelectionIndices();
+ addToDisplay(toAdd);
+ }
+ else if (source == _removeButton)
+ {
+ int[] toAdd = _displayedList.getSelectionIndices();
+ removeFromDisplay(toAdd);
+ }
+ else if (source == _upButton)
+ {
+ int index = _displayedList.getSelectionIndex();
+ moveUp(index);
+ _displayedList.select(index - 1);
+ }
+ else if (source == _downButton)
+ {
+ int index = _displayedList.getSelectionIndex();
+ moveDown(index);
+ _displayedList.select(index + 1);
+ }
+
+ // update button enable states
+ updateEnableStates();
+ }
+
+ public IPropertyDescriptor[] getDisplayedColumns()
+ {
+ IPropertyDescriptor[] displayedColumns = new IPropertyDescriptor[_currentDisplayedDescriptors.size()];
+ for (int i = 0; i< _currentDisplayedDescriptors.size();i++)
+ {
+ displayedColumns[i]= (IPropertyDescriptor)_currentDisplayedDescriptors.get(i);
+ }
+ return displayedColumns;
+ }
+
+ private void updateEnableStates()
+ {
+ boolean enableAdd = false;
+ boolean enableRemove = false;
+ boolean enableUp = false;
+ boolean enableDown = false;
+
+ int[] availableSelected = _availableList.getSelectionIndices();
+ for (int i = 0; i < availableSelected.length; i++)
+ {
+ int index = availableSelected[i];
+ IPropertyDescriptor descriptor = (IPropertyDescriptor)_availableDescriptors.get(index);
+ if (!_currentDisplayedDescriptors.contains(descriptor))
+ {
+ enableAdd = true;
+ }
+ }
+
+ if (_displayedList.getSelectionCount()>0)
+ {
+ enableRemove = true;
+
+ int index = _displayedList.getSelectionIndex();
+ if (index > 0)
+ {
+ enableUp = true;
+ }
+ if (index < _displayedList.getItemCount()-1)
+ {
+ enableDown = true;
+ }
+ }
+
+ _addButton.setEnabled(enableAdd);
+ _removeButton.setEnabled(enableRemove);
+ _upButton.setEnabled(enableUp);
+ _downButton.setEnabled(enableDown);
+
+ }
+
+ private void moveUp(int index)
+ {
+ Object obj = _currentDisplayedDescriptors.remove(index);
+ _currentDisplayedDescriptors.add(index - 1, obj);
+ refreshDisplayedList();
+ }
+
+ private void moveDown(int index)
+ {
+ Object obj = _currentDisplayedDescriptors.remove(index);
+ _currentDisplayedDescriptors.add(index + 1, obj);
+
+ refreshDisplayedList();
+ }
+
+ private void addToDisplay(int[] toAdd)
+ {
+ ArrayList added = new ArrayList();
+ for (int i = 0; i < toAdd.length; i++)
+ {
+ int index = toAdd[i];
+
+ IPropertyDescriptor descriptor = (IPropertyDescriptor)_availableDescriptors.get(index);
+
+ if (!_currentDisplayedDescriptors.contains(descriptor))
+ {
+ _currentDisplayedDescriptors.add(descriptor);
+ added.add(descriptor);
+ }
+ }
+
+ for (int i = 0; i < added.size(); i++)
+ {
+ _availableDescriptors.remove(added.get(i));
+ }
+
+
+ refreshAvailableList();
+ refreshDisplayedList();
+
+ }
+
+ private void removeFromDisplay(int[] toRemove)
+ {
+ for (int i = 0; i < toRemove.length; i++)
+ {
+ int index = toRemove[i];
+ IPropertyDescriptor descriptor = (IPropertyDescriptor)_currentDisplayedDescriptors.get(index);
+ _currentDisplayedDescriptors.remove(index);
+ _availableDescriptors.add(descriptor);
+ }
+ refreshDisplayedList();
+ refreshAvailableList();
+ }
+
+ protected void buttonPressed(int buttonId)
+ {
+ setReturnCode(buttonId);
+
+ close();
+ }
+
+ protected Control getInitialFocusControl()
+ {
+ return _availableList;
+ }
+
+ public Control createInner(Composite parent)
+ {
+ Composite main = SystemWidgetHelpers.createComposite(parent, 1);
+
+ Label label = SystemWidgetHelpers.createLabel(main, SystemResources.RESID_TABLE_SELECT_COLUMNS_DESCRIPTION_LABEL);
+
+ Composite c = SystemWidgetHelpers.createComposite(main, 4);
+ c.setLayoutData(new GridData(GridData.FILL_BOTH));
+ _availableList = SystemWidgetHelpers.createListBox(c, SystemResources.RESID_TABLE_SELECT_COLUMNS_AVAILABLE_LABEL, this, true);
+
+ Composite addRemoveComposite = SystemWidgetHelpers.createComposite(c, 1);
+ addRemoveComposite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_CENTER));
+ _addButton = SystemWidgetHelpers.createPushButton(addRemoveComposite,
+ SystemResources.RESID_TABLE_SELECT_COLUMNS_ADD_LABEL,
+ this);
+ _addButton.setToolTipText(SystemResources.RESID_TABLE_SELECT_COLUMNS_ADD_TOOLTIP);
+
+ _removeButton = SystemWidgetHelpers.createPushButton(addRemoveComposite,
+ SystemResources.RESID_TABLE_SELECT_COLUMNS_REMOVE_LABEL,
+ this);
+ _removeButton.setToolTipText(SystemResources.RESID_TABLE_SELECT_COLUMNS_REMOVE_TOOLTIP);
+
+ _displayedList = SystemWidgetHelpers.createListBox(c, SystemResources.RESID_TABLE_SELECT_COLUMNS_DISPLAYED_LABEL, this, false);
+
+ Composite upDownComposite = SystemWidgetHelpers.createComposite(c, 1);
+ upDownComposite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_CENTER));
+ _upButton = SystemWidgetHelpers.createPushButton(upDownComposite,
+ SystemResources.RESID_TABLE_SELECT_COLUMNS_UP_LABEL,
+ this);
+ _upButton.setToolTipText(SystemResources.RESID_TABLE_SELECT_COLUMNS_UP_TOOLTIP);
+
+ _downButton = SystemWidgetHelpers.createPushButton(upDownComposite,
+ SystemResources.RESID_TABLE_SELECT_COLUMNS_DOWN_LABEL,
+ this);
+ _downButton.setToolTipText(SystemResources.RESID_TABLE_SELECT_COLUMNS_DOWN_TOOLTIP);
+
+ initLists();
+
+ setHelp();
+ return c;
+ }
+
+ private void initLists()
+ {
+ refreshAvailableList();
+ refreshDisplayedList();
+ updateEnableStates();
+ }
+
+ private void refreshAvailableList()
+ {
+ _availableList.removeAll();
+ // initialize available list
+ for (int i = 0; i < _availableDescriptors.size(); i++)
+ {
+ IPropertyDescriptor descriptor = (IPropertyDescriptor)_availableDescriptors.get(i);
+ _availableList.add(descriptor.getDisplayName());
+ }
+ }
+
+ private void refreshDisplayedList()
+ {
+ _displayedList.removeAll();
+ // initialize display list
+ for (int i = 0; i < _currentDisplayedDescriptors.size(); i++)
+ {
+
+ Object obj = _currentDisplayedDescriptors.get(i);
+ if (obj != null && obj instanceof IPropertyDescriptor)
+ {
+ _displayedList.add(((IPropertyDescriptor)obj).getDisplayName());
+ }
+ }
+ }
+
+ private void setHelp()
+ {
+ setHelp(SystemPlugin.HELPPREFIX + "gntc0000");
+ }
+ }
+
+ public SelectColumnsAction()
+ {
+ super(SystemMonitorViewPart.this, SystemResources.ACTION_SELECTCOLUMNS_LABEL, null);
+ setToolTipText(SystemResources.ACTION_SELECTCOLUMNS_TOOLTIP);
+ setImageDescriptor(SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_FILTER_ID));
+ }
+
+ public void checkEnabledState()
+ {
+
+ if (getViewer() != null && getViewer().getInput() != null)
+ {
+ setEnabled(true);
+ }
+ else
+ {
+ setEnabled(false);
+ }
+ }
+ public void run()
+ {
+ SystemTableTreeView viewer = getViewer();
+ SystemTableViewColumnManager mgr = viewer.getColumnManager();
+ ISystemViewElementAdapter adapter = viewer.getAdapterForContents();
+ SelectColumnsDialog dlg = new SelectColumnsDialog(getShell(), adapter, mgr);
+ if (dlg.open() == Window.OK)
+ {
+ mgr.setCustomDescriptors(adapter, dlg.getDisplayedColumns());
+ viewer.computeLayout(true);
+ viewer.refresh();
+ }
+ }
+ }
+
+ MonitorViewWorkbook _folder = null;
+ private CellEditorActionHandler _editorActionHandler = null;
+
+ // for ISystemMessageLine
+ private String _message, _errorMessage;
+ private SystemMessage sysErrorMessage;
+ private IStatusLineManager _statusLine = null;
+
+ private SelectColumnsAction _selectColumnsAction = null;
+ private RefreshAction _refreshAction = null;
+
+ private ClearAction _clearAllAction = null;
+ private ClearSelectedAction _clearSelectedAction = null;
+
+ private SubSetAction _subsetAction = null;
+ private PositionToAction _positionToAction = null;
+
+ // constants
+ public static final String ID = "org.eclipse.rse.ui.view.monitorView";
+ // matches id in plugin.xml, view tag
+
+ public void setFocus()
+ {
+ _folder.showCurrentPage();
+ }
+
+ public Shell getShell()
+ {
+ return _folder.getShell();
+ }
+
+ public SystemTableTreeView getViewer()
+ {
+ return _folder.getViewer();
+ }
+
+ public Viewer getRSEViewer()
+ {
+ return _folder.getViewer();
+ }
+
+ public CellEditorActionHandler getEditorActionHandler()
+ {
+ if (_editorActionHandler == null)
+ {
+ _editorActionHandler = new CellEditorActionHandler(getViewSite().getActionBars());
+ }
+ return _editorActionHandler;
+ }
+
+ public void createPartControl(Composite parent)
+ {
+ _folder = new MonitorViewWorkbook(parent, this);
+ _folder.getFolder().addSelectionListener(this);
+
+ ISelectionService selectionService = getSite().getWorkbenchWindow().getSelectionService();
+ selectionService.addSelectionListener(this);
+
+
+ SystemWidgetHelpers.setHelp(_folder, SystemPlugin.HELPPREFIX + "ucmd0000");
+
+ ISystemRegistry registry = SystemPlugin.getTheSystemRegistry();
+ registry.addSystemResourceChangeListener(this);
+ registry.addSystemRemoteChangeListener(this);
+
+
+ RestoreStateRunnable restore = new RestoreStateRunnable();
+ Display.getCurrent().asyncExec(restore);
+
+ fillLocalToolBar();
+
+ }
+
+ public void selectionChanged(IWorkbenchPart part, ISelection sel)
+ {
+ }
+
+ public void dispose()
+ {
+ ISelectionService selectionService = getSite().getWorkbenchWindow().getSelectionService();
+ selectionService.removeSelectionListener(this);
+ _folder.dispose();
+
+ ISystemRegistry registry = SystemPlugin.getTheSystemRegistry();
+ registry.removeSystemResourceChangeListener(this);
+ super.dispose();
+ }
+
+ public void updateActionStates()
+ {
+
+ if (_folder != null && _folder.getInput() != null)
+ {
+ }
+ if (_clearAllAction != null)
+ {
+ _clearAllAction.checkEnabledState();
+ _clearSelectedAction.checkEnabledState();
+ _selectColumnsAction.checkEnabledState();
+ _refreshAction.checkEnabledState();
+ _positionToAction.checkEnabledState();
+ }
+ }
+
+ public void fillLocalToolBar()
+ {
+ if (_folder != null )
+ {
+
+
+ //updateActionStates();
+
+ IActionBars actionBars = getViewSite().getActionBars();
+
+ _refreshAction= new RefreshAction();
+
+ _clearSelectedAction = new ClearSelectedAction(this);
+ _clearAllAction = new ClearAction(this);
+
+ _selectColumnsAction = new SelectColumnsAction();
+
+ _subsetAction = new SubSetAction();
+ _positionToAction = new PositionToAction();
+
+ IToolBarManager toolBarManager = actionBars.getToolBarManager();
+ addToolBarItems(toolBarManager);
+ addToolBarMenuItems(actionBars.getMenuManager());
+ }
+ updateActionStates();
+ }
+
+ private void addToolBarItems(IToolBarManager toolBarManager)
+ {
+ toolBarManager.removeAll();
+
+ toolBarManager.add(_refreshAction);
+
+ toolBarManager.add(new Separator());
+ toolBarManager.add(_clearSelectedAction);
+ toolBarManager.add(_clearAllAction);
+
+ toolBarManager.add(new Separator());
+ toolBarManager.add(_selectColumnsAction);
+
+ toolBarManager.update(true);
+ }
+
+
+
+ public void selectionChanged(SelectionChangedEvent e)
+ {
+ }
+
+
+
+ public void addItemToMonitor(IAdaptable root)
+ {
+ if (root != null)
+ {
+ _folder.addItemToMonitor(root, true);
+ if (true)
+ updateActionStates();
+ }
+ }
+
+ public void removeItemToMonitor(IAdaptable root)
+ {
+ if (root != null)
+ {
+ _folder.remove(root);
+ if (true)
+ updateActionStates();
+ }
+ }
+
+ public void removeAllItemsToMonitor()
+ {
+ while (_folder.getInput() != null)
+ {
+ removeItemToMonitor((IAdaptable)_folder.getInput());
+ }
+ }
+
+ public void setInput(IAdaptable object)
+ {
+ _folder.setInput(object);
+ }
+
+
+ /**
+ * Used to asynchronously update the view whenever properties change.
+ */
+ public void systemResourceChanged(ISystemResourceChangeEvent event)
+ {
+
+ Object child = event.getSource();
+ SystemTableTreeView viewer = getViewer();
+ if (viewer != null)
+ {
+ Object input = viewer.getInput();
+ switch (event.getType())
+ {
+ case ISystemResourceChangeEvents.EVENT_PROPERTY_CHANGE:
+ {
+ _folder.removeDisconnected();
+ }
+ break;
+ case ISystemResourceChangeEvents.EVENT_RENAME:
+ {
+ if (child == input)
+ {
+ _folder.getCurrentTabItem().updateTitle((IAdaptable)child);
+ }
+ }
+ break;
+ case ISystemResourceChangeEvents.EVENT_DELETE:
+ case ISystemResourceChangeEvents.EVENT_DELETE_MANY:
+ {
+ if (child == input)
+ {
+ removeItemToMonitor((IAdaptable)child);
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ /**
+ * This is the method in your class that will be called when a remote resource
+ * changes. You will be called after the resource is changed.
+ * @see org.eclipse.rse.model.ISystemRemoteChangeEvent
+ */
+ public void systemRemoteResourceChanged(ISystemRemoteChangeEvent event)
+ {
+ int eventType = event.getEventType();
+ Object remoteResourceParent = event.getResourceParent();
+ Object remoteResource = event.getResource();
+
+ Vector remoteResourceNames = null;
+ if (remoteResource instanceof Vector)
+ {
+ remoteResourceNames = (Vector) remoteResource;
+ remoteResource = remoteResourceNames.elementAt(0);
+ }
+
+ Object child = event.getResource();
+
+ SystemTableTreeView viewer = getViewer();
+ if (viewer != null)
+ {
+ Object input = viewer.getInput();
+ if (input == child || child instanceof Vector)
+ {
+ switch (eventType)
+ {
+ // --------------------------
+ // REMOTE RESOURCE CHANGED...
+ // --------------------------
+ case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_CHANGED :
+ break;
+
+ // --------------------------
+ // REMOTE RESOURCE CREATED...
+ // --------------------------
+ case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_CREATED :
+ break;
+
+ // --------------------------
+ // REMOTE RESOURCE DELETED...
+ // --------------------------
+ case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_DELETED :
+ {
+ if (child instanceof Vector)
+ {
+ Vector vec = (Vector)child;
+ for (int v = 0; v < vec.size(); v++)
+ {
+ Object c = vec.get(v);
+
+ }
+ }
+ else
+ {
+
+ return;
+ }
+ }
+ break;
+
+ // --------------------------
+ // REMOTE RESOURCE RENAMED...
+ // --------------------------
+ case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_RENAMED :
+ {
+ addItemToMonitor((IAdaptable)child);
+ }
+
+ break;
+ }
+ }
+ }
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e)
+ {
+ widgetSelected(e);
+ }
+
+ public void widgetSelected(SelectionEvent e)
+ {
+ Widget source = e.widget;
+
+ if (source == _folder.getFolder())
+ {
+ updateActionStates();
+ }
+ }
+
+
+// -------------------------------
+ // ISystemMessageLine interface...
+ // -------------------------------
+ /**
+ * Clears the currently displayed error message and redisplayes
+ * the message which was active before the error message was set.
+ */
+ public void clearErrorMessage()
+ {
+ _errorMessage = null;
+ sysErrorMessage = null;
+ if (_statusLine != null)
+ _statusLine.setErrorMessage(_errorMessage);
+ }
+ /**
+ * Clears the currently displayed message.
+ */
+ public void clearMessage()
+ {
+ _message = null;
+ if (_statusLine != null)
+ _statusLine.setMessage(_message);
+ }
+ /**
+ * Get the currently displayed error text.
+ * @return The error message. If no error message is displayed null
is returned.
+ */
+ public String getErrorMessage()
+ {
+ return _errorMessage;
+ }
+ /**
+ * Get the currently displayed message.
+ * @return The message. If no message is displayed null
is returned.
+ */
+ public String getMessage()
+ {
+ return _message;
+ }
+ /**
+ * Display the given error message. A currently displayed message
+ * is saved and will be redisplayed when the error message is cleared.
+ */
+ public void setErrorMessage(String message)
+ {
+ this._errorMessage = message;
+ if (_statusLine != null)
+ _statusLine.setErrorMessage(message);
+ }
+ /**
+ * Get the currently displayed error text.
+ * @return The error message. If no error message is displayed
if the container must be a direct ancestor of the child item,
+ * null
is returned.
+ */
+ public SystemMessage getSystemErrorMessage()
+ {
+ return sysErrorMessage;
+ }
+
+ /**
+ * Display the given error message. A currently displayed message
+ * is saved and will be redisplayed when the error message is cleared.
+ */
+ public void setErrorMessage(SystemMessage message)
+ {
+ sysErrorMessage = message;
+ setErrorMessage(message.getLevelOneText());
+ }
+ /**
+ * Display the given error message. A currently displayed message
+ * is saved and will be redisplayed when the error message is cleared.
+ */
+ public void setErrorMessage(Throwable exc)
+ {
+ setErrorMessage(exc.getMessage());
+ }
+
+ /**
+ * Set the message text. If the message line currently displays an error,
+ * the message is stored and will be shown after a call to clearErrorMessage
+ */
+ public void setMessage(String message)
+ {
+ this._message = message;
+ if (_statusLine != null)
+ _statusLine.setMessage(message);
+ }
+ /**
+ *If the message line currently displays an error,
+ * the message is stored and will be shown after a call to clearErrorMessage
+ */
+ public void setMessage(SystemMessage message)
+ {
+ setMessage(message.getLevelOneText());
+ }
+
+ private void addToolBarMenuItems(IMenuManager menuManager)
+ {
+ menuManager.removeAll();
+ menuManager.add(_selectColumnsAction);
+ menuManager.add(new Separator("Filter"));
+ menuManager.add(_positionToAction);
+ menuManager.add(_subsetAction);
+ }
+
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/TabFolderLayout.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/TabFolderLayout.java
new file mode 100644
index 00000000000..7b3493d154f
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/TabFolderLayout.java
@@ -0,0 +1,61 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view.monitor;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Layout;
+
+public class TabFolderLayout extends Layout {
+
+
+
+ protected Point computeSize (Composite composite, int wHint, int hHint, boolean flushCache) {
+ if (wHint != SWT.DEFAULT && hHint != SWT.DEFAULT)
+ return new Point(wHint, hHint);
+
+ Control [] children = composite.getChildren ();
+ int count = children.length;
+ int maxWidth = 0, maxHeight = 0;
+ for (int i=0; ifalse
otherwise.
+ * @return true
if there is an ancestry relationship, false
otherwise.
+ */
+ private boolean isAncestorOf(TreeItem container, TreeItem item, boolean direct)
+ {
+ TreeItem[] children = null;
+
+ // does not have to be a direct ancestor
+ if (!direct) {
+ // get the children of the container's parent, i.e. the container's siblings
+ // as well as itself
+ TreeItem parent = container.getParentItem();
+
+ // check if parent is null
+ // parent is null if the container is a root item
+ if (parent != null) {
+ children = parent.getItems();
+ }
+ else {
+ children = getTree().getItems();
+ }
+ }
+ // must be a direct ancestor
+ else {
+ // get the children of the container
+ children = container.getItems();
+ }
+
+ // go through all the children
+ for (int i = 0; i < children.length; i++) {
+
+ TreeItem child = children[i];
+
+ // if one of the children matches the child item, return true
+ if (child == item && direct) {
+ return true;
+ }
+ // otherwise, go through children, and see if any of those are ancestors of
+ // the child item
+ else if (child.getItemCount() > 0) {
+
+ // we check for direct ancestry
+ if (isAncestorOf(child, item, true)) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * --------------------------------------------------------------------------------
+ * For many actions we have to walk the selection list and examine each selected
+ * object to decide if a given common action is supported or not.
+ * null
is returned.
+ */
+ public String getErrorMessage()
+ {
+ return _errorMessage;
+ }
+ /**
+ * Get the currently displayed message.
+ * @return The message. If no message is displayed null
is returned.
+ */
+ public String getMessage()
+ {
+ return _message;
+ }
+ /**
+ * Display the given error message. A currently displayed message
+ * is saved and will be redisplayed when the error message is cleared.
+ */
+ public void setErrorMessage(String message)
+ {
+ this._errorMessage = message;
+ if (_statusLine != null)
+ _statusLine.setErrorMessage(message);
+ }
+ /**
+ * Get the currently displayed error text.
+ * @return The error message. If no error message is displayed
null
is returned.
+ */
+ public SystemMessage getSystemErrorMessage()
+ {
+ return sysErrorMessage;
+ }
+
+ /**
+ * Display the given error message. A currently displayed message
+ * is saved and will be redisplayed when the error message is cleared.
+ */
+ public void setErrorMessage(SystemMessage message)
+ {
+ sysErrorMessage = message;
+ setErrorMessage(message.getLevelOneText());
+ }
+ /**
+ * Display the given error message. A currently displayed message
+ * is saved and will be redisplayed when the error message is cleared.
+ */
+ public void setErrorMessage(Throwable exc)
+ {
+ setErrorMessage(exc.getMessage());
+ }
+
+ /**
+ * Set the message text. If the message line currently displays an error,
+ * the message is stored and will be shown after a call to clearErrorMessage
+ */
+ public void setMessage(String message)
+ {
+ this._message = message;
+ if (_statusLine != null)
+ _statusLine.setMessage(message);
+ }
+ /**
+ *If the message line currently displays an error,
+ * the message is stored and will be shown after a call to clearErrorMessage
+ */
+ public void setMessage(SystemMessage message)
+ {
+ setMessage(message.getLevelOneText());
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/scratchpad/SystemScratchpadViewProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/scratchpad/SystemScratchpadViewProvider.java
new file mode 100644
index 00000000000..33861297529
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/scratchpad/SystemScratchpadViewProvider.java
@@ -0,0 +1,181 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view.scratchpad;
+
+import java.util.Hashtable;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.util.ListenerList;
+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.rse.ui.view.ISystemViewElementAdapter;
+import org.eclipse.swt.graphics.Image;
+
+
+/**
+ * This is the content and label provider for the SystemScratchpadView.
+ * This class is used both to populate the SystemScratchpadView but also
+ * to resolve the icon and labels for the cells in the table/tree.
+ *
+ */
+public class SystemScratchpadViewProvider implements ILabelProvider, ITreeContentProvider
+{
+
+
+ private ListenerList listeners = new ListenerList(1);
+
+
+ /**
+ * The cache of images that have been dispensed by this provider.
+ * Maps ImageDescriptor->Image.
+ */
+ private Map imageTable = new Hashtable(40);
+ private SystemScratchpadView _view;
+
+ public SystemScratchpadViewProvider(SystemScratchpadView view)
+ {
+ super();
+ _view = view;
+ }
+
+ public void inputChanged(Viewer visualPart, Object oldInput, Object newInput)
+ {
+ }
+
+
+
+ public boolean isDeleted(Object element)
+ {
+ return false;
+ }
+
+ public Object[] getChildren(Object object)
+ {
+ return getElements(object);
+ }
+
+ public Object getParent(Object object)
+ {
+ return getAdapterFor(object).getParent(object);
+ }
+
+ public boolean hasChildren(Object object)
+ {
+ return getAdapterFor(object).hasChildren(object);
+
+ }
+
+ public Object getElementAt(Object object, int i)
+ {
+
+ return null;
+ }
+
+ protected ISystemViewElementAdapter getAdapterFor(Object object)
+ {
+ if (object instanceof IAdaptable)
+ {
+ IAdaptable adapt = (IAdaptable) object;
+ if (adapt != null)
+ {
+ ISystemViewElementAdapter result = (ISystemViewElementAdapter) adapt.getAdapter(ISystemViewElementAdapter.class);
+ result.setPropertySourceInput(object);
+ result.setViewer(_view);
+
+ return result;
+ }
+ }
+
+ return null;
+ }
+
+ public Object[] getElements(Object object)
+ {
+ Object[] results = null;
+
+ if (object instanceof IAdaptable)
+ {
+ ISystemViewElementAdapter adapter = getAdapterFor(object);
+ if (adapter != null && adapter.hasChildren(object))
+ {
+ results = adapter.getChildren(object);
+ }
+ }
+ if (results == null)
+ {
+ return new Object[0];
+ }
+
+ return results;
+ }
+
+ public String getText(Object object)
+ {
+ return getAdapterFor(object).getText(object);
+ }
+
+ public Image getImage(Object object)
+ {
+
+ ImageDescriptor descriptor = getAdapterFor(object).getImageDescriptor(object);
+
+ Image image = null;
+ if (descriptor != null)
+ {
+ Object iobj = imageTable.get(descriptor);
+ if (iobj == null)
+ {
+ image = descriptor.createImage();
+ imageTable.put(descriptor, image);
+ }
+ else
+ {
+ image = (Image) iobj;
+ }
+ }
+
+ return image;
+ }
+
+
+ public void addListener(ILabelProviderListener listener)
+ {
+ listeners.add(listener);
+ }
+
+ public boolean isLabelProperty(Object element, String property)
+ {
+ return true;
+ }
+
+ public void removeListener(ILabelProviderListener listener)
+ {
+ listeners.remove(listener);
+ }
+
+ public void dispose()
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchClearHistoryAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchClearHistoryAction.java
new file mode 100644
index 00000000000..ec9cd255002
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchClearHistoryAction.java
@@ -0,0 +1,51 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view.search;
+
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.actions.SystemBaseAction;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * This action clears the history in the Remote Search view.
+ */
+public class SystemSearchClearHistoryAction extends SystemBaseAction {
+
+ private SystemSearchViewPart searchView;
+
+ /**
+ * Constructor for action.
+ * @param searchView the remote search view.
+ * @param shell the shell.
+ */
+ public SystemSearchClearHistoryAction(SystemSearchViewPart searchView, Shell shell) {
+ super(SystemResources.RESID_SEARCH_CLEAR_HISTORY_LABEL,SystemResources.RESID_SEARCH_CLEAR_HISTORY_TOOLTIP,
+ SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SEARCH_CLEAR_HISTORY_ID), shell);
+
+ this.searchView = searchView;
+ }
+
+ /**
+ * @see org.eclipse.jface.action.IAction#run()
+ */
+ public void run() {
+ searchView.deleteAllPages();
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchCopyToClipboardAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchCopyToClipboardAction.java
new file mode 100644
index 00000000000..0089fc6f55c
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchCopyToClipboardAction.java
@@ -0,0 +1,56 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view.search;
+
+import org.eclipse.rse.ui.actions.SystemCopyToClipboardAction;
+import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * Action that copies objects selected in Remote Search view to clipboard.
+ */
+public class SystemSearchCopyToClipboardAction extends SystemCopyToClipboardAction {
+
+ /**
+ * Constructor.
+ * @param shell the shell.
+ * @param clipboard the system clipboard.
+ */
+ public SystemSearchCopyToClipboardAction(Shell shell, Clipboard clipboard) {
+ super(shell, clipboard);
+ }
+
+ /**
+ * Returns the string "\t" if the object is a remote search result, otherwise returns the super class
+ * implementation.
+ * @see com.ibm.etools.systems.files.ui.actions.SystemCopyToClipboardAction#getTextTransferPrepend(java.lang.Object, org.eclipse.rse.ui.view.ISystemViewElementAdapter)
+ */
+ protected String getTextTransferPrepend(Object obj, ISystemViewElementAdapter adapter) {
+ /** shouldn't be coupled with search (files ui)
+ if (adapter instanceof SystemViewRemoteSearchResultAdapter)
+ {
+ return "\t";
+ }
+ else
+ **/
+ {
+ return super.getTextTransferPrepend(obj, adapter);
+ }
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchHistoryAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchHistoryAction.java
new file mode 100644
index 00000000000..e93c7167575
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchHistoryAction.java
@@ -0,0 +1,61 @@
+/********************************************************************************
+ * Copyright (c) 2003, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view.search;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.resource.ImageDescriptor;
+
+/**
+ * This is the history action for the remote system search view.
+ */
+public class SystemSearchHistoryAction extends Action {
+
+
+
+ private SystemSearchViewPart searchView;
+ private int index;
+
+ /**
+ * Constructor for SystemSearchHistoryAction.
+ * @param text the text for the action.
+ * @param image the image.
+ * @param searchView the search view.
+ * @param index the index in the history.
+ */
+ public SystemSearchHistoryAction(String text, ImageDescriptor image, SystemSearchViewPart searchView, int index) {
+ super(text, image);
+ setToolTipText(text);
+ this.searchView = searchView;
+ this.index = index;
+ }
+
+ /**
+ * @see org.eclipse.jface.action.IAction#run()
+ */
+ public void run() {
+ searchView.showSearchResult(index);
+ }
+
+ /**
+ * Sets the text and the tooltip.
+ * @see org.eclipse.jface.action.IAction#setText(java.lang.String)
+ */
+ public void setText(String text) {
+ super.setText(text);
+ setToolTipText(text);
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchRemoveAllMatchesAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchRemoveAllMatchesAction.java
new file mode 100644
index 00000000000..818e147290d
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchRemoveAllMatchesAction.java
@@ -0,0 +1,52 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view.search;
+
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.actions.SystemBaseAction;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * This action removes all matches from the Remote Search view.
+ */
+public class SystemSearchRemoveAllMatchesAction extends SystemBaseAction {
+
+ private SystemSearchViewPart searchView;
+
+ /**
+ * Constructor for action.
+ * @param searchView the remote search view.
+ * @param shell the shell.
+ */
+ public SystemSearchRemoveAllMatchesAction(SystemSearchViewPart searchView, Shell shell) {
+ super(SystemResources.RESID_SEARCH_REMOVE_ALL_MATCHES_LABEL,SystemResources.RESID_SEARCH_REMOVE_ALL_MATCHES_TOOLTIP,
+ SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SEARCH_REMOVE_ALL_MATCHES_ID),
+ shell);
+
+ this.searchView = searchView;
+ }
+
+ /**
+ * @see org.eclipse.jface.action.IAction#run()
+ */
+ public void run() {
+ searchView.deleteCurrentPage();
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchRemoveSelectedMatchesAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchRemoveSelectedMatchesAction.java
new file mode 100644
index 00000000000..bb9808446cc
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchRemoveSelectedMatchesAction.java
@@ -0,0 +1,52 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view.search;
+
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.actions.SystemBaseAction;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * This action removes selected matches from the Remote Search view.
+ */
+public class SystemSearchRemoveSelectedMatchesAction extends SystemBaseAction {
+
+ private SystemSearchViewPart searchView;
+
+ /**
+ * Constructor for action.
+ * @param searchView the remote search view.
+ * @param shell the shell.
+ */
+ public SystemSearchRemoveSelectedMatchesAction(SystemSearchViewPart searchView, Shell shell) {
+ super(SystemResources.RESID_SEARCH_REMOVE_SELECTED_MATCHES_LABEL,SystemResources.RESID_SEARCH_REMOVE_SELECTED_MATCHES_TOOLTIP,
+ SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SEARCH_REMOVE_SELECTED_MATCHES_ID),
+ shell);
+
+ this.searchView = searchView;
+ }
+
+ /**
+ * @see org.eclipse.jface.action.IAction#run()
+ */
+ public void run() {
+ searchView.deleteSelected();
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchTableView.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchTableView.java
new file mode 100644
index 00000000000..b47f79ed371
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchTableView.java
@@ -0,0 +1,374 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view.search;
+
+import java.util.Vector;
+
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.model.ISystemRemoteChangeEvent;
+import org.eclipse.rse.model.ISystemRemoteChangeEvents;
+import org.eclipse.rse.model.ISystemResourceChangeEvent;
+import org.eclipse.rse.model.ISystemResourceChangeEvents;
+import org.eclipse.rse.services.search.IHostSearchResultConfiguration;
+import org.eclipse.rse.services.search.IHostSearchResultSet;
+import org.eclipse.rse.ui.messages.ISystemMessageLine;
+import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
+import org.eclipse.rse.ui.view.SystemDecoratingLabelProvider;
+import org.eclipse.rse.ui.view.SystemTableTreeView;
+import org.eclipse.rse.ui.view.SystemTableTreeViewProvider;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.Widget;
+
+
+public class SystemSearchTableView extends SystemTableTreeView
+{
+
+
+ private boolean _firstRefresh = true;
+ private IHostSearchResultSet resultSet;
+
+ public SystemSearchTableView(Tree tabletree, IHostSearchResultSet resultSet, ISystemMessageLine msgLine)
+ {
+ super(tabletree, msgLine);
+ this.resultSet = resultSet;
+
+ setLabelProvider(new SystemDecoratingLabelProvider(_provider, SystemPlugin.getDefault().getWorkbench().getDecoratorManager().getLabelDecorator()));
+ }
+
+ public IHostSearchResultSet getResultSet() {
+ return resultSet;
+ }
+
+
+ public void systemRemoteResourceChanged(ISystemRemoteChangeEvent event)
+ {
+ int eventType = event.getEventType();
+
+ SystemTableTreeViewProvider provider = (SystemTableTreeViewProvider)getContentProvider();
+
+ IHostSearchResultSet resultSet = null;
+
+ if (getInput() instanceof IHostSearchResultSet) {
+ resultSet = (IHostSearchResultSet)getInput();
+ }
+
+ if (resultSet == null) {
+ return;
+ }
+
+ switch (eventType)
+ {
+ // --------------------------
+ // REMOTE RESOURCE DELETED...
+ // --------------------------
+ case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_DELETED :
+ {
+ {
+ Object remoteResource = event.getResource();
+ Vector remoteResourceNames = null;
+
+ if (remoteResource instanceof Vector)
+ {
+ remoteResourceNames = (Vector) remoteResource;
+ remoteResource = remoteResourceNames.elementAt(0);
+ }
+ else
+ {
+ remoteResourceNames = new Vector();
+ remoteResourceNames.add(remoteResource);
+ }
+
+ for (int d = 0; d < remoteResourceNames.size(); d++)
+ {
+ Object dchild = remoteResourceNames.get(d);
+
+ ISystemViewElementAdapter dadapt = getAdapter(dchild);
+ ISubSystem dSubSystem = dadapt.getSubSystem(dchild);
+ String dkey = dadapt.getAbsoluteName(dchild);
+
+ // this will use cache if there is one already
+ // note: do not call provider.getCache() since the
+ // cache is changed if getChildren() is called with
+ // an object other than the input (so if we expand
+ // a tree node then the cache will be the children
+ // of that node, and not the root nodes of the tree)
+ Object[] children = provider.getChildren(resultSet);
+
+ for (int i = 0; i < children.length; i++)
+ {
+ Object existingChild = children[i];
+
+ if (existingChild != null)
+ {
+ ISystemViewElementAdapter eadapt = getAdapter(existingChild);
+ ISubSystem eSubSystem = eadapt.getSubSystem(existingChild);
+
+ if (dSubSystem == eSubSystem)
+ {
+ String ekey = eadapt.getAbsoluteName(existingChild);
+
+ boolean matches = false;
+
+ // to compare absolute paths, check whether the system
+ // is case sensitive or not
+ if (dSubSystem.getSubSystemConfiguration().isCaseSensitive()) {
+ matches = ekey.equals(dkey);
+ }
+ else {
+ matches = ekey.equalsIgnoreCase(dkey);
+ }
+
+ if (matches)
+ {
+ resultSet.removeResult(existingChild);
+ provider.setCache(resultSet.getAllResults());
+ remove(existingChild);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ }
+ break;
+
+ // --------------------------
+ // REMOTE RESOURCE RENAMED...
+ // --------------------------
+ case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_RENAMED :
+ {
+ Object resource = event.getResource();
+ String resourceOldPath = event.getOldName();
+
+ /** FIXME - IREmoteFile is systems.core independent now
+ // we only care about remote file renames
+ if (resource instanceof IRemoteFile) {
+
+ ISystemRemoteElementAdapter adapter = getRemoteAdapter(resource);
+ resourceSubSystem = adapter.getSubSystem(resource);
+
+ if (resourceSubSystem == null) {
+ return;
+ }
+ }
+ else
+ {
+ return;
+ }
+ */
+ if (true) // DKM - hack to avoid this
+ return;
+ if (provider != null)
+ {
+ // this will use cache if there is one already
+ // note: do not call provider.getCache() since the
+ // cache is changed if getChildren() is called with
+ // an object other than the input (so if we expand
+ // a tree node then the cache will be the children
+ // of that node, and not the root nodes of the tree)
+ Object[] children = provider.getChildren(resultSet);
+
+ for (int i = 0; i < children.length; i++)
+ {
+ Object child = children[i];
+
+ // found same object. This means:
+ // a) rename happened in this view, or
+ // b) we are using the same object to populate this view
+ // and another view, and the rename happened in the
+ // other view
+ if (child == resource)
+ {
+ Widget widget = findItem(child);
+
+ if (widget != null)
+ {
+ update(child, null);
+ return;
+ }
+ }
+
+ /** FIXME - IREmoteFile is systems.core independent now
+ // did not find object
+ // rename happened in another view and we are not populating
+ // this view and the other view with the same object
+ else if (child instanceof IRemoteFile)
+ {
+ ISystemRemoteElementAdapter adapt = getRemoteAdapter(child);
+ ISubSystem childSubSystem = adapt.getSubSystem(child);
+
+ // check if both are from the same subsystem
+ if (childSubSystem == resourceSubSystem) {
+
+ String childPath = adapt.getAbsoluteName(child);
+
+ // find out if system is case sensitive
+ boolean isCaseSensitive = resourceSubSystem.getParentSubSystemFactory().isCaseSensitive();
+
+ boolean matches = false;
+
+ // look for the child whose path matches the old path of the resource
+ if (isCaseSensitive) {
+ matches = childPath.equals(resourceOldPath);
+ }
+ else {
+ matches = childPath.equalsIgnoreCase(resourceOldPath);
+ }
+
+ // if paths match, update the object and then update the view
+ if (matches) {
+
+
+
+ // now update label for child
+ Widget widget = findItem(child);
+
+ if (widget != null) {
+ update(child, null);
+ return;
+ }
+ }
+ }
+ }*/
+
+ }
+ }
+ break;
+ }
+ default :
+ super.systemRemoteResourceChanged(event);
+ break;
+ }
+ }
+
+ protected void doUpdateItem(Widget widget, Object element, boolean flag)
+ {
+ if (_firstRefresh)
+ {
+ computeLayout(true);
+ _firstRefresh = false;
+ }
+
+ super.doUpdateItem(widget, element, flag);
+ }
+
+ public void systemResourceChanged(ISystemResourceChangeEvent event) {
+ Object actualSource = event.getSource();
+
+ switch (event.getType()) {
+
+ case ISystemResourceChangeEvents.EVENT_REFRESH :
+
+ if (actualSource == null) {
+ return;
+ }
+
+ SystemTableTreeViewProvider provider = (SystemTableTreeViewProvider)getContentProvider();
+
+ if (provider == null) {
+ return;
+ }
+
+ if (actualSource instanceof IHostSearchResultConfiguration) {
+
+ IHostSearchResultConfiguration config = (IHostSearchResultConfiguration)actualSource;
+ IHostSearchResultSet resultSet = config.getParentResultSet();
+
+ if (resultSet == getInput()) {
+ // this will use cache if there is one already
+ // note: do not call provider.getCache() since the
+ // cache is changed if getChildren() is called with
+ // an object other than the input (so if we expand
+ // a tree node then the cache will be the children
+ // of that node, and not the root nodes of the tree)
+ Object[] previousResults = provider.getCachedObjects(resultSet);
+ Object[] newResults = resultSet.getAllResults();
+
+ int newSize = newResults.length;
+
+ // merge items so only one creation
+ if ((previousResults == null || previousResults.length == 0) && newResults.length != 0) {
+ provider.flushCache();
+ refresh(getInput());
+ }
+ else if (previousResults != null) {
+
+ int deltaSize = newSize - previousResults.length;
+
+ if (deltaSize > 0) {
+
+ Object[] delta = new Object[deltaSize];
+ int d = 0;
+
+ for (int i = 0; i < newSize; i++) {
+ Object nobj = newResults[i];
+
+ if (previousResults.length > i) {
+ Object pobj = previousResults[i];
+
+ if (pobj == null) {
+ delta[d] = nobj;
+ d++;
+ }
+ }
+ else {
+ delta[d] = nobj;
+ d++;
+ }
+ }
+
+ // must set the cache before calling add()
+ provider.setCache(newResults);
+
+ // set the cached objects
+ provider.setCachedObjects(resultSet, newResults);
+
+ if (delta.length > 2000) {
+ internalRefresh(getInput());
+ }
+ else {
+ add(getInput(), delta);
+ }
+ }
+ }
+ }
+ }
+
+ break;
+
+ default :
+ super.systemResourceChanged(event);
+ break;
+ }
+ }
+
+ protected Object getParentForContent(Object element)
+ {
+ return getAdapter(element).getParent(element);
+ }
+
+
+ /**
+ * Does nothing.
+ * @see org.eclipse.rse.ui.view.SystemTableTreeView#handleKeyPressed(org.eclipse.swt.events.KeyEvent)
+ */
+ protected void handleKeyPressed(KeyEvent event) {
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchTableViewProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchTableViewProvider.java
new file mode 100644
index 00000000000..992e7f45987
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchTableViewProvider.java
@@ -0,0 +1,45 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view.search;
+
+import org.eclipse.rse.ui.view.SystemTableTreeViewProvider;
+import org.eclipse.rse.ui.view.SystemTableViewColumnManager;
+
+public class SystemSearchTableViewProvider extends SystemTableTreeViewProvider
+{
+
+ public SystemSearchTableViewProvider(SystemTableViewColumnManager columnManager)
+ {
+ super(columnManager);
+ }
+
+ public String getText(Object object)
+ {
+ String text = getAdapterFor(object).getName(object);
+ /** FIXME - IREmoteFile is systems.core independent now
+ if (object instanceof IRemoteFile) {
+ IRemoteFile parent = ((IRemoteFile)object).getParentRemoteFile();
+ String absolutePath = getAdapterFor(parent).getAbsoluteName(parent);
+ return text + " - " + absolutePath;
+ }
+ else {
+ return text;
+ }
+ */
+ return text;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchUI.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchUI.java
new file mode 100644
index 00000000000..d46fcd775bb
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchUI.java
@@ -0,0 +1,73 @@
+/********************************************************************************
+ * Copyright (c) 2003, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view.search;
+
+import org.eclipse.rse.core.SystemBasePlugin;
+import org.eclipse.ui.PartInitException;
+
+
+/**
+ * A singleton class for dealing with Remote Search view
+ */
+public class SystemSearchUI {
+
+
+
+ // singleton instance
+ private static SystemSearchUI instance;
+
+ // search view id
+ public static final String SEARCH_RESULT_VIEW_ID = "org.eclipse.rse.ui.view.SystemSearchView";
+
+ /**
+ * Constructor for SystemSearchUI.
+ */
+ private SystemSearchUI() {
+ super();
+ }
+
+ /**
+ * Get the singleton instance.
+ * @return the singleton object of this type
+ */
+ public static SystemSearchUI getInstance() {
+
+ if (instance == null) {
+ instance = new SystemSearchUI();
+ }
+
+ return instance;
+ }
+
+ /**
+ * Activate search result view.
+ * @return true
if successful, false otherwise
+ */
+ public SystemSearchViewPart activateSearchResultView() {
+
+ SystemSearchViewPart searchView = null;
+
+ try {
+ searchView = (SystemSearchViewPart)(SystemBasePlugin.getActiveWorkbenchWindow().getActivePage().showView(SystemSearchUI.SEARCH_RESULT_VIEW_ID));
+ }
+ catch (PartInitException e) {
+ SystemBasePlugin.logError("Can not open search result view", e);
+ }
+
+ return searchView;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchViewContentProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchViewContentProvider.java
new file mode 100644
index 00000000000..a2bb2dbdd0b
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchViewContentProvider.java
@@ -0,0 +1,183 @@
+/********************************************************************************
+ * Copyright (c) 2003, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view.search;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.rse.core.SystemAdapterHelpers;
+import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
+import org.eclipse.ui.part.ViewPart;
+
+
+/**
+ * This class is the content provider for the remote systems search viewer.
+ */
+public class SystemSearchViewContentProvider implements ITreeContentProvider {
+
+
+ private ViewPart viewPart;
+
+ /**
+ * Constructor for SystemSearchViewContentProvider.
+ */
+ public SystemSearchViewContentProvider() {
+ super();
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(Object)
+ */
+ public Object[] getChildren(Object parentElement) {
+
+ if (parentElement == null) {
+ return null;
+ }
+
+ if (parentElement instanceof IAdaptable) {
+ ISystemViewElementAdapter adapter = getAdapter(parentElement);
+
+ if (adapter == null) {
+ return null;
+ }
+ else {
+ return adapter.getChildren(parentElement);
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(Object)
+ */
+ public Object getParent(Object element) {
+
+ if (element == null) {
+ return null;
+ }
+
+ if (element instanceof IAdaptable) {
+ ISystemViewElementAdapter adapter = getAdapter(element);
+
+ if (adapter == null) {
+ return null;
+ }
+ else {
+ return adapter.getParent(element);
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(Object)
+ */
+ public boolean hasChildren(Object element) {
+
+ if (element == null) {
+ return false;
+ }
+
+ if (element instanceof IAdaptable) {
+ ISystemViewElementAdapter adapter = getAdapter(element);
+
+ if (adapter == null) {
+ return false;
+ }
+ else {
+ return adapter.hasChildren(element);
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(Object)
+ */
+ public Object[] getElements(Object inputElement) {
+
+ if (inputElement == null) {
+ return null;
+ }
+
+ if (inputElement instanceof IAdaptable) {
+ ISystemViewElementAdapter adapter = getAdapter(inputElement);
+
+ if (adapter == null) {
+ return null;
+ }
+ else {
+ return adapter.getChildren(inputElement);
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+ */
+ public void dispose() {
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(Viewer, Object, Object)
+ */
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+
+ if (newInput == null) {
+ return;
+ }
+
+ if (newInput instanceof IAdaptable) {
+ ISystemViewElementAdapter adapter = getAdapter(newInput);
+
+ if (adapter != null) {
+ viewer.refresh();
+ }
+ }
+ }
+
+ /**
+ * Get the adapter for the given object.
+ * @param the object
+ * @return the adapter
+ */
+ public ISystemViewElementAdapter getAdapter(Object element)
+ {
+ return SystemAdapterHelpers.getAdapter(element);
+ }
+ /**
+ * Set the ViewPart of this provider
+ * @parm ViewPart of this provider
+ */
+ public void setViewPart(ViewPart viewPart)
+ {
+ this.viewPart = viewPart;
+ }
+ /**
+ * Get the ViewPart of this provider
+ * @return ViewPart of this provider
+ */
+ public ViewPart getViewPart()
+ {
+ return viewPart;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchViewLabelProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchViewLabelProvider.java
new file mode 100644
index 00000000000..a8eee8db1c5
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchViewLabelProvider.java
@@ -0,0 +1,94 @@
+/********************************************************************************
+ * Copyright (c) 2003, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view.search;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.rse.core.SystemAdapterHelpers;
+import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
+import org.eclipse.swt.graphics.Image;
+
+
+/**
+ * This is the label provider for the remote systems search view.
+ */
+public class SystemSearchViewLabelProvider extends LabelProvider {
+
+
+
+ /**
+ * Constructor for SystemSearchViewLabelProvider.
+ */
+ public SystemSearchViewLabelProvider() {
+ super();
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.ILabelProvider#getImage(Object)
+ */
+ public Image getImage(Object element) {
+
+ if (element == null) {
+ return null;
+ }
+
+ if (element instanceof IAdaptable) {
+ ISystemViewElementAdapter adapter = getAdapter(element);
+
+ if (adapter != null) {
+ ImageDescriptor descriptor = adapter.getImageDescriptor(element);
+
+ if (descriptor != null) {
+ return descriptor.createImage();
+ }
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.ILabelProvider#getText(Object)
+ */
+ public String getText(Object element) {
+
+ if (element == null) {
+ return null;
+ }
+
+ if (element instanceof IAdaptable) {
+ ISystemViewElementAdapter adapter = getAdapter(element);
+
+ if (adapter != null) {
+ return adapter.getText(element);
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Get the adapter for the given object.
+ * @param the object
+ * @return the adapter
+ */
+ public ISystemViewElementAdapter getAdapter(Object element)
+ {
+ return SystemAdapterHelpers.getAdapter(element);
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchViewPart.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchViewPart.java
new file mode 100644
index 00000000000..7823e0b1c26
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchViewPart.java
@@ -0,0 +1,1282 @@
+/********************************************************************************
+ * Copyright (c) 2003, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view.search;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.GroupMarker;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IStatusLineManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.viewers.AbstractTreeViewer;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.rse.core.SystemAdapterHelpers;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.model.ISystemRegistry;
+import org.eclipse.rse.model.ISystemResourceChangeEvent;
+import org.eclipse.rse.model.ISystemResourceChangeEvents;
+import org.eclipse.rse.model.ISystemResourceChangeListener;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.services.search.IHostSearchResultConfiguration;
+import org.eclipse.rse.services.search.IHostSearchResultSet;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.SystemMenuManager;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.SystemWidgetHelpers;
+import org.eclipse.rse.ui.actions.SystemPasteFromClipboardAction;
+import org.eclipse.rse.ui.messages.ISystemMessageLine;
+import org.eclipse.rse.ui.view.IRSEViewPart;
+import org.eclipse.rse.ui.view.ISystemRemoveElementAdapter;
+import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
+import org.eclipse.rse.ui.view.SystemTableTreeViewProvider;
+import org.eclipse.rse.ui.view.SystemView;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.IViewSite;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.part.CellEditorActionHandler;
+import org.eclipse.ui.part.PageBook;
+import org.eclipse.ui.part.ViewPart;
+
+
+
+/**
+ * This class defines the Remote Search view.
+ */
+public class SystemSearchViewPart extends ViewPart implements ISystemResourceChangeListener,
+ IMenuListener, ISelectionChangedListener,
+ ISystemMessageLine, IRSEViewPart
+{
+
+
+
+ private PageBook pageBook;
+ private StructuredViewer currentViewer;
+
+ private IActionBars actionBars;
+ private IMenuManager mMgr;
+ private IToolBarManager tbMgr;
+ private IStatusLineManager slMgr;
+
+ private static final String MENU_HISTORY_GROUP_NAME = "historyGroup";
+ private static final String MENU_CLEAR_HISTORY_GROUP_NAME = "clearHistoryGroup";
+
+ private ArrayList viewers = new ArrayList();
+ private ArrayList historyActions = new ArrayList();
+
+ private CancelAction cancelAction;
+ private SystemSearchClearHistoryAction clearHistoryAction;
+ private SystemSearchRemoveSelectedMatchesAction removeSelectedAction;
+ private SystemSearchRemoveAllMatchesAction removeAllAction;
+
+ private SystemSearchCopyToClipboardAction copyAction;
+ private SystemPasteFromClipboardAction pasteAction;
+
+ // for ISystemMessageLine
+ private String _message, _errorMessage;
+ private SystemMessage sysErrorMessage;
+ private IStatusLineManager _statusLine = null;
+
+
+ /**
+ * Double click listener.
+ */
+ public class SystemSearchDoubleClickListener implements IDoubleClickListener {
+
+ /**
+ * @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(DoubleClickEvent)
+ */
+ public void doubleClick(DoubleClickEvent event) {
+ IStructuredSelection selection = (IStructuredSelection) (event.getSelection());
+
+ if (!selection.isEmpty()) {
+ Object element = selection.getFirstElement();
+ ISystemViewElementAdapter adapter = getAdapter(element);
+ adapter.setViewer(currentViewer);
+ adapter.handleDoubleClick(element);
+ }
+ }
+ }
+
+ class SelectAllAction extends Action {
+
+ public SelectAllAction() {
+ super(SystemResources.ACTION_SELECT_ALL_LABEL, null);
+ }
+
+ public void run() {
+
+ if ((currentViewer != null) && (currentViewer instanceof TableViewer)) {
+ TableViewer viewer = (TableViewer) currentViewer;
+ viewer.getTable().selectAll();
+ // force viewer selection change
+ viewer.setSelection(viewer.getSelection());
+ }
+ }
+ }
+
+ public class CancelAction extends Action {
+
+ public CancelAction() {
+ super(SystemResources.ACTION_CANCEL_SEARCH_LABEL, SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_STOP_ID));
+ setToolTipText(SystemResources.ACTION_CANCEL_SEARCH_TOOLTIP);
+ }
+
+ public void run() {
+
+ if (currentViewer == null) {
+ return;
+ }
+
+ Object input = currentViewer.getInput();
+
+ if (input != null) {
+
+ if (input instanceof IHostSearchResultSet) {
+ IHostSearchResultSet resultSet = (IHostSearchResultSet)input;
+ setEnabled(false);
+ resultSet.cancel();
+ }
+ }
+ }
+
+ public void updateEnableState(IAdaptable input) {
+
+ // no input yet, so disable it
+ if (input == null) {
+ setEnabled(false);
+ }
+
+ if (input instanceof IHostSearchResultSet) {
+ IHostSearchResultSet set = (IHostSearchResultSet)input;
+
+ // running, so enable it
+ if (set.isRunning()) {
+ setEnabled(true);
+ }
+ // otherwise, disable
+ else {
+ setEnabled(false);
+ }
+ }
+ // some other input, disable it
+ else {
+ setEnabled(false);
+ }
+ }
+ }
+
+ /**
+ * Constructor for SystemSearchViewPart.
+ */
+ public SystemSearchViewPart() {
+ super();
+ }
+
+ /**
+ * @see org.eclipse.ui.IWorkbenchPart#createPartControl(Composite)
+ */
+ public void createPartControl(Composite parent) {
+
+ // create the page book
+ pageBook = new PageBook(parent, SWT.NONE);
+
+ // pageBook.showPage(createDummyControl());
+
+ // get view site
+ IViewSite site = getViewSite();
+
+ // set a dummy selection provider
+ // getSite().setSelectionProvider(createDummySelectionProvider());
+
+ // get action bars
+ actionBars = site.getActionBars();
+
+ // get the menu manager
+ mMgr = actionBars.getMenuManager();
+
+ // get the tool bar manager
+ tbMgr = actionBars.getToolBarManager();
+
+ _statusLine = actionBars.getStatusLineManager();
+
+
+ // initialize toolbar actions
+ initToolBarActions(tbMgr);
+
+ // get the status line manager
+ slMgr = actionBars.getStatusLineManager();
+
+ // update action bars
+ actionBars.updateActionBars();
+
+ // add view as a system listener
+ SystemPlugin.getTheSystemRegistry().addSystemResourceChangeListener(this);
+
+ // set help
+ SystemWidgetHelpers.setHelp(pageBook, SystemPlugin.HELPPREFIX + "srch0000");
+ }
+
+ private void initToolBarActions(IToolBarManager tbMgr) {
+
+ // create cancel action
+ if (cancelAction == null) {
+ cancelAction = new CancelAction();
+
+ if (currentViewer == null) {
+ cancelAction.setEnabled(false);
+ }
+ else if (currentViewer.getInput() == null){
+ cancelAction.setEnabled(false);
+ }
+ else {
+ cancelAction.setEnabled(true);
+ }
+ }
+
+ // create remove selected matches action
+ if (removeSelectedAction == null) {
+ removeSelectedAction = new SystemSearchRemoveSelectedMatchesAction(this, getShell());
+
+ if (currentViewer == null) {
+ removeSelectedAction.setEnabled(false);
+ }
+ else {
+ removeSelectedAction.setEnabled(isRemoveSelectedEnabled());
+ }
+ }
+
+ // create remove all matches action
+ if (removeAllAction == null) {
+ removeAllAction = new SystemSearchRemoveAllMatchesAction(this, getShell());
+
+ if (currentViewer == null) {
+ removeAllAction.setEnabled(false);
+ }
+ else {
+ Object input = currentViewer.getInput();
+ removeAllAction.setEnabled(isRemoveAllEnabled((IAdaptable)input));
+ }
+ }
+
+ // add cancel action
+ tbMgr.add(cancelAction);
+
+ // add remove selected action
+ tbMgr.add(removeSelectedAction);
+
+ // add remove all action
+ tbMgr.add(removeAllAction);
+
+ // register global edit actions
+ ISystemRegistry registry = SystemPlugin.getTheSystemRegistry();
+
+ // clipboard
+ Clipboard clipboard = registry.getSystemClipboard();
+
+ Shell shell = registry.getShell();
+
+ copyAction = new SystemSearchCopyToClipboardAction(shell, clipboard);
+ pasteAction = new SystemPasteFromClipboardAction(shell, clipboard);
+
+ CellEditorActionHandler editorActionHandler = new CellEditorActionHandler(getViewSite().getActionBars());
+
+ editorActionHandler.setCopyAction(copyAction);
+ editorActionHandler.setPasteAction(pasteAction);
+ editorActionHandler.setDeleteAction(removeSelectedAction);
+ // editorActionHandler.setSelectAllAction(new SelectAllAction());
+ }
+
+ /**
+ * Updates the remove selected action.
+ * @return
true
if remove selected action should be enabled, false
otherwise.
+ */
+ private boolean isRemoveSelectedEnabled() {
+
+ ISelection selection = getSelection();
+
+ if (selection == null) {
+ return false;
+ }
+ else if (selection.isEmpty()) {
+ return false;
+ }
+ else {
+
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection strSel = (IStructuredSelection)selection;
+
+ // note that SystemSearchTableView returns the current input
+ // if the actual selection is null
+ // so we check for it and return null
+ if (strSel.getFirstElement() == currentViewer.getInput()) {
+ return false;
+ }
+ else {
+ return true;
+ }
+ }
+ else {
+ return false;
+ }
+ }
+ }
+
+ /**
+ * Updates the remove all matches action.
+ * @param input the input to the current viewer, or null
if there is currently no input.
+ * @return true
if remove all action should be enabled, false
otherwise.
+ */
+ private boolean isRemoveAllEnabled(IAdaptable input) {
+
+ if (input == null) {
+ return false;
+ }
+
+ ISystemViewElementAdapter adapter = (ISystemViewElementAdapter)getAdapter(input);
+
+ if (adapter == null) {
+ return false;
+ }
+ else {
+ return adapter.hasChildren(input);
+ }
+ }
+
+ /**
+ * @see org.eclipse.ui.IWorkbenchPart#setFocus()
+ */
+ public void setFocus() {
+ pageBook.setFocus();
+ }
+
+ /**
+ * @see org.eclipse.ui.IViewPart#init(IViewSite, IMemento)
+ */
+ public void init(IViewSite site, IMemento memento) throws PartInitException {
+ super.init(site, memento);
+ }
+
+ /**
+ * @see org.eclipse.ui.IViewPart#saveState(IMemento)
+ */
+ public void saveState(IMemento memento) {
+ super.saveState(memento);
+ }
+
+ /**
+ * Add a search result set.
+ * @param the search result set
+ */
+ public void addSearchResult(IAdaptable resultSet) {
+
+ // if the correct adapter is not registered, then return
+ ISystemViewElementAdapter adapter = getAdapter(resultSet);
+
+ if (adapter == null) {
+ return;
+ }
+
+ if (resultSet instanceof IHostSearchResultSet) {
+ currentViewer = createSearchResultsTable((IHostSearchResultSet)resultSet, adapter);
+ }
+ else {
+ currentViewer = createSearchResultsTree(resultSet, adapter);
+
+ TreeViewer treeViewer = (TreeViewer)currentViewer;
+ MenuManager menuMgr = new MenuManager("#PopupMenu");
+ menuMgr.setRemoveAllWhenShown(true);
+ menuMgr.addMenuListener(this);
+ Tree tree = (Tree)treeViewer.getControl();
+ Menu menu = menuMgr.createContextMenu(tree);
+ tree.setMenu(menu);
+ }
+
+ // set input
+ currentViewer.setInput(resultSet);
+
+ // add as selection changed listener to current viewer
+ currentViewer.addSelectionChangedListener(this);
+
+ // set as selection provider
+ getSite().setSelectionProvider(currentViewer);
+
+ // add double click listener
+ currentViewer.addDoubleClickListener(new SystemSearchDoubleClickListener());
+
+ // set help for control
+ SystemWidgetHelpers.setHelp(currentViewer.getControl(), SystemPlugin.HELPPREFIX + "srch0000");
+
+ // add current viewer to viewer list
+ viewers.add(currentViewer);
+
+ // get title to use from adapter
+ String title = adapter.getText(resultSet);
+
+ // set the title of the view
+ setContentDescription(title);
+
+ int num = viewers.size()-1;
+
+ // create history action
+ SystemSearchHistoryAction historyAction = new SystemSearchHistoryAction(title, SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_SEARCH_RESULT_ID), this, num);
+
+ // add to list of history actions
+ historyActions.add(historyAction);
+
+ // if this is the first result set, add the clear history action
+ if (viewers.size() == 1) {
+
+ // create a group for history actions
+ mMgr.add(new GroupMarker(MENU_HISTORY_GROUP_NAME));
+
+ // create a separator with a group for clear history action
+ mMgr.add(new Separator(MENU_CLEAR_HISTORY_GROUP_NAME));
+
+ // add the clear history action to the group
+ clearHistoryAction = new SystemSearchClearHistoryAction(this, getShell());
+ mMgr.appendToGroup(MENU_CLEAR_HISTORY_GROUP_NAME, clearHistoryAction);
+ }
+
+ // add history action to the menu manager
+ mMgr.appendToGroup(MENU_HISTORY_GROUP_NAME, historyAction);
+
+ // add global actions
+ // actionBars.setGlobalActionHandler(ActionFactory.DELETE, new SystemSearchDeleteAction(this));
+
+ // update action bars
+ actionBars.updateActionBars();
+
+ // show the control
+ pageBook.showPage(currentViewer.getControl());
+
+ // enable/disable state for this input
+ if (cancelAction != null) {
+ cancelAction.updateEnableState(resultSet);
+ }
+
+ // enable/disable state
+ if (removeSelectedAction != null) {
+ removeSelectedAction.setEnabled(isRemoveSelectedEnabled());
+ }
+
+ // enable/disable state for this input
+ if (removeAllAction != null) {
+ removeAllAction.setEnabled(isRemoveAllEnabled(resultSet));
+ }
+ }
+
+ private StructuredViewer createSearchResultsTree(IAdaptable resultSet, ISystemViewElementAdapter adapter)
+ {
+
+ // create the current tree
+ Tree currentControl = new Tree(pageBook, SWT.MULTI);
+
+ // create the current viewer
+ TreeViewer currentViewer = new TreeViewer(currentControl);
+ currentViewer.setUseHashlookup(true);
+ currentViewer.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS);
+
+ // create a new content provider
+ SystemSearchViewContentProvider contentProvider = new SystemSearchViewContentProvider();
+ // save the viewpart to the provider
+ contentProvider.setViewPart(this);
+ // add the content provider to the viewer
+ currentViewer.setContentProvider(contentProvider);
+
+ // create a new label provider
+ SystemSearchViewLabelProvider labelProvider = new SystemSearchViewLabelProvider();
+
+ // add the label provider to the viewer
+ currentViewer.setLabelProvider(labelProvider);
+
+ return currentViewer;
+ }
+
+ private StructuredViewer createSearchResultsTable(IHostSearchResultSet resultSet, ISystemViewElementAdapter adapter) {
+
+ // create table portion
+ // TODO change to tabletree when eclipse fixes the swt widget
+ //TableTree table = new TableTree(pageBook, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION | SWT.HIDE_SELECTION);
+ Tree tabletree = new Tree(pageBook, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION | SWT.HIDE_SELECTION);
+ SystemSearchTableView viewer = new SystemSearchTableView(tabletree, (IHostSearchResultSet)resultSet, this);
+ viewer.setWorkbenchPart(this);
+
+ getSite().registerContextMenu(viewer.getContextMenuManager(), viewer);
+ return viewer;
+ }
+
+ /**
+ * @see org.eclipse.ui.IWorkbenchPart#dispose()
+ */
+ public void dispose() {
+
+ // remove as resource change listener
+ SystemPlugin.getTheSystemRegistry().removeSystemResourceChangeListener(this);
+
+ // clear viewers
+ clearViewers();
+
+ // clear arrays
+ viewers.clear();
+ historyActions.clear();
+
+ // call super as required
+ super.dispose();
+ }
+
+ /**
+ * Remove current viewer as selection provider, removes children of all the inputs and disposes
+ * the controls if they haven't already been disposed.
+ */
+ private void clearViewers() {
+
+ // remove current viewer as selection provider if it exists
+ if (currentViewer != null) {
+
+ // remove as selection changed listener to current viewer
+ currentViewer.removeSelectionChangedListener(this);
+
+ if (getSite().getSelectionProvider() == currentViewer) {
+ getSite().setSelectionProvider(null);
+ }
+ }
+
+ for (int i = 0; i < viewers.size(); i++) {
+
+ Object viewer = viewers.get(i);
+
+ // if we're dealing with universal search
+ if (viewer instanceof SystemSearchTableView) {
+
+ SystemSearchTableView tableView = (SystemSearchTableView)viewer;
+
+ Object input = tableView.getInput();
+
+ // dispose the remote search result set
+ // which cancels the search and removes contents from the input
+ // (i.e. removes from model)
+ if (input instanceof IHostSearchResultSet) {
+ IHostSearchResultSet set = (IHostSearchResultSet)input;
+ set.dispose();
+ }
+
+ // dispose viewer
+ tableView.dispose();
+ }
+ // other search
+ else if (viewer instanceof TreeViewer){
+
+ TreeViewer treeView = (TreeViewer)viewer;
+
+ Object input = treeView.getInput();
+
+ ISystemViewElementAdapter adapter = getAdapter(input);
+
+ if (adapter != null && adapter instanceof ISystemRemoveElementAdapter) {
+ ISystemRemoveElementAdapter rmAdapter = (ISystemRemoveElementAdapter)adapter;
+ rmAdapter.removeAllChildren(input);
+
+ Control control = treeView.getControl();
+
+ if (!control.isDisposed()) {
+ control.dispose();
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Show search result with the given index.
+ * @param the index in the result history list
+ */
+ public void showSearchResult(int index) {
+
+ // remove as selection listener from current viewer
+ if (currentViewer != null) {
+ currentViewer.removeSelectionChangedListener(this);
+ }
+
+ // get viewer with this index and make it current
+ currentViewer = (StructuredViewer)(viewers.get(index));
+
+ // set as selection provider
+ getSite().setSelectionProvider(currentViewer);
+
+ // add as selection changed listener to current viewer
+ currentViewer.addSelectionChangedListener(this);
+
+ // get the input
+ IAdaptable resultSet = (IAdaptable)(currentViewer.getInput());
+
+ if (resultSet == null) {
+ return;
+ }
+
+ ISystemViewElementAdapter adapter = getAdapter(resultSet);
+
+ // if the correct adapter is not registered, then return
+ if (adapter == null) {
+ return;
+ }
+
+ // get title to use from adapter
+ String title = adapter.getText(resultSet);
+
+ // set the title of the view
+ setContentDescription(title);
+
+ // get the associated control
+ Control currentControl = currentViewer.getControl();
+
+ // show the control
+ pageBook.showPage(currentControl);
+
+ // enable/disable state for this input
+ if (cancelAction != null) {
+ cancelAction.updateEnableState(resultSet);
+ }
+
+ // enable/disable state
+ if (removeSelectedAction != null) {
+ removeSelectedAction.setEnabled(isRemoveSelectedEnabled());
+ }
+
+ // enable/disable state for this input
+ if (removeAllAction != null) {
+ removeAllAction.setEnabled(isRemoveAllEnabled(resultSet));
+ }
+ }
+
+ /**
+ * Delete the selected object in the view.
+ * @return true
if the selection has been deleted, false
otherwise.
+ */
+ public boolean deleteSelected() {
+
+ if (currentViewer == null) {
+ return false;
+ }
+
+ IStructuredSelection selection = (IStructuredSelection)(currentViewer.getSelection());
+
+ if (selection == null || selection.isEmpty()) {
+ return false;
+ }
+
+ Object input = currentViewer.getInput();
+
+ ISystemViewElementAdapter adapter = getAdapter(input);
+
+ // adapter should be an instance of ISystemRemoveElementAdapter
+ if (adapter == null || !(adapter instanceof ISystemRemoveElementAdapter)) {
+ return false;
+ }
+
+ Iterator elements = selection.iterator();
+
+ ArrayList removeElements = new ArrayList();
+
+ while (elements.hasNext()) {
+ Object element = elements.next();
+ ((ISystemRemoveElementAdapter)adapter).remove(input, element);
+ removeElements.add(element);
+ }
+
+ // current viewer should be an instance of tree viewer
+ // remove the elements from it to update the view
+ if (currentViewer instanceof TreeViewer) {
+ ((TreeViewer)currentViewer).remove(removeElements.toArray());
+ }
+
+ // get title to use from adapter
+ String title = adapter.getText(input);
+
+ // set the title of the view
+ setContentDescription(title);
+
+ // enable/disable state for this input
+ if (cancelAction != null) {
+ cancelAction.updateEnableState((IAdaptable)input);
+ }
+
+ // enable/disable state for this input
+ if (removeSelectedAction != null) {
+ removeSelectedAction.setEnabled(isRemoveSelectedEnabled());
+ }
+
+ // enable/disable state for this input
+ if (removeAllAction != null) {
+ removeAllAction.setEnabled(isRemoveAllEnabled((IAdaptable)input));
+ }
+
+ return true;
+ }
+
+ /**
+ * Deletes all the pages in the view.
+ * @return true
if all pages have been deleted, false
otherwise.
+ */
+ public boolean deleteAllPages() {
+
+ // first show a dummy control in page book
+ // this must be done before viewers are cleared
+ // reason is that current showing control in page book can not be disposed
+ // SWT doesn't seem to like it
+ // This is fixed in 3.0
+ pageBook.showPage(createDummyControl());
+
+ // clear viewers
+ clearViewers();
+
+ // current viewer is null again
+ currentViewer = null;
+
+ // clear the viewer list
+ viewers.clear();
+
+ // disable cancel action
+ cancelAction.setEnabled(false);
+
+ // disable remove all action
+ removeSelectedAction.setEnabled(false);
+
+ // disable remove all action
+ removeAllAction.setEnabled(false);
+
+ // clear the history action list
+ historyActions.clear();
+
+ // get rid of all menu manager actions
+ mMgr.removeAll();
+
+ // update action bars
+ actionBars.updateActionBars();
+
+ // clear the content description
+ setContentDescription("");
+
+ return true;
+ }
+
+ /**
+ * Creates a dummy control to show in the page book.
+ * @return a dummy control.
+ */
+ private Control createDummyControl() {
+ Control control = new Composite(pageBook, SWT.NONE);
+ return control;
+ }
+
+ /**
+ * Deletes the current page.
+ * @return true
if the current page has been deleted, false
otherwise.
+ */
+ public boolean deleteCurrentPage() {
+
+ // remove current viewer as selection provider if it exists
+ if (currentViewer != null) {
+
+ // remove as selection changed listener to current viewer
+ currentViewer.removeSelectionChangedListener(this);
+
+ if (getSite().getSelectionProvider() == currentViewer) {
+ getSite().setSelectionProvider(null);
+ }
+ }
+ else {
+ return false;
+ }
+
+ Object input = currentViewer.getInput();
+
+ ISystemViewElementAdapter adapter = getAdapter(input);
+
+ // universal search
+ if (currentViewer instanceof SystemSearchTableView)
+ {
+
+ SystemSearchTableView tableView = (SystemSearchTableView)currentViewer;
+
+ // remove viewer as listener
+ tableView.removeAsListener();
+
+ // clear model
+ if (input instanceof IHostSearchResultSet) {
+ IHostSearchResultSet set = (IHostSearchResultSet)input;
+ set.dispose();
+ }
+
+ // now refresh viewer
+ // but flush cache of the provider first for an accurate refresh
+ SystemTableTreeViewProvider provider = (SystemTableTreeViewProvider)(tableView.getContentProvider());
+ provider.flushCache();
+ tableView.refresh();
+ }
+ // other search
+ else if (currentViewer instanceof TreeViewer){
+
+ TreeViewer treeView = (TreeViewer)currentViewer;
+
+ if (adapter != null && adapter instanceof ISystemRemoveElementAdapter) {
+ ISystemRemoveElementAdapter rmAdapter = (ISystemRemoveElementAdapter)adapter;
+ rmAdapter.removeAllChildren(input);
+ treeView.refresh();
+ }
+ }
+
+ // get title to use from adapter
+ String title = adapter.getText(input);
+
+ // set the title of the view
+ setContentDescription(title);
+
+ // disable cancel action
+ cancelAction.setEnabled(false);
+
+ // disable remove selected action
+ removeSelectedAction.setEnabled(false);
+
+ // disable remove all action
+ removeAllAction.setEnabled(false);
+
+ return true;
+ }
+
+ /**
+ * Get the adapter for the given object.
+ * @param the object the object for which I want the adapter.
+ * @return the adapter for the object.
+ */
+ public ISystemViewElementAdapter getAdapter(Object element) {
+ return SystemAdapterHelpers.getAdapter(element);
+ }
+
+ /**
+ * Get the shell.
+ * @return the shell
+ */
+ public Shell getShell() {
+ return getSite().getShell();
+ }
+
+ public void systemResourceChanged(ISystemResourceChangeEvent event) {
+
+ // need to introduce another event type for this....
+ if (event.getType() == ISystemResourceChangeEvents.EVENT_SEARCH_FINISHED) {
+
+ // the view is added as a system listener when the part is created
+ // so the current viewer may not exist if the search results has not been added yet
+ if (currentViewer == null) {
+ return;
+ }
+
+ Object actualSource = event.getSource();
+
+ if (actualSource instanceof IHostSearchResultConfiguration) {
+
+ IHostSearchResultSet source = ((IHostSearchResultConfiguration)actualSource).getParentResultSet();
+
+ // get title to use from adapter
+ ISystemViewElementAdapter adapter = getAdapter(source);
+
+ if (adapter == null) {
+ return;
+ }
+
+ int index = -1;
+
+ // if the source is the input to the current viewer
+ // update view title and cancel action
+ // also update the history action corresponding to the current view
+ if (currentViewer.getInput() == source) {
+
+ // end of a search
+ String title = adapter.getText(source);
+
+ // set the title of the view
+ setContentDescription(title);
+
+ // enable/disable state for this input
+ if (cancelAction != null) {
+ cancelAction.updateEnableState((IAdaptable)source);
+ }
+
+ // enable/disable state for this input
+ if (removeSelectedAction != null) {
+ removeSelectedAction.setEnabled(isRemoveSelectedEnabled());
+ }
+
+ // enable/disable state for this input
+ if (removeAllAction != null) {
+ removeAllAction.setEnabled(isRemoveAllEnabled((IAdaptable)source));
+ }
+
+ // find out where the current viewer is in the viewer list
+ index = viewers.indexOf(currentViewer);
+ }
+ // if the source is not the input to the current view
+ // we simply update the history action
+ else {
+
+ for (int i = 0; i < viewers.size(); i++) {
+
+ SystemSearchTableView view = (SystemSearchTableView)viewers.get(i);
+
+ if (view.getInput() == source) {
+ index = i;
+ break;
+ }
+ }
+ }
+
+ // since the history actions list paralles the viewer list, use the index to
+ // get the history action
+ if (index >= 0) {
+ SystemSearchHistoryAction historyAction = (SystemSearchHistoryAction)historyActions.get(index);
+ historyAction.setText(adapter.getText(source));
+ }
+ }
+ }
+ }
+
+ //------------------------------------------------------
+ // Methods used by the tree view pop-up menu
+ //------------------------------------------------------
+ /**
+ * Fill context for the tree view pop-up menu.
+ * @param menu the menu manager.
+ */
+ public void fillContextMenu(IMenuManager menu)
+ {
+ IStructuredSelection selection = (IStructuredSelection)currentViewer.getSelection();
+
+ if (selection == null) {
+ return;
+ }
+
+ int selectionCount = selection.size();
+
+ if (selectionCount == 0) { // nothing selected
+ return;
+ }
+ else {
+
+ // if only one selection, check if selection is the input
+ // if so add no actions
+ if (selectionCount == 1) {
+
+ if (selection.getFirstElement() == currentViewer.getInput()) {
+ return;
+ }
+ }
+
+ // if selection count is more than 1
+ // check if all have same parent
+ // if not, check if they have ancestor relationship
+ // if so, add no actions
+// if (selectionCount > 1) {
+// boolean allSelectionsFromSameParent = sameParent();
+//
+// // if all selections do not have the same parent, do not show anything in the menu
+// if (!allSelectionsFromSameParent) {
+//
+// if (selectionHasAncestryRelationship()) {
+// // don't show the menu because actions with
+// // multiple select on objects that are ancestors
+// // of each other is problematic
+// // still create the standard groups
+// SystemView.createStandardGroups(menu);
+// return;
+// }
+// }
+// }
+
+ // partition into groups...
+ SystemView.createStandardGroups(menu);
+
+ // adapter actions
+ SystemMenuManager ourMenu = new SystemMenuManager(menu);
+ Object element = selection.getFirstElement();
+ ISystemViewElementAdapter adapter = getAdapter(element);
+ adapter.setViewer(currentViewer);
+ adapter.addActions(ourMenu, selection,
+ getShell(),
+ ISystemContextMenuConstants.GROUP_ADAPTERS);
+ }
+ }
+
+ /**
+ * This is called to ensure all elements in a multiple-selection have the same parent in the
+ * tree viewer. If they don't we automatically disable all actions.
+ * null
if there is no current viewer.
+ */
+ public StructuredViewer getCurrentViewer() {
+ return currentViewer;
+ }
+
+ public Viewer getRSEViewer()
+ {
+ return currentViewer;
+ }
+
+// -------------------------------
+ // ISystemMessageLine interface...
+ // -------------------------------
+ /**
+ * Clears the currently displayed error message and redisplayes
+ * the message which was active before the error message was set.
+ */
+ public void clearErrorMessage()
+ {
+ _errorMessage = null;
+ sysErrorMessage = null;
+ if (_statusLine != null)
+ _statusLine.setErrorMessage(_errorMessage);
+ }
+ /**
+ * Clears the currently displayed message.
+ */
+ public void clearMessage()
+ {
+ _message = null;
+ if (_statusLine != null)
+ _statusLine.setMessage(_message);
+ }
+ /**
+ * Get the currently displayed error text.
+ * @return The error message. If no error message is displayed null
is returned.
+ */
+ public String getErrorMessage()
+ {
+ return _errorMessage;
+ }
+ /**
+ * Get the currently displayed message.
+ * @return The message. If no message is displayed null
is returned.
+ */
+ public String getMessage()
+ {
+ return _message;
+ }
+ /**
+ * Display the given error message. A currently displayed message
+ * is saved and will be redisplayed when the error message is cleared.
+ */
+ public void setErrorMessage(String message)
+ {
+ this._errorMessage = message;
+ if (_statusLine != null)
+ _statusLine.setErrorMessage(message);
+ }
+ /**
+ * Get the currently displayed error text.
+ * @return The error message. If no error message is displayed
is returned.
+ */
+ public String getErrorMessage()
+ {
+ return errorMessage;
+ }
+ /**
+ * Get the currently displayed message.
+ * @return The message. If no message is displayed null
is returned.
+ */
+ public SystemMessage getSystemErrorMessage()
+ {
+ return sysErrorMessage;
+ }
+
+ /**
+ * Display the given error message. A currently displayed message
+ * is saved and will be redisplayed when the error message is cleared.
+ */
+ public void setErrorMessage(SystemMessage message)
+ {
+ sysErrorMessage = message;
+ setErrorMessage(message.getLevelOneText());
+ }
+ /**
+ * Display the given error message. A currently displayed message
+ * is saved and will be redisplayed when the error message is cleared.
+ */
+ public void setErrorMessage(Throwable exc)
+ {
+ setErrorMessage(exc.getMessage());
+ }
+
+ /**
+ * Set the message text. If the message line currently displays an error,
+ * the message is stored and will be shown after a call to clearErrorMessage
+ */
+ public void setMessage(String message)
+ {
+ this._message = message;
+ if (_statusLine != null)
+ _statusLine.setMessage(message);
+ }
+ /**
+ *If the message line currently displays an error,
+ * the message is stored and will be shown after a call to clearErrorMessage
+ */
+ public void setMessage(SystemMessage message)
+ {
+ setMessage(message.getLevelOneText());
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemResourceAdaptableProfile.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemResourceAdaptableProfile.java
new file mode 100644
index 00000000000..9f7d94f740d
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemResourceAdaptableProfile.java
@@ -0,0 +1,35 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view.team;
+
+import org.eclipse.rse.model.ISystemProfile;
+
+/**
+ * This class wrappers a SystemProfile and adapts it to an IResource
+ * by mapping to its underlying folder.
+ */
+public class SystemResourceAdaptableProfile
+{
+ /**
+ * Constructor
+ */
+ public SystemResourceAdaptableProfile(ISystemProfile profile)
+ {
+ super();
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamView.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamView.java
new file mode 100644
index 00000000000..27e7fcd7e44
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamView.java
@@ -0,0 +1,267 @@
+/********************************************************************************
+ * Copyright (c) 2003, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view.team;
+import java.util.Vector;
+
+import org.eclipse.jface.viewers.AbstractTreeViewer;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.model.ISystemResourceChangeEvent;
+import org.eclipse.rse.model.ISystemResourceChangeEvents;
+import org.eclipse.rse.model.ISystemResourceChangeListener;
+import org.eclipse.rse.ui.SystemWidgetHelpers;
+import org.eclipse.rse.ui.view.ISystemSelectAllTarget;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.swt.widgets.Widget;
+
+
+//import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
+
+/**
+ * We specialize tree viewer for the Team view, so we know
+ * when we are dealing with the team view in common code.
+ */
+public class SystemTeamView extends TreeViewer implements ISystemSelectAllTarget, ISystemResourceChangeListener
+{
+ private SystemTeamViewPart teamViewPart;
+
+ /**
+ * @param parent
+ */
+ public SystemTeamView(Composite parent, SystemTeamViewPart teamViewPart)
+ {
+ super(parent);
+ this.teamViewPart = teamViewPart;
+ SystemWidgetHelpers.setHelp(getTree(), SystemPlugin.HELPPREFIX+"teamview");
+ }
+
+ /**
+ * @param parent
+ * @param style
+ */
+ public SystemTeamView(Composite parent, int style, SystemTeamViewPart teamViewPart)
+ {
+ super(parent, style);
+ this.teamViewPart = teamViewPart;
+ SystemWidgetHelpers.setHelp(getTree(), SystemPlugin.HELPPREFIX+"teamview");
+ }
+
+ /**
+ * @param tree
+ */
+ public SystemTeamView(Tree tree, SystemTeamViewPart teamViewPart)
+ {
+ super(tree);
+ this.teamViewPart = teamViewPart;
+ SystemWidgetHelpers.setHelp(getTree(), SystemPlugin.HELPPREFIX+"teamview");
+ }
+
+ /**
+ * Return the part view part of this tree view
+ */
+ public SystemTeamViewPart getTeamViewPart()
+ {
+ return teamViewPart;
+ }
+
+ /**
+ * This returns an array containing each element in the tree, up to but not including the root.
+ * The array is in reverse order, starting at the leaf and going up.
+ */
+ public Object[] getElementNodes(Object element)
+ {
+ Widget w = findItem(element);
+ if ((w != null) && (w instanceof TreeItem))
+ return getElementNodes((TreeItem)w);
+ return null;
+ }
+ /**
+ * This returns an array containing each element in the tree, up to but not including the root.
+ * The array is in reverse order, starting at the leaf and going up.
+ * This flavour is optimized for the case when you have the tree item directly.
+ */
+ public Object[] getElementNodes(TreeItem item)
+ {
+ Vector v = new Vector();
+ v.addElement(item.getData());
+ while (item != null)
+ {
+ item = item.getParentItem();
+ if (item != null)
+ v.addElement(item.getData());
+ }
+ Object[] nodes = new Object[v.size()];
+ for (int idx=0; idx
+ * We will not use parent code.
+ * @see IContentProvider#inputChanged(Viewer, Object, Object)
+ */
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
+ {
+ this.viewer = viewer;
+
+ // TODO DKM - replace this with appropriate thing
+ // super.viewer = viewer;
+
+ // TODO DKM - get rid of inputChanged. I put it here temporarily so that there's a way to set super.viewer in 3.0
+ super.inputChanged(viewer, oldInput, newInput);
+
+ //System.out.println("inside inputChanged. oldInput = " + oldInput + ", newInput = " + newInput);
+ if (newInput != null)
+ {
+ if (newInput instanceof SystemTeamViewInputProvider)
+ {
+ inputProvider = (SystemTeamViewInputProvider)newInput;
+ /*
+ getResourceDeltaHandler().registerTreeViewer((TreeViewer)viewer);
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(this,
+ //IResourceChangeEvent.POST_AUTO_BUILD
+ //IResourceChangeEvent.PRE_AUTO_BUILD
+ IResourceChangeEvent.POST_CHANGE
+ // IResourceChangeEvent.PRE_CLOSE
+ //| IResourceChangeEvent.PRE_DELETE
+ //| IResourceChangeEvent.POST_AUTO_BUILD
+ );
+ */
+ }
+ }
+ }
+
+ /**
+ * Returns the implementation of ISystemViewElement for the given
+ * object. Returns null if the adapter is not defined or the
+ * object is not adaptable.
+ */
+ protected ISystemViewElementAdapter getSystemViewAdapter(Object o)
+ {
+ ISystemViewElementAdapter adapter = null;
+ if (o == null)
+ {
+ SystemBasePlugin.logWarning("ERROR: null passed to getAdapter in SystemTeamViewContentProvider");
+ return null;
+ }
+ if (!(o instanceof IAdaptable))
+ adapter = (ISystemViewElementAdapter)Platform.getAdapterManager().getAdapter(o,ISystemViewElementAdapter.class);
+ else
+ adapter = (ISystemViewElementAdapter)((IAdaptable)o).getAdapter(ISystemViewElementAdapter.class);
+ //if (adapter == null)
+ // SystemPlugin.logWarning("ADAPTER IS NULL FOR ELEMENT OF TYPE: " + o.getClass().getName());
+ if ((adapter!=null) && (viewer != null))
+ {
+ Shell shell = null;
+ if (viewer instanceof ISystemResourceChangeListener)
+ shell = ((ISystemResourceChangeListener)viewer).getShell();
+ else if (viewer != null)
+ shell = viewer.getControl().getShell();
+ if (shell != null)
+ adapter.setShell(shell);
+ adapter.setViewer(viewer);
+ if (viewer.getInput() instanceof ISystemViewInputProvider)
+ {
+ ISystemViewInputProvider inputProvider = (ISystemViewInputProvider)viewer.getInput();
+ adapter.setInput(inputProvider);
+ }
+ }
+ else if (viewer == null)
+ SystemBasePlugin.logWarning("VIEWER IS NULL FOR SystemTeamViewContentProvider");
+ return adapter;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewInputProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewInputProvider.java
new file mode 100644
index 00000000000..105b6a32cad
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewInputProvider.java
@@ -0,0 +1,169 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view.team;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.rse.core.SystemResourceManager;
+import org.eclipse.rse.model.IHost;
+import org.eclipse.rse.ui.view.ISystemViewInputProvider;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * Represents the input to the team viewer.
+ * For now, this really doesn't do much since we always list the same thing.
+ */
+public class SystemTeamViewInputProvider implements IAdaptable, ISystemViewInputProvider
+{
+ private Object[] roots = new Object[1];
+ private Shell shell;
+ private Viewer viewer;
+
+ /**
+ * Constructor for SystemTeamViewInputProvider.
+ */
+ public SystemTeamViewInputProvider()
+ {
+ super();
+ }
+
+ /**
+ * Return the roots to display in the team viewer.
+ * This is simply the RSE singleton project
+ */
+ public Object[] getRoots()
+ {
+ if (roots[0] == null)
+ roots[0] = SystemResourceManager.getRemoteSystemsProject();
+ return roots;
+ }
+
+ /**
+ * This is the method required by the IAdaptable interface.
+ * Given an adapter class type, return an object castable to the type, or
+ * null if this is not possible.
+ */
+ public Object getAdapter(Class adapterType)
+ {
+ return Platform.getAdapterManager().getAdapter(this, adapterType);
+ }
+
+ // ----------------------------------------
+ // Methods from ISystemViewInputProvider...
+ // ----------------------------------------
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.ui.view.ISystemViewInputProvider#getSystemViewRoots()
+ */
+ public Object[] getSystemViewRoots()
+ {
+ return getRoots();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.ui.view.ISystemViewInputProvider#hasSystemViewRoots()
+ */
+ public boolean hasSystemViewRoots()
+ {
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.ui.view.ISystemViewInputProvider#showingConnections()
+ */
+ public boolean showingConnections()
+ {
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.ui.view.ISystemViewInputProvider#getConnectionChildren(com.ibm.etools.systems.model.SystemConnection)
+ */
+ public Object[] getConnectionChildren(IHost selectedConnection)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.ui.view.ISystemViewInputProvider#hasConnectionChildren(com.ibm.etools.systems.model.SystemConnection)
+ */
+ public boolean hasConnectionChildren(IHost selectedConnection)
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.ui.view.ISystemViewInputProvider#setShell(org.eclipse.swt.widgets.Shell)
+ */
+ public void setShell(Shell shell)
+ {
+ this.shell = shell;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.ui.view.ISystemViewInputProvider#getShell()
+ */
+ public Shell getShell()
+ {
+ return shell;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.ui.view.ISystemViewInputProvider#setViewer(org.eclipse.jface.viewers.Viewer)
+ */
+ public void setViewer(Viewer viewer)
+ {
+ this.viewer = viewer;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.ui.view.ISystemViewInputProvider#getViewer()
+ */
+ public Viewer getViewer()
+ {
+ return viewer;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.ui.view.ISystemViewInputProvider#showActionBar()
+ */
+ public boolean showActionBar()
+ {
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.ui.view.ISystemViewInputProvider#showButtonBar()
+ */
+ public boolean showButtonBar()
+ {
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.ui.view.ISystemViewInputProvider#showActions()
+ */
+ public boolean showActions()
+ {
+ return false;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewLabelProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewLabelProvider.java
new file mode 100644
index 00000000000..57e27c3695e
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewLabelProvider.java
@@ -0,0 +1,212 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view.team;
+
+import java.util.Collection;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.rse.core.SystemBasePlugin;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.model.ISystemProfile;
+import org.eclipse.rse.model.ISystemResourceChangeListener;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
+import org.eclipse.rse.ui.view.ISystemViewInputProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+
+
+/**
+ * Base label provider for System Team View part
+ */
+public class SystemTeamViewLabelProvider extends LabelProvider
+{
+
+ public static final String Copyright =
+ "(C) Copyright IBM Corp. 2002, 2003. All Rights Reserved.";
+
+ // Used to grab Workbench standard icons.
+ private WorkbenchLabelProvider aWorkbenchLabelProvider = new WorkbenchLabelProvider();
+ private Viewer viewer;
+ /**
+ * The cache of images that have been dispensed by this provider.
+ * Maps ImageDescriptor->Image.
+ */
+ private Map imageTable = new Hashtable(40);
+
+ /**
+ * Constructor
+ */
+ public SystemTeamViewLabelProvider(Viewer viewer)
+ {
+ super();
+ this.viewer = viewer;
+ }
+ /**
+ * Get the image to display
+ */
+ public Image getImage(Object element)
+ {
+ Image image = null;
+
+ if (element instanceof ISystemProfile)
+ {
+ ISystemProfile profile = (ISystemProfile)element;
+ if (SystemPlugin.getTheSystemRegistry().getSystemProfileManager().isSystemProfileActive(profile.getName()))
+ return SystemPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_PROFILE_ACTIVE_ID);
+ else
+ return SystemPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_PROFILE_ID);
+ }
+
+ // If we have a project, return the resource project images.
+ else if (element instanceof IProject)
+ {
+ Image projectImage = aWorkbenchLabelProvider.getImage((IProject)element);
+ return projectImage;
+ }
+
+ // User system view element adapter
+ ISystemViewElementAdapter adapter = getSystemViewAdapter(element);
+ if (adapter != null)
+ {
+ //return adapter.getImage(element);
+ ImageDescriptor descriptor = adapter.getImageDescriptor(element);
+ if (descriptor != null)
+ {
+ return getImageFromImageDescriptor(descriptor);
+ }
+ }
+
+ // use Workbench stuff.
+ image = aWorkbenchLabelProvider.getImage(element);
+ if (image != null)
+ {
+ return image;
+ }
+
+ // all failed, use parent code.
+ return super.getImage(element);
+ }
+ /**
+ * Turn image descriptor into image
+ */
+ private Image getImageFromImageDescriptor(ImageDescriptor descriptor)
+ {
+ if (descriptor == null)
+ return null;
+ Image image = (Image) imageTable.get(descriptor);
+ if (image == null)
+ {
+ image = descriptor.createImage();
+ imageTable.put(descriptor, image);
+ }
+ return image;
+
+ }
+
+ /**
+ * Get the label to display
+ */
+ public String getText(Object element)
+ {
+ ISystemViewElementAdapter adapter = getSystemViewAdapter(element);
+ if (adapter != null)
+ return adapter.getText(element);
+
+ // If we have a project, return the resource project images.
+ if (element instanceof IProject)
+ {
+ return ((IProject)element).getName();
+ }
+ // use Workbench stuff.
+ String text = aWorkbenchLabelProvider.getText(element);
+ if (text.length() > 0)
+ return text;
+
+ // all failed, use parent code.
+ return super.getText(element);
+ }
+
+ /**
+ * Dispose of images created here.
+ */
+ public void dispose()
+ {
+ // The following we got from WorkbenchLabelProvider
+ if (imageTable != null)
+ {
+ Collection imageValues = imageTable.values();
+ if (imageValues!=null)
+ {
+ Iterator images = imageValues.iterator();
+ if (images!=null)
+ while (images.hasNext())
+ ((Image)images.next()).dispose();
+ imageTable = null;
+ }
+ }
+ }
+
+ /**
+ * Returns the implementation of ISystemViewElement for the given
+ * object. Returns null if the adapter is not defined or the
+ * object is not adaptable.
+ */
+ protected ISystemViewElementAdapter getSystemViewAdapter(Object o)
+ {
+ ISystemViewElementAdapter adapter = null;
+ if (o == null)
+ {
+ SystemBasePlugin.logWarning("ERROR: null passed to getAdapter in SystemTeamViewLabelProvider");
+ return null;
+ }
+ if (!(o instanceof IAdaptable))
+ adapter = (ISystemViewElementAdapter)Platform.getAdapterManager().getAdapter(o,ISystemViewElementAdapter.class);
+ else
+ adapter = (ISystemViewElementAdapter)((IAdaptable)o).getAdapter(ISystemViewElementAdapter.class);
+ //if (adapter == null)
+ // SystemPlugin.logWarning("ADAPTER IS NULL FOR ELEMENT OF TYPE: " + o.getClass().getName());
+ if ((adapter!=null) && (viewer != null))
+ {
+ Shell shell = null;
+ if (viewer instanceof ISystemResourceChangeListener)
+ shell = ((ISystemResourceChangeListener)viewer).getShell();
+ else if (viewer != null)
+ shell = viewer.getControl().getShell();
+ if (shell != null)
+ adapter.setShell(shell);
+ adapter.setViewer(viewer);
+ if (viewer.getInput() instanceof ISystemViewInputProvider)
+ {
+ ISystemViewInputProvider inputProvider = (ISystemViewInputProvider)viewer.getInput();
+ adapter.setInput(inputProvider);
+ }
+ }
+ else if (viewer == null)
+ SystemBasePlugin.logWarning("VIEWER IS NULL FOR SystemTeamViewLabelProvider");
+ return adapter;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewMakeActiveProfileAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewMakeActiveProfileAction.java
new file mode 100644
index 00000000000..004278ce8bb
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewMakeActiveProfileAction.java
@@ -0,0 +1,91 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view.team;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.internal.model.SystemProfileManager;
+import org.eclipse.rse.model.ISystemProfile;
+import org.eclipse.rse.model.ISystemProfileManager;
+import org.eclipse.rse.model.ISystemRegistry;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.actions.SystemBaseAction;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * The action allows users to activate all selected profiles
+ */
+public class SystemTeamViewMakeActiveProfileAction extends SystemBaseAction
+
+{
+
+ /**
+ * Constructor
+ */
+ public SystemTeamViewMakeActiveProfileAction(Shell parent)
+ {
+ super(SystemResources.ACTION_PROFILE_MAKEACTIVE_LABEL,SystemResources.ACTION_PROFILE_MAKEACTIVE_TOOLTIP,
+ SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_MAKEPROFILEACTIVE_ID),
+ parent);
+ allowOnMultipleSelection(true);
+ setContextMenuGroup(ISystemContextMenuConstants.GROUP_CHANGE);
+ setHelp(SystemPlugin.HELPPREFIX+"ActionMakeActive");
+ }
+
+ /**
+ * Here we decide whether to enable ths action or not. We enable it
+ * if every selected object is a profile, and if its not the case
+ * that every selected profile is already active.
+ * @see SystemBaseAction#updateSelection(IStructuredSelection)
+ */
+ public boolean updateSelection(IStructuredSelection selection)
+ {
+ Object currsel = getFirstSelection();
+ if (!(currsel instanceof ISystemProfile))
+ return false;
+ ISystemProfile profile = (ISystemProfile)currsel;
+ ISystemProfileManager mgr = SystemProfileManager.getSystemProfileManager();
+ boolean allActive = true;
+ while (profile != null)
+ {
+ if (!mgr.isSystemProfileActive(profile.getName()))
+ allActive = false;
+ currsel = getNextSelection();
+ if ((currsel!=null) && !(currsel instanceof ISystemProfile))
+ return false;
+ profile = (ISystemProfile)currsel;
+ }
+ return !allActive;
+ }
+
+ /**
+ * This is the method called when the user selects this action.
+ * It walks through all the selected profiles and make them all active
+ */
+ public void run()
+ {
+ ISystemRegistry sr = SystemPlugin.getTheSystemRegistry();
+ ISystemProfile profile = (ISystemProfile)getFirstSelection();
+ while (profile != null)
+ {
+ sr.setSystemProfileActive(profile, true);
+ profile = (ISystemProfile)getNextSelection();
+ }
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewMakeInActiveProfileAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewMakeInActiveProfileAction.java
new file mode 100644
index 00000000000..163fb19b1ec
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewMakeInActiveProfileAction.java
@@ -0,0 +1,93 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view.team;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.internal.model.SystemProfileManager;
+import org.eclipse.rse.model.ISystemProfile;
+import org.eclipse.rse.model.ISystemProfileManager;
+import org.eclipse.rse.model.ISystemRegistry;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.actions.SystemBaseAction;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * The action allows users to de-activate all selected profiles
+ */
+public class SystemTeamViewMakeInActiveProfileAction extends SystemBaseAction
+
+{
+
+ /**
+ * Constructor
+ */
+ public SystemTeamViewMakeInActiveProfileAction(Shell parent)
+ {
+ super(SystemResources.ACTION_PROFILE_MAKEINACTIVE_LABEL,SystemResources.ACTION_PROFILE_MAKEINACTIVE_TOOLTIP,
+ SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_MAKEPROFILEINACTIVE_ID),
+ parent);
+ allowOnMultipleSelection(true);
+ setContextMenuGroup(ISystemContextMenuConstants.GROUP_CHANGE);
+ setHelp(SystemPlugin.HELPPREFIX+"ActionMakeInactive");
+ }
+
+ /**
+ * Here we decide whether to enable ths action or not. We enable it
+ * if every selected object is a profile, and if its not the case
+ * that every selected profile is already inactive.
+ * @see SystemBaseAction#updateSelection(IStructuredSelection)
+ */
+ public boolean updateSelection(IStructuredSelection selection)
+ {
+ Object currsel = getFirstSelection();
+ if (!(currsel instanceof ISystemProfile))
+ return false;
+ ISystemProfile profile = (ISystemProfile)currsel;
+ ISystemProfileManager mgr = SystemProfileManager.getSystemProfileManager();
+ boolean allInActive = true;
+ while (profile != null)
+ {
+ if (mgr.isSystemProfileActive(profile.getName()))
+ allInActive = false;
+ currsel = getNextSelection();
+ if ((currsel!=null) && !(currsel instanceof ISystemProfile))
+ return false;
+ profile = (ISystemProfile)currsel;
+ }
+ return !allInActive;
+ }
+
+ /**
+ * This is the method called when the user selects this action.
+ * It walks through all the selected profiles and make them all inactive
+ */
+ public void run()
+ {
+ // TODO: test if attempting to disable all profiles, and issue an error
+ // that at least one needs to be active. Or, at least a warning.
+ ISystemRegistry sr = SystemPlugin.getTheSystemRegistry();
+ ISystemProfile profile = (ISystemProfile)getFirstSelection();
+ while (profile != null)
+ {
+ sr.setSystemProfileActive(profile, false);
+ profile = (ISystemProfile)getNextSelection();
+ }
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewPart.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewPart.java
new file mode 100644
index 00000000000..fc1b1a4e85e
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewPart.java
@@ -0,0 +1,1560 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view.team;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Vector;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IStatusLineManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.util.ListenerList;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.IOpenListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.OpenEvent;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.window.SameShellProvider;
+import org.eclipse.rse.core.SystemAdapterHelpers;
+import org.eclipse.rse.core.SystemBasePlugin;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.SystemResourceManager;
+import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
+import org.eclipse.rse.filters.ISystemFilter;
+import org.eclipse.rse.filters.ISystemFilterPool;
+import org.eclipse.rse.model.IHost;
+import org.eclipse.rse.model.ISystemModelChangeEvent;
+import org.eclipse.rse.model.ISystemModelChangeEvents;
+import org.eclipse.rse.model.ISystemModelChangeListener;
+import org.eclipse.rse.model.ISystemProfile;
+import org.eclipse.rse.model.ISystemProfileManager;
+import org.eclipse.rse.model.ISystemRegistry;
+import org.eclipse.rse.model.SystemStartHere;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.ISystemDeleteTarget;
+import org.eclipse.rse.ui.ISystemRenameTarget;
+import org.eclipse.rse.ui.SystemMenuManager;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.actions.ISystemAction;
+import org.eclipse.rse.ui.actions.SystemCollapseAllAction;
+import org.eclipse.rse.ui.actions.SystemCommonDeleteAction;
+import org.eclipse.rse.ui.actions.SystemCommonSelectAllAction;
+import org.eclipse.rse.ui.actions.SystemNewProfileAction;
+import org.eclipse.rse.ui.actions.SystemSubMenuManager;
+import org.eclipse.rse.ui.actions.SystemTeamReloadAction;
+import org.eclipse.rse.ui.messages.ISystemMessageLine;
+import org.eclipse.rse.ui.messages.SystemMessageDialog;
+import org.eclipse.rse.ui.view.IRSEViewPart;
+import org.eclipse.rse.ui.view.ISystemMementoConstants;
+import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
+import org.eclipse.rse.ui.view.SystemViewMenuListener;
+import org.eclipse.rse.ui.view.SystemViewPart;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.ScrollBar;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.IPageListener;
+import org.eclipse.ui.IViewSite;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.dialogs.PropertyDialogAction;
+import org.eclipse.ui.part.ISetSelectionTarget;
+import org.eclipse.ui.part.ViewPart;
+import org.osgi.framework.Bundle;
+
+
+/**
+ * The viewer and view part for the Team view
+ */
+public class SystemTeamViewPart
+ extends ViewPart
+ implements ISetSelectionTarget, ISelectionProvider, ISystemModelChangeListener,
+ ISystemMessageLine, ISelectionChangedListener,
+ ISystemDeleteTarget, ISystemRenameTarget, IMenuListener, IRSEViewPart
+{
+
+ private boolean menuListenerAdded;
+ public static final String ID = "org.eclipse.rse.ui.view.teamView";
+
+ private SystemTeamViewInputProvider input = null;
+ private SystemTeamView treeViewer = null;
+ //private FrameList frameList = null;
+ private IStatusLineManager statusLine = null;
+ private String message, errorMessage;
+ private SystemMessage sysErrorMessage;
+
+ // selectionChangedListeners
+ private ListenerList selectionChangedListeners = new ListenerList(6);
+
+ private boolean privateProfileStillExists = false;
+
+ // context menu actions for project...
+ protected SystemTeamReloadAction reloadRSEAction;
+ protected SystemNewProfileAction newProfileAction;
+ // common context menu actions...
+ protected SystemCommonDeleteAction deleteAction;
+ protected PropertyDialogAction propertyDialogAction;
+ protected SystemTeamViewRefreshAllAction toolBarRefreshAllAction, menuRefreshAllAction;
+ protected SystemCollapseAllAction collapseAllAction;
+
+ protected ISystemViewElementAdapter profileAdapter = SystemPlugin.getDefault().getSystemViewAdapterFactory().getProfileAdapter();
+
+ // remember-state variables...
+ private IMemento fMemento;
+ // state...
+ static final String TAG_RELEASE= "release";
+ static final String TAG_SELECTION= "selection";
+ static final String TAG_EXPANDED_TO= "expandedTo";
+ static final String TAG_EXPANDED= "expanded";
+ static final String TAG_ELEMENT= "element";
+ static final String TAG_PATH= "path";
+ static final String TAG_INPUT= "svInput";
+ static final String TAG_VERTICAL_POSITION= "verticalPosition";
+ static final String TAG_HORIZONTAL_POSITION= "horizontalPosition";
+ static final String MEMENTO_DELIM = "///";
+
+ /**
+ * Remove a selection change listener
+ */
+ public void removeSelectionChangedListener(ISelectionChangedListener listener)
+ {
+ selectionChangedListeners.remove(listener);
+ }
+ /**
+ * Add a selection change listener
+ */
+ public void addSelectionChangedListener(ISelectionChangedListener listener)
+ {
+ selectionChangedListeners.add(listener);
+ }
+
+ /**
+ * Returns selection for the tree view
+ */
+ public ISelection getSelection()
+ {
+ return treeViewer.getSelection();
+ }
+
+ public void setSelection(ISelection selection)
+ {
+ treeViewer.setSelection(selection);
+ }
+
+ /**
+ * Returns the tree viewer selection as a structured selection
+ */
+ public IStructuredSelection getStructuredSelection()
+ {
+ // we know we have a ss.
+ return (IStructuredSelection) (treeViewer.getSelection());
+ }
+
+ public TreeViewer getTreeViewer() {
+ return treeViewer;
+ }
+
+ public Viewer getRSEViewer()
+ {
+ return treeViewer;
+ }
+
+ /**
+ * We are getting focus
+ */
+ public void setFocus()
+ {
+ if (treeViewer == null)
+ return;
+ Tree tree = treeViewer.getTree();
+ if (tree != null)
+ treeViewer.getTree().setFocus();
+ }
+
+ /**
+ * Create the viewer to go in this view part.
+ */
+ public void createPartControl(Composite parent)
+ {
+ treeViewer =
+ //new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
+ new SystemTeamView(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL, this);
+ treeViewer.setUseHashlookup(true);
+ treeViewer.setContentProvider(new SystemTeamViewContentProvider());
+ treeViewer.setLabelProvider(new SystemTeamViewLabelProvider(treeViewer));
+
+ treeViewer.setInput(getInput());
+
+ addTreeViewerListeners();
+
+ // create the frame list.
+ //frameList = createFrameList();
+
+ // now update title of the view part.
+ updateTitle();
+
+ // Handle menus:
+ // think about menu manager id later.
+ MenuManager menuMgr = new MenuManager();
+ menuMgr.setRemoveAllWhenShown(true);
+ Menu menu = menuMgr.createContextMenu(treeViewer.getTree());
+ treeViewer.getTree().setMenu(menu);
+ getSite().registerContextMenu(menuMgr, treeViewer);
+ // important to add our listener after registering, so we are called second!
+ // This gives us the opportunity to scrub the contributions added by others, to screen out
+ // non-team additions.
+ menuMgr.addMenuListener(this);
+ /*
+ menuMgr.addMenuListener(new IMenuListener() {
+ public void menuAboutToShow(IMenuManager manager) {
+ SystemTeamViewPart.this.fillContextMenu(manager);
+ }
+ });*/
+
+ // Fill the action bars and update the global action handlers'
+ // enabled state to match the current selection. We pass the selection
+ // based on the iSeries object model. The action group will handle
+ // delegating the correct object model to the actions.
+ fillActionBars(getViewSite().getActionBars());
+ //updateActionBars(getStructuredSelection());
+
+ // this is a must here to get Properties Pages to work.
+ getSite().setSelectionProvider(treeViewer);
+ //getSite().setSelectionProvider(this);
+
+ // Update status line.
+ statusLine = getViewSite().getActionBars().getStatusLineManager();
+ //updateStatusLine(getStructuredSelection());
+
+ // we need to refresh viewer when page gets activated for Marker updates
+ //pageListener = new CurrentPageListener(getSite().getPage());
+ //getSite().getWorkbenchWindow().addPageListener(pageListener);
+
+ // update F1 help
+ //PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IF1HelpContextID.NAV01);
+
+ SystemPlugin.getTheSystemRegistry().addSystemModelChangeListener(this);
+
+ treeViewer.setAutoExpandLevel(2); // dang, it doesn't work!
+
+ // ----------------------
+ // Restore previous state
+ // ----------------------
+ if (fMemento != null)
+ restoreState(fMemento);
+ fMemento= null;
+ }
+
+ /**
+ * Called when the context menu is about to open.
+ * From IMenuListener interface
+ * Calls {@link #fillContextMenu(IMenuManager)}
+ */
+ public void menuAboutToShow(IMenuManager menu)
+ {
+ fillContextMenu(menu);
+ if (!menuListenerAdded)
+ {
+ if (menu instanceof MenuManager)
+ {
+ Menu m = ((MenuManager)menu).getMenu();
+ if (m != null)
+ {
+ menuListenerAdded = true;
+ SystemViewMenuListener ml = new SystemViewMenuListener();
+ ml.setShowToolTipText(true, (ISystemMessageLine)this);
+ m.addMenuListener(ml);
+ }
+ }
+ }
+ //System.out.println("Inside menuAboutToShow: menu null? "+( ((MenuManager)menu).getMenu()==null));
+ }
+
+ // -------------------------------------------
+ // MEMENTO SUPPORT (SAVING/RESTORING STATE)...
+ // -------------------------------------------
+ /**
+ * Initializes this view with the given view site. A memento is passed to
+ * the view which contains a snapshot of the views state from a previous
+ * session. Where possible, the view should try to recreate that state
+ * within the part controls.
+ *
+ * This is needed for various keys (eg: delete key) and for model dump.
+ */
+ private void handleKeyReleased(KeyEvent event)
+ {
+ //System.out.println("in handleKeyPressed. keyCode == SWT.F5? " + (event.keyCode==SWT.F5) + ", keyCode: "+event.keyCode);
+ if (event.keyCode == SWT.F5)
+ {
+ getRefreshAllToolbarAction(getStructuredSelection()).run();
+ }
+ }
+ /**
+ * Handles key events in viewer.
+ * This is needed for various keys (eg: delete key) and for model dump.
+ */
+ private void handleKeyPressed(KeyEvent event)
+ {
+ //System.out.println("in handleKeyPressed. keyCode == SWT.F5? " + (event.keyCode==SWT.F5) + ", keyCode: "+event.keyCode);
+ IStructuredSelection selection = (IStructuredSelection)getSelection();
+ if ((event.character == SWT.DEL) && (event.stateMask == 0) && (selection.size()>0) )
+ {
+ if (showDelete() && canDelete())
+ {
+ SystemCommonDeleteAction dltAction = (SystemCommonDeleteAction)getDeleteAction(selection);
+ dltAction.setShell(getShell());
+ dltAction.setSelection(getSelection());
+ dltAction.setViewer(getViewer());
+ dltAction.run();
+ }
+ }
+ else if ((event.character == '-') && (event.stateMask == SWT.CTRL) )
+ {
+ SystemCollapseAllAction collapseAllAction = getCollapseAllAction();
+ collapseAllAction.setShell(getShell());
+ collapseAllAction.run();
+ }
+ else if ((event.character == '-') && (selection.size()>0) )
+ {
+ //System.out.println("Inside Ctrl+- processing");
+ treeViewer.collapseSelected();
+ }
+ else if ((event.character == '+') && (selection.size()>0) )
+ {
+ //System.out.println("Inside Ctrl++ processing");
+ treeViewer.expandSelected();
+ }
+
+ }
+
+ /**
+ * Reveal and selects the passed selection in viewer.
+ */
+ public void selectReveal(ISelection selection)
+ {
+ if (!(selection instanceof StructuredSelection))
+ return;
+ StructuredSelection ssel = (StructuredSelection)selection;
+ java.util.List test = ssel.toList();
+ if (!ssel.isEmpty()) {
+ // select and reveal the item
+ treeViewer.setSelection(ssel, true);
+ }
+ }
+
+ /**
+ * Called when the context menu is about to open.
+ */
+ private void fillContextMenu(IMenuManager menu)
+ {
+ SystemMenuManager ourMenu = new SystemMenuManager(menu);
+
+ privateProfileStillExists = (SystemStartHere.getSystemProfileManager().getDefaultPrivateSystemProfile() != null);
+
+ // Populate with our stuff...
+ IStructuredSelection selection = getStructuredSelection();
+ Object firstSelection = selection.getFirstElement();
+ if (firstSelection instanceof IProject)
+ {
+ // Scrub unrelated menu items
+ scrubOtherContributions(menu);
+ createStandardGroups(menu);
+ if (selection.size() == 1)
+ fillProjectContextMenu(ourMenu, selection);
+ }
+ else
+ {
+ createStandardGroups(menu);
+ ISystemViewElementAdapter adapter = SystemAdapterHelpers.getAdapter(firstSelection, treeViewer);
+ if (adapter != null)
+ {
+ if ((firstSelection instanceof SystemTeamViewSubSystemFactoryNode) ||
+ // FIXME - compile actions separate now (firstSelection instanceof SystemTeamViewCompileTypeNode) ||
+ (firstSelection instanceof ISystemProfile))
+ {
+ addActions(ourMenu, selection);
+ }
+ else if (firstSelection instanceof ISystemFilterPool)
+ {
+ //SystemTestingAction testAction = new SystemTestingAction(getShell(), this);
+ //testAction.setSelection(getSelection());
+ //ourMenu.add(ISystemContextMenuConstants.GROUP_CHANGE, testAction);
+ }
+ }
+ }
+ // wail through all actions, updating shell and selection
+ IContributionItem[] items = menu.getItems();
+ for (int idx=0; idx < items.length; idx++)
+ {
+ if ((items[idx] instanceof ActionContributionItem) &&
+ (((ActionContributionItem)items[idx]).getAction() instanceof ISystemAction))
+ {
+ ISystemAction item = (ISystemAction) ( ((ActionContributionItem)items[idx]).getAction() );
+ try{
+ item.setInputs(getShell(), getViewer(), selection);
+ } catch (Exception e)
+ {
+ SystemBasePlugin.logError("Error configuring action " + item.getClass().getName(),e);
+ System.err.println("Error configuring action " + item.getClass().getName());
+ }
+ }
+ else if (items[idx] instanceof SystemSubMenuManager)
+ {
+ SystemSubMenuManager item = (SystemSubMenuManager)items[idx];
+ item.setInputs(getShell(), getViewer(), selection);
+ }
+ }
+ PropertyDialogAction pdAction = getPropertyDialogAction(selection);
+ if (pdAction.isApplicableForSelection())
+ menu.appendToGroup(ISystemContextMenuConstants.GROUP_PROPERTIES, pdAction);
+ }
+
+ /**
+ * Let each object add their own actions...
+ * @param menu
+ */
+ protected void addActions(SystemMenuManager ourMenu, IStructuredSelection selection)
+ {
+ // ADAPTER SPECIFIC ACTIONS
+ Iterator elements= selection.iterator();
+ Hashtable adapters = new Hashtable();
+ while (elements.hasNext())
+ {
+ Object element= elements.next();
+ ISystemViewElementAdapter adapter = SystemAdapterHelpers.getAdapter(element, treeViewer);
+ if (adapter != null)
+ adapters.put(adapter,element); // want only unique adapters
+ }
+ Enumeration uniqueAdapters = adapters.keys();
+ Shell shell = getShell();
+ while (uniqueAdapters.hasMoreElements())
+ {
+ ISystemViewElementAdapter nextAdapter = (ISystemViewElementAdapter)uniqueAdapters.nextElement();
+ nextAdapter.addActions(ourMenu,selection,shell,ISystemContextMenuConstants.GROUP_ADAPTERS);
+ //if (nextAdapter instanceof AbstractSystemViewAdapter)
+ // ((AbstractSystemViewAdapter)nextAdapter).addCommonRemoteActions(ourMenu,selection,shell,ISystemContextMenuConstants.GROUP_ADAPTERS);
+ }
+
+ // wail through all actions, updating shell and selection
+ IContributionItem[] items = ourMenu.getMenuManager().getItems();
+ for (int idx=0; idx < items.length; idx++)
+ {
+ if ((items[idx] instanceof ActionContributionItem) &&
+ (((ActionContributionItem)items[idx]).getAction() instanceof ISystemAction))
+ {
+ ISystemAction item = (ISystemAction) ( ((ActionContributionItem)items[idx]).getAction() );
+ try{
+ item.setInputs(getShell(), treeViewer, selection);
+ } catch (Exception e)
+ {
+ SystemBasePlugin.logError("Error configuring action " + item.getClass().getName(),e);
+ System.out.println("Error configuring action " + item.getClass().getName());
+ }
+ }
+ else if (items[idx] instanceof SystemSubMenuManager)
+ {
+ SystemSubMenuManager item = (SystemSubMenuManager)items[idx];
+ item.setInputs(getShell(), treeViewer, selection);
+ }
+ }
+ }
+
+ /**
+ * Creates the Systems plugin standard groups in a context menu.
+ */
+ public void createStandardGroups(IMenuManager menu)
+ {
+ //if (!menu.isEmpty())
+ // return;
+ // simply sets partitions in the menu, into which actions can be directed.
+ // Each partition can be delimited by a separator (new Separator) or not (new GroupMarker).
+ // Deleted groups are not used yet.
+ menu.add(new Separator(ISystemContextMenuConstants.GROUP_NEW)); // new->
+ menu.add(new Separator(ISystemContextMenuConstants.GROUP_NEW_NONCASCADING)); // new stuff
+ /*
+ menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_GOTO)); // goto into, go->
+ menu.add(new Separator(ISystemContextMenuConstants.GROUP_EXPANDTO)); // expand to->
+ menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_EXPAND)); // expand, collapse
+ menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_OPEN)); // open xxx
+ menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_OPENWITH)); // open with->
+ menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_BROWSEWITH)); // open with->
+ */
+ menu.add(new Separator(ISystemContextMenuConstants.GROUP_WORKWITH)); // work with->
+ menu.add(new Separator(ISystemContextMenuConstants.GROUP_BUILD)); // build, rebuild, refresh
+ menu.add(new Separator(ISystemContextMenuConstants.GROUP_CHANGE)); // update, change
+ menu.add(new Separator(ISystemContextMenuConstants.GROUP_REORGANIZE)); // rename,move,copy,delete,bookmark,refactoring
+ /*
+ menu.add(new Separator(ISystemContextMenuConstants.GROUP_REORDER)); // move up, move down
+ menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_GENERATE)); // getters/setters, etc. Typically in editor
+ menu.add(new Separator(ISystemContextMenuConstants.GROUP_SEARCH)); // search
+ menu.add(new Separator(ISystemContextMenuConstants.GROUP_CONNECTION)); // connection-related actions
+ menu.add(new Separator(ISystemContextMenuConstants.GROUP_STARTSERVER)); // Start Remote Server cascading menu
+ menu.add(new Separator(ISystemContextMenuConstants.GROUP_IMPORTEXPORT)); // get or put actions
+ menu.add(new Separator(ISystemContextMenuConstants.GROUP_ADAPTERS)); // actions queried from adapters
+ */
+ menu.add(new Separator(ISystemContextMenuConstants.GROUP_ADDITIONS)); // user or BP/ISV additions
+ //menu.add(new Separator(ISystemContextMenuConstants.GROUP_VIEWER_SETUP)); // ? Probably View->by xxx, yyy
+ //menu.add(new Separator(ISystemContextMenuConstants.GROUP_TEAM)); // Team
+ menu.add(new Separator(ISystemContextMenuConstants.GROUP_PROPERTIES)); // Properties
+ }
+
+
+ /**
+ * Fill context menu for IProjects
+ */
+ private void fillProjectContextMenu(SystemMenuManager menu, IStructuredSelection selection)
+ {
+ menu.add(ISystemContextMenuConstants.GROUP_BUILD,getRefreshAllMenuAction(selection));
+ menu.add(ISystemContextMenuConstants.GROUP_BUILD,getReloadRSEAction(selection));
+ menu.add(ISystemContextMenuConstants.GROUP_NEW,getNewProfileAction(selection));
+ //menu.add(new Separator(ISystemContextMenuConstants.GROUP_PROPERTIES));
+ //menu.appendToGroup(ISystemContextMenuConstants.GROUP_PROPERTIES, getPropertyDialogAction(selection));
+ }
+
+ /**
+ * Get the properties dialog action
+ */
+ private PropertyDialogAction getPropertyDialogAction(IStructuredSelection selection)
+ {
+ if (propertyDialogAction == null)
+ propertyDialogAction = new PropertyDialogAction(new SameShellProvider(getShell()), treeViewer);
+ propertyDialogAction.selectionChanged(selection);
+ return propertyDialogAction;
+ }
+ /**
+ * Get the reload RSE action for the context menu
+ */
+ private SystemTeamReloadAction getReloadRSEAction(IStructuredSelection selection)
+ {
+ if (reloadRSEAction == null)
+ reloadRSEAction = new SystemTeamReloadAction(getShell());
+ reloadRSEAction.setSelection(selection);
+ if (privateProfileStillExists)
+ reloadRSEAction.setEnabled(false);
+ return reloadRSEAction;
+ }
+ /**
+ * Get the refresh All action for the context menu
+ */
+ private SystemTeamViewRefreshAllAction getRefreshAllMenuAction(IStructuredSelection selection)
+ {
+ if (menuRefreshAllAction == null)
+ menuRefreshAllAction = new SystemTeamViewRefreshAllAction(getShell(), this);
+ menuRefreshAllAction.setSelection(selection);
+ return menuRefreshAllAction;
+ }
+ /**
+ * Get the refresh All action for the toolbar
+ */
+ private SystemTeamViewRefreshAllAction getRefreshAllToolbarAction(IStructuredSelection selection)
+ {
+ if (toolBarRefreshAllAction == null)
+ toolBarRefreshAllAction = new SystemTeamViewRefreshAllAction(getShell(), this);
+ toolBarRefreshAllAction.setSelection(selection);
+ return toolBarRefreshAllAction;
+ }
+ /**
+ * Get the New Profile actoin
+ */
+ private SystemNewProfileAction getNewProfileAction(IStructuredSelection selection)
+ {
+ if (newProfileAction == null)
+ {
+ newProfileAction = new SystemNewProfileAction(getShell(), false);
+ newProfileAction.setViewer(getViewer());
+ }
+ newProfileAction.setSelection(selection);
+ return newProfileAction;
+ }
+ /**
+ * Rather than pre-defined this common action we wait until it is first needed,
+ * for performance reasons.
+ */
+ protected IAction getDeleteAction(IStructuredSelection selection)
+ {
+ if (deleteAction == null)
+ {
+ deleteAction = new SystemCommonDeleteAction(getShell(),this);
+ deleteAction.setViewer(getViewer());
+ deleteAction.setHelp(SystemPlugin.HELPPREFIX+"actndlpr");
+ deleteAction.setDialogHelp(SystemPlugin.HELPPREFIX+"ddltprfl");
+ deleteAction.setPromptLabel(SystemResources.RESID_DELETE_PROFILES_PROMPT);
+ }
+ deleteAction.setSelection(selection);
+ return deleteAction;
+ }
+
+ /**
+ * Scrub the popup menu to remove everything but team-related stuff...
+ */
+ private void scrubOtherContributions(IMenuManager menuMgr)
+ {
+ IContributionItem items[] = menuMgr.getItems();
+
+ if (items != null)
+ {
+ //System.out.println("# existing menu items: "+items.length);
+ for (int idx=0; idxnull
is returned.
+ */
+ public String getMessage()
+ {
+ return message;
+ }
+ /**
+ * Display the given error message. A currently displayed message
+ * is saved and will be redisplayed when the error message is cleared.
+ */
+ public void setErrorMessage(String message)
+ {
+ this.errorMessage = message;
+ if (statusLine != null)
+ statusLine.setErrorMessage(message);
+ }
+ /**
+ * Get the currently displayed error text.
+ * @return The error message. If no error message is displayed
null
is returned.
+ */
+ public SystemMessage getSystemErrorMessage()
+ {
+ return sysErrorMessage;
+ }
+
+ /**
+ * Display the given error message. A currently displayed message
+ * is saved and will be redisplayed when the error message is cleared.
+ */
+ public void setErrorMessage(SystemMessage message)
+ {
+ sysErrorMessage = message;
+ setErrorMessage(message.getLevelOneText());
+ }
+ /**
+ * Display the given error message. A currently displayed message
+ * is saved and will be redisplayed when the error message is cleared.
+ */
+ public void setErrorMessage(Throwable exc)
+ {
+ setErrorMessage(exc.getMessage());
+ }
+
+ /**
+ * Set the message text. If the message line currently displays an error,
+ * the message is stored and will be shown after a call to clearErrorMessage
+ */
+ public void setMessage(String message)
+ {
+ this.message = message;
+ if (statusLine != null)
+ statusLine.setMessage(message);
+ }
+ /**
+ *If the message line currently displays an error,
+ * the message is stored and will be shown after a call to clearErrorMessage
+ */
+ public void setMessage(SystemMessage message)
+ {
+ setMessage(message.getLevelOneText());
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewProfileAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewProfileAdapter.java
new file mode 100644
index 00000000000..4e5d91ef8bf
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/team/SystemTeamViewProfileAdapter.java
@@ -0,0 +1,412 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.view.team;
+import java.util.Hashtable;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.core.ISystemUserIdConstants;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.core.SystemResourceManager;
+import org.eclipse.rse.model.ISystemProfile;
+import org.eclipse.rse.model.SystemStartHere;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.ISystemIconConstants;
+import org.eclipse.rse.ui.SystemMenuManager;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.actions.SystemCommonDeleteAction;
+import org.eclipse.rse.ui.actions.SystemCommonRenameAction;
+import org.eclipse.rse.ui.actions.SystemProfileNameCopyAction;
+import org.eclipse.rse.ui.validators.ISystemValidator;
+import org.eclipse.rse.ui.validators.ValidatorProfileName;
+import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
+import org.eclipse.rse.ui.view.ISystemMementoConstants;
+import org.eclipse.rse.ui.view.ISystemPropertyConstants;
+import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
+import org.eclipse.rse.ui.view.SystemViewResources;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.views.properties.PropertyDescriptor;
+
+
+/**
+ * Adapter for displaying and processing SystemProfile objects in tree views, such as
+ * the Team view.
+ */
+public class SystemTeamViewProfileAdapter
+ extends AbstractSystemViewAdapter
+ implements ISystemViewElementAdapter, ISystemUserIdConstants
+{
+
+ private boolean actionsCreated = false;
+ private Hashtable categoriesByProfile = new Hashtable();
+ // context menu actions for profiles...
+ protected SystemTeamViewActiveProfileAction activeProfileAction;
+ protected SystemTeamViewMakeActiveProfileAction makeProfileActiveAction;
+ protected SystemTeamViewMakeInActiveProfileAction makeProfileInactiveAction;
+ protected SystemCommonRenameAction renameAction;
+ protected SystemCommonDeleteAction deleteAction;
+ protected SystemProfileNameCopyAction copyProfileAction;
+
+ // -------------------
+ // property descriptors
+ // -------------------
+ private static PropertyDescriptor[] propertyDescriptorArray = null;
+
+
+ /**
+ * Returns any actions that should be contributed to the popup menu
+ * for the given element.
+ * @param menu The menu to contribute actions to
+ * @param selection The window's current selection.
+ * @param shell Shell of viewer
+ * @param menuGroup recommended menu group to add actions to. If added to another group, you must be sure to create that group first.
+ */
+ public void addActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup)
+ {
+ if (!actionsCreated)
+ createActions();
+
+ boolean privateProfileStillExists = (SystemStartHere.getSystemProfileManager().getDefaultPrivateSystemProfile() != null);
+ copyProfileAction.setProfile((ISystemProfile)selection.getFirstElement());
+
+ if (activeProfileAction != null)
+ {
+ activeProfileAction.setEnabled(!privateProfileStillExists);
+ menu.add(ISystemContextMenuConstants.GROUP_CHANGE,activeProfileAction);
+ }
+ else
+ {
+ menu.add(ISystemContextMenuConstants.GROUP_CHANGE,makeProfileActiveAction);
+ menu.add(ISystemContextMenuConstants.GROUP_CHANGE,makeProfileInactiveAction);
+ }
+ menu.add(ISystemContextMenuConstants.GROUP_REORGANIZE,copyProfileAction);
+ menu.add(ISystemContextMenuConstants.GROUP_REORGANIZE,deleteAction);
+ menu.add(ISystemContextMenuConstants.GROUP_REORGANIZE,renameAction);
+ }
+ private void createActions()
+ {
+ // activate profile action...
+ // TODO: Delete the activeProfileAction logic when we have another mri rev, and can use the new actions.
+ if (SystemResources.ACTION_PROFILE_MAKEACTIVE_LABEL.equals("test"))
+ activeProfileAction = new SystemTeamViewActiveProfileAction(getShell());
+ else
+ {
+ makeProfileActiveAction = new SystemTeamViewMakeActiveProfileAction(getShell());
+ makeProfileInactiveAction = new SystemTeamViewMakeInActiveProfileAction(getShell());
+ }
+
+ copyProfileAction = new SystemProfileNameCopyAction(getShell());
+
+ deleteAction = new SystemCommonDeleteAction(getShell(),getTeamViewPart());
+ deleteAction.setHelp(SystemPlugin.HELPPREFIX+"actndlpr");
+ deleteAction.setDialogHelp(SystemPlugin.HELPPREFIX+"ddltprfl");
+ deleteAction.setPromptLabel(SystemResources.RESID_DELETE_PROFILES_PROMPT);
+
+ renameAction = new SystemCommonRenameAction(getShell(),getTeamViewPart());
+ renameAction.setHelp(SystemPlugin.HELPPREFIX+"actnrnpr");
+ renameAction.setDialogSingleSelectionHelp(SystemPlugin.HELPPREFIX+"drnsprfl");
+ renameAction.setDialogMultiSelectionHelp(SystemPlugin.HELPPREFIX+"drnmprfl");
+ renameAction.setSingleSelectPromptLabel(SystemResources.RESID_SIMPLE_RENAME_PROFILE_PROMPT_LABEL,
+ SystemResources.RESID_SIMPLE_RENAME_PROFILE_PROMPT_TIP);
+ renameAction.setMultiSelectVerbage(SystemResources.RESID_MULTI_RENAME_PROFILE_VERBAGE);
+
+ actionsCreated = true;
+ }
+
+ /**
+ * Returns an image descriptor for the image. More efficient than getting the image.
+ * @param element The element for which an image is desired
+ */
+ public ImageDescriptor getImageDescriptor(Object element)
+ {
+ ISystemProfile profile = (ISystemProfile)element;
+ if (SystemPlugin.getTheSystemRegistry().getSystemProfileManager().isSystemProfileActive(profile.getName()))
+ return SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_PROFILE_ACTIVE_ID);
+ else
+ return SystemPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_PROFILE_ID);
+ }
+ /**
+ * Return the team view part
+ */
+ private SystemTeamViewPart getTeamViewPart()
+ {
+ SystemTeamView viewer = (SystemTeamView)getViewer();
+ //System.out.println("Team view part set? " + (viewer != null));
+ return viewer.getTeamViewPart();
+ }
+
+ /**
+ * Return the label for this object
+ */
+ public String getText(Object element)
+ {
+ return ((ISystemProfile)element).getName();
+ }
+
+ /**
+ * Return the name of this object, which may be different than the display text ({#link #getText(Object)}.
+ * true
if daemon launch should be enabled, false
otherwise.
+ */
+ public void setDaemonLaunchEnabled(boolean enable)
+ {
+ //_radioDaemon.setVisible(enable);
+ //_daemonControls.setVisible(enable);
+ //_daemonControls.getLayout().
+ _labelDaemonPort.setEnabled(enable);
+ _fieldDaemonPort.setEnabled(enable);
+
+ _radioDaemon.setEnabled(enable);
+ }
+
+ /**
+ * Sets whether to enable rexec launch.
+ * @param enable true
if rexec launch should be enabled, false
otherwise.
+ */
+ public void setRexecLaunchEnabled(boolean enable)
+ {
+ /*
+ _radioRexec.setVisible(enable);
+ _rexecControls.setVisible(enable);
+ _labelRexecInvocation.setVisible(enable);
+ _labelRexecPath.setVisible(enable);
+ _labelRexecPort.setVisible(enable);
+ */
+ _fieldRexecInvocation.setEnabled(enable);
+ _fieldRexecPath.setEnabled(enable);
+ _fieldRexecPort.setEnabled(enable);
+
+ _radioRexec.setEnabled(enable);
+ }
+
+ public void setHostname(String hostname)
+ {
+ _hostName = hostname;
+ }
+
+ /**
+ * Set the daemon port widget value
+ * @param port - the port value as a string
+ */
+ public void setDaemonPort(String port)
+ {
+ _fieldDaemonPort.setText(port);
+ }
+
+ /**
+ * Set the daemon port widget value
+ * @param port - the port value as an int
+ */
+ public void setDaemonPort(int port)
+ {
+ _fieldDaemonPort.setText(Integer.toString(port));
+ }
+
+ /**
+ * Get the Daemon port widget value
+ * @return the widget's current value as an int
+ */
+ public int getDaemonPortAsInt()
+ {
+ int port = 0;
+ try {
+ port = Integer.parseInt(_fieldDaemonPort.getText().trim());
+ } catch (Exception exc) { }
+ return port;
+ }
+ /**
+ * Get the daemon port widget value
+ * @return the widget's current value as a string
+ */
+ public String getDaemonPort()
+ {
+ return _fieldDaemonPort.getText().trim();
+ }
+
+ /**
+ * Set the REXEC port's widget value, as a String
+ * @param port - the value to apply to the widget
+ */
+ public void setREXECPort(String port)
+ {
+ _fieldRexecPort.setText(port);
+ }
+ /**
+ * Set the REXEC port's widget value, given an int port value
+ * @param port - the value to apply to the widget.
+ */
+ public void setREXECPort(int port)
+ {
+ _fieldRexecPort.setText(Integer.toString(port));
+ }
+ /**
+ * Get the REXEC port widget value
+ * @return the widget's current value as an int
+ */
+ public int getREXECPortAsInt()
+ {
+ int port = 0;
+ try {
+ port = Integer.parseInt(_fieldRexecPort.getText().trim());
+ } catch (Exception exc) { }
+ return port;
+ }
+ /**
+ * Get the REXEC port widget value
+ * @return the widget's current value as a string
+ */
+ public String getREXECPort()
+ {
+ return _fieldRexecPort.getText().trim();
+ }
+
+
+ /**
+ * Sets whether to enable no launch.
+ * @param enable true
if no launch should be enabled, false
otherwise.
+ */
+ public void setNoLaunchEnabled(boolean enable)
+ {
+ _radioNone.setEnabled(enable);
+ }
+ /**
+ * Return the current value of the REXEC server install path widget
+ * @return widget value as a string
+ */
+ public String getServerInstallPath()
+ {
+ return _fieldRexecPath.getText().trim();
+ }
+ /**
+ * Set the REXEC server install path widget's value
+ * @param path - the text to set the widget's value to
+ */
+ public void setServerInstallPath(String path)
+ {
+ _fieldRexecPath.setText(path);
+ }
+ /**
+ * Return the current value of the REXEC server invocation widget
+ * @return widget value as a string
+ */
+ public String getServerInvocation()
+ {
+ return _fieldRexecInvocation.getText();
+ }
+ /**
+ * Set the REXEC server invocation widget's value
+ * @param invocation - the text to set the widget's value to
+ */
+ public void setServerInvocation(String invocation)
+ {
+ _fieldRexecInvocation.setText(invocation);
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/IServerLauncherForm.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/IServerLauncherForm.java
new file mode 100644
index 00000000000..40e9d901188
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/IServerLauncherForm.java
@@ -0,0 +1,61 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.widgets;
+
+import org.eclipse.rse.core.subsystems.IServerLauncherProperties;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+
+/**
+ * An interface implemented by server launchers in order to prompt for the
+ * properties of that server launcher.
+ * @see org.eclipse.rse.core.subsystems.IServerLauncherProperties
+ */
+public interface IServerLauncherForm
+{
+ /**
+ * Create the contents of the form
+ */
+ public abstract Control createContents(Composite parent);
+
+ /*
+ * Sets the hostname associated with this form
+ */
+ public void setHostname(String hostname);
+
+ /**
+ * Set the initial values for the widgets, based on the server launcher values
+ */
+ public void initValues(IServerLauncherProperties launcher);
+ /**
+ * Verify the contents of the widgets, when OK is pressed.
+ * Return true if all is well, false if an error found.
+ */
+ public boolean verify();
+ /**
+ * Update the actual values in the server launcher, from the widgets. Called on successful press of OK.
+ * @return true if all went well, false if something failed for some reason.
+ */
+ public boolean updateValues(IServerLauncherProperties launcher);
+
+ /**
+ * Did anythign change?
+ * @return
+ */
+ public boolean isDirty();
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/ISystemAddListener.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/ISystemAddListener.java
new file mode 100644
index 00000000000..402149e8574
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/ISystemAddListener.java
@@ -0,0 +1,47 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.widgets;
+import org.eclipse.rse.model.IHost;
+/**
+ * This is an interface used by the AS400SelectFieldForm, AS400SelectFieldDialog and
+ * AS400SelectFieldAction classes to enable the caller to be informed when the user
+ * presses the Add button for the selected field.
+ *
+ *
+ * In addition to the modes, there are these states supported
+ *
+ *
+ * There are constants for these modes and states in {@link org.eclipse.rse.ui.widgets.ISystemEditPaneStates}
+ *
+ *
+ */
+public class SystemEditPaneStateMachine implements ISystemEditPaneStates
+ //, SelectionListener
+{
+ // state
+ private Composite composite;
+ private Button applyButton, resetButton;
+ private int mode, state;
+ private int backupMode, backupState;
+ private SystemMessage pendingMsg;
+ private String applyLabel_applyMode;
+ private String applyLabel_newMode;
+ private String applyTip_applyMode;
+ private String applyTip_newMode;
+ private boolean applyLabelMode;
+ private boolean newSetByDelete; //d47125
+
+
+ /**
+ * Constructor for SystemEditPaneStateMachine.
+ *
+ * @see #updateHistory()
+ */
+public class SystemHistoryCombo extends Composite implements ISystemCombo, TraverseListener, KeyListener
+{
+ private Combo historyCombo = null;
+ private Button historyButton = null;
+ private String historyKey = null;
+ private String[] defaultHistory; // pc41439
+ private boolean readonly = false;
+ private boolean autoUppercase = false;
+
+ private int maxComboEntries; // DY: Debugger requested we provide support to limit the number of entries
+ private static final int DEFAULT_MAX_COMBO_ENTRIES = 20; // in the combo box for transient data like job name / number. Note: this does
+ // not affect the edit history portion of this widget. I have guessed at a
+ // default limit of 20 entries.
+
+ private static final int DEFAULT_COMBO_WIDTH = 100;
+ // dwd private static final int DEFAULT_BUTTON_WIDTH = 10;
+ private static final int DEFAULT_BUTTON_WIDTH = 13; // dwd: changed from 10 to accomodate focus rectangle
+ private static final int DEFAULT_MARGIN = 1;
+
+
+ /**
+ * Constructor for SystemHistoryCombo
+ * @param parent The owning composite
+ * @param style The swt style to apply to the overall composite. Typically it is just SWT.NULL
+ * @param key The unique string used as a preferences key to persist the history for this widget
+ * @param readonly Set to true for a readonly combo vs user-editable combo box
+ */
+ public SystemHistoryCombo(Composite parent, int style, String key, boolean readonly)
+ {
+ this(parent, style, key, DEFAULT_MAX_COMBO_ENTRIES, readonly);
+ }
+
+ /**
+ * Constructor for SystemHistoryCombo
+ * @param parent The owning composite
+ * @param style The swt style to apply to the overall composite. Typically it is just SWT.NULL
+ * @param key The unique string used as a preferences key to persist the history for this widget
+ * @param maxComboEntries The number of history entries to show in the combo box. This only restricts the
+ * combo box not the full history list
+ * @param readonly Set to true for a readonly combo vs user-editable combo box
+ */
+ public SystemHistoryCombo(Composite parent, int style, String key, int maxComboEntries, boolean readonly)
+ {
+ super(parent, style);
+ historyKey = key;
+ this.readonly = readonly;
+ prepareComposite(2);
+ historyCombo = createCombo(this, readonly);
+ //historyCombo.addTraverseListener(this);
+ historyCombo.addKeyListener(this);
+ //setWidthHint(DEFAULT_COMBO_WIDTH+DEFAULT_BUTTON_WIDTH+DEFAULT_MARGIN);
+ this.maxComboEntries = maxComboEntries;
+ createHistoryButton();
+ String[] history = getHistory();
+ if (history.length > 0)
+ setItems(history);
+ addOurButtonSelectionListener();
+ }
+
+ /**
+ * Return the combo box widget
+ */
+ public Combo getCombo()
+ {
+ return historyCombo;
+ }
+ /**
+ * Set the width hint for the combo box widget (in pixels).
+ * Default is only 100, so you may want to set it.
+ * A rule of thumb is 10 pixels per character, but allow 15 for the litte button on the right.
+ * You must call this versus setting it yourself, else you may see truncation.
+ */
+ public void setWidthHint(int widthHint)
+ {
+ // after much research it was decided that it was the wrong thing to do to
+ // explicitly set the widthHint of a child widget without our composite, as
+ // that could end up being a bigger number than the composites widthHint itself
+ // if the caller set its it directly.
+ // Rather, we just set the overall composite width and specify the combo child
+ // widget is to grab all the space within that which the little button does not use.
+ /*((GridData)historyCombo.getLayoutData()).grabExcessHorizontalSpace = true;
+ ((GridData)historyCombo.getLayoutData()).horizontalAlignment = GridData.FILL;
+ ((GridData)historyCombo.getLayoutData()).widthHint = widthHint;*/
+ ((GridData)getLayoutData()).widthHint = widthHint + DEFAULT_BUTTON_WIDTH + DEFAULT_MARGIN;
+ }
+
+ /**
+ * Set auto-uppercase. When enabled, all non-quoted values are uppercases when added to the history.
+ */
+ public void setAutoUpperCase(boolean enable)
+ {
+ this.autoUppercase = enable;
+ }
+
+ /**
+ * Return the history button widget
+ */
+ public Button getHistoryButton()
+ {
+ return historyButton;
+ }
+
+ /**
+ * Set the combo field's current contents
+ */
+ public void setText(String text)
+ {
+ if (!readonly)
+ {
+ historyCombo.setText(text);
+ updateHistory();
+ }
+ else
+ {
+ int selIdx = -1;
+ String[] currentItems = historyCombo.getItems();
+ String[] newItems = new String[currentItems.length + 1];
+ newItems[0] = text;
+ for (int idx=0; (selIdx==-1) && (idx
+ * ______________v...
+ *
+ *
+ * Connection: ______________________v
+ *
+ *
+ * Connection: ______________v New...
+ *
+ *
+ */
+public class SystemHostCombo extends Composite implements ISelectionProvider, ISystemCombo,
+ org.eclipse.rse.model.ISystemResourceChangeListener,
+ ISystemResourceChangeEvents, DisposeListener
+{
+ protected Label connectionLabel = null;
+ protected Combo connectionCombo = null;
+ protected Button newButton = null;
+ protected boolean showNewButton = true;
+ protected boolean showLabel = true;
+ protected boolean showQualifiedNames;
+ protected boolean listeningForConnectionEvents = false;
+ private IHost[] connections = null;
+ private SystemNewConnectionAction newConnectionAction = null;
+ private String[] restrictSystemTypesTo = null;
+ private int gridColumns = 2;
+ //private static final int DEFAULT_COMBO_WIDTH = 300;
+ //private static final int DEFAULT_BUTTON_WIDTH = 80;
+ private String label;
+ private String populateSystemType = null; /* used as criteria when refresh is done */
+ private String[] populateSystemTypes = null; /* used as criteria when refresh is done */
+ private ISubSystemConfiguration populateSSFactory = null; /* used as criteria when refresh is done */
+ private String populateSSFactoryId = null; /* used as criteria when refresh is done */
+ private String populateSSFactoryCategory = null; /* used as criteria when refresh is done */
+ private Cursor waitCursor;
+
+ /**
+ * Constructor for SystemConnectionCombo when there is only a single system type to restrict the connection list to.
+ * @param parent Parent composite
+ * @param style SWT style flags for overall composite widget. Typically just pass SWT.NULL
+ * @param systemType the system type to restrict the connection list to. Can be null or * for all.
+ * @param defaultConnection the system connection to preselect. Pass null to preselect first connection.
+ * @param showNewButton true if a New... button is to be included in this composite
+ */
+ public SystemHostCombo(Composite parent, int style, String systemType, IHost defaultConnection, boolean showNewButton)
+ {
+ super(parent, style);
+ restrictSystemTypesTo = new String[1];
+ restrictSystemTypesTo[0] = systemType;
+ init(parent, showNewButton);
+ populateSystemType = systemType;
+ populateConnectionCombo(connectionCombo, systemType, defaultConnection, true);
+ setConnectionToolTipText();
+ addOurConnectionSelectionListener();
+ }
+ /**
+ * Constructor for SystemConnectionCombo when there is an array of system types to restrict the connection list to.
+ * @param parent Parent composite
+ * @param style SWT style flags for overall composite widget. Typically just pass SWT.NULL
+ * @param systemTypes the system type array to restrict the connection list to.
+ * @param defaultConnection the system connection to preselect. Pass null to preselect first connection.
+ * @param showNewButton true if a New... button is to be included in this composite
+ */
+ public SystemHostCombo(Composite parent, int style, String[] systemTypes, IHost defaultConnection, boolean showNewButton)
+ {
+ super(parent, style);
+ restrictSystemTypesTo = systemTypes;
+ init(parent, showNewButton);
+ populateSystemTypes = systemTypes;
+ populateConnectionCombo(connectionCombo, systemTypes, defaultConnection);
+ setConnectionToolTipText();
+ addOurConnectionSelectionListener();
+ }
+ /**
+ * Constructor for SystemConnectionCombo when there is a subsystem factory to restrict the list to.
+ * @param parent Parent composite
+ * @param style SWT style flags for overall composite widget. Typically just pass SWT.NULL
+ * @param subsystemFactory. Only connections with subsystems owned by this factory are returned.
+ * @param defaultConnection the system connection to preselect. Pass null to preselect first connection.
+ * @param showNewButton true if a New... button is to be included in this composite
+ */
+ public SystemHostCombo(Composite parent, int style, ISubSystemConfiguration ssFactory, IHost defaultConnection, boolean showNewButton)
+ {
+ super(parent, style);
+ restrictSystemTypesTo = ssFactory.getSystemTypes();
+ init(parent, showNewButton);
+ populateSSFactory = ssFactory;
+ populateConnectionCombo(connectionCombo, ssFactory, defaultConnection);
+ setConnectionToolTipText();
+ addOurConnectionSelectionListener();
+ }
+ /**
+ * Constructor for SystemConnectionCombo when there is a subsystem factory id to restrict the list to.
+ * To avoid collision with the constructor that takes a string for the system type, this one places the
+ * subystem factory Id string parameter after the defaultConnection constructor
+ * @param parent Parent composite
+ * @param style SWT style flags for overall composite widget. Typically just pass SWT.NULL
+ * @param defaultConnection the system connection to preselect. Pass null to preselect first connection.
+ * @param subsystemFactoryId. Only connections with subsystems owned by this factory are returned.
+ * @param showNewButton true if a New... button is to be included in this composite
+ */
+ public SystemHostCombo(Composite parent, int style, IHost defaultConnection, String ssFactoryId, boolean showNewButton)
+ {
+ super(parent, style);
+ restrictSystemTypesTo = SystemPlugin.getTheSystemRegistry().getSubSystemConfiguration(ssFactoryId).getSystemTypes();
+ init(parent, showNewButton);
+ populateSSFactoryId = ssFactoryId;
+ populateConnectionCombo(connectionCombo, ssFactoryId, defaultConnection);
+ setConnectionToolTipText();
+ addOurConnectionSelectionListener();
+ }
+
+ /**
+ * Constructor for SystemConnectionCombo when there is a subsystem factory category to restrict the list to.
+ * To avoid collision with the constructor that takes a string for the system type, this one places the
+ * string parameter at the end.
+ * @param parent Parent composite
+ * @param style SWT style flags for overall composite widget. Typically just pass SWT.NULL
+ * @param defaultConnection the system connection to preselect. Pass null to preselect first connection.
+ * @param showNewButton true if a New... button is to be included in this composite
+ * @param subsystemFactoryCategory. Only connections with subsystems owned by factories of this category are returned.
+ */
+ public SystemHostCombo(Composite parent, int style, IHost defaultConnection, boolean showNewButton, String ssFactoryCategory)
+ {
+ this(parent, style, defaultConnection, showNewButton, ssFactoryCategory, true);
+ }
+
+ /**
+ * Constructor for SystemConnectionCombo when there is a subsystem factory category to restrict the list to.
+ * To avoid collision with the constructor that takes a string for the system type, this one places the
+ * string parameter at the end.
+ * @param parent Parent composite
+ * @param style SWT style flags for overall composite widget. Typically just pass SWT.NULL
+ * @param defaultConnection the system connection to preselect. Pass null to preselect first connection.
+ * @param showNewButton true if a New... button is to be included in this composite
+ * @param subsystemFactoryCategory. Only connections with subsystems owned by factories of this category are returned.
+ * @param showLabel. true if a 'Connection' label is to be included in this composite
+ */
+ public SystemHostCombo(Composite parent, int style, IHost defaultConnection, boolean showNewButton, String ssFactoryCategory, boolean showLabel)
+ {
+ super(parent, style);
+ if (showNewButton) // this is expensive, so only need to do this if New is enabled
+ {
+ ISubSystemConfigurationProxy[] ssfProxies = SystemPlugin.getTheSystemRegistry().getSubSystemConfigurationProxiesByCategory(ssFactoryCategory);
+ Vector vTypes = new Vector();
+ for (int idx=0; idx
+ * Set the cursor to the wait cursor (true) or restores it to the normal cursor (false).
+ */
+ protected void setBusyCursor(boolean setBusy)
+ {
+ if (setBusy)
+ {
+ // Set the busy cursor to all shells.
+ Display d = getShell().getDisplay();
+ waitCursor = new Cursor(d, SWT.CURSOR_WAIT);
+ org.eclipse.rse.ui.dialogs.SystemPromptDialog.setDisplayCursor(getShell(), waitCursor);
+ }
+ else
+ {
+ org.eclipse.rse.ui.dialogs.SystemPromptDialog.setDisplayCursor(getShell(), null);
+ if (waitCursor != null)
+ waitCursor.dispose();
+ waitCursor = null;
+ }
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemPortPrompt.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemPortPrompt.java
new file mode 100644
index 00000000000..8cbb3fd0d89
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemPortPrompt.java
@@ -0,0 +1,366 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.widgets;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.SystemPropertyResources;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.SystemWidgetHelpers;
+import org.eclipse.rse.ui.messages.ISystemMessageLine;
+import org.eclipse.rse.ui.validators.ISystemValidator;
+import org.eclipse.rse.ui.validators.SystemNumericVerifyListener;
+import org.eclipse.rse.ui.validators.ValidatorPortInput;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+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.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+
+
+/**
+ * A composite encapsulating the GUI widgets for prompting for a port. Used in the core SubSystem property
+ * page but also be instantiated and used anywhere.
+ */
+public class SystemPortPrompt
+ //extends Composite
+ implements SelectionListener
+{
+
+ private Composite composite_prompts;
+ private Label labelPortPrompt, labelPort;
+ private InheritableEntryField textPort;
+ protected SystemMessage errorMessage;
+
+ protected boolean portEditable=true;
+ protected boolean portApplicable=true;
+ protected int existingPortValue;
+ // validators
+ protected ISystemValidator portValidator;
+ // Inputs from caller
+ protected ISystemMessageLine msgLine;
+
+ /**
+ * Constructor when you want a new composite to hold the child controls
+ */
+ public SystemPortPrompt(Composite parent, int style, ISystemMessageLine msgLine,
+ boolean wantLabel, boolean isPortEditable,
+ int existingPortValue, ISystemValidator portValidator)
+ {
+ //super(parent, style);
+ //composite_prompts = this;
+ composite_prompts = new Composite(parent, style);
+ GridLayout gridLayout = new GridLayout();
+ gridLayout.numColumns = wantLabel ? 2 : 1;
+ gridLayout.marginHeight = 0;
+ gridLayout.marginWidth = 0;
+ composite_prompts.setLayout(gridLayout);
+ GridData gridData = new GridData();
+ gridData.horizontalAlignment = GridData.FILL;
+ gridData.grabExcessHorizontalSpace = true;
+ gridData.grabExcessVerticalSpace = false;
+ composite_prompts.setLayoutData(gridData);
+
+ init(composite_prompts, msgLine, wantLabel, isPortEditable, existingPortValue, portValidator);
+
+ composite_prompts.pack();
+ }
+ /**
+ * Constructor when you have an existing composite to hold the child controls
+ */
+ public SystemPortPrompt(Composite composite_prompts, ISystemMessageLine msgLine,
+ boolean wantLabel, boolean isPortEditable,
+ int existingPortValue, ISystemValidator portValidator)
+ {
+ this.composite_prompts = composite_prompts;
+
+ init(composite_prompts, msgLine, wantLabel, isPortEditable, existingPortValue, portValidator);
+ }
+
+ /**
+ * Get user-entered Port number.
+ */
+ public int getPort()
+ {
+ if (isEditable())
+ {
+ String port = textPort.getLocalText(); // will be "" if !textPort.getIsLocal(), which results in wiping out local override
+ Integer portInteger = null;
+ if (textPort.isLocal() && (port.length()>0))
+ portInteger = new Integer(port);
+ else
+ portInteger = new Integer(0);
+ return portInteger.intValue();
+ }
+ else
+ return existingPortValue;
+ }
+ /**
+ * Return user-enter Port number as a string
+ */
+ public String getPortString()
+ {
+ return internalGetPort();
+ }
+
+ /**
+ * Return true if port is user-editable
+ */
+ public boolean isEditable()
+ {
+ return (portEditable && portApplicable);
+ }
+
+ /**
+ * Return true if current port value is without error
+ */
+ public boolean isComplete()
+ {
+ if (!isEditable())
+ return true;
+ else
+ return ((errorMessage==null) && (internalGetPort().length()>0));
+ }
+
+ /**
+ * Set the initial port value
+ */
+ public void setPort(int port)
+ {
+ // port
+ if (portEditable || portApplicable)
+ {
+ String localPort = null;
+
+ localPort = "" + port;
+ int iPort = port;
+ if (!portEditable) // applicable but not editable
+ labelPort.setText(localPort);
+ else // editable
+ {
+ textPort.setLocalText(localPort);
+ textPort.setInheritedText("0 "+SystemPropertyResources.RESID_PORT_DYNAMICSELECT);
+ textPort.setLocal(iPort != 0);
+ }
+ }
+ }
+
+ /**
+ * Set the focus
+ */
+ public boolean setFocus()
+ {
+ if (textPort != null)
+ {
+ textPort.getTextField().setFocus();
+ return true;
+ }
+ else
+ return composite_prompts.setFocus();
+ }
+
+ /**
+ * Reset to original value
+ */
+ public void setDefault()
+ {
+ setPort(existingPortValue);
+ }
+
+ /**
+ * Return the entry field or label for the port prompt
+ */
+ public Control getPortField()
+ {
+ if (textPort != null)
+ return textPort.getTextField();
+ else
+ return labelPort;
+ }
+
+ /**
+ * Validate port value per keystroke
+ */
+ public SystemMessage validatePortInput()
+ {
+ boolean wasInError = (errorMessage != null);
+ errorMessage= null;
+ if (textPort!=null)
+ {
+ if (!textPort.isLocal())
+ {
+ if (wasInError)
+ clearErrorMessage();
+ return null;
+ }
+ if (portValidator != null)
+ errorMessage= portValidator.validate(textPort.getText().trim());
+ else if (internalGetPort().equals(""))
+ errorMessage = SystemPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_USERID_EMPTY);
+ }
+ if (errorMessage == null)
+ {
+ if (wasInError)
+ clearErrorMessage();
+ }
+ else
+ setErrorMessage(errorMessage);
+ //setPageComplete();
+ return errorMessage;
+ }
+
+ // -------------------
+ // INTERNAL METHODS...
+ // -------------------
+ /**
+ * Initialize vars, create and init prompts
+ */
+ protected void init(Composite composite_prompts, ISystemMessageLine msgLine,
+ boolean wantLabel, boolean isPortEditable,
+ int existingPortValue, ISystemValidator portValidator)
+ {
+ this.msgLine = msgLine;
+ this.portEditable = isPortEditable;
+ this.existingPortValue = existingPortValue;
+ if (portValidator == null)
+ portValidator = new ValidatorPortInput();
+ this.portValidator = portValidator;
+
+ createPortPrompt(composite_prompts, wantLabel);
+ setPort(existingPortValue);
+
+ if (textPort != null)
+ {
+ textPort.addModifyListener(
+ new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ //System.out.println("in modify text '"+internalGetPort()+"'");
+ validatePortInput();
+ }
+ });
+
+ textPort.getTextField().addVerifyListener(new SystemNumericVerifyListener());
+ //textPort.addSelectionListener(this); Removed for defect 44132
+ }
+ }
+
+ /**
+ * Return user-entered Port number.
+ */
+ protected String internalGetPort()
+ {
+ if (textPort != null)
+ return textPort.getText().trim();
+ else
+ return labelPort.getText();
+ }
+
+ /**
+ * Create GUI widgets
+ */
+ protected void createPortPrompt(Composite composite_prompts, boolean wantLabel)
+ {
+ // Port prompt
+ String portRange = " (1-" + ValidatorPortInput.MAXIMUM_PORT_NUMBER + ")";
+ if (wantLabel) {
+ String labelText = SystemWidgetHelpers.appendColon(SystemResources.RESID_SUBSYSTEM_PORT_LABEL + portRange);
+ labelPortPrompt = SystemWidgetHelpers.createLabel(composite_prompts, labelText);
+ }
+ portApplicable = isPortApplicable();
+ portEditable = isPortEditable();
+ if (isEditable())
+ {
+ textPort = SystemWidgetHelpers.createInheritableTextField(
+ composite_prompts,SystemResources.RESID_SUBSYSTEM_PORT_INHERITBUTTON_TIP,SystemResources.RESID_SUBSYSTEM_PORT_TIP);
+ textPort.setFocus();
+ }
+ else
+ {
+ String labelValue = " ";
+ if (!portApplicable)
+ labelValue = getTranslatedNotApplicable();
+ labelPort = SystemWidgetHelpers.createLabel(composite_prompts, labelValue);
+ }
+ }
+
+ /**
+ * Return true if the port is applicable.
+ * For this to be false, the caller must state the port is not editable,
+ * and the port value must be null or Integer(-1).
+ */
+ protected boolean isPortApplicable()
+ {
+ if (!isPortEditable() && (existingPortValue==-1))
+ return false;
+ else
+ return true;
+ }
+ /**
+ * Return true if the port is editable for this subsystem
+ */
+ protected boolean isPortEditable()
+ {
+ return portEditable;
+ }
+
+ /**
+ * Return "Not applicable" translated
+ */
+ private String getTranslatedNotApplicable()
+ {
+ return SystemPropertyResources.RESID_TERM_NOTAPPLICABLE;
+ }
+
+ protected void setErrorMessage(SystemMessage msg)
+ {
+ if (msgLine != null)
+ msgLine.setErrorMessage(msg);
+ }
+ protected void clearErrorMessage()
+ {
+ if (msgLine != null)
+ msgLine.clearErrorMessage();
+ }
+
+
+ // SELECTIONLISTENER...
+ public void widgetDefaultSelected(SelectionEvent event)
+ {
+ }
+ public void widgetSelected(SelectionEvent event)
+ {
+ //System.out.println("Inside widgetSelected. textPort.isLocal(): " + textPort.isLocal());
+ if (textPort.isLocal()) // from local to non-local
+ {
+ /* I don't know why I did this! Phil. Removed for defect 44132
+ if (errorMessage != null)
+ {
+ errorMessage = null;
+ clearErrorMessage();
+ } */
+ }
+ else
+ {
+ //validatePortInput(); doesn't work because it is called before the toggle
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemSelectConnectionForm.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemSelectConnectionForm.java
new file mode 100644
index 00000000000..f6e2fc43e2b
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemSelectConnectionForm.java
@@ -0,0 +1,508 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.widgets;
+import java.util.Iterator;
+import java.util.Vector;
+
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.rse.model.IHost;
+import org.eclipse.rse.ui.SystemBaseForm;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.SystemWidgetHelpers;
+import org.eclipse.rse.ui.messages.ISystemMessageLine;
+import org.eclipse.rse.ui.view.SystemPropertySheetForm;
+import org.eclipse.rse.ui.view.SystemViewConnectionSelectionInputProvider;
+import org.eclipse.rse.ui.view.SystemViewForm;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+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.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+
+
+/**
+ * A reusable form for prompting for a connection. Unlike {@link org.eclipse.rse.ui.widgets.SystemHostCombo},
+ * this form uses a list box to show the available connections.
+ *
+ *
+ *
+ *
+ *
+ *
+ */
+public class SystemSelectConnectionForm extends SystemBaseForm
+ implements ISelectionChangedListener
+{
+ protected static final int PROMPT_WIDTH = 200; // The maximum width of the dialog's prompt, in pixels.
+
+ // GUI widgets
+ protected Label verbageLabel, spacer1, spacer2;
+ protected Text nameEntryValue;
+ protected SystemViewForm tree;
+ protected SystemPropertySheetForm ps;
+ //protected ISystemMessageLine msgLine;
+ protected Composite outerParent, ps_composite;
+ // inputs
+ protected String verbage = null;
+ protected String[] systemTypes = null;
+ protected IHost defaultConn;
+ protected boolean allowNew = true;
+ protected boolean multipleSelectionMode;
+ protected boolean showPropertySheet = false;
+ protected Vector listeners = new Vector();
+
+ // outputs
+ protected IHost[] outputConnections = null;
+ protected IHost outputConnection = null;
+ // state
+ //protected ResourceBundle rb;
+ protected boolean initDone;
+ protected boolean contentsCreated;
+
+ //protected String errorMessage;
+ //protected Object caller;
+ //protected boolean callerInstanceOfWizardPage, callerInstanceOfSystemPromptDialog;
+ protected int autoExpandDepth = 0;
+
+ protected Object previousSelection = null;
+
+ /**
+ * Constructor
+ * @param shell The shell hosting this form
+ * @param msgLine A GUI widget capable of writing error messages to.
+ *
+ * @see #setShowNewConnectionPrompt(boolean)
+ * @see #setSystemTypes(String[])
+ */
+ public SystemSelectConnectionForm(Shell shell, ISystemMessageLine msgLine)
+ {
+ super(shell, msgLine);
+ //this.caller = caller;
+ //callerInstanceOfWizardPage = (caller instanceof WizardPage);
+ //callerInstanceOfSystemPromptDialog = (caller instanceof SystemPromptDialog);
+
+ // set default GUI
+ verbage = SystemResources.RESID_SELECTCONNECTION_VERBAGE;
+ }
+
+ // ---------------------------------
+ // INPUT OR CONFIGURATION METHODS...
+ // ---------------------------------
+ /**
+ * Set the connection to default the selection to
+ */
+ public void setDefaultConnection(IHost conn)
+ {
+ defaultConn = conn;
+ }
+
+ /**
+ * Set to true if we are to allow users to create a new connection. Default is true.
+ */
+ public void setShowNewConnectionPrompt(boolean show)
+ {
+ allowNew = show;
+ }
+ /**
+ * Restrict to certain system types
+ * @param systemTypes the system types to restrict what connections are shown and what types of connections
+ * the user can create
+ * @see org.eclipse.rse.core.ISystemTypes
+ */
+ public void setSystemTypes(String[] systemTypes)
+ {
+ this.systemTypes = systemTypes;
+ }
+ /**
+ * Restrict to one system type
+ * @param systemType the system type to restrict what connections are shown and what types of connections
+ * the user can create
+ * @see org.eclipse.rse.core.ISystemTypes
+ */
+ public void setSystemType(String systemType)
+ {
+ systemTypes = new String[1];
+ systemTypes[0] = systemType;
+ }
+ /**
+ * Set the message shown as the text at the top of the form. Default is "Select a connection"
+ */
+ public void setMessage(String message)
+ {
+ this.verbage = message;
+ if (verbageLabel != null)
+ verbageLabel.setText(message);
+ }
+ /**
+ * Show the property sheet on the right hand side, to show the properties of the
+ * selected connection.
+ *
+ *
+ */
+ public AbstractSystemNewConnectionWizardPage(IWizard wizard, ISubSystemConfiguration parentFactory, String pageDescription)
+ {
+ super(wizard, parentFactory.getId(), parentFactory.getName(), pageDescription);
+ this.parentFactory = parentFactory;
+ }
+ /**
+ * Constructor that defaults:
+ *
+ *
+ */
+ public AbstractSystemNewConnectionWizardPage(IWizard wizard, ISubSystemConfiguration parentFactory)
+ {
+ super(wizard, parentFactory.getId(), parentFactory.getName(), SystemResources.RESID_NEWCONN_SUBSYSTEMPAGE_DESCRIPTION);
+ this.parentFactory = parentFactory;
+ }
+
+ /**
+ * Return the subsystem factory that supplied this page
+ */
+ public ISubSystemConfiguration getSubSystemFactory()
+ {
+ return parentFactory;
+ }
+
+ /**
+ * @see AbstractSystemWizardPage#getInitialFocusControl()
+ */
+ protected Control getInitialFocusControl()
+ {
+ return null;
+ }
+
+ /**
+ * @see AbstractSystemWizardPage#createContents(Composite)
+ */
+ public abstract Control createContents(Composite parent);
+
+ /**
+ * @see ISystemWizardPage#performFinish()
+ */
+ public boolean performFinish()
+ {
+ return true;
+ }
+
+ /**
+ * Get the parent wizard typed as the SystemNewConnectionWizard
+ */
+ public SystemNewConnectionWizard getNewConnectionWizard()
+ {
+ return (SystemNewConnectionWizard)getWizard();
+ }
+
+ /**
+ * Get the main page of SystemNewConnectionWizard, which contains all user enter connection attributes
+ */
+ public ISystemNewConnectionWizardMainPage getMainPage()
+ {
+ SystemNewConnectionWizard ourWizard = getNewConnectionWizard();
+ if (ourWizard != null)
+ return ourWizard.getMainPage();
+ else
+ return null;
+ }
+
+ /**
+ * Get the SystemConnectionForm of the main page of SystemNewConnectionWizard, which
+ * contains all user enter connection attributes
+ */
+ public SystemConnectionForm getMainPageForm()
+ {
+ SystemNewConnectionWizard ourWizard = getNewConnectionWizard();
+ if (ourWizard != null)
+ return ourWizard.getMainPageForm();
+ else
+ return null;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/AbstractSystemWizard.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/AbstractSystemWizard.java
new file mode 100644
index 00000000000..195d65455ab
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/AbstractSystemWizard.java
@@ -0,0 +1,454 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.wizards;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.dialogs.SystemWizardDialog;
+import org.eclipse.rse.ui.view.ISystemTree;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IWorkbench;
+
+
+/**
+ * Base class for all RSE wizards. This class is more beneficial when using in conjunction with
+ * {@link org.eclipse.rse.ui.wizards.AbstractSystemWizardPage}, and
+ * {@link org.eclipse.rse.ui.actions.SystemBaseWizardAction}.
+ *
+ *
+ *
+ *
+ *
+ * @see org.eclipse.rse.ui.wizards.AbstractSystemWizardPage
+ * @see org.eclipse.rse.ui.dialogs.SystemWizardDialog
+ * @see org.eclipse.rse.ui.actions.SystemBaseWizardAction
+ */
+public abstract class AbstractSystemWizard
+ extends Wizard implements ISystemWizard
+{
+ protected boolean finishPressed = true; // most accurate guess
+ protected boolean cancelled = false;
+ protected Object input = null;
+ protected Object output = null;
+ protected IStructuredSelection selection = null;
+ protected int minPageWidth, minPageHeight;
+ protected String helpId;
+ protected Viewer viewer = null;
+ protected String pageTitle;
+ protected SystemWizardDialog owningDialog;
+ private Cursor waitCursor;
+
+ /**
+ * Default constructor.
+ *
+ * @see #setWizardTitle(String)
+ * @see #setWizardImage(ImageDescriptor)
+ * @see #setWizardPageTitle(String)
+ */
+ public AbstractSystemWizard()
+ {
+ super();
+
+ }
+
+ /**
+ * Constructor when wizard title is known.
+ * Alternatively, you can call {@link #setWizardTitle(String)}
+ *
+ * @see #setWizardImage(ImageDescriptor)
+ * @see #setWizardPageTitle(String)
+ */
+ public AbstractSystemWizard(String title)
+ {
+ super();
+ setWindowTitle(title);
+ }
+
+ /**
+ * Constructor when you both a title and an image for this wizard.
+ * Alternatively, you can call {@link #setWizardTitle(String)} or {@link #setWizardImage(ImageDescriptor)}
+ *
+ * @see #setWizardPageTitle(String)
+ */
+ public AbstractSystemWizard(String title, ImageDescriptor wizardImage)
+ {
+ super();
+ setWindowTitle(title);
+ setDefaultPageImageDescriptor(wizardImage);
+ }
+
+ /**
+ * Called from {@link org.eclipse.rse.ui.dialogs.SystemWizardDialog} when it is used as the hosting dialog
+ */
+ public void setSystemWizardDialog(SystemWizardDialog dlg)
+ {
+ this.owningDialog = dlg;
+ }
+ /**
+ * Return the result of {@link #setSystemWizardDialog(SystemWizardDialog)}
+ */
+ public SystemWizardDialog getSystemWizardDialog()
+ {
+ return owningDialog;
+ }
+ /**
+ * Exposes this nice new 2.0 capability to the public.
+ * Only does anything if being hosted by SystemWizardDialog.
+ */
+ public void updateSize()
+ {
+ if (owningDialog != null)
+ owningDialog.updateSize(getContainer().getCurrentPage());
+ }
+ /**
+ * Set the wizard title. Using this makes it possible to avoid subclassing.
+ * Typically the wizard title is the same for all pages... eg "New"
+ */
+ public void setWizardTitle(String title)
+ {
+ setWindowTitle(title);
+ }
+ /**
+ * Set the wizard page title. Using this makes it possible to avoid subclassing.
+ * The page title goes below the wizard title, and can be unique per page. However,
+ * typically the wizard page title is the same for all pages... eg "Filter".
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * In this approach, only errors in the current field in focus are caught, and errors in other fields are not caught until Finish is pressed.
+ *
+ * In this approach, which is more rigorous, the error checking is always complete for the whole page, so Finish theoretically will never catch an
+ * error, and the page enablement is always completely accurate.
+ *
+ * For setting the overall help for the wizard page.
+ *
+ * For setting control-specific help for a control on the wizard page.
+ *
+ * For explicitly setting input object. Automatically propogated by the parent wizard.
+ */
+ public void setInputObject(Object inputObject)
+ {
+ this.input = inputObject;
+ }
+
+ // ------------------------
+ // GETTER METHODS...
+ // ------------------------
+ /**
+ * Getter method.
+ * For explicitly getting input object.
+ */
+ public Object getInputObject()
+ {
+ return input;
+ }
+ /**
+ * Getter method.
+ * Return the help Id as set in {@link #setHelp(String)}
+ */
+ public String getHelpContextId()
+ {
+ return helpId;
+ }
+ /**
+ * Getter method.
+ * Return this page's message line so it can be passed to re-usable widgets that need it
+ */
+ public ISystemMessageLine getMessageLine()
+ {
+ //return msgLine;
+ return this;
+ }
+
+ // ----------------
+ // ABSTRACT METHODS
+ // ----------------
+ /**
+ * Abstract method.
+ * Create the page contents here.
+ *
+ * Return the Control to be given initial focus.
+ *
+ * Perform error checking of the page contents, returning true only if there are no errors.
+ *
+ * Creates the wizard's UI component.
+ * We set mnemonics. Child classes should NOT USE THIS.
+ * Child classes should override {@link #createContents(Composite)}, which this calls.
+ */
+ public void createControl(Composite parent)
+ {
+// dwd parentComposite = parent;
+ Composite myComposite = new Composite(parent, SWT.NONE);
+ myComposite.setLayout(new GridLayout(1, false));
+ GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_BEGINNING, true, false);
+ myComposite.setLayoutData(gd);
+ parentComposite = myComposite;
+ Control c = createContents(myComposite);
+ if (c instanceof Composite)
+ {
+ applyMnemonics((Composite)c);
+ parentComposite = (Composite)c;
+ if (helpId != null)
+ SystemWidgetHelpers.setHelp(parentComposite, helpId);
+ // SystemWidgetHelpers.setCompositeHelp((Composite)c, helpId, helpIdPerControl);
+ }
+ else if (c instanceof Button)
+ {
+ Mnemonics ms = new Mnemonics();
+ ms.setMnemonic((Button)c);
+ }
+// dwd configureMessageLine();
+ msgLine = new SystemMessageLine(myComposite);
+ msgLine.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
+ if (pendingMessage!=null)
+ setMessage(pendingMessage);
+ if (pendingErrorMessage!=null)
+ setErrorMessage(pendingErrorMessage);
+// dwd setControl(c);
+ setControl(myComposite);
+ }
+
+ /**
+ * Apply mnemonic to the content composite.
+ * @param c the composite.
+ */
+ protected void applyMnemonics(Composite c) {
+ SystemWidgetHelpers.setWizardPageMnemonics(c);
+ }
+
+ /**
+ * Parent override.
+ * We intercept to give the initial-focus-control focus.
+ */
+ public void setVisible(boolean visible)
+ {
+ super.setVisible(visible);
+ if (visible)
+ {
+ Control c = getInitialFocusControl();
+ if (c != null)
+ c.setFocus();
+ }
+ }
+
+ // -----------------------------
+ // ISystemMessageLine methods...
+ // -----------------------------
+
+ /**
+ * ISystemMessageLine method.
+ * Clears the currently displayed error message and redisplayes
+ * the message which was active before the error message was set.
+ */
+ public void clearErrorMessage()
+ {
+ if (msgLine!=null)
+ msgLine.clearErrorMessage();
+ }
+
+ /**
+ * ISystemMessageLine method.
+ * Clears the currently displayed message.
+ */
+ public void clearMessage()
+ {
+ if (msgLine!=null)
+ msgLine.clearMessage();
+ }
+
+ /**
+ * ISystemMessageLine method.
+ * Get the currently displayed error text.
+ * @return The error message. If no error message is displayed null
is returned.
+ */
+ public SystemMessage getSystemErrorMessage()
+ {
+ if (msgLine!=null)
+ return msgLine.getSystemErrorMessage();
+ else
+ return null;
+ }
+
+ /**
+ * ISystemMessageLine method.
+ * Display the given error message. A currently displayed message
+ * is saved and will be redisplayed when the error message is cleared.
+ */
+ public void setErrorMessage(SystemMessage message)
+ {
+ if (msgLine!=null)
+ {
+ if (message != null)
+ msgLine.setErrorMessage(message);
+ else
+ msgLine.clearErrorMessage();
+ }
+ else // not configured yet
+ pendingErrorMessage = message;
+ }
+ /**
+ * ISystemMessageLine method.
+ * Convenience method to set an error message from an exception
+ */
+ public void setErrorMessage(Throwable exc)
+ {
+ if (msgLine != null)
+ msgLine.setErrorMessage(exc);
+ else
+ {
+ SystemMessage msg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_ERROR_UNEXPECTED);
+ msg.makeSubstitution(exc);
+ pendingErrorMessage = msg;
+ }
+ }
+ /**
+ * ISystemMessageLine method.
+ * Display the given error message. A currently displayed message
+ * is saved and will be redisplayed when the error message is cleared.
+ */
+ public void setErrorMessage(String message)
+ {
+ if (msgLine != null)
+ msgLine.setErrorMessage(message);
+// super.setErrorMessage(message);
+// if (msgLine != null)
+// ((SystemDialogPageMessageLine)msgLine).internalSetErrorMessage(message);
+ }
+
+ /**
+ * ISystemMessageLine method.
+ * If the message line currently displays an error,
+ * the message is stored and will be shown after a call to clearErrorMessage
+ */
+ public void setMessage(SystemMessage message)
+ {
+ if (msgLine!=null)
+ msgLine.setMessage(message);
+ else // not configured yet
+ pendingMessage = message;
+ }
+ /**
+ * ISystemMessageLine method.
+ * Set the non-error message text. If the message line currently displays an error,
+ * the message is stored and will be shown after a call to clearErrorMessage
+ */
+ public void setMessage(String message)
+ {
+ if (msgLine!=null)
+ msgLine.setMessage(message);
+// super.setMessage(message);
+// if (msgLine!=null)
+// ((SystemDialogPageMessageLine)msgLine).internalSetMessage(message);
+ }
+
+ // ---------------
+ // HELPER METHODS
+ // ---------------
+ /**
+ * Set the cursor to the wait cursor (true) or restores it to the normal cursor (false).
+ */
+ public void setBusyCursor(boolean setBusy)
+ {
+ if (setBusy)
+ {
+ // Set the busy cursor to all shells.
+ Display d = getShell().getDisplay();
+ waitCursor = new Cursor(d, SWT.CURSOR_WAIT);
+ org.eclipse.rse.ui.dialogs.SystemPromptDialog.setDisplayCursor(getShell(), waitCursor);
+ }
+ else
+ {
+ org.eclipse.rse.ui.dialogs.SystemPromptDialog.setDisplayCursor(getShell(), null);
+ if (waitCursor != null)
+ waitCursor.dispose();
+ waitCursor = null;
+ }
+ }
+
+ /**
+ * Helper method
+ * Add a separator line. This is a physically visible line.
+ */
+ protected void addSeparatorLine(Composite parent, int nbrColumns)
+ {
+ Label separator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
+ GridData data = new GridData();
+ data.horizontalSpan = nbrColumns;
+ data.horizontalAlignment = GridData.FILL;
+ separator.setLayoutData(data);
+ }
+ /**
+ * Helper method
+ * Add a spacer line
+ */
+ protected void addFillerLine(Composite parent, int nbrColumns)
+ {
+ Label filler = new Label(parent, SWT.LEFT);
+ GridData data = new GridData();
+ data.horizontalSpan = nbrColumns;
+ data.horizontalAlignment = GridData.FILL;
+ filler.setLayoutData(data);
+ }
+ /**
+ * Helper method
+ * Add a spacer line that grows in height to absorb extra space
+ */
+ protected void addGrowableFillerLine(Composite parent, int nbrColumns)
+ {
+ Label filler = new Label(parent, SWT.LEFT);
+ GridData data = new GridData();
+ data.horizontalSpan = nbrColumns;
+ data.horizontalAlignment = GridData.FILL;
+ data.verticalAlignment = GridData.FILL;
+ data.grabExcessVerticalSpace = true;
+ filler.setLayoutData(data);
+ }
+
+ // ----------------
+ // INTERNAL METHODS
+ // ----------------
+ /**
+ * Internal method
+ * Configure the message line
+ */
+// private void configureMessageLine()
+// {
+// msgLine = SystemDialogPageMessageLine.createWizardMsgLine(this);
+// if (msgLine!=null)
+// {
+// if (pendingMessage!=null)
+// setMessage(pendingMessage);
+// if (pendingErrorMessage!=null)
+// setErrorMessage(pendingErrorMessage);
+// }
+// }
+
+ /**
+ * Internal method
+ * On Finish, when an error is detected, position to the given
+ * control. The trick though is to give this page focus if it
+ * doesn't have it.
+ */
+ protected void setFocus(Control control)
+ {
+ if (this != getContainer().getCurrentPage())
+ getContainer().showPage(this);
+ if ((control!=null) && !control.isDisposed())
+ control.setFocus();
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/ISubSystemPropertiesWizardPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/ISubSystemPropertiesWizardPage.java
new file mode 100644
index 00000000000..8baf5043f0f
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/ISubSystemPropertiesWizardPage.java
@@ -0,0 +1,24 @@
+/********************************************************************************
+ * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.wizards;
+
+import org.eclipse.rse.core.subsystems.ISubSystem;
+
+public interface ISubSystemPropertiesWizardPage
+{
+ public boolean applyValues(ISubSystem ss);
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/ISystemNewConnectionWizardMainPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/ISystemNewConnectionWizardMainPage.java
new file mode 100644
index 00000000000..f447c51c9c9
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/ISystemNewConnectionWizardMainPage.java
@@ -0,0 +1,84 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.wizards;
+import org.eclipse.rse.model.IHost;
+import org.eclipse.rse.ui.validators.ISystemValidator;
+
+
+
+
+/**
+ * Interface for new Connection (ie Definition) wizard main page classes
+ */
+public interface ISystemNewConnectionWizardMainPage extends ISystemWizardPage
+{
+
+ public String getSystemType();
+ public String getConnectionName();
+ public String getHostName();
+ public String getConnectionDescription();
+ public String getDefaultUserId();
+ public int getDefaultUserIdLocation();
+ public String getProfileName();
+ /**
+ * Call this to restrict the system type that the user is allowed to choose
+ */
+ public void restrictSystemType(String systemType);
+ /**
+ * Call this to restrict the system types that the user is allowed to choose
+ */
+ public void restrictSystemTypes(String[] systemTypes);
+
+ /**
+ * Call this to specify a validator for the connection name. It will be called per keystroke.
+ */
+ public void setConnectionNameValidators(ISystemValidator[] v);
+ /**
+ * Call this to specify a validator for the hostname. It will be called per keystroke.
+ */
+ public void setHostNameValidator(ISystemValidator v);
+ /**
+ * Call this to specify a validator for the userId. It will be called per keystroke.
+ */
+ public void setUserIdValidator(ISystemValidator v);
+ /**
+ * This method allows setting of the initial user Id. Sometimes subsystems
+ * like to have their own default userId preference page option. If so, query
+ * it and set it here by calling this.
+ */
+ public void setUserId(String userId);
+ /**
+ * Preset the connection name
+ */
+ public void setConnectionName(String name);
+ /**
+ * Preset the host name
+ */
+ public void setHostName(String name);
+ /**
+ * Set the profile names to show in the combo
+ */
+ public void setProfileNames(String[] names);
+ /**
+ * Set the profile name to preselect
+ */
+ public void setProfileNamePreSelection(String name);
+ /**
+ * Set the currently selected connection so as to better initialize input fields
+ */
+ public void setCurrentlySelectedConnection(IHost connection);
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/ISystemNewConnectionWizardPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/ISystemNewConnectionWizardPage.java
new file mode 100644
index 00000000000..bdc9a0dddee
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/ISystemNewConnectionWizardPage.java
@@ -0,0 +1,50 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.wizards;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
+
+
+/**
+ * Interface that all subsystem factory supplied pages contributed to the New Connection wizard
+ * must implement.
+ * @see org.eclipse.rse.ui.wizards.AbstractSystemNewConnectionWizardPage
+ * @see org.eclipse.rse.core.subsystems.ISubSystemConfiguration#getNewConnectionWizardPages(IWizard)
+ */
+public interface ISystemNewConnectionWizardPage extends IWizardPage
+{
+
+ /**
+ * This is called when the users presses Finish. All that should be done here is validation
+ * of the input, returning true if all is ok and the finish can proceed.
+ */
+ public boolean performFinish();
+
+ /**
+ * This is called frequently by the framework to decide whether to enable the Finish and
+ * Next buttons.
+ *
+ *
+ */
+
+public class SystemNewProfileWizardMainPage
+ extends AbstractSystemWizardPage
+ implements ISystemMessages,
+ ISystemMessageLine
+{
+
+ private String profileName;
+ private Text textName;
+ private Button makeActiveCB;
+ private boolean makeActive;
+ private SystemMessage errorMessage;
+ protected ISystemValidator nameValidator;
+ private static final String HELPID_PREFIX = SystemPlugin.HELPPREFIX + "wnpr";
+
+ /**
+ * Constructor.
+ */
+ public SystemNewProfileWizardMainPage(Wizard wizard)
+ {
+ super(wizard, "NewProfile",
+ SystemResources.RESID_NEWPROFILE_PAGE1_TITLE,
+ SystemResources.RESID_NEWPROFILE_PAGE1_DESCRIPTION);
+ nameValidator = new ValidatorProfileName(SystemPlugin.getTheSystemRegistry().getAllSystemProfileNamesVector());
+ setHelp(HELPID_PREFIX+"0000");
+ }
+
+ /**
+ * CreateContents is the one method that must be overridden from the parent class.
+ * In this method, we populate an SWT container with widgets and return the container
+ * to the caller (JFace). This is used as the contents of this page.
+ */
+ public Control createContents(Composite parent)
+ {
+ // Inner composite
+ int nbrColumns = 2;
+ Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns);
+
+ // Name
+ textName = SystemWidgetHelpers.createLabeledTextField(
+ composite_prompts, null, SystemResources.RESID_NEWPROFILE_NAME_LABEL, SystemResources.RESID_NEWPROFILE_NAME_TOOLTIP);
+ textName.setTextLimit(ValidatorProfileName.MAX_PROFILENAME_LENGTH); // defect 41816
+ //SystemWidgetHelpers.setHelp(textName, HELPID_PREFIX+"0001", HELPID_PREFIX+"0000");
+ SystemWidgetHelpers.setHelp(textName, HELPID_PREFIX+"0001");
+
+ // Make active
+ makeActiveCB = SystemWidgetHelpers.createCheckBox(
+ composite_prompts, nbrColumns, null, SystemResources.RESID_NEWPROFILE_MAKEACTIVE_LABEL, SystemResources.RESID_NEWPROFILE_MAKEACTIVE_TOOLTIP);
+ makeActiveCB.setSelection(true);
+ //SystemWidgetHelpers.setHelp(makeActiveCB, HELPID_PREFIX+"0002", HELPID_PREFIX+"0000");
+ SystemWidgetHelpers.setHelp(makeActiveCB, HELPID_PREFIX+"0002");
+
+ // Verbage
+ addGrowableFillerLine(composite_prompts, nbrColumns);
+ addSeparatorLine(composite_prompts, nbrColumns);
+ SystemWidgetHelpers.createVerbage(composite_prompts, SystemResources.RESID_NEWPROFILE_VERBAGE, nbrColumns, false, 200);
+
+ textName.addModifyListener(
+ new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ validateNameInput();
+ }
+ }
+ );
+
+ // SET CONTEXT HELP IDS...
+ //SystemWidgetHelpers.setHelp(textName, HELPID_PREFIX + "0001", HELPID_PREFIX + "0000");
+ //SystemWidgetHelpers.setHelp(makeActiveCB, HELPID_PREFIX + "0002", HELPID_PREFIX + "0000");
+
+ return composite_prompts;
+ }
+ /**
+ * Return the Control to be given initial focus.
+ * Override from parent. Return control to be given initial focus.
+ */
+ protected Control getInitialFocusControl()
+ {
+ return textName;
+ }
+
+ /**
+ * This hook method is called whenever the text changes in the input field.
+ * The default implementation delegates the request to an ISystemValidator
object.
+ * If the ISystemValidator
reports an error the error message is displayed
+ * in the Dialog's message line.
+ * @see SystemUserIdPerSystemTypeDialog#setUserIdValidator(ISystemValidator)
+ */
+ protected SystemMessage validateNameInput()
+ {
+ errorMessage= nameValidator.validate(textName.getText());
+ if (errorMessage != null)
+ setErrorMessage(errorMessage);
+ else
+ clearErrorMessage();
+ setPageComplete(errorMessage==null);
+ return errorMessage;
+ }
+
+ /**
+ * Completes processing of the wizard. If this
+ * method returns true, the wizard will close;
+ * otherwise, it will stay active.
+ * This method is an override from the parent Wizard class.
+ *
+ * @return whether the wizard finished successfully
+ */
+ public boolean performFinish()
+ {
+ boolean ok = (validateNameInput()==null);
+ if (ok)
+ {
+ profileName = textName.getText().trim();
+ makeActive = makeActiveCB.getSelection();
+ }
+ return ok;
+ }
+
+ // --------------------------------- //
+ // METHODS FOR EXTRACTING USER DATA ...
+ // --------------------------------- //
+ /**
+ * Return user-entered profile name.
+ * Call this after finish ends successfully.
+ */
+ public String getProfileName()
+ {
+ return profileName;
+ }
+ /**
+ * Return user-entered decision to make the new profile active.
+ * Call this after finish ends successfully.
+ */
+ public boolean getMakeActive()
+ {
+ return makeActive;
+ }
+
+
+ // ISystemMessageLine methods
+// public void clearMessage()
+// {
+// setMessage(null);
+// }
+ //public void clearErrorMessage()
+ //{
+ //setErrorMessage(null);
+ //}
+
+ public Object getLayoutData()
+ {
+ return null;
+ }
+
+ public void setLayoutData(Object gridData)
+ {
+ }
+
+ /**
+ * Return true if the page is complete, so to enable Finish.
+ * Called by wizard framework.
+ */
+ public boolean isPageComplete()
+ {
+ return (textName.getText().trim().length()>0);
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SystemSubSystemsPropertiesWizardPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SystemSubSystemsPropertiesWizardPage.java
new file mode 100644
index 00000000000..06075de05e1
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SystemSubSystemsPropertiesWizardPage.java
@@ -0,0 +1,252 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.ui.wizards;
+
+import java.util.List;
+
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
+import org.eclipse.rse.ui.ISystemVerifyListener;
+import org.eclipse.rse.ui.SystemResources;
+import org.eclipse.rse.ui.SystemWidgetHelpers;
+import org.eclipse.rse.ui.propertypages.ISystemConnectionWizardErrorUpdater;
+import org.eclipse.rse.ui.propertypages.ISystemConnectionWizardPropertyPage;
+import org.eclipse.rse.ui.view.monitor.TabFolderLayout;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CTabFolder;
+import org.eclipse.swt.custom.CTabItem;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.dialogs.PropertyPage;
+
+
+/**
+ * Wizard page that display the property pages for a given subsystem in the
+ * connection
+ *
+ */
+public class SystemSubSystemsPropertiesWizardPage
+ extends AbstractSystemNewConnectionWizardPage
+ implements ISystemVerifyListener, ISubSystemPropertiesWizardPage
+{
+
+ private CTabFolder _folder;
+ private List _propertyPages;
+ private String _lastHostName;
+ /**
+ * Constructor
+ */
+ public SystemSubSystemsPropertiesWizardPage(IWizard wizard, ISubSystemConfiguration parentFactory, List propertyPages)
+ {
+ //super(wizard, parentFactory); todo: use this when we enable port
+ // selection
+ super(
+ wizard,
+ parentFactory,
+ parentFactory.getId(),
+ // removed subsystem append since not correct for some languages
+ parentFactory.getName(),
+ //+ " " + SystemResources.RESID_SUBSYSTEM_TYPE_VALUE),
+ //" SubSystem Properties", //TODO create
+ // message for
+ // this
+ //"Configure properties of this subsystem"
+ SystemResources.RESID_NEWCONN_SUBSYSTEMPAGE_DESCRIPTION
+ );
+ _propertyPages = propertyPages;
+ }
+
+ /**
+ * @see AbstractSystemWizardPage#getInitialFocusControl()
+ */
+ protected Control getInitialFocusControl()
+ {
+ return getControl();
+ }
+
+ /*
+ * Updates wiard property pages with new hostname
+ */
+ protected void hostNameUpdated(String hostName)
+ {
+ if (_folder != null)
+ {
+ for (int i = 0; i < _folder.getItemCount(); i++)
+ {
+ ISystemConnectionWizardPropertyPage page =
+ (ISystemConnectionWizardPropertyPage) _folder.getItem(i).getData();
+ page.setHostname(hostName);
+ }
+ }
+
+ }
+
+ /**
+ * @see AbstractSystemWizardPage#createContents(Composite)
+ */
+ public Control createContents(Composite parent)
+ {
+ int nbrColumns = 2;
+ Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns);
+
+ _folder = new CTabFolder(composite_prompts, SWT.NONE);
+ _folder.setLayout(new TabFolderLayout());
+
+ int numAdded = 0;
+ for (int i = 0; i < _propertyPages.size(); i++)
+ {
+ PropertyPage page = (PropertyPage)_propertyPages.get(i);
+ if (page != null && page instanceof ISystemConnectionWizardPropertyPage)
+ {
+ ISystemConnectionWizardPropertyPage cpage = (ISystemConnectionWizardPropertyPage)page;
+ cpage.setSubSystemFactory(parentFactory);
+
+ CTabItem titem = new CTabItem(_folder, SWT.NULL, numAdded);
+ titem.setData(page);
+ page.createControl(_folder);
+ titem.setText(page.getTitle());
+ try
+ {
+ titem.setControl(page.getControl());
+
+ }
+ catch (Exception e)
+ {
+ // TODO why does the tabfolder hit exception the
+ // first tiem setcontrol is called?
+ }
+
+ //set the hostname for the page in case it's required
+ cpage.setHostname(getMainPage().getHostName());
+ cpage.setSystemType(getMainPage().getSystemType());
+
+ numAdded++;
+ }
+
+ }
+
+
+ if (numAdded == 0)
+ {
+
+ }
+ addVerifyListener();
+
+ return composite_prompts;
+ }
+
+ /**
+ * @see ISystemWizardPage#performFinish()
+ */
+ public boolean performFinish()
+ {
+ return true;
+ }
+
+ public boolean applyValues(ISubSystem ss)
+ {
+ boolean result = true;
+ if (_folder != null)
+ {
+ for (int i = 0; i < _folder.getItemCount() && result; i++)
+ {
+ ISystemConnectionWizardPropertyPage page =
+ (ISystemConnectionWizardPropertyPage) _folder.getItem(i).getData();
+ result = page.applyValues(ss.getConnectorService());
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Return true if the page is complete, so to enable Finish. Called by
+ * wizard framework.
+ */
+ public boolean isPageComplete()
+ {
+ String hostName = getMainPage().getHostName();
+ if (!hostName.equals(_lastHostName))
+ {
+ hostNameUpdated(hostName);
+ _lastHostName = hostName;
+ }
+ boolean result = true;
+ if (_folder != null)
+ {
+ for (int i = 0; i < _folder.getItemCount() && result; i++)
+ {
+ if (_folder.getItem(i).getData() instanceof ISystemConnectionWizardErrorUpdater)
+ {
+ ISystemConnectionWizardErrorUpdater page =
+ (ISystemConnectionWizardErrorUpdater) _folder.getItem(i).getData();
+ result = page.isPageComplete();
+ }
+ }
+ }
+ return result;
+
+ }
+
+ protected void addVerifyListener()
+ {
+ if (_folder != null)
+ {
+ for (int i = 0; i < _folder.getItemCount(); i++)
+ {
+ if (_folder.getItem(i).getData() instanceof ISystemConnectionWizardErrorUpdater)
+ {
+ ISystemConnectionWizardErrorUpdater page =
+ (ISystemConnectionWizardErrorUpdater) _folder.getItem(i).getData();
+ page.addVerifyListener(this);
+ }
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
+ */
+ public void handleVerifyComplete()
+ {
+ boolean complete = isPageComplete();
+ if (!complete)
+ {
+ if (_folder != null)
+ {
+ for (int i = 0; i < _folder.getItemCount(); i++)
+ {
+ if (_folder.getItem(i).getData() instanceof ISystemConnectionWizardErrorUpdater)
+ {
+ ISystemConnectionWizardErrorUpdater page =
+ (ISystemConnectionWizardErrorUpdater) _folder.getItem(i).getData();
+ String error = page.getTheErrorMessage();
+ if (error != null && !error.equals(""))
+ {
+ setErrorMessage(_folder.getItem(i).getText() + ": " + page.getTheErrorMessage());
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ clearErrorMessage();
+ }
+ setPageComplete(complete);
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/about.html b/rse/plugins/org.eclipse.rse.ui/about.html
new file mode 100644
index 00000000000..6f6b96c4c87
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/about.html
@@ -0,0 +1,22 @@
+
+
+
+About This Content
+
+License
+
+
+ *
+ *
+ *
+ * @param filter SystemFilter object to add
+ * @return true if added, false if filter with this aliasname already existed.
+ */
+ public boolean addSystemFilter(ISystemFilter filter);
+ /**
+ * Return Vector of String objects: the names of existing filters in this container.
+ * Needed by name validators for New and Rename actions to verify new name is unique.
+ */
+ public Vector getSystemFilterNames();
+ /**
+ * Return a Vector of the filters contained in this filter container.
+ */
+ public Vector getSystemFiltersVector();
+ /**
+ * Return an array of the filters contained in this filter container.
+ */
+ public ISystemFilter[] getSystemFilters();
+ /**
+ * Return a system filter given its name
+ */
+ public ISystemFilter getSystemFilter(String filterName);
+ /**
+ * Return the parent pool of this container.
+ * If this is itself a pool, returns "this".
+ * Else, for a nested filter, returns the pool that is the ultimate parent of this filter.
+ */
+ public ISystemFilterPool getSystemFilterPool();
+ /**
+ * Return how many filters are defined in this filter container
+ */
+ public int getSystemFilterCount();
+ /**
+ * Removes a given filter from the list.
+ * @param filter SystemFilter object to remove
+ */
+ public void deleteSystemFilter(ISystemFilter filter);
+ /**
+ * Renames a given filter in the list.
+ * @param filter SystemFilter object to rename
+ * @param newName New name to assign it. Assumes unique checking already done.
+ */
+ public void renameSystemFilter(ISystemFilter filter, String newName);
+ /**
+ * Return a given filter's zero-based location
+ */
+ public int getSystemFilterPosition(ISystemFilter filter);
+ /**
+ * Move a given filter to a given zero-based location
+ */
+ public void moveSystemFilter(int pos, ISystemFilter filter);
+ /**
+ * Updates a given filter in the list.
+ * @param filter SystemFilter object to update
+ * @param newName New name to assign it. Assumes unique checking already done.
+ * @param newStrings New strings to assign it. Replaces current strings.
+ */
+ public void updateSystemFilter(ISystemFilter filter, String newName, String[] newStrings);
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterContainerReference.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterContainerReference.java
new file mode 100644
index 00000000000..b5a0b8cdbe3
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterContainerReference.java
@@ -0,0 +1,81 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.filters;
+
+import org.eclipse.rse.core.subsystems.ISubSystem;
+
+/**
+ * Both SystemFilter and SystemFilterPool contain filters, so the
+ * common methods for filters are abstracted out in SystemFilterContainer,
+ * which both classes implement.
+ * Both SystemFilterReference and SystemFilterPoolReference hold references
+ * to SystemFilterContainer objects (either SystemFilter or SystemFilterPool).
+ * There are a couple of methods that are common to both classes, related to
+ * getting an array of references to the filters that are held by the referenced
+ * object.
+ * This interface captures those common methods, and both
+ * SystemFilterReferenceImpl and SystemFilterPoolReferenceImpl
+ * implement this interface and hence these methods.
+ * @see org.eclipse.rse.internal.filters.SystemFilterContainerReferenceCommonMethods
+ */
+public interface ISystemFilterContainerReference
+{
+ /**
+ * Return the object to which we hold a reference. This is either
+ * SystemFilter or SystemFilterPool. Since both implement
+ * SystemFilterContainer, that is what we return.
+ */
+ public ISystemFilterContainer getReferencedSystemFilterContainer();
+ /**
+ * Build and return an array of SystemFilterReference objects.
+ * Each object is created new. There is one for each of the filters
+ * in the reference SystemFilter or SystemFilterPool.
+ * For performance reasons, we will cache this array and only
+ * return a fresh one if something changes in the underlying
+ * filter list.
+ */
+ public ISystemFilterReference[] getSystemFilterReferences(ISubSystem subSystem);
+ /**
+ * Return an existing reference to a given system filter.
+ * If no reference currently exists to this filter, returns null.
+ * @see #getSystemFilterReference(ISystemFilter)
+ */
+ public ISystemFilterReference getExistingSystemFilterReference(ISubSystem subSystem, ISystemFilter filter);
+ /**
+ * Create a single filter refererence to a given filter
+ * If there already is a reference to this filter, it is returned.
+ * If not, a new reference is created and appended to the end of the existing filter reference array.
+ * @see #getExistingSystemFilterReference(ISystemFilter)
+ */
+ public ISystemFilterReference getSystemFilterReference(ISubSystem subSystem, ISystemFilter filter);
+
+ /**
+ * Return the name of the SystemFilter or SystemFilterPool that we reference.
+ * For such objects this is what we show in the GUI.
+ */
+ public String getName();
+
+ /**
+ * Return true if the referenced pool or filter has filters.
+ */
+ public boolean hasFilters();
+
+ /**
+ * Return count of the number of filters in the referenced pool or filter
+ */
+ public int getFilterCount();
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterNamingPolicy.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterNamingPolicy.java
new file mode 100644
index 00000000000..a485a856a0e
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterNamingPolicy.java
@@ -0,0 +1,68 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.filters;
+/**
+ * Allows tool writers to specify the naming standards for the
+ * persistance files and folders involved with filters.
+ *
+ * By default this is represented as a folder on disk, with each filter
+ * stored as a file in that folder.
+ */
+/**
+ * @lastgen interface SystemFilterPool extends SystemPersistableReferencedObject, SystemFilterContainer {}
+ */
+public interface ISystemFilterPool extends ISystemPersistableReferencedObject, ISystemFilterContainer, IRSEModelObject
+{
+ // external methods
+ /**
+ * Return the caller which instantiated the filter pool manager overseeing this filter framework instance
+ */
+ public ISystemFilterPoolManagerProvider getProvider();
+ /**
+ * Set the naming policy used when saving data to disk.
+ * @see org.eclipse.rse.filters.ISystemFilterNamingPolicy
+ */
+ public void setNamingPolicy(ISystemFilterNamingPolicy namingPolicy);
+ /**
+ * Get the naming policy currently used when saving data to disk.
+ * @see org.eclipse.rse.filters.ISystemFilterNamingPolicy
+ */
+ public ISystemFilterNamingPolicy getNamingPolicy();
+ /**
+ * Does this filter support nested filters?
+ */
+ public boolean supportsNestedFilters();
+ /**
+ * Does this support duplicate filter strings? Calls mof-generated isSupportsDuplicateFilterStrings.
+ */
+ public boolean supportsDuplicateFilterStrings();
+ /**
+ * @return The value of the StringsCaseSensitive attribute
+ * Are filter strings in this filter case sensitive?
+ * If not set locally, queries the parent filter pool manager's atttribute.
+ */
+ public boolean isStringsCaseSensitive();
+
+ /**
+ * Set the filter pool manager.
+ */
+ public void setSystemFilterPoolManager(ISystemFilterPoolManager mgr);
+ /**
+ * Return the filter pool manager managing this collection of filter pools and their filters.
+ */
+ public ISystemFilterPoolManager getSystemFilterPoolManager();
+ /**
+ * This is to set transient data that is queryable via getFilterPoolData
+ */
+ public void setSystemFilterPoolData(Object data);
+ /**
+ * Return transient data set via setFilterPoolData.
+ */
+ public Object getSystemFilterPoolData();
+ /**
+ * Clone this filter pools' attributes and filters into another filter pool.
+ * Assumes the core attributes were already set when filter pool was created:
+ *
+ *
+ * Attributes we clone:
+ *
+ *
+ */
+ public void cloneSystemFilterPool(ISystemFilterPool targetPool)
+ throws Exception;
+ /**
+ * Copy a system filter to this or another filter pool.
+ */
+ public ISystemFilter copySystemFilter(ISystemFilterPool targetPool, ISystemFilter oldFilter, String newName)
+ throws Exception;
+ /**
+ * Order filters according to user preferences.
+ *
+ *
+ * This method is called by the SystemFilterPoolManager.
+ */
+ public void setSavePolicy(int policy);
+
+
+ public String getId();
+
+ /**
+ * @generated This field/method will be replaced during code generation
+ * @return The value of the Name attribute
+ */
+ String getName();
+
+
+ /**
+ * @generated This field/method will be replaced during code generation
+ * @param value The new value of the Name attribute
+ */
+ void setName(String value);
+
+ /**
+ * @generated This field/method will be replaced during code generation
+ * @return The value of the Type attribute
+ * Allows tools to have typed filter pools
+ */
+ String getType();
+
+ /**
+ * @generated This field/method will be replaced during code generation
+ * @param value The new value of the Type attribute
+ */
+ void setType(String value);
+
+ /**
+ * @generated This field/method will be replaced during code generation
+ * @return The value of the SupportsNestedFilters attribute
+ */
+ boolean isSupportsNestedFilters();
+
+ /**
+ * @generated This field/method will be replaced during code generation
+ * @param value The new value of the SupportsNestedFilters attribute
+ */
+ void setSupportsNestedFilters(boolean value);
+
+ /**
+ * @generated This field/method will be replaced during code generation
+ * @return The value of the Deletable attribute
+ */
+ boolean isDeletable();
+
+ /**
+ * @generated This field/method will be replaced during code generation
+ * @param value The new value of the Deletable attribute
+ */
+ void setDeletable(boolean value);
+
+ /**
+ * @generated This field/method will be replaced during code generation
+ * @return The value of the Default attribute
+ * Is this a default vendor-supplied pool versus user-created pool
+ */
+ boolean isDefault();
+
+ /**
+ * @generated This field/method will be replaced during code generation
+ * @param value The new value of the Default attribute
+ */
+ void setDefault(boolean value);
+
+ /**
+ * @generated This field/method will be replaced during code generation
+ * @param value The new value of the StringsCaseSensitive attribute
+ */
+ void setStringsCaseSensitive(boolean value);
+
+ /**
+ * @generated This field/method will be replaced during code generation
+ * Unsets the StringsCaseSensitive attribute
+ */
+ void unsetStringsCaseSensitive();
+
+ /**
+ * @generated This field/method will be replaced during code generation
+ * @return true if the StringsCaseSensitive attribute has been set
+ */
+ boolean isSetStringsCaseSensitive();
+
+ /**
+ * @generated This field/method will be replaced during code generation
+ * @return The list of Filters references
+ */
+ java.util.List getFilters();
+
+ /**
+ * @generated This field/method will be replaced during code generation
+ * @return The value of the SupportsDuplicateFilterStrings attribute
+ */
+ boolean isSupportsDuplicateFilterStrings();
+
+ /**
+ * @generated This field/method will be replaced during code generation
+ * @param value The new value of the SupportsDuplicateFilterStrings attribute
+ */
+ void setSupportsDuplicateFilterStrings(boolean value);
+
+ /**
+ * @generated This field/method will be replaced during code generation
+ * @return The value of the Release attribute
+ * In what release was this created? Typically, will be the version and release
+ * times 10, as in 40 or 51.
+ */
+ int getRelease();
+
+ /**
+ * @generated This field/method will be replaced during code generation
+ * @param value The new value of the Release attribute
+ */
+ void setRelease(int value);
+
+ /**
+ * Returns the value of the 'Single Filter String Only' attribute.
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * All the underlying file system work is handled for you.
+ *
+ *
+ *
+ *
+ * @param pool The filter pool object to physically delete
+ */
+ public void deleteSystemFilterPool(ISystemFilterPool pool)
+ throws Exception;
+
+ /**
+ * Delete all existing filter pools. Call this when you are about to delete this manager, say.
+ */
+ public void deleteAllSystemFilterPools();
+
+ /**
+ * Pre-test if we are going to run into any trouble renaming any of the files or folders
+ * used to persist a filter pool.
+ * @returns true if everything seems ok, false if a file/folder is in use.
+ */
+ public boolean preTestRenameFilterPool(ISystemFilterPool pool) throws Exception;
+ /**
+ * Rename a given filter pool. Dependending on the save policy, the
+ * appropriate file or folder on disk will also be renamed.
+ *
+ *
+ * @param pool The filter pool object to physically rename
+ * @param newName The new name to give the pool
+ */
+ public void renameSystemFilterPool(ISystemFilterPool pool, String newName)
+ throws Exception;
+
+ /**
+ * Copy the specified filter pool from this manager to this manager or another manager.
+ *
+ *
+ * @param targetMgr The target manager to copy our filter pool to. Can be this manager, but target pool name must be unique.
+ * @param pool The filter pool to copy
+ * @param newName The new name to give the copied pool
+ * @return the new copy of the copied system filter pool
+ */
+ public ISystemFilterPool copySystemFilterPool(ISystemFilterPoolManager targetMgr, ISystemFilterPool pool, String newName)
+ throws Exception;
+
+ /**
+ * Copy all filter pools from this manager to another manager.
+ *
+ *
+ * @param targetMgr The target manager to copy our filter pools to
+ */
+ public void copySystemFilterPools(ISystemFilterPoolManager targetMgr)
+ throws Exception;
+
+ /**
+ * Move the specified filter pool from this manager to another manager.
+ *
+ *
+ * @param targetMgr The target manager to move our filter pool to. Cannot be this manager.
+ * @param oldPool The filter pool to move
+ * @param newName The new name to give the moved pool
+ * @return the new copy of the moved system filter pool
+ */
+ public ISystemFilterPool moveSystemFilterPool(ISystemFilterPoolManager targetMgr, ISystemFilterPool oldPool, String newName)
+ throws Exception;
+
+ // ---------------------------------
+ // FILTER METHODS
+ // ---------------------------------
+ /**
+ * Creates a new system filter within the given filter container (either a filter pool, or
+ * a filter). This creates the filter, and then saves the filter pool.
+ *
+ *
+ */
+ public boolean deleteSystemFilter(ISystemFilter filter)
+ throws Exception;
+ /**
+ * Renames a filter. This is better than filter.setName(String newName) as it
+ * saves the parent pool to disk.
+ *
+ *
+ */
+ public void renameSystemFilter(ISystemFilter filter, String newName)
+ throws Exception;
+
+ /**
+ * Updates a filter. This is better than doing it directly as it saves it to disk.
+ *
+ *
+ */
+ public void updateSystemFilter(ISystemFilter filter, String newName, String[] strings)
+ throws Exception;
+
+ /**
+ * Sets a filter's type. This is better than calling filter.setType(String) directly as it saves the filter to disk after.
+ *
+ *
+ * @param filters Array of SystemFilters to move.
+ * @param newPosition new zero-based position for the filters
+ */
+ public void moveSystemFilters(ISystemFilter filters[], int delta)
+ throws Exception;
+
+ /**
+ * Order filters according to user preferences.
+ *
+ *
+ */
+ public ISystemFilterString addSystemFilterString(ISystemFilter filter, String newString) throws Exception;
+ /**
+ * Insert a new filter string to the given filter's list, at the given zero-based position
+ *
+ *
+ */
+ public ISystemFilterString addSystemFilterString(ISystemFilter filter, String newString, int position) throws Exception;
+ /**
+ * Remove a filter string from this filter's list, given its SystemFilterString object.
+ *
+ *
+ * @return true if the given string existed and hence was deleted.
+ */
+ public boolean removeSystemFilterString(ISystemFilter filter, ISystemFilterString filterString) throws Exception;
+ /**
+ * Delete a filter string from the given filter's list
+ *
+ *
+ * @return true if given string was found and hence was deleted.
+ */
+ public boolean removeSystemFilterString(ISystemFilter filter, String oldString) throws Exception;
+ /**
+ * Remove a filter string from the given filter's list, given its zero-based position
+ *
+ *
+ * @return true if a string existed at the given position and hence was deleted.
+ */
+ public boolean removeSystemFilterString(ISystemFilter filter, int position) throws Exception;
+ /**
+ * Update a filter string's string vale
+ *
+ *
+ */
+ public void updateSystemFilterString(ISystemFilterString filterString, String newValue) throws Exception;
+ /**
+ * Return the zero-based position of a SystemFilterString object within its filter
+ */
+ public int getSystemFilterStringPosition(ISystemFilterString filterString);
+ /**
+ * Copy a system filter string to a filter in this or another filter pool manager.
+ */
+ public ISystemFilterString copySystemFilterString(ISystemFilter targetFilter, ISystemFilterString oldFilterString)
+ throws Exception;
+ /**
+ * Move a system filter string to a filter in this or another filter pool manager.
+ * Does this by doing a copy operation, then if successful doing a delete operation.
+ */
+ public ISystemFilterString moveSystemFilterString(ISystemFilter targetFilter, ISystemFilterString oldFilterString)
+ throws Exception;
+ /**
+ * Move existing filter strings a given number of positions in the same filter
+ * If the delta is negative, they are all moved up by the given amount. If
+ * positive, they are all moved down by the given amount.
+ *
+ * @param filterStrings Array of SystemFilterStrings to move.
+ * @param newPosition new zero-based position for the filter strings
+ */
+ public void moveSystemFilterStrings(ISystemFilterString filterStrings[], int delta)
+ throws Exception;
+
+ // -----------------------------------
+ // SUSPEND/RESUME CALLBACKS METHODS...
+ // -----------------------------------
+ /**
+ * Suspend callbacks to the provider
+ */
+ public void suspendCallbacks(boolean suspend);
+
+
+
+ /**
+ * @generated This field/method will be replaced during code generation
+ * @return The value of the SupportsNestedFilters attribute
+ */
+ boolean isSupportsNestedFilters();
+
+ /**
+ * @generated This field/method will be replaced during code generation
+ * @param value The new value of the StringsCaseSensitive attribute
+ */
+ void setStringsCaseSensitive(boolean value);
+
+ /**
+ * @generated This field/method will be replaced during code generation
+ * @return The list of Pools references
+ */
+ java.util.List getPools();
+
+ /**
+ * @generated This field/method will be replaced during code generation
+ * @return The value of the SupportsDuplicateFilterStrings attribute
+ */
+ boolean isSupportsDuplicateFilterStrings();
+
+ /**
+ * @generated This field/method will be replaced during code generation
+ * Unsets the SupportsDuplicateFilterStrings attribute
+ */
+ void unsetSupportsDuplicateFilterStrings();
+
+ /**
+ * @generated This field/method will be replaced during code generation
+ * @return true if the SupportsDuplicateFilterStrings attribute has been set
+ */
+ boolean isSetSupportsDuplicateFilterStrings();
+
+ /**
+ * Returns the value of the 'Single Filter String Only' attribute.
+ *
+ *
+ *
+ * @param relatedManagers the filter pool managers that hold filter pools we reference
+ * @param provider the host of this reference manager, so you can later call getProvider
+ * @return A Vector of SystemFilterPoolReferences that were not successfully resolved, or null if all
+ * were resolved.
+ */
+ public Vector resolveReferencesAfterRestore(ISystemFilterPoolManagerProvider relatedPoolMgrProvider,
+ ISystemFilterPoolReferenceManagerProvider provider);
+ /**
+ * Save all the filter pool references to disk.
+ * Use only if not doing your own saving, else override or set save policy to none.
+ */
+ public void save()
+ throws Exception;
+
+ /**
+ * Return the folder that this manager is contained in.
+ */
+ public IFolder getFolder();
+ /**
+ * Reset the folder that this manager is contained in.
+ */
+ public void resetManagerFolder(IFolder newFolder);
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolReferenceManagerProvider.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolReferenceManagerProvider.java
new file mode 100644
index 00000000000..ab53e8b9787
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/filters/ISystemFilterPoolReferenceManagerProvider.java
@@ -0,0 +1,94 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.filters;
+/**
+ * An interface for classes that instantiate SystemFilterPoolReferenceManager objects.
+ * This is the "caller" and as is recorded and recoverable from any object within
+ * the filter reference framework. This enables callers to get back instances of themselves
+ * given any filter reference object. Important when enabling UI actions against user
+ * selected filter reference framework objects
+ *
+ *
+ */
+/**
+ * @lastgen class SystemFilterReferenceImpl extends SystemReferencingObjectImpl implements IAdaptable, SystemFilterReference, SystemReferencingObject {}
+ */
+public class SystemFilterReference extends SystemReferencingObject implements IAdaptable, ISystemFilterReference, ISystemReferencingObject
+{
+ private SystemFilterContainerReferenceCommonMethods containerHelper = null;
+ private ISystemFilterContainerReference parent = null;
+ private ISystemFilter referencedFilter = null;
+ private ISystemFilterStringReference[] referencedFilterStrings = null;
+ protected boolean persistent;
+ protected boolean isStale;
+// protected Object[] cachedContents;
+ protected ISubSystem _subSystem;
+
+ protected HashMap cachedContents;
+
+ public static final boolean PERSISTENT_YES = true;
+ public static final boolean PERSISTENT_NO = false;
+ /**
+ * Constructor. Typically called by MOF.
+ */
+ protected SystemFilterReference()
+ {
+ super();
+ containerHelper = new SystemFilterContainerReferenceCommonMethods(this);
+ persistent = true;
+ isStale = true;
+ cachedContents = new HashMap();
+ }
+ /**
+ * Create a new instance of this class.
+ * @param parent The SystemFilterReference or SystemFilterPoolReference object that we are a child of.
+ * @param filter The master object to be referenced.
+ * @param persistent Whether we should formally register our reference with the target filter or not.
+ */
+ public static ISystemFilterReference createSystemFilterReference(ISubSystem subSystem,
+ ISystemFilterContainerReference parent,
+ ISystemFilter filter,
+ boolean persistent)
+ {
+ //SystemFilterReferenceImpl newRef = (SystemFilterReferenceImpl)SystemFilterImpl.initMOF().createSystemFilterReference();
+ SystemFilterReference newRef = new SystemFilterReference(); // more efficient?
+ newRef.persistent = persistent;
+ newRef.setSubSystem(subSystem);
+ newRef.setParent(parent);
+ newRef.setReferencedFilter(filter);
+ filter.addReference(newRef);
+ return newRef;
+ }
+
+ /**
+ * Gets the subsystem that contains this reference
+ * @return the subsystem
+ */
+ public ISubSystem getSubSystem()
+ {
+ return _subSystem;
+ }
+
+ /**
+ * Sets the subsystem that contains this reference
+ * @param subSystem
+ */
+ public void setSubSystem(ISubSystem subSystem)
+ {
+ _subSystem = subSystem;
+ }
+
+ /**
+ * Return the reference manager which is managing this filter reference
+ * framework object.
+ */
+ public ISystemFilterPoolReferenceManager getFilterPoolReferenceManager()
+ {
+ ISystemFilterPoolReference pool = getParentSystemFilterReferencePool();
+ if (pool != null)
+ return pool.getFilterPoolReferenceManager();
+ else
+ return null;
+ }
+
+ /**
+ * Return the object which instantiated the pool reference manager object.
+ * Makes it easy to get back to the point of origin, given any filter reference
+ * framework object
+ */
+ public ISystemFilterPoolReferenceManagerProvider getProvider()
+ {
+ ISystemFilterPoolReferenceManager mgr = getFilterPoolReferenceManager();
+ if (mgr != null)
+ {
+ ISystemFilterPoolReferenceManagerProvider provider = mgr.getProvider();
+ if (provider == null)
+ {
+ provider = getSubSystem();
+ }
+ return provider;
+ }
+ else
+ return null;
+ }
+
+
+ /**
+ * If this is a reference to a nested filter, the parent is the
+ * reference to the nested filter's parent. Else, it is the
+ * reference to the parent filter pool
+ */
+ public void setParent(ISystemFilterContainerReference parent)
+ {
+ this.parent = parent;
+ }
+ /**
+ * The parent will either by a SystemFilterPoolReference or
+ * a SystemFilterReference.
+ */
+ public ISystemFilterContainerReference getParent()
+ {
+ return parent;
+ }
+
+ /**
+ * Return the filter to which we reference...
+ */
+ public ISystemFilter getReferencedFilter()
+ {
+ return persistent ? (ISystemFilter)super.getReferencedObject() : referencedFilter;
+ }
+ /**
+ * Set the filter to which we reference...
+ */
+ public void setReferencedFilter(ISystemFilter filter)
+ {
+ if (persistent)
+ super.setReferencedObject(filter);
+ else
+ referencedFilter = filter;
+ }
+
+ /**
+ * If this is a reference to a nested filter, the parent is the
+ * reference to the nested filter's parent. Else, it is the
+ * reference to the parent filter pool
+ */
+ public ISystemFilterPoolReference getParentSystemFilterReferencePool()
+ {
+ if (parent instanceof ISystemFilterPoolReference)
+ return (ISystemFilterPoolReference)parent;
+ else
+ return ((ISystemFilterReference)parent).getParentSystemFilterReferencePool();
+ }
+ /**
+ * This is the method required by the IAdaptable interface.
+ * Given an adapter class type, return an object castable to the type, or
+ * null if this is not possible.
+ */
+ public Object getAdapter(Class adapterType)
+ {
+ return Platform.getAdapterManager().getAdapter(this, adapterType);
+ }
+
+ // -------------------------------------------------------------
+ // Methods common with SystemFilterPoolReferenceImpl, and hence
+ // abstracted out into SystemFilterContainerReference...
+ // -------------------------------------------------------------
+ /**
+ * Return the object to which we hold a reference. This is either
+ * SystemFilter or SystemFilterPool. Since both implement
+ * SystemFilterContainer, that is what we return.
+ *
+ *
+ */
+public class SystemFilterSimple extends SystemFilter implements ISystemContainer
+{
+
+ private String name = null;
+ private String type = ISystemFilterConstants.DEFAULT_TYPE;
+ private boolean caseSensitive = false;
+ private boolean promptable = false;
+ private Object parent;
+ // the following are inherited...
+ //private String[] filterStringArray = null;
+ //private SystemFilterString[] filterStringObjectArray = null;
+ //private Vector filterStringVector = null;
+ protected boolean isStale;
+ protected HashMap cachedContents;
+
+ /**
+ * Constructor for SystemFilterSimpleImpl
+ */
+ public SystemFilterSimple(String name)
+ {
+ //super();
+ this.name = name;
+ filterStringVector = new Vector();
+ isStale = true;
+ cachedContents = new HashMap();
+ }
+
+ protected void invalidateCache()
+ {
+ filterStringArray = null;
+ filterStringObjectArray = null;
+ //filterStringVector = null;
+ }
+
+ /**
+ * Return true if this a transient or simple filter that is only created temporary "on the fly"
+ * and not intended to be saved or part of the filter framework. Eg it has no manager or provider.
+ *
+ *
+ */
+public class SystemFilterStartHere
+ implements ISystemFilterConstants
+{
+ /**
+ * Factory method to return an instance populated with defaults.
+ * You can then simply override whatever is desired via setXXX methods.
+ */
+ public static ISystemFilterNamingPolicy createSystemFilterNamingPolicy()
+ {
+ return SystemFilterNamingPolicy.getNamingPolicy();
+ }
+
+
+ /**
+ * Factory to create a filter pool manager, when you do NOT want it to worry about
+ * saving and restoring the filter data to disk. Rather, you will save and restore
+ * yourself.
+ * @param logger A logging object into which to log errors as they happen in the framework
+ * @param caller Objects which instantiate this class should implement the
+ * SystemFilterPoolManagerProvider interface, and pass "this" for this parameter.
+ * Given any filter framework object, it is possible to retrieve the caller's
+ * object via the getProvider method call.
+ * @param name the name of the filter pool manager. Not currently used but you may
+ * find a use for it.
+ * @param allowNestedFilters true if filters inside filter pools in this manager are
+ * to allow nested filters. This is the default, but can be overridden at the
+ * individual filter pool level.
+ */
+ public static ISystemFilterPoolManager
+ createSystemFilterPoolManager(ISystemProfile profile,
+ Logger logger,
+ ISystemFilterPoolManagerProvider caller,
+ String name,
+ boolean allowNestedFilters)
+ {
+ return SystemFilterPoolManager.createSystemFilterPoolManager(profile, logger, caller,
+ name, allowNestedFilters, SAVE_POLICY_NONE, null);
+ }
+
+
+
+ /**
+ * Create a SystemFilterPoolReferenceManager instance, when you do NOT want it
+ * to be saved and restored to its own file. Rather, you will save and restore it
+ * yourself.
+ * @param caller Objects which instantiate this class should implement the
+ * SystemFilterPoolReferenceManagerProvider interface, and pass "this" for this parameter.
+ * Given any filter framework object, it is possible to retrieve the caller's
+ * object via the getProvider method call.
+ * @param relatedPoolManagers The managers that own the master list of filter pools that
+ * this manager will contain references to.
+ * @param name the name of the filter pool reference manager. This is not currently
+ * used, but you may find a use for it.
+ * @param namingPolicy the naming policy object which will return the name of that one file.
+ */
+ public static ISystemFilterPoolReferenceManager createSystemFilterPoolReferenceManager(
+ ISystemFilterPoolReferenceManagerProvider caller,
+ ISystemFilterPoolManagerProvider relatedPoolMgrProvider,
+ String name, ISystemFilterNamingPolicy namingPolicy)
+ {
+ return SystemFilterPoolReferenceManager.createSystemFilterPoolReferenceManager(
+ caller, relatedPoolMgrProvider, null, name, SAVE_POLICY_NONE, namingPolicy);
+ }
+
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/internal/filters/SystemFilter.java b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/internal/filters/SystemFilter.java
new file mode 100644
index 00000000000..8ca46eddaa3
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/filters/org/eclipse/rse/internal/filters/SystemFilter.java
@@ -0,0 +1,1399 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * {Name} (company) - description of contribution.
+ ********************************************************************************/
+
+package org.eclipse.rse.internal.filters;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Vector;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.rse.core.SystemPlugin;
+import org.eclipse.rse.filters.ISystemFilter;
+import org.eclipse.rse.filters.ISystemFilterConstants;
+import org.eclipse.rse.filters.ISystemFilterContainer;
+import org.eclipse.rse.filters.ISystemFilterNamingPolicy;
+import org.eclipse.rse.filters.ISystemFilterPool;
+import org.eclipse.rse.filters.ISystemFilterPoolManager;
+import org.eclipse.rse.filters.ISystemFilterPoolManagerProvider;
+import org.eclipse.rse.filters.ISystemFilterString;
+import org.eclipse.rse.filters.SystemFilterSimple;
+import org.eclipse.rse.internal.references.SystemReferencedObject;
+import org.eclipse.rse.references.ISystemReferencedObject;
+import org.eclipse.rse.ui.SystemResources;
+
+
+/**
+ * A filter is an encapsulation of a unique name, and a list
+ * of filter strings.
+ * Filters can be referenced.
+ */
+/**
+ * @lastgen class SystemFilterImpl extends SystemReferencedObjectImpl implements SystemFilter, SystemReferencedObject, SystemFilterContainer, IAdaptable {}
+ */
+public class SystemFilter extends SystemReferencedObject implements ISystemFilter, ISystemReferencedObject, ISystemFilterContainer, IAdaptable
+{
+
+ /**
+ * The default value of the '{@link #getName() Name}' attribute.
+ *
+ *
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+
+ private SystemFilterContainerCommonMethods helpers = null;
+ private ISystemFilterPool parentPool = null;
+ protected String[] filterStringArray = null;
+ protected ISystemFilterString[] filterStringObjectArray = null;
+ protected Vector filterStringVector = null;
+
+ // persistance
+ protected boolean _isDirty = true;
+ protected boolean _wasRestored = false;
+
+ //protected static String SAVEFILE_PREFIX = DEFAULT_FILENAME_PREFIX_FILTER;
+ //protected static String SAVEFILE_SUFFIX = ".xmi";
+ protected static boolean debug = true;
+ /**
+ * @generated This field/method will be replaced during code generation.
+ */
+ /**
+ * @generated This field/method will be replaced during code generation.
+ */
+ protected String name = NAME_EDEFAULT;
+ /**
+ * The default value of the '{@link #getType() Type}' attribute.
+ *
+ *
+ * @see #getType()
+ * @generated
+ * @ordered
+ */
+ protected static final String TYPE_EDEFAULT = null;
+
+ /**
+ * @generated This field/method will be replaced during code generation.
+ */
+ protected String type = TYPE_EDEFAULT;
+ /**
+ * The default value of the '{@link #isSupportsNestedFilters() Supports Nested Filters}' attribute.
+ *
+ *
+ * @see #isSupportsNestedFilters()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean SUPPORTS_NESTED_FILTERS_EDEFAULT = false;
+
+ /**
+ * @generated This field/method will be replaced during code generation.
+ */
+ protected boolean supportsNestedFilters = SUPPORTS_NESTED_FILTERS_EDEFAULT;
+ /**
+ * The default value of the '{@link #getRelativeOrder() Relative Order}' attribute.
+ *
+ *
+ * @see #getRelativeOrder()
+ * @generated
+ * @ordered
+ */
+ protected static final int RELATIVE_ORDER_EDEFAULT = 0;
+
+ /**
+ * @generated This field/method will be replaced during code generation.
+ */
+ protected int relativeOrder = RELATIVE_ORDER_EDEFAULT;
+ /**
+ * The default value of the '{@link #isDefault() Default}' attribute.
+ *
+ *
+ * @see #isDefault()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean DEFAULT_EDEFAULT = false;
+
+ /**
+ * @generated This field/method will be replaced during code generation.
+ */
+ protected boolean default_ = DEFAULT_EDEFAULT;
+ /**
+ * The default value of the '{@link #isStringsCaseSensitive() Strings Case Sensitive}' attribute.
+ *
+ *
+ * @see #isStringsCaseSensitive()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean STRINGS_CASE_SENSITIVE_EDEFAULT = false;
+
+ /**
+ * @generated This field/method will be replaced during code generation.
+ */
+ protected boolean stringsCaseSensitive = STRINGS_CASE_SENSITIVE_EDEFAULT;
+ /**
+ * The default value of the '{@link #isPromptable() Promptable}' attribute.
+ *
+ *
+ * @see #isPromptable()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean PROMPTABLE_EDEFAULT = false;
+
+ /**
+ * @generated This field/method will be replaced during code generation.
+ */
+ protected boolean promptable = PROMPTABLE_EDEFAULT;
+ /**
+ * The default value of the '{@link #isSupportsDuplicateFilterStrings() Supports Duplicate Filter Strings}' attribute.
+ *
+ *
+ * @see #isSupportsDuplicateFilterStrings()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean SUPPORTS_DUPLICATE_FILTER_STRINGS_EDEFAULT = false;
+
+ /**
+ * @generated This field/method will be replaced during code generation.
+ */
+ protected boolean supportsDuplicateFilterStrings = SUPPORTS_DUPLICATE_FILTER_STRINGS_EDEFAULT;
+ /**
+ * The default value of the '{@link #isNonDeletable() Non Deletable}' attribute.
+ *
+ *
+ * @see #isNonDeletable()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean NON_DELETABLE_EDEFAULT = false;
+
+ /**
+ * @generated This field/method will be replaced during code generation.
+ */
+ protected boolean nonDeletable = NON_DELETABLE_EDEFAULT;
+ /**
+ * The default value of the '{@link #isNonRenamable() Non Renamable}' attribute.
+ *
+ *
+ * @see #isNonRenamable()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean NON_RENAMABLE_EDEFAULT = false;
+
+ /**
+ * @generated This field/method will be replaced during code generation.
+ */
+ protected boolean nonRenamable = NON_RENAMABLE_EDEFAULT;
+ /**
+ * The default value of the '{@link #isNonChangable() Non Changable}' attribute.
+ *
+ *
+ * @see #isNonChangable()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean NON_CHANGABLE_EDEFAULT = false;
+
+ /**
+ * @generated This field/method will be replaced during code generation.
+ */
+ protected boolean nonChangable = NON_CHANGABLE_EDEFAULT;
+ /**
+ * The default value of the '{@link #isStringsNonChangable() Strings Non Changable}' attribute.
+ *
+ *
+ * @see #isStringsNonChangable()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean STRINGS_NON_CHANGABLE_EDEFAULT = false;
+
+ /**
+ * @generated This field/method will be replaced during code generation.
+ */
+ protected boolean stringsNonChangable = STRINGS_NON_CHANGABLE_EDEFAULT;
+ /**
+ * The default value of the '{@link #getRelease() Release}' attribute.
+ *
+ *
+ * @see #getRelease()
+ * @generated
+ * @ordered
+ */
+ protected static final int RELEASE_EDEFAULT = 0;
+
+ /**
+ * @generated This field/method will be replaced during code generation.
+ */
+ protected int release = RELEASE_EDEFAULT;
+ /**
+ * The default value of the '{@link #isSingleFilterStringOnly() Single Filter String Only}' attribute.
+ *
+ *
+ * @see #isSingleFilterStringOnly()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean SINGLE_FILTER_STRING_ONLY_EDEFAULT = false;
+
+ /**
+ * The cached value of the '{@link #isSingleFilterStringOnly() Single Filter String Only}' attribute.
+ *
+ *
+ * @see #isSingleFilterStringOnly()
+ * @generated
+ * @ordered
+ */
+ protected boolean singleFilterStringOnly = SINGLE_FILTER_STRING_ONLY_EDEFAULT;
+
+ /**
+ * @generated This field/method will be replaced during code generation.
+ */
+ protected java.util.List nestedFilters = null;
+ /**
+ * @generated This field/method will be replaced during code generation.
+ */
+ protected java.util.List strings = null;
+
+
+ // FIXME
+ protected ISystemFilter _parentFilter;
+
+/**
+ * Constructor. Do not instantiate directly, let MOF do it!
+ */
+ protected SystemFilter()
+ {
+ super();
+ helpers = new SystemFilterContainerCommonMethods();
+ }
+ /*
+ * Private internal way to get filters. Makes it easy to change in future, if we don't use MOF.
+ */
+ protected java.util.List internalGetFilters()
+ {
+ return getNestedFilters();
+ }
+
+ /**
+ * Returns the type attribute. Intercepted to return SystemFilterConstants.DEFAULT_TYPE if it is currently null
+ */
+ public String getType()
+ {
+ String type = getTypeGen();
+ if (type == null)
+ return ISystemFilterConstants.DEFAULT_TYPE;
+ else
+ return type;
+ }
+ /**
+ * Returns the type attribute. Intercepted to return SystemFilterConstants.DEFAULT_TYPE if it is currently null
+ */
+ public String getTypeGen()
+ {
+ return type;
+ }
+ /*
+ * Creates a new nested system filter within this filter
+ * @param parentPool the SystemFilterPool that owns the root filter.
+ * @param data Optional transient data to be stored in the new filter. Can be null.
+ * @param aliasName The name to give the new filter. Must be unique for this pool.
+ * @param filterStrings The list of String objects that represent the filter strings.
+ *
+ public SystemFilter createSystemFilter(SystemFilterPool parentPool, Object data, String aliasName, Vector filterStrings)
+ {
+ SystemFilter newFilter = helpers.createSystemFilter(internalGetFilters(), parentPool, data, aliasName, filterStrings);
+ newFilter.setSupportsNestedFilters(true); // presumably it does since it is nested itself.
+ return newFilter;
+ }*/
+
+ /**
+ * Creates a new nested system filter within this filter.
+ * This filter will inherit/store the following attributes from this filter:
+ *
+ *
+ *
+ *
+ *
+ *
+ * @param aliasName The name to give the new filter. Must be unique for this pool.
+ * @param filterStrings The list of String objects that represent the filter strings.
+ */
+ public ISystemFilter createSystemFilter(String aliasName, Vector filterStrings)
+ {
+ ISystemFilter newFilter = helpers.createSystemFilter(internalGetFilters(), getParentFilterPool(), aliasName, filterStrings);
+ newFilter.setSupportsNestedFilters(true); // presumably it does since it is nested itself.
+ newFilter.setSupportsDuplicateFilterStrings(supportsDuplicateFilterStrings());
+ newFilter.setStringsCaseSensitive(areStringsCaseSensitive());
+ return newFilter;
+ }
+
+ /**
+ * Internal use method
+ */
+ protected void initializeFilterStrings()
+ {
+ java.util.List filterStrings = getStrings();
+ Iterator i = filterStrings.iterator();
+ while (i.hasNext())
+ ((ISystemFilterString)i.next()).setParentSystemFilter(this);
+ }
+
+ /**
+ * Clones a given filter to the given target filter.
+ * All filter strings, and all nested filters, are copied.
+ * @param targetFilter new filter into which we copy all our data
+ */
+ public void clone(ISystemFilter targetFilter)
+ {
+ // clone attributes
+ //targetFilter.setName(getName());
+ targetFilter.setDefault(isDefault());
+ targetFilter.setType(getType());
+ targetFilter.setPromptable(isPromptable());
+ targetFilter.setRelativeOrder(getRelativeOrder());
+ targetFilter.setSupportsNestedFilters(isSupportsNestedFilters());
+ targetFilter.setSupportsDuplicateFilterStrings(isSupportsDuplicateFilterStrings());
+ targetFilter.setStringsNonChangable(isStringsNonChangable());
+ targetFilter.setNonChangable(isNonChangable());
+ targetFilter.setNonDeletable(isNonDeletable());
+ targetFilter.setNonRenamable(isNonRenamable());
+ if (isSetSingleFilterStringOnly())
+ targetFilter.setSingleFilterStringOnly(isSingleFilterStringOnly());
+ if (isSetStringsCaseSensitive())
+ targetFilter.setStringsCaseSensitive(isStringsCaseSensitive());
+ // clone filter strings
+ ISystemFilterString[] strings = getSystemFilterStrings();
+ ISystemFilterString newString = null;
+ if (strings != null)
+ for (int idx=0; idx
+ *
+ * @param filter SystemFilter object to add
+ * @return true if added, false if filter with this aliasname already existed.
+ */
+ public boolean addSystemFilter(ISystemFilter filter)
+ {
+ return helpers.addSystemFilter(internalGetFilters(),filter);
+ }
+ /**
+ * Removes a given filter from the list.
+ * @param filter SystemFilter object to remove
+ */
+ public void deleteSystemFilter(ISystemFilter filter)
+ {
+ helpers.deleteSystemFilter(internalGetFilters(),filter);
+ }
+ /**
+ * Rename a given filter in the list.
+ * @param filter SystemFilter object to remove
+ */
+ public void renameSystemFilter(ISystemFilter filter, String newName)
+ {
+ helpers.renameSystemFilter(internalGetFilters(),filter, newName);
+ }
+ /**
+ * Updates a given filter in the list.
+ * @param filter SystemFilter object to update
+ * @param newName New name to assign it. Assumes unique checking already done.
+ * @param newStrings New strings to assign it. Replaces current strings.
+ */
+ public void updateSystemFilter(ISystemFilter filter, String newName, String[] newStrings)
+ {
+ helpers.updateSystemFilter(internalGetFilters(), filter, newName, newStrings);
+ }
+ /**
+ * Duplicates a given filter in the list.
+ * @param filter SystemFilter object to clone
+ * @param alias New, unique, alias name to give this filter. Clone will fail if this is not unique.
+ */
+ public ISystemFilter cloneSystemFilter(ISystemFilter filter, String aliasName)
+ {
+ return helpers.cloneSystemFilter(internalGetFilters(), filter, aliasName);
+ }
+ /**
+ * Return a given filter's zero-based location
+ */
+ public int getSystemFilterPosition(ISystemFilter filter)
+ {
+ return helpers.getSystemFilterPosition(internalGetFilters(),filter);
+ }
+
+ /**
+ * Move a given filter to a given zero-based location
+ */
+ public void moveSystemFilter(int pos, ISystemFilter filter)
+ {
+ helpers.moveSystemFilter(internalGetFilters(), pos, filter);
+ }
+ /**
+ * Return the parent pool of this filter. For nested filters, we walk up the parent chain
+ * until we find the pool.
+ */
+ public ISystemFilterPool getParentFilterPool()
+ {
+ return parentPool;
+ }
+ /**
+ * Internal use method to set the parent filter pool.
+ */
+ public void setParentFilterPool(ISystemFilterPool parentPool)
+ {
+ this.parentPool = parentPool;
+ ISystemFilter[] filters = getSystemFilters();
+ if (filters != null)
+ for (int idx=0; idx
+ *
+ * @param filter SystemFilter object to add
+ * @return true if added, false if filter with this aliasname already existed.
+ */
+ public boolean addSystemFilter(java.util.List filters, ISystemFilter filter)
+ {
+ boolean exists = getSystemFilter(filters, filter.getName()) != null;
+ if (!exists)
+ return internalAddSystemFilter(filters, filter);
+ else
+ return false;
+ }
+ /**
+ * Internally, we can skip the uniqueness checking.
+ */
+ protected boolean internalAddSystemFilter(java.util.List filters, ISystemFilter filter)
+ {
+ filters.add(filter);
+ invalidateCache();
+ return true;
+ }
+ /**
+ * Adds given filter to the list.
+ *
+ *
+ * @param filter SystemFilter object to add
+ * @return true if added, false if filter with this aliasname already existed.
+ */
+ public boolean addSystemFilter(Vector filters, ISystemFilter filter)
+ {
+ boolean exists = getSystemFilter(filters, filter.getName()) != null;
+ if (!exists)
+ return internalAddSystemFilter(filters, filter);
+ else
+ return false;
+ }
+ /**
+ * Internally, we can skip the uniqueness checking.
+ */
+ private boolean internalAddSystemFilter(Vector filters, ISystemFilter filter)
+ {
+ filters.add(filter);
+ invalidateCache();
+ return true;
+ }
+
+
+
+ /**
+ * Removes a given filter from the list.
+ * Does NOT follow references to remove them.
+ * @param filters MOF list to remove from
+ * @param filter SystemFilter object to remove
+ */
+ public void deleteSystemFilter(java.util.List filters, ISystemFilter filter)
+ {
+ filters.remove(filter);
+ invalidateCache();
+ }
+ /**
+ * Renames a given filter from the list.
+ * @param filters java.util.List list
+ * @param filter SystemFilter object to rename
+ * @param newName new name to give filter
+ */
+ public void renameSystemFilter(java.util.List filters, ISystemFilter filter, String newName)
+ {
+ filter.setName(newName);
+ invalidateCache();
+ }
+
+ /**
+ * Removes a given filter from the list.
+ * Does NOT follow references to remove them.
+ * @param filters Vector list to remove from
+ * @param filter SystemFilter object to remove
+ */
+ public void deleteSystemFilter(Vector filters, ISystemFilter filter)
+ {
+ filters.remove(filter);
+ invalidateCache();
+ }
+ /**
+ * Renames a given filter from the list.
+ * @param filters Vector list
+ * @param filter SystemFilter object to rename
+ * @param newName new name to give filter
+ */
+ public void renameSystemFilter(Vector filters, ISystemFilter filter, String newName)
+ {
+ filter.setName(newName);
+ invalidateCache();
+ }
+ /**
+ * Updates a given filter in the list.
+ * @param filters Vector list
+ * @param filter SystemFilter object to update
+ * @param newName new name to give filter
+ * @param newString new strings to give filter
+ */
+ public void updateSystemFilter(Vector filters, ISystemFilter filter, String newName, String[] newStrings)
+ {
+ filter.setName(newName);
+ filter.setFilterStrings(newStrings);
+ invalidateCache();
+ }
+ /**
+ * Updates a given filter in the list.
+ * @param filters java.util.List list
+ * @param filter SystemFilter object to update
+ * @param newName new name to give filter
+ * @param newString new strings to give filter
+ */
+ public void updateSystemFilter(java.util.List filters, ISystemFilter filter, String newName, String[] newStrings)
+ {
+ filter.setName(newName);
+ filter.setFilterStrings(newStrings);
+ invalidateCache();
+ }
+ /**
+ * Duplicates a given filter in the list.
+ * @param filters MOF list of filters into which to place the clone
+ * @param filter SystemFilter object to clone
+ * @param aliasName New, unique, alias name to give this filter. Clone will fail if this is not unique.
+ */
+ public ISystemFilter cloneSystemFilter(java.util.List filters, ISystemFilter filter, String aliasName)
+ {
+
+ ISystemFilter copy =
+ createSystemFilter(filters, filter.getParentFilterPool(),
+ aliasName, filter.getFilterStringsVector());
+ internalAfterCloneSystemFilter(filter, copy);
+ // now clone nested filters...
+ ISystemFilter[] nested = filter.getSystemFilters();
+ if ((nested!=null) && (nested.length>0))
+ for (int idx=0; idx
+ *
+ * @param namingPolicy The names to use for file and folders when persisting to disk. Pass
+ * null to just use the defaults.
+ */
+ public static ISystemFilterPool createSystemFilterPool(
+ String name,
+ boolean allowNestedFilters,
+ boolean isDeletable,
+ boolean tryToRestore)
+ {
+
+
+ SystemFilterPool pool = null;
+ if (tryToRestore)
+ {
+ try
+ {
+ pool = (SystemFilterPool)SystemPlugin.getThePersistenceManager().restoreFilterPool(name);
+ }
+ catch (Exception exc) // real error trying to restore, versus simply not found.
+ {
+ // todo: something? Log the exception somewhere?
+ }
+ }
+ if (pool == null) // not found or some serious error.
+ {
+ pool = createPool();
+ }
+ if (pool != null)
+ {
+ pool.initialize(name, allowNestedFilters, isDeletable);
+ }
+ return pool;
+ }
+
+ // temporary!
+ //public boolean isSharable() {return isSharable; }
+ //public void setIsSharable(boolean is) { isSharable = is; }
+
+ /*
+ * Private helper method.
+ * Uses MOF to create an instance of this class.
+ */
+ protected static SystemFilterPool createPool()
+ {
+ ISystemFilterPool pool = new SystemFilterPool();
+ // FIXME SystemFilterImpl.initMOF().createSystemFilterPool();
+ pool.setRelease(SystemResources.CURRENT_RELEASE);
+ return (SystemFilterPool)pool;
+ }
+
+ /*
+ * Private helper method to initialize attributes
+ */
+ protected void initialize(String name,
+ boolean allowNestedFilters,
+ boolean isDeletable)
+ {
+ if (!initialized)
+ initialize(name, savePolicy, namingPolicy);
+ setDeletable(isDeletable); // mof attribute
+ //System.out.println("In initialize() for filter pool " + getName() + ". isDeletable= " + isDeletable);
+ setSupportsNestedFilters(allowNestedFilters); // cascades to each filter
+ }
+
+ /*
+ * Private helper method to core initialization, from either createXXX or restore.
+ */
+ protected void initialize(String name,
+ int savePolicy, ISystemFilterNamingPolicy namingPolicy)
+ {
+ setName(name); // mof attribute
+ setSavePolicy(savePolicy);
+ setNamingPolicy(namingPolicy);
+
+ initialized = true;
+ }
+
+
+ //protected Vector internalGetFilters()
+ protected java.util.List internalGetFilters()
+ {
+ //return filters;
+ return getFilters(); // mof-supplied in parent class
+ }
+
+ /**
+ * Return the caller which instantiated the filter pool manager overseeing this filter framework instance
+ */
+ public ISystemFilterPoolManagerProvider getProvider()
+ {
+ ISystemFilterPoolManager mgr = getSystemFilterPoolManager();
+ if (mgr != null)
+ return mgr.getProvider();
+ else
+ return null;
+ }
+
+ /**
+ * Set the save file policy. See constants in {@link org.eclipse.rse.filters.ISystemFilterConstants SystemFilterConstants}.
+ * One of:
+ *
+ *
+ * This method is called by the SystemFilterPoolManager.
+ */
+ public void setSavePolicy(int policy)
+ {
+ if (this.savePolicy != policy)
+ {
+ this.savePolicy = policy;
+ setDirty(true);
+ }
+ }
+
+ /**
+ * Set the naming policy used when saving data to disk.
+ * @see org.eclipse.rse.filters.ISystemFilterNamingPolicy
+ */
+ public void setNamingPolicy(ISystemFilterNamingPolicy namingPolicy)
+ {
+ if (this.namingPolicy != namingPolicy)
+ {
+ this.namingPolicy = namingPolicy;
+ setDirty(true);
+ }
+ }
+
+ /**
+ * Get the naming policy currently used when saving data to disk.
+ * @see org.eclipse.rse.filters.ISystemFilterNamingPolicy
+ */
+ public ISystemFilterNamingPolicy getNamingPolicy()
+ {
+ return namingPolicy;
+ }
+
+ /**
+ * Set whether filters in this pool support nested filters.
+ * Important to note this is stored in every filter as well as this filter pool.
+ */
+ public void setSupportsNestedFilters(boolean supports)
+ {
+ this.setSupportsNestedFiltersGen(supports);
+ ISystemFilter[] filters = getSystemFilters();
+ if (filters != null)
+ for (int idx=0; idx
+ *
+ * Attributes we clone:
+ *
+ *
+ */
+ public void cloneSystemFilterPool(ISystemFilterPool targetPool)
+ throws Exception
+ {
+ //System.out.println("In SystemFilterPoolImpl#cloneSystemFilterPool. targetPool null? " + (targetPool == null));
+ if (filterPoolData != null)
+ targetPool.setSystemFilterPoolData(filterPoolData);
+
+ //String ourType = getTypeGen();
+ //if (ourType != null)
+ // targetPool.setType(ourType);
+ targetPool.setType(getType());
+
+ targetPool.setDeletable(isDeletable());
+ targetPool.setSupportsNestedFilters(isSupportsNestedFilters());
+
+ //Boolean ourDefault = getDefault();
+ //if (ourDefault != null)
+ // targetPool.setDefault(ourDefault);
+ targetPool.setDefault(isDefault());
+
+ targetPool.setSupportsDuplicateFilterStrings(supportsDuplicateFilterStrings());
+ targetPool.setRelease(getRelease());
+ //targetPool.setNonDeletable(isNonDeletable());
+ targetPool.setNonRenamable(isNonRenamable());
+ targetPool.setOwningParentName(getOwningParentName());
+ if (isSetSingleFilterStringOnly())
+ targetPool.setSingleFilterStringOnly(isSingleFilterStringOnly());
+ if (isSetStringsCaseSensitive())
+ targetPool.setStringsCaseSensitive(isStringsCaseSensitive());
+
+
+ ISystemFilter[] filters = getSystemFilters();
+ if ((filters!=null) && (filters.length>0))
+ {
+ for (int idx=0; idx
+ *
+ * @param filter SystemFilter object to add
+ * @return true if added, false if filter with this aliasname already existed.
+ */
+ public boolean addSystemFilter(ISystemFilter filter)
+ {
+ return helpers.addSystemFilter(internalGetFilters(),filter);
+ }
+ /**
+ * Removes a given filter from the list.
+ * @param filter SystemFilter object to remove
+ */
+ public void deleteSystemFilter(ISystemFilter filter)
+ {
+ helpers.deleteSystemFilter(internalGetFilters(),filter);
+ }
+
+ /**
+ * Rename a given filter in the list.
+ * @param filter SystemFilter object to remove
+ */
+ public void renameSystemFilter(ISystemFilter filter, String newName)
+ {
+ helpers.renameSystemFilter(internalGetFilters(),filter, newName);
+ }
+
+ /**
+ * Updates a given filter in the list.
+ * @param filter SystemFilter object to update
+ * @param newName New name to assign it. Assumes unique checking already done.
+ * @param newStrings New strings to assign it. Replaces current strings.
+ */
+ public void updateSystemFilter(ISystemFilter filter, String newName, String[] newStrings)
+ {
+ helpers.updateSystemFilter(internalGetFilters(), filter, newName, newStrings);
+ }
+
+ /**
+ * Duplicates a given filter in the list.
+ * @param filter SystemFilter object to clone
+ * @param alias New, unique, alias name to give this filter. Clone will fail if this is not unique.
+ */
+ public ISystemFilter cloneSystemFilter(ISystemFilter filter, String aliasName)
+ {
+ return helpers.cloneSystemFilter(internalGetFilters(), filter, aliasName);
+ }
+
+ /**
+ * Return a given filter's zero-based location
+ */
+ public int getSystemFilterPosition(ISystemFilter filter)
+ {
+ return helpers.getSystemFilterPosition(internalGetFilters(),filter);
+ }
+
+ /**
+ * Move a given filter to a given zero-based location
+ */
+ public void moveSystemFilter(int pos, ISystemFilter filter)
+ {
+ helpers.moveSystemFilter(internalGetFilters(),pos,filter);
+ }
+
+ /**
+ * This is the method required by the IAdaptable interface.
+ * Given an adapter class type, return an object castable to the type, or
+ * null if this is not possible.
+ */
+ public Object getAdapter(Class adapterType)
+ {
+ return Platform.getAdapterManager().getAdapter(this, adapterType);
+ }
+
+ /**
+ * Private helper method to deduce filter names from disk files.
+ * Will populate and return a list.
+ * Only makes sense to use if the save policy is one file per filter.
+ */
+ protected static Vector deduceFilterNames(IFolder folder, ISystemFilterNamingPolicy namingPolicy)
+ {
+ Vector filterNames = SystemResourceHelpers.getResourceHelpers().convertToVectorAndStrip(
+ SystemResourceHelpers.getResourceHelpers().listFiles(folder,
+ namingPolicy.getFilterSaveFileNamePrefix(),
+ SAVEFILE_SUFFIX),
+ namingPolicy.getFilterSaveFileNamePrefix(), SAVEFILE_SUFFIX);
+ return filterNames;
+ }
+
+
+
+ /**
+ * Order filters according to user preferences.
+ *
+ *
+ *
+ *
+ *
+ *
+ * All the underlying file system work is handled for you.
+ *
+ *
+ * @param namingPolicy The names to use for file and folders when persisting to disk. Pass
+ * null to just use the defaults, or if using SAVE_POLICY_NONE.
+ */
+ public static ISystemFilterPoolManager
+ createSystemFilterPoolManager(ISystemProfile profile, Logger logger,
+ ISystemFilterPoolManagerProvider caller,
+ String name,
+ boolean allowNestedFilters,
+ int savePolicy, ISystemFilterNamingPolicy namingPolicy)
+ {
+
+ SystemFilterPoolManager mgr = null;
+ if (namingPolicy == null)
+ namingPolicy = SystemFilterNamingPolicy.getNamingPolicy();
+ try
+ {
+ mgr = (SystemFilterPoolManager)SystemPlugin.getThePersistenceManager().restoreFilterPoolManager(profile, logger, caller, name);
+ /*
+ if (savePolicy != SystemFilterConstants.SAVE_POLICY_NONE)
+ mgr = (SystemFilterPoolManagerImpl)restore(;
+ */
+ }
+ catch (Exception exc) // real error trying to restore, versus simply not found.
+ {
+ // todo: something. Log the exception somewhere?
+ }
+ if (mgr == null) // not found or some serious error.
+ {
+ mgr = createManager(profile);
+ }
+ if (mgr != null)
+ {
+ mgr.initialize(logger, caller, name, allowNestedFilters);
+ }
+ return mgr;
+ }
+
+ /*
+ * Private helper method.
+ * Uses MOF to create an instance of this class.
+ */
+ public static SystemFilterPoolManager createManager(ISystemProfile profile)
+ {
+ ISystemFilterPoolManager mgr = new SystemFilterPoolManager(profile);
+
+ //FIXME SystemFilterImpl.initMOF().createSystemFilterPoolManager();
+ return (SystemFilterPoolManager)mgr;
+ }
+
+ /*
+ * Private helper method to initialize state
+ */
+ public void initialize(Logger logger, ISystemFilterPoolManagerProvider caller, String name,
+ boolean allowNestedFilters)
+ {
+ if (!initialized)
+ initialize(logger, caller, name); // core data
+
+ {
+ java.util.List pools = getPools();
+ ISystemFilterPool pool = null;
+ Vector poolNames = getSystemFilterPoolNamesVector();
+ for (int idx=0; idx
+ *
+ * @param pool The filter pool object to physically delete
+ */
+ public void deleteSystemFilterPool(ISystemFilterPool pool)
+ throws Exception
+ {
+
+
+
+ // remove all references
+ ISystemBaseReferencingObject[] refs = pool.getReferencingObjects();
+ //boolean needsSave = false;
+ if (refs != null)
+ {
+ for (int idx=0; idx < refs.length; idx++)
+ {
+ if (refs[idx] instanceof ISystemFilterPoolReference)
+ {
+ ISystemFilterPoolReference fpRef = (ISystemFilterPoolReference)refs[idx];
+ ISystemFilterPoolReferenceManager fprMgr = fpRef.getFilterPoolReferenceManager();
+ if (fprMgr != null)
+ fprMgr.removeSystemFilterPoolReference(fpRef,false);// false means don't dereference
+ }
+ }
+ }
+ String poolName = pool.getName();
+
+ // remove from model
+ java.util.List pools = getPools();
+ pools.remove(pool);
+
+ /* FIXME
+ // now in EMF, the pools are "owned" by the Resource, and only referenced by this pool manager,
+ // so I don't think just removing it from the manager is enough... it must also be removed from its
+ // resource. Phil.
+ Resource res = pool.eResource();
+ if (res != null)
+ res.getContents().remove(pool);
+
+ // remove from disk
+ if ( (savePolicy == SystemFilterConstants.SAVE_POLICY_ONE_FILEANDFOLDER_PER_POOL) ||
+ (savePolicy == SystemFilterConstants.SAVE_POLICY_ONE_FILE_PER_FILTER) )
+ {
+ String expectedFolderName = derivePoolFolderName(poolName);
+ if (expectedFolderName.equals(poolFolder.getName()))
+ {
+ // folder name equals what we would have named it if left to us.
+ // assumption is this folder only exists to hold this pool!
+ if (poolFolder.exists())
+ getResourceHelpers().deleteResource(poolFolder);
+ }
+ }
+ else if (savePolicy == SystemFilterConstants.SAVE_POLICY_ONE_FILE_PER_POOL_SAME_FOLDER)
+ {
+ String poolFileName = SystemFilterPoolImpl.getSaveFileName(getMOFHelpers(),pool);
+ IFile poolFile = SystemResourceHelpers.getResourceHelpers().getFile(poolFolder,poolFileName);
+ if (poolFile.exists())
+ getResourceHelpers().deleteResource(poolFile);
+ }
+ else // all pools in one file per manager. Just save it
+ {
+ commit();
+ }
+ invalidatePoolCache();
+ // if caller provider, callback to inform them of this event
+ if ((caller != null) && !suspendCallbacks)
+ caller.filterEventFilterPoolDeleted(pool);
+ */
+ }
+
+ /**
+ * Delete all existing filter pools. Call this when you are about to delete this manager, say.
+ */
+ public void deleteAllSystemFilterPools()
+ {
+ ISystemFilterPool[] allPools = getSystemFilterPools();
+ for (int idx=0; idx
+ *
+ * @param pool The filter pool object to physically rename
+ * @param newName The new name to give the pool
+ */
+ public void renameSystemFilterPool(ISystemFilterPool pool, String newName)
+ throws Exception
+ {
+ String oldName = pool.getName();
+ int oldLen = oldName.length();
+ int newLen = newName.length();
+ // rename on disk
+ /* FIXME
+ if ( (savePolicy == SystemFilterConstants.SAVE_POLICY_ONE_FILEANDFOLDER_PER_POOL) ||
+ (savePolicy == SystemFilterConstants.SAVE_POLICY_ONE_FILE_PER_FILTER) )
+ {
+ String expectedFolderName = derivePoolFolderName(pool.getName());
+ boolean ourFolderName = expectedFolderName.equals(pool.getFolder().getName());
+ // we must rename the old file...
+ String poolFileName = SystemFilterPoolImpl.getSaveFileName(getMOFHelpers(),pool);
+ String poolFileNewName = SystemFilterPoolImpl.getSaveFileName(getMOFHelpers(),pool,newName);
+ IFile poolFile = getResourceHelpers().getFile(pool.getFolder(),poolFileName);
+ IFolder poolFolder = pool.getFolder();
+
+ // first, pre-test for file-in-use error:
+ boolean inUse = poolFile.exists() && SystemResourceHelpers.testIfResourceInUse(poolFile);
+ if (inUse)
+ {
+ SystemMessage msg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_FILE_INUSE);
+ msg.makeSubstitution(poolFile.getFullPath());
+ throw new SystemMessageException(msg);
+ }
+ // next, pre-test for folder-in-use error:
+ if (ourFolderName)
+ {
+ inUse = poolFolder.exists() && SystemResourceHelpers.testIfResourceInUse(poolFolder);
+ if (inUse)
+ {
+ SystemMessage msg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_FOLDER_INUSE);
+ msg.makeSubstitution(poolFolder.getFullPath());
+ throw new SystemMessageException(msg);
+ }
+ }
+
+ if (poolFile.exists())
+ {
+ // pre-test if the new name will be too long for MOF (256)
+ if (nameLenDiff > 0)
+ {
+ if (ourFolderName)
+ nameLenDiff *= 2; // new name affects folder and file
+ int newNameLen = poolFile.getLocation().toOSString().length() + nameLenDiff;
+ if (newNameLen > 256)
+ throw new Exception("Fully qualified filter pool name too long for "+newName+". Exceeds 256 characters");
+ }
+ getResourceHelpers().renameResource(poolFile, poolFileNewName);
+ }
+ if (ourFolderName)
+ {
+ // folder name equals what we would have named it if left to us.
+ // assumption is this folder only exists to hold this pool!
+ if (poolFolder.exists())
+ {
+ String newFolderName = derivePoolFolderName(newName);
+ getResourceHelpers().renameResource(poolFolder, newFolderName);
+ // as we now know, the original IFolder still points to the old name!
+ poolFolder = getResourceHelpers().getRenamedFolder(poolFolder, newFolderName);
+ pool.setFolder(poolFolder);
+ }
+ }
+ }
+ else if (savePolicy == SystemFilterConstants.SAVE_POLICY_ONE_FILE_PER_POOL_SAME_FOLDER)
+ {
+ String poolFileName = SystemFilterPoolImpl.getSaveFileName(getMOFHelpers(),pool);
+ IFile poolFile = getResourceHelpers().getFile(pool.getFolder(),poolFileName);
+ // first, pre-test for file-in-use error:
+ boolean inUse = poolFile.exists() && SystemResourceHelpers.testIfResourceInUse(poolFile);
+ if (inUse)
+ {
+ SystemMessage msg = SystemPlugin.getPluginMessage(ISystemMessages.MSG_FILE_INUSE);
+ msg.makeSubstitution(poolFile.getFullPath());
+ throw new SystemMessageException(msg);
+ }
+ if (poolFile.exists())
+ {
+ String poolFileNewName = SystemFilterPoolImpl.getSaveFileName(getMOFHelpers(),pool,newName);
+ getResourceHelpers().renameResource(poolFile, poolFileNewName);
+ }
+ }
+ */
+ pool.setName(newName);
+ invalidatePoolCache();
+
+ // inform all referencees
+ ISystemBaseReferencingObject[] refs = pool.getReferencingObjects();
+ if (refs != null)
+ {
+ for (int idx=0; idx < refs.length; idx++)
+ {
+ ISystemBaseReferencingObject ref = refs[idx];
+ if (ref instanceof ISystemFilterPoolReference)
+ {
+ ISystemFilterPoolReference fpRef = (ISystemFilterPoolReference)ref;
+ ISystemFilterPoolReferenceManager fprMgr = fpRef.getFilterPoolReferenceManager();
+ fprMgr.renameReferenceToSystemFilterPool(pool);
+ }
+ }
+ }
+
+ // if caller provider, callback to inform them of this event
+ if ((caller != null) && !suspendCallbacks)
+ caller.filterEventFilterPoolRenamed(pool,oldName);
+ }
+
+ /**
+ * Copy the specified filter pool from this manager to this manager or another manager.
+ *
+ *
+ * @param targetMgr The target manager to copy our filter pool to. Can be this manager, but target pool name must be unique.
+ * @param oldPool The filter pool to copy
+ * @param newName The new name to give the copied pool
+ * @return the new copy
+ */
+ public ISystemFilterPool copySystemFilterPool(ISystemFilterPoolManager targetMgr, ISystemFilterPool oldPool, String newName)
+ throws Exception
+ {
+ ISystemFilterPool newPool = targetMgr.createSystemFilterPool(newName, oldPool.isDeletable());
+ //System.out.println("In SystemFilterPoolManagerImpl#copySystemFilterPool: newPool "+newName+" null? " + (newPool == null));
+ oldPool.cloneSystemFilterPool(newPool);
+ commit(newPool); // save it all to disk
+ return newPool;
+ }
+
+ /**
+ * Move the specified filter pool from this manager to another manager.
+ *
+ *
+ * @param targetMgr The target manager to move our filter pool to. Cannot be this manager.
+ * @param oldPool The filter pool to move
+ * @param newName The new name to give the moved pool
+ * @return the new copy of the moved system filter pool
+ */
+ public ISystemFilterPool moveSystemFilterPool(ISystemFilterPoolManager targetMgr, ISystemFilterPool oldPool, String newName)
+ throws Exception
+ {
+ ISystemFilterPool newPool = copySystemFilterPool(targetMgr, oldPool, newName);
+ // find all references to original, and reset them to reference the new...
+ ISystemBaseReferencingObject[] refs = oldPool.getReferencingObjects();
+ if (refs != null)
+ {
+ for (int idx=0; idx < refs.length; idx++)
+ {
+ if (refs[idx] instanceof ISystemFilterPoolReference)
+ {
+ ISystemFilterPoolReference fpRef = (ISystemFilterPoolReference)refs[idx];
+ //SystemFilterPool fp = fpRef.getReferencedFilterPool();
+ ISystemFilterPoolReferenceManager fprMgr = fpRef.getFilterPoolReferenceManager();
+ fprMgr.resetSystemFilterPoolReference(fpRef, newPool); // reset the referenced pool
+ }
+ }
+ }
+ try
+ {
+ deleteSystemFilterPool(oldPool);
+ }
+ catch (Exception exc)
+ {
+ if (refs != null)
+ {
+ for (int idx=0; idx < refs.length; idx++)
+ {
+ if (refs[idx] instanceof ISystemFilterPoolReference)
+ {
+ ISystemFilterPoolReference fpRef = (ISystemFilterPoolReference)refs[idx];
+ ISystemFilterPoolReferenceManager fprMgr = fpRef.getFilterPoolReferenceManager();
+ fprMgr.resetSystemFilterPoolReference(fpRef, oldPool); // reset the referenced pool
+ }
+ }
+ }
+ targetMgr.deleteSystemFilterPool(newPool);
+ throw exc;
+ }
+ return newPool;
+ }
+
+ /**
+ * Copy all filter pools from this manager to another manager.
+ *
+ *
+ * @param targetMgr The target manager to copy our filter pools to
+ */
+ public void copySystemFilterPools(ISystemFilterPoolManager targetMgr)
+ throws Exception
+ {
+ targetMgr.setStringsCaseSensitive(areStringsCaseSensitive());
+ ISystemFilterPool[] pools = getSystemFilterPools();
+ if ((pools!=null) && (pools.length>0))
+ {
+ targetMgr.suspendCallbacks(true);
+ //boolean oldSuspendCallbacks = suspendCallbacks;
+ for (int idx=0;idx
+ *
+ */
+ public boolean deleteSystemFilter(ISystemFilter filter)
+ throws Exception
+ {
+
+ // ok to proceed...
+ boolean ok = true;
+ ISystemFilterContainer parent = filter.getParentFilterContainer();
+ parent.deleteSystemFilter(filter);
+ commit(filter.getParentFilterPool());
+
+ // if caller provider, callback to inform them of this event
+ if ((caller != null) && !suspendCallbacks)
+ caller.filterEventFilterDeleted(filter);
+ return ok;
+ }
+ /**
+ * Renames a filter. This is better than filter.setName(String newName) as it
+ * saves the parent pool to disk.
+ *
+ *
+ * Does fire an event.
+ */
+ public void renameSystemFilter(ISystemFilter filter, String newName)
+ throws Exception
+ {
+
+ // ok to proceed
+ ISystemFilterContainer parent = filter.getParentFilterContainer();
+ String oldName = filter.getName();
+ parent.renameSystemFilter(filter, newName);
+ // rename on disk
+ try
+ {
+
+ commit(filter.getParentFilterPool());
+ }
+ catch (Exception exc)
+ {
+ parent.renameSystemFilter(filter, oldName); // rollback name change
+ throw exc;
+ }
+ // if caller provider, callback to inform them of this event
+ if ((caller != null) && !suspendCallbacks)
+ caller.filterEventFilterRenamed(filter,oldName);
+ }
+
+ /**
+ * Updates a filter. This is better than doing it directly as it saves it to disk.
+ *
+ *
+ */
+ public void updateSystemFilter(ISystemFilter filter, String newName, String[] strings)
+ throws Exception
+ {
+
+ // ok to proceed...
+ ISystemFilterContainer parent = filter.getParentFilterContainer();
+ String oldName = filter.getName();
+ boolean rename = !oldName.equals(newName);
+ if (rename)
+ {
+ renameSystemFilter(filter, newName);
+ }
+ parent.updateSystemFilter(filter, newName, strings);
+ ISystemFilterPool parentPool = filter.getParentFilterPool();
+ commit(parentPool);
+ if ((caller != null) && !suspendCallbacks)
+ caller.filterEventFilterUpdated(filter);
+ }
+
+ /**
+ * Sets a filter's type. This is better than calling filter.setType(String) directly as it saves the filter to disk after.
+ *
+ *
+ * @param filters Array of SystemFilters to move.
+ * @param newPosition new zero-based position for the filters (filterEventFiltersRePositioned)
+ */
+ public void moveSystemFilters(ISystemFilter filters[], int delta)
+ throws Exception
+ {
+ ISystemFilterContainer container = filters[0].getParentFilterContainer();
+ int[] oldPositions = new int[filters.length];
+ for (int idx=0; idx
+ *
+ */
+ public ISystemFilterString addSystemFilterString(ISystemFilter filter, String newString) throws Exception
+ {
+ ISystemFilterString newFilterString = filter.addFilterString(newString);
+ ISystemFilterPool parentPool = filter.getParentFilterPool();
+ commit(parentPool);
+ if ((caller != null) && !suspendCallbacks)
+ caller.filterEventFilterStringCreated(newFilterString);
+ return newFilterString;
+ }
+ /**
+ * Insert a new filter string to the its filters' list, at the given zero-based position
+ *
+ *
+ */
+ public ISystemFilterString addSystemFilterString(ISystemFilter filter, String newString, int position) throws Exception
+ {
+ ISystemFilterString newFilterString = filter.addFilterString(newString, position);
+ ISystemFilterPool parentPool = filter.getParentFilterPool();
+ commit(parentPool);
+ if ((caller != null) && !suspendCallbacks)
+ caller.filterEventFilterStringCreated(newFilterString);
+ return newFilterString;
+ }
+ /**
+ * Delete a filter string from the given filter's list
+ *
+ *
+ * @return true if given string was found and hence was deleted.
+ */
+ public boolean removeSystemFilterString(ISystemFilter filter, String oldString) throws Exception
+ {
+ ISystemFilterString oldFilterString = filter.removeFilterString(oldString);
+ if (oldFilterString == null)
+ return false;
+ ISystemFilterPool parentPool = filter.getParentFilterPool();
+ commit(parentPool);
+ if ((caller != null) && !suspendCallbacks)
+ caller.filterEventFilterStringDeleted(oldFilterString);
+ return true;
+ }
+ /**
+ * Remove a filter string from this filter's list, given its SystemFilterString object.
+ *
+ *
+ * @return true if the given string existed and hence was deleted.
+ */
+ public boolean removeSystemFilterString(ISystemFilter filter, ISystemFilterString filterString) throws Exception
+ {
+ boolean ok = filter.removeFilterString(filterString);
+ if (!ok)
+ return false;
+ ISystemFilterPool parentPool = filter.getParentFilterPool();
+ commit(parentPool);
+ if ((caller != null) && !suspendCallbacks)
+ caller.filterEventFilterStringDeleted(filterString);
+ return ok;
+ }
+ /**
+ * Remove a filter string from the given filter's list, given its zero-based position
+ *
+ *
+ * @return true if a string existed at the given position and hence was deleted.
+ */
+ public boolean removeSystemFilterString(ISystemFilter filter, int position) throws Exception
+ {
+ ISystemFilterString oldFilterString = filter.removeFilterString(position);
+ if (oldFilterString == null)
+ return false;
+ ISystemFilterPool parentPool = filter.getParentFilterPool();
+ commit(parentPool);
+ if ((caller != null) && !suspendCallbacks)
+ caller.filterEventFilterStringDeleted(oldFilterString);
+ return true;
+ }
+ /**
+ * Update a filter string's string vale
+ *
+ *
+ */
+ public void updateSystemFilterString(ISystemFilterString filterString, String newValue) throws Exception
+ {
+ if (newValue.equals(filterString.getString()))
+ return;
+ ISystemFilter filter = filterString.getParentSystemFilter();
+ filter.updateFilterString(filterString, newValue);
+ ISystemFilterPool parentPool = filter.getParentFilterPool();
+ commit(parentPool);
+ if ((caller != null) && !suspendCallbacks)
+ caller.filterEventFilterStringUpdated(filterString);
+ }
+ /**
+ * Return the zero-based position of a SystemFilterString object within its filter
+ */
+ public int getSystemFilterStringPosition(ISystemFilterString filterString)
+ {
+ ISystemFilter filter = filterString.getParentSystemFilter();
+ int position = -1;
+ boolean match = false;
+ ISystemFilterString[] filterStrings = filter.getSystemFilterStrings();
+
+ String matchString = filterString.getString();
+ for (int idx = 0; !match && (idx
+ *
+ * @param filterStrings Array of SystemFilterStrings to move.
+ * @param newPosition new zero-based position for the filter strings
+ */
+ public void moveSystemFilterStrings(ISystemFilterString filterStrings[], int delta)
+ throws Exception
+ {
+ ISystemFilter filter = filterStrings[0].getParentSystemFilter();
+ int[] oldPositions = new int[filterStrings.length];
+ for (int idx=0; idx
+ *
+ * @param namingPolicy The names to use for file and folders when persisting to disk. Pass
+ * null to just use the defaults, or if using SAVE_POLICY_NONE.
+ */
+ public static ISystemFilterPoolReferenceManager createSystemFilterPoolReferenceManager(
+ ISystemFilterPoolReferenceManagerProvider caller,
+ ISystemFilterPoolManagerProvider relatedPoolManagerProvider,
+ IFolder mgrFolder,
+ String name,
+ int savePolicy,
+ ISystemFilterNamingPolicy namingPolicy)
+ {
+ SystemFilterPoolReferenceManager mgr = null;
+
+ if (mgrFolder != null)
+ SystemResourceHelpers.getResourceHelpers().ensureFolderExists(mgrFolder);
+ if (namingPolicy == null)
+ namingPolicy = SystemFilterNamingPolicy.getNamingPolicy();
+ try
+ {
+ if (savePolicy != ISystemFilterSavePolicies.SAVE_POLICY_NONE)
+ mgr = (SystemFilterPoolReferenceManager)restore(caller, mgrFolder, name, namingPolicy);
+ }
+ catch (Exception exc) // real error trying to restore, versus simply not found.
+ {
+ // todo: something. Log the exception somewhere?
+ }
+ if (mgr == null) // not found or some serious error.
+ {
+ mgr = createManager();
+ }
+ if (mgr != null)
+ {
+ mgr.initialize(caller, mgrFolder, name, savePolicy, namingPolicy, relatedPoolManagerProvider);
+ }
+
+ return mgr;
+ }
+
+ /*
+ * Private helper method.
+ * Uses MOF to create an instance of this class.
+ */
+ protected static SystemFilterPoolReferenceManager createManager()
+ {
+ ISystemFilterPoolReferenceManager mgr = new SystemFilterPoolReferenceManager();
+ // FIXME SystemFilterImpl.initMOF().createSystemFilterPoolReferenceManager();
+ return (SystemFilterPoolReferenceManager)mgr;
+ }
+
+
+
+ /*
+ * Private helper method to initialize state
+ */
+ protected void initialize(ISystemFilterPoolReferenceManagerProvider caller,
+ IFolder folder,
+ String name,
+ int savePolicy,
+ ISystemFilterNamingPolicy namingPolicy,
+ ISystemFilterPoolManagerProvider relatedPoolManagerProvider)
+ {
+ if (!initialized)
+ initialize(caller, folder, name, savePolicy, namingPolicy); // core data
+ //setSystemFilterPoolManagers(relatedPoolManagers);
+ setSystemFilterPoolManagerProvider(relatedPoolManagerProvider);
+ }
+
+ /*
+ * Private helper method to do core initialization.
+ * Might be called from either the static factory method or the static restore method.
+ */
+ protected void initialize(ISystemFilterPoolReferenceManagerProvider caller,
+ IFolder folder,
+ String name,
+ int savePolicy,
+ ISystemFilterNamingPolicy namingPolicy)
+ {
+ this.mgrFolder = folder;
+ setProvider(caller);
+ setName(name);
+ this.savePolicy = savePolicy;
+ setNamingPolicy(namingPolicy);
+ initialized = true;
+ }
+
+ private void invalidateFilterPoolReferencesCache()
+ {
+ fpRefsArray = null;
+ invalidateCache();
+ }
+
+ // ------------------------------------------------------------
+ // Methods for setting and querying attributes
+ // ------------------------------------------------------------
+ /**
+ * Set the associated master pool manager provider. Note the provider
+ * typically manages multiple pool managers and we manage references
+ * across those.
+ */
+ public void setSystemFilterPoolManagerProvider(ISystemFilterPoolManagerProvider poolMgrProvider)
+ {
+ this.poolMgrProvider = poolMgrProvider;
+ }
+ /**
+ * Get the associated master pool manager provider. Note the provider
+ * typically manages multiple pool managers and we manage references
+ * across those.
+ */
+ public ISystemFilterPoolManagerProvider getSystemFilterPoolManagerProvider()
+ {
+ return poolMgrProvider;
+ }
+ /*
+ * Set the managers of the master list of filter pools, from which
+ * objects in this list reference.
+ *
+ public void setSystemFilterPoolManagers(SystemFilterPoolManager[] mgrs)
+ {
+ this.poolMgrs = mgrs;
+ }*/
+
+ /**
+ * Get the managers of the master list of filter pools, from which
+ * objects in this list reference.
+ */
+ public ISystemFilterPoolManager[] getSystemFilterPoolManagers()
+ {
+ //return poolMgrs;
+ return poolMgrProvider.getSystemFilterPoolManagers();
+ }
+ /**
+ * Get the managers of the master list of filter pools, from which
+ * objects in this list reference, but which are not in the list of
+ * managers our pool manager supplier gives us. That is, these are
+ * references to filter pools outside the expected list.
+ */
+ public ISystemFilterPoolManager[] getAdditionalSystemFilterPoolManagers()
+ {
+ ISystemFilterPoolManager[] poolMgrs = getSystemFilterPoolManagers();
+ Vector v = new Vector();
+
+ ISystemFilterPoolReference[] fpRefs = getSystemFilterPoolReferences();
+ for (int idx=0; idx
+ *
+ * @param relatedManagers the filter pool managers that hold filter pools we reference
+ * @param provider the host of this reference manager, so you can later call getProvider
+ * @return A Vector of SystemFilterPoolReferences that were not successfully resolved, or null if all
+ * were resolved.
+ */
+ public Vector resolveReferencesAfterRestore(ISystemFilterPoolManagerProvider relatedPoolMgrProvider,
+ ISystemFilterPoolReferenceManagerProvider provider)
+ {
+ setSystemFilterPoolManagerProvider(relatedPoolMgrProvider); // sets poolMgrs = relatedManagers
+ setProvider(provider);
+ //com.ibm.etools.systems.subsystems.SubSystem ss = (com.ibm.etools.systems.subsystems.SubSystem)provider;
+ //System.out.println("Inside resolveReferencesAfterRestore for subsys " +getName() + " in conn " + ss.getSystemProfile() + "." + ss.getSystemConnection());
+ ISystemFilterPoolManager[] relatedManagers = getSystemFilterPoolManagers();
+ if (relatedManagers != null)
+ {
+ Vector badRefs = new Vector();
+ ISystemFilterPoolReference[] poolRefs = getSystemFilterPoolReferences();
+ if (poolRefs != null)
+ {
+ for (int idx=0; idx+Fu~nduON7JX
r;bLZfQAL-W4~nY}b&0b3{rPZ!xusJ`rmjQFWm3wb$r`;ZObpflG)e2p
literal 0
HcmV?d00001
diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/makeprofileinactive.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/dlcl16/makeprofileinactive.gif
new file mode 100644
index 0000000000000000000000000000000000000000..5299480398ba88aac62d3b7fffd1483b7458d84b
GIT binary patch
literal 388
zcmZ?wbhEHb6krfwxXQqA=-|P>fB*jZ^XK>P-@ktS`u_d
*nI-;@{1{xW&1$zO${uwy?pqulM!z
zys@mp!NLFk{{R30A^8LW0015UEC2ui01yBW000G6peK%GNp@#?q9WU}U6&;AJG=4d
zdb!S
gVgr#m?Z|;_d71)6Uk})!gUh>GbsVgollaj+55d
z+Vk}F^7Hh_&eFrl&Cb-(p&T_V)Dk_4@kw`T6+s^6jv!o~Wdk;M~#Z<=v#8lc=MY
z`uX_6!NK?U_y7O@A^8LW0018VEC2ui01yBW000G9;3tk`X`bDQPN_O})?~G6SKW8p
z?fcg$mrG_t>ktZpRObQFU}(O;QQ2TZeFnfl>8L_GiEx<5BXu}v^wrEkxGC$G$K&?I
WMV$j8f{@&O2n!5?e`IARApkqpY=QIu
literal 0
HcmV?d00001
diff --git a/rse/plugins/org.eclipse.rse.ui/icons/full/dtool16/newfolder_wiz.gif b/rse/plugins/org.eclipse.rse.ui/icons/full/dtool16/newfolder_wiz.gif
new file mode 100644
index 0000000000000000000000000000000000000000..da261845f18d41b4301a6b0add98ecdbb25647ed
GIT binary patch
literal 225
zcmZ?wbhEHb6krfwIKsg2>(`Grub+JW^!C%oHyhT>d;0j!n^%uty?D4{$@GPDCqB4y
z@#V97FP`50@b1Nu`IA>Hp8n|Gl?S&kJbQHW;l1m>ety4q