diff options
Diffstat (limited to 'rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions')
30 files changed, 0 insertions, 6177 deletions
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/ISystemNewFilterActionConfigurator.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/ISystemNewFilterActionConfigurator.java deleted file mode 100644 index b91a306da..000000000 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/ISystemNewFilterActionConfigurator.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************** - * 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.rse.core.subsystems.ISubSystemConfiguration; - -/** - * Sometimes configuring a filter action can take a reasonably substantial amount of - * processing. For this reason, we would desire to defer that configuration, when simply - * filling a popup menu, until such time as the user has select to run the action. This - * reduces time and memory in the vast majority of cases. - * <p> - * 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 deleted file mode 100644 index a28d5c113..000000000 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterAction.java +++ /dev/null @@ -1,252 +0,0 @@ -/******************************************************************************** - * 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.filters.ISystemFilter; -import org.eclipse.rse.core.filters.ISystemFilterPool; -import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider; -import org.eclipse.rse.core.filters.ISystemFilterPoolReference; -import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider; -import org.eclipse.rse.core.filters.ISystemFilterReference; -import org.eclipse.rse.ui.ISystemContextMenuConstants; -import org.eclipse.rse.ui.ISystemIconConstants; -import org.eclipse.rse.ui.RSEUIPlugin; -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, - RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_CHANGEFILTER_ID)); - } - - public SystemChangeFilterAction(Shell parent, String label, String tooltip) - { - this(parent, label, tooltip, RSEUIPlugin.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(RSEUIPlugin.HELPPREFIX+"acfr0000"); //$NON-NLS-1$ - } - - - /** - * Set the help context Id (infoPop) for this action. This must be fully qualified by - * plugin ID. - * <p> - * 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 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. - * <p> - * 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 deleted file mode 100644 index 9473c7686..000000000 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterActionCopyString.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************** - * 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.ui.ISystemContextMenuConstants; -import org.eclipse.rse.ui.RSEUIPlugin; -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(RSEUIPlugin.HELPPREFIX+"dufr2000"); //$NON-NLS-1$ - } - - /** - * 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 deleted file mode 100644 index 9cb0fbf87..000000000 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterActionDeleteString.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************** - * 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.ui.ISystemContextMenuConstants; -import org.eclipse.rse.ui.RSEUIPlugin; -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(RSEUIPlugin.HELPPREFIX+"dufr1000"); //$NON-NLS-1$ - } - - /** - * 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 deleted file mode 100644 index 94703ee8a..000000000 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterActionMoveStringDown.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************** - * 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.ui.ISystemContextMenuConstants; -import org.eclipse.rse.ui.ISystemIconConstants; -import org.eclipse.rse.ui.RSEUIPlugin; -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, - RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_MOVEDOWN_ID), - null); - allowOnMultipleSelection(false); - this.parentDialog = parentDialog; - setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORDER); - setHelp(RSEUIPlugin.HELPPREFIX+"dufr5000"); //$NON-NLS-1$ - } - - /** - * 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 deleted file mode 100644 index 7ed44c481..000000000 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterActionMoveStringUp.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************** - * 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.ui.ISystemContextMenuConstants; -import org.eclipse.rse.ui.ISystemIconConstants; -import org.eclipse.rse.ui.RSEUIPlugin; -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, - RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_MOVEUP_ID), - null); - allowOnMultipleSelection(false); - this.parentDialog = parentDialog; - setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORDER); - setHelp(RSEUIPlugin.HELPPREFIX+"dufr4000"); //$NON-NLS-1$ - } - - /** - * 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 deleted file mode 100644 index c20eede47..000000000 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterActionPasteString.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************** - * 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.ui.ISystemContextMenuConstants; -import org.eclipse.rse.ui.RSEUIPlugin; -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(RSEUIPlugin.HELPPREFIX+"dufr3000"); //$NON-NLS-1$ - } - - /** - * 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 deleted file mode 100644 index c6fe91374..000000000 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterAbstractFilterAction.java +++ /dev/null @@ -1,232 +0,0 @@ -/******************************************************************************** - * 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. - * <p> - * 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. - * <p> - * 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(); - * <p> - * 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. - * <p> - * Only called if user pressed OK on dialog. - * <p> - * @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 deleted file mode 100644 index a6eeb7fa5..000000000 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterAbstractFilterPoolAction.java +++ /dev/null @@ -1,493 +0,0 @@ -/******************************************************************************** - * 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.rse.core.filters.ISystemFilter; -import org.eclipse.rse.core.filters.ISystemFilterPool; -import org.eclipse.rse.core.filters.ISystemFilterPoolManager; -import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider; -import org.eclipse.rse.core.filters.ISystemFilterPoolReference; -import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager; -import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider; -import org.eclipse.rse.core.filters.ISystemFilterReference; -import org.eclipse.rse.core.filters.ISystemFilterString; -import org.eclipse.rse.core.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. - * <p> - * 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. - * <p> - * By default, tries the following in this order: - * <ol> - * <li>calls getFilterPoolManagerProvider if setFilterPoolManagerProvider was called - * <li>uses what was given in setFilterPoolManagers - * <li>uses what was given in setFilterPoolReferenceManager, calling its getSystemFilterPoolManagers - * <li>checks if the current selection is a filterPoolReferenceManager, and if so uses the managers it references from. - * </ol> - */ - public ISystemFilterPoolManager[] getFilterPoolManagers() - { - ISystemFilterPoolManager[] mgrs = null; - ISystemFilterPoolManagerProvider provider = getFilterPoolManagerProvider(); - 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) && (idx<mgrs.length); idx++) - if (mgrs[idx].getName().equals(mgrNamePreselect)) - pos = idx; - } - } - if (pos < 0) - return dlgInputs.mgrSelection; - else - { - //System.out.println("Found a match for mgr name '"+mgrNamePreselect+"' so preselect index is "+pos); - return pos; - } - } - /** - * Set the name of the filter pool manager to pre-select - */ - public void setFilterPoolManagerNamePreSelection(String name) - { - this.mgrNamePreselect = name; - } - - /** - * Set the input filter pool reference manager which is holding the references this - * dialog is allowing the user to select. - * <p> - * If you call this, then this action has everything it needs to know to be fully self-contained. - * It will totally handle updating the reference manager with the user's selections and - * deselections. - */ - public void setFilterPoolReferenceManager(ISystemFilterPoolReferenceManager refManager) - { - dlgInputs.refManager = refManager; - } - /** - * Returns the filter pool reference manager which contains the list of selected filter pools - * that this dialog is showing and allowing the user to change. - * <p> - * 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<mgrElements.length; idx++) - { - //SystemFilterPoolManager mgr = (SystemFilterPoolManager)mgrElements[idx].getData(); - SystemSimpleContentElement[] poolElements = mgrElements[idx].getChildren(); - for (int jdx=0; jdx<poolElements.length; jdx++) - { - //if (poolElements[jdx].isSelected()) - poolElements[jdx].setSelected( - getFilterPoolPreSelection((ISystemFilterPool)poolElements[jdx].getData())); - } - } - } - /** - * Decide per pool if it should be selected or not. - * Default behaviour is to select it if it is currently referenced. - */ - protected boolean getFilterPoolPreSelection(ISystemFilterPool pool) - { - return pool.getReferenceCount() > 0; - } - - /** - * 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. - * <p> - * 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(); - * <p> - * 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. - * <p> - * Only called if user pressed OK on dialog. - * <p> - * @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 deleted file mode 100644 index 8c25200ed..000000000 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterAbstractFilterPoolWizardAction.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************** - * 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 deleted file mode 100644 index 7a6909fd3..000000000 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterAbstractFilterWizardAction.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************** - * 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 deleted file mode 100644 index 3b78fee0d..000000000 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterCascadingNewFilterPoolReferenceAction.java +++ /dev/null @@ -1,135 +0,0 @@ -/******************************************************************************** - * 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.filters.ISystemFilterPoolManager; -import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager; -import org.eclipse.rse.ui.ISystemContextMenuConstants; -import org.eclipse.rse.ui.ISystemIconConstants; -import org.eclipse.rse.ui.RSEUIPlugin; -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, - RSEUIPlugin.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. - * <p> - * 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)); //$NON-NLS-1$ - 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<mgrs.length; idx++) - { - mgr = mgrs[idx]; - if (mgr != defaultMgr) - { - action = new SystemFilterCascadingNewFilterPoolReferenceFPMgrAction(shell, mgr, refMgr); - if (helpId != null) - action.setHelp(helpId); - ourSubMenu.add(action.getSubMenu()); - } - } - } - - /** - * Overridable method from parent that instantiates the menu listener who job is to add mnemonics. - * @param setMnemonicsOnlyOnce true if the menu is static and so mnemonics need only be set once. False if it is dynamic - */ - protected SystemViewMenuListener createMnemonicsListener(boolean setMnemonicsOnlyOnce) - { - return new SystemViewMenuListener(false); // our menu is re-built dynamically each time - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterCascadingNewFilterPoolReferenceFPMgrAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterCascadingNewFilterPoolReferenceFPMgrAction.java deleted file mode 100644 index f414febf3..000000000 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterCascadingNewFilterPoolReferenceFPMgrAction.java +++ /dev/null @@ -1,127 +0,0 @@ -/******************************************************************************** - * 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.filters.ISystemFilterPool; -import org.eclipse.rse.core.filters.ISystemFilterPoolManager; -import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager; -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 submenu action for "New Filter Pool Reference->". - * This is after the first cascade, where we list filter pool managers. - */ -public class SystemFilterCascadingNewFilterPoolReferenceFPMgrAction - extends SystemBaseSubMenuAction - implements IMenuListener -{ - private ISystemFilterPoolManager mgr; - private ISystemFilterPoolReferenceManager refMgr; - - /** - * Constructor. - */ - public SystemFilterCascadingNewFilterPoolReferenceFPMgrAction(Shell shell, - ISystemFilterPoolManager mgr, - ISystemFilterPoolReferenceManager refMgr) - { - super(mgr.getName(),shell); - setCreateMenuEachTime(false); - setPopulateMenuEachTime(false); - this.mgr = mgr; - this.refMgr = refMgr; - } - - /** - * Set the help context Id (infoPop) for this action. This must be fully qualified by - * plugin ID. - * <p> - * 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)); //$NON-NLS-1$ - 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<pools.length; idx++) - { - pool = pools[idx]; - if (!isPoolAlreadyReferenced(pool) && !isPoolConnectionUnique(pool)) - { - action = new SystemFilterPoolReferenceSelectAction(shell,pool,refMgr); - if (helpId != null) - action.setHelp(helpId); - ourSubMenu.add(action); - } - } - } - - /** - * Determine if the given filter pool is already referenced by this reference manager - */ - private boolean isPoolAlreadyReferenced(ISystemFilterPool pool) - { - return refMgr.isSystemFilterPoolReferenced(pool); - } - /** - * Determine if the given filter pool is the special unique pool for a connection. - * If so, we don't want to let anyone else reference it. - */ - private boolean isPoolConnectionUnique(ISystemFilterPool pool) - { - return (pool.getOwningParentName() != null); - } - - /** - * Overridable method from parent that instantiates the menu listener who job is to add mnemonics. - * @param setMnemonicsOnlyOnce true if the menu is static and so mnemonics need only be set once. False if it is dynamic - */ - protected SystemViewMenuListener createMnemonicsListener(boolean setMnemonicsOnlyOnce) - { - return new SystemViewMenuListener(false); // our menu is re-built dynamically each time - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterCopyFilterAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterCopyFilterAction.java deleted file mode 100644 index 1735dbb68..000000000 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterCopyFilterAction.java +++ /dev/null @@ -1,362 +0,0 @@ -/******************************************************************************** - * 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.filters.ISystemFilter; -import org.eclipse.rse.core.filters.ISystemFilterPool; -import org.eclipse.rse.core.filters.ISystemFilterPoolManager; -import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider; -import org.eclipse.rse.core.filters.ISystemFilterReference; -import org.eclipse.rse.core.subsystems.util.ISubSystemConfigurationAdapter; -import org.eclipse.rse.services.clientserver.messages.SystemMessage; -import org.eclipse.rse.ui.ISystemMessages; -import org.eclipse.rse.ui.RSEUIPlugin; -import org.eclipse.rse.ui.SystemResources; -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 SystemFilterCopyFilterAction extends SystemBaseCopyAction -{ - private String promptString = null; - private SystemSimpleContentElement initialSelectionElement = null; - private SystemSimpleContentElement root = null; - - /** - * Constructor - */ - public SystemFilterCopyFilterAction(Shell parent) - { - super(parent, SystemResources.ACTION_COPY_FILTER_LABEL, MODE_COPY); - promptString = SystemResources.RESID_COPY_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. - * <p> - * 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... - * <p> - * @see SystemBaseAction#updateSelection(IStructuredSelection) - */ - public boolean updateSelection(IStructuredSelection selection) - { - boolean enable = true; - /* */ - Iterator e = 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 RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COPYFILTERS_PROGRESS); - } - /** - * @see SystemBaseCopyAction#getCopyingMessage(String) - */ - protected SystemMessage getCopyingMessage(String oldName) - { - return RSEUIPlugin.getPluginMessage(ISystemMessages.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<filters.length; idx++) - names[idx] = filters[idx].getName(); - return names; - } - - /** - * Get the currently selected filters - */ - protected ISystemFilter[] getSelectedFilters() - { - IStructuredSelection selection = getSelection(); - ISystemFilter[] filters = new ISystemFilter[selection.size()]; - Iterator i = selection.iterator(); - int idx=0; - while (i.hasNext()) - { - Object next = i.next(); - if (next instanceof SystemSimpleContentElement) - next = ((SystemSimpleContentElement)next).getData(); - if (next instanceof ISystemFilterReference) - filters[idx++] = ((ISystemFilterReference)next).getReferencedFilter(); - else - filters[idx++] = (ISystemFilter)next; - } - return filters; - } - /** - * Get the first selected filter - */ - protected ISystemFilter getFirstSelectedFilter() - { - Object first = getFirstSelection(); - if (first instanceof SystemSimpleContentElement) - { - root = ((SystemSimpleContentElement)first).getRoot(); - first = ((SystemSimpleContentElement)first).getData(); - } - if (first == null) - return null; - else if (first instanceof ISystemFilterReference) - return ((ISystemFilterReference)first).getReferencedFilter(); - else if (first instanceof ISystemFilter) - return (ISystemFilter)first; - else - return null; - } - - // ------------------ - // PRIVATE METHODS... - // ------------------ - - /** - * Create and return data model to populate selection tree with. - * @param poolMgrProvider The provider who will give us the list of filter pool managers to populate the list with - * @param poolMgr The SystemFilterPoolManager whose tree model element is to be pre-selected - */ - protected SystemSimpleContentElement getPoolMgrTreeModel(ISystemFilterPoolManagerProvider poolMgrProvider, - ISystemFilterPoolManager poolMgr) - { - SystemSimpleContentElement veryRootElement = - new SystemSimpleContentElement("Root", //$NON-NLS-1$ - null, null, (Vector)null); - veryRootElement.setRenamable(false); - veryRootElement.setDeletable(false); - - ISystemFilterPoolManager[] mgrs = poolMgrProvider.getSystemFilterPoolManagers(); - - ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)poolMgrProvider.getAdapter(ISubSystemConfigurationAdapter.class); - ImageDescriptor image = adapter.getSystemFilterPoolManagerImage(); - - if ((mgrs == null) || (mgrs.length == 0)) - return veryRootElement; - - Vector veryRootChildren = new Vector(); - for (int idx=0; idx<mgrs.length; idx++) - { - SystemSimpleContentElement mgrElement = - new SystemSimpleContentElement(mgrs[idx].getName(), - mgrs[idx], veryRootElement, (Vector)null); - mgrElement.setRenamable(false); - mgrElement.setDeletable(false); - mgrElement.setImageDescriptor(image); - - Vector elements = new Vector(); - populateFilterPoolContentElementVector(poolMgrProvider, mgrs[idx], elements, mgrElement); - mgrElement.setChildren(elements); - - veryRootChildren.addElement(mgrElement); - if (mgrs[idx] == poolMgr) - initialSelectionElement = mgrElement; - } - veryRootElement.setChildren(veryRootChildren); - return veryRootElement; - } - - /** - * Populate filter pool manager subtree with filter pools - */ - protected static void populateFilterPoolContentElementVector(ISystemFilterPoolManagerProvider poolMgrProvider, - ISystemFilterPoolManager mgr, - Vector elements, - SystemSimpleContentElement parentElement) - { - //String mgrName = mgr.getName(); - ISystemFilterPool[] pools = mgr.getSystemFilterPools(); - for (int idx=0; idx<pools.length; idx++) - { - ISystemFilterPool pool = pools[idx]; - SystemSimpleContentElement cElement = - new SystemSimpleContentElement(pool.getName(), pool, parentElement, (Vector)null); - cElement.setImageDescriptor(SystemFilterUIHelpers.getFilterPoolImage(poolMgrProvider, pool)); - //cElement.setSelected(setFilterPoolSelection(pool)); - elements.addElement(cElement); - } - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterCopyFilterPoolAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterCopyFilterPoolAction.java deleted file mode 100644 index f8aefe247..000000000 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterCopyFilterPoolAction.java +++ /dev/null @@ -1,323 +0,0 @@ -/******************************************************************************** - * 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.filters.ISystemFilterPool; -import org.eclipse.rse.core.filters.ISystemFilterPoolManager; -import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider; -import org.eclipse.rse.core.filters.ISystemFilterPoolReference; -import org.eclipse.rse.core.subsystems.util.ISubSystemConfigurationAdapter; -import org.eclipse.rse.services.clientserver.messages.SystemMessage; -import org.eclipse.rse.ui.ISystemMessages; -import org.eclipse.rse.ui.RSEUIPlugin; -import org.eclipse.rse.ui.SystemResources; -import org.eclipse.rse.ui.actions.SystemBaseCopyAction; -import org.eclipse.rse.ui.dialogs.SystemRenameSingleDialog; -import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement; -import org.eclipse.swt.widgets.Shell; - - -/** - * Copy a filter pool action. - */ -public class SystemFilterCopyFilterPoolAction extends SystemBaseCopyAction -{ - private String promptString = null; - private SystemSimpleContentElement initialSelectionElement = null; - private SystemSimpleContentElement root = null; - - /** - * Constructor - */ - public SystemFilterCopyFilterPoolAction(Shell parent) - { - super(parent, SystemResources.ACTION_COPY_FILTERPOOL_LABEL, MODE_COPY); - promptString = SystemResources.RESID_COPY_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. - * <p> - * 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... - * <p> - * @see SystemBaseAction#updateSelection(IStructuredSelection) - */ - public boolean updateSelection(IStructuredSelection selection) - { - boolean enable = true; - /* */ - Iterator e= 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 RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COPYFILTERPOOLS_PROGRESS); - } - /** - * @see SystemBaseCopyAction#getCopyingMessage(String) - */ - protected SystemMessage getCopyingMessage(String oldName) - { - return RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COPYFILTERPOOL_PROGRESS).makeSubstitution(oldName); - } - /** - * Return complete message - */ - public SystemMessage getCompletionMessage(Object targetContainer, String[] oldNames, String[] newNames) - { - return RSEUIPlugin.getPluginMessage(ISystemMessages.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<filterPools.length; idx++) - names[idx] = filterPools[idx].getName(); - return names; - } - - /** - * Get the currently selected filter pools - */ - protected ISystemFilterPool[] getSelectedFilterPools() - { - IStructuredSelection selection = getSelection(); - ISystemFilterPool[] filterPools = new ISystemFilterPool[selection.size()]; - Iterator i = selection.iterator(); - int idx=0; - while (i.hasNext()) - { - Object next = i.next(); - if (next instanceof SystemSimpleContentElement) - next = ((SystemSimpleContentElement)next).getData(); - if (next instanceof ISystemFilterPoolReference) - filterPools[idx++] = ((ISystemFilterPoolReference)next).getReferencedFilterPool(); - else - filterPools[idx++] = (ISystemFilterPool)next; - } - return filterPools; - } - /** - * Get the first selected filter pool - */ - protected ISystemFilterPool getFirstSelectedFilterPool() - { - Object first = getFirstSelection(); - if (first instanceof SystemSimpleContentElement) - { - root = ((SystemSimpleContentElement)first).getRoot(); - first = ((SystemSimpleContentElement)first).getData(); - } - if (first == null) - return null; - else if (first instanceof ISystemFilterPoolReference) - return ((ISystemFilterPoolReference)first).getReferencedFilterPool(); - else if (first instanceof ISystemFilterPool) - return (ISystemFilterPool)first; - else - return null; - } - - // ------------------ - // PRIVATE METHODS... - // ------------------ - - /** - * Create and return data model to populate selection tree with. - * @param poolMgrProvider The provider who will give us the list of filter pool managers to populate the list with - * @param poolMgr The SystemFilterPoolManager whose tree model element is to be pre-selected - */ - protected SystemSimpleContentElement getPoolMgrTreeModel(ISystemFilterPoolManagerProvider poolMgrProvider, ISystemFilterPoolManager poolMgr) - { - SystemSimpleContentElement veryRootElement = - new SystemSimpleContentElement("Root", //$NON-NLS-1$ - null, null, (Vector)null); - veryRootElement.setRenamable(false); - veryRootElement.setDeletable(false); - - ISystemFilterPoolManager[] mgrs = poolMgrProvider.getSystemFilterPoolManagers(); - ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)poolMgrProvider.getAdapter(ISubSystemConfigurationAdapter.class); - ImageDescriptor image = adapter.getSystemFilterPoolManagerImage(); - - if ((mgrs == null) || (mgrs.length == 0)) - return veryRootElement; - - Vector veryRootChildren = new Vector(); - for (int idx=0; idx<mgrs.length; idx++) - { - SystemSimpleContentElement mgrElement = - new SystemSimpleContentElement(mgrs[idx].getName(), - mgrs[idx], veryRootElement, (Vector)null); - mgrElement.setRenamable(false); - mgrElement.setDeletable(false); - mgrElement.setImageDescriptor(image); - veryRootChildren.addElement(mgrElement); - if (mgrs[idx] == poolMgr) - initialSelectionElement = mgrElement; - } - veryRootElement.setChildren(veryRootChildren); - return veryRootElement; - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterCopyFilterStringAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterCopyFilterStringAction.java deleted file mode 100644 index de75b4156..000000000 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterCopyFilterStringAction.java +++ /dev/null @@ -1,494 +0,0 @@ -/******************************************************************************** - * 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.filters.ISystemFilter; -import org.eclipse.rse.core.filters.ISystemFilterPool; -import org.eclipse.rse.core.filters.ISystemFilterPoolManager; -import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider; -import org.eclipse.rse.core.filters.ISystemFilterString; -import org.eclipse.rse.core.filters.ISystemFilterStringReference; -import org.eclipse.rse.core.subsystems.util.ISubSystemConfigurationAdapter; -import org.eclipse.rse.services.clientserver.messages.SystemMessage; -import org.eclipse.rse.ui.ISystemMessages; -import org.eclipse.rse.ui.RSEUIPlugin; -import org.eclipse.rse.ui.SystemResources; -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.rse.ui.messages.SystemMessageDialog; -import org.eclipse.rse.ui.validators.ValidatorUniqueString; -import org.eclipse.swt.widgets.Shell; - - -/** - * Copy a filter string action. - */ -public class SystemFilterCopyFilterStringAction extends SystemBaseCopyAction -{ - private String promptString = null; - private SystemSimpleContentElement initialSelectionElement = null; - private SystemSimpleContentElement root = null; - private ISystemFilterString[] strings = null; - - /** - * Constructor - */ - public SystemFilterCopyFilterStringAction(Shell parent) - { - super(parent, SystemResources.ACTION_COPY_FILTERSTRING_LABEL, MODE_COPY); - promptString = SystemResources.RESID_COPY_PROMPT; - } - - /** - * Reset. This is a re-run of this action - */ - protected void reset() - { - super.reset(); - initialSelectionElement = null; - root = null; - strings = null; - } - - /** - * Set the help context Id (infoPop) for this action. This must be fully qualified by - * plugin ID. - * <p> - * 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); - } - - /** - * Overridable method if you support duplicate filter strings in the same filter. - * By default, queries the "supportsDuplicateFilterStrings" attribute in the filter. - */ - protected boolean supportsDuplicateFilterStrings(ISystemFilter filter) - { - return filter.isSupportsDuplicateFilterStrings(); - } - - /** - * We override from parent to do unique checking... - * <p> - * @see SystemBaseAction#updateSelection(IStructuredSelection) - */ - public boolean updateSelection(IStructuredSelection selection) - { - boolean enable = true; - /* */ - Iterator e = 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. - * <p> - * 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. - * <p> - * If you decide to override this, it is your responsibility to issue the error - * message to the user and return false here. - * <p> - * @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 = RSEUIPlugin.getPluginMessage(ISystemMessages.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 RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COPYFILTERSTRINGS_PROGRESS); - } - /** - * @see SystemBaseCopyAction#getCopyingMessage( String) - */ - protected SystemMessage getCopyingMessage(String oldName) - { - return RSEUIPlugin.getPluginMessage(ISystemMessages.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<strings.length; idx++) - names[idx] = strings[idx].getString(); - return names; - } - - /** - * Get the currently selected filter strings - */ - protected ISystemFilterString[] getSelectedFilterStrings() - { - if (strings == null) - { - IStructuredSelection selection = getSelection(); - strings = new ISystemFilterString[selection.size()]; - Iterator i = selection.iterator(); - int idx=0; - while (i.hasNext()) - { - Object next = i.next(); - if (next instanceof SystemSimpleContentElement) - next = ((SystemSimpleContentElement)next).getData(); - if (next instanceof ISystemFilterStringReference) - strings[idx++] = ((ISystemFilterStringReference)next).getReferencedFilterString(); - else - strings[idx++] = (ISystemFilterString)next; - } - } - return strings; - } - /** - * Get the intersection list of filters of currently selected filter strings - */ - protected ISystemFilter[] getSelectedFilters() - { - Vector v = new Vector(); - ISystemFilterString[] strings = getSelectedFilterStrings(); - for (int idx=0; idx<strings.length; idx++) - { - ISystemFilter filter = strings[idx].getParentSystemFilter(); - if (!supportsDuplicateFilterStrings(filter)) - { - if (!containsFilter(v,filter)) - v.addElement(filter); - } - } - ISystemFilter[] filters = new ISystemFilter[v.size()]; - for (int idx=0; idx<v.size(); idx++) - filters[idx] = (ISystemFilter)v.elementAt(idx); - return filters; - } - /** - * Get the first selected filter string - */ - protected ISystemFilterString getFirstSelectedFilterString() - { - Object first = getFirstSelection(); - if (first instanceof SystemSimpleContentElement) - { - root = ((SystemSimpleContentElement)first).getRoot(); - first = ((SystemSimpleContentElement)first).getData(); - } - if (first == null) - return null; - else if (first instanceof ISystemFilterStringReference) - return ((ISystemFilterStringReference)first).getReferencedFilterString(); - else if (first instanceof ISystemFilterString) - return (ISystemFilterString)first; - else - return null; - } - - // ------------------ - // PRIVATE METHODS... - // ------------------ - - /** - * Create and return data model to populate selection tree with. - * @param poolMgrProvider The provider who will give us the list of filter pool managers to populate the list with - * @param poolMgr The SystemFilterPoolManager whose tree model element is to be pre-selected - * @param filtersToExclude All the currently selected filters, which are excluded from the target list - */ - protected SystemSimpleContentElement getPoolMgrTreeModel(ISystemFilterPoolManagerProvider poolMgrProvider, - ISystemFilterPoolManager poolMgr, - ISystemFilter[] filtersToExclude) - { - SystemSimpleContentElement veryRootElement = - new SystemSimpleContentElement("Root", //$NON-NLS-1$ - null, null, (Vector)null); - veryRootElement.setRenamable(false); - veryRootElement.setDeletable(false); - - ISystemFilterPoolManager[] mgrs = poolMgrProvider.getSystemFilterPoolManagers(); - - ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)poolMgrProvider.getAdapter(ISubSystemConfigurationAdapter.class); - ImageDescriptor image = adapter.getSystemFilterPoolManagerImage(); - - if ((mgrs == null) || (mgrs.length == 0)) - return veryRootElement; - - ISystemFilter parentFilter = getFirstSelectedFilterString().getParentSystemFilter(); - ISystemFilterPool parentFilterPool = parentFilter.getParentFilterPool(); - - Vector veryRootChildren = new Vector(); - for (int idx=0; idx<mgrs.length; idx++) - { - SystemSimpleContentElement mgrElement = - new SystemSimpleContentElement(mgrs[idx].getName(), - mgrs[idx], veryRootElement, (Vector)null); - mgrElement.setRenamable(false); - mgrElement.setDeletable(false); - mgrElement.setImageDescriptor(image); - - Vector elements = new Vector(); - populateFilterPoolContentElementVector(poolMgrProvider, mgrs[idx], elements, - mgrElement, filtersToExclude, parentFilterPool, parentFilter); - mgrElement.setChildren(elements); - - veryRootChildren.addElement(mgrElement); - //if (mgrs[idx] == poolMgr) - // initialSelectionElement = mgrElement; - } - veryRootElement.setChildren(veryRootChildren); - return veryRootElement; - } - - /** - * Populate filter pool manager subtree with filter pools - */ - protected void populateFilterPoolContentElementVector(ISystemFilterPoolManagerProvider poolMgrProvider, - ISystemFilterPoolManager mgr, - Vector elements, - SystemSimpleContentElement parentElement, - ISystemFilter[] filtersToExclude, - ISystemFilterPool filterPoolToSelect, - ISystemFilter filterToSelect) - { - ISystemFilterPool[] pools = mgr.getSystemFilterPools(); - for (int idx=0; idx<pools.length; idx++) - { - ISystemFilterPool pool = pools[idx]; - SystemSimpleContentElement cElement = - new SystemSimpleContentElement(pool.getName(), pool, parentElement, (Vector)null); - cElement.setImageDescriptor(SystemFilterUIHelpers.getFilterPoolImage(poolMgrProvider,pool)); - - Vector childElements = new Vector(); - populateFilterContentElementVector(poolMgrProvider, pool, childElements, cElement, filtersToExclude, filterToSelect); - cElement.setChildren(childElements); - - elements.addElement(cElement); - if ((pool == filterPoolToSelect) && (initialSelectionElement==null)) - initialSelectionElement = cElement; - } - } - - /** - * Populate filter pool subtree with filters - */ - protected void populateFilterContentElementVector(ISystemFilterPoolManagerProvider poolMgrProvider, - ISystemFilterPool pool, - Vector elements, - SystemSimpleContentElement parentElement, - ISystemFilter[] filtersToExclude, - ISystemFilter filterToSelect) - { - ISystemFilter[] filters = pool.getSystemFilters(); - for (int idx=0; idx<filters.length; idx++) - { - ISystemFilter filter = filters[idx]; - if (!filter.isNonChangable() && !filter.isPromptable() && // defect 43242 - !containsFilter(filtersToExclude,filter)) - { - SystemSimpleContentElement cElement = - new SystemSimpleContentElement(filter.getName(), filter, parentElement, (Vector)null); - cElement.setImageDescriptor(SystemFilterUIHelpers.getFilterImage(poolMgrProvider, filter)); - elements.addElement(cElement); - if (filterToSelect == filter) - initialSelectionElement = cElement; - } - } - } - - private static boolean containsFilter(ISystemFilter[] filters, ISystemFilter filter) - { - ISystemFilter match = null; - for (int idx=0; (match==null) && (idx<filters.length); idx++) - if (filters[idx] == filter) - match = filters[idx]; - return (match != null); - } - public static boolean containsFilter(Vector filters, ISystemFilter filter) - { - ISystemFilter match = null; - for (int idx=0; (match==null) && (idx<filters.size()); idx++) - if (filters.elementAt(idx) == filter) - match = (ISystemFilter)filters.elementAt(idx); - return (match != null); - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterMoveDownFilterAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterMoveDownFilterAction.java deleted file mode 100644 index 79d356051..000000000 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterMoveDownFilterAction.java +++ /dev/null @@ -1,153 +0,0 @@ -/******************************************************************************** - * 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.filters.ISystemFilter; -import org.eclipse.rse.core.filters.ISystemFilterContainer; -import org.eclipse.rse.core.filters.ISystemFilterPoolManager; -import org.eclipse.rse.core.filters.ISystemFilterReference; -import org.eclipse.rse.ui.ISystemContextMenuConstants; -import org.eclipse.rse.ui.ISystemIconConstants; -import org.eclipse.rse.ui.RSEUIPlugin; -import org.eclipse.rse.ui.SystemResources; -import org.eclipse.rse.ui.SystemSortableSelection; -import org.eclipse.rse.ui.actions.SystemBaseAction; -import org.eclipse.swt.widgets.Shell; - - -/** - * The action allows users to move the current filter down in the list - */ -public class SystemFilterMoveDownFilterAction extends SystemBaseAction - -{ - - - /** - * Constructor - */ - public SystemFilterMoveDownFilterAction(Shell parent) - { - super(SystemResources.ACTION_MOVEDOWN_LABEL,SystemResources.ACTION_MOVEDOWN_TOOLTIP, - RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_MOVEDOWN_ID), - parent); - allowOnMultipleSelection(true); - setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORDER); - } - - /** - * Set the help context Id (infoPop) for this action. This must be fully qualified by - * plugin ID. - * <p> - * 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 filters - * come from the same parent - */ - public boolean updateSelection(IStructuredSelection selection) - { - ISystemFilterContainer prevContainer = null; - boolean enable = true; - Iterator e = selection.iterator(); - while (enable && e.hasNext()) - { - Object selectedObject = e.next(); - ISystemFilter filter = getSystemFilter(selectedObject); - if (prevContainer != null) - { - if (prevContainer != filter.getParentFilterContainer()) - enable = false; - else - prevContainer = filter.getParentFilterContainer(); - } - else - prevContainer = filter.getParentFilterContainer(); - if (enable) - enable = checkObjectType(filter); - } - 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) || - (selectedObject instanceof ISystemFilterReference))) - return false; - - ISystemFilter filter = getSystemFilter(selectedObject); - //SystemFilterPoolManager fpMgr = filter.getSystemFilterPoolManager(); - ISystemFilterContainer fpContainer = filter.getParentFilterContainer(); - int pos = fpContainer.getSystemFilterPosition(filter); - return (pos < (fpContainer.getSystemFilterCount()-1)); - } - - private ISystemFilter getSystemFilter(Object selectedObject) - { - if (selectedObject instanceof ISystemFilter) - return (ISystemFilter)selectedObject; - else - return ((ISystemFilterReference)selectedObject).getReferencedFilter(); - } - - /** - * This is the method called when the user selects this action. - * @see org.eclipse.jface.action.Action#run() - */ - public void run() - { - IStructuredSelection selections = getSelection(); - - SystemSortableSelection[] sortableArray = new SystemSortableSelection[selections.size()]; - Iterator i = selections.iterator(); - int idx = 0; - ISystemFilter filter = null; - ISystemFilterContainer fpContainer = null; - while (i.hasNext()) - { - sortableArray[idx] = new SystemSortableSelection(getSystemFilter(i.next())); - filter = (ISystemFilter)sortableArray[idx].getSelectedObject(); - fpContainer = filter.getParentFilterContainer(); - sortableArray[idx].setPosition(fpContainer.getSystemFilterPosition(filter)); - idx++; - } - SystemSortableSelection.sortArray(sortableArray); - ISystemFilter[] filters = (ISystemFilter[])SystemSortableSelection.getSortedObjects(sortableArray, new ISystemFilter[sortableArray.length]); - - if (idx>0) - { - ISystemFilterPoolManager fpMgr = filters[0].getSystemFilterPoolManager(); - try { - fpMgr.moveSystemFilters(filters,1); - } catch (Exception exc) - { - } - } - } -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterMoveDownFilterPoolReferenceAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterMoveDownFilterPoolReferenceAction.java deleted file mode 100644 index ce5918e64..000000000 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterMoveDownFilterPoolReferenceAction.java +++ /dev/null @@ -1,141 +0,0 @@ -/******************************************************************************** - * 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.filters.ISystemFilterPoolReference; -import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager; -import org.eclipse.rse.ui.ISystemContextMenuConstants; -import org.eclipse.rse.ui.ISystemIconConstants; -import org.eclipse.rse.ui.RSEUIPlugin; -import org.eclipse.rse.ui.SystemResources; -import org.eclipse.rse.ui.SystemSortableSelection; -import org.eclipse.rse.ui.actions.SystemBaseAction; -import org.eclipse.swt.widgets.Shell; - - -/** - * The action allows users to move the current filter down in the list - */ -public class SystemFilterMoveDownFilterPoolReferenceAction extends SystemBaseAction - -{ - - - /** - * Constructor - */ - public SystemFilterMoveDownFilterPoolReferenceAction(Shell parent) - { - super(SystemResources.ACTION_MOVEDOWN_LABEL,SystemResources.ACTION_MOVEDOWN_TOOLTIP, - RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_MOVEDOWN_ID), - parent); - allowOnMultipleSelection(true); - setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORDER); - } - - /** - * Set the help context Id (infoPop) for this action. This must be fully qualified by - * plugin ID. - * <p> - * 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 = 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(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 deleted file mode 100644 index 91a83acea..000000000 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterMoveFilterAction.java +++ /dev/null @@ -1,370 +0,0 @@ -/******************************************************************************** - * 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.filters.ISystemFilter; -import org.eclipse.rse.core.filters.ISystemFilterPool; -import org.eclipse.rse.core.filters.ISystemFilterPoolManager; -import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider; -import org.eclipse.rse.core.filters.ISystemFilterReference; -import org.eclipse.rse.core.subsystems.util.ISubSystemConfigurationAdapter; -import org.eclipse.rse.services.clientserver.messages.SystemMessage; -import org.eclipse.rse.ui.ISystemMessages; -import org.eclipse.rse.ui.RSEUIPlugin; -import org.eclipse.rse.ui.SystemResources; -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 -{ - 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. - * <p> - * 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... - * <p> - * @see SystemBaseAction#updateSelection(IStructuredSelection) - */ - public boolean updateSelection(IStructuredSelection selection) - { - boolean enable = true; - /* */ - Iterator e= 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 RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_MOVEFILTERS_PROGRESS); - } - /** - * @see SystemBaseCopyAction#getCopyingMessage( String) - */ - protected SystemMessage getCopyingMessage(String oldName) - { - return RSEUIPlugin.getPluginMessage(ISystemMessages.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<filters.length; idx++) - names[idx] = filters[idx].getName(); - return names; - } - - /** - * Get the currently selected filters - */ - protected ISystemFilter[] getSelectedFilters() - { - IStructuredSelection selection = getSelection(); - ISystemFilter[] filters = new ISystemFilter[selection.size()]; - Iterator i = selection.iterator(); - int idx=0; - while (i.hasNext()) - { - Object next = i.next(); - if (next instanceof SystemSimpleContentElement) - next = ((SystemSimpleContentElement)next).getData(); - if (next instanceof ISystemFilterReference) - filters[idx++] = ((ISystemFilterReference)next).getReferencedFilter(); - else - filters[idx++] = (ISystemFilter)next; - } - return filters; - } - /** - * Get the first selected filter - */ - protected ISystemFilter getFirstSelectedFilter() - { - Object first = getFirstSelection(); - if (first instanceof SystemSimpleContentElement) - { - root = ((SystemSimpleContentElement)first).getRoot(); - first = ((SystemSimpleContentElement)first).getData(); - } - if (first == null) - return null; - else if (first instanceof ISystemFilterReference) - return ((ISystemFilterReference)first).getReferencedFilter(); - else if (first instanceof ISystemFilter) - return (ISystemFilter)first; - else - return null; - } - - // ------------------ - // PRIVATE METHODS... - // ------------------ - - /** - * Create and return data model to populate selection tree with. - * @param poolMgrProvider The provider who will give us the list of filter pool managers to populate the list with - * @param poolMgr The SystemFilterPoolManager whose tree model element is to be pre-selected - * @param pool The SystemFilterPool whose tree model element is to be excluded - */ - protected SystemSimpleContentElement getPoolMgrTreeModel(ISystemFilterPoolManagerProvider poolMgrProvider, - ISystemFilterPoolManager poolMgr, - ISystemFilterPool pool) - { - SystemSimpleContentElement veryRootElement = - new SystemSimpleContentElement("Root", //$NON-NLS-1$ - null, null, (Vector)null); - veryRootElement.setRenamable(false); - veryRootElement.setDeletable(false); - - ISystemFilterPoolManager[] mgrs = poolMgrProvider.getSystemFilterPoolManagers(); - - ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)poolMgrProvider.getAdapter(ISubSystemConfigurationAdapter.class); - ImageDescriptor image = adapter.getSystemFilterPoolManagerImage(); - - if ((mgrs == null) || (mgrs.length == 0)) - return veryRootElement; - - Vector veryRootChildren = new Vector(); - for (int idx=0; idx<mgrs.length; idx++) - { - SystemSimpleContentElement mgrElement = - new SystemSimpleContentElement(mgrs[idx].getName(), - mgrs[idx], veryRootElement, (Vector)null); - mgrElement.setRenamable(false); - mgrElement.setDeletable(false); - mgrElement.setImageDescriptor(image); - - Vector elements = new Vector(); - populateFilterPoolContentElementVector(poolMgrProvider, mgrs[idx], elements, mgrElement, pool); - mgrElement.setChildren(elements); - - if (mgrs[idx] == poolMgr) - initialSelectionElement = mgrElement; - - veryRootChildren.addElement(mgrElement); - } - veryRootElement.setChildren(veryRootChildren); - return veryRootElement; - } - - /** - * Populate filter pool manager subtree with filter pools - */ - protected static void populateFilterPoolContentElementVector(ISystemFilterPoolManagerProvider poolMgrProvider, - ISystemFilterPoolManager mgr, - Vector elements, - SystemSimpleContentElement parentElement, - ISystemFilterPool poolToExclude) - { - ISystemFilterPool[] pools = mgr.getSystemFilterPools(); - for (int idx=0; idx<pools.length; idx++) - { - ISystemFilterPool pool = pools[idx]; - if (pool != poolToExclude) - { - SystemSimpleContentElement cElement = - new SystemSimpleContentElement(pool.getName(), pool, parentElement, (Vector)null); - cElement.setImageDescriptor(SystemFilterUIHelpers.getFilterPoolImage(poolMgrProvider, pool)); - //cElement.setSelected(setFilterPoolSelection(pool)); - elements.addElement(cElement); - } - } - } - - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterMoveFilterPoolAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterMoveFilterPoolAction.java deleted file mode 100644 index 48ee535b3..000000000 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterMoveFilterPoolAction.java +++ /dev/null @@ -1,369 +0,0 @@ -/******************************************************************************** - * 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.filters.ISystemFilterPool; -import org.eclipse.rse.core.filters.ISystemFilterPoolManager; -import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider; -import org.eclipse.rse.core.filters.ISystemFilterPoolReference; -import org.eclipse.rse.core.subsystems.util.ISubSystemConfigurationAdapter; -import org.eclipse.rse.services.clientserver.messages.SystemMessage; -import org.eclipse.rse.ui.ISystemMessages; -import org.eclipse.rse.ui.RSEUIPlugin; -import org.eclipse.rse.ui.SystemResources; -import org.eclipse.rse.ui.actions.SystemBaseCopyAction; -import org.eclipse.rse.ui.dialogs.SystemRenameSingleDialog; -import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement; -import org.eclipse.swt.widgets.Shell; - - -/** - * Move a filter pool action. - */ -public class SystemFilterMoveFilterPoolAction extends SystemBaseCopyAction -{ - private String promptString = null; - private SystemSimpleContentElement initialSelectionElement = null; - private SystemSimpleContentElement root = null; - - /** - * Constructor - */ - public SystemFilterMoveFilterPoolAction(Shell parent) - { - super(parent, SystemResources.ACTION_MOVE_FILTERPOOL_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. - * <p> - * 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... - * <p> - * We intercept to ensure only filterpools from the same filterpool manager are selected. - * <p> - * @see SystemBaseAction#updateSelection(IStructuredSelection) - */ - public boolean updateSelection(IStructuredSelection selection) - { - boolean enable = true; - /* */ - Iterator e = 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 RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_MOVEFILTERPOOLS_PROGRESS); - } - /** - * @see SystemBaseCopyAction#getCopyingMessage( String) - */ - protected SystemMessage getCopyingMessage(String oldName) - { - return RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_MOVEFILTERPOOL_PROGRESS).makeSubstitution(oldName); - } - /** - * Return complete message - */ - public SystemMessage getCompletionMessage(Object targetContainer, String[] oldNames, String[] newNames) - { - return RSEUIPlugin.getPluginMessage(ISystemMessages.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<filterPools.length; idx++) - names[idx] = filterPools[idx].getName(); - return names; - } - - /** - * Get the currently selected filter pools - */ - protected ISystemFilterPool[] getSelectedFilterPools() - { - IStructuredSelection selection = getSelection(); - ISystemFilterPool[] filterPools = new ISystemFilterPool[selection.size()]; - Iterator i = selection.iterator(); - int idx=0; - while (i.hasNext()) - { - Object next = i.next(); - if (next instanceof SystemSimpleContentElement) - next = ((SystemSimpleContentElement)next).getData(); - if (next instanceof ISystemFilterPoolReference) - filterPools[idx++] = ((ISystemFilterPoolReference)next).getReferencedFilterPool(); - else - filterPools[idx++] = (ISystemFilterPool)next; - } - return filterPools; - } - /** - * Get the managers of the currently selected filter pools - */ - protected ISystemFilterPoolManager[] getSelectedFilterPoolManagers() - { - ISystemFilterPoolManager[] mgrs = null; - Vector v = new Vector(); - ISystemFilterPool[] pools = getSelectedFilterPools(); - for (int idx=0; idx<pools.length; idx++) - { - ISystemFilterPoolManager mgr = pools[idx].getSystemFilterPoolManager(); - if (!v.contains(mgr)) - v.addElement(mgr); - } - - mgrs = new ISystemFilterPoolManager[v.size()]; - for (int idx=0; idx<mgrs.length; idx++) - mgrs[idx] = (ISystemFilterPoolManager)v.elementAt(idx); - - return mgrs; - } - - /** - * Get the first selected filter pool - */ - protected ISystemFilterPool getFirstSelectedFilterPool() - { - Object first = getFirstSelection(); - if (first instanceof SystemSimpleContentElement) - { - root = ((SystemSimpleContentElement)first).getRoot(); - first = ((SystemSimpleContentElement)first).getData(); - } - if (first == null) - return null; - else if (first instanceof ISystemFilterPoolReference) - return ((ISystemFilterPoolReference)first).getReferencedFilterPool(); - else if (first instanceof ISystemFilterPool) - return (ISystemFilterPool)first; - else - return null; - } - - // ------------------ - // PRIVATE METHODS... - // ------------------ - - /** - * Create and return data model to populate selection tree with. - * @param poolMgrProvider The provider who will give us the list of filter pool managers to populate the list with - * @param poolMgr The current SystemFilterPoolManager which is to be excluded from the list. - */ - protected SystemSimpleContentElement getPoolMgrTreeModel(ISystemFilterPoolManagerProvider poolMgrProvider, ISystemFilterPoolManager poolMgr) - { - SystemSimpleContentElement veryRootElement = - new SystemSimpleContentElement("Root", //$NON-NLS-1$ - null, null, (Vector)null); - veryRootElement.setRenamable(false); - veryRootElement.setDeletable(false); - - ISystemFilterPoolManager[] mgrs = poolMgrProvider.getSystemFilterPoolManagers(); - - ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)poolMgrProvider.getAdapter(ISubSystemConfigurationAdapter.class); - ImageDescriptor image = adapter.getSystemFilterPoolManagerImage(); - - if ((mgrs == null) || (mgrs.length == 0)) - return veryRootElement; - - Vector veryRootChildren = new Vector(); - for (int idx=0; idx<mgrs.length; idx++) - { - if (mgrs[idx] != poolMgr) - { - SystemSimpleContentElement mgrElement = - new SystemSimpleContentElement(mgrs[idx].getName(), - mgrs[idx], veryRootElement, (Vector)null); - mgrElement.setRenamable(false); - mgrElement.setDeletable(false); - mgrElement.setImageDescriptor(image); - veryRootChildren.addElement(mgrElement); - if (initialSelectionElement == null) - initialSelectionElement = mgrElement; - } - } - veryRootElement.setChildren(veryRootChildren); - return veryRootElement; - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterMoveFilterStringAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterMoveFilterStringAction.java deleted file mode 100644 index cdfab0187..000000000 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterMoveFilterStringAction.java +++ /dev/null @@ -1,485 +0,0 @@ -/******************************************************************************** - * 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.filters.ISystemFilter; -import org.eclipse.rse.core.filters.ISystemFilterPool; -import org.eclipse.rse.core.filters.ISystemFilterPoolManager; -import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider; -import org.eclipse.rse.core.filters.ISystemFilterString; -import org.eclipse.rse.core.filters.ISystemFilterStringReference; -import org.eclipse.rse.core.subsystems.util.ISubSystemConfigurationAdapter; -import org.eclipse.rse.services.clientserver.messages.SystemMessage; -import org.eclipse.rse.ui.ISystemMessages; -import org.eclipse.rse.ui.RSEUIPlugin; -import org.eclipse.rse.ui.SystemResources; -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.rse.ui.messages.SystemMessageDialog; -import org.eclipse.rse.ui.validators.ValidatorUniqueString; -import org.eclipse.swt.widgets.Shell; - - -/** - * Move a filter string action. - */ -public class SystemFilterMoveFilterStringAction extends SystemBaseCopyAction -{ - private String promptString = null; - private SystemSimpleContentElement initialSelectionElement = null; - private SystemSimpleContentElement root = null; - private ISystemFilterString[] strings = null; - - /** - * Constructor - */ - public SystemFilterMoveFilterStringAction(Shell parent) - { - super(parent, SystemResources.ACTION_MOVE_FILTERSTRING_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; - strings = null; - } - - /** - * Set the help context Id (infoPop) for this action. This must be fully qualified by - * plugin ID. - * <p> - * 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); - } - - /** - * Overridable method if you support duplicate filter strings in the same filter. - * By default, queries the "supportsDuplicateFilterStrings" attribute in the filter. - */ - protected boolean supportsDuplicateFilterStrings(ISystemFilter filter) - { - return filter.isSupportsDuplicateFilterStrings(); - } - - /** - * We override from parent to do unique checking... - * <p> - * @see SystemBaseAction#updateSelection(IStructuredSelection) - */ - public boolean updateSelection(IStructuredSelection selection) - { - boolean enable = true; - /* */ - Iterator e= 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. - * <p> - * 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. - * <p> - * If you decide to override this, it is your responsibility to issue the error - * message to the user and return false here. - * <p> - * @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 = RSEUIPlugin.getPluginMessage(ISystemMessages.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 RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_MOVEFILTERSTRINGS_PROGRESS); - } - /** - * @see SystemBaseCopyAction#getCopyingMessage( String) - */ - protected SystemMessage getCopyingMessage(String oldName) - { - return RSEUIPlugin.getPluginMessage(ISystemMessages.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<strings.length; idx++) - names[idx] = strings[idx].getString(); - return names; - } - - /** - * Get the currently selected filter strings - */ - protected ISystemFilterString[] getSelectedFilterStrings() - { - if (strings == null) - { - IStructuredSelection selection = getSelection(); - strings = new ISystemFilterString[selection.size()]; - Iterator i = selection.iterator(); - int idx=0; - while (i.hasNext()) - { - Object next = i.next(); - if (next instanceof SystemSimpleContentElement) - next = ((SystemSimpleContentElement)next).getData(); - if (next instanceof ISystemFilterStringReference) - strings[idx++] = ((ISystemFilterStringReference)next).getReferencedFilterString(); - else - strings[idx++] = (ISystemFilterString)next; - } - } - return strings; - } - /** - * Get the intersection list of filters of currently selected filter strings - */ - protected ISystemFilter[] getSelectedFilters() - { - Vector v = new Vector(); - ISystemFilterString[] strings = getSelectedFilterStrings(); - for (int idx=0; idx<strings.length; idx++) - { - ISystemFilter filter = strings[idx].getParentSystemFilter(); - if (!supportsDuplicateFilterStrings(filter) && - !SystemFilterCopyFilterStringAction.containsFilter(v,filter)) - v.addElement(filter); - } - ISystemFilter[] filters = new ISystemFilter[v.size()]; - for (int idx=0; idx<v.size(); idx++) - filters[idx] = (ISystemFilter)v.elementAt(idx); - return filters; - } - /** - * Get the first selected filter string - */ - protected ISystemFilterString getFirstSelectedFilterString() - { - Object first = getFirstSelection(); - if (first instanceof SystemSimpleContentElement) - { - root = ((SystemSimpleContentElement)first).getRoot(); - first = ((SystemSimpleContentElement)first).getData(); - } - if (first == null) - return null; - else if (first instanceof ISystemFilterStringReference) - return ((ISystemFilterStringReference)first).getReferencedFilterString(); - else if (first instanceof ISystemFilterString) - return (ISystemFilterString)first; - else - return null; - } - - // ------------------ - // PRIVATE METHODS... - // ------------------ - - /** - * Create and return data model to populate selection tree with. - * @param poolMgrProvider The provider who will give us the list of filter pool managers to populate the list with - * @param poolMgr The SystemFilterPoolManager whose tree model element is to be pre-selected - * @param filtersToExclude All the currently selected filters, which are excluded from the target list - */ - protected SystemSimpleContentElement getPoolMgrTreeModel(ISystemFilterPoolManagerProvider poolMgrProvider, - ISystemFilterPoolManager poolMgr, - ISystemFilter[] filtersToExclude) - { - SystemSimpleContentElement veryRootElement = - new SystemSimpleContentElement("Root", //$NON-NLS-1$ - null, null, (Vector)null); - veryRootElement.setRenamable(false); - veryRootElement.setDeletable(false); - - ISystemFilterPoolManager[] mgrs = poolMgrProvider.getSystemFilterPoolManagers(); - - ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)poolMgrProvider.getAdapter(ISubSystemConfigurationAdapter.class); - ImageDescriptor image = adapter.getSystemFilterPoolManagerImage(); - - if ((mgrs == null) || (mgrs.length == 0)) - return veryRootElement; - - ISystemFilter parentFilter = getFirstSelectedFilterString().getParentSystemFilter(); - ISystemFilterPool parentFilterPool = parentFilter.getParentFilterPool(); - - Vector veryRootChildren = new Vector(); - for (int idx=0; idx<mgrs.length; idx++) - { - SystemSimpleContentElement mgrElement = - new SystemSimpleContentElement(mgrs[idx].getName(), - mgrs[idx], veryRootElement, (Vector)null); - mgrElement.setRenamable(false); - mgrElement.setDeletable(false); - mgrElement.setImageDescriptor(image); - - Vector elements = new Vector(); - populateFilterPoolContentElementVector(poolMgrProvider, mgrs[idx], elements, - mgrElement, filtersToExclude, - parentFilterPool, parentFilter); - mgrElement.setChildren(elements); - - veryRootChildren.addElement(mgrElement); - //if (mgrs[idx] == poolMgr) - //initialSelectionElement = mgrElement; - } - veryRootElement.setChildren(veryRootChildren); - return veryRootElement; - } - - /** - * Populate filter pool manager subtree with filter pools - */ - protected void populateFilterPoolContentElementVector(ISystemFilterPoolManagerProvider poolMgrProvider, - ISystemFilterPoolManager mgr, - Vector elements, - SystemSimpleContentElement parentElement, - ISystemFilter[] filtersToExclude, - ISystemFilterPool filterPoolToSelect, - ISystemFilter filterToSelect) - { - ISystemFilterPool[] pools = mgr.getSystemFilterPools(); - for (int idx=0; idx<pools.length; idx++) - { - ISystemFilterPool pool = pools[idx]; - SystemSimpleContentElement cElement = - new SystemSimpleContentElement(pool.getName(), pool, parentElement, (Vector)null); - cElement.setImageDescriptor(SystemFilterUIHelpers.getFilterPoolImage(poolMgrProvider,pool)); - - Vector childElements = new Vector(); - populateFilterContentElementVector(poolMgrProvider, pool, childElements, cElement, filtersToExclude, filterToSelect); - cElement.setChildren(childElements); - - elements.addElement(cElement); - if ((pool == filterPoolToSelect) && (initialSelectionElement==null)) - initialSelectionElement = cElement; - } - } - - /** - * Populate filter pool subtree with filters - */ - protected void populateFilterContentElementVector(ISystemFilterPoolManagerProvider poolMgrProvider, - ISystemFilterPool pool, - Vector elements, - SystemSimpleContentElement parentElement, - ISystemFilter[] filtersToExclude, - ISystemFilter filterToSelect) - { - ISystemFilter[] filters = pool.getSystemFilters(); - for (int idx=0; idx<filters.length; idx++) - { - ISystemFilter filter = filters[idx]; - if (!filter.isNonChangable() && !filter.isPromptable() && // defect 43242 - !containsFilter(filtersToExclude,filter)) - { - SystemSimpleContentElement cElement = - new SystemSimpleContentElement(filter.getName(), filter, parentElement, (Vector)null); - cElement.setImageDescriptor(SystemFilterUIHelpers.getFilterImage(poolMgrProvider,filter)); - elements.addElement(cElement); - if (filter == filterToSelect) - initialSelectionElement = cElement; - } - } - } - - private boolean containsFilter(ISystemFilter[] filters, ISystemFilter filter) - { - ISystemFilter match = null; - for (int idx=0; (match==null) && (idx<filters.length); idx++) - if (filters[idx] == filter) - match = filters[idx]; - return (match != null); - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterMoveUpFilterAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterMoveUpFilterAction.java deleted file mode 100644 index c261ff9be..000000000 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterMoveUpFilterAction.java +++ /dev/null @@ -1,156 +0,0 @@ -/******************************************************************************** - * 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.filters.ISystemFilter; -import org.eclipse.rse.core.filters.ISystemFilterContainer; -import org.eclipse.rse.core.filters.ISystemFilterPoolManager; -import org.eclipse.rse.core.filters.ISystemFilterReference; -import org.eclipse.rse.ui.ISystemContextMenuConstants; -import org.eclipse.rse.ui.ISystemIconConstants; -import org.eclipse.rse.ui.RSEUIPlugin; -import org.eclipse.rse.ui.SystemResources; -import org.eclipse.rse.ui.SystemSortableSelection; -import org.eclipse.rse.ui.actions.SystemBaseAction; -import org.eclipse.swt.widgets.Shell; - - -/** - * The action allows users to move the current filter up in the list - */ -public class SystemFilterMoveUpFilterAction extends SystemBaseAction - -{ - - /** - * Constructor - */ - public SystemFilterMoveUpFilterAction(Shell parent) - { - super(SystemResources.ACTION_MOVEUP_LABEL,SystemResources.ACTION_MOVEUP_TOOLTIP, - RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_MOVEUP_ID), - parent); - allowOnMultipleSelection(true); - setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORDER); - } - - /** - * Set the help context Id (infoPop) for this action. This must be fully qualified by - * plugin ID. - * <p> - * 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 filters - * come from the same parent - */ - public boolean updateSelection(IStructuredSelection selection) - { - ISystemFilterContainer prevContainer = null; - boolean enable = true; - Iterator e = selection.iterator(); - while (enable && e.hasNext()) - { - Object selectedObject = e.next(); - ISystemFilter filter = getSystemFilter(selectedObject); - if (prevContainer != null) - { - if (prevContainer != filter.getParentFilterContainer()) - enable = false; - else - prevContainer = filter.getParentFilterContainer(); - } - else - prevContainer = filter.getParentFilterContainer(); - if (enable) - enable = checkObjectType(filter); - } - 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) || - (selectedObject instanceof ISystemFilterReference))) - return false; - ISystemFilter filter = getSystemFilter(selectedObject); - ISystemFilterContainer fpContainer = filter.getParentFilterContainer(); - int pos = fpContainer.getSystemFilterPosition(filter); - return (pos>0); - } - - private ISystemFilter getSystemFilter(Object selectedObject) - { - if (selectedObject instanceof ISystemFilter) - return (ISystemFilter)selectedObject; - else - return ((ISystemFilterReference)selectedObject).getReferencedFilter(); - } - - /** - * This is the method called when the user selects this action. - * @see org.eclipse.jface.action.Action#run() - */ - public void run() - { - IStructuredSelection selections = getSelection(); - //SystemFilter filters[] = new SystemFilter[selections.size()]; - //Iterator i = selections.iterator(); - //int idx = 0; - //while (i.hasNext()) - //filters[idx++] = getSystemFilter(i.next()); - - SystemSortableSelection[] sortableArray = new SystemSortableSelection[selections.size()]; - Iterator i = selections.iterator(); - int idx = 0; - ISystemFilter filter = null; - ISystemFilterContainer fpContainer = null; - while (i.hasNext()) - { - sortableArray[idx] = new SystemSortableSelection(getSystemFilter(i.next())); - filter = (ISystemFilter)sortableArray[idx].getSelectedObject(); - fpContainer = filter.getParentFilterContainer(); - sortableArray[idx].setPosition(fpContainer.getSystemFilterPosition(filter)); - idx++; - } - SystemSortableSelection.sortArray(sortableArray); - ISystemFilter[] filters = (ISystemFilter[])SystemSortableSelection.getSortedObjects(sortableArray, new ISystemFilter[sortableArray.length]); - - if (idx>0) - { - ISystemFilterPoolManager fpMgr = filters[0].getSystemFilterPoolManager(); - try { - //System.out.println("In SystemFilterMoveUpFilterAction#run(). Calling mgr.moveSystemFilters"); - fpMgr.moveSystemFilters(filters,-1); - } catch (Exception exc) - { - } - } - } -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterMoveUpFilterPoolReferenceAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterMoveUpFilterPoolReferenceAction.java deleted file mode 100644 index 530b4a8b3..000000000 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterMoveUpFilterPoolReferenceAction.java +++ /dev/null @@ -1,141 +0,0 @@ -/******************************************************************************** - * 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.filters.ISystemFilterPoolReference; -import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager; -import org.eclipse.rse.ui.ISystemContextMenuConstants; -import org.eclipse.rse.ui.ISystemIconConstants; -import org.eclipse.rse.ui.RSEUIPlugin; -import org.eclipse.rse.ui.SystemResources; -import org.eclipse.rse.ui.SystemSortableSelection; -import org.eclipse.rse.ui.actions.SystemBaseAction; -import org.eclipse.swt.widgets.Shell; - - -/** - * The action allows users to move the current filter pool reference up in the list - */ -public class SystemFilterMoveUpFilterPoolReferenceAction extends SystemBaseAction - -{ - - - /** - * Constructor - */ - public SystemFilterMoveUpFilterPoolReferenceAction(Shell parent) - { - super(SystemResources.ACTION_MOVEUP_LABEL,SystemResources.ACTION_MOVEUP_TOOLTIP, - RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_MOVEUP_ID), - parent); - allowOnMultipleSelection(true); - setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORDER); - } - - /** - * Set the help context Id (infoPop) for this action. This must be fully qualified by - * plugin ID. - * <p> - * 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 = 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(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 deleted file mode 100644 index 0f62994ba..000000000 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterNewFilterPoolAction.java +++ /dev/null @@ -1,174 +0,0 @@ -/******************************************************************************** - * 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.filters.ISystemFilterPool; -import org.eclipse.rse.core.filters.ISystemFilterPoolManager; -import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager; -import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider; -import org.eclipse.rse.ui.ISystemContextMenuConstants; -import org.eclipse.rse.ui.ISystemIconConstants; -import org.eclipse.rse.ui.RSEUIPlugin; -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, - RSEUIPlugin.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 deleted file mode 100644 index 3abff83f2..000000000 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterPoolReferenceSelectAction.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************** - * 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.filters.ISystemFilterPool; -import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager; -import org.eclipse.rse.ui.ISystemIconConstants; -import org.eclipse.rse.ui.RSEUIPlugin; -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(), RSEUIPlugin.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. - * <p> - * 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); //$NON-NLS-1$ - } - } -}
\ 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 deleted file mode 100644 index 59256745e..000000000 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterRemoveFilterPoolReferenceAction.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************** - * 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.filters.ISystemFilterPoolReference; -import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager; -import org.eclipse.rse.ui.ISystemContextMenuConstants; -import org.eclipse.rse.ui.ISystemIconConstants; -import org.eclipse.rse.ui.RSEUIPlugin; -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, - RSEUIPlugin.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. - * <p> - * 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(); - 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 deleted file mode 100644 index c4450b067..000000000 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterSelectFilterPoolsAction.java +++ /dev/null @@ -1,268 +0,0 @@ -/******************************************************************************** - * 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.filters.ISystemFilterPool; -import org.eclipse.rse.core.filters.ISystemFilterPoolManager; -import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager; -import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider; -import org.eclipse.rse.ui.ISystemContextMenuConstants; -import org.eclipse.rse.ui.ISystemIconConstants; -import org.eclipse.rse.ui.RSEUIPlugin; -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. - * <p> - * 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. - * <p> - * Uses getName() on manager for display name of root nodes. - * <p> - * 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. - * - * <p> - * You call the setFilterPoolManagers method to set the array of filter pool managers - * this dialog allows the user to select from. - * <p> - * If you also call the optional method setFilterPoolReferenceManager, you need not - * subclass this action. It will handle everything for you!! - * <ul - * <li>Preselects the filter pools currently referenced by one or more reference objects - * in the filter pool reference manager. - * <li>What OK is pressed, removes the previous references from the reference manager, - * and adds references for the pools selected by the user. - * </ul> - * - * 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, - RSEUIPlugin.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(RSEUIPlugin.HELPPREFIX + "actn0043"); //$NON-NLS-1$ - setDialogHelp(RSEUIPlugin.HELPPREFIX + "dsfp0000"); //$NON-NLS-1$ - } - /** - * 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(RSEUIPlugin.HELPPREFIX + "actn0043"); //$NON-NLS-1$ - setDialogHelp(RSEUIPlugin.HELPPREFIX + "dsfp0000"); //$NON-NLS-1$ - } - - - /** - * 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(RSEUIPlugin.HELPPREFIX + "actn0043"); //$NON-NLS-1$ - setDialogHelp(RSEUIPlugin.HELPPREFIX + "dsfp0000"); //$NON-NLS-1$ - } - - - /** - * 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. - * <p> - * <i>Assumes setFilterPoolManagers has been called.</i> - * <p> - * 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. - * <p> - * 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<mgrs.length; idx++) - allmgrs[allidx++] = mgrs[idx]; - for (int idx=0; idx<additionalMgrs.length; idx++) - allmgrs[allidx++] = additionalMgrs[idx]; - mgrs = allmgrs; - } - - SystemSimpleContentElement input = - SystemFilterUIHelpers.getFilterPoolModel(getFilterPoolManagerProvider(), mgrs); - preSelect(input); - setValue(input); - - if (sprmp != null) - { - ISystemFilterPoolManager initialSelection = sprmp.getSystemFilterPoolReferenceManager().getDefaultSystemFilterPoolManager(); - if (initialSelection != null) - { - SystemSimpleContentElement initialElementSelection = SystemFilterUIHelpers.getDataElement(input, initialSelection); - if (initialElementSelection != null) - dialog.setRootToPreselect(initialElementSelection); - } - } - return dialog; - } - /** - * We override createDialog from parent, so this is a no-op. - */ - public SystemFilterPoolDialogInterface createFilterPoolDialog(Shell parent) - { - return null; - } - - /** - * Walk elements deciding pre-selection - */ - protected void preSelect(SystemSimpleContentElement inputElement) - { - super.preSelect(inputElement); - } - /** - * Decide per pool if it should be selected or not. - * Default behaviour is to select it if it is currently referenced. - */ - protected boolean getFilterPoolPreSelection(ISystemFilterPool pool) - { - ISystemFilterPoolReferenceManagerProvider refMgrProvider = getReferenceManagerProviderSelection(); - if (refMgrProvider != null) - { - ISystemFilterPoolReferenceManager refMgr = refMgrProvider.getSystemFilterPoolReferenceManager(); - if (refMgr != null) - { - return refMgr.isSystemFilterPoolReferenced(pool); - } - else - return false; - } - else - return false; - } - - /** - * Called by parent class after dialog returns. We set the internal value attribute - * to be the array of user selected filter pools. - * <p> - * After this action executes, simply call getValue() to get an - * array of SystemFilterPool objects representing what pools the user selected. - * A result of null means the dialog was cancelled. - */ - protected Object getDialogValue(Dialog dlg) - { - SystemSimpleSelectDialog dialog = (SystemSimpleSelectDialog)dlg; - if (!dialog.wasCancelled()) - { - Vector selectedFilterPools = new Vector(); - SystemSimpleContentElement inputElement = dialog.getUpdatedContent(); - SystemSimpleContentElement[] mgrElements = inputElement.getChildren(); - for (int idx=0; idx<mgrElements.length; idx++) - { - SystemSimpleContentElement[] poolElements = mgrElements[idx].getChildren(); - for (int jdx=0; jdx<poolElements.length; jdx++) - { - if (poolElements[jdx].isSelected()) - selectedFilterPools.addElement(poolElements[jdx].getData()); - } - } - - ISystemFilterPool[] selectedPoolArray = new ISystemFilterPool[selectedFilterPools.size()]; - for (int idx=0; idx<selectedFilterPools.size(); idx++) - selectedPoolArray[idx] = (ISystemFilterPool)selectedFilterPools.elementAt(idx); - return selectedPoolArray; - } - else - return null; - } - - - /** - * Method called when ok pressed on dialog and after getDialogValue has set the - * value attribute to an array of SystemFilterPool objects for the selected pools. - * <p> - * By default, if the current selected object implements SystemFilterPoolReferenceManagerProvider, - * then this will call setFilterPoolReferences on that selected object. - * <p> - * @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 deleted file mode 100644 index 463297112..000000000 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterWorkWithFilterPoolsAction.java +++ /dev/null @@ -1,199 +0,0 @@ -/******************************************************************************** - * 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.filters.ISystemFilterPoolManager; -import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider; -import org.eclipse.rse.ui.ISystemContextMenuConstants; -import org.eclipse.rse.ui.ISystemIconConstants; -import org.eclipse.rse.ui.RSEUIPlugin; -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, - RSEUIPlugin.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(RSEUIPlugin.HELPPREFIX + "actn0044"); //$NON-NLS-1$ - setDialogHelp(RSEUIPlugin.HELPPREFIX + "dwfp0000"); //$NON-NLS-1$ - } - /** - * 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, - RSEUIPlugin.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(RSEUIPlugin.HELPPREFIX + "actn0044"); //$NON-NLS-1$ - setDialogHelp(RSEUIPlugin.HELPPREFIX + "dwfp0000"); //$NON-NLS-1$ - } - /** - * 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(RSEUIPlugin.HELPPREFIX + "actn0044"); //$NON-NLS-1$ - setDialogHelp(RSEUIPlugin.HELPPREFIX + "dwfp0000"); //$NON-NLS-1$ - } - - - /** - * 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 deleted file mode 100644 index 3c4f660db..000000000 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterWorkWithFilterPoolsRefreshAllAction.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************** - * 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: - * Michael Berger (IBM) - 146339 Added refresh action graphic. - ********************************************************************************/ - -package org.eclipse.rse.ui.filters.actions; - -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.rse.ui.ISystemContextMenuConstants; -import org.eclipse.rse.ui.ISystemIconConstants; -import org.eclipse.rse.ui.RSEUIPlugin; -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 System 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, - RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_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. - * <p> - * 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 deleted file mode 100644 index 36b24b3b0..000000000 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemNewFilterAction.java +++ /dev/null @@ -1,492 +0,0 @@ -/******************************************************************************** - * 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.filters.ISystemFilter; -import org.eclipse.rse.core.filters.ISystemFilterContainer; -import org.eclipse.rse.core.filters.ISystemFilterContainerReference; -import org.eclipse.rse.core.filters.ISystemFilterPool; -import org.eclipse.rse.core.filters.ISystemFilterPoolReference; -import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider; -import org.eclipse.rse.core.filters.ISystemFilterPoolSelectionValidator; -import org.eclipse.rse.core.filters.ISystemFilterPoolWrapperInformation; -import org.eclipse.rse.core.filters.ISystemFilterReference; -import org.eclipse.rse.core.subsystems.ISubSystem; -import org.eclipse.rse.ui.ISystemContextMenuConstants; -import org.eclipse.rse.ui.ISystemIconConstants; -import org.eclipse.rse.ui.RSEUIPlugin; -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. - * <p> - * 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 verbiage = 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, - RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_NEWFILTER_ID), false); - } - - // ------------------------ - // CONFIGURATION METHODS... - // ------------------------ - - /** - * <i>Configuration method. Do not override.</i><br> - * 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; - } - /** - * <i>Configuration method. Do not override.</i><br> - * Set the help context Id (infoPop) for this action. This must be fully qualified by - * plugin ID. - * <p> - * 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); - } - /** - * <i>Configuration method. Do not override.</i><br> - * 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; - } - /** - * <i>Configuration method. Do not override.</i><br> - * 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; - } - /** - * <i>Configuration method. Do not override.</i><br> - * This is an alternative to {@link #setAllowFilterPoolSelection(ISystemFilterPool[])} - * <p> - * 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. - * <p> - * 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 verbiage 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; - } - - /** - * <i>Configuration method. Do not override.</i><br> - * 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. - * <p>This will also result in a call to setType(String) on the filter string edit pane, which - * sets the <samp>type</samp> instance variable in case your edit pane subclass needs to know. - */ - public void setType(String type) - { - this.type = type; - } - /** - * <i>Getter method. Do not override.</i><br> - * Get the type of filter as set by {@link #setType(String)} - */ - public String getType() - { - return type; - } - /** - * <i>Configuration method. Do not override.</i><br> - * 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; - } - /** - * <i>Configuration method. Do not override.</i><br> - * Call this if you want the new filter to have some default filter strings. - */ - public void setDefaultFilterStrings(String[] defaultFilterStrings) - { - this.defaultFilterStrings = defaultFilterStrings; - } - /** - * <i>Configuration method. Do not override.</i><br> - * 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. - * <p> - * 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. - * <p> - * For convenience, when this is called, setShowInfoPage(false) is called for you - */ - public void setShowNamePrompt(boolean show) - { - showNamePrompt = show; - } - /** - * <i>Configuration method. Do not override.</i><br> - * Call in order to not show the final info-only page of the wizard. Default is true. - * @see #setVerbiage(String) - */ - public void setShowInfoPage(boolean show) - { - showInfoPage = show; - } - /** - * <i>Configuration method. Do not override.</i><br> - * Set the verbiage 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 setVerbiage(String verbiage) - { - this.verbiage = verbiage; - } - /** - * <i>Configuration method. Do not override.</i><br> - * Set the description to display on the first page of the wizard - */ - public void setPage1Description(String description) - { - this.page1Description = description; - } - /** - * <i>Configuration method. Do not override.</i><br> - * Set if we are creating a filter for use in the RSE or not. This affects the - * tips and help. - * <p> - * 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; - } - /** - * <i>Configuration method. Do not override.</i><br> - * 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; - } - - /** - * <i>Configuration method. Do not override.</i><br> - * Specify an edit pane that prompts the user for the contents of a filter string. - */ - public void setFilterStringEditPane(SystemFilterStringEditPane editPane) - { - this.editPane = editPane; - } - - /** - * <i>Configuration method. Do not override.</i><br> - * Specify the help to show for the name page (page 2) - */ - public void setNamePageHelp(String helpId) - { - this.namePageHelp = helpId; - } - - // ---------------------- - // OVERRIDABLE METHODS... - // ---------------------- - /** - * <i><b>Overridable</b> configuration method.</i><br> - * Overridable extension. For those cases when you don't want to create your - * own wizard subclass, but prefer to simply configure the default wizard. - * <p> - * 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. - * <p>By default, this does nothing. - */ - protected void configureNewFilterWizard(SystemNewFilterWizard wizard) - { - } - - /** - * <i><b>Overridable</b> configuration method.</i><br> - * Configure the new filter created by the wizard. This is only called after - * successful completion of the wizard - * <p>By default, this does nothing. - */ - protected void configureNewFilter(ISystemFilter newFilter) - { - } - - // -------------------- - // LIFECYCLE METHODS... - // -------------------- - - /** - * <i>Lifecyle method. Do not override. Instead override {@link #createNewFilterWizard(ISystemFilterPool)}.</i><br> - * The default processing for the run method calls createDialog, which - * in turn calls this method to return an instance of our wizard.<br> - * Our default implementation is to call createNewFilterWizard. - * <p> - * 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 (verbiage != null) - wizard.setVerbiage(verbiage); - if (page1Description != null) - wizard.setPage1Description(page1Description); - if (filterPoolSelectionValidator != null) - wizard.setFilterPoolSelectionValidator(filterPoolSelectionValidator); - if (editPane != null) - wizard.setFilterStringEditPane(editPane); - ISystemFilterPoolReferenceManagerProvider provider = getSystemFilterPoolReferenceManagerProvider(); - //RSEUIPlugin.logDebugMessage(this.getClass().getName(),"Inside createWizard. null? " + (provider==null)); - wizard.setSystemFilterPoolReferenceManagerProvider(provider); - configureNewFilterWizard(wizard); - return wizard; - } - - /** - * <i><b>Overridable</b> lifecyle method. </i><br> - * Create and return the actual wizard. - * By default this returns an instance of {@link org.eclipse.rse.filters.ui.wizards.SystemNewFilterWizard}. - * <p> - * You can avoid creating your own wizard subclass by instead overriding - * {@link #configureNewFilterWizard(SystemNewFilterWizard)} - */ - protected SystemNewFilterWizard createNewFilterWizard(ISystemFilterPool parentPool) - { - return new SystemNewFilterWizard(parentPool); - } - /** - * <i>Lifecyle method. Do not override. Instead override {@link #configureNewFilter(ISystemFilter)}.</i><br> - * 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); - } - - /** - * <i>Lifecyle method. No need to override.</i><br> - * 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... - // ----------------- - - /** - * <i>Output method. Do not override.</i><br> - * 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; - } - - /** - * <i>Output method. Do not override.</i><br> - * 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(). - * <p> - * 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; - } - - /** - * <i>Output method. Do not override.</i><br> - * 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. - * <p> - * 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<strings.length; idx++) - strings[idx] = (String)v.elementAt(idx); - return strings; - } - else if (output instanceof ISystemFilter) - { - return ((ISystemFilter)output).getFilterStrings(); - } - else - return null; - } - /** - * <i>Output method. Do not override.</i><br> - * 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 |