Hei Andreas,

I would like to see it in the OpenJUMP configuration file. It should be 
possible.. or is it too cumbersome?
(mhm... one moment)
If I remember right the ISA tools did as well add context menu 
functions. Some of them have been transfered and are found in 
openjump.core.ui.plugin.mousemenu
If you scroll down in the OpenJumpConfiguration file you will find 
initializations of MouseMenu functions.

What concerns the resource files: Please add the key to every language 
file including the english translation. The translation can be later 
replaced by the people that maintain the specific language file.

stefan

note: i fixed the last 2 hours the first MacOSX bug, so your changelog 
needs to be updated

Andreas Schmitz schrieb:
> Hi,
> 
> I just wrote a little plugin to rename a layer. I know one can rename a
> layer by double clicking, but users have asked me for a (context) menu
> item ;-)
> 
> Some questions came up:
> 
> 1) Where exactly do I have to put I18N keys? Right now I just put them
> in the en, de and jump.properties. Do I have to put an english key in
> the other language files?
> 
> 2) Since I wanted to have a context menu item I'm loading the plugin
> from the JUMPConfiguration. Is there a better/more preferred way? I
> found the OpenJumpConfiguration, but it does not seem to offer this.
> 
> I just wanted to clarify these points before checking anything in.
> 
> PS: Once again I attached a patch, and the plugin source which goes to
> src/org/openjump/core/ui/plugin/layer/ChangeLayerableNamePlugIn.java
> 
> Best regards, Andreas
> 
> 
> ------------------------------------------------------------------------
> 
> Index: src/com/vividsolutions/jump/workbench/JUMPConfiguration.java
> ===================================================================
> --- src/com/vividsolutions/jump/workbench/JUMPConfiguration.java      
> (Revision 907)
> +++ src/com/vividsolutions/jump/workbench/JUMPConfiguration.java      
> (Arbeitskopie)
> @@ -33,6 +33,8 @@
>  
>  import com.vividsolutions.jts.util.*;
>  import org.openjump.OpenJumpConfiguration;
> +import org.openjump.core.ui.plugin.layer.ChangeLayerableNamePlugIn;
> +
>  import com.vividsolutions.jump.I18N;
>  
>  import com.vividsolutions.jump.datastore.*;
> @@ -237,6 +239,8 @@
>      private ImageLayerManagerPlugIn imageLayerManagerPlugIn = new 
> ImageLayerManagerPlugIn();
>  
>       private RefreshDataStoreLayerPlugin refreshDataStoreLayerPlugin = new 
> RefreshDataStoreLayerPlugin();
> +    
> +    private ChangeLayerableNamePlugIn changeLayerableNamePlugIn = new 
> ChangeLayerableNamePlugIn();
>       
>      public void setup(WorkbenchContext workbenchContext) throws Exception {
>          configureStyles(workbenchContext);
> @@ -384,6 +388,9 @@
>                  zoomToLayerPlugIn, zoomToLayerPlugIn.getName(), false, null,
>                  zoomToLayerPlugIn.createEnableCheck(workbenchContext));
>          featureInstaller.addPopupMenuItem(layerNamePopupMenu,
> +                                          changeLayerableNamePlugIn, 
> changeLayerableNamePlugIn.getName(), false, null,
> +                                          
> changeLayerableNamePlugIn.createEnableCheck(workbenchContext));
> +        featureInstaller.addPopupMenuItem(layerNamePopupMenu,
>                  changeStylesPlugIn, changeStylesPlugIn.getName() + "...",
>                  false, GUIUtil.toSmallIcon(changeStylesPlugIn.getIcon()),
>                  changeStylesPlugIn.createEnableCheck(workbenchContext));
> Index: src/language/jump.properties
> ===================================================================
> --- src/language/jump.properties      (Revision 907)
> +++ src/language/jump.properties      (Arbeitskopie)
> @@ -434,6 +434,7 @@
>  org.openjump.core.ui.plugin.layer.AddSIDLayerPlugIn.files                    
>                                                                               
>                                                  = files
>  org.openjump.core.ui.plugin.layer.AddSIDLayerPlugIn.not-installed            
>                                                                               
>                                                  = not installed.
>  org.openjump.core.ui.plugin.layer.AddSIDLayerPlugIn.open-MrSID-file          
>                                                                               
>                                                  = open MrSID file
> +org.openjump.core.ui.plugin.layer.ChangeLayerableName.Rename                 
>                                                                               
>                                                  = Rename Selected Layer
>  org.openjump.core.ui.plugin.layer.ChangeSRIDPlugIn.Change-SRID               
>                                                                               
>                                                  = Change SRID
>  
> org.openjump.core.ui.plugin.layer.ToggleVisiblityPlugIn.Error-See-Output-Window
>                                                                               
>                                                = Error: see output window
>  org.openjump.core.ui.plugin.layer.ToggleVisiblityPlugIn.Toggle-Visibility    
>                                                                               
>                                                  = Toggle Visibility
> Index: src/language/jump_en.properties
> ===================================================================
> --- src/language/jump_en.properties   (Revision 907)
> +++ src/language/jump_en.properties   (Arbeitskopie)
> @@ -434,6 +434,7 @@
>  org.openjump.core.ui.plugin.layer.AddSIDLayerPlugIn.files                    
>                                                                               
>                                                  = files
>  org.openjump.core.ui.plugin.layer.AddSIDLayerPlugIn.not-installed            
>                                                                               
>                                                  = not installed.
>  org.openjump.core.ui.plugin.layer.AddSIDLayerPlugIn.open-MrSID-file          
>                                                                               
>                                                  = open MrSID file
> +org.openjump.core.ui.plugin.layer.ChangeLayerableName.Rename                 
>                                                                               
>                                                  = Rename Selected Layer
>  org.openjump.core.ui.plugin.layer.ChangeSRIDPlugIn.Change-SRID               
>                                                                               
>                                                  = Change SRID
>  
> org.openjump.core.ui.plugin.layer.ToggleVisiblityPlugIn.Error-See-Output-Window
>                                                                               
>                                                = Error: see output window
>  org.openjump.core.ui.plugin.layer.ToggleVisiblityPlugIn.Toggle-Visibility    
>                                                                               
>                                                  = Toggle Visibility
> Index: src/language/jump_de.properties
> ===================================================================
> --- src/language/jump_de.properties   (Revision 907)
> +++ src/language/jump_de.properties   (Arbeitskopie)
> @@ -426,6 +426,7 @@
>  org.openjump.core.ui.plugin.layer.AddSIDLayerPlugIn.files                    
>                                                                               
>                                                  = Dateien
>  org.openjump.core.ui.plugin.layer.AddSIDLayerPlugIn.not-installed            
>                                                                               
>                                                  = nicht installiert.
>  org.openjump.core.ui.plugin.layer.AddSIDLayerPlugIn.open-MrSID-file          
>                                                                               
>                                                  = MrSID Bild \u00F6ffnen
> +org.openjump.core.ui.plugin.layer.ChangeLayerableName.Rename                 
>                                                                               
>                                                  = Ausgew\u00E4hlte Ebene 
> umbenennen
>  org.openjump.core.ui.plugin.layer.ChangeSRIDPlugIn.Change-SRID               
>                                                                               
>                                                  = SRID \u00E4ndern
>  
> org.openjump.core.ui.plugin.layer.ToggleVisiblityPlugIn.Error-See-Output-Window
>                                                                               
>                                                = Fehler: bitte im 
> Ausgabefenster schauen
>  org.openjump.core.ui.plugin.layer.ToggleVisiblityPlugIn.Toggle-Visibility    
>                                                                               
>                                                  = Sichtbarkeit 
> Ein-/Ausschalten
> 
> 
> ------------------------------------------------------------------------
> 
> package org.openjump.core.ui.plugin.layer;
> 
> import javax.swing.JOptionPane;
> 
> import com.vividsolutions.jump.I18N;
> import com.vividsolutions.jump.workbench.WorkbenchContext;
> import com.vividsolutions.jump.workbench.model.Layer;
> import com.vividsolutions.jump.workbench.model.UndoableCommand;
> import com.vividsolutions.jump.workbench.plugin.AbstractPlugIn;
> import com.vividsolutions.jump.workbench.plugin.EnableCheck;
> import com.vividsolutions.jump.workbench.plugin.EnableCheckFactory;
> import com.vividsolutions.jump.workbench.plugin.MultiEnableCheck;
> import com.vividsolutions.jump.workbench.plugin.PlugInContext;
> import com.vividsolutions.jump.workbench.ui.MenuNames;
> import com.vividsolutions.jump.workbench.ui.plugin.FeatureInstaller;
> 
> /**
>  * <code>ChangeLayerableName</code> changes the name of a layer.
>  * 
>  * @author <a href="mailto:[EMAIL PROTECTED]">Andreas Schmitz</a>
>  * @author last edited by: $Author:$
>  * 
>  * @version $Revision:$, $Date:$
>  */
> public class ChangeLayerableNamePlugIn extends AbstractPlugIn {
> 
>     private MultiEnableCheck enableCheck;
> 
>     @Override
>     public void initialize( PlugInContext context )
>                             throws Exception {
>         
>         new FeatureInstaller( context.getWorkbenchContext() 
> ).addMainMenuItemWithJava14Fix(
>                                                                               
>               this,
>                                                                               
>               new String[] { MenuNames.LAYER },
>                                                                               
>               getName() + "...", false,
>                                                                               
>               null, enableCheck );
>     }
> 
>     @Override
>     public String getName() {
>         return I18N.get( 
> "org.openjump.core.ui.plugin.layer.ChangeLayerableName.Rename" );
>     }
> 
>     @Override
>     public boolean execute( PlugInContext context )
>                             throws Exception {
>         reportNothingToUndoYet( context );
>         final Layer layer = context.getSelectedLayer( 0 );
>         final String oldName = layer.getName();
>         final String newName = (String) JOptionPane.showInputDialog(
>                                                                      
> context.getWorkbenchFrame(),
>                                                                      
> I18N.get( "org.openjump.core.ui.plugin.layer.ChangeLayerableName.Rename" ),
>                                                                      
> getName(), JOptionPane.PLAIN_MESSAGE, null, null,
>                                                                      oldName 
> );
>         execute( new UndoableCommand( getName() ) {
>             @Override
>             public void execute() {
>                 layer.setName( newName );
>             }
> 
>             @Override
>             public void unexecute() {
>                 layer.setName( oldName );
>             }
>         }, context );
>         return true;
>     }
> 
>     /**
>      * @param workbenchContext
>      * @return an enable check
>      */
>     public EnableCheck createEnableCheck( WorkbenchContext workbenchContext ) 
> {
>         if(enableCheck != null) return enableCheck;
>         
>         EnableCheckFactory enableCheckFactory = new EnableCheckFactory( 
> workbenchContext );
>         enableCheck = new MultiEnableCheck();
>         enableCheck.add( 
> enableCheckFactory.createWindowWithLayerManagerMustBeActiveCheck() );
>         enableCheck.add( 
> enableCheckFactory.createExactlyNLayersMustBeSelectedCheck( 1 ) );
>         return enableCheck;
>     }
> 
> }
> 
> 
> ------------------------------------------------------------------------
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >>  http://get.splunk.com/
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Jump-pilot-devel mailing list
> Jump-pilot-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to