Checks to see if the chosen shortcut is already being used and if so shows a message warning the user
9516
private void checkDuplicate() {
		KeyboardShortcut ks = this.getDuplicate();
		if (ks != null) {
			this.setFieldValue(FIELD_INFO, Constant.messages.getString("keyboard.dialog.warning.dup", ks.getName()));
		} else {
			this.setFieldValue(FIELD_INFO, "");
		}
	}
1348729
def watchTextSelection(self, event=None):
        
        # Note that this isn't perfect - it is a key click behind when
        # selections are made via shift-arrow.  If this becomes important, it
        # can likely be fixed with after().
        if self.entry.selection_present(): # entry must be text entry type
            i1 = self.entry.index(SEL_FIRST)
            i2 = self.entry.index(SEL_LAST)
            if i1 >= 0 and i2 >= 0 and i2 > i1:
                sel = self.entry.get()[i1:i2]
                # Add to clipboard on platforms where necessary.
                print('selected: "'+sel+'"')
706075
def _set_shortcut_ownership(path, user):
    '''
    
    '''
    try:
        __salt__['file.lchown'](path, user)
    except OSError:
        pass
    return _check_shortcut_ownership(path, user)
424160
def detect_event_conflict!(event_name, method_name = event_name)
      if method_already_implemented?(method_name)
        raise FiniteMachine::AlreadyDefinedError, EVENT_CONFLICT_MESSAGE % {
          name: event_name,
          type: :instance,
          method: method_name,
          source: 'FiniteMachine'
        }
      end
    end
274724
private String getShortcutMessages(CmsMessages messages) {

        StringBuffer buffer = new StringBuffer();
        buffer.append("<span class=\"col1\"><b>").append(messages.key(Messages.GUI_CODEMIRROR_SHORTCUT_SEARCH_0));
        buffer.append("</b> ").append(messages.key(Messages.GUI_CODEMIRROR_SHORTCUT_SEARCH_HELP_0));
        buffer.append(" </span><span class=\"col2\"><b>").append(
            messages.key(Messages.GUI_CODEMIRROR_SHORTCUT_FIND_NEXT_0));
        buffer.append("</b> ").append(messages.key(Messages.GUI_CODEMIRROR_SHORTCUT_FIND_NEXT_HELP_0));
        buffer.append(" </span><span class=\"col3\"><b>").append(
            messages.key(Messages.GUI_CODEMIRROR_SHORTCUT_FIND_PREVIOUS_0));
        buffer.append("</b> ").append(messages.key(Messages.GUI_CODEMIRROR_SHORTCUT_FIND_PREVIOUS_HELP_0));
        buffer.append(" </span><span class=\"col1\"><b>").append(
            messages.key(Messages.GUI_CODEMIRROR_SHORTCUT_REPLACE_0));
        buffer.append("</b> ").append(messages.key(Messages.GUI_CODEMIRROR_SHORTCUT_REPLACE_HELP_0));
        buffer.append(" </span><span class=\"col2\"><b>").append(
            messages.key(Messages.GUI_CODEMIRROR_SHORTCUT_REPLACE_ALL_0));
        buffer.append("</b> ").append(messages.key(Messages.GUI_CODEMIRROR_SHORTCUT_REPLACE_ALL_HELP_0)).append(
            "</span>");
        return buffer.toString();
    }
365915
def handle_shortcut(request, config)
      if(params = config['shortcut'][request.path])
        params.each do |key, val|
          request.params[key.to_s] = val ? val : ''
        end
        request.uri = @handler_uri
      end
    end
232843
def ack(self):
        
        if self.acknowledged:
            raise self.MessageStateError(
                "Message already acknowledged with state: %s" % self._state)
        self.backend.ack(self._frame)
        self._state = "ACK"
218448
function isUsed (name) {
        if (module.isUsed(name)) {
          return true
        }
        if (dupes.length > 0) {
          return dupes.some((dupe) => {
            const m = analyzer.modules.get(dupe.file)
            return m && m.isUsed(name)
          })
        }
        return false
      }
151630
def _shortcut_check(name,
                    target,
                    arguments,
                    working_dir,
                    description,
                    icon_location,
                    force,
                    user):
    '''
    
    '''
    changes = {}
    if not os.path.exists(name):
        changes['new'] = name
        return None, 'Shortcut "{0}" to "{1}" is set for creation'.format(
            name, target
        ), changes

    if os.path.isfile(name):
        with salt.utils.winapi.Com():
            shell = win32com.client.Dispatch("WScript.Shell")
        scut = shell.CreateShortcut(name)
        state_checks = [scut.TargetPath.lower() == target.lower()]
        if arguments is not None:
            state_checks.append(scut.Arguments == arguments)
        if working_dir is not None:
            state_checks.append(
                scut.WorkingDirectory.lower() == working_dir.lower()
            )
        if description is not None:
            state_checks.append(scut.Description == description)
        if icon_location is not None:
            state_checks.append(
                scut.IconLocation.lower() == icon_location.lower()
            )

        if not all(state_checks):
            changes['change'] = name
            return None, 'Shortcut "{0}" target is set to be changed to "{1}"'.format(
                name, target
            ), changes
        else:
            result = True
            msg = 'The shortcut "{0}" is present'.format(name)
            if not _check_shortcut_ownership(name, user):
                result = None
                changes['ownership'] = '{0}'.format(_get_shortcut_ownership(name))
                msg += (
                    ', but the ownership of the shortcut would be changed '
                    'from {1} to {0}'
                ).format(user, _get_shortcut_ownership(name))
            return result, msg, changes
    else:
        if force:
            return None, ('The link or directory "{0}" is set for removal to '
                          'make way for a new shortcut targeting "{1}"'
                          .format(name, target)), changes
        return False, ('Link or directory exists where the shortcut "{0}" '
                       'should be. Did you mean to use force?'.format(name)), changes
656028
def display_warning(self, message, short_message,
                        style=wx.OK | wx.ICON_WARNING):
        """"""

        dlg = GMD.GenericMessageDialog(self.main_window, message,
                                       short_message, style)
        dlg.ShowModal()
        dlg.Destroy()
100889
def check_selection(self):
        
        if self.current_prompt_pos is None:
            self.set_cursor_position('eof')
        else:
            self.truncate_selection(self.current_prompt_pos)
813874
def _onMenuItemSelected(self, evt):
        """"""
        current = self._menu.IsChecked(evt.GetId())
        if current:
            new = False
        else:
            new = True
        self._menu.Check(evt.GetId(), new)
        # Lines above would be deleted based on svn tracker ID 2841525;
        # not clear whether this matters or not.
        self._toolbar.set_active(self.getActiveAxes())
        evt.Skip()
995413
def action_rm(self):
        

        name = self.args['<name>']

        if self.args['all']:
            # delete all

            if ask_yes_no('Really delete ALL shortcuts?', default='no'):
                self.db_exec(''' DELETE FROM shortcuts ''')
                print_msg("All shortcuts deleted.")
            else:
                print_err("Aborted.")
                return

        else:
            # delete one

            # find by name
            self.db_exec('''
                SELECT id FROM shortcuts WHERE name=?
                ''', (name,))

            q = self.db_fetch_one()
            id = q[0]

            # delete if exists
            if q is None:
                print_err('Shortcut "%s" does not exist!' % name)

            else:
                self.db_exec('''
                    DELETE FROM shortcuts WHERE id=?
                    ''', (id,))

                # show OK message
                print_msg('Shortcut "%s" deleted.' % name)
1022707
def _unhandledInput(event, workbench, launcher):
    
    if event == "ctrl w":
        raise urwid.ExitMainLoop()
    elif event == "esc":
        workbench.clear()
        workbench.display(launcher)
        return True
275477
def hide_shortcuts(self, menu):
        """"""
        for element in getattr(self, menu + '_menu_actions'):
            if element and isinstance(element, QAction):
                if element._shown_shortcut is not None:
                    element.setShortcut(QKeySequence())
187939
def updateShortcut( self ):
        
        aitem = self.uiActionTREE.currentItem()
        if ( not aitem ):
            return True
        
        scut = self.uiShortcutTXT.text()
        if ( not scut ):
            aitem.setText(1, '')
            return True
            
        for i in range(self.uiActionTREE.topLevelItemCount()):
            item = self.uiActionTREE.topLevelItem(i)
            if (item != aitem and item.text(1) == scut):
                msg = '%s already is using the %s shortcut.' % (item.text(0),
                                                                scut)
                QMessageBox.critical( self,
                                      'Duplicate Shortcut',
                                      msg )
                return False
        
        # update the item
        aitem.setText(1, scut)
        return True
872690
def _is_program_selected(progs):
    """"""
    mode = False
    for prog in progs:
        if getattr(Settings, prog.__name__):
            mode = True
            break
    return mode