Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-devel] menu paths etc for new operations

Thanks Jesse

I can't control where the categories go in the operations menu. Or alternatively if I create a new Action Set > menu (e.g. "Sample Menu"), and then use that as the menuPath for the new Operation, it just ends up on the menu bar, not in the new menu. Actually, the new menu doesn't even show up at all!

Murray



Jesse Eichar wrote:

On 15-Jan-07, at 6:54 AM, Murray Richardson wrote:

Hope you all had a good weekend!

Trying to wrap up a project and have a few last minute questions if
anyone might be able to help:

(1) I haven't been able to figure out the menu paths to use for new operations. What are they? Also - is it possible to have new subcategories within new categories to better organize operations? Finally, is it possible to put new Operations into a new Menu altogether (not Operations), but still have them accessible under the Operations menu accessed by right-clicking layers?

That is an optional attribute by default operations will be in the Operation Menu in the category that was declared in the extension definition. The Menu path allows one to place the operation else where. You can find most of the options in the Constants class. Look at:
http://svn.geotools.org/udig/branches/1.1.x/udig/plugins/net.refractions.udig.ui/src/net/refractions/udig/ui/Constants.java






(2) Is it possible to reset a postGIS service listed in the catalog from
within an operation?  If so, how?

Its not nice... Here's a snippet from the Reset action:

public static void reset( IService original, IProgressMonitor monitor ) { IServiceFactory locator = CatalogPlugin.getDefault().getServiceFactory();
        ICatalog connections = CatalogPlugin.getDefault().getLocalCatalog();

            try {
                final URL ID = original.getIdentifier();
CatalogUIPlugin.trace("Reset service " + original.getIdentifier()); //$NON-NLS-1$

Map<java.lang.String, java.io.Serializable> connectionParams = original
                        .getConnectionParams();

                IService replacement = null; // unknown
TEST: for( IService candidate : locator.acquire(ID, connectionParams) ) {
                    try {
CatalogUIPlugin.trace(ID + " : connecting"); //$NON-NLS-1$
                        IServiceInfo info = candidate.getInfo(monitor);
CatalogUIPlugin.trace(ID + " : found " + info.getTitle()); //$NON-NLS-1$
                        replacement = candidate;
                        break TEST;
                    } catch (Throwable t) {
CatalogUIPlugin.trace(ID + " : ... " + t.getLocalizedMessage()); //$NON-NLS-1$

                    }
                }
                if (replacement == null) {
return; // not available - should update existing service to error?
                }
                connections.replace(ID, replacement);
            } catch (Throwable failed) {
                CatalogUIPlugin.log("Reset failed", failed); //$NON-NLS-1$
            }
    }



(3) Is it possible to have more than one target class for an operation? e.g. How do I make an operation apply to resources in the catalog view, such as a table in a postGIS service, as well as layers in the Project view?


Hmmm. If I think you will have to do it in a 2 step process. A Layer will adapt to anything a IGeoResource will adapt to. So if your operation operates on a FeatureSource then it will work on both an IGeoResource or a Layer. There are two ways to do this the easy way and the more correct way:

Easy:
Make the target a java.sql.Connection. Currenlty only PostGis will resolve to SQL. But the PostGis Service does too so this will allow the operation to be run on a PostGisService

Correct:
What you can do is make a net.refractions.udig.catalog.resolvers extension so that PostGis GeoResources will resolve to some interface of your choosing. Then set the target of your operation to be that interface. See http://udig.refractions.net/docs/api-udig/extension-points/net_refractions_udig_catalog_resolvers.html for more info on the Resolvers extension point

Thanks!

Murray


_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel


------------------------------------------------------------------------

_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel


------------------------------------------------------------------------

No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.16.12/628 - Release Date: 1/15/2007 11:04 AM


Back to the top