Пример #1
0
 private boolean setServiceParameter(
     GlobalEnvironment.PropertyType type, JLabel label, JTextField textField) {
   String name = String.valueOf(type).toLowerCase();
   String startDirectory =
       StringUtil.isEmptyOrSpaces(textField.getText())
           ? System.getProperty("user.home")
           : textField.getText();
   JFileChooser fileChooser = new JFileChooser(startDirectory);
   fileChooser.setDialogTitle("Select Emacs " + name + " directory");
   fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
   if (fileChooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
     String dir = fileChooser.getSelectedFile().getAbsolutePath();
     textField.setText(dir);
     if (GlobalEnvironment.testProperty(type, dir)) {
       infoLabel.setText("Emacs " + name + " directory successfully set");
       label.setForeground(Color.black);
       return true;
     } else {
       onWrongProperty(label, type);
       return false;
     }
   } else {
     if (GlobalEnvironment.isEmacsPropertyOk(type)) return true;
     onWrongProperty(label, type);
     return false;
   }
 }
Пример #2
0
 public void refreshText() {
   setText(homeTextField, emacsHomeService);
   setText(srcTextField, emacsSourceService);
   if (!EnvironmentInitializer.isGlobalInitialized()) {
     isSourceValid =
         GlobalEnvironment.testProperty(
             GlobalEnvironment.PropertyType.SOURCE, emacsSourceService.getEmacsParameter());
     isHomeValid =
         GlobalEnvironment.testProperty(
             GlobalEnvironment.PropertyType.HOME, emacsHomeService.getEmacsParameter());
   } else {
     isHomeValid = true;
     isSourceValid = true;
   }
   homeLabel.setForeground(isHomeValid ? Color.black : Color.red);
   srcLabel.setForeground(isSourceValid ? Color.black : Color.red);
   applyButton.setEnabled(false);
   infoLabel.setText("");
 }
Пример #3
0
 @Subroutine("message")
 public static LispString message(@Optional LispObject... args) {
   if (args.length == 0) throw new WrongNumberOfArgumentsException("message", 0);
   LispObject formatObj = args[0];
   if (formatObj instanceof LispString) {
     LispObject[] a = new LispObject[args.length - 1];
     System.arraycopy(args, 1, a, 0, args.length - 1);
     myCurrentMessage = format((LispString) formatObj, a);
   } else if (formatObj.equals(LispSymbol.ourNil)) {
     myCurrentMessage = new LispString(LispSymbol.ourNil.toString());
   } else {
     throw new WrongTypeArgumentException("stringp", formatObj);
   }
   GlobalEnvironment.echo(myCurrentMessage.getData(), GlobalEnvironment.MessageType.OUTPUT);
   return myCurrentMessage;
 }