private String getValue(Object[] objects) {
   StringBuffer buffer = new StringBuffer();
   for (Object object : objects) {
     IPackageFragment fragment = (IPackageFragment) object;
     if (buffer.length() > 0)
       buffer.append("," + getLineDelimiter() + " "); // $NON-NLS-1$ //$NON-NLS-2$
     buffer.append(fragment.getElementName());
   }
   return buffer.toString();
 }
 /*
  * Fix for Bug 60163 Accessibility: New Builder Dialog missing object info
  * for textInput controls
  */
 public void addControlAccessibleListener(Control control, String controlName) {
   // strip mnemonic (&)
   String[] strs = controlName.split("&"); // $NON-NLS-1$
   StringBuffer stripped = new StringBuffer();
   for (String element : strs) {
     stripped.append(element);
   }
   control
       .getAccessible()
       .addAccessibleListener(new ControlAccessibleListener(stripped.toString()));
 }
  /**
   * Constructs the URL string according to the given context root and the file name.
   *
   * @param fileName
   * @return
   */
  protected String computeURL(String fileName) {
    if (server == null) {
      return ""; //$NON-NLS-1$
    }
    String urlString = server.getBaseURL();

    if (urlString.equals("")) { // $NON-NLS-1$
      urlString = "http://localhost"; // $NON-NLS-1$
    }
    StringBuffer url = new StringBuffer(urlString);
    if (!fileName.equals("")) { // $NON-NLS-1$
      url.append(fileName);
    }
    return url.toString();
  }
Beispiel #4
0
 public void renderInitialization(final Widget widget) throws IOException {
   Tree tree = (Tree) widget;
   JSWriter writer = JSWriter.getWriterFor(tree);
   StringBuffer style = new StringBuffer();
   if ((tree.getStyle() & SWT.MULTI) != 0) {
     style.append("multi|");
   }
   if ((tree.getStyle() & SWT.CHECK) != 0) {
     style.append("check|");
   }
   if ((tree.getStyle() & SWT.VIRTUAL) != 0) {
     style.append("virtual|");
   }
   writer.newWidget("org.eclipse.swt.widgets.Tree", new Object[] {style.toString()});
   ControlLCAUtil.writeStyleFlags(tree);
 }
Beispiel #5
0
 public String toString() {
   StringBuffer sb = new StringBuffer();
   sb.append("Phase: " + getPhaseAlias() + " SubPhase: " + getSubPhaseAlias());
   sb.append(
       "Leader: "
           + getLeader().getAlias()
           + " sel: "
           + getLeader().getButton().getSelection()
           + " enabled: "
           + getLeader().getButton().isEnabled()
           + "\n");
   if (getControls() != null) {
     Iterator it = getControls().iterator();
     while (it.hasNext()) {
       ISootOptionWidget next = (ISootOptionWidget) it.next();
       sb.append("control: " + next.getId() + "\n");
       if (next instanceof BooleanOptionWidget) {
         sb.append(
             "control is boolean and enable state: "
                 + ((BooleanOptionWidget) next).getButton().isEnabled()
                 + "\n");
       }
     }
   }
   return sb.toString();
 }
 private void updateArgumentPreview(IArgumentsInfo launcherArguments) {
   StringBuffer buffer = new StringBuffer();
   String delim = System.getProperty("line.separator"); // $NON-NLS-1$
   String args =
       launcherArguments.getCompleteProgramArguments(
           TAB_LABELS[fLastTab], TAB_ARCHLABELS[fLastArch[fLastTab]]);
   if (args.length() > 0) {
     buffer.append(PDEUIMessages.ArgumentsSection_program);
     buffer.append(delim);
     buffer.append(args);
     buffer.append(delim);
     buffer.append(delim);
   }
   args =
       launcherArguments.getCompleteVMArguments(
           TAB_LABELS[fLastTab], TAB_ARCHLABELS[fLastArch[fLastTab]]);
   if (args.length() > 0) {
     buffer.append(PDEUIMessages.ArgumentsSection_vm);
     buffer.append(delim);
     buffer.append(args);
   }
   fPreviewArgs.setValue(buffer.toString());
 }
Beispiel #7
0
    /** Returns the next lexical token in the document. */
    public int nextToken() {
      int c;
      fStartToken = fPos;
      while (true) {
        switch (c = read()) {
          case EOF:
            return EOF;
          case '/': // comment
            c = read();
            if (c == '/') {
              while (true) {
                c = read();
                if ((c == EOF) || (c == EOL)) {
                  unread(c);
                  return COMMENT;
                }
              }
            } else {
              unread(c);
            }
            return OTHER;
          case '\'': // char const
            character:
            for (; ; ) {
              c = read();
              switch (c) {
                case '\'':
                  return STRING;
                case EOF:
                  unread(c);
                  return STRING;
                case '\\':
                  c = read();
                  break;
              }
            }

          case '"': // string
            string:
            for (; ; ) {
              c = read();
              switch (c) {
                case '"':
                  return STRING;
                case EOF:
                  unread(c);
                  return STRING;
                case '\\':
                  c = read();
                  break;
              }
            }

          case '0':
          case '1':
          case '2':
          case '3':
          case '4':
          case '5':
          case '6':
          case '7':
          case '8':
          case '9':
            do {
              c = read();
            } while (Character.isDigit((char) c));
            unread(c);
            return NUMBER;
          default:
            if (Character.isWhitespace((char) c)) {
              do {
                c = read();
              } while (Character.isWhitespace((char) c));
              unread(c);
              return WHITE;
            }
            if (Character.isJavaIdentifierStart((char) c)) {
              fBuffer.setLength(0);
              do {
                fBuffer.append((char) c);
                c = read();
              } while (Character.isJavaIdentifierPart((char) c));
              unread(c);
              Integer i = (Integer) fgKeys.get(fBuffer.toString());
              if (i != null) return i.intValue();
              return WORD;
            }
            return OTHER;
        }
      }
    }
 protected void log(final String msg) {
   content.insert(0, msg.trim() + text.getLineDelimiter());
   text.setText(content.toString());
 }