Пример #1
0
 void onMnemonic(TraverseEvent event) {
   char mnemonic = _findMnemonic(text);
   if (mnemonic == '\0') return;
   if (Character.toLowerCase(event.character) != mnemonic) return;
   Composite control = this.getParent();
   while (control != null) {
     Control[] children = control.getChildren();
     int index = 0;
     while (index < children.length) {
       if (children[index] == this) break;
       index++;
     }
     index++;
     if (index < children.length) {
       if (children[index].setFocus()) {
         event.doit = true;
         event.detail = SWT.TRAVERSE_NONE;
       }
     }
     control = control.getParent();
   }
 }
 public void setSelected(FModel fmodel) {
   if (selectedModel == fmodel) return;
   selectedModel = fmodel;
   if (selectedModel instanceof FConstantsModel) {
     currentEditor = constants;
     enableComponent(0);
     constants.setFModel(fmodel);
     dependency.setFModel(null);
   } else if (selectedModel instanceof FieldModel) {
     fmodel = ((FieldModel) fmodel).getDefaultDependency();
     dependency.setFModel(fmodel);
     dependency.getFieldEditor().setEnabled(true);
     constants.setFModel(null);
     if (currentEditor != dependency) {
       currentEditor = dependency;
       enableComponent(1);
     }
   } else if (selectedModel instanceof DependencyModel) {
     dependency.setFModel(fmodel);
     dependency.getFieldEditor().setEnabled(false);
     constants.setFModel(null);
     if (currentEditor != dependency) {
       currentEditor = dependency;
       enableComponent(1);
     }
   } else if (currentEditor != null) {
     currentEditor = null;
     enableComponent(-1);
     constants.setFModel(null);
     constants.setFModel(null);
   }
   selectedModel = fmodel;
   control.getParent().update();
   control.update();
   control.layout(true);
   control.redraw();
 }