if ( (cmd != this.cancelCommand) &&
if ( (cmd != this.hideCommand) &&
	public void addCommand(Command cmd) {		if (cmd == this.singleLeftCommand || cmd == this.singleRightCommand || this.commandsList.contains(cmd)) {			// do not add an existing command again...			//#debug			System.out.println("Ignoring existing command " + cmd.getLabel() );			return;		}		//#debug		System.out.println("adding command " + cmd.getLabel() + " (" + cmd + ")");		int type = cmd.getCommandType();		int priority = cmd.getPriority();		//#if tmp.useInvisibleMenuBar			if ( this.cancelCommand == null ) {				// add cancel command:				//#ifdef polish.i18n.useDynamicTranslations					String text =  Locale.get("polish.command.hide");				//#elifdef polish.command.hide:defined					//#= String text =  "${polish.command.hide}";				//#else					//# String text =  "Hide";				//#endif				this.cancelCommand = new Command( text, Command.CANCEL, 2000 );				addCommand( this.cancelCommand );			}			if ( (cmd != this.cancelCommand) && 					(type == Command.BACK || type == Command.CANCEL || type == Command.EXIT) ) 			{				if ( this.singleRightCommand == null || this.singleRightCommand.getPriority() > priority ) {					this.singleRightCommand = cmd;				}			}		//#else			//#if polish.blackberry				//# if (type == Command.BACK || type == Command.CANCEL || type == Command.EXIT ) {			//#else			if (type == Command.BACK || type == Command.CANCEL) {			//#endif				if (this.singleRightCommand == null) {					this.singleRightCommand = cmd;					this.singleRightCommandItem.setImage( (Image)null );					this.singleRightCommandItem.setText( cmd.getLabel() );					if (this.isInitialised) {						this.isInitialised = false;						repaint();					}					return;				} else if ( this.singleRightCommand.getPriority() > priority ) {					Command oldRightCommand = this.singleRightCommand;					this.singleRightCommand = cmd;					this.singleRightCommandItem.setText( cmd.getLabel() );					cmd = oldRightCommand;					priority = oldRightCommand.getPriority();				}			}			if (this.singleLeftCommand != null) {				// add existing left command first:				//#style menuitem, menu, default				CommandItem item = new CommandItem( this.singleLeftCommand, this );				this.commandsList.add( this.singleLeftCommand );				this.commandsContainer.add( item );				this.singleLeftCommand = null;			}  else if (this.commandsList.size() == 0) {				// this is the new single left command!				//#debug				System.out.println("Setting single left command " + cmd.getLabel() );				this.singleLeftCommand = cmd;				this.singleLeftCommandItem.setText( cmd.getLabel() );				if (this.isInitialised) {					this.isInitialised = false;					repaint();				}				return;			} 		//#endif		//#style menuitem, menu, default		CommandItem item = new CommandItem( cmd, this );		if ( this.commandsList.size() == 0 ) {			this.commandsList.add( cmd );			this.commandsContainer.add( item );		} else {			// there are already several commands,			// so add this cmd to the appropriate sorted position:			Command[] myCommands = (Command[]) this.commandsList.toArray( new Command[ this.commandsList.size() ]);			boolean inserted = false;			for (int i = 0; i < myCommands.length; i++) {				Command command = myCommands[i];				if ( cmd == command ) {					return;				}				if (command.getPriority() > priority ) {					this.commandsList.add( i, cmd );					this.commandsContainer.add(i, item);					inserted = true;					break;				}			}			if (!inserted) {				this.commandsList.add( cmd );				this.commandsContainer.add( item );			}		}				if (this.isInitialised) {			this.isInitialised = false;			repaint();		}	}