/** * Removes the SelectionListener from this command's eSWT command widget on the specified control. * * @param control * @param listener */ void eswtRemoveCommandSelectionListener(Control control, SelectionListener listener) { if (listener != null) { org.eclipse.ercp.swt.mobile.Command cmd = getESWTCommand(control); if (cmd != null && !cmd.isDisposed()) { cmd.removeSelectionListener(listener); } } }
/** * Add a SelectionListener to this command's eSWT command widget on the specified control. * * @param control * @param listener */ void eswtAddCommandSelectionListener(Control control, SelectionListener listener) { if (listener != null) { org.eclipse.ercp.swt.mobile.Command cmd = getESWTCommand(control); if (cmd != null && !cmd.isDisposed()) { // Remove listener if it is already added. Same listener // should be in same command only once: cmd.removeSelectionListener(listener); cmd.addSelectionListener(listener); } } }
/** * eSWT callback to add an eSWT Command to vector of eSWT Commands. * * @param control eSWT control on which the command is created. * @param isDefault If true, created eSWT command is set to be default one. */ void eswtAddESWTCommand(Control control, boolean isDefault) { if (!eswtCommands.containsKey(control)) { int eswtType = getEswtType(type); int eswtPriority = getESWTPriority(priority); org.eclipse.ercp.swt.mobile.Command eswtCommand = new org.eclipse.ercp.swt.mobile.Command(control, eswtType, eswtPriority); eswtCommand.setText(shortLabel); if (longLabel != null) { eswtCommand.setLongLabel(longLabel); } if (isDefault) { eswtCommand.setDefaultCommand(); } eswtCommands.put(control, eswtCommand); } }