diff --git a/rse/examples/org.eclipse.rse.examples.tutorial/plugin.xml b/rse/examples/org.eclipse.rse.examples.tutorial/plugin.xml index 96f723a0c04..5c1263ee1a3 100644 --- a/rse/examples/org.eclipse.rse.examples.tutorial/plugin.xml +++ b/rse/examples/org.eclipse.rse.examples.tutorial/plugin.xml @@ -21,31 +21,37 @@ Martin Oberhuber (Wind River) - Adapted original tutorial code to Open RSE. - - - - - + + + + + - - - + + + + + + + diff --git a/rse/examples/org.eclipse.rse.examples.tutorial/src/samples/ui/actions/ShowJarContents.java b/rse/examples/org.eclipse.rse.examples.tutorial/src/samples/ui/actions/ShowJarContents.java index 51484a1bbca..d36d7e49a87 100644 --- a/rse/examples/org.eclipse.rse.examples.tutorial/src/samples/ui/actions/ShowJarContents.java +++ b/rse/examples/org.eclipse.rse.examples.tutorial/src/samples/ui/actions/ShowJarContents.java @@ -16,10 +16,17 @@ package samples.ui.actions; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.jface.action.IAction; import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.rse.core.SystemBasePlugin; import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.files.ui.actions.SystemAbstractRemoteFilePopupMenuExtensionAction; +import org.eclipse.rse.core.subsystems.ISubSystem; import org.eclipse.rse.services.shells.IHostOutput; import org.eclipse.rse.services.shells.IHostShell; import org.eclipse.rse.services.shells.IHostShellChangeEvent; @@ -32,24 +39,50 @@ import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCommandShell; import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteError; import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteOutput; import org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem.IShellServiceSubSystem; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IObjectActionDelegate; +import org.eclipse.ui.IWorkbenchPart; /** * An action that runs a command to display the contents of a Jar file. * The plugin.xml file restricts this action so it only appears for .jar files. */ -public class ShowJarContents extends SystemAbstractRemoteFilePopupMenuExtensionAction { - +public class ShowJarContents implements IObjectActionDelegate +{ + private List _selectedFiles; + /** * Constructor for ShowJarContents. */ - public ShowJarContents() { - super(); + public ShowJarContents() + { + _selectedFiles = new ArrayList(); } + protected Shell getShell() + { + return SystemBasePlugin.getActiveWorkbenchShell(); + } + + protected IRemoteFile getFirstSelectedRemoteFile() + { + if (_selectedFiles.size() > 0) + { + return (IRemoteFile)_selectedFiles.get(0); + } + return null; + } + + protected ISubSystem getSubSystem() + { + return getFirstSelectedRemoteFile().getParentRemoteFileSubSystem(); + } + + /* (non-Javadoc) * @see org.eclipse.rse.ui.actions.SystemAbstractPopupMenuExtensionAction#run() */ - public void run() { + public void run(IAction action) { IRemoteFile selectedFile = getFirstSelectedRemoteFile(); String cmdToRun = "jar -tvf " + selectedFile.getAbsolutePath(); //$NON-NLS-1$ try { @@ -73,6 +106,8 @@ public class ShowJarContents extends SystemAbstractRemoteFilePopupMenuExtensionA return null; } + + public void runCommand(String command) throws Exception { IRemoteCmdSubSystem cmdss = getRemoteCmdSubSystem(); @@ -138,4 +173,24 @@ public class ShowJarContents extends SystemAbstractRemoteFilePopupMenuExtensionA } } + public void selectionChanged(org.eclipse.jface.action.IAction action, + org.eclipse.jface.viewers.ISelection selection) + { + _selectedFiles.clear(); + // store the selected jars to be used when running + Iterator theSet = ((IStructuredSelection)selection).iterator(); + while (theSet.hasNext()) + { + Object obj = theSet.next(); + if (obj instanceof IRemoteFile) + { + _selectedFiles.add(obj); + } + } + } + + public void setActivePart(IAction action, IWorkbenchPart targetPart) { + // TODO Auto-generated method stub + + } } diff --git a/rse/examples/org.eclipse.rse.examples.tutorial/src/samples/ui/propertypages/FolderInfoPropertyPage.java b/rse/examples/org.eclipse.rse.examples.tutorial/src/samples/ui/propertypages/FolderInfoPropertyPage.java index a9316e3ff21..d5c42d13b42 100644 --- a/rse/examples/org.eclipse.rse.examples.tutorial/src/samples/ui/propertypages/FolderInfoPropertyPage.java +++ b/rse/examples/org.eclipse.rse.examples.tutorial/src/samples/ui/propertypages/FolderInfoPropertyPage.java @@ -16,10 +16,10 @@ package samples.ui.propertypages; -import org.eclipse.rse.files.ui.propertypages.SystemAbstractRemoteFilePropertyPageExtensionAction; import org.eclipse.rse.services.clientserver.messages.SystemMessageException; import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; import org.eclipse.rse.ui.SystemWidgetHelpers; +import org.eclipse.rse.ui.propertypages.SystemBasePropertyPage; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.widgets.Button; @@ -35,7 +35,7 @@ import samples.RSESamplesPlugin; * extension point xml to only apply to folder objects. */ public class FolderInfoPropertyPage - extends SystemAbstractRemoteFilePropertyPageExtensionAction + extends SystemBasePropertyPage implements SelectionListener { // gui widgets... @@ -262,5 +262,17 @@ public class FolderInfoPropertyPage Display.getDefault().asyncExec(guiUpdater); } + protected boolean verifyPageContents() { + return true; + } + + /** + * Get the input remote file object + */ + protected IRemoteFile getRemoteFile() + { + Object element = getElement(); + return ((IRemoteFile)element); + } } diff --git a/rse/plugins/org.eclipse.rse.eclipse.filesystem/src/org/eclipse/rse/eclipse/filesystem/RSEFileStoreRemoteFileWrapper.java b/rse/plugins/org.eclipse.rse.eclipse.filesystem/src/org/eclipse/rse/eclipse/filesystem/RSEFileStoreRemoteFileWrapper.java index 5a019a9e5c9..4dbd506d312 100644 --- a/rse/plugins/org.eclipse.rse.eclipse.filesystem/src/org/eclipse/rse/eclipse/filesystem/RSEFileStoreRemoteFileWrapper.java +++ b/rse/plugins/org.eclipse.rse.eclipse.filesystem/src/org/eclipse/rse/eclipse/filesystem/RSEFileStoreRemoteFileWrapper.java @@ -43,6 +43,9 @@ import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.Job; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.osgi.util.NLS; import org.eclipse.rse.core.subsystems.RemoteChildrenContentsType; @@ -224,18 +227,19 @@ public class RSEFileStoreRemoteFileWrapper extends FileStore implements IFileSto { file = (IFile)UniversalFileTransferUtility.copyRemoteResourceToWorkspace(_remoteFile, monitor); + if (file != null && !file.isSynchronized(IResource.DEPTH_ZERO)) { - /* + RefreshJob refresh = new RefreshJob(file, IResource.DEPTH_ZERO); + refresh.schedule(); try { - file.refreshLocal(IFile.DEPTH_ZERO, monitor); + refresh.join(); } catch (Exception e) { e.printStackTrace(); } - */ } } } @@ -245,14 +249,18 @@ public class RSEFileStoreRemoteFileWrapper extends FileStore implements IFileSto } if (file != null && !file.isSynchronized(IResource.DEPTH_ZERO) && !_remoteFile.getName().equals(".project")) //$NON-NLS-1$ { - try - { - file.refreshLocal(IResource.DEPTH_ZERO, monitor); - } - catch (Exception e) - { - e.printStackTrace(); - } + RefreshJob refresh = new RefreshJob(file, IResource.DEPTH_ZERO); + refresh.schedule(); + try + { + refresh.join(); + } + catch (Exception e) + { + e.printStackTrace(); + } + + } if (file != null) { @@ -278,6 +286,31 @@ public class RSEFileStoreRemoteFileWrapper extends FileStore implements IFileSto return null; } + public class RefreshJob extends Job + { + private IResource _resource; + private int _depth; + public RefreshJob(IResource resource, int depth) + { + super("Refresh"); + _resource = resource; + _depth = depth; + } + + public IStatus run(IProgressMonitor monitor) + { + try + { + _resource.refreshLocal(_depth, monitor); + } + catch (Exception e) + { + e.printStackTrace(); + } + return Status.OK_STATUS; + } + } + private InputStream getDummyProjectFileStream() { diff --git a/rse/plugins/org.eclipse.rse.files.ui/plugin.xml b/rse/plugins/org.eclipse.rse.files.ui/plugin.xml index bbd9cd44a2b..b21982fc261 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/plugin.xml +++ b/rse/plugins/org.eclipse.rse.files.ui/plugin.xml @@ -39,18 +39,19 @@ Contributors: - + + + + + - - diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/actions/SystemAbstractRemoteFilePopupMenuExtensionAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/actions/SystemAbstractRemoteFilePopupMenuExtensionAction.java deleted file mode 100644 index 236025d0feb..00000000000 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/actions/SystemAbstractRemoteFilePopupMenuExtensionAction.java +++ /dev/null @@ -1,141 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2000, 2006 IBM Corporation. All rights reserved. - * This program and the accompanying materials are made available under the terms - * of the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Initial Contributors: - * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, - * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * - * Contributors: - * {Name} (company) - description of contribution. - ********************************************************************************/ - -package org.eclipse.rse.files.ui.actions; -import java.util.Iterator; - -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystemConfiguration; -import org.eclipse.rse.ui.actions.SystemAbstractPopupMenuExtensionAction; -import org.eclipse.ui.IObjectActionDelegate; - - -/** - * This is a base class to simplify the creation of actions supplied via the - * org.eclipse.rse.ui.popupMenus extension point, targeting remote files - * and/or remote folders. - *

- * The only method you must implement is {@link #run()}. - * You may optionally override {@link #getEnabled(Object[])} - *

- * Convenience methods available in this class: - *

    - *
  • {@link #getSelectedRemoteFiles()} - *
  • {@link #getFirstSelectedRemoteFile()} - *
  • {@link #getRemoteFileSubSystem()} - *
  • {@link #getRemoteFileSubSystemConfiguration()} - *
- *

- * See also the convenience methods available in the parent class {@link SystemAbstractPopupMenuExtensionAction} - * - * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter - * @see org.eclipse.rse.ui.dialogs.SystemPromptDialog - */ -public abstract class SystemAbstractRemoteFilePopupMenuExtensionAction - extends SystemAbstractPopupMenuExtensionAction - implements IObjectActionDelegate -{ - - /** - * Constructor - */ - public SystemAbstractRemoteFilePopupMenuExtensionAction() - { - super(); - } - - // ---------------------------------- - // OVERRIDABLE METHODS FROM PARENT... - // ---------------------------------- - - /** - * The user has selected this action. This is where the actual code for the action goes. - */ - public abstract void run(); - - /** - * The user has selected one or more objects. This is an opportunity to enable/disable - * this action based on the current selection. - *

- * The default implementation of this method returns false if all the objects are not of - * type IRemoteFile. - */ - public boolean getEnabled(Object[] currentlySelected) - { - for (int idx=0; idx - * The only method you must implement is {@link #run()}. - * You may optionally override {@link #getEnabled(Object[])} - *

- * Convenience methods are: - *

    - *
  • {@link #getShell()} - *
  • {@link #getProxyAction()} - *
  • {@link #getSelection()} - *
  • {@link #getSelectionCount()} - *
  • {@link #getSelectedRemoteObjects()} - *
  • {@link #getFirstSelectedRemoteObject()} - *
  • {@link #getRemoteAdapter(Object)} - * - *
  • {@link #getSubSystem()} - *
  • {@link #getSubSystemConfiguration()} - *
  • {@link #getSystemConnection()} - * - *
  • {@link #getRemoteObjectName(Object obj, ISystemRemoteElementAdapter adapter)} - *
  • {@link #getRemoteObjectSubSystemConfigurationId(Object obj, ISystemRemoteElementAdapter adapter)} - *
  • {@link #getRemoteObjectTypeCategory(Object obj, ISystemRemoteElementAdapter adapter)} - *
  • {@link #getRemoteObjectType(Object obj, ISystemRemoteElementAdapter adapter)} - *
  • {@link #getRemoteObjectSubType(Object obj, ISystemRemoteElementAdapter adapter)} - *
  • {@link #getRemoteObjectSubSubType(Object obj, ISystemRemoteElementAdapter adapter)} - *
- * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter - * @see org.eclipse.rse.ui.dialogs.SystemPromptDialog - */ -public abstract class SystemAbstractPopupMenuExtensionAction - implements IObjectActionDelegate -{ - protected IWorkbenchPart viewPart = null; - protected IStructuredSelection sel = null; - protected IAction proxyAction; - protected Shell shell; - protected static final Object[] EMPTY_ARRAY = new Object[0]; - - /** - * Constructor - */ - public SystemAbstractPopupMenuExtensionAction() - { - super(); - } - - // ------------------------ - // OVERRIDABLE METHODS... - // ------------------------ - - /** - * The user has selected this action. This is where the actual code for the action goes. - */ - public abstract void run(); - - /** - * The user has selected one or more objects. This is an opportunity to enable/disable - * this action based on the current selection. By default, it is always enabled. Return - * false to disable it. - */ - public boolean getEnabled(Object[] currentlySelected) - { - return true; - } - - // --------------------------------- - // IOBJECTACTIONDELEGATE METHODS... - // --------------------------------- - - /** - * @see IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart) - */ - public void setActivePart(IAction action, IWorkbenchPart part) - { - this.viewPart = part; - this.proxyAction = action; - this.shell = part.getSite().getShell(); - } - /** - * Get the current view part. - * Handy for things like getting the shell. - */ - public IWorkbenchPart getActivePart() - { - return viewPart; - } - - /** - * The Eclipse-supplied proxy action has been selected to run. - * This is the foreward to us, the actual action. This method's default - * implementation is to simply call {@link #run()}. - * - * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) - */ - public void run(IAction action) - { - run(); - } - - /** - * Called by Eclipse when the user selects something. Our opportunity - * to enable or disable this menu item. The default implementation of this - * method calls getEnabled to determine if the proxy action should be enabled - * or not, then calls setEnabled on that proxy action with the result. - * - * @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection) - */ - public void selectionChanged(IAction action, ISelection sel) - { - if (!action.isEnabled()) - return; // defect 43471: we were overriding the enableFor attribute enablement - if (sel instanceof IStructuredSelection) - { - this.sel = (IStructuredSelection)sel; - action.setEnabled(getEnabled(getSelectedRemoteObjects())); - } - else - { - this.sel = null; - action.setEnabled(false); - } - } - - // --------------------------------------------- - // CONVENIENCE METHODS FOR SUBCLASSES TO USE... - // --------------------------------------------- - /** - * For toggle actions (attribute state specified in action tag), set the toggle state - */ - public void setChecked(boolean checked) - { - proxyAction.setChecked(checked); - } - - /** - * Change the enabled state of the action - */ - public void setEnabled(boolean enabled) - { - proxyAction.setEnabled(enabled); - } - - /** - * Return the proxy action for this action delegate - */ - public IAction getProxyAction() - { - return proxyAction; - } - - /** - * Return the shell hosting this action - */ - public Shell getShell() - { - return shell; - } - - /** - * Retrieve the current selected objects as a structured selection - */ - public IStructuredSelection getSelection() - { - return sel; - } - /** - * Retrieve the number of items currently selected - */ - public int getSelectionCount() - { - return ((sel==null)?0:sel.size()); - } - - /** - * Retrieve the currently selected objects as an array of Object objects. - * Array may be length 0, but will never be null, for convenience. - * To do anything interesting with the object, you will also need to retrieve its adapter - * @see #getRemoteAdapter(Object) - */ - public Object[] getSelectedRemoteObjects() - { - Object[] seld = new Object[(sel!=null) ? sel.size() : 0]; - if (sel == null) - return seld; - Iterator i = sel.iterator(); - int idx=0; - while (i.hasNext()) - seld[idx++] = i.next(); - return seld; - } - /** - * Retrieve the first selected object, for convenience. - * Will be null if there is nothing selected - * To do anything interesting with the object, you will also need to retrieve its adapter - * @see #getRemoteAdapter(Object) - */ - public Object getFirstSelectedRemoteObject() - { - if (sel == null) - return null; - return sel.getFirstElement(); - } - /** - * Retrieve the adapters of the currently selected objects as an array of ISystemRemoteElementAdapter objects. - * Array may be length 0, but will never be null, for convenience. - */ - public ISystemRemoteElementAdapter[] getSelectedRemoteObjectAdapters() - { - ISystemRemoteElementAdapter[] seld = new ISystemRemoteElementAdapter[(sel!=null) ? sel.size() : 0]; - if (sel == null) - return seld; - Iterator i = sel.iterator(); - int idx=0; - while (i.hasNext()) - seld[idx++] = getRemoteAdapter(i.next()); - return seld; - } - /** - * Retrieve the adapter of the first selected object as an ISystemRemoteElementAdapter object, for convenience. - * Will be null if there is nothing selected - */ - public ISystemRemoteElementAdapter getFirstSelectedRemoteObjectAdapter() - { - if (sel == null) - return null; - return getRemoteAdapter(sel.getFirstElement()); - } - - /** - * Returns the implementation of ISystemRemoteElementAdapter for the given - * object. Returns null if this object does not adaptable to this. - */ - public ISystemRemoteElementAdapter getRemoteAdapter(Object o) - { - if (!(o instanceof IAdaptable)) - return (ISystemRemoteElementAdapter)Platform.getAdapterManager().getAdapter(o,ISystemRemoteElementAdapter.class); - return (ISystemRemoteElementAdapter)((IAdaptable)o).getAdapter(ISystemRemoteElementAdapter.class); - } - - /** - * Returns the name of the given remote object, given its remote object adapter. - * Same as adapter.getName(obj); - */ - public String getRemoteObjectName(Object obj, ISystemRemoteElementAdapter adapter) - { - return adapter.getName(obj); - } - /** - * Returns the id of the subsystem factory of the given remote object, given its remote object adapter. - * Same as adapter.getSubSystemConfigurationId(obj); - */ - public String getRemoteObjectSubSystemConfigurationId(Object obj, ISystemRemoteElementAdapter adapter) - { - return adapter.getSubSystemConfigurationId(obj); - } - /** - * Returns the type category of the given remote object, given its remote object adapter. - * Same as adapter.getRemoteTypeCategory(obj); - */ - public String getRemoteObjectTypeCategory(Object obj, ISystemRemoteElementAdapter adapter) - { - return adapter.getRemoteTypeCategory(obj); - } - /** - * Returns the type of the given remote object, given its remote object adapter. - * Same as adapter.getRemoteType(obj); - */ - public String getRemoteObjectType(Object obj, ISystemRemoteElementAdapter adapter) - { - return adapter.getRemoteType(obj); - } - /** - * Returns the subtype of the given remote object, given its remote object adapter. - * Same as adapter.getRemoteSubType(obj); - */ - public String getRemoteObjectSubType(Object obj, ISystemRemoteElementAdapter adapter) - { - return adapter.getRemoteSubType(obj); - } - /** - * Returns the sub-subtype of the given remote object, given its remote object adapter. - * Same as adapter.getRemoteSubSubType(obj); - */ - public String getRemoteObjectSubSubType(Object obj, ISystemRemoteElementAdapter adapter) - { - return adapter.getRemoteSubSubType(obj); - } - /** - * Returns the subsystem from which the selected remote objects were resolved. - */ - public ISubSystem getSubSystem() - { - ISystemRemoteElementAdapter ra = getFirstSelectedRemoteObjectAdapter(); - if (ra != null) - return ra.getSubSystem(getFirstSelectedRemoteObject()); - else - return null; - } - /** - * Returns the subsystem factory which owns the subsystem from which the selected remote objects were resolved - */ - public ISubSystemConfiguration getSubSystemConfiguration() - { - ISubSystem ss = getSubSystem(); - if (ss != null) - return ss.getSubSystemConfiguration(); - else - return null; - } - - /** - * Return the SystemConnection from which the selected remote objects were resolved - */ - public IHost getSystemConnection() - { - IHost conn = null; - ISystemRemoteElementAdapter ra = getFirstSelectedRemoteObjectAdapter(); - if (ra != null) - { - ISubSystem ss = ra.getSubSystem(getFirstSelectedRemoteObject()); - if (ss != null) - conn = ss.getHost(); - } - return conn; - } - - /** - * Debug method to print out details of given selected object... - */ - public void printTest() - { - System.out.println("Testing. Number of selected objects = "+getSelectionCount()); //$NON-NLS-1$ - Object obj = getFirstSelectedRemoteObject(); - if (obj == null) - System.out.println("selected obj is null"); //$NON-NLS-1$ - else - { - ISystemRemoteElementAdapter adapter = getRemoteAdapter(obj); - System.out.println(); - System.out.println("REMOTE INFORMATION FOR FIRST SELECTION"); //$NON-NLS-1$ - System.out.println("--------------------------------------"); //$NON-NLS-1$ - System.out.println("Remote object name................: " + getRemoteObjectName(obj,adapter)); //$NON-NLS-1$ - System.out.println("Remote object subsystem factory id: " + getRemoteObjectSubSystemConfigurationId(obj,adapter)); //$NON-NLS-1$ - System.out.println("Remote object type category.......: " + getRemoteObjectTypeCategory(obj,adapter)); //$NON-NLS-1$ - System.out.println("Remote object type ...............: " + getRemoteObjectType(obj,adapter)); //$NON-NLS-1$ - System.out.println("Remote object subtype ............: " + getRemoteObjectSubType(obj,adapter)); //$NON-NLS-1$ - System.out.println("Remote object subsubtype .........: " + getRemoteObjectSubSubType(obj,adapter)); //$NON-NLS-1$ - System.out.println(); - } - System.out.println(); - } - -} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRemotePropertiesAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRemotePropertiesAction.java deleted file mode 100644 index 3884eabc774..00000000000 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRemotePropertiesAction.java +++ /dev/null @@ -1,162 +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.actions; -import java.text.MessageFormat; -import java.util.Iterator; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.preference.PreferenceManager; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.rse.core.SystemPropertyPageExtensionManager; -import org.eclipse.rse.ui.GenericMessages; -import org.eclipse.rse.ui.ISystemContextMenuConstants; -import org.eclipse.rse.ui.SystemResources; -import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.internal.dialogs.PropertyDialog; -import org.eclipse.ui.internal.dialogs.PropertyPageManager; - - -/** - * The action shows properties for remote objects - */ -public class SystemRemotePropertiesAction - extends SystemBaseAction - -{ - - /** - * Constructor - */ - public SystemRemotePropertiesAction(Shell shell) - { - super(SystemResources.ACTION_REMOTE_PROPERTIES_LABEL, SystemResources.ACTION_REMOTE_PROPERTIES_TOOLTIP,shell); - allowOnMultipleSelection(false); - setContextMenuGroup(ISystemContextMenuConstants.GROUP_PROPERTIES); - } - - /** - * We override from parent to do unique checking... - *

- * It is too expense to check for registered property pages at popup time, so we just return true. - *

- * @see SystemBaseAction#updateSelection(IStructuredSelection) - */ - public boolean updateSelection(IStructuredSelection selection) - { - boolean enable = true; - return enable; - } - - /** - * Returns the name of the given element. - * @param element the element - * @return the name of the element - */ - private String getName(Object element) - { - return getAdapter(element).getName(element); - } - /** - * Returns whether the provided object has pages registered in the property page - * manager. - */ - public boolean hasPropertyPagesFor(Object object) - { - //PropertyPageContributorManager manager = PropertyPageContributorManager.getManager(); - return getOurPropertyPageManager().hasContributorsFor(getRemoteAdapter(object), object); - } - /** - * Get the remote property page extension manager - */ - private SystemPropertyPageExtensionManager getOurPropertyPageManager() - { - return SystemPropertyPageExtensionManager.getManager(); - } - /** - * Returns whether this action is actually applicable to the current selection. - * Returns true if there are any registered property pages applicable for the - * given input object. - *

- * This method is generally too expensive to use when updating the enabled state - * of the action. - *

- * - * @return true if there are property pages for the currently - * selected element, and false otherwise - */ - public boolean isApplicableForSelection() - { - return hasPropertyPagesFor(getFirstSelection()); - } - /** - * The PropertyDialogAction implementation of this - * IAction method performs the action by opening the Property Page - * Dialog for the current selection. If no pages are found, an informative - * message dialog is presented instead. - */ - public void run() - { - PropertyPageManager pageManager = new PropertyPageManager(); - String title = "";//$NON-NLS-1$ - - // get selection - //Object element = getFirstSelection(); - IAdaptable element = (IAdaptable)getFirstSelection(); - if (element == null) - return; - ISystemRemoteElementAdapter adapter = getRemoteAdapter(element); - if (adapter == null) - return; - - // load pages for the selection - // fill the manager with contributions from the matching contributors - getOurPropertyPageManager().contribute(pageManager, getRemoteAdapter(element), element); - //PropertyPageContributorManager.getManager().contribute(pageManager, element); - - Shell shell = getShell(); - - // testing if there are pages in the manager - Iterator pages = pageManager.getElements(PreferenceManager.PRE_ORDER).iterator(); - String name = getName(element); - if (!pages.hasNext()) { - MessageDialog.openInformation( - shell, - GenericMessages.PropertyDialog_messageTitle, - MessageFormat.format(GenericMessages.PropertyDialog_noPropertyMessage, new Object[] {name})); - return; - } - else - { - title = MessageFormat.format(GenericMessages.PropertyDialog_propertyMessage, new Object[] {name}); - } - - PropertyDialog propertyDialog = new PropertyDialog(shell, pageManager, getSelection()); - propertyDialog.create(); - propertyDialog.getShell().setText(title); - - - - // TODO - hack to make this work in 3.1 - String id = PlatformUI.PLUGIN_ID + ".property_dialog_context"; //$NON-NLS-1$ - PlatformUI.getWorkbench().getHelpSystem().setHelp(propertyDialog.getShell(), id); - - propertyDialog.open(); - } -} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/TestPopupMenuAction1.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/TestPopupMenuAction1.java deleted file mode 100644 index bdee9f2fc6b..00000000000 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/TestPopupMenuAction1.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2000, 2006 IBM Corporation. All rights reserved. - * This program and the accompanying materials are made available under the terms - * of the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Initial Contributors: - * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, - * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * - * Contributors: - * {Name} (company) - description of contribution. - ********************************************************************************/ - -package org.eclipse.rse.ui.actions; -/** - * This is just a test action to ensure the popupMenus extension point works - * for adding popup menu actions to remote objects - */ -public class TestPopupMenuAction1 extends SystemAbstractPopupMenuExtensionAction -{ - - - - /** - * Constructor for TestPopupMenuAction1 - */ - public TestPopupMenuAction1() - { - super(); - } - - /** - * Called when the user selects this action - */ - public void run() - { - printTest(); - } - -} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemAbstractPropertyPageExtensionAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemAbstractPropertyPageExtensionAction.java deleted file mode 100644 index 5e2b3571e74..00000000000 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemAbstractPropertyPageExtensionAction.java +++ /dev/null @@ -1,249 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2000, 2006 IBM Corporation. All rights reserved. - * This program and the accompanying materials are made available under the terms - * of the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Initial Contributors: - * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, - * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * - * Contributors: - * {Name} (company) - description of contribution. - ********************************************************************************/ - -package org.eclipse.rse.ui.propertypages; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.Platform; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.subsystems.ISubSystem; -import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; -import org.eclipse.rse.ui.SystemWidgetHelpers; -import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.ui.IWorkbenchPropertyPage; - - - -/** - * This is a base class to simplify the creation of remote object property pages supplied via the - * org.eclipse.rse.core.propertyPages extension point. - *

- * This class extends {@link SystemBasePropertyPage} and so inherits the benefits of that class.
- * To get these benefits though, you must override {@link #createContentArea(Composite)} versus the - * usual createContents(Composite) method.. - *

- * The benefits of this class are:

- *
    - *
  • From {@link SystemBasePropertyPage}: Adds a message line and {@link org.eclipse.rse.ui.messages.ISystemMessageLine} message methods. - *
  • From {@link SystemBasePropertyPage}: Automatically assigns mnemonics to controls on this page, simplifying this common task. See {#wantMnemonics()}. - *
  • From {@link SystemBasePropertyPage}: For pages with input controls, simplifies the page validation burden: only one method need be overridden: {@link #verifyPageContents()} - *
  • From {@link SystemBasePropertyPage}: If no Default and Apply buttons wanted, the area reserved for this is removed, removing extra white space. - *
  • Supplies helper method {@link #getRemoteObject()} for querying the selected remote object. - *
  • Supplies helper methods getRemoteObjectXXX() for querying the attributes of the selected remote object. - *
  • Supplies helper methods to query the {@link #getSubSystem() subsystem} and {@link #getSystemConnection() connection} containing the selected remote object. - *
- * If your property page is for a file-system file or folder, use {@link SystemAbstractRemoteFilePropertyPageExtensionAction}. - */ -public abstract class SystemAbstractPropertyPageExtensionAction - //extends PropertyPage implements IWorkbenchPropertyPage - extends SystemBasePropertyPage implements IWorkbenchPropertyPage -{ - protected static final Object[] EMPTY_ARRAY = new Object[0]; - - /** - * Constructor - */ - public SystemAbstractPropertyPageExtensionAction() - { - super(); - // ensure the page has no special buttons - noDefaultAndApplyButton(); - } - - // ------------------------ - // OVERRIDABLE METHODS... - // ------------------------ - /** - * Abstract. You must override.
- * This is where child classes create their content area versus createContent, - * in order to have the message line configured for them and mnemonics assigned. - */ - protected abstract Control createContentArea(Composite parent); - - /** - * You may override if your page has input fields. By default returns true.
- * Validate all the widgets on the page. Based on this, the Eclipse framework will know whether - * to veto any user attempt to select another property page from the list on the left in the - * Properties dialog. - *

- * Subclasses should override to do full error checking on all the widgets on the page. Recommendation:
- *

    - *
  • If an error is detected, issue a {@link org.eclipse.rse.ui.messages.SystemMessage} via {@link #setErrorMessage(SystemMessage)} or text message via {@link #setErrorMessage(String)}. - *
  • If no errors detected, clear the message line via {@link #clearErrorMessage()} - *
- * - * @return true if there are no errors, false if any errors were found. - */ - protected boolean verifyPageContents() - { - return true; - } - - // --------------------------------------------- - // CONVENIENCE METHODS FOR SUBCLASSES TO USE... - // --------------------------------------------- - /** - * Retrieve the input remote object - * @see #getRemoteAdapter(Object) - */ - public Object getRemoteObject() - { - return getElement(); - } - /** - * Retrieve the adapter of the input remote object as an ISystemRemoteElementAdapter object, for convenience. - * Will be null if there is nothing selected - */ - public ISystemRemoteElementAdapter getRemoteAdapter() - { - return getRemoteAdapter(getElement()); - } - /** - * Returns the implementation of ISystemRemoteElementAdapter for the given - * object. Returns null if this object does not adaptable to this. - */ - protected ISystemRemoteElementAdapter getRemoteAdapter(Object o) - { - if (!(o instanceof IAdaptable)) - return (ISystemRemoteElementAdapter)Platform.getAdapterManager().getAdapter(o,ISystemRemoteElementAdapter.class); - return (ISystemRemoteElementAdapter)((IAdaptable)o).getAdapter(ISystemRemoteElementAdapter.class); - } - - /** - * Returns the name of the input remote object - */ - public String getRemoteObjectName() - { - return getRemoteAdapter().getName(getRemoteObject()); - } - /** - * Returns the id of the subsystem factory of the input remote object. - */ - public String getRemoteObjectSubSystemConfigurationId() - { - return getRemoteAdapter().getSubSystemConfigurationId(getRemoteObject()); - } - /** - * Returns the type category of the input remote object - */ - public String getRemoteObjectTypeCategory() - { - return getRemoteAdapter().getRemoteTypeCategory(getRemoteObject()); - } - /** - * Returns the type of the input remote object - */ - public String getRemoteObjectType() - { - return getRemoteAdapter().getRemoteType(getRemoteObject()); - } - /** - * Returns the subtype of the input remote object - */ - public String getRemoteObjectSubType() - { - return getRemoteAdapter().getRemoteSubType(getRemoteObject()); - } - /** - * Returns the sub-subtype of the input remote object - */ - public String getRemoteObjectSubSubType() - { - return getRemoteAdapter().getRemoteSubSubType(getRemoteObject()); - } - /** - * Returns the subsystem from which the input remote object was resolved - */ - public ISubSystem getSubSystem() - { - return getRemoteAdapter().getSubSystem(getRemoteObject()); - } - /** - * Returns the subsystem factory which owns the subsystem from which the input remote object was resolved - */ - public ISubSystemConfiguration getSubSystemConfiguration() - { - ISubSystem ss = getSubSystem(); - if (ss != null) - return ss.getSubSystemConfiguration(); - else - return null; - } - - /** - * Return the SystemConnection from which the selected remote objects were resolved - */ - public IHost getSystemConnection() - { - IHost conn = null; - ISubSystem ss = getRemoteAdapter().getSubSystem(getRemoteObject()); - if (ss != null) - conn = ss.getHost(); - return conn; - } - - - - /** - * Debug method to print out details of given selected object, in a composite GUI widget... - */ - protected Composite createTestComposite(Composite parent) - { - // Inner composite - int nbrColumns = 2; - Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns); - - //System.out.println("Remote object name................: " + getRemoteObjectName()); - //System.out.println("Remote object subsystem factory id: " + getRemoteObjectSubSystemConfigurationId()); - //System.out.println("Remote object type category.......: " + getRemoteObjectTypeCategory()); - //System.out.println("Remote object type ...............: " + getRemoteObjectType()); - //System.out.println("Remote object subtype ............: " + getRemoteObjectSubType()); - //System.out.println("Remote object subsubtype .........: " + getRemoteObjectSubSubType()); - - SystemWidgetHelpers.createLabel(composite_prompts, "Remote object name: "); //$NON-NLS-1$ - SystemWidgetHelpers.createLabel(composite_prompts, checkForNull(getRemoteObjectName())); - - SystemWidgetHelpers.createLabel(composite_prompts, "Remote object subsystem factory id: "); //$NON-NLS-1$ - SystemWidgetHelpers.createLabel(composite_prompts, checkForNull(getRemoteObjectSubSystemConfigurationId())); - - SystemWidgetHelpers.createLabel(composite_prompts, "Remote object type category: "); //$NON-NLS-1$ - SystemWidgetHelpers.createLabel(composite_prompts, checkForNull(getRemoteObjectTypeCategory())); - - SystemWidgetHelpers.createLabel(composite_prompts, "Remote object type: "); //$NON-NLS-1$ - SystemWidgetHelpers.createLabel(composite_prompts, checkForNull(getRemoteObjectType())); - - SystemWidgetHelpers.createLabel(composite_prompts, "Remote object subtype: "); //$NON-NLS-1$ - SystemWidgetHelpers.createLabel(composite_prompts, checkForNull(getRemoteObjectSubType())); - - SystemWidgetHelpers.createLabel(composite_prompts, "Remote object subsubtype: "); //$NON-NLS-1$ - SystemWidgetHelpers.createLabel(composite_prompts, checkForNull(getRemoteObjectSubSubType())); - - return composite_prompts; - } - - /** - * Check for null, and if so, return "" - */ - private String checkForNull(String input) - { - if (input == null) - return ""; //$NON-NLS-1$ - else - return input; - } - -} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemRemotePropertyPageNode.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemRemotePropertyPageNode.java deleted file mode 100644 index 8858897d21b..00000000000 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemRemotePropertyPageNode.java +++ /dev/null @@ -1,89 +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.propertypages; -import org.eclipse.jface.preference.PreferenceNode; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.rse.core.SystemPropertyPageExtension; -import org.eclipse.swt.graphics.Image; -import org.eclipse.ui.IWorkbenchPropertyPage; - - -/** - * Our version of PropertyPageNode that does not require a RegistryPageContributor input. - */ -public class SystemRemotePropertyPageNode extends PreferenceNode -{ - - private SystemPropertyPageExtension contributor; - private IWorkbenchPropertyPage page; - private Image icon; - private Object element; - /** - * Constructor. - */ - public SystemRemotePropertyPageNode(SystemPropertyPageExtension contributor, Object element) - { - super(contributor.getId()); - this.contributor = contributor; - this.element = element; - } - /** - * Creates the preference page this node stands for. If the page is null, - * it will be created by loading the class. If loading fails, - * empty filler page will be created instead. - */ - public void createPage() - { - page = contributor.createPage(element); - setPage(page); - } - /** (non-Javadoc) - * Method declared on IPreferenceNode. - */ - public void disposeResources() - { - page = null; - if (icon != null) - { - icon.dispose(); - icon = null; - } - } - /** - * Returns page icon, if defined. - */ - public Image getLabelImage() - { - if (icon==null) - { - ImageDescriptor desc = contributor.getImage(); - if (desc != null) - { - icon = desc.createImage(); - } - } - return icon; - } - /** - * Returns page label as defined in the registry. - */ - public String getLabelText() - { - return contributor.getName(); - } - -} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableTreeView.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableTreeView.java index 5ec2217d495..adbf1be201f 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableTreeView.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableTreeView.java @@ -45,7 +45,6 @@ import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.jface.window.SameShellProvider; import org.eclipse.rse.core.SystemAdapterHelpers; import org.eclipse.rse.core.SystemBasePlugin; -import org.eclipse.rse.core.SystemPopupMenuActionContributorManager; import org.eclipse.rse.core.model.IHost; import org.eclipse.rse.core.model.ISystemRegistry; import org.eclipse.rse.core.subsystems.ISubSystem; @@ -72,7 +71,6 @@ import org.eclipse.rse.ui.actions.SystemCommonRenameAction; import org.eclipse.rse.ui.actions.SystemCommonSelectAllAction; import org.eclipse.rse.ui.actions.SystemOpenExplorerPerspectiveAction; import org.eclipse.rse.ui.actions.SystemRefreshAction; -import org.eclipse.rse.ui.actions.SystemRemotePropertiesAction; import org.eclipse.rse.ui.actions.SystemShowInTableAction; import org.eclipse.rse.ui.actions.SystemSubMenuManager; import org.eclipse.rse.ui.messages.ISystemMessageLine; @@ -100,7 +98,6 @@ import org.eclipse.swt.widgets.TreeColumn; import org.eclipse.swt.widgets.TreeItem; import org.eclipse.swt.widgets.Widget; import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.dialogs.PropertyDialogAction; @@ -248,7 +245,6 @@ implements IMenuListener, ISystemDeleteTarget, ISystemRenameTarget, ISystemSelec // of actions. I say limited because somethings don't yet work properly. protected SystemRefreshAction _refreshAction; protected PropertyDialogAction _propertyDialogAction; - protected SystemRemotePropertiesAction _remotePropertyDialogAction; protected SystemOpenExplorerPerspectiveAction _openToPerspectiveAction; protected SystemShowInTableAction _showInTableAction; @@ -272,8 +268,6 @@ implements IMenuListener, ISystemDeleteTarget, ISystemRenameTarget, ISystemSelec protected boolean _selectionIsRemoteObject = true; protected boolean _selectionFlagsUpdated = false; - private IWorkbenchPart _workbenchPart = null; - private int[] _lastWidths = null; private ISystemMessageLine _messageLine; protected boolean menuListenerAdded = false; @@ -347,10 +341,6 @@ implements IMenuListener, ISystemDeleteTarget, ISystemRenameTarget, ISystemSelec return _layout; } - public void setWorkbenchPart(IWorkbenchPart part) - { - _workbenchPart = part; - } public void setViewFilters(String[] filter) { @@ -1161,19 +1151,7 @@ implements IMenuListener, ISystemDeleteTarget, ISystemRenameTarget, ISystemSelec _propertyDialogAction.selectionChanged(getSelection()); return _propertyDialogAction; } - /** - * Rather than pre-defining this common action we wait until it is first needed, - * for performance reasons. - */ - protected SystemRemotePropertiesAction getRemotePropertyDialogAction() - { - if (_remotePropertyDialogAction == null) - { - _remotePropertyDialogAction = new SystemRemotePropertiesAction(getShell()); - } - _remotePropertyDialogAction.setSelection(getSelection()); - return _remotePropertyDialogAction; - } + /** * Return the select All action */ @@ -1627,46 +1605,27 @@ implements IMenuListener, ISystemDeleteTarget, ISystemRenameTarget, ISystemSelec // registered propertyPages extension points registered for the selected object's class type. //propertyDialogAction.selectionChanged(selection); - if (!_selectionIsRemoteObject) // is not a remote object + PropertyDialogAction pdAction = getPropertyDialogAction(); + if (pdAction.isApplicableForSelection()) { - PropertyDialogAction pdAction = getPropertyDialogAction(); - if (pdAction.isApplicableForSelection()) - { - menu.appendToGroup(ISystemContextMenuConstants.GROUP_PROPERTIES, pdAction); - } - // OPEN IN NEW PERSPECTIVE ACTION... if (fromSystemViewPart && showOpenViewActions()) - { - //SystemCascadingOpenToAction openToAction = getOpenToAction(); - SystemOpenExplorerPerspectiveAction openToPerspectiveAction = getOpenToPerspectiveAction(); - SystemShowInTableAction showInTableAction = getShowInTableAction(); - openToPerspectiveAction.setSelection(selection); - showInTableAction.setSelection(selection); - //menu.appendToGroup(ISystemContextMenuConstants.GROUP_OPEN, openToAction.getSubMenu()); - menu.appendToGroup(ISystemContextMenuConstants.GROUP_OPEN, openToPerspectiveAction); - menu.appendToGroup(ISystemContextMenuConstants.GROUP_OPEN, showInTableAction); + menu.appendToGroup(ISystemContextMenuConstants.GROUP_PROPERTIES, pdAction); + } + // OPEN IN NEW PERSPECTIVE ACTION... if (fromSystemViewPart && showOpenViewActions()) + if (!_selectionIsRemoteObject) + { + //SystemCascadingOpenToAction openToAction = getOpenToAction(); + SystemOpenExplorerPerspectiveAction openToPerspectiveAction = getOpenToPerspectiveAction(); + SystemShowInTableAction showInTableAction = getShowInTableAction(); + openToPerspectiveAction.setSelection(selection); + showInTableAction.setSelection(selection); + //menu.appendToGroup(ISystemContextMenuConstants.GROUP_OPEN, openToAction.getSubMenu()); + menu.appendToGroup(ISystemContextMenuConstants.GROUP_OPEN, openToPerspectiveAction); + menu.appendToGroup(ISystemContextMenuConstants.GROUP_OPEN, showInTableAction); - } - } - else // is a remote object - { - //Object firstSelection = selection.getFirstElement(); - //ISystemRemoteElementAdapter remoteAdapter = getRemoteAdapter(firstSelection); - //logMyDebugMessage(this.getClass().getName(), ": there is a remote adapter"); - SystemRemotePropertiesAction pdAction = getRemotePropertyDialogAction(); - if (pdAction.isApplicableForSelection()) - menu.appendToGroup(ISystemContextMenuConstants.GROUP_PROPERTIES, pdAction); - //else - //logMyDebugMessage(this.getClass().getName(), ": but it is not applicable for selection"); - // -------------------------------------------------------------------------------------------------------------------- - // look for and add any popup menu actions registered via our org.eclipse.rse.core.popupMenus extension point... - // -------------------------------------------------------------------------------------------------------------------- - if (_workbenchPart != null) - { - SystemPopupMenuActionContributorManager.getManager().contributeObjectActions(_workbenchPart, ourMenu, this, null); - } } + } } diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableView.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableView.java index 33a0a8a72d7..43de909e580 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableView.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableView.java @@ -45,7 +45,6 @@ import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.window.SameShellProvider; import org.eclipse.rse.core.SystemAdapterHelpers; import org.eclipse.rse.core.SystemBasePlugin; -import org.eclipse.rse.core.SystemPopupMenuActionContributorManager; import org.eclipse.rse.core.filters.ISystemFilterReference; import org.eclipse.rse.core.model.IHost; import org.eclipse.rse.core.model.ISystemContainer; @@ -74,7 +73,6 @@ import org.eclipse.rse.ui.actions.SystemCommonRenameAction; import org.eclipse.rse.ui.actions.SystemCommonSelectAllAction; import org.eclipse.rse.ui.actions.SystemOpenExplorerPerspectiveAction; import org.eclipse.rse.ui.actions.SystemRefreshAction; -import org.eclipse.rse.ui.actions.SystemRemotePropertiesAction; import org.eclipse.rse.ui.actions.SystemShowInTableAction; import org.eclipse.rse.ui.actions.SystemSubMenuManager; import org.eclipse.rse.ui.messages.ISystemMessageLine; @@ -100,7 +98,6 @@ import org.eclipse.swt.widgets.TableColumn; import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Widget; import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.dialogs.PropertyDialogAction; @@ -236,7 +233,6 @@ public class SystemTableView // of actions. I say limited because somethings don't yet work properly. protected SystemRefreshAction _refreshAction; protected PropertyDialogAction _propertyDialogAction; - protected SystemRemotePropertiesAction _remotePropertyDialogAction; protected SystemOpenExplorerPerspectiveAction _openToPerspectiveAction; protected SystemShowInTableAction _showInTableAction; @@ -260,7 +256,6 @@ public class SystemTableView protected boolean _selectionIsRemoteObject = true; protected boolean _selectionFlagsUpdated = false; - private IWorkbenchPart _workbenchPart = null; private ISystemMessageLine _messageLine; private int[] _lastWidths = null; @@ -356,10 +351,6 @@ public class SystemTableView return _layout; } - public void setWorkbenchPart(IWorkbenchPart part) - { - _workbenchPart = part; - } public void setViewFilters(String[] filter) { @@ -1291,19 +1282,7 @@ public class SystemTableView _propertyDialogAction.selectionChanged(getSelection()); return _propertyDialogAction; } - /** - * Rather than pre-defining this common action we wait until it is first needed, - * for performance reasons. - */ - protected SystemRemotePropertiesAction getRemotePropertyDialogAction() - { - if (_remotePropertyDialogAction == null) - { - _remotePropertyDialogAction = new SystemRemotePropertiesAction(getShell()); - } - _remotePropertyDialogAction.setSelection(getSelection()); - return _remotePropertyDialogAction; - } + /** * Return the select All action */ @@ -1731,46 +1710,28 @@ public class SystemTableView // registered propertyPages extension points registered for the selected object's class type. //propertyDialogAction.selectionChanged(selection); - if (!_selectionIsRemoteObject) // is not a remote object + + PropertyDialogAction pdAction = getPropertyDialogAction(); + if (pdAction.isApplicableForSelection()) { - PropertyDialogAction pdAction = getPropertyDialogAction(); - if (pdAction.isApplicableForSelection()) - { - menu.appendToGroup(ISystemContextMenuConstants.GROUP_PROPERTIES, pdAction); - } - // OPEN IN NEW PERSPECTIVE ACTION... if (fromSystemViewPart && showOpenViewActions()) - { - //SystemCascadingOpenToAction openToAction = getOpenToAction(); - SystemOpenExplorerPerspectiveAction openToPerspectiveAction = getOpenToPerspectiveAction(); - SystemShowInTableAction showInTableAction = getShowInTableAction(); - openToPerspectiveAction.setSelection(selection); - showInTableAction.setSelection(selection); - //menu.appendToGroup(ISystemContextMenuConstants.GROUP_OPEN, openToAction.getSubMenu()); - menu.appendToGroup(ISystemContextMenuConstants.GROUP_OPEN, openToPerspectiveAction); - menu.appendToGroup(ISystemContextMenuConstants.GROUP_OPEN, showInTableAction); + menu.appendToGroup(ISystemContextMenuConstants.GROUP_PROPERTIES, pdAction); + } + // OPEN IN NEW PERSPECTIVE ACTION... if (fromSystemViewPart && showOpenViewActions()) + if (!_selectionIsRemoteObject) + { + //SystemCascadingOpenToAction openToAction = getOpenToAction(); + SystemOpenExplorerPerspectiveAction openToPerspectiveAction = getOpenToPerspectiveAction(); + SystemShowInTableAction showInTableAction = getShowInTableAction(); + openToPerspectiveAction.setSelection(selection); + showInTableAction.setSelection(selection); + //menu.appendToGroup(ISystemContextMenuConstants.GROUP_OPEN, openToAction.getSubMenu()); + menu.appendToGroup(ISystemContextMenuConstants.GROUP_OPEN, openToPerspectiveAction); + menu.appendToGroup(ISystemContextMenuConstants.GROUP_OPEN, showInTableAction); - } - } - else // is a remote object - { - //Object firstSelection = selection.getFirstElement(); - //ISystemRemoteElementAdapter remoteAdapter = getRemoteAdapter(firstSelection); - //logMyDebugMessage(this.getClass().getName(), ": there is a remote adapter"); - SystemRemotePropertiesAction pdAction = getRemotePropertyDialogAction(); - if (pdAction.isApplicableForSelection()) - menu.appendToGroup(ISystemContextMenuConstants.GROUP_PROPERTIES, pdAction); - //else - //logMyDebugMessage(this.getClass().getName(), ": but it is not applicable for selection"); - // -------------------------------------------------------------------------------------------------------------------- - // look for and add any popup menu actions registered via our org.eclipse.rse.core.popupMenus extension point... - // -------------------------------------------------------------------------------------------------------------------- - if (_workbenchPart != null) - { - SystemPopupMenuActionContributorManager.getManager().contributeObjectActions(_workbenchPart, ourMenu, this, null); - } } + } } diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableViewPart.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableViewPart.java index d0e699b79ca..0cb9de2f4e1 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableViewPart.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableViewPart.java @@ -1128,7 +1128,6 @@ public class SystemTableViewPart extends ViewPart implements ISelectionListener, { Table table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION | SWT.HIDE_SELECTION); _viewer = new SystemTableView(table, this); - _viewer.setWorkbenchPart(this); table.setLinesVisible(true); diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemView.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemView.java index 4c1418041dd..6322f2e5977 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemView.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemView.java @@ -57,7 +57,6 @@ import org.eclipse.jface.window.SameShellProvider; import org.eclipse.rse.core.SystemAdapterHelpers; import org.eclipse.rse.core.SystemBasePlugin; import org.eclipse.rse.core.SystemElapsedTimer; -import org.eclipse.rse.core.SystemPopupMenuActionContributorManager; import org.eclipse.rse.core.SystemPreferencesManager; import org.eclipse.rse.core.filters.ISystemFilter; import org.eclipse.rse.core.filters.ISystemFilterContainer; @@ -104,7 +103,6 @@ import org.eclipse.rse.ui.actions.SystemExpandAction; import org.eclipse.rse.ui.actions.SystemNewConnectionAction; import org.eclipse.rse.ui.actions.SystemOpenExplorerPerspectiveAction; import org.eclipse.rse.ui.actions.SystemRefreshAction; -import org.eclipse.rse.ui.actions.SystemRemotePropertiesAction; import org.eclipse.rse.ui.actions.SystemShowInMonitorAction; import org.eclipse.rse.ui.actions.SystemShowInTableAction; import org.eclipse.rse.ui.actions.SystemSubMenuManager; @@ -162,7 +160,6 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe protected SystemNewConnectionAction newConnectionAction; protected SystemRefreshAction refreshAction; protected PropertyDialogAction propertyDialogAction; - protected SystemRemotePropertiesAction remotePropertyDialogAction; protected SystemCollapseAction collapseAction; // defect 41203 protected SystemExpandAction expandAction; // defect 41203 protected SystemOpenExplorerPerspectiveAction openToPerspectiveAction; @@ -637,17 +634,6 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe return propertyDialogAction; } - /** - * Rather than pre-defining this common action we wait until it is first needed, - * for performance reasons. - */ - public SystemRemotePropertiesAction getRemotePropertyDialogAction() { - if (remotePropertyDialogAction == null) { - remotePropertyDialogAction = new SystemRemotePropertiesAction(getShell()); - } - remotePropertyDialogAction.setSelection(getSelection()); - return remotePropertyDialogAction; - } /** * Return the select All action @@ -884,58 +870,41 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe // registered propertyPages extension points registered for the selected object's class type. //propertyDialogAction.selectionChanged(selection); - if (!selectionIsRemoteObject) // is not a remote object - { - PropertyDialogAction pdAction = getPropertyDialogAction(); + PropertyDialogAction pdAction = getPropertyDialogAction(); - if (pdAction.isApplicableForSelection()) menu.appendToGroup(ISystemContextMenuConstants.GROUP_PROPERTIES, pdAction); + if (pdAction.isApplicableForSelection()) menu.appendToGroup(ISystemContextMenuConstants.GROUP_PROPERTIES, pdAction); + + + // GO INTO ACTION... + // OPEN IN NEW WINDOW ACTION... + if (fromSystemViewPart && showOpenViewActions() && !selectionIsRemoteObject) { - // GO INTO ACTION... - // OPEN IN NEW WINDOW ACTION... - if (fromSystemViewPart && showOpenViewActions()) { + GoIntoAction goIntoAction = getGoIntoAction(); + goIntoAction.setEnabled(selection.size() == 1); + menu.appendToGroup(ISystemContextMenuConstants.GROUP_GOTO, goIntoAction); + + SystemOpenExplorerPerspectiveAction openToPerspectiveAction = getOpenToPerspectiveAction(); + openToPerspectiveAction.setSelection(selection); + menu.appendToGroup(openToPerspectiveAction.getContextMenuGroup(), openToPerspectiveAction); + + if (showGenericShowInTableAction()) { - GoIntoAction goIntoAction = getGoIntoAction(); - goIntoAction.setEnabled(selection.size() == 1); - menu.appendToGroup(ISystemContextMenuConstants.GROUP_GOTO, goIntoAction); + SystemShowInTableAction showInTableAction = getShowInTableAction(); + showInTableAction.setSelection(selection); + menu.appendToGroup(openToPerspectiveAction.getContextMenuGroup(), showInTableAction); - SystemOpenExplorerPerspectiveAction openToPerspectiveAction = getOpenToPerspectiveAction(); - openToPerspectiveAction.setSelection(selection); - menu.appendToGroup(openToPerspectiveAction.getContextMenuGroup(), openToPerspectiveAction); + SystemShowInMonitorAction showInMonitorAction = getShowInMonitorAction(); + showInMonitorAction.setSelection(selection); + menu.appendToGroup(openToPerspectiveAction.getContextMenuGroup(), showInMonitorAction); - if (showGenericShowInTableAction()) { - - - SystemShowInTableAction showInTableAction = getShowInTableAction(); - showInTableAction.setSelection(selection); - menu.appendToGroup(openToPerspectiveAction.getContextMenuGroup(), showInTableAction); - - SystemShowInMonitorAction showInMonitorAction = getShowInMonitorAction(); - showInMonitorAction.setSelection(selection); - menu.appendToGroup(openToPerspectiveAction.getContextMenuGroup(), showInMonitorAction); - - } - - } - } else // is a remote object - { - //Object firstSelection = selection.getFirstElement(); - //ISystemRemoteElementAdapter remoteAdapter = getRemoteAdapter(firstSelection); - //logMyDebugMessage(this.getClass().getName(), ": there is a remote adapter"); - SystemRemotePropertiesAction pdAction = getRemotePropertyDialogAction(); - if (pdAction.isApplicableForSelection()) menu.appendToGroup(ISystemContextMenuConstants.GROUP_PROPERTIES, pdAction); - //else - //logMyDebugMessage(this.getClass().getName(), ": but it is not applicable for selection"); - // -------------------------------------------------------------------------------------------------------------------- - // look for and add any popup menu actions registered via our org.eclipse.rse.core.popupMenus extension point... - // -------------------------------------------------------------------------------------------------------------------- - if (fromSystemViewPart) // these require an IWorkbenchPart as a parameter, so we can't support them from within dialogs - addObjectActions(ourMenu); + } + // GO TO CASCADING ACTIONS... if (fromSystemViewPart && (selectionIsRemoteObject || showOpenViewActions())) { @@ -949,15 +918,6 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe } - /** - * Contributes popup menu actions and submenus registered for the object type(s) in the current selection. - * Patterned after addObjectActions in PopupMenuExtender class supplied by Eclipse. - */ - protected void addObjectActions(SystemMenuManager menu) { - if (SystemPopupMenuActionContributorManager.getManager().contributeObjectActions(getWorkbenchPart(), menu, this, null)) { - //menu.add(new Separator()); - } - } /** * Called when the context menu is about to open. diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/MonitorViewPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/MonitorViewPage.java index ec7b55bcae6..10a45e375ac 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/MonitorViewPage.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/monitor/MonitorViewPage.java @@ -424,7 +424,6 @@ FocusListener Tree tree = new Tree(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION | SWT.HIDE_SELECTION); _viewer = new SystemTableTreeView(tree, _viewPart); - _viewer.setWorkbenchPart(_viewPart); _viewer.addDoubleClickListener(new IDoubleClickListener() { diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/scratchpad/SystemScratchpadView.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/scratchpad/SystemScratchpadView.java index 9c00e97dd24..dc7ae9b3c80 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/scratchpad/SystemScratchpadView.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/scratchpad/SystemScratchpadView.java @@ -43,7 +43,6 @@ import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.jface.window.SameShellProvider; import org.eclipse.rse.core.SystemAdapterHelpers; import org.eclipse.rse.core.SystemBasePlugin; -import org.eclipse.rse.core.SystemPopupMenuActionContributorManager; import org.eclipse.rse.core.filters.ISystemFilter; import org.eclipse.rse.core.filters.ISystemFilterReference; import org.eclipse.rse.core.model.IHost; @@ -69,7 +68,6 @@ import org.eclipse.rse.ui.actions.SystemCommonRenameAction; import org.eclipse.rse.ui.actions.SystemCommonSelectAllAction; import org.eclipse.rse.ui.actions.SystemOpenExplorerPerspectiveAction; import org.eclipse.rse.ui.actions.SystemRefreshAction; -import org.eclipse.rse.ui.actions.SystemRemotePropertiesAction; import org.eclipse.rse.ui.actions.SystemShowInTableAction; import org.eclipse.rse.ui.actions.SystemSubMenuManager; import org.eclipse.rse.ui.messages.ISystemMessageLine; @@ -99,7 +97,6 @@ import org.eclipse.swt.widgets.Tree; import org.eclipse.swt.widgets.TreeItem; import org.eclipse.swt.widgets.Widget; import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.dialogs.PropertyDialogAction; @@ -131,7 +128,6 @@ public class SystemScratchpadView // of actions. I say limited because somethings don't yet work properly. protected SystemRefreshAction _refreshAction; protected PropertyDialogAction _propertyDialogAction; - protected SystemRemotePropertiesAction _remotePropertyDialogAction; protected SystemOpenExplorerPerspectiveAction _openToPerspectiveAction; protected SystemShowInTableAction _showInTableAction; @@ -157,7 +153,6 @@ public class SystemScratchpadView protected boolean _selectionIsRemoteObject = true; protected boolean _selectionFlagsUpdated = false; - private IWorkbenchPart _workbenchPart = null; private ISystemMessageLine _messageLine; protected boolean menuListenerAdded = false; @@ -222,11 +217,6 @@ public class SystemScratchpadView return _layout; } - public void setWorkbenchPart(IWorkbenchPart part) - { - _workbenchPart = part; - } - /** * Return the popup menu for the table @@ -697,19 +687,8 @@ public class SystemScratchpadView _propertyDialogAction.selectionChanged(getSelection()); return _propertyDialogAction; } - /** - * Rather than pre-defining this common action we wait until it is first needed, - * for performance reasons. - */ - protected SystemRemotePropertiesAction getRemotePropertyDialogAction() - { - if (_remotePropertyDialogAction == null) - { - _remotePropertyDialogAction = new SystemRemotePropertiesAction(getShell()); - } - _remotePropertyDialogAction.setSelection(getSelection()); - return _remotePropertyDialogAction; - } + + /** * Return the select All action */ @@ -1194,45 +1173,28 @@ public class SystemScratchpadView // registered propertyPages extension points registered for the selected object's class type. //propertyDialogAction.selectionChanged(selection); - if (!_selectionIsRemoteObject) // is not a remote object + + PropertyDialogAction pdAction = getPropertyDialogAction(); + if (pdAction.isApplicableForSelection()) { - PropertyDialogAction pdAction = getPropertyDialogAction(); - if (pdAction.isApplicableForSelection()) - { - menu.appendToGroup(ISystemContextMenuConstants.GROUP_PROPERTIES, pdAction); - } - // OPEN IN NEW PERSPECTIVE ACTION... if (fromSystemViewPart && showOpenViewActions()) - { - //SystemCascadingOpenToAction openToAction = getOpenToAction(); - SystemOpenExplorerPerspectiveAction openToPerspectiveAction = getOpenToPerspectiveAction(); - SystemShowInTableAction showInTableAction = getShowInTableAction(); - openToPerspectiveAction.setSelection(selection); - showInTableAction.setSelection(selection); - //menu.appendToGroup(ISystemContextMenuConstants.GROUP_OPEN, openToAction.getSubMenu()); - menu.appendToGroup(ISystemContextMenuConstants.GROUP_OPEN, openToPerspectiveAction); - menu.appendToGroup(ISystemContextMenuConstants.GROUP_OPEN, showInTableAction); + menu.appendToGroup(ISystemContextMenuConstants.GROUP_PROPERTIES, pdAction); + } + // OPEN IN NEW PERSPECTIVE ACTION... if (fromSystemViewPart && showOpenViewActions()) + if (!_selectionIsRemoteObject) + { + //SystemCascadingOpenToAction openToAction = getOpenToAction(); + SystemOpenExplorerPerspectiveAction openToPerspectiveAction = getOpenToPerspectiveAction(); + SystemShowInTableAction showInTableAction = getShowInTableAction(); + openToPerspectiveAction.setSelection(selection); + showInTableAction.setSelection(selection); + //menu.appendToGroup(ISystemContextMenuConstants.GROUP_OPEN, openToAction.getSubMenu()); + menu.appendToGroup(ISystemContextMenuConstants.GROUP_OPEN, openToPerspectiveAction); + menu.appendToGroup(ISystemContextMenuConstants.GROUP_OPEN, showInTableAction); - } - } - else // is a remote object - { - //Object firstSelection = selection.getFirstElement(); - //ISystemRemoteElementAdapter remoteAdapter = getRemoteAdapter(firstSelection); - //logMyDebugMessage(this.getClass().getName(), ": there is a remote adapter"); - SystemRemotePropertiesAction pdAction = getRemotePropertyDialogAction(); - if (pdAction.isApplicableForSelection()) - menu.appendToGroup(ISystemContextMenuConstants.GROUP_PROPERTIES, pdAction); - //else - //logMyDebugMessage(this.getClass().getName(), ": but it is not applicable for selection"); - // -------------------------------------------------------------------------------------------------------------------- - // look for and add any popup menu actions registered via our org.eclipse.rse.core.popupMenus extension point... - // -------------------------------------------------------------------------------------------------------------------- - if (_workbenchPart != null) - { - SystemPopupMenuActionContributorManager.getManager().contributeObjectActions(_workbenchPart, ourMenu, this, null); - } } + + } } diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/scratchpad/SystemScratchpadViewPart.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/scratchpad/SystemScratchpadViewPart.java index 9b3863d8bf4..d6331caf582 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/scratchpad/SystemScratchpadViewPart.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/scratchpad/SystemScratchpadViewPart.java @@ -103,7 +103,6 @@ public class SystemScratchpadViewPart extends ViewPart implements ISelectionList Tree tree = new Tree(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION | SWT.HIDE_SELECTION); _viewer = new SystemScratchpadView(tree, this); - _viewer.setWorkbenchPart(this); ISelectionService selectionService = getSite().getWorkbenchWindow().getSelectionService(); selectionService.addSelectionListener(this); diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchViewPart.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchViewPart.java index 4c299a9129a..4ca821a3787 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchViewPart.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/search/SystemSearchViewPart.java @@ -537,7 +537,6 @@ public class SystemSearchViewPart extends ViewPart //TableTree table = new TableTree(pageBook, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION | SWT.HIDE_SELECTION); Tree tabletree = new Tree(pageBook, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION | SWT.HIDE_SELECTION); SystemSearchTableView viewer = new SystemSearchTableView(tabletree, resultSet, this); - viewer.setWorkbenchPart(this); getSite().registerContextMenu(viewer.getContextMenuManager(), viewer); return viewer; diff --git a/rse/plugins/org.eclipse.rse.ui/plugin.xml b/rse/plugins/org.eclipse.rse.ui/plugin.xml index 73897e0a623..67cce0b457e 100644 --- a/rse/plugins/org.eclipse.rse.ui/plugin.xml +++ b/rse/plugins/org.eclipse.rse.ui/plugin.xml @@ -73,271 +73,7 @@ Contributors: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/rse/plugins/org.eclipse.rse.ui/schema/popupMenus.exsd b/rse/plugins/org.eclipse.rse.ui/schema/popupMenus.exsd deleted file mode 100644 index d3480ceac08..00000000000 --- a/rse/plugins/org.eclipse.rse.ui/schema/popupMenus.exsd +++ /dev/null @@ -1,753 +0,0 @@ - - - - - - - - - This extension point is for defining actions that appear in the -popup menu of remote resources of the -Remote Systems view, in the Remote System Explorer perspective. - -<p> -It is modelled after the Eclipse workbench extension point <samp>org.eclipse.ui.popupMenus</samp>. -However, because we know we are targeting remote resources, it -is simplified a bit. Specifically, there is no need to specify -the object class, as we assume these -actions apply to remote resources, which often share a common -object class. On the other hand, we -need additional filtering capabilities to scope which remote -resources these actions are to apply to. -</p> - -<p> -To this end, there is a rich set of -filtering attributes to enable fine-grained scoping by a number -of criteria. These scoping attributes -are the same as those for our <samp>org.eclipse.rse.ui.propertyPages</samp> -extension point. -</p> - -<p> -Like the workbench extension point, unless you specify otherwise -, the action will show -up in the main popup menu in the "additions" group. To create -cascading sub-menus, first -define a submenu and named separator group within it, using the -<samp>menu</samp> element and its <samp>separator </samp> -sub-element. Then refer to that menu's <samp>id</samp> in your -action element's <samp>menubarPath</samp> -attribute: -<samp>menuid/separator-group-name</samp>. -</p> - -<p> -While not fully documented here, this extension point supports the -<samp>&lt;filter&gt;</samp> -<samp>&lt;visibility&gt;</samp> and -<samp>&lt;enablement&gt;</samp> elements from the <samp>org.eclipse.ui.popupMenus</samp> -extension point. See its -documentation in the help for information on these elements. -For example: -<samp><pre> - <filter name="subsystemConfigurationCategory" value="files"/> - - <enablement> - <objectState name="hasChildren" value="true"/> - </enablement> -</pre></samp> -These elements are for conditionally deciding whether to show, -or enable, -the action(s). The <samp>name</samp>s supported for the <samp>&lt;filter&gt;</samp> -element, -and the <samp>objectState</samp>s supported for the <samp>&lt;visibility&gt;</samp> -and -<samp>&lt;enablement&gt;</samp> elements are:</p> -<ul> -<li><b><samp>"name"</samp></b>. Will test the <i>value</i> for -an exact match on an object's name, -or beginning-of-name match if ends with an asterisk. -<li><b><samp>"type"</samp></b>. Will test the <i>value</i> for -an exact match on an object's type. -<li><b><samp>"offline"</samp></b>.Will test the <i>value</i> -against "true" if the user is working -in "offline" mode or "false" if not. Currently only supported -for iSeries connections. -<li><b><samp>"connected"</samp></b>. Will test the <i>value</i> -against "true" if the connection -containing the selected object is active or "false" if not. -<li><b><samp>"hasChildren"</samp></b>. Will test the <i>value</i> -against "true" if this object's -adapter reports that it has children or "false" if it doesn't -have children. -<li><b><samp>"systemType"</samp></b>. Will test the <i>value</i> -for an exact match on the system type of -this object's parent SystemConnection object. -You can specify multiple values if you comma-separate them. -<li><b><samp>"subsystemConfigurationId"</samp></b>. Will test the <i>value</i> -for an exact match on the -<samp>ID</samp> of the subsystem configuration that created this object's -subsystem. Returns false for SystemConnection objects. -You can specify multiple values if you comma-separate them. -<li><b><samp>"subsystemConfigurationCategory"</samp></b>. Will test -the <i>value</i> for an exact match -on the <samp>category</samp> of the subsystem configuration that created -this object's subsystem. -You can specify multiple values if you comma-separate them. -</ul> - -<p> -These <samp>objectstate</samp>s are also supported via the -Eclipse <samp>org.eclipse.ui.popupMenus</samp> extension point, -for the -non-remote objects in the RSE: connections, subsystems, filter -pools -and filters. -</p> - - - - - - - - - - - (no description available) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (no description available) - - - - - - - - - - - - The id for this set of remote resource popup menu contributions. Must -be unique over all plug-ins. -It is suggested that the user qualify this with the plug-in id. - - - - - - - One of the optional filters to scope the remote resources for -which the popup menu actions are to appear. -Specify as many of these optional filters like this as needed to explicitly scope -all the actions defined in this objectContribution element. -<p> -This filter specifies a subsystem configuration id, such that these -actions will only appear for remote resources returned from subsystems of the given subsystem configuration. -This ID can be scalar, or it can be generic to match on multiple subsystem configuration IDs. - - - - - - - One of the optional filters to scope the remote resources for -which the popup menu actions are to appear. -Specify as many of these optional filters like this as needed to explicitly scope -all the actions defined in this <samp>objectContribution</samp> element. - -<p> -This filter specifies a subsystem configuration category, such that -these -actions will only appear for remote resources returned from subsystems -owned by factories -declared defined with the specified category. - -<p> -This category can be scalar, or it can be generic to match on -multiple subsystem configuration categories. -<br> - - - - - - - One of the optional filters to scope the remote resources for -which the popup menu actions are to appear. -Specify as many of these optional filters like this as needed to explicitly scope -all the actions defined in this objectContribution element. -<br> -This filter specifies a single system type, or semicolon-separated list of system types, -or asterisk for all system types (the default). -Will scope these actions to only remote objects from systems of this type or types. -<br><br> - - - - - - - One of the optional filters to scope the remote resources for -which the popup menu actions are to appear. -Specify as many of these optional filters like this as needed to explicitly scope -all the actions defined in this objectContribution element. -<p> -This filter specifies a simple or generic resource name. -Only resources whose name matches this filter will show the actions -defined within this object contribution element. -</p> - - - - - - - One of the optional filters to scope the remote resources for -which the property page is to appear. -Specify as many of these optional filters like this as needed to explicitly scope this property page element. -<p> -This filter specifies a type category. Normally the subsystemconfigurationid -is sufficient, but some subsystems display multiple types of -resources, and these are categorized by a type name that can -be used to scope property pages. -<br> - - - - - - - One of the optional filters to scope the remote resources for -which the popup menu actions are to appear. -Specify as many of these optional filters like this as needed to explicitly scope -all the actions defined in this objectContribution element. - -<p> -This filter specifies a resource type, either simple or generic. -The resource types depends on the subsystem. -<br> - - - - - - - One of the optional filters to scope the remote resources for -which the popup menu actions are to appear. -Specify as many of these optional filters like this as needed to explicitly scope -all the actions defined in this objectContribution element. - -<p> -This filter specifies a simple or generic resource subtype to -match. Not all subsystems support subtypes for their resources. -<br> - - - - - - - One of the optional filters to scope the remote resources for -which the popup menu actions are to appear. -Specify as many of these optional filters like this as needed to explicitly scope -all the actions defined in this objectContribution element. -<p> -This filter specifies a simple or generic resource sub-subtype -to match. -</p> - - - - - - - - - - - - - - - - - Use this element when you wish to have your action appear in -your own cascading menu, versus in the primary popup menu. - - - - - - - - - - unique ID for this submenu, used later in the first part of the menubarPath attribute of -the action element or path attribute of a nested menu element. This is used to identify -the target sub-menu of the action or sub-submenu. - - - - - - - readable text to show up in the popup menu, for this cascading menu. Do NOT specify ampersand -for mnemonics, as these are assigned for you. However, accelerator information is valid as defined -by the Eclipse rules. - - - - - - - For multi-cascading menus, use this attribute to identify a previously -specified menu that -this menu is to be nested within. The syntax is a bit tricky. -It is "id/group", where -<samp>id</samp> matches the <samp>id</samp> attribute from a -previous <samp>menu</samp> element, -and <samp>group</samp> matches the <samp>name</samp> attribute -of a <samp>separator</samp> -sub-element within that previous <samp>menu</samp> element. - -<p> -For the root cascading menu, you can also use this to specify -a group within the remote resource's -popup menu, where to place this cascading menu. In this case, -you would not specify an id. The default group is the <samp>additions</samp> group, -which is near the bottom of the popup menu. -</p> -The IBM pre-defined groups are: -<ul> -<li><b>"group.new"</b>. This is where the cascading "New->" menu -is. -<li><b>"group.goto"</b>. This is where the cascading "Goto->" -menu is. -<li><b>"group.expandto"</b>. This is where the cascading "Expand -To->" menu is. -<li><b>"group.openwith"</b>. This is where the cascading "Open -With->" menu is. -<li><b>"group.browsewith"</b>. This is where the cascading "Browse -With->" menu is. -<li><b>"group.workwith"</b>. This is where the cascading "Work -With->" menu is. -<li><b>"group.build"</b>. Area of the menu reserved for build or refresh -related actions. -<li><b>"group.change"</b>. Area of the menu reserved for change-related actions. -<li><b>"group.reorganize"</b>. Area of the menu reserved for reorganize-related actions, -such as rename, move, copy, delete. -<li><b>"group.reorder"</b>. Area of the menu reserved for reorder-related actions, -such as move up or move down. -<li><b>"group.generate"</b>. Area of the menu reserved for code generation-related actions. -<li><b>"group.search"</b>. Area of the menu reserved for search-related actions. -<li><b>"group.connection"</b>. Area of the menu reserved for connection-related actions. -<li><b>"group.remoteservers"</b>. Area of the menu reserved for the "Remote Servers->" action. -<li><b>"group.importexport"</b>. Area of the menu reserved for import or export-related actions. -<li><b>"group.adapter"</b>. Area of the menu reserved for actions queried from the remote resource adapters. -<li><b>"additions"</b>. Area of the menu reserved for actions that don't specify a group. -<li><b>"group.team"</b>. Area of the menu reserved for team-related actions. -<li><b>"group.properties"</b>. Area of the menu reserved for properties-related actions. -</ul> - -<p> -You may also desire to place your action in an supplied cascading menu. -To do this, for the ID-part, specify one of the following supplied menu IDs: -<ul> -<li><b>"menu.new"</b>. This is the cascading "New->" menu. -<li><b>"menu.goto"</b>. This is the cascading "Goto->" menu. -<li><b>"menu.expandto"</b>. This is the cascading "Expand To->" menu. -<li><b>"menu.openwith"</b>. This is the cascading "Open With->" menu. -<li><b>"menu.browsewith"</b>. This is the cascading "Browse With->" menu. -<li><b>"menu.workwith"</b>. This is the cascading "Work With->" menu. -<li><b>"menu.remoteservers"</b>. This is the cascading "Remote Servers->" menu. -</ul> -<br> - - - - - - - - - - - - - Use this element to define an action, and where it will appear in the popup menu. The action -defined here will only appear in a remote resource popup menu if the resource matches all the -given filtering criteria in the parent objectContribution element. - - - - - - - Unique ID for this action. - - - - - - - Readable text to display in the popup menu for this action. Do NOT specify ampersand for mnemonics, -as these are assigned for you. However, accelerator information is valid, as defined by the Eclipse rules. - - - - - - - An optional image icon for the popup menu. This is a .gif file, given with a path relative to your plugin -directory. - - - - - - - - - - Optional tooltip text for this action. This appears in the status bar when the action is selected. - - - - - - - A slash-delimited path that is used to specify the location of the the action in the popup menu. Each token -in the path, except the last one, represents an existing submenu in the hierarchy, as defined via the <samp>id</samp> -attribute of a <samp>menu</samp> element previously defined. Alternatively, the ID of a supplied cascading -menu can be specified. The last token represents the named separator group into which the action will be added. -If no path is given, this must be a supplied group. -<p> -See the comments for the path attribute of the menu element for a list of the supplied cascading menus, -and supplied separator groups. -</p> -<p> -If a path is given, then this must match the name attribute of a <samp>separator</samp> sub-element -within one of your <samp>menu</samp> elements. -</p> -<p> -If the path is omitted, or this menubarPath attribute, the action will be added to the standard "additions" group. -</p> - - - - - - - A value indicating the selection count which must be met to enable the action. If this attribute is specified and -the condition is met, the action is enabled. If the condition is not met, the action is disabled. If no attribute -is specified, the action is enabled for any number of resources selected. The following formats are supported: -<ul> -<li><b>!</b>. 0 items selected. -<li><b>?</b>. 0 or 1 items selected. -<li><b>+</b>. 1 or more items selected. -<li><b>n+</b>. n or more items selected. Example: 2+. -<li><b>n</b>. A precise number of items selected. Example: 4 -<li><b>*</b>. Any number of items selected. -</ul> - - - - - - - Optional attribute indicating the action is a toggle type. That -is, is shown as a check box menu item. The attribute value will -be used as the initial state. - - - - - - - Optional unique identifier indicating the help context ID for this action. When the action appears as a menu item, pressing -F1 while the menu item is highlighted will display help for the given context ID. - - - - - - - Your action class that implements <samp>org.eclipse.ui.IObjectActionDelegate</samp>. -Typically you will extend one of the supplied classes, described in the API Information section. - - - - - - - - - - - - - Use this element to partition your cascading menu into areas, or groups. This groups are defined in the -order in which the separator elements appear. The name attribute identifies the group such that it can -be used as the target of an action or sub-menu. - - - - - - - The arbitrary, but unique with this menu, name to assign this group. You can specify this name -later in the menubarPath attribute of an action, or the group part of the path attribute of a -menu. - - - - - - - - - - - - The following is an example of a defining a simple popup menu -action for any files and folders in any system type, which only -shows when a single file or folder is selected: -<h3>Example One</h3> - -<p> -<pre> -<extension point="org.eclipse.rse.ui.popupMenus"> - <objectContribution - id="com.acme.actions.action1" - typecategoryfilter="files"> - <action id="com.acme.action1" - label="Test Action for Files and Folders" - class="com.acme.actions.Action1" - enablesFor="1"> - </action> - </objectContribution> -</extension> -</pre> -</p> -The following example refines the first example so the action -only appears -for Java source files, not folders, and only for files in a local -connection. -Further, we show how to define multiple actions within one objectContribution: -<h3>Example Two</h3> - -<p> -<pre> -<extension point="org.eclipse.rse.ui.popupMenus"> - <objectContribution - id="com.acme.actions.action2" - typecategoryfilter="files" - typefilter="file" - namefilter="*.java" - subsystemconfigurationid="local.files"> - <action id="com.acme.action2a" - label="Test Action One for Local Java Files" - class="com.acme.actions.Action2a" - enablesFor="1"> - </action> - <action id="com.acme.action2b" - label="Test Action Two for Local Java Files" - class="com.acme.actions.Action2b" - enablesFor="1"> - </action> - </objectContribution> -</extension> -</pre> -</p> -The following example refines the second example, by moving the -actions to our own single-cascading menu: -<h3>Example Three</h3> - -<p> -<pre> -<extension point="org.eclipse.rse.ui.popupMenus"> - <objectContribution - id="com.acme.actions.action3" - typecategoryfilter="files" - typefilter="file" - namefilter="*.java" - subsystemconfigurationid="local.files"> - <menu id="com.acme.menu" - label="Test Actions"> - <separator name="taGroup"/> - </menu> - <action id="com.acme.action3a" - label="Test Action One for Local Java Files" - class="com.acme.actions.Action3a" - enablesFor="1" - menubarPath="com.acme.menu/taGroup"> - </action> - <action id="com.acme.action3b" - label="Test Action Two for Local Java Files" - class="com.acme.actions.Action3b" - enablesFor="1" - menubarPath="com.acme.menu/taGroup"> - </action> - </objectContribution> -</extension> -</pre> -</p> -The following example refines the third example, by moving the -actions to our own <i>multiple</i>-cascading menu. Notice how -we -can define the same separator group in different menus since -they -are unrelated to each other: -<h3>Example Four</h3> - -<p> -<pre> -<extension point="org.eclipse.rse.ui.popupMenus"> - <objectContribution - id="com.acme.actions.action4" - typecategoryfilter="files" - typefilter="file" - namefilter="*.java" - subsystemconfigurationid="local.files"> - <menu id="com.acme.menu" - label="Test Actions"> - <separator name="taGroup"/> - </menu> - <menu id="com.acme.menu2" - label="A Sub Menu" - path="com.acme.menu/taGroup"> - <separator name="taGroup"/> - </menu> - - <action id="com.acme.action4a" - label="Test Action One for Local Java Files" - class="com.acme.actions.Action4a" - enablesFor="1" - menubarPath="com.acme.menu/com.acme.menu2/taGroup"> - </action> - <action id="com.acme.action4a" - label="Test Action Two for Local Java Files" - class="com.acme.actions.Action4b" - enablesFor="1" - menubarPath="com.acme.menu/com.acme.menu2/taGroup"> - </action> - </objectContribution> -</extension> -</pre> -</p> -The following example shows how to place actions within a supplied cascading menu: -<h3>Example Five</h3> - -<p> -<pre> -<extension point="org.eclipse.rse.ui.popupMenus"> - <objectContribution - id="com.acme.actions.action5" - typecategoryfilter="files" - typefilter="file" - namefilter="*.java" - subsystemconfigurationid="local.files"> - <action id="com.acme.action5a" - label="Test Action One for Local Java Files" - class="com.acme.actions.Action5a" - enablesFor="1" - menubarPath="menu.openwith/additions"> - </action> - <action id="com.acme.action5b" - label="Test Action Two for Local Java Files" - class="com.acme.actions.Action5b" - enablesFor="1" - menubarPath="menu.browsewith/additions"> - </action> - </objectContribution> -</extension> -</pre> -</p> - -<p> -Remember, you can repeat the <samp>objectContribution</samp> elements as -needed, as well as the <samp>menu</samp> and <samp>action</samp> elements within them. -</p> - - - - - - - - - Your actions must all implement the interface <samp>org.eclipse.ui.IObjectActionDelegate</samp>. -Typically, you will subclass one of the supplied base classes -for this extension point: -<ul> -<li><b>org.eclipse.rse.ui.actions.SystemAbstractPopupMenuExtensionAction</b>, -in plugin org.eclipse.rse.ui. -Base class offering generic support for any remote resource popup -menu action, for any system type. -<li><b>org.eclipse.rse.ui.actions.SystemAbstractRemoteFilePopupMenuExtensionAction</b>, -in plugin org.eclipse.rse.ui. -Specialized base class offering specific support for any remote -file or folder popup menu action, for any system type. -</ul> - - - - - - - - - There is no supplied implementation for this extension point. - - - - - - - - - Copyright (c) 2002, 2006 IBM Corporation. All Rights Reserved. -This program and the accompanying materials are made available under the terms -of the Eclipse Public License v1.0 which accompanies this distribution, and is -available at http://www.eclipse.org/legal/epl-v10.html - -Contributors: -IBM Corporation - initial API and implementation - - - - diff --git a/rse/plugins/org.eclipse.rse.ui/schema/propertyPages.exsd b/rse/plugins/org.eclipse.rse.ui/schema/propertyPages.exsd deleted file mode 100644 index 89ecb3fb4db..00000000000 --- a/rse/plugins/org.eclipse.rse.ui/schema/propertyPages.exsd +++ /dev/null @@ -1,408 +0,0 @@ - - - - - - - - - <p> -This extension point is modelled after the eclipse workbench -extension point <samp>org.eclipse.ui.propertyPages</samp>. -However, because we know we are targeting remote resources, it -is simplified a bit. Specifically, -there is no need to specify the object class, as we assume these -actions apply to remote resources, which often share a common -object class. -On the other hand, we need additional filtering capabilities -to scope which remote resources these pages are to apply to. -</p> - -<p> -To this end, there is a rich set of filtering attributes to enable -fine-grained scoping by a number -of criteria. These scoping attributes are the same as those for -our <samp>org.eclipse.rse.ui.popupMenus</samp> -extension point. - -<p> -While not fully documented here, this extension point supports -the -<samp>&lt;filter&gt;</samp> -element from the <samp>org.eclipse.ui.popupMenus</samp> -extension point. See its -documentation in the help for information on this element. -For example: -<samp><pre> - <filter name="subsystemFactoryCategory" value="files"/> -</pre></samp> -This element is for conditionally deciding whether to show -the property page, very much like the attributes of the &lt;page&gt; element -do; in fact there is some overlap. <br> -The <samp>name</samp>s -supported for the <samp>&lt;filter&gt;</samp> -element are:</p> -<ul> -<li><b><samp>"name"</samp></b>. Will test the <i>value</i> for -an exact match on an object's name, -or beginning-of-name match if ends with an asterisk. -<li><b><samp>"type"</samp></b>. Will test the <i>value</i> for -an exact match on an object's type. -<li><b><samp>"offline"</samp></b>.Will test the <i>value</i> -against "true" if the user is working -in "offline" mode or "false" if not. Currently only supported -for iSeries connections. -<li><b><samp>"connected"</samp></b>. Will test the <i>value</i> -against "true" if the connection -containing the selected object is active or "false" if not. -<li><b><samp>"hasChildren"</samp></b>. Will test the <i>value</i> -against "true" if this object's -adapter reports that it has children or "false" if it doesn't -have children. -<li><b><samp>"systemType"</samp></b>. Will test the <i>value</i> -for an exact match on the system type of -this object's parent SystemConnection object. -You can specify multiple values if you comma-separate them. -<li><b><samp>"subsystemFactoryId"</samp></b>. Will test the <i>value</i> -for an exact match on the -<samp>ID</samp> of the subsystem factory that created this object's -subsystem. Returns false for SystemConnection objects. -You can specify multiple values if you comma-separate them. -<li><b><samp>"subsystemFactoryCategory"</samp></b>. Will test -the <i>value</i> for an exact match -on the <samp>category</samp> of the subsystem factory that created -this object's subsystem. -You can specify multiple values if you comma-separate them. -</ul> - - - - - - - (no description available) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Identifies an individual property page contribution. - - - - - - - a unique ID that will be used to identify this page. - - - - - - - a translatable name that will be used in the UI for this page. - - - - - - - a fully qualified name of the class that implements <code>org.eclipse.ui.IWorkbenchPropertyPage</code>. -Or better yet, extends one of the supplied base classes, described in the API Information section. - - - - - - - - - - A relative path to an icon that will be used in the UI in addition to the page name. Optional. - - - - - - - - - - One of the optional filters to scope the remote resources for -which the property page is to appear. -Specify as many of these optional filters like this as needed to explicitly scope this property page element. -<p> -This filter specifies a subsystem configuration id, such that this -property page will only appear for remote resources returned from subsystems of the given subsystem configuration. -This ID can be scalar, or it can be generic to match on multiple subsystem configuration IDs. - - - - - - - One of the optional filters to scope the remote resources for -which the property page is to appear. -Specify as many of these optional filters like this as needed to explicitly scope -this property page element. - -<p> -This filter specifies a subsystem configuration category, such that -this -property page will only appear for remote resources returned from subsystems -owned by subsystem configurations -declared defined with the specified category. - -<p> -This category can be scalar, or it can be generic to match on -multiple subsystem configuration categories. The -categories of the Predefined subsystem configurations that display -remote resources in the Remote -Systems view are: -</p> -<ul> -<li><b>files</b>. For subsystems that list hierarchical file -system resources, such as folders and files. -<li><b>nativefiles</b>. For subsystems that list non-hierarchical file -system resources, such as in the iSeries QSYS file system. -<li><b>commands</b>. For subsystems that list remote commands. -<li><b>jobs</b>. For subsystems that list remote jobs. -</ul> -<br> - - - - - - - One of the optional filters to scope the remote resources for -which the popup menu actions are to appear. -Specify as many of these optional filters like this as needed to explicitly scope -all the actions defined in this objectContribution element. -<br> -This filter specifies a single system type, or semicolon-separated list of system types, -or asterisk for all system types (the default). -Will scope these actions to only remote objects from systems of this type or types. -<br><br> - - - - - - - One of the optional filters to scope the remote resources for -which the property page is to appear. -Specify as many of these optional filters like this as needed to explicitly scope this property page element. -<p> -This filter specifies a simple or generic resource name. -Only resources whose name matches this filter will show the property page -defined within this page element. -</p> - - - - - - - One of the optional filters to scope the remote resources for -which the property page is to appear. -Specify as many of these optional filters like this as needed to explicitly scope this property page element. -<p> -This filter specifies a type category. Normally the subsystemconfigurationid -is sufficient, but some subsystems display multiple types of -resources, and these are categorized by a type name that can -be used to scope property pages. -<br> - - - - - - - One of the optional filters to scope the remote resources for -which the property page is to appear. -Specify as many of these optional filters like this as needed to explicitly scope -this property page element. - -<p> -This filter specifies a resource type, either simple or generic. -The resource types depends on the subsystem. -<br> - - - - - - - One of the optional filters to scope the remote resources for -which the property page is to appear. -Specify as many of these optional filters like this as needed to explicitly scope -this property page element. - -<p> -This filter specifies a simple or generic resource subtype to -match. Not all subsystems support subtypes for their resources. -<br> - - - - - - - One of the optional filters to scope the remote resources for -which the property page is to appear. -Specify as many of these optional filters like this as needed to explicitly scope -this property page element. - -<p> -This filter specifies a simple or generic resource sub-subtype -to match. -</p> - - - - - - - - - - - - The following is a simple example of a property page for -files or folders in any remote system type: -<h3>Example One</h3> -<p> -<pre> -<extension point="org.eclipse.rse.ui.propertyPages"> - <page - class="com.acme.myPropertyPage1" - id="com.acme.mypropertypage1" - name="Remote Folder and File Info" - typecategoryfilter="files"> - </page> -</extension> -</pre> -</p> - -The following refines the first example so it only applies -to files, versus folders, and only for local files: -<h3>Example Two</h3> -<p> -<pre> -<extension point="org.eclipse.rse.ui.propertyPages"> - <page - class="com.acme.myPropertyPage2" - id="com.acme.mypropertypage2" - name="Remote File Info" - typecategoryfilter="files" - typefilter="file" - subsystemconfigurationid="local.files"> - </page> -</extension> -</pre> -</p> - -The following refines the second example so it only applies -to local Java files: -<h3>Example Three</h3> -<p> -<pre> -<extension point="org.eclipse.rse.ui.propertyPages"> - <page - class="com.acme.myPropertyPage3" - id="com.acme.mypropertypage3" - name="Remote Java File Info" - typecategoryfilter="files" - typefilter="file" - subsystemconfigurationid="local.files" - namefilter="*.java"> - </page> -</extension> -</pre> -</p> - - -<p> -Remember, you can repeat the <samp>page</samp> elements as needed, to define -multiple property pages within the same extension configuration. -</p> - - - - - - - - - Your actions must all implement the interface <samp>org.eclipse.ui.IWorkbenchPropertyPage</samp>. -Typically, you will subclass one of the supplied base classes -for this extension point: -<ul> -<li><b>org.eclipse.rse.ui.propertypages.SystemAbstractPropertyPageExtensionAction</b>, -in plugin org.eclipse.rse.ui. -Base class offering generic support for any remote resource property page, for any system type. -<li><b>org.eclipse.rse.files.ui.propertypages.SystemAbstractRemoteFilePropertyPageExtensionAction</b>, -in plugin org.eclipse.rse.files.ui. -Specialized base class offering specific support for any remote file or folder property page, for any system type. -</ul> -<br> - - - - - - - - - There is no supplied implementation for this extension point. - - - - - - - - - Copyright (c) 2002, 2006 IBM Corporation. All Rights Reserved. -This program and the accompanying materials are made available under the terms -of the Eclipse Public License v1.0 which accompanies this distribution, and is -available at http://www.eclipse.org/legal/epl-v10.html - -Contributors: -IBM Corporation - initial API and implementation - - - - diff --git a/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemPopupMenuActionContributor.java b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemPopupMenuActionContributor.java deleted file mode 100644 index 4b06e913adb..00000000000 --- a/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemPopupMenuActionContributor.java +++ /dev/null @@ -1,594 +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.core; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IAdapterManager; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jface.action.AbstractGroupMarker; -import org.eclipse.jface.action.GroupMarker; -import org.eclipse.jface.action.IContributionItem; -import org.eclipse.jface.action.IContributionManager; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.rse.ui.SystemMenuManager; -import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter; -import org.eclipse.ui.IWorkbenchActionConstants; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.internal.ActionDescriptor; -import org.eclipse.ui.internal.ActionExpression; -import org.eclipse.ui.internal.IObjectActionContributor; -import org.eclipse.ui.internal.ObjectFilterTest; -import org.eclipse.ui.internal.ObjectPluginAction; -import org.eclipse.ui.internal.PluginAction; -import org.eclipse.ui.internal.PluginActionBuilder; -import org.eclipse.ui.internal.PluginActionContributionItem; - -/** - * This class parses the tag from our - * org.eclipse.rse.core.PopupMenus extension point. - *

- * We modelled our org.eclipse.rse.core.popupMenus extension point - * after the org.eclipse.ui.popupMenus extension point, so it makes sense to model - * the code to support it after the Eclipse code to support theirs. - * To that end, we have to replace the class that parses the tag, - * because that class does not support subclassing, and change it to: - *

    - *
  • Ignore all processing of the objectClass attribute, because we don't have one. - *
  • Add processing for the filter attributes we added: subsystemconfigurationid, - * namefilter, typecategoryfilter, - * typefilter, subtypefilter, subsubtypefilter - *
- * - * TODO use overrides list - * - * @see SystemPopupMenuActionContributorManager - */ -public class SystemPopupMenuActionContributor extends PluginActionBuilder implements IObjectActionContributor { - - private static final String ATT_TYPE_CATEGORY_FILTER = "typecategoryfilter"; //$NON-NLS-1$ - private static final String ATT_NAME_FILTER = "namefilter"; //$NON-NLS-1$ - private static final String ATT_TYPE_FILTER = "typefilter"; //$NON-NLS-1$ - private static final String ATT_SUBTYPE_FILTER = "subtypefilter"; //$NON-NLS-1$ - private static final String ATT_SUBSUBTYPE_FILTER = "subsubtypefilter"; //$NON-NLS-1$ - private static final String ATT_SUBSYSTEM_FACTORY_ID = "subsystemconfigurationid"; //$NON-NLS-1$ - private static final String ATT_SUBSYSTEM_FACTORY_CATEGORY = "subsystemconfigurationCategory"; //$NON-NLS-1$ - private static final String ATT_SYSTEM_TYPES = "systemTypes"; //$NON-NLS-1$ - private static final String ATT_ID = "id"; //$NON-NLS-1$ - private static final String ATT_NAME = "name"; //$NON-NLS-1$ - private static final String ATT_LABEL = "label"; //$NON-NLS-1$ - private static final String ATT_PATH = "path"; //$NON-NLS-1$ - private static final String TAG_OBJECT_CONTRIBUTION = "objectContribution";//$NON-NLS-1$ - private static final String TAG_MENU = "menu"; //$NON-NLS-1$ - private static final String TAG_ACTION = "action"; //$NON-NLS-1$ - private static final String TAG_SEPARATOR = "separator"; //$NON-NLS-1$ - private static final String TAG_FILTER = "filter"; //$NON-NLS-1$ - private static final String TAG_VISIBILITY = "visibility"; //$NON-NLS-1$ - private static final String TAG_GROUP_MARKER = "groupMarker"; //$NON-NLS-1$ - private IConfigurationElement config; - private List cachedMenus; - private List cachedActions; - private boolean configRead = false; - private ObjectFilterTest filterTest; - private ActionExpression visibilityTest; - private SystemRemoteObjectMatcher matcher = null; - - /** - * Constructor for SystemPopupMenuActionContributor - */ - public SystemPopupMenuActionContributor(IConfigurationElement element) { - super(); - config = element; - cachedMenus = new ArrayList(); - cachedActions = new ArrayList(); - String categoryfilter = element.getAttribute(ATT_TYPE_CATEGORY_FILTER); - String namefilter = element.getAttribute(ATT_NAME_FILTER); - String typefilter = element.getAttribute(ATT_TYPE_FILTER); - String subtypefilter = element.getAttribute(ATT_SUBTYPE_FILTER); - String subsubtypefilter = element.getAttribute(ATT_SUBSUBTYPE_FILTER); - String subsystemfilter = element.getAttribute(ATT_SUBSYSTEM_FACTORY_ID); - String subsystemCategoryFilter = element.getAttribute(ATT_SUBSYSTEM_FACTORY_CATEGORY); - String systypes = element.getAttribute(ATT_SYSTEM_TYPES); - matcher = new SystemRemoteObjectMatcher(subsystemfilter, subsystemCategoryFilter, categoryfilter, systypes, namefilter, typefilter, subtypefilter, subsubtypefilter); - } - - /** - * Return what was specified for the typecategoryfilter xml attribute. - */ - public String getCategoryFilter() { - return matcher.getCategoryFilter(); - } - - /** - * Return what was specified for the namefilter xml attribute. - */ - public String getNameFilter() { - return matcher.getNameFilter(); - } - - /** - * Return what was specified for the typefilter xml attribute. - */ - public String getTypeFilter() { - return matcher.getTypeFilter(); - } - - /** - * Return what was specified for the subtypefilter xml attribute. - */ - public String getSubTypeFilter() { - return matcher.getSubTypeFilter(); - } - - /** - * Return what was specified for the subsubtypefilter xml attribute. - */ - public String getSubSubTypeFilter() { - return matcher.getSubSubTypeFilter(); - } - - /** - * Return what was specified for the subsystemconfigurationid xml attribute. - */ - public String getSubSystemConfigurationId() { - return matcher.getSubSystemConfigurationId(); - } - - /** - * Return what was specified for the subsystemconfigurationCategory xml attribute. - */ - public String getSubSystemConfigurationCategoryFilter() { - return matcher.getSubSystemConfigurationCategoryFilter(); - } - - /** - * Return what was specified for the systemTypes xml attribute. - */ - public String getSystemTypesFilter() { - return matcher.getSystemTypesFilter(); - } - - /** - * Returns the implementation of ISystemRemoteElement for the given - * object. Returns null if this object is not adaptable to this. - */ - private ISystemRemoteElementAdapter getRemoteAdapter(Object object) { - Object adapter = null; - if (object instanceof IAdaptable) { - IAdaptable adaptable = (IAdaptable) object; - adapter = adaptable.getAdapter(ISystemRemoteElementAdapter.class); - } else { - IAdapterManager adapterManager = Platform.getAdapterManager(); - adapter = adapterManager.getAdapter(object, ISystemRemoteElementAdapter.class); - } - return (ISystemRemoteElementAdapter) adapter; - } - - /** - * Contributes actions applicable for the current selection. - */ - public boolean contributeObjectActions(IWorkbenchPart part, SystemMenuManager menu, ISelectionProvider selProv, List actionIdOverrides) { - return contributeObjectActions(part, menu.getMenuManager(), selProv, actionIdOverrides); - } - - /** - * Contributes actions applicable for the current selection. - */ - public boolean contributeObjectActions(IWorkbenchPart part, IMenuManager menu, ISelectionProvider selProv, List actionIdOverrides) { - // Parse configuration - readConfigElement(); - if (cache == null) { - return false; - } - if (cachedActions.size() == 0) { - return false; - } - // Get a structured selection. - ISelection sel = selProv.getSelection(); - if ((sel == null) || !(sel instanceof IStructuredSelection)) { - return false; - } - IStructuredSelection selection = (IStructuredSelection) sel; - // Generate actions. - boolean actualContributions = false; - for (int i = 0; i < cachedActions.size(); i++) { - Object obj = cachedActions.get(i); - if (obj instanceof ActionDescriptor) { - ActionDescriptor ad = (ActionDescriptor) obj; - contributeMenuAction(ad, menu, true); - // Update action for the current selection and part. - if (ad.getAction() instanceof ObjectPluginAction) { - ObjectPluginAction action = (ObjectPluginAction) ad.getAction(); - //String actionText = action.getText(); // for debugging - action.selectionChanged(selection); - //System.out.println("action " + actionText + " enabled? " + action.isEnabled()); - action.setActivePart(part); - } - actualContributions = true; - } - } - return actualContributions; - } - - /** - * Contribute to the list the action identifiers from other contributions that - * this contribution wants to override. Actions of these identifiers will - * not be contributed. - * @see IObjectActionContributor - */ - public void contributeObjectActionIdOverrides(List actionIdOverrides) { - readConfigElement(); - // TODO: need to implement at some point - } - - /** - * Contributes menus applicable for the current selection. - */ - public boolean contributeObjectMenus(SystemMenuManager menu, ISelectionProvider selProv) { - return contributeObjectMenus(menu.getMenuManager(), selProv); - } - - /** - * Contributes menus applicable for the current selection. - * @see IObjectActionContributor - */ - public boolean contributeObjectMenus(IMenuManager menu, ISelectionProvider selProv) { - // Parse config element. - readConfigElement(); - if (cache == null) { - return false; - } - if (cachedMenus.size() == 0) { - return false; - } - // Get a structured selection. - ISelection sel = selProv.getSelection(); - if ((sel == null) || !(sel instanceof IStructuredSelection)) { - return false; - } - // Generate menus. - boolean actualContributions = false; - for (int i = 0; i < cachedMenus.size(); i++) { - Object obj = cachedMenus.get(i); - if (obj instanceof IConfigurationElement) { - IConfigurationElement menuElement = (IConfigurationElement) obj; - contributeMenu(menuElement, menu, true); - actualContributions = true; - } - } - return actualContributions; - } - - /** - * This factory method returns a new ActionDescriptor for the - * configuration element. - */ - protected ActionDescriptor createActionDescriptor(IConfigurationElement element) { - return new ActionDescriptor(element, ActionDescriptor.T_POPUP); - } - - /** - * Returns true if the current selection matches all the given filtering criteria. - */ - public boolean isApplicableTo(Object object) { - readConfigElement(); - ISystemRemoteElementAdapter adapter = getRemoteAdapter(object); - boolean matches = (adapter != null); - matches = matches && (visibilityTest == null || visibilityTest.isEnabledFor(object)); - matches = matches && (filterTest == null || filterTest.matches(object, true)); - matches = matches && matcher.appliesTo(adapter, object); - return matches; - } - - /** - * Reads the configuration element and all the children. - * This creates an action descriptor for every action in the extension. - */ - private void readConfigElement() { - if (!configRead) { - currentContribution = createContribution(); - readElementChildren(config); - if (cache == null) cache = new ArrayList(4); - cache.add(currentContribution); - currentContribution = null; - configRead = true; - } - } - - protected void readContributions(String id, String tag, String extensionPoint) { - cachedMenus.clear(); - cachedActions.clear(); - super.readContributions(id, tag, extensionPoint); - } - - /** - * Implements abstract method to handle the provided XML element - * in the registry. - */ - protected boolean readElement(IConfigurationElement element) { - String tag = element.getName(); - if (tag.equals(TAG_VISIBILITY)) { - visibilityTest = new ActionExpression(element); - return true; - } - if (tag.equals(TAG_FILTER)) { - if (filterTest == null) filterTest = new ObjectFilterTest(); - filterTest.addFilterElement(element); - return true; - } - // Ignore all object contributions element as these - // are handled by the ObjectActionContributorReader. - if (tag.equals(TAG_OBJECT_CONTRIBUTION)) { - return true; - } - // Found top level contribution element - if (tag.equals(targetContributionTag)) { - if (targetID != null) { - // Ignore contributions not matching target id - String id = getTargetID(element); - if (id == null || !id.equals(targetID)) return true; - } - // Read it's sub-elements - currentContribution = createContribution(); - readElementChildren(element); - if (cache == null) cache = new ArrayList(4); - cache.add(currentContribution); - currentContribution = null; - return true; - } - // Found menu contribution sub-element - if (tag.equals(TAG_MENU)) { - currentContribution.addMenu(element); - cachedMenus.add(element); - return true; - } - // Found action contribution sub-element - if (tag.equals(TAG_ACTION)) { - ActionDescriptor ades = createActionDescriptor(element); - currentContribution.addAction(ades); - cachedActions.add(ades); - return true; - } - return false; - } - -// /** -// * get the root part of the path -// */ -// protected String getPathRoot(String path) { -// int loc = path.indexOf('/'); -// if (loc != -1) { -// if (loc > 0) -// return path.substring(0, loc); -// else -// return ""; // should never happen! -// } else { -// return path; -// } -// } - - /* - * @see IObjectContributor#canAdapt() - */ - public boolean canAdapt() { - return false; - } - - /**** EVERYTHING BELOW IS HACK ***/ - /** - * Creates a menu from the information in the menu configuration element and - * adds it into the provided menu manager. If 'appendIfMissing' is true, and - * menu path slot is not found, it will be created and menu will be added - * into it. Otherwise, add operation will fail. - */ - protected void contributeMenu(IConfigurationElement menuElement, IMenuManager mng, boolean appendIfMissing) { - // Get config data. - String id = menuElement.getAttribute(ATT_ID); - String label = menuElement.getAttribute(ATT_LABEL); - String path = menuElement.getAttribute(ATT_PATH); - if (label == null) { - SystemBasePlugin.logInfo("Invalid Menu Extension (label == null): " + id); //$NON-NLS-1$ - return; - } - // Calculate menu path and group. - String group = null; - if (path != null) { - int loc = path.lastIndexOf('/'); - if (loc != -1) { - group = path.substring(loc + 1); - path = path.substring(0, loc); - } else { - // assume that path represents a slot - // so actual path portion should be null - group = path; - path = null; - } - } - // Find parent menu. - IMenuManager parent = mng; - if (path != null) { - parent = mng.findMenuUsingPath(path); - if (parent == null) { - SystemBasePlugin.logInfo("Invalid Menu Extension (Path is invalid): " + id); //$NON-NLS-1$ - return; - } - } - // Find reference group. - if (group == null) group = IWorkbenchActionConstants.MB_ADDITIONS; - IContributionItem sep = parent.find(group); - if (sep == null) { - if (appendIfMissing) - addGroup(parent, group); - else { - SystemBasePlugin.logInfo("Invalid Menu Extension (Group is invalid): " + id); //$NON-NLS-1$ - return; - } - } - // If the menu does not exist create it. - IMenuManager newMenu = parent.findMenuUsingPath(id); - if (newMenu == null) newMenu = new MenuManager(label, id); - // Add the menu - try { - insertAfter(parent, group, newMenu); - } catch (IllegalArgumentException e) { - SystemBasePlugin.logInfo("Invalid Menu Extension (Group is missing): " + id); //$NON-NLS-1$ - } - // Get the menu again as it may be wrapped, otherwise adding - // the separators and group markers below will not be wrapped - // properly if the menu was just created. - newMenu = parent.findMenuUsingPath(id); - if (newMenu == null) SystemBasePlugin.logInfo("Could not find new menu: " + id); //$NON-NLS-1$ - // Create separators. - IConfigurationElement[] children = menuElement.getChildren(); - for (int i = 0; i < children.length; i++) { - String childName = children[i].getName(); - if (childName.equals(TAG_SEPARATOR)) { - contributeSeparator(newMenu, children[i]); - } else if (childName.equals(TAG_GROUP_MARKER)) { - contributeGroupMarker(newMenu, children[i]); - } - } - } - - /** - * Contributes action from action descriptor into the provided menu manager. - */ - protected void contributeMenuAction(ActionDescriptor ad, IMenuManager menu, boolean appendIfMissing) { - // Get config data. - String mpath = ad.getMenuPath(); - String mgroup = ad.getMenuGroup(); - if (mpath == null && mgroup == null) return; - // Find parent menu. - IMenuManager parent = menu; - if (mpath != null) { - parent = parent.findMenuUsingPath(mpath); - if (parent == null) { - SystemBasePlugin.logInfo("Invalid Menu Extension (Path is invalid): " + ad.getId()); //$NON-NLS-1$ - return; - } - } - // Find reference group. - if (mgroup == null) mgroup = IWorkbenchActionConstants.MB_ADDITIONS; - IContributionItem sep = parent.find(mgroup); - if (sep == null) { - if (appendIfMissing) - addGroup(parent, mgroup); - else { - SystemBasePlugin.logInfo("Invalid Menu Extension (Group is invalid): " + ad.getId()); //$NON-NLS-1$ - return; - } - } - // Add action. - try { - insertAfter(parent, mgroup, ad.getAction()); - } catch (IllegalArgumentException e) { - SystemBasePlugin.logInfo("Invalid Menu Extension (Group is missing): " + ad.getId()); //$NON-NLS-1$ - } - } - - /** - * Creates a named menu separator from the information in the configuration element. - * If the separator already exists do not create a second. - */ - protected void contributeSeparator(IMenuManager menu, IConfigurationElement element) { - String id = element.getAttribute(ATT_NAME); - if (id == null || id.length() <= 0) return; - IContributionItem sep = menu.find(id); - if (sep != null) return; - insertMenuGroup(menu, new Separator(id)); - } - - /** - * Creates a named menu group marker from the information in the configuration element. - * If the marker already exists do not create a second. - */ - protected void contributeGroupMarker(IMenuManager menu, IConfigurationElement element) { - String id = element.getAttribute(ATT_NAME); - if (id == null || id.length() <= 0) return; - IContributionItem marker = menu.find(id); - if (marker != null) return; - insertMenuGroup(menu, new GroupMarker(id)); - } - - /** - * Contributes action from the action descriptor into the provided tool bar manager. - */ - protected void contributeToolbarAction(ActionDescriptor ad, IToolBarManager toolbar, boolean appendIfMissing) { - // Get config data. - String tId = ad.getToolbarId(); - String tgroup = ad.getToolbarGroupId(); - if (tId == null && tgroup == null) return; - // Find reference group. - if (tgroup == null) tgroup = IWorkbenchActionConstants.MB_ADDITIONS; - IContributionItem sep = null; - sep = toolbar.find(tgroup); - if (sep == null) { - if (appendIfMissing) { - addGroup(toolbar, tgroup); - } else { - SystemBasePlugin.logInfo("Invalid Toolbar Extension (Group is invalid): " + ad.getId()); //$NON-NLS-1$ - return; - } - } - // Add action to tool bar. - try { - insertAfter(toolbar, tgroup, ad.getAction()); - } catch (IllegalArgumentException e) { - SystemBasePlugin.logInfo("Invalid Toolbar Extension (Group is missing): " + ad.getId()); //$NON-NLS-1$ - } - } - - /** - * Inserts the separator or group marker into the menu. Subclasses may override. - */ - protected void insertMenuGroup(IMenuManager menu, AbstractGroupMarker marker) { - menu.add(marker); - } - - /** - * Inserts an action after another named contribution item. - * Subclasses may override. - */ - protected void insertAfter(IContributionManager mgr, String refId, PluginAction action) { - insertAfter(mgr, refId, new PluginActionContributionItem(action)); - } - - /** - * Inserts a contribution item after another named contribution item. - * Subclasses may override. - */ - protected void insertAfter(IContributionManager mgr, String refId, IContributionItem item) { - mgr.insertAfter(refId, item); - } - - /** - * Adds a group to a contribution manager. - * Subclasses may override. - */ - protected void addGroup(IContributionManager mgr, String name) { - mgr.add(new Separator(name)); - } -} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemPopupMenuActionContributorManager.java b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemPopupMenuActionContributorManager.java deleted file mode 100644 index 5b87b130022..00000000000 --- a/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemPopupMenuActionContributorManager.java +++ /dev/null @@ -1,161 +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.core; - -import java.util.Iterator; -import java.util.List; -import java.util.Vector; - -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.rse.ui.SystemMenuManager; -import org.eclipse.ui.IWorkbenchPart; - - -/** - * This class provides for the management of all popup menus provided by the - * org.eclipse.rse.core.popupMenus extension point. - * To that end, we must - *
    - *
  • Process the additional filtering attributes we added to the tag - *
  • Forgot all the code to do matching by object class type. - * We can't do that because all remote objects - * might be of the same type. Instead we replace that code with code - * to do matching via those additional - * filter attributes we described. - *
- * @see SystemPopupMenuActionContributor - */ -public class SystemPopupMenuActionContributorManager { - - private static final String T_OBJECT_CONTRIBUTION = "objectContribution"; //$NON-NLS-1$ - private static final String POPUP_MENU_EXTENSION_POINT_ID = "org.eclipse.rse.ui.popupMenus"; //$NON-NLS-1$ - private static SystemPopupMenuActionContributorManager singleton; - private Vector contributors = new Vector(); - - /** - * Returns the singleton instance of this manager. - */ - public static SystemPopupMenuActionContributorManager getManager() { - if (singleton == null) { - singleton = new SystemPopupMenuActionContributorManager(); - } - return singleton; - } - - /** - * Constructor for SystemPopupMenuActionContributorManager - */ - public SystemPopupMenuActionContributorManager() { - super(); - loadContributors(); - } - - /** - * Reads the registry, constructs contributors from the "objectContribution" - * elements found, and registers them in the RSE popup menu registry. - */ - private void loadContributors() { - IExtensionRegistry registry = Platform.getExtensionRegistry(); - IConfigurationElement[] popupMenus = registry.getConfigurationElementsFor(POPUP_MENU_EXTENSION_POINT_ID); - for (int i = 0; i < popupMenus.length; i++) { - IConfigurationElement popupMenu = popupMenus[i]; - if (popupMenu.getName().equals(T_OBJECT_CONTRIBUTION)) - { - SystemPopupMenuActionContributor contributor = new SystemPopupMenuActionContributor(popupMenu); - contributors.add(contributor); - } - else - { - IConfigurationElement[] popupMenuChildren = popupMenu.getChildren(); - for (int j = 0; j < popupMenuChildren.length; j++) { - IConfigurationElement popupMenuChild = popupMenuChildren[j]; - if (popupMenuChild.getName().equals(T_OBJECT_CONTRIBUTION)) - { - SystemPopupMenuActionContributor contributor = new SystemPopupMenuActionContributor(popupMenuChild); - contributors.add(contributor); - } - else - { - //TODO: add a warning message for this - SystemBasePlugin.logWarning("Invalid Tag found: " + popupMenuChild.getName()); //$NON-NLS-1$ - } - } - } - } - } - - /** - * Contributes submenus and/or actions applicable to the selection in the - * provided viewer into the provided popup menu. - * It is called from the SystemView class when filling the context menu. - * TODO: use actionIdOverrides list - * @param part the IWorkbenchPart in which the selection lives and the menu will appear - * @param popupMenu the SystemMenuManager (menu) in which the menu items are to be placed - * @param selectionProvider the ISelectionProvider that will give us access to the selected items in the view - * @param actionIdOverrides the List of overrides for the actions (currently ignored) - * @return true if anything was added to the menu - */ - public boolean contributeObjectActions(IWorkbenchPart part, SystemMenuManager popupMenu, ISelectionProvider selectionProvider, List actionIdOverrides) { - /* get the selection */ - ISelection selection = selectionProvider.getSelection(); - if ((selection == null) || !(selection instanceof IStructuredSelection)) return false; - IStructuredSelection structuredSelection = (IStructuredSelection) selection; - - /* Convert the selection to an array. This is an optimization since they must each be scanned several times. */ - Object[] selections = structuredSelection.toArray(); - - /* Finds those contributors that match every selection. Those that match only some are discarded. */ - Vector matchingContributors = new Vector(10); // 10 is arbitrary but reasonable bound - for (Iterator z = contributors.iterator(); z.hasNext();) { - boolean matches = true; - SystemPopupMenuActionContributor contributor = (SystemPopupMenuActionContributor) z.next(); - for (int i = 0; i < selections.length && matches; i++) { - Object object = selections[i]; - if (!contributor.isApplicableTo(object)) { - matches = false; - } - } - if (matches) { - matchingContributors.add(contributor); - } - } - - /* Process the menu contributions. */ - int actualContributions = 0; - for (Iterator z = matchingContributors.iterator(); z.hasNext();) { - SystemPopupMenuActionContributor contributor = (SystemPopupMenuActionContributor) z.next(); - boolean contributed = contributor.contributeObjectMenus(popupMenu, selectionProvider); - if (contributed) actualContributions++; - } - - /* Process the object action contributions. */ - for (Iterator z = matchingContributors.iterator(); z.hasNext();) { - SystemPopupMenuActionContributor contributor = (SystemPopupMenuActionContributor) z.next(); - boolean contributed = contributor.contributeObjectActions(part, popupMenu, selectionProvider, actionIdOverrides); - if (contributed) actualContributions++; - } - - /* return true if there were any contributions made */ - return (actualContributions > 0); - } - -} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemPropertyPageExtension.java b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemPropertyPageExtension.java deleted file mode 100644 index c37b1475d38..00000000000 --- a/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemPropertyPageExtension.java +++ /dev/null @@ -1,371 +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.core; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.HashMap; -import java.util.Iterator; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.rse.ui.propertypages.SystemRemotePropertyPageNode; -import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter; -import org.eclipse.ui.IActionFilter; -import org.eclipse.ui.IWorkbenchPropertyPage; -import org.eclipse.ui.internal.dialogs.IPropertyPageContributor; -import org.eclipse.ui.internal.dialogs.PropertyPageManager; -import org.osgi.framework.Bundle; - - -/** - * Represents a registered remote system property page. These are registered - * via our propertyPages extension point. - *

- * This class encapsulates all the information supplied by the extension xml. - *

    - *
  1. id. Unique identifier - *
  2. name. Displayable property page name - *
  3. class. The class which implements IWorkbenchPropertyPage - *
  4. subsystemconfigurationid. For scoping to remote objects for a given subsystem configuration - *
  5. subsystemconfigurationCategory. For scoping to remote objects for a given subsystem configuration category - *
  6. systemTypes. For scoping to remote objects from systems of a given type, or semicolon-separated types. - *
  7. namefilter. For scoping to remote objects of a given name - *
  8. typecategoryfilter. For scoping to remote objects for a given remote object type category - *
  9. typefilter. For scoping to remote objects of a given type - *
  10. subtypefilter. For scoping to remote objects of a given subtype - *
  11. subsubtypefilter. For scoping to remote objects of a given sub-subtype - *
- * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter - */ -public class SystemPropertyPageExtension implements IPropertyPageContributor -{ - - private String name,id; - private ImageDescriptor image = null; - private SystemRemoteObjectMatcher matcher = null; - private IConfigurationElement element = null; - private IWorkbenchPropertyPage object = null; - private boolean atTop = false; - private HashMap filterProperties; - private static final String TAG_FILTER="filter";//$NON-NLS-1$ - - /** - * Constructor - */ - public SystemPropertyPageExtension(IConfigurationElement element) - { - this.element = element; - this.id = element.getAttribute("id"); //$NON-NLS-1$ - this.name = element.getAttribute("name"); //$NON-NLS-1$ - this.image = getPluginImage(element, element.getAttribute("icon")); //$NON-NLS-1$ - String sAtTop = element.getAttribute("first"); //$NON-NLS-1$ - if ((sAtTop != null) && sAtTop.equals("1")) //$NON-NLS-1$ - atTop = true; - - String subsystemfilter,subsystemCategoryFilter,systypes,categoryfilter,namefilter,typefilter,subtypefilter,subsubtypefilter; - - categoryfilter = element.getAttribute("typecategoryfilter"); //$NON-NLS-1$ - namefilter = element.getAttribute("namefilter"); //$NON-NLS-1$ - typefilter = element.getAttribute("typefilter"); //$NON-NLS-1$ - subtypefilter = element.getAttribute("subtypefilter"); //$NON-NLS-1$ - subsubtypefilter = element.getAttribute("subsubtypefilter"); //$NON-NLS-1$ - subsystemfilter = element.getAttribute("subsystemconfigurationid"); //$NON-NLS-1$ - subsystemCategoryFilter = element.getAttribute("subsystemconfigurationCategory"); //$NON-NLS-1$ - systypes = element.getAttribute("systemTypes"); //$NON-NLS-1$ - - filterProperties = null; - IConfigurationElement[] children = element.getChildren(); - for (int i=0; iname xml attribute. - */ - public String getName() - { - return name; - } - /** - * Getter method. - * Return what was specified for the id xml attribute. - */ - public String getId() - { - return id; - } - /** - * Getter method. - * Return what was specified for the icon xml attribute. - */ - public ImageDescriptor getImage() - { - return image; - } - /** - * Getter method. - * Return what was last set via call to setAtTop(boolean) - */ - public boolean isAtTop() - { - return atTop; - } - /** - * Set the at top attribute - */ - public void setAtTop(boolean atTop) - { - this.atTop = atTop; - } - /** - * Getter method. - * Return what was specified for the typecategoryfilter xml attribute. - */ - public String getCategoryFilter() - { - return matcher.getCategoryFilter(); - } - /** - * Getter method. - * Return what was specified for the namefilter xml attribute. - */ - public String getNameFilter() - { - return matcher.getNameFilter(); - } - /** - * Getter method. - * Return what was specified for the typefilter xml attribute. - */ - public String getTypeFilter() - { - return matcher.getTypeFilter(); - } - /** - * Getter method. - * Return what was specified for the subtypefilter xml attribute. - */ - public String getSubTypeFilter() - { - return matcher.getSubTypeFilter(); - } - /** - * Getter method. - * Return what was specified for the subsubtypefilter xml attribute. - */ - public String getSubSubTypeFilter() - { - return matcher.getSubSubTypeFilter(); - } - /** - * Getter method. - * Return what was specified for the subsystemconfigurationid xml attribute. - */ - public String getSubSystemConfigurationId() - { - return matcher.getSubSystemConfigurationId(); - } - /** - * Getter method. - * Return what was specified for the subsystemconfigurationCategory xml attribute. - */ - public String getSubSystemConfigurationCategoryFilter() - { - return matcher.getSubSystemConfigurationCategoryFilter(); - } - /** - * Getter method. - * Return what was specified for the systemTypes xml attribute. - */ - public String getSystemTypesFilter() - { - return matcher.getSystemTypesFilter(); - } - - /** - * Retrieve image in given plugin's directory tree, given its file name. - * The file name should be relatively qualified with the subdir containing it. - */ - protected ImageDescriptor getPluginImage(IConfigurationElement element, String fileName) - { - URL path = getBundle(element).getEntry("/"); //$NON-NLS-1$ - URL fullPathString = null; - try { - fullPathString = new URL(path,fileName); - return ImageDescriptor.createFromURL(fullPathString); - } catch (MalformedURLException e) {} - return null; - } - - protected Bundle getBundle(IConfigurationElement element) - { - String nameSpace = element.getDeclaringExtension().getNamespaceIdentifier(); - return Platform.getBundle(nameSpace); - } - - /** - * Given an ISystemRemoteElement, return true if that element - * should show this property page. Looks at the filter criteria. - */ - public boolean appliesTo(ISystemRemoteElementAdapter adapter, Object element) - { - boolean matches = matcher.appliesTo(adapter, element); - if (!matches) - return false; - // Test custom filter - if (filterProperties == null) - return true; - IActionFilter filter = null; - // If this is a resource contributor and the object is not a resource but - // is an adaptable then get the object's resource via the adaptable mechanism. - Object testObject = element; - /* - if (isResourceContributor - && !(object instanceof IResource) - && (object instanceof IAdaptable)) - { - Object result = ((IAdaptable)object).getAdapter(IResource.class); - if (result != null) - testObject = result; - }*/ - if (testObject instanceof IActionFilter) - filter = (IActionFilter)testObject; - else if (testObject instanceof IAdaptable) - filter = (IActionFilter)((IAdaptable)testObject).getAdapter(IActionFilter.class); - if (filter != null) - return testCustom(testObject, filter); - else - return true; - } - /** - * Returns whether the object passes a custom key value filter - * implemented by a matcher. - */ - private boolean testCustom(Object object, IActionFilter filter) - { - if (filterProperties == null) - return false; - Iterator iter = filterProperties.keySet().iterator(); - while (iter.hasNext()) - { - String key = (String)iter.next(); - String value = (String)filterProperties.get(key); - if (!filter.testAttribute(object, key, value)) - return false; - } - return true; - } - - - /** - * Instantiate and return the class that implements IWorkbenchPropertyPage - */ - public IWorkbenchPropertyPage getPropertyPage() - { - //if (object == null) - //{ - try - { - object = (IWorkbenchPropertyPage)element.createExecutableExtension("class"); //$NON-NLS-1$ - } catch (Exception exc) - { - SystemBasePlugin.logError("Unable to start remote property page extension "+id,exc); //$NON-NLS-1$ - } - //} - return object; - } - - public String toString() - { - return id; - } - - - // ----------------------------------- - // IPropertyPageContributor methods... - // ----------------------------------- - - /** - * Implement this method to add instances of PropertyPage class to the - * property page manager. - * @return true if pages were added, false if not. - */ - public boolean contributePropertyPages(PropertyPageManager manager, Object object) - { - boolean added = false; - SystemRemotePropertyPageNode node = new SystemRemotePropertyPageNode(this, object); - manager.addToRoot(node); - return added; - } - /** - * Returns true if this contributor should be considered - * for the given object. - */ - public boolean isApplicableTo(Object object) - { - return true; - } - /** - * Creates the page based on the information in the configuration element. - */ - public IWorkbenchPropertyPage createPage(Object element) // throws CoreException - { - IWorkbenchPropertyPage ppage = getPropertyPage(); - if (ppage != null) - { - if (element instanceof IAdaptable) { - ppage.setElement((IAdaptable)element); - } - - ppage.setTitle(name); - } - return ppage; - } - /** - * see IObjectContributor#canAdapt() - */ - public boolean canAdapt() - { - return false; - } - -} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemPropertyPageExtensionManager.java b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemPropertyPageExtensionManager.java deleted file mode 100644 index c7cd2def170..00000000000 --- a/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemPropertyPageExtensionManager.java +++ /dev/null @@ -1,106 +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.core; -import org.eclipse.rse.ui.RSEUIPlugin; -import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter; -import org.eclipse.ui.internal.dialogs.PropertyPageManager; - - -/** - * Manages remote system property page extenders. - * @see org.eclipse.rse.core.SystemPropertyPageExtension - */ -public class SystemPropertyPageExtensionManager -{ - private SystemPropertyPageExtension[] propertyPageSuppliers = null; - private static SystemPropertyPageExtensionManager inst = null; - //private PropertyPageContributorManager test = null; - /** - * Constructor. Don't call directly. - */ - protected SystemPropertyPageExtensionManager() - { - } - /** - * Get the singleton of this manager - */ - public static SystemPropertyPageExtensionManager getManager() - { - if (inst == null) - inst = new SystemPropertyPageExtensionManager(); - return inst; - } - - /** - * Get all the extenders of the remote properties page extension point - */ - public SystemPropertyPageExtension[] getPropertyPageSuppliers() - { - if (propertyPageSuppliers == null) - { - propertyPageSuppliers = RSEUIPlugin.getDefault().getPropertyPageExtensions(); - } - return propertyPageSuppliers; - } - - /** - * Return true if there are any remote property page contributions for the - * given selected object - */ - public boolean hasContributorsFor(ISystemRemoteElementAdapter adapter, Object element) - { - boolean hasContributors = false; - if (adapter != null) - { - getPropertyPageSuppliers(); - - if (propertyPageSuppliers != null) - { - for (int idx=0; !hasContributors && (idx