mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-07 08:15:48 +02:00
[173143] removing remote property page and remote popup menu extension points
This commit is contained in:
parent
c47a69d198
commit
6191ec4a50
31 changed files with 254 additions and 4260 deletions
|
@ -21,31 +21,37 @@ Martin Oberhuber (Wind River) - Adapted original tutorial code to Open RSE.
|
|||
<!-- Remote Object Popup Menu Actions -->
|
||||
<!-- ======================================= -->
|
||||
<!-- Tutorial #1: Creating a Remote Resource pop-up Menu Action -->
|
||||
<extension point="org.eclipse.rse.ui.popupMenus">
|
||||
<objectContribution id="actions.jar"
|
||||
typecategoryfilter="files"
|
||||
typefilter="file"
|
||||
namefilter="*.jar">
|
||||
<action id="actions.jar.show"
|
||||
enablesFor="1"
|
||||
label="Show contents"
|
||||
tooltip="List contents of this file"
|
||||
class="samples.ui.actions.ShowJarContents">
|
||||
</action>
|
||||
</objectContribution>
|
||||
<extension point="org.eclipse.ui.popupMenus">
|
||||
<objectContribution
|
||||
objectClass="org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile"
|
||||
nameFilter="*.jar"
|
||||
id="actions.jar">
|
||||
<action
|
||||
label="Show contents"
|
||||
tooltip="list contents of this file"
|
||||
class="samples.ui.actions.ShowJarContents"
|
||||
menubarPath="additions"
|
||||
enablesFor="1"
|
||||
id="actions.jar.show">
|
||||
</action>
|
||||
</objectContribution>
|
||||
</extension>
|
||||
|
||||
<!-- ======================================= -->
|
||||
<!-- Remote Object Property Pages -->
|
||||
<!-- ======================================= -->
|
||||
<!-- Tutorial #2: Creating a Remote Resource Property Page -->
|
||||
<extension point="org.eclipse.rse.ui.propertyPages">
|
||||
<page name="Folder Contents"
|
||||
class="samples.ui.propertypages.FolderInfoPropertyPage"
|
||||
id="samples.ui.PropertyPage1"
|
||||
typefilter="folder"
|
||||
typecategoryfilter="files">
|
||||
</page>
|
||||
<extension
|
||||
point="org.eclipse.ui.propertyPages">
|
||||
<page
|
||||
name="Folder Contents"
|
||||
class="samples.ui.propertypages.FolderInfoPropertyPage"
|
||||
id="samples.ui.PropertyPage1">
|
||||
<enabledWhen>
|
||||
<instanceof value="org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile"/>
|
||||
</enabledWhen>
|
||||
<filter name="isDirectory" value="true"/>
|
||||
</page>
|
||||
</extension>
|
||||
|
||||
<!-- ======================================= -->
|
||||
|
|
|
@ -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
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
{
|
||||
|
||||
|
|
|
@ -39,18 +39,19 @@ Contributors:
|
|||
<!-- ============================================ -->
|
||||
<!-- Define Remote Object Properties Pages -->
|
||||
<!-- ============================================ -->
|
||||
<extension
|
||||
point="org.eclipse.rse.ui.propertyPages">
|
||||
|
||||
<extension
|
||||
point="org.eclipse.ui.propertyPages">
|
||||
<page
|
||||
name="%RemotePropertyPage.File.Info"
|
||||
typecategoryfilter="files"
|
||||
class="org.eclipse.rse.files.ui.propertypages.SystemFilePropertyPage"
|
||||
id="org.eclipse.rse.files.PropertyPage">
|
||||
<enabledWhen>
|
||||
<instanceof value="org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile"/>
|
||||
</enabledWhen>
|
||||
</page>
|
||||
</extension>
|
||||
|
||||
|
||||
|
||||
<!-- ============================================ -->
|
||||
<!-- Define Workbench Properties Pages -->
|
||||
<!-- ============================================ -->
|
||||
|
|
|
@ -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.
|
||||
* <p>
|
||||
* The only method you must implement is {@link #run()}.
|
||||
* You may optionally override {@link #getEnabled(Object[])}
|
||||
* <p>
|
||||
* Convenience methods available in this class:
|
||||
* <ul>
|
||||
* <li>{@link #getSelectedRemoteFiles()}
|
||||
* <li>{@link #getFirstSelectedRemoteFile()}
|
||||
* <li>{@link #getRemoteFileSubSystem()}
|
||||
* <li>{@link #getRemoteFileSubSystemConfiguration()}
|
||||
* </ul>
|
||||
* <p>
|
||||
* 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.
|
||||
* <p>
|
||||
* 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<currentlySelected.length; idx++)
|
||||
if (!(currentlySelected[idx] instanceof IRemoteFile))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// CONVENIENCE METHODS WE ADD SPECIFICALLY FOR REMOTE FILE ACTIONS...
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Retrieve the currently selected objects as an array of IRemoteFile objects.
|
||||
* Array may be length 0, but will never be null, for convenience.
|
||||
*/
|
||||
public IRemoteFile[] getSelectedRemoteFiles()
|
||||
{
|
||||
IRemoteFile[] seld = new IRemoteFile[(sel!=null) ? sel.size() : 0];
|
||||
if (sel == null)
|
||||
return seld;
|
||||
Iterator i = sel.iterator();
|
||||
int idx=0;
|
||||
while (i.hasNext())
|
||||
seld[idx++] = (IRemoteFile)i.next();
|
||||
return seld;
|
||||
}
|
||||
/**
|
||||
* Retrieve the first selected object, as an IRemoteFile, for convenience.
|
||||
* Will be null if there is nothing selected
|
||||
*/
|
||||
public IRemoteFile getFirstSelectedRemoteFile()
|
||||
{
|
||||
//System.out.println("Sel = " + sel);
|
||||
if (sel == null)
|
||||
return null;
|
||||
Object obj = sel.getFirstElement();
|
||||
//System.out.println("obj = " + obj);
|
||||
if (obj instanceof IRemoteFile)
|
||||
return (IRemoteFile)obj;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the remote file subsystem from which the selected objects were resolved.
|
||||
* This has many useful methods in it, including support to transfer files to and
|
||||
* from the local and remote systems.
|
||||
*/
|
||||
public IRemoteFileSubSystem getRemoteFileSubSystem()
|
||||
{
|
||||
return (IRemoteFileSubSystem)getSubSystem();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the remote file subsystem factory which owns the subsystem from which the
|
||||
* selected remote objects were resolved. This has some useful methods in it,
|
||||
* including isUnixStyle() indicating if this remote file system is unix or windows.
|
||||
*/
|
||||
public IRemoteFileSubSystemConfiguration getRemoteFileSubSystemConfiguration()
|
||||
{
|
||||
return (IRemoteFileSubSystemConfiguration)getSubSystemConfiguration();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,119 +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.propertypages;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
||||
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.propertypages.SystemAbstractPropertyPageExtensionAction;
|
||||
import org.eclipse.rse.ui.propertypages.SystemBasePropertyPage;
|
||||
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 property pages supplied via the
|
||||
* org.eclipse.rse.ui.propertyPages extension point, targeting remote files
|
||||
* and/or remote folders.
|
||||
* <p>
|
||||
* The only method you must implement is {@link #createContentArea(Composite)}.
|
||||
* <p>
|
||||
* The benefits of this class are:</p>
|
||||
* <ul>
|
||||
* <li>From {@link SystemBasePropertyPage}: Adds a message line and {@link org.eclipse.rse.ui.messages.ISystemMessageLine} message methods.
|
||||
* <li>From {@link SystemBasePropertyPage}: Automatically assigns mnemonics to controls on this page, simplifying this common task. See {#wantMnemonics()}.
|
||||
* <li>From {@link SystemBasePropertyPage}: For pages with input controls, simplifies the page validation burden: only one method need be overridden: {@link #verifyPageContents()}
|
||||
* <li>From {@link SystemBasePropertyPage}: If no Default and Apply buttons wanted, the area reserved for this is removed, removing extra white space.
|
||||
* <li>Supplies helper method {@link #getRemoteFile()} for querying the selected remote file/folder.
|
||||
* <li>Supplies helper methods to query the {@link #getRemoteFileSubSystem() file-subsystem} and {@link #getSystemConnection() connection} containing the selected remote file.
|
||||
* </ul>
|
||||
*/
|
||||
public abstract class SystemAbstractRemoteFilePropertyPageExtensionAction
|
||||
extends SystemAbstractPropertyPageExtensionAction implements IWorkbenchPropertyPage
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public SystemAbstractRemoteFilePropertyPageExtensionAction()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
// ----------------------------------
|
||||
// OVERRIDABLE METHODS FROM PARENT...
|
||||
// ----------------------------------
|
||||
/**
|
||||
* <i><b>Abstract</b>. You must override.</i><br>
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* <i>You may override if your page has input fields. By default returns true.</i><br>
|
||||
* 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.
|
||||
* <p>
|
||||
* Subclasses should override to do full error checking on all the widgets on the page. Recommendation:<br>
|
||||
* <ul>
|
||||
* <li>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)}.
|
||||
* <li>If no errors detected, clear the message line via {@link #clearErrorMessage()}
|
||||
* </ul>
|
||||
*
|
||||
* @return true if there are no errors, false if any errors were found.
|
||||
*/
|
||||
protected boolean verifyPageContents()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// CONVENIENCE METHODS WE ADD SPECIFICALLY FOR REMOTE FILE ACTIONS...
|
||||
// ------------------------------------------------------------------
|
||||
/**
|
||||
* Retrieve the input selected object, as an IRemoteFile, for convenience.
|
||||
*/
|
||||
public IRemoteFile getRemoteFile()
|
||||
{
|
||||
return (IRemoteFile)super.getRemoteObject();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the remote file subsystem from which the selected objects were resolved.
|
||||
* This has many useful methods in it, including support to transfer files to and
|
||||
* from the local and remote systems.
|
||||
*/
|
||||
public IRemoteFileSubSystem getRemoteFileSubSystem()
|
||||
{
|
||||
return (IRemoteFileSubSystem)getSubSystem();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the remote file subsystem factory which owns the subsystem from which the
|
||||
* selected remote objects were resolved. This has some useful methods in it,
|
||||
* including isUnixStyle() indicating if this remote file system is unix or windows.
|
||||
*/
|
||||
public IRemoteFileSubSystemConfiguration getRemoteFileSubSystemConfiguration()
|
||||
{
|
||||
return (IRemoteFileSubSystemConfiguration)getSubSystemConfiguration();
|
||||
}
|
||||
|
||||
}
|
|
@ -2259,14 +2259,7 @@ public class SystemViewRemoteFileAdapter
|
|||
//System.out.println("INSIDE CANDELETE FOR ADAPTER: RETURNING " + !file.isRoot());
|
||||
return !file.isRoot() && file.canRead();
|
||||
}
|
||||
/**
|
||||
* Perform the delete action. Defers request to the remote file subsystem
|
||||
* @deprecated use the one with monitor now
|
||||
*/
|
||||
public boolean doDelete(Shell shell, Object element) throws Exception
|
||||
{
|
||||
return doDelete(shell, element, null);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Perform the delete action. Defers request to the remote file subsystem
|
||||
|
|
|
@ -272,7 +272,6 @@ FocusListener
|
|||
// create table portion
|
||||
Table table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION | SWT.HIDE_SELECTION);
|
||||
_viewer = new SystemCommandsView(table, _viewPart);
|
||||
_viewer.setWorkbenchPart(_viewPart);
|
||||
|
||||
_viewer.addDoubleClickListener(new IDoubleClickListener()
|
||||
{
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -31,7 +31,6 @@ import org.eclipse.rse.core.IRSESystemType;
|
|||
import org.eclipse.rse.core.ISystemViewSupplier;
|
||||
import org.eclipse.rse.core.RSECorePlugin;
|
||||
import org.eclipse.rse.core.SystemBasePlugin;
|
||||
import org.eclipse.rse.core.SystemPropertyPageExtension;
|
||||
import org.eclipse.rse.core.SystemResourceManager;
|
||||
import org.eclipse.rse.core.comm.ISystemKeystoreProvider;
|
||||
import org.eclipse.rse.core.comm.SystemCommunicationsDaemon;
|
||||
|
@ -849,59 +848,6 @@ public class RSEUIPlugin extends SystemBasePlugin implements ISystemMessageProvi
|
|||
|
||||
|
||||
|
||||
/**
|
||||
* Return an array of SystemPropertyPageExtension objects.
|
||||
* These represent all extensions to our propertyPage extension point.
|
||||
*/
|
||||
public SystemPropertyPageExtension[] getPropertyPageExtensions()
|
||||
{
|
||||
SystemPropertyPageExtension[] propertyPageExtensions = null;
|
||||
IConfigurationElement[] propertyPagePlugins = getPropertyPagePlugins();
|
||||
if (propertyPagePlugins != null)
|
||||
{
|
||||
Vector v = new Vector();
|
||||
for (int idx=0; idx<propertyPagePlugins.length; idx++)
|
||||
{
|
||||
SystemPropertyPageExtension sppe =
|
||||
new SystemPropertyPageExtension(propertyPagePlugins[idx]);
|
||||
v.addElement(sppe);
|
||||
}
|
||||
|
||||
propertyPageExtensions = new SystemPropertyPageExtension[v.size()];
|
||||
|
||||
// prescan for first
|
||||
boolean foundFirst = false;
|
||||
|
||||
for (int idx=0; !foundFirst && (idx<v.size()); idx++)
|
||||
if (((SystemPropertyPageExtension)v.elementAt(idx)).isAtTop())
|
||||
{
|
||||
propertyPageExtensions[0] = (SystemPropertyPageExtension)v.elementAt(idx);
|
||||
foundFirst = true;
|
||||
}
|
||||
|
||||
int ppIdx = foundFirst ? 1: 0;
|
||||
|
||||
for (int idx=0; idx<v.size(); idx++)
|
||||
if (!((SystemPropertyPageExtension)v.elementAt(idx)).isAtTop())
|
||||
propertyPageExtensions[ppIdx++] = (SystemPropertyPageExtension)v.elementAt(idx);
|
||||
}
|
||||
|
||||
return propertyPageExtensions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all elements that extend the org.eclipse.rse.ui.propertyPage extension point
|
||||
*/
|
||||
private IConfigurationElement[] getPropertyPagePlugins()
|
||||
{
|
||||
// Get reference to the plug-in registry
|
||||
IExtensionRegistry registry = Platform.getExtensionRegistry();
|
||||
// Get configured extenders
|
||||
IConfigurationElement[] propertyPageExtensions =
|
||||
registry.getConfigurationElementsFor(PLUGIN_ID,"propertyPages"); //$NON-NLS-1$
|
||||
|
||||
return propertyPageExtensions;
|
||||
}
|
||||
/**
|
||||
* Return all elements that extend the org.eclipse.rse.ui.remoteSystemsViewPreferencesActions extension point
|
||||
*/
|
||||
|
|
|
@ -1,389 +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.util.Iterator;
|
||||
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.rse.core.model.IHost;
|
||||
import org.eclipse.rse.core.subsystems.ISubSystem;
|
||||
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
|
||||
import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.IObjectActionDelegate;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
|
||||
|
||||
/**
|
||||
* This is a base class to simplify the creation of actions supplied via the
|
||||
* org.eclipse.rse.core.popupMenus extension point.
|
||||
* <p>
|
||||
* The only method you must implement is {@link #run()}.
|
||||
* You may optionally override {@link #getEnabled(Object[])}
|
||||
* <p>
|
||||
* Convenience methods are:
|
||||
* <ul>
|
||||
* <li>{@link #getShell()}
|
||||
* <li>{@link #getProxyAction()}
|
||||
* <li>{@link #getSelection()}
|
||||
* <li>{@link #getSelectionCount()}
|
||||
* <li>{@link #getSelectedRemoteObjects()}
|
||||
* <li>{@link #getFirstSelectedRemoteObject()}
|
||||
* <li>{@link #getRemoteAdapter(Object)}
|
||||
*
|
||||
* <li>{@link #getSubSystem()}
|
||||
* <li>{@link #getSubSystemConfiguration()}
|
||||
* <li>{@link #getSystemConnection()}
|
||||
*
|
||||
* <li>{@link #getRemoteObjectName(Object obj, ISystemRemoteElementAdapter adapter)}
|
||||
* <li>{@link #getRemoteObjectSubSystemConfigurationId(Object obj, ISystemRemoteElementAdapter adapter)}
|
||||
* <li>{@link #getRemoteObjectTypeCategory(Object obj, ISystemRemoteElementAdapter adapter)}
|
||||
* <li>{@link #getRemoteObjectType(Object obj, ISystemRemoteElementAdapter adapter)}
|
||||
* <li>{@link #getRemoteObjectSubType(Object obj, ISystemRemoteElementAdapter adapter)}
|
||||
* <li>{@link #getRemoteObjectSubSubType(Object obj, ISystemRemoteElementAdapter adapter)}
|
||||
* </ul>
|
||||
* @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 <code>adapter.getName(obj);</code>
|
||||
*/
|
||||
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 <code>adapter.getSubSystemConfigurationId(obj);</code>
|
||||
*/
|
||||
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 <code>adapter.getRemoteTypeCategory(obj);</code>
|
||||
*/
|
||||
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 <code>adapter.getRemoteType(obj);</code>
|
||||
*/
|
||||
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 <code>adapter.getRemoteSubType(obj);</code>
|
||||
*/
|
||||
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 <code>adapter.getRemoteSubSubType(obj);</code>
|
||||
*/
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
|
@ -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...
|
||||
* <p>
|
||||
* It is too expense to check for registered property pages at popup time, so we just return true.
|
||||
* <p>
|
||||
* @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.
|
||||
* <p>
|
||||
* This method is generally too expensive to use when updating the enabled state
|
||||
* of the action.
|
||||
* </p>
|
||||
*
|
||||
* @return <code>true</code> if there are property pages for the currently
|
||||
* selected element, and <code>false</code> otherwise
|
||||
*/
|
||||
public boolean isApplicableForSelection()
|
||||
{
|
||||
return hasPropertyPagesFor(getFirstSelection());
|
||||
}
|
||||
/**
|
||||
* The <code>PropertyDialogAction</code> implementation of this
|
||||
* <code>IAction</code> 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();
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
|
@ -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.
|
||||
* <p>
|
||||
* This class extends {@link SystemBasePropertyPage} and so inherits the benefits of that class.<br>
|
||||
* <b>To get these benefits though, you must override {@link #createContentArea(Composite)} versus the
|
||||
* usual createContents(Composite) method.</b>.
|
||||
* <p>
|
||||
* The benefits of this class are:</p>
|
||||
* <ul>
|
||||
* <li>From {@link SystemBasePropertyPage}: Adds a message line and {@link org.eclipse.rse.ui.messages.ISystemMessageLine} message methods.
|
||||
* <li>From {@link SystemBasePropertyPage}: Automatically assigns mnemonics to controls on this page, simplifying this common task. See {#wantMnemonics()}.
|
||||
* <li>From {@link SystemBasePropertyPage}: For pages with input controls, simplifies the page validation burden: only one method need be overridden: {@link #verifyPageContents()}
|
||||
* <li>From {@link SystemBasePropertyPage}: If no Default and Apply buttons wanted, the area reserved for this is removed, removing extra white space.
|
||||
* <li>Supplies helper method {@link #getRemoteObject()} for querying the selected remote object.
|
||||
* <li>Supplies helper methods getRemoteObjectXXX() for querying the attributes of the selected remote object.
|
||||
* <li>Supplies helper methods to query the {@link #getSubSystem() subsystem} and {@link #getSystemConnection() connection} containing the selected remote object.
|
||||
* </ul>
|
||||
* 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...
|
||||
// ------------------------
|
||||
/**
|
||||
* <i><b>Abstract</b>. You must override.</i><br>
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* <i>You may override if your page has input fields. By default returns true.</i><br>
|
||||
* 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.
|
||||
* <p>
|
||||
* Subclasses should override to do full error checking on all the widgets on the page. Recommendation:<br>
|
||||
* <ul>
|
||||
* <li>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)}.
|
||||
* <li>If no errors detected, clear the message line via {@link #clearErrorMessage()}
|
||||
* </ul>
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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()
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -73,271 +73,7 @@ Contributors:
|
|||
|
||||
<extension-point id="subsystemConfigurations" name="%extPoint.subsystemConfigurations" schema="schema/subsystemConfigurations.exsd"/>
|
||||
|
||||
<!-- ================================================================================== -->
|
||||
<!-- EXTENSION POINT: org.eclipse.rse.ui.propertyPages -->
|
||||
<!-- ================================================================================== -->
|
||||
<!-- Extension point for defining property pages for remote objects. -->
|
||||
<!-- This extension point is modeled after the workbench extension point -->
|
||||
<!-- org.eclipse.ui.propertyPages. However it hardcodes the objectClass to -->
|
||||
<!-- com.etools.systems.core.ui.view.ISystemRemoteElement, and it allows filtering by the -->
|
||||
<!-- remote object's subsystem configuration, and the object's name, type, subtype and even -->
|
||||
<!-- sub-subtype. All filter values can be scalar or simple generic: begins or ends -->
|
||||
<!-- with an asterisk. Not specifying a filter is the same as specifying '*' -->
|
||||
<!-- -->
|
||||
<!-- For all the filtering values, if you want to start or end it with an asterisk -->
|
||||
<!-- but you do not want that asterisk to be interpreted as a wildcard, use -->
|
||||
<!-- the special symbol "%%ast." without the quotes. For example, for iSeries -->
|
||||
<!-- object types like "*PGM" you can specify "%%ast.PGM" for an exact match. -->
|
||||
<!-- -->
|
||||
<!-- Like the workbench extension point, the class that you implement must -->
|
||||
<!-- implement IWorkbenchPropertyPage. -->
|
||||
<!-- -->
|
||||
<!-- Attributes: -->
|
||||
<!-- ================================================================================== -->
|
||||
<!-- id => unique id for this extension point extender -->
|
||||
<!-- name => translatable display name for the page -->
|
||||
<!-- icon => an optional image icon for the property page. This is a .gif file, given -->
|
||||
<!-- with a path relative to your plugin directory. -->
|
||||
<!-- class => your class that implements IWorkbenchPropertyPage -->
|
||||
<!-- subsystemconfigurationid => the subsystem configuration id to whose objects you wish to show -->
|
||||
<!-- a property page for. Can be a simple name or simple generic -->
|
||||
<!-- name to match on. -->
|
||||
<!-- This id matches the id attribute of a subsystemConfigurations -->
|
||||
<!-- extension point. -->
|
||||
<!-- subsystemconfigurationCategory => a subsystem configuration "category" to match on. Can be a -->
|
||||
<!-- simple name or simple generic like "*files". Matches on -->
|
||||
<!-- the "category" attribute of the subsystem configuration. -->
|
||||
<!-- Known values are "file", "nativefiles", "commands" or "jobs". -->
|
||||
<!-- systemTypes => semicolon-separated list of system types or * for all -->
|
||||
<!-- namefilter => scalar or simple generic name to match on. -->
|
||||
<!-- typecategoryfilter => scalar or simple generic type category to match on. -->
|
||||
<!-- This is subsystem configuration defined and usually not needed if -->
|
||||
<!-- the subsystemconfiguration id is given. -->
|
||||
<!-- typefilter => scalar or simple generic type to match on. This too is subsystem -->
|
||||
<!-- configuration defined. -->
|
||||
<!-- subtypefilter => scalar or simple generic subtype to match on. -->
|
||||
<!-- subsubtypefilter => scalar or simple generic sub-subtype to match on. -->
|
||||
<!-- ================================================================================== -->
|
||||
<!-- -->
|
||||
<!-- __________________________________________________________________________________ -->
|
||||
<!-- Example of extension configuration: -->
|
||||
<!-- <extension point="org.eclipse.rse.ui.propertyPages"> -->
|
||||
<!-- <page class="com.acme.myPropertyPage" -->
|
||||
<!-- id="com.acme.mypropertypage" -->
|
||||
<!-- name="Remote File Info" -->
|
||||
<!-- icon="icons/myProperties.gif" -->
|
||||
<!-- subsystemconfigurationid="local.files" -->
|
||||
<!-- subsystemconfigurationCategory="files" -->
|
||||
<!-- typefilter="file" -->
|
||||
<!-- subtypefilter="java" -->
|
||||
<!-- namefilter="*.java" -->
|
||||
<!-- </page> -->
|
||||
<!-- </extension> -->
|
||||
<!-- -->
|
||||
<!-- ================================================================================== -->
|
||||
|
||||
<extension-point id="propertyPages" name="%extPoint.propertyPages" schema="schema/propertyPages.exsd"/>
|
||||
|
||||
<!-- ================================================================================== -->
|
||||
<!-- EXTENSION POINT: org.eclipse.rse.ui.popupMenus -->
|
||||
<!-- ================================================================================== -->
|
||||
<!-- Extension point for defining actions for remote objects. -->
|
||||
<!-- This extension point is modeled after the workbench extension point -->
|
||||
<!-- org.eclipse.ui.popupMenus. -->
|
||||
<!-- However, because we know what we are targeting, it is simplified a bit. -->
|
||||
<!-- Specifically, there is no need to specify the object class, as we assume it -->
|
||||
<!-- applies to remote objects. -->
|
||||
<!-- On the other hand, we need a special mechanism to enable you to specify exactly -->
|
||||
<!-- what type of remote object the action is to apply to. We supply a rich set of -->
|
||||
<!-- attributes to enable fine-grained scoping by a number of criteria. These -->
|
||||
<!-- scoping attributes are identical to those in our own propertyPages extension -->
|
||||
<!-- point for remote objects. -->
|
||||
<!-- -->
|
||||
<!-- For all the filtering values, if you want to start or end it with an asterisk -->
|
||||
<!-- but you do not want that asterisk to be interpreted as a wildcard, use -->
|
||||
<!-- the special symbol "%%ast." without the quotes. For example, for iSeries -->
|
||||
<!-- object types like "*PGM" you can specify "%%ast.PGM" for an exact match. -->
|
||||
<!-- -->
|
||||
<!-- Like the workbench extension point, unless you specify o/w, the action will show -->
|
||||
<!-- up in the main popup menu in the "additions" group. To create cascading -->
|
||||
<!-- submenus, first define a submenu and named separator group within it, using the -->
|
||||
<!-- menu tag and its separator sub-tag. Then refer to that menu's id in your action -->
|
||||
<!-- tag's menubarPath attribute: menuid/separator-group-name. -->
|
||||
<!-- -->
|
||||
<!-- Like the workbench extension point, the action class that you implement must -->
|
||||
<!-- implement org.eclipse.ui.IObjectActionDelegate -->
|
||||
<!-- -->
|
||||
<!-- ================================================================================== -->
|
||||
<!-- <objectContribution> main tag: -->
|
||||
<!-- Within each of these tags, specify scoping criteria and then all the menus and -->
|
||||
<!-- actions that apply to that scoping criteria. Other than id, each of the other -->
|
||||
<!-- attributes are optional ... specify as many as needed to uniquely identify which -->
|
||||
<!-- remote objects your actions should apply to. That is, show up in the popup menu. -->
|
||||
<!-- ================================================================================== -->
|
||||
<!-- id => unique id for this extension point extender -->
|
||||
<!-- subsystemconfigurationid => the subsystem configuration id for whose objects you wish to show -->
|
||||
<!-- a popup action for. Can be a simple name or simple generic -->
|
||||
<!-- name to match on. -->
|
||||
<!-- This id matches the id attribute of a subsystemConfigurations -->
|
||||
<!-- extension point. -->
|
||||
<!-- subsystemconfigurationCategory => a subsystem configuration "category" to match on. Can be a -->
|
||||
<!-- simple name or simple generic like "*files". Matches on -->
|
||||
<!-- the "category" attribute of the subsystem configuration. -->
|
||||
<!-- systemTypes => semicolon-separated list of system types or * for all -->
|
||||
<!-- namefilter => scalar or simple generic name to match on -->
|
||||
<!-- typecategoryfilter => scalar or simple generic type category to match on. -->
|
||||
<!-- This is subsystem configuration defined and usually not needed if -->
|
||||
<!-- the subsystemconfiguration id is given. -->
|
||||
<!-- typefilter => scalar or simple generic type to match on. This too is subsystem -->
|
||||
<!-- configuration defined. -->
|
||||
<!-- subtypefilter => scalar or simple generic subtype to match on. -->
|
||||
<!-- subsubtypefilter => scalar or simple generic sub-subtype to match on. No -->
|
||||
<!-- predefined subsystem factories currently set this -->
|
||||
<!-- -->
|
||||
<!-- ================================================================================== -->
|
||||
<!-- <menu> sub tag (of <objectContribution> tag) attributes: -->
|
||||
<!-- Use one of these tags for each cascading submenu you wish to define in order to -->
|
||||
<!-- subsequently direction your actions into that submenu. To have nested cascading -->
|
||||
<!-- submenus, define two menu tags, and name the first in the path attribute -->
|
||||
<!-- of the second. -->
|
||||
<!-- What is a "group"? It is a named partition of a popup menu, allowing you to -->
|
||||
<!-- direct where in the menu to place an action. There are many predefined already. -->
|
||||
<!-- The typical and default group for your actions is "additions". -->
|
||||
<!-- ================================================================================== -->
|
||||
<!-- id => unique id for this submenu, used later in first part of the menubarPath -->
|
||||
<!-- attribute of the action or path attribute of a nested submenu. -->
|
||||
<!-- This is used to identify the target submenu of the action or subsubmenu -->
|
||||
<!-- label => readable text to show up in the popup menu, for this cascading menu. -->
|
||||
<!-- Do NOT specify '&' for mnemonics as these are assigned for you. -->
|
||||
<!-- However, accerator information is valid as defined by the Eclipse rules.-->
|
||||
<!-- path => the group or previously defined menu where to place this menu in the -->
|
||||
<!-- popup. If omitted, it is placed in the "additions" group with is near -->
|
||||
<!-- the bottom of the popup. Other predefined groups are "new", "goto", -->
|
||||
<!-- "openwith", "open", "show", "change" and "reorganize" in order from top -->
|
||||
<!-- to bottom of the popup -->
|
||||
<!-- -->
|
||||
<!-- ================================================================================== -->
|
||||
<!-- <separator> sub tag (of <menu> tag) attributes: -->
|
||||
<!-- Use the separator tag to define your own groups within your own submenus. Since -->
|
||||
<!-- it is your menu there are no groups predefined, and you must specify a group as -->
|
||||
<!-- the last part of the menubarPath attribute of the action tag. Therefore, menu -->
|
||||
<!-- tags must have at least one separator tag. If more than one is specified, then -->
|
||||
<!-- a separator is placed between the two groups at runtime. -->
|
||||
<!-- ================================================================================== -->
|
||||
<!-- name => the arbitrary name to assign this group. Specify it later in menubarPath -->
|
||||
<!-- attributes for actions to direct an action to an area of the menu. -->
|
||||
<!-- -->
|
||||
<!-- ================================================================================== -->
|
||||
<!-- <action> sub tag (of <objectContribution> tag) attributes: -->
|
||||
<!-- Use one of these tags for each action to place in the popup menu for remote -->
|
||||
<!-- objects. It will only show up if the object matches the criteria given in the -->
|
||||
<!-- parent <objectContribution> tag. -->
|
||||
<!-- ================================================================================== -->
|
||||
<!-- id => unique id for this action. Not really used but must be specified. -->
|
||||
<!-- label => readable text to display in the popup menu for this action. -->
|
||||
<!-- Do NOT specify '&' for mnemonics as these are assigned for you. -->
|
||||
<!-- However, accerator information is valid as defined by the Eclipse rules.-->
|
||||
<!-- icon => an optional image icon for the popup menu. This is a .gif file, given -->
|
||||
<!-- with a path relative to your plugin directory. OPTIONAL ATTRIBUTE. -->
|
||||
<!-- class => your action class that implements org.eclipse.ui.IObjectActionDelegate -->
|
||||
<!-- tooltip => optional tooltip text for this action -->
|
||||
<!-- menubarPath => a slash-delimited path ('/') that is used to specify the location -->
|
||||
<!-- of the action in the pop-up menu. Each token in the path except the last -->
|
||||
<!-- one represents an existing submenu in the hierarchy, as defined via the -->
|
||||
<!-- id attribute of a <menu> tag previously. The last token represents the -->
|
||||
<!-- named separator group into which the action will be added. If a path is -->
|
||||
<!-- given then this must match the name attribute of some <separator> subtag -->
|
||||
<!-- within one of your <menu> tags. -->
|
||||
<!-- If the path is omitted, the action will be added to the standard group -->
|
||||
<!-- named "additions". Indeed, same if the whole menubarPath attr is omitted.-->
|
||||
<!-- enablesFor => 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 -->
|
||||
<!-- items selected. The following attribute formats are supported: -->
|
||||
<!-- ! -> 0 items selected -->
|
||||
<!-- ? -> 0 or 1 items selected -->
|
||||
<!-- + -> 1 or more items selected -->
|
||||
<!-- multiple, 2+ -> 2 or more items selected -->
|
||||
<!-- n - a precise number of items selected. Example: 4. -->
|
||||
<!-- * - any number of items selected -->
|
||||
<!-- state => an optional attribute indicating that the action should be of a toggle -->
|
||||
<!-- type. When added to a pop-up menu, it will manifest itself as a check -->
|
||||
<!-- box item.. If defined, attribute value will be used as the initial state -->
|
||||
<!-- (either true or false) -->
|
||||
<!-- helpContextId => a 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. -->
|
||||
<!-- -->
|
||||
<!-- __________________________________________________________________________________ -->
|
||||
<!-- Example of extension configuration: -->
|
||||
<!-- <extension point="org.eclipse.rse.ui.popupMenus"> -->
|
||||
<!-- <objectContribution -->
|
||||
<!-- id="com.acme.displayfile.actions" -->
|
||||
<!-- subsystemconfigurationid="acme.files" -->
|
||||
<!-- typecategoryfilter="OBJECT*" -->
|
||||
<!-- typefilter="*FILE" -->
|
||||
<!-- subtypefilter="DSPF" -->
|
||||
<!-- namefilter="*"> -->
|
||||
<!-- <menu id="com.acme.displayfile.menu" -->
|
||||
<!-- label="My Display File Actions"> -->
|
||||
<!-- <separator name="group1"/> -->
|
||||
<!-- </menu> -->
|
||||
<!-- <action id="com.acme.action1" -->
|
||||
<!-- label="My first action" -->
|
||||
<!-- class="com.acme.actions.Action1" -->
|
||||
<!-- menubarPath="com.acme.displayfile.menu/group1" -->
|
||||
<!-- enablesFor="1"> -->
|
||||
<!-- </action> -->
|
||||
<!-- <action id="com.acme.action2" -->
|
||||
<!-- label="My second action" -->
|
||||
<!-- class="com.acme.actions.Action2" -->
|
||||
<!-- menubarPath="com.acme.displayfile.menu/group1" -->
|
||||
<!-- enablesFor="+"> -->
|
||||
<!-- </action> -->
|
||||
<!-- </objectContribution> -->
|
||||
<!-- </extension> -->
|
||||
<!-- Remember, you can repeat the <objectContribution> tags as needed, as well as the -->
|
||||
<!-- <menu> and <action> tags within them. -->
|
||||
<!-- ================================================================================== -->
|
||||
|
||||
<extension-point id="popupMenus" name="%extPoint.popupMenus" schema="schema/popupMenus.exsd"/>
|
||||
|
||||
<!-- ================================================================================== -->
|
||||
<!-- EXTENSION POINT: org.eclipse.rse.ui.compile -->
|
||||
<!-- ================================================================================== -->
|
||||
<!-- Extension point for defining compile commands. -->
|
||||
<!-- Example of extension configuration: -->
|
||||
<!-- <extension point="org.eclipse.rse.ui.compile"> -->
|
||||
<!-- <compilecommand -->
|
||||
<!-- id="com.mycomp.compileCommand1" -->
|
||||
<!-- label="My Label 1" -->
|
||||
<!-- commandstring="mycommand ${resource_name}" -->
|
||||
<!-- subsystemconfigurationid="acme.files" -->
|
||||
<!-- namefilter="*.java"> -->
|
||||
<!-- </compilecommand> -->
|
||||
<!-- </extension> -->
|
||||
<!-- -->
|
||||
<!-- <compileCommand> tag attributes: -->
|
||||
<!-- ================================================================================== -->
|
||||
<!-- id => unique id for this compile command. -->
|
||||
<!-- label => label for compile command. This will be displayed in the -->
|
||||
<!-- compile menus. -->
|
||||
<!-- commandstring => the compile string to be executed. Can contain substitution -->
|
||||
<!-- variables. -->
|
||||
<!-- subsystemconfigurationid => the subsystem configuration id of resources to which this compile -->
|
||||
<!-- compile command will apply. -->
|
||||
<!-- namefilter => the names to match. Must be either generic or of the form -->
|
||||
<!-- *.extension, e.g. *.java. -->
|
||||
<!-- typefilter => the type of the remote resource. -->
|
||||
<!-- labeleditable => specify whether label is editable in the Work With Compile -->
|
||||
<!-- Commands dialog. -->
|
||||
<!-- -->
|
||||
<!-- See the extension point reference for more details. -->
|
||||
|
||||
<!-- TODODeferred after RSE 1.0
|
||||
<extension-point id="compile" name="%extPoint.compile" schema="schema/compile.exsd"/>
|
||||
-->
|
||||
|
||||
<!-- ================================================================================== -->
|
||||
<!-- EXTENSION POINT: org.eclipse.rse.ui.remoteSystemsViewPreferencesActions -->
|
||||
|
|
|
@ -1,753 +0,0 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- Schema file written by PDE -->
|
||||
<schema targetNamespace="org.eclipse.rse.ui">
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<meta.schema plugin="org.eclipse.rse.ui" id="popupMenus" name="Popup Menus"/>
|
||||
</appInfo>
|
||||
<documentation>
|
||||
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>
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<include schemaLocation="schema://org.eclipse.ui/schema/commonAction.exsd"/>
|
||||
|
||||
<include schemaLocation="schema://org.eclipse.ui/schema/commonExpression.exsd"/>
|
||||
|
||||
<element name="extension">
|
||||
<annotation>
|
||||
<documentation>
|
||||
(no description available)
|
||||
</documentation>
|
||||
</annotation>
|
||||
<complexType>
|
||||
<sequence>
|
||||
<element ref="objectContribution" minOccurs="1" maxOccurs="unbounded"/>
|
||||
</sequence>
|
||||
<attribute name="point" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="id" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="name" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<element name="objectContribution">
|
||||
<annotation>
|
||||
<documentation>
|
||||
(no description available)
|
||||
</documentation>
|
||||
</annotation>
|
||||
<complexType>
|
||||
<sequence>
|
||||
<element ref="visibility" minOccurs="0" maxOccurs="1"/>
|
||||
<element ref="menu" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<element ref="action" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</sequence>
|
||||
<attribute name="id" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
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.
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="subsystemconfigurationid" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
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.
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="subsystemconfigurationCategory" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
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>
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="systemTypes" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
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>
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="namefilter" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
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>
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="typecategoryfilter" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
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>
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="typefilter" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
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>
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="subtypefilter" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
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>
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="subsubtypefilter" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
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>
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="adaptable" type="boolean">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<element name="menu">
|
||||
<annotation>
|
||||
<documentation>
|
||||
Use this element when you wish to have your action appear in
|
||||
your own cascading menu, versus in the primary popup menu.
|
||||
</documentation>
|
||||
</annotation>
|
||||
<complexType>
|
||||
<sequence>
|
||||
<element ref="separator" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</sequence>
|
||||
<attribute name="id" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
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.
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="label" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
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.
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="path" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
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>
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<element name="action">
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<meta.element labelAttribute="label" icon="icon"/>
|
||||
</appInfo>
|
||||
<documentation>
|
||||
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.
|
||||
</documentation>
|
||||
</annotation>
|
||||
<complexType>
|
||||
<attribute name="id" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
Unique ID for this action.
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="label" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
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.
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="icon" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
An optional image icon for the popup menu. This is a .gif file, given with a path relative to your plugin
|
||||
directory.
|
||||
</documentation>
|
||||
<appInfo>
|
||||
<meta.attribute kind="resource"/>
|
||||
</appInfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="tooltip" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
Optional tooltip text for this action. This appears in the status bar when the action is selected.
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="menubarPath" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
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>
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="enablesFor" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
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>
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="state" type="boolean">
|
||||
<annotation>
|
||||
<documentation>
|
||||
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.
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="helpContextId" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
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.
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="class" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
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.
|
||||
</documentation>
|
||||
<appInfo>
|
||||
<meta.attribute kind="java" basedOn="org.eclipse.ui.IObjectActionDelegate"/>
|
||||
</appInfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<element name="separator">
|
||||
<annotation>
|
||||
<documentation>
|
||||
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.
|
||||
</documentation>
|
||||
</annotation>
|
||||
<complexType>
|
||||
<attribute name="name" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
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.
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<meta.section type="examples"/>
|
||||
</appInfo>
|
||||
<documentation>
|
||||
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>
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<meta.section type="apiInfo"/>
|
||||
</appInfo>
|
||||
<documentation>
|
||||
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>
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<meta.section type="implementation"/>
|
||||
</appInfo>
|
||||
<documentation>
|
||||
There is no supplied implementation for this extension point.
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<meta.section type="copyright"/>
|
||||
</appInfo>
|
||||
<documentation>
|
||||
Copyright (c) 2002, 2006 IBM Corporation. All Rights Reserved.
|
||||
This program and the accompanying materials are made available under the 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
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
</schema>
|
|
@ -1,408 +0,0 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- Schema file written by PDE -->
|
||||
<schema targetNamespace="org.eclipse.rse.ui">
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<meta.schema plugin="org.eclipse.rse.ui" id="propertyPages" name="Property Pages"/>
|
||||
</appInfo>
|
||||
<documentation>
|
||||
<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>
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<element name="extension">
|
||||
<annotation>
|
||||
<documentation>
|
||||
(no description available)
|
||||
</documentation>
|
||||
</annotation>
|
||||
<complexType>
|
||||
<sequence>
|
||||
<element ref="page" minOccurs="1" maxOccurs="unbounded"/>
|
||||
</sequence>
|
||||
<attribute name="point" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="id" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="name" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<element name="page">
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<meta.element labelAttribute="name" icon="icon"/>
|
||||
</appInfo>
|
||||
<documentation>
|
||||
Identifies an individual property page contribution.
|
||||
</documentation>
|
||||
</annotation>
|
||||
<complexType>
|
||||
<attribute name="id" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
a unique ID that will be used to identify this page.
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="name" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
a translatable name that will be used in the UI for this page.
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="class" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
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.
|
||||
</documentation>
|
||||
<appInfo>
|
||||
<meta.attribute kind="java" basedOn="org.eclipse.ui.IWorkbenchPropertyPage"/>
|
||||
</appInfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="icon" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
A relative path to an icon that will be used in the UI in addition to the page name. Optional.
|
||||
</documentation>
|
||||
<appInfo>
|
||||
<meta.attribute kind="resource"/>
|
||||
</appInfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="subsystemconfigurationid" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
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.
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="subsystemconfigurationCategory" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
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>
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="systemTypes" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
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>
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="namefilter" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
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>
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="typecategoryfilter" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
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>
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="typefilter" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
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>
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="subtypefilter" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
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>
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="subsubtypefilter" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
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>
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<meta.section type="examples"/>
|
||||
</appInfo>
|
||||
<documentation>
|
||||
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>
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<meta.section type="apiInfo"/>
|
||||
</appInfo>
|
||||
<documentation>
|
||||
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>
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<meta.section type="implementation"/>
|
||||
</appInfo>
|
||||
<documentation>
|
||||
There is no supplied implementation for this extension point.
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<meta.section type="copyright"/>
|
||||
</appInfo>
|
||||
<documentation>
|
||||
Copyright (c) 2002, 2006 IBM Corporation. All Rights Reserved.
|
||||
This program and the accompanying materials are made available under the 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
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
</schema>
|
|
@ -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 <objectContributor> tag from our
|
||||
* org.eclipse.rse.core.PopupMenus extension point.
|
||||
* <p>
|
||||
* 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 <objectContribution> tag,
|
||||
* because that class does not support subclassing, and change it to:
|
||||
* <ul>
|
||||
* <li>Ignore all processing of the objectClass attribute, because we don't have one.
|
||||
* <li>Add processing for the filter attributes we added: subsystemconfigurationid,
|
||||
* namefilter, typecategoryfilter,
|
||||
* typefilter, subtypefilter, subsubtypefilter
|
||||
* </ul>
|
||||
*
|
||||
* 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 <samp>typecategoryfilter</samp> xml attribute.
|
||||
*/
|
||||
public String getCategoryFilter() {
|
||||
return matcher.getCategoryFilter();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return what was specified for the <samp>namefilter</samp> xml attribute.
|
||||
*/
|
||||
public String getNameFilter() {
|
||||
return matcher.getNameFilter();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return what was specified for the <samp>typefilter</samp> xml attribute.
|
||||
*/
|
||||
public String getTypeFilter() {
|
||||
return matcher.getTypeFilter();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return what was specified for the <samp>subtypefilter</samp> xml attribute.
|
||||
*/
|
||||
public String getSubTypeFilter() {
|
||||
return matcher.getSubTypeFilter();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return what was specified for the <samp>subsubtypefilter</samp> xml attribute.
|
||||
*/
|
||||
public String getSubSubTypeFilter() {
|
||||
return matcher.getSubSubTypeFilter();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return what was specified for the <samp>subsystemconfigurationid</samp> xml attribute.
|
||||
*/
|
||||
public String getSubSystemConfigurationId() {
|
||||
return matcher.getSubSystemConfigurationId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return what was specified for the <samp>subsystemconfigurationCategory</samp> xml attribute.
|
||||
*/
|
||||
public String getSubSystemConfigurationCategoryFilter() {
|
||||
return matcher.getSubSystemConfigurationCategoryFilter();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return what was specified for the <samp>systemTypes</samp> 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));
|
||||
}
|
||||
}
|
|
@ -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
|
||||
* <ul>
|
||||
* <li>Process the additional filtering attributes we added to the <objectContribution> tag
|
||||
* <li>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.
|
||||
* </ul>
|
||||
* @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);
|
||||
}
|
||||
|
||||
}
|
|
@ -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.
|
||||
* <p>
|
||||
* This class encapsulates all the information supplied by the extension xml.
|
||||
* <ol>
|
||||
* <li>id. Unique identifier
|
||||
* <li>name. Displayable property page name
|
||||
* <li>class. The class which implements IWorkbenchPropertyPage
|
||||
* <li>subsystemconfigurationid. For scoping to remote objects for a given subsystem configuration
|
||||
* <li>subsystemconfigurationCategory. For scoping to remote objects for a given subsystem configuration category
|
||||
* <li>systemTypes. For scoping to remote objects from systems of a given type, or semicolon-separated types.
|
||||
* <li>namefilter. For scoping to remote objects of a given name
|
||||
* <li>typecategoryfilter. For scoping to remote objects for a given remote object type category
|
||||
* <li>typefilter. For scoping to remote objects of a given type
|
||||
* <li>subtypefilter. For scoping to remote objects of a given subtype
|
||||
* <li>subsubtypefilter. For scoping to remote objects of a given sub-subtype
|
||||
* </ol>
|
||||
* @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; i<children.length; i++)
|
||||
{
|
||||
processChildElement(children[i]);
|
||||
}
|
||||
|
||||
|
||||
matcher = new SystemRemoteObjectMatcher(subsystemfilter, subsystemCategoryFilter, categoryfilter, systypes,
|
||||
namefilter, typefilter, subtypefilter, subsubtypefilter);
|
||||
}
|
||||
/**
|
||||
* Parses child element and processes it
|
||||
*/
|
||||
private void processChildElement(IConfigurationElement element)
|
||||
{
|
||||
String tag = element.getName();
|
||||
if (tag.equals(TAG_FILTER))
|
||||
{
|
||||
String key = element.getAttribute("name"); //$NON-NLS-1$
|
||||
String value = element.getAttribute("value"); //$NON-NLS-1$
|
||||
if ((key == null) || (value == null))
|
||||
return;
|
||||
if (filterProperties==null)
|
||||
filterProperties = new HashMap();
|
||||
filterProperties.put(key, value);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Getter method.
|
||||
* Return what was specified for the <samp>name</samp> xml attribute.
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
/**
|
||||
* Getter method.
|
||||
* Return what was specified for the <samp>id</samp> xml attribute.
|
||||
*/
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
/**
|
||||
* Getter method.
|
||||
* Return what was specified for the <samp>icon</samp> 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 <samp>typecategoryfilter</samp> xml attribute.
|
||||
*/
|
||||
public String getCategoryFilter()
|
||||
{
|
||||
return matcher.getCategoryFilter();
|
||||
}
|
||||
/**
|
||||
* Getter method.
|
||||
* Return what was specified for the <samp>namefilter</samp> xml attribute.
|
||||
*/
|
||||
public String getNameFilter()
|
||||
{
|
||||
return matcher.getNameFilter();
|
||||
}
|
||||
/**
|
||||
* Getter method.
|
||||
* Return what was specified for the <samp>typefilter</samp> xml attribute.
|
||||
*/
|
||||
public String getTypeFilter()
|
||||
{
|
||||
return matcher.getTypeFilter();
|
||||
}
|
||||
/**
|
||||
* Getter method.
|
||||
* Return what was specified for the <samp>subtypefilter</samp> xml attribute.
|
||||
*/
|
||||
public String getSubTypeFilter()
|
||||
{
|
||||
return matcher.getSubTypeFilter();
|
||||
}
|
||||
/**
|
||||
* Getter method.
|
||||
* Return what was specified for the <samp>subsubtypefilter</samp> xml attribute.
|
||||
*/
|
||||
public String getSubSubTypeFilter()
|
||||
{
|
||||
return matcher.getSubSubTypeFilter();
|
||||
}
|
||||
/**
|
||||
* Getter method.
|
||||
* Return what was specified for the <samp>subsystemconfigurationid</samp> xml attribute.
|
||||
*/
|
||||
public String getSubSystemConfigurationId()
|
||||
{
|
||||
return matcher.getSubSystemConfigurationId();
|
||||
}
|
||||
/**
|
||||
* Getter method.
|
||||
* Return what was specified for the <samp>subsystemconfigurationCategory</samp> xml attribute.
|
||||
*/
|
||||
public String getSubSystemConfigurationCategoryFilter()
|
||||
{
|
||||
return matcher.getSubSystemConfigurationCategoryFilter();
|
||||
}
|
||||
/**
|
||||
* Getter method.
|
||||
* Return what was specified for the <samp>systemTypes</samp> 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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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<propertyPageSuppliers.length); idx++)
|
||||
hasContributors = propertyPageSuppliers[idx].appliesTo(adapter, element);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
hasContributors = false;
|
||||
}
|
||||
return hasContributors;
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate a given property page manager with all the applicable remote property pages
|
||||
*/
|
||||
public boolean contribute(PropertyPageManager manager, ISystemRemoteElementAdapter adapter, Object object)
|
||||
{
|
||||
boolean added = false;
|
||||
getPropertyPageSuppliers();
|
||||
if (propertyPageSuppliers != null)
|
||||
{
|
||||
for (int idx=0; idx<propertyPageSuppliers.length; idx++)
|
||||
{
|
||||
boolean applies = propertyPageSuppliers[idx].appliesTo(adapter, object);
|
||||
if (applies)
|
||||
{
|
||||
added = true;
|
||||
propertyPageSuppliers[idx].contributePropertyPages(manager, object);
|
||||
}
|
||||
}
|
||||
}
|
||||
return added;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue