I'm trying to add a button to the left  vertical toolbar with no success at
all, I've looked to several plugins and I don't get what I'm missing. could
someone tell me what I'm doing wrong. Every things compiles and runs but
the button doesn't appear. As JMenuItem works well

thanks guys
// License: GPL. Copyright 2009 by Mike Nice and others
//package org.openstreetmap.josm.plugins.AddrInterpolation;
package simpleaddrinterpolation;

import org.openstreetmap.josm.Main;
import org.openstreetmap.josm.gui.IconToggleButton;
import org.openstreetmap.josm.gui.MapFrame;
import org.openstreetmap.josm.plugins.Plugin;
import org.openstreetmap.josm.plugins.PluginInformation;

public class SimpleAddrInterpolationPlugin extends Plugin
{

    SimpleAddrInterpolationAction action;
//    private final IconToggleButton btn;

    public SimpleAddrInterpolationPlugin(PluginInformation info)
    {
        super(info);
        action = new SimpleAddrInterpolationAction();
        Main.main.menu.toolsMenu.add(action);
        action.setEnabled(true);

//        btn = new IconToggleButton(new SimpleAddrInterpolationMode(Main.map));
//        btn.setVisible(true);


    }
    
        @Override
    public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {
         if (oldFrame == null && newFrame != null) {
//            Main.map.addMapMode(btn);
//            Main.map.setVisible(true);
//            Main.map.mapView.repaint();
             Main.map.addMapMode(new IconToggleButton(new SimpleAddrInterpolationMode(Main.map)));
             Main.map.setVisible(true);
             Main.map.mapMode.setEnabled(true);
        }
    }

}
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package simpleaddrinterpolation;

import org.openstreetmap.josm.gui.MapFrame;
import java.awt.Cursor;
import org.openstreetmap.josm.actions.mapmode.MapMode;
import static org.openstreetmap.josm.tools.I18n.tr;

/**
 *
 * @author user
 */
class SimpleAddrInterpolationMode extends MapMode
{

    public SimpleAddrInterpolationMode(MapFrame mapFrame)
    {
        super(tr("Simple Interpolation"), "AddrInterpolation.png", 
                tr("provides simple interpolation"),
                mapFrame, Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));

    }
    
    @Override
        public void enterMode() {
        super.enterMode();
        }
        
            @Override
    public void exitMode() {
        super.exitMode();
            }
            
            
    
}
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package simpleaddrinterpolation;

import java.awt.event.ActionEvent;
import java.util.Collection;
import org.openstreetmap.josm.actions.JosmAction;
import org.openstreetmap.josm.data.osm.OsmPrimitive;
import static org.openstreetmap.josm.tools.I18n.tr;

/**
 *
 * @author user
 */
public class SimpleAddrInterpolationAction extends JosmAction
{

    public SimpleAddrInterpolationAction()
    {
        super(tr("Simple Addr Interpolation"), "AddrInterpolation",
                tr("Add house numbers using Buenos Aires interpolation schema"), null, true);
        setEnabled(true);
    }
    
    
    @Override
    public void actionPerformed(ActionEvent ae)
    {
        throw new UnsupportedOperationException("Not supported yet.");
    }
    
    public void selectionChanged(Collection<? extends OsmPrimitive> newSelection)
    {
        throw new UnsupportedOperationException("Not supported yet.");
    }
}//end class

_______________________________________________
josm-dev mailing list
josm-dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/josm-dev

Reply via email to