1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

[175303] Restore ISV Docs for propertyPages and popupMenus

This commit is contained in:
Martin Oberhuber 2007-02-24 04:26:45 +00:00
parent a61f2965b4
commit 313cd36041
15 changed files with 531 additions and 25 deletions

View file

@ -3,7 +3,7 @@
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2002, 2006. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2002, 2007. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
<LINK REL="STYLESHEET" HREF="../../../book.css" TYPE="text/css">
<title>RSE Properties API</title>
</head>
@ -63,14 +63,12 @@ point, you need to know the class or, preferably, interface that the objects imp
</TBODY>
</TABLE>
<h2>Property Pages for RSE Remote Resources</h2>
<p>Remote resources have no underlying eclipse resource, and typically all are instances of the same class,
meaning insufficient fidelity in scoping property pages to a remote resource of a particular type. Because of this,
the RSE supplies its <a href="../../../reference/extension-points/org_eclipse_rse_ui_propertyPages.html">propertyPages</a> extension point, for remote resources, which allows for
very explicit scoping of the property page to very specific types of remote resources.
<p>See <a href="../../../guide/plugin/propertypage.html">Plugging In Property Pages</a>
for information on how to contribute property pages for remote resources.
Because remote resources have no underlying eclipse resource, and typically all are instances of the same class,
Eclipse Filtering capabilities are used to allow very explicit scoping of the property page to very specific types of remote resources.
</p>
<P><BR></P>
</body>
</html>

View file

@ -4,7 +4,7 @@
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2002, 2006. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2002, 2007. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
<LINK REL="STYLESHEET" HREF="../../book.css" TYPE="text/css">
<title>Other Relevant Extension Points</title>
</head>
@ -23,7 +23,8 @@ the information needed to enable them to in Remote System Explorer.
<TH>Description</TH>
</TR>
<TR>
<TD><samp>org.eclipse.ui.viewActions</samp></TD>
<TD><a name="viewActions"></a>
<samp><a href="../../../org.eclipse.platform.doc.isv/guide/workbench_basicext_viewActions.htm">org.eclipse.ui.viewActions</a></samp></TD>
<TD>For adding actions to the pulldown menu in any view's local toolbar, or to the toolbar itself.
To use this you need to know the ID of the RSE views, for the <samp>targetID</samp> attribute: There are:
<ul>
@ -37,18 +38,35 @@ the information needed to enable them to in Remote System Explorer.
</TD>
</TR>
<TR>
<TD><samp>org.eclipse.ui.propertyPages</samp></TD>
<TD>For adding property pages for non-remote objects within the
<TD><a name="property"></a>
<samp>
<!-- a href="../../../org.eclipse.platform.doc.isv/guide/preferences_prop_contribute.htm" -->
<a href="propertypage.html">
org.eclipse.ui.propertyPages</a></samp></TD>
<TD>For adding property pages for objects within the
Remote System Explorer. To use this you need to know the class type
of these objects for the <samp>objectClass</samp> attribute of the <samp>&lt;page&gt;</samp> element:
<ul>
<li>Connections: <samp><A href="../../reference/api/org/eclipse/rse/core/model/IHost.html">org.eclipse.rse.core.model.IHost</A></samp>
<li>SubSystems: <samp><A href="../../reference/api/org/eclipse/rse/core/subsystems/ISubSystem.html">org.eclipse.rse.core.subsystems.ISubSystem</A></samp>
<li>Filter Pools: <samp><A href="../../reference/api/org/eclipse/rse/core/filters/ISystemFilterPoolReference.html">org.eclipse.rse.core.filters.ISystemFilterPoolReference</A></samp>
<li>Filters: <samp><A href="../../reference/api/org/eclipse/rse/core/filters/ISystemFilterReference.html">org.eclipse.rse.core.filters.ISystemFilterReference</A></samp>
<li>Connections: <samp><A href="../../reference/api/org/eclipse/rse/core/model/IHost.html">org.eclipse.rse.core.model.IHost</A></samp></li>
<li>SubSystems: <samp><A href="../../reference/api/org/eclipse/rse/core/subsystems/ISubSystem.html">org.eclipse.rse.core.subsystems.ISubSystem</A></samp></li>
<li>Filter Pools: <samp><A href="../../reference/api/org/eclipse/rse/core/filters/ISystemFilterPoolReference.html">org.eclipse.rse.core.filters.ISystemFilterPoolReference</A></samp></li>
<li>Filters: <samp><A href="../../reference/api/org/eclipse/rse/core/filters/ISystemFilterReference.html">org.eclipse.rse.core.filters.ISystemFilterReference</A></samp></li>
<li>Remote Elements: your model objects, which are adaptable to <samp>ISystemViewElementAdapter</samp>.
For the RSE-provided reusable file, process and shell subsystems, these are
<samp><a href="../../reference/api/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFile.html">IRemoteFile</a></samp>,
<samp><a href="../../reference/api/org/eclipse/rse/subsystems/processes/core/subsystem/IRemoteProcess.html">IRemoteProcess</a></samp> and
<samp><a href="../../reference/api/org/eclipse/rse/subsystems/shells/core/subsystems/IRemoteCommandShell.html">IRemoteCommandShell</a></samp>, respectively.
In the Remote Command View, you'll also find
<samp><a href="../../reference/api/org/eclipse/rse/subsystems/shells/core/subsystems/IRemoteError.html">IRemoteError</a></samp> and
<samp><a href="../../reference/api/org/eclipse/rse/subsystems/shells/core/subsystems/IRemoteOutput.html">IRemoteOutput</a></samp>.
</li>
</ul>
It is possible to scope your property pages to only appear for certain system types or subsystems, using
the <samp>&lt;filter&gt;</samp> element. For example:<br>
Because all RSE elements adapt to
<samp><A href="../../reference/api/org/eclipse/rse/ui/view/ISystemViewElementAdapter.html">ISystemViewElementAdapter</A></samp>,
which in turn implements
<samp><A href="../../../org.eclipse.platform.doc.isv/reference/api/org/eclipse/ui/IActionFilter.html">org.eclipse.ui.IActionFilter</A></samp>,
it is possible to scope your property pages to only appear for certain system types or subsystems, using
the extension point's <samp>&lt;filter&gt;</samp> element. For example:<br>
<pre><code>
&lt;extension point=&quot;org.eclipse.ui.propertyPages&quot;&gt;
&lt;page name=&quot;Team Info&quot;
@ -63,18 +81,36 @@ the information needed to enable them to in Remote System Explorer.
</TD>
</TR>
<TR>
<TD><samp>org.eclipse.ui.popupMenus</samp></TD>
<TD>For adding pop-up menu actions for non-remote objects within the Remote System Explorer.
<TD><a name="popup"></a>
<samp>
<!-- a href="../../../org.eclipse.platform.doc.isv/guide/workbench_basicext_popupMenus.htm" -->
<a href="popup.html">
org.eclipse.ui.popupMenus</a></samp>
</TD>
<TD>For adding pop-up menu actions for objects within the Remote System Explorer.
To use this you need to know the class type of these objects for the <samp>objectClass</samp> attribute
of the &lt;objectContribution&gt; element:
<ul>
<li>Connections: <samp><A href="../../reference/api/org/eclipse/rse/core/model/IHost.html">org.eclipse.rse.core.model.IHost</A></samp>
<li>SubSystems: <samp><A href="../../reference/api/org/eclipse/rse/core/subsystems/ISubSystem.html">org.eclipse.rse.core.subsystems.ISubSystem</A></samp>
<li>Filter Pools: <samp><A href="../../reference/api/org/eclipse/rse/core/filters/ISystemFilterPoolReference.html">org.eclipse.rse.core.filters.ISystemFilterPoolReference</A></samp>
<li>Filters: <samp><A href="../../reference/api/org/eclipse/rse/core/filters/ISystemFilterReference.html">org.eclipse.rse.core.filters.ISystemFilterReference</A></samp>
<li>Connections: <samp><A href="../../reference/api/org/eclipse/rse/core/model/IHost.html">org.eclipse.rse.core.model.IHost</A></samp></li>
<li>SubSystems: <samp><A href="../../reference/api/org/eclipse/rse/core/subsystems/ISubSystem.html">org.eclipse.rse.core.subsystems.ISubSystem</A></samp></li>
<li>Filter Pools: <samp><A href="../../reference/api/org/eclipse/rse/core/filters/ISystemFilterPoolReference.html">org.eclipse.rse.core.filters.ISystemFilterPoolReference</A></samp></li>
<li>Filters: <samp><A href="../../reference/api/org/eclipse/rse/core/filters/ISystemFilterReference.html">org.eclipse.rse.core.filters.ISystemFilterReference</A></samp></li>
<li>Remote Elements: your model objects, which are adaptable to <samp>ISystemViewElementAdapter</samp>.
For the RSE-provided reusable file, process and shell subsystems, these are
<samp><a href="../../reference/api/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFile.html">IRemoteFile</a></samp>,
<samp><a href="../../reference/api/org/eclipse/rse/subsystems/processes/core/subsystem/IRemoteProcess.html">IRemoteProcess</a></samp> and
<samp><a href="../../reference/api/org/eclipse/rse/subsystems/shells/core/subsystems/IRemoteCommandShell.html">IRemoteCommandShell</a></samp>, respectively.
In the Remote Command View, you'll also find
<samp><a href="../../reference/api/org/eclipse/rse/subsystems/shells/core/subsystems/IRemoteError.html">IRemoteError</a></samp> and
<samp><a href="../../reference/api/org/eclipse/rse/subsystems/shells/core/subsystems/IRemoteOutput.html">IRemoteOutput</a></samp>.
</li>
</ul>
It is possible to scope your actions to only appear for certain system types or subsystems, using
the <samp>&lt;filter&gt;</samp> element. For example:<br>
Because all RSE elements adapt to
<samp><A href="../../reference/api/org/eclipse/rse/ui/view/ISystemViewElementAdapter.html">ISystemViewElementAdapter</A></samp>,
which in turn extends
<samp><A href="../../../org.eclipse.platform.doc.isv/reference/api/org/eclipse/ui/IActionFilter.html">org.eclipse.ui.IActionFilter</A></samp>,
it is possible to scope your actions to only appear for certain system types or subsystems, using
the extension point's <samp>&lt;filter&gt;</samp> element. For example:<br>
<pre><code>
&lt;extension point=&quot;org.eclipse.ui.popupMenus&quot;&gt;
&lt;objectContribution

View file

@ -0,0 +1,185 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2002, 2007. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
<LINK REL="STYLESHEET" HREF="../../book.css" TYPE="text/css">
<title>Plugging In Popup Menu Actions</title>
</head>
<body bgcolor="#ffffff">
<h1>Plugging In Popup Menu Actions</h1>
<p>The <samp><a href="../../../org.eclipse.platform.doc.isv/reference/extension-points/org_eclipse_ui_popupMenus.html">org.eclipse.ui.popupMenus</a></samp> extension point
from the base Eclipse Platform is used to contribute popup menus.
</p>
<p>The primary element in the markup for this extension point is the <b><samp>&lt;objectContribution&gt;</samp></b> element,
which scopes the remote objects to which the child elements apply:
</p>
<ul>
<li><b>id</b>.A unique ID for this extension point. Not used, but required by Eclipse.</li>
<li><a name="objectClass"></a>
<b>objectClass</b>. The element on which the popup menu action should appear.
To use this you need to know the class type of these objects for the <samp>objectClass</samp> attribute
of the &lt;objectContribution&gt; element:
<ul>
<li>Connections: <samp><A href="../../reference/api/org/eclipse/rse/core/model/IHost.html">org.eclipse.rse.core.model.IHost</A></samp></li>
<li>SubSystems: <samp><A href="../../reference/api/org/eclipse/rse/core/subsystems/ISubSystem.html">org.eclipse.rse.core.subsystems.ISubSystem</A></samp></li>
<li>Filter Pools: <samp><A href="../../reference/api/org/eclipse/rse/core/filters/ISystemFilterPoolReference.html">org.eclipse.rse.core.filters.ISystemFilterPoolReference</A></samp></li>
<li>Filters: <samp><A href="../../reference/api/org/eclipse/rse/core/filters/ISystemFilterReference.html">org.eclipse.rse.core.filters.ISystemFilterReference</A></samp></li>
<li>Remote Elements: your model objects, which are adaptable to <samp>ISystemViewElementAdapter</samp>.
For the RSE-provided reusable file, process and shell subsystems, these are
<samp><a href="../../reference/api/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFile.html">IRemoteFile</a></samp>,
<samp><a href="../../reference/api/org/eclipse/rse/subsystems/processes/core/subsystem/IRemoteProcess.html">IRemoteProcess</a></samp> and
<samp><a href="../../reference/api/org/eclipse/rse/subsystems/shells/core/subsystems/IRemoteCommandShell.html">IRemoteCommandShell</a></samp>, respectively.
In the Remote Command View, you'll also find
<samp><a href="../../reference/api/org/eclipse/rse/subsystems/shells/core/subsystems/IRemoteError.html">IRemoteError</a></samp> and
<samp><a href="../../reference/api/org/eclipse/rse/subsystems/shells/core/subsystems/IRemoteOutput.html">IRemoteOutput</a></samp>.
</li>
</ul></li>
<li><a name="filtering"></a>
<b><i>filtering attributes</i></b>.To scope which remote objects these actions should show up for.
Because all RSE elements adapt to
<samp><A href="../../reference/api/org/eclipse/rse/ui/view/ISystemViewElementAdapter.html">ISystemViewElementAdapter</A></samp>,
which in turn extends
<samp><A href="../../../org.eclipse.platform.doc.isv/reference/api/org/eclipse/ui/IActionFilter.html">org.eclipse.ui.IActionFilter</A></samp>,
it is possible to scope your actions to only appear for certain system types or subsystems, using
the extension point's <samp>&lt;filter&gt;</samp> element. For example:<br>
<pre><code>
&lt;extension point=&quot;org.eclipse.ui.popupMenus&quot;&gt;
&lt;objectContribution
id =&quot;samples.ui.actions.TeamFilterActions&quot;
objectClass=&quot;org.eclipse.rse.core.filters.ISystemFilterReference&quot;&gt;
<b>&lt;filter name=&quot;subsystemFactoryId&quot; value=&quot;samples.subsystems.factory&quot;/&gt;</b>
&lt;action id=&quot;samples.ui.actions.TeamFilterAction1&quot;
label=&quot;Sample Team Filter Action&quot;
class=&quot;samples.ui.actions.ShowJarContents&quot;&gt;
&lt;/action&gt;
&lt;/objectContribution&gt;
&lt;/extension&gt;
</code></pre>
See <a href="other.html#scoping">Scoping</a> for all the filter <samp>names</samp> supported by RSE objects.
</li>
</ul>
<p>Within each <samp>&lt;objectContribution&gt;</samp> element are zero or more <B><samp>&lt;menu&gt;</samp></B> elements for
optionally defining cascading submenus, and &lt;<B>action</B>&gt; elements for the actual actions.
To have the actions show up in a cascading menu, use the <samp>&lt;menu&gt;</samp> element with these
attributes:
</p>
<ul>
<li><b>id</b>. Unique id for the submenu. Used later to target actions into this cascading submenu.
<li><b>label</b>. The text the user sees in the pop-up menu.
<li><b>path</b>. 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 <samp>id/group</samp>, where <samp>id</samp>
matches the id attribute from a previous <samp>&lt;menu&gt;</samp> element, and <samp>group</samp> matches the name attribute
of a <samp>&lt;separator&gt;</samp> sub-element within that previous <samp>&lt;menu&gt;</samp> element. For multi-nesting, repeat the <samp>id</samp>
part, as in <samp>id1/id2/id3/group</samp>. In this case, there must be a <samp>&lt;menu&gt;</samp> element with and id value of
<samp>id3</samp> that refers to another <samp>&lt;menu&gt;</samp> element <samp>id2</samp> via is path attribute, which in turn
refers to <samp>&lt;menu&gt;</samp> element <samp>id1</samp> via its <samp>path</samp> attribute. If the group does not exist,
it will be created.
<br>
For the root cascading menu, you can also use this to specify a group within the remote object's pop-up,
for where to place this cascading menu. The default is the <samp>additions</samp> group, which is near the
bottom of the pop-up menu. The RSE-supplied groups for pop-up menus are listed shortly in Table 4. There are
also a few RSE-supplied cascading menus listed in Table 4, which can be specified for the id prefix in order
to add a cascading menu to an RSE-supplied cascading menu.
</ul>
<P>Within each <samp>&lt;menu&gt;</samp> element are one or more <b><samp>&lt;separator&gt;</samp></b> elements that partition the cascading
menu into groups. Groups are simply named physical areas of the menu. The order in which they are defined is the order they
appear in the menu. Actions always go into groups. Groups avoid the need to specify relative information to identify where
within a pop-up menu to place actions. There is only one attribute for this element:
</P>
<ul>
<li><b>name</b>. The name to give this group. Users do not see this, but it is used in the <samp>action</samp> element to identify where to place
the action within this submenu. Groups exist in the order they are defined, top to bottom. Between groups is a separator unless
contiguous groups are empty. There is always a default group named <samp>additions</samp> supplied for you.
</ul>
<p>Finally, within <samp>&lt;objectContribution&gt;</samp> elements are one or more <b><samp>&lt;action&gt;</samp></b> elements identifying the
actual actions, each of which only show up if the scoping criteria is met for that parent <samp>&lt;objectContribution&gt;</samp>
element. The attributes for <samp>&lt;action&gt;</samp> elements are:
</p>
<ul>
<li><b>id</b>. Unique id for the action.
<li><b>label</b>. What the user sees in the pop-up menu.
<li><b>icon</b>. Optional icon to show beside the label. This is the name of a file qualified by a path relative to this plugin's directory.
<li><b>class</b>. Name of the class extending one of the classes listed in the documentation.
<li><b>menubarPath</b>. Where to put this action. This is optional and only required when you do not want the action to go into the
default location within the remote object's pop-up menu. This is a group name, optionally preceded by slash-delimited Ids for actions
that go inside cascading menus, where each Id matches an id attribute from a previously specified <samp>&lt;menu&gt;</samp> element.
If no menubarPath is specified, the action goes into the <samp>&lt;additions&gt;</samp> area of the object's popup menu, which is
near the bottom of the pop-up menu. The RSE-supplied groups for remote object pop-up menus are listed in Table 4, as well as menu Ids
for RSE-supplied cascading menus, should you wish to add an action to an RSE-supplied cascading menu.
<li><b>enablesFor</b>. Tells when to enable this action based on how many items are selected. Typically, specify "1" for
single-selection or "+" for multiple-selection. You can also change the enabled state of your action within your class,
by calling the <samp>setEnabled(boolean)</samp> method or overriding the <samp>getEnabled(Object[] currentlySelected)</samp> method that is called
when the selection changes.
<li><b>state</b>. Specify if this is a toggle (checkable) menu item. Specify "true" or "false" to indicate initial
toggle status. Call <samp>setChecked(boolean)</samp> in your class to change the toggled state.
<li><b>helpContextId</b>. Allows F1 help for this action. Optional.
</ul>
<p>
The <samp>path</samp> attribute for the <samp>&lt;menu&gt;</samp> element, and the <samp>menubarPath</samp> attribute for the <samp>&lt;action&gt;</samp>
element, are the most difficult to master. The rules are reasonably simple though:
</p>
<ol>
<li>To have your action show up in the initial pop-up menu, just specify a group name on the <samp>menubarPath</samp> attribute. That name can be
one of the RSE-supplied group names defined in Table 4, or your own group name, which will be created and appended to the end of the
pop-up menu. The default group is <samp>"additions"</samp>.
<br>Example: <samp>menubarPath="myGroup"</samp>
<li>To have your action show up in a simple RSE-supplied cascading menu within the pop-up menu, in your <samp>&lt;action&gt;</samp> element,
specify the RSE-supplied menu ID from Table 4 in the <samp>menubarPath</samp> attribute, then a slash followed by the name of a group. The only
RSE-supplied group for cascading menus is <samp>"additions"</samp>. If you specify anything else for the group, the group will be created for you
at the bottom of the menu.
<br>Example: <samp>menubarPath="menu.new/myGroup"</samp>
<li>To have your action show up in a simple cascading menu of your own, first define the menu with a <samp>&lt;menu&gt;</samp> element,
giving it an ID via the id attribute. In your <samp>&lt;action&gt;</samp> element, in the <samp>menubarPath</samp> attribute specify that id followed by a slash
and then the name of a group. That group name can be one specified on a <samp>&lt;separator&gt;</samp> element within your menu, or a new name, which
results in a new group at the bottom of the menu. In the latter case, there will be no separators delimiting the group, while in the former case
there will be.
<br>Example: <samp>menubarPath="myMenu1/myGroup"</samp>
<li>To have your action show up in a multi-cascading menu of your own, define each of the menu via <samp>&lt;menu&gt;</samp> elements. For all but the
first, identify the parent menu using the path attribute, specifying the Ids for each of the parent menus, slash-separated. At
the end of the path attribute, specify the group within the final parent menu into which this menu will be placed. Again, this
will either be a group defined with a <samp>&lt;separator&gt;</samp> element in the parent <samp>menu</samp> element, or specify a non-existing group that will be
created for you. Once your multi-cascading menu is created, you identify it in your <samp>&lt;action&gt;</samp> element via the <samp>menubarPath</samp> attribute,
specifying all the menu Ids up to the final menu, slash-separated, and then the group within that final menu, as usual.
<br>Example: <samp>menubarPath="myMenu1/myMenu2/myGroup"</samp>
</ol>
<h2>Programming Details</h2>
<p>To use this extension point you will create a class that extends the
<samp><A href="../../reference/api/org/eclipse/rse/ui/actions/SystemAbstractPopupMenuExtensionAction.html">SystemAbstractPopupMenuExtensionAction</A></samp> class in the
package <samp><A href="../../reference/api/org/eclipse/rse/ui/actions/package-summary.html">org.eclipse.rse.ui.actions</A></samp>. This is your action class,
and when the user selects your action, the <samp>run()</samp>
method in your action class will be called. You will rarely extend the <samp>SystemAbstractPopupMenuExtensionAction</samp> base class
directly, though. Instead there are subclasses of it that offer additional functionality for specific types of remote objects,
as shown here:
</p>
<TABLE border="1">
<TBODY>
<TR>
<TH>Base Class</TH>
<TH>Description</TH>
</TR>
<TR>
<TD><samp><A href="../../reference/api/org/eclipse/rse/ui/actions/SystemAbstractPopupMenuExtensionAction.html">SystemAbstractPopupMenuExtensionAction</A></samp> in
<samp>org.eclipse.rse.ui</samp> plugin</TD>
<TD>Base class offering generic support for any remote object pop-up menu action, for any system type.</TD>
</TR>
<TR>
<TD><samp><A href="../../reference/api/org/eclipse/rse/files/ui/actions/SystemAbstractRemoteFilePopupMenuExtensionAction.html">SystemAbstractRemoteFilePopupMenuExtensionAction</A></samp>
in <samp>org.eclipse.rse.files.ui</samp> plugin</TD>
<TD>Specialized base class offering specific support for any remote file object pop-up menu action, for any system type.</TD>
</TR>
</TBODY>
</TABLE>
<br><hr>
<p>See the <a href="../tutorial/popup.html">pop-up menu action tutorial</a> for a step-by-step example.</p>
<p>See the <a href="../../../org.eclipse.platform.doc.isv/guide/workbench_basicext_popupMenus.htm">Eclipse Platform Programmer's Guide</a>
for more background information.</p>
</body>
</html>

View file

@ -0,0 +1,86 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2002, 2007. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
<LINK REL="STYLESHEET" HREF="../../book.css" TYPE="text/css">
<title>Plugging In Property Pages</title>
</head>
<body bgcolor="#ffffff">
<h1>Plugging In Property Pages</h1>
<p>The <samp><a href="../../../org.eclipse.platform.doc.isv/reference/extension-points/org_eclipse_ui_propertyPages.html">org.eclipse.ui.propertyPages</a></samp> extension point
from the base Eclipse Platform is used to contribute property pages.<BR/>
What is a property page?
It is a page that shows up in the Eclipse <A href="propertypage_figure2.gif">Properties dialog</A> that users
get to by right-clicking on an object within any tree or table view, and selecting
the <A href="propertypage_figure1.gif">Properties action</A>.</p>
<p>Extenders supply one or more <samp>&lt;page&gt;</samp> elements within the beginning and ending <samp>&lt;extension&gt;</samp> element for this.
The attributes of this <samp>&lt;page&gt;</samp> element are:</p>
<ul>
<li><b>id</b>. A unique ID for this extension point. Not actually used, but required by Eclipse.</li>
<li><b>name</b>. A translated node-name to show in the left tree view in the Eclipse-supplied
Properties dialog that comes up when the user selects "Properties..." from the pop-up menu.</li>
<li><b>icon</b>. An optional icon to show in the Properties dialog for this property page.</li>
<li><b>class</b>. The fully qualified name of the class that implements the Eclipse interface
<samp>org.Eclipse.ui.IWorkbenchPropertyPage</samp>. This is usually done by extending the Eclipse class
<samp>org.Eclipse.ui.dialog.PropertyPage</samp>. Your class will populate the detail page on the right of the
Eclipse-supplied Properties dialog when the node-name is selected in the left hand tree view.</li>
<li><b><i>objectClass</i></b>. Specify the class or interface of the model objects for which
this property page should be registered. Available interfaces are are identical to those in the
<samp><A href="popup.html#objectClass">popupMenus</A></samp> extension point.</li>
<li><b><i>filtering criteria</i></b>. To scope which objects these property pages should show up for,
there are a series of filtering attributes. These attributes are identical to those in the <samp><A href="popup.html#filtering">popupMenus</A></samp>
extension point.
<!--
Supported through the
<samp><a href="../../reference/api/org/eclipse/rse/core/SystemRemoteObjectMatcher.html">SystemRemoteObjectMatcher</a></samp>
class, providers supply as many as needed to uniquely identify their target objects. Every one of these
values can be scalar or "simple generic", meaning it can start or end with an asterisk for pattern matching:
<ul>
<li><b>subsystemconfigurationid</b>. Restrict to remote objects originating from subsystems created by this subsystem factory.
<li><b>typecategoryfilter</b>. Restrict to remote objects originating from subsystems created by a subsystem factory that specified this value for their category attribute
<li><b>namefilter</b>. Restrict to remote objects matching this simple generic name
<li><b>typefilter</b>. Restrict to remote objects matching this simple type filter. The "type" of any remote object is subsystem-determined.
<li><b>subtypefilter</b>. Restrict to remote objects matching this simple sub-type filter. The "subtype" of any remote object is subsystem-determined.
<li><b>subsubtypefilter</b>. Restrict to remote objects matching this simple sub-sub-type filter. The "sub-subtype" of any remote object is subsystem-determined.
</ul>
-->
</ul>
<h2>Programming Details</h2>
<p>To use this extension point your class will typically extend one of the supplied base classes to
make it easier to create these property pages for remote objects. The only method you must implement in these
classes is <samp>createContents(Composite)</samp>, which populates the details page on the right side when the node is
selected on the left side. The supplied classes are listed here:
</p>
<TABLE border="1">
<TBODY>
<TR>
<TH>Base Class</TH>
<TH>Description</TH>
</TR>
<TR>
<TD><samp><A href="../../reference/api/org/eclipse/rse/ui/propertypages/SystemAbstractPropertyPageExtensionAction.html">SystemAbstractPropertyPageExtensionAction</A></samp>
in <samp>org.eclipse.rse.ui</samp> plugin.</TD>
<TD>Base class offering generic support for any remote object property page.</TD>
</TR>
<TR>
<TD><samp><A href="../../reference/api/org/eclipse/rse/files/ui/propertypages/SystemAbstractRemoteFilePropertyPageExtensionAction.html">SystemAbstractRemoteFilePropertyPageExtensionAction</A></samp>
in <samp>org.eclipse.rse.files.ui</samp> plugin.</TD>
<TD>Specialized base class offering specific support for any remote file object property page.</TD>
</TR>
</TBODY>
</TABLE>
<p>
</p>
<br><hr>
<p>See the <a href="../tutorial/propertypage.html">property page tutorial</a> for a step-by-step example.</p>
<p>See the <a href="../../../org.eclipse.platform.doc.isv/guide/preferences_prop_contribute.htm">Eclipse Platform Programmer's Guide</a>
for more background information.</p>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

View file

@ -0,0 +1,115 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2002, 2007. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
<LINK REL="STYLESHEET" HREF="../../book.css" TYPE="text/css">
<title>Creating a Remote Resource Popup Menu Action</title>
</head>
<body bgcolor="#ffffff">
<h1>Creating a Remote Resource pop-up Menu Action</h1>
<p>In this tutorial, you will use the
<samp><A href="../plugin/popup.html">org.eclipse.ui.popupMenus</a></samp> extension point to
create a pop-up menu action that will appear
in the context menu for any <samp>.jar</samp> file, for any connection to
any system type. The action will be labeled "Show contents" and will simply
run the <samp>jar -tvf</samp> JDK command when selected, displaying the results
in the command console. You could expand this example to copy the file
to a local temporary folder, extract the list of file names within the jar, and
display those names in an Eclipse table view.
</p>
<p><b>Tip:</b> If you prefer your Java code to use lined-up braces, select the
first two options in the <b><A href="preferences_JavaFormatting.gif">Code
Formatter</A></b> preferences page for <b>Java</b>, via <b>Windows-&gt;Preferences</b>.
This will affect code generated by wizards. The source code shown assumes this option has been set, but this is not required.
<h2>Step-by-Step: Creating an RSE Remote Resource Pop-up Menu Action</h2>
<ol>
<li>If you have not already, first <a href="pdeProject.html">create or prepare a plugin project</a>.
</li>
<li>Open the <b>plugin.xml</b> file for editing by right-clicking on it and selecting
<b>Open With-&gt;Text Editor</b>. Before the ending &lt;/plugin&gt; statement, add the following lines:
<pre><code>
&lt;!-- ======================================= --&gt;
&lt;!-- Remote Object Popup Menu Actions --&gt;
&lt;!-- ======================================= --&gt;
&lt;extension point=&quot;org.eclipse.ui.popupMenus&quot;&gt;
&lt;objectContribution
objectClass=&quot;org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile&quot;
namefilter=&quot;*.jar&quot;´
id=&quot;actions.jar&quot;&gt;
&lt;action
label=&quot;Show contents&quot;
tooltip=&quot;List contents of this file&quot;
class=&quot;samples.ui.actions.ShowJarContents&quot;
menubarPath=&quot;additions&quot;
enablesFor=&quot;1&quot;
id=&quot;actions.jar.show&quot;&gt;
&lt;/action&gt;
&lt;/objectContribution&gt;
&lt;/extension&gt;
</code></pre>
Save and close the file.
</li>
<li>
Create the Java package: right-click on the <B>src</B> source folder and select <B>New-&gt;Package</B> to open the <B>New
Java Package</B> wizard. Enter <B>&quot;samples.ui.actions&quot;</B> for the name of the package and press <B>Finish</B>.</li>
<li>
Create the Java class: right-click on the new <B>&quot;samples.ui.actions&quot;</B> package folder and select <B>New-&gt;Class</B> to open the <B>New
Java Class</B> wizard. Enter <B>&quot;ShowJarContents&quot;</B> for the <b>Name</b>
and <b>&quot;org.eclipse.rse.files.ui.actions.SystemAbstractRemoteFilePopupMenuExtensionAction&quot;</b>
for the <b>Superclass</b>. Select the <b>Constructors from superclass</b> check box, as shown
<A href="popup_newClass.gif">here</A>.
Press <b>Finish</b> to create the <samp><a href="ShowJarContents1.html">ShowJarContents</a></samp> class.
</li>
<li>Edit the generated <samp>ShowJarContents.java</samp> file as follows:
<ol>
<li type="i">Add the following three statements to the body of the <samp>run()</samp> method:</li>
<pre><code>
IRemoteFile selectedFile = getFirstSelectedRemoteFile();
String cmdToRun = "jar -tvf " + selectedFile.getAbsolutePath();
runCommand(cmdToRun);
</code></pre>
<li type="i">Add the following two methods to find the subsystem and run the command:</li>
<pre><code>
private void runCommand(String command) {
IRemoteCmdSubSystem cmdss = getRemoteCmdSubSystem();
if (cmdss != null && cmdss.isConnected()) {
RemoteCommandHelpers.runUniversalCommand(getShell(), command, ".", cmdss);
} else {
MessageDialog.openError(getShell(), "No command subsystem", "Found no command subsystem");
}
}
/**
* Gets the Command subsystem associated with the current host
*/
private IRemoteCmdSubSystem getRemoteCmdSubSystem() {
IHost myHost = getSubSystem().getHost();
IRemoteCmdSubSystem[] subsys = RemoteCommandHelpers.getCmdSubSystems(myHost);
for (int i = 0; i < subsys.length; i++) {
if (subsys[i].getSubSystemConfiguration().supportsCommands()) {
return subsys[i];
}
}
return null;
}
</code></pre>
<li type="i">User the "Source -> Organize Imports" context menu item to add the appropriate import statements.</li>
</ol>
The final result after editing is shown <a href="ShowJarContents2.html">here</a>.
</li>
</ol>
<p>Thats it! Now, you can try your new action. Use <b>Run-&gt;Run As-&gt;Run-time Workbench</b>. Drill
down in the RSE to a Jar file in a local or remote connection and right-click to <a href="popup_see.gif">see</a> and <a href="popup_run.gif">run</a> your new action. Notice
how it does not appear for files that do not end with the ".jar" extension. This is because of the "namefilter" attribute
in our extension point .xml file.
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View file

@ -0,0 +1,86 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2002, 2006. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
<LINK REL="STYLESHEET" HREF="../../book.css" TYPE="text/css">
<title>Creating a Remote Resource Property Page</title>
</head>
<body bgcolor="#ffffff">
<h1>Creating a Remote Resource Property Page</h1>
<p>In this tutorial, you will use the
<samp><A href="../plugin/propertypage.html">org.eclipse.ui.propertyPages</a></samp>
extension point to
create a <a href="propertypage_run_done.gif">property page</a> that will appear
in the Properties dialog for any folder, for any connection to
any system type. The page will be labeled "Folder Contents" and will show the
cumulative size of the contents of the folder, and the number of folders and files within it.
This will show the extension point, plus how to use some of the RSE user interface helpers, as well
as the remote file API for querying information about remote folders and files.
</p>
<p><b>Tip:</b> If you prefer your Java code to use lined-up braces, select the
first two options in the <b><A href="preferences_JavaFormatting.gif">Code
Formatter</A></b> preferences page for <b>Java</b>, via <b>Windows-&gt;Preferences</b>.
This will affect code generated by wizards. The source code shown assumes this option has been set, but this is not required.
<h2>Step-by-Step: Creating a Remote Resource Property Page</h2>
<ol>
<li>If you have not already, first <a href="pdeProject.html">create or prepare a plugin project</a>.
Open the <b>plugin.xml</b> file for editing by right-clicking on it, and selecting
<b>Open With-&gt;Text Editor</b>. Before the ending &lt;/plugin&gt; statement, add the following lines:
<pre><code>
&lt;!-- ======================================= --&gt;
&lt;!-- Remote Object Property Pages --&gt;
&lt;!-- ======================================= --&gt;
&lt;extension point=&quot;org.eclipse.ui.propertyPages&quot;&gt;
&lt;page name=&quot;Folder Contents&quot;
class=&quot;samples.ui.propertypages.FolderInfoPropertyPage&quot;
id=&quot;samples.ui.PropertyPage1&quot;&gt;
&lt;enabledWhen&gt;
&lt;instanceof value=&quot;org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile&quot;/&gt;
&lt;/enabledWhen&gt;
&lt;filter name=&quot;isDirectory&quot; value=&quot;true&quot;/&gt;
&lt;/page&gt;
&lt;/extension&gt;
</code></pre></li>
<li>Save and close the file.</li>
<li>
Create the Java package: right-click on the <B>src</B> source folder and select <B>New-&gt;Package</B> to get the <B>New
Java Package</B> wizard. Enter <B>&quot;samples.ui.propertypages&quot;</B> for the name of the package and press <B>Finish</B>.</li>
<li>
Create the Java class: right-click on the new <B>&quot;samples.ui.propertypages&quot;</B> package folder and select <B>New-&gt;Class</B> to open the <B>New
Java Class</B> wizard. Enter <B>&quot;FolderInfoPropertyPage&quot;</B> for the <b>Name</b>
and <b>&quot;org.eclipse.rse.files.ui.propertypages.SystemAbstractRemoteFilePropertyPageExtensionAction&quot;</b>
for the <b>Superclass</b>. Select the <b>Constructors from superclass</b> check box, as shown
<A href="propertypage_newClass.gif">here</A>.
Press <b>Finish</b> to create the <samp><a href="FolderInfoPropertyPage1.html">FolderInfoPropertyPage</a></samp> class.
</li>
<li>Edit the <samp>FolderInfoPropertyPage</samp> class to look like <A href="FolderInfoPropertyPage2.html">this</A>. There are many changes, so you should use
the clipboard to copy and paste.
</li>
<li>Edit the <samp>rseSamplesMesssage.xml</samp> file to look like <A href="rseSamplesMessages2.html">this</A>, where the changes are highlighted.
</li>
<li>Edit the <samp>rseSamplesResources.properties</samp> file to look like <A href="rseSamplesResources2.html">this</A>.
</li>
</ol>
<p>Thats it! Now, you can try out your new property page. Use <b>Run-&gt;Run As-&gt;Run-time Workbench</b>. Drill
down in the RSE to a folder in a local or remote connection and right-click to <a href="propertypage_see.gif">see</a>
and <a href="propertypage_run_during.gif">run</a> your new property page. This sample is a unique case, in that this operation could potentially run for a long time, as you are recursively walking all
the sub-folders and files to accumulate the size and count information. Because of this, we put this work
in a background thread, and update the GUI as each sub-folder is processed. We also supply a stop button
to the user and watch for them pressing Cancel or closing the dialog. When the thread ends, the
result looks like <a href="propertypage_run_done.gif">this</a>.
<p>Notice how this property page only appears for folders, due to the <b><samp>&lt;filter name="isDirectory&gt;</samp></b> markup
in our extension point xml.
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB