Package org.eclipse.ui.forms.widgets

Examples of org.eclipse.ui.forms.widgets.FormText


        Composite cmpDescription = new Composite(container, SWT.BORDER);
        cmpDescription.setBackground(tree.getBackground());

        txtDescription = new ScrolledFormText(cmpDescription, SWT.V_SCROLL | SWT.H_SCROLL, false);
        FormText formText = new FormText(txtDescription, SWT.NO_FOCUS);
        txtDescription.setFormText(formText);
        txtDescription.setBackground(tree.getBackground());
        formText.setBackground(tree.getBackground());
        formText.setForeground(tree.getForeground());

        GridData gd_cmpDescription = new GridData(SWT.FILL, SWT.FILL, true, true);
        gd_cmpDescription.heightHint = 100;
        cmpDescription.setLayoutData(gd_cmpDescription);
View Full Code Here


    }

    @Override
    void createSection(Section section, FormToolkit toolkit) {
        section.setText(Messages.RunBundlesPart_title);
        FormText description = new FormText(section, SWT.READ_ONLY | SWT.WRAP);
        description.setText(Messages.RunBundlesPart_description, true, false);
        section.setDescriptionControl(description);
        super.createSection(section, toolkit);

        Composite composite = (Composite) section.getClient();
View Full Code Here

                    Group group = new Group(shell, SWT.NONE);
                    data = new GridData(SWT.LEFT, SWT.TOP, true, true);
                    group.setLayoutData(data);
                    group.setLayout(layout);
                    group.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
                    FormText text = toolkit.createFormText(group, true);
                    configureFormText(ResolveVisualizerForm.this.form.getForm(), text);
                    if (href instanceof IMessage[]) {
                        text.setText(createFormTextContent((IMessage[]) href), true, false);
                    }

                    shell.setLocation(hl);
                    shell.pack();
                    shell.open();
View Full Code Here

        Composite cmpDescription = new Composite(container, SWT.BORDER);
        cmpDescription.setBackground(tree.getBackground());

        txtDescription = new ScrolledFormText(cmpDescription, SWT.V_SCROLL | SWT.H_SCROLL, false);
        FormText formText = new FormText(txtDescription, SWT.NO_FOCUS);
        txtDescription.setFormText(formText);
        txtDescription.setBackground(tree.getBackground());
        formText.setBackground(tree.getBackground());
        formText.setForeground(tree.getForeground());
        formText.setFont("fixed", JFaceResources.getTextFont());
        formText.setFont("italic", JFaceResources.getFontRegistry().getItalic(""));

        GridData gd_cmpDescription = new GridData(SWT.FILL, SWT.FILL, true, true);
        gd_cmpDescription.heightHint = 100;
        cmpDescription.setLayoutData(gd_cmpDescription);
View Full Code Here

    return container;
    }

  public final static FormText createClient(Composite section, String content, FormToolkit toolkit)
    {
    FormText text = toolkit.createFormText(section, true);

    try
      {
      text.setText(content, false, false);
      }

    catch (SWTException e)
      {
      text.setText(e.getMessage(), false, false);
      }

    return text;
    }
View Full Code Here

      }
    }

    if (chatHistory == null) {
      if (styledTextHistory == null) {
        FormText text = tk.createFormText(historyForm.getBody(), true);
        if (isMe(jid)) {
          text.setColor("jidcolor", text.getDisplay().getSystemColor(
              SWT.COLOR_RED));
        } else {
          text.setColor("jidcolor", text.getDisplay().getSystemColor(
              SWT.COLOR_BLUE));
        }
        if (emoticons != null)
          for (IconDef def : emoticons.getIcons()) {
            for (String iconstr : def.text) {
              if (msg.contains(iconstr)) {
                msg = msg.replace(iconstr, "<img href=\""
                    + def.image + "\" />");
                text.setImage(def.image, def.getImage());
              }
            }
          }
        StringBuffer fullText = new StringBuffer("<form><p>");
        fullText.append("<b>").append(
            historyDateFormat.format(date == null ? new Date() : date))
            .append("</b> ");
        fullText.append("<span color=\"jidcolor\">");
        if (prefix == null)
          fullText.append(" &lt;").append(jiddisplay).append("&gt; ");
        else
          fullText.append(prefix).append(jiddisplay);
        fullText.append("</span> ");
        fullText.append(msg);
        fullText.append("</p></form>");
        System.out.println("Text: " + fullText.toString());
        text.setText(fullText.toString(), true, false);
        text.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
        historyForm.reflow(true);
        historyForm.setOrigin(0, text.getLocation().y);
      } else {
        if(styledTextHistory.getText().length() > 0) {
          styledTextHistory.append("\n");
        }
       
        String historydate =  historyDateFormat.format(date == null ? new Date() : date) + " ";
       
        String prefixtext = (prefix == null ? "<" + jiddisplay + "> " : prefix + jiddisplay + " ");
        StyleRange dateRange = new StyleRange();
        dateRange.start = styledTextHistory.getText().length();
        dateRange.length = historydate.length();
        dateRange.fontStyle = SWT.BOLD;
       
        int msgStart = styledTextHistory.getText().length() + historydate.length();
        StyleRange range = new StyleRange();
        range.start = dateRange.start + dateRange.length;
        range.length = prefixtext.length();
        if(isMe(jid)) {
          range.foreground = styledTextHistory.getDisplay().getSystemColor(SWT.COLOR_RED);
        } else {
          range.foreground = styledTextHistory.getDisplay().getSystemColor(SWT.COLOR_BLUE);
        }
        range.fontStyle = SWT.BOLD;
        styledTextHistory.append(historydate + prefixtext);
        styledTextHistory.setStyleRange(dateRange);
        styledTextHistory.setStyleRange(range);
        if(usesXHTML) {
          SAXParserFactory fac = SAXParserFactory.newInstance();
          try {
            SAXParser parser = fac.newSAXParser();
           
            parser.parse(new InputSource(new StringReader("<body>"+msg+"</body>")),new ParseXHTMLForStyledText(styledTextHistory));
          } catch (ParserConfigurationException e) {
            e.printStackTrace();
          } catch (SAXException e) {
            e.printStackTrace();
          } catch (IOException e) {
            e.printStackTrace();
          }
         
        } else {
          styledTextHistory.append(msg);
        }
       
        String text = styledTextHistory.getText();
        text = text.substring(msgStart,text.length());

        if (emoticons != null) {
          for (IconDef def : emoticons.getIcons()) {
            for (String iconstr : def.text) {
              int index = text.indexOf(iconstr);
              if (index >= 0) {
                StyleRange iconRange = new StyleRange();
                iconRange.start = msgStart + index;
                iconRange.length = iconstr.length();
                Image image = def.getImage();
View Full Code Here

   
    TableWrapLayout formBodyLayout = new TableWrapLayout();
    formBodyLayout.leftMargin = 10;
    form.getBody().setLayout(formBodyLayout);
    form.getBody().setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));
    FormText text = tk.createFormText(form.getBody(),true);
//    text.setText(buf.toString(),true,true);
    text.setText(aboutText,true,true);
//    text.setImage("aboutImage",img);
//    text.setColor("header",tk.getColors().getColor(FormColors.TITLE));
//    text.setFont( "header",JFaceResources.getHeaderFont());
    TableWrapData tableWrapData = new TableWrapData(TableWrapData.FILL);
    text.setLayoutData(tableWrapData);
   
    text.addHyperlinkListener(new IHyperlinkListener(){
      public void linkEntered(HyperlinkEvent e) {
      }
      public void linkExited(HyperlinkEvent e) {
      }
      public void linkActivated(HyperlinkEvent e) {
View Full Code Here

                  public void widgetDisposed(DisposeEvent e) {
                    createImage.dispose();
                  }
                });
            FormText ft = new FormText(createDialogArea, SWT.NONE);
            ft
                .setText(
                    "<form><p><b>AppWrench 1.3</b></p><p>(c) Copyright <a>OnPositive Technologies, LLC. 2009-2010t</a>.  All rights reserved.</p><p></p></form>",
                    true, true);
            ft.addHyperlinkListener(new IHyperlinkListener() {

              public void linkExited(HyperlinkEvent e) {

              }

              public void linkEntered(HyperlinkEvent e) {
               
              }

              public void linkActivated(HyperlinkEvent e) {

                try {
                  PlatformUI
                      .getWorkbench()
                      .getBrowserSupport()
                      .getExternalBrowser()
                      .openURL(
                          new URL(
                              "http://onpositive.com"));
                } catch (PartInitException e1) {
                  Activator.log(e1);
                } catch (MalformedURLException e1) {
                  Activator.log(e1);
                }
              }

            });
            ft.setBackground(Display.getCurrent().getSystemColor(
                SWT.COLOR_WHITE));
            createDialogArea.setBackground(Display.getCurrent()
                .getSystemColor(SWT.COLOR_WHITE));
            return createDialogArea;
          }
View Full Code Here

    layout2.marginHeight = 0;
    createComposite.setLayout(layout2);
    Section desc = formToolkit.createSection(createComposite,
        Section.TITLE_BAR);
    desc.setText("Details");
    final FormText createFormText = formToolkit.createFormText(desc, false);
    createFormText
        .setText(
            "<form><p>Please select query\n\n\n<br/><br/> <br/></p></form>",
            true, false);
    desc.setClient(createFormText);
    desc.setLayoutData(GridDataFactory.fillDefaults().grab(true, false)
        .hint(-1, 200).create());
    Section stack = formToolkit.createSection(createComposite,
        Section.TITLE_BAR);
    stack.setText("Stack");
    stack.setLayoutData(GridDataFactory.fillDefaults().grab(true, true)
        .create());
    final TableViewer tableViewer = new TableViewer(stack);
    tableViewer.getTable().setLinesVisible(true);
    tableViewer.setContentProvider(new ArrayContentProvider());
    tv.addSelectionChangedListener(new ISelectionChangedListener() {

      public void selectionChanged(SelectionChangedEvent event) {
        IStructuredSelection sel = (IStructuredSelection) event
            .getSelection();
        if (sel.isEmpty()) {
          tableViewer.setInput(null);
        } else {
          RequestInfo info = (RequestInfo) sel.getFirstElement();
          tableViewer.setInput(info.getStackTrace());
          StringBuilder bld = new StringBuilder();
          bld.append("<form>");
          bld.append("<p>");
          bld.append("<b>Query:</b> " + info.getMessage());
          bld.append("<br/>");
          bld.append("<b>Count:</b> " + info.getCount());
          bld.append("<br/>");
          // bld.append("<b>Api time(ms):</b> "+info.getCost());

          // if (info instanceof PutRequestInfo){
          // PutRequestInfo pr=(PutRequestInfo) info;
          // if (pr.entityWritesBytes!=0){
          // bld.append("<br/>");
          // bld.append("<b>Entity writes:</b> "+pr.entityWrites);
          // bld.append(" <b>Entity writes bytes:</b> "+pr.entityWritesBytes);
          // bld.append("<br/>");
          // bld.append("<b>Index writes:</b> "+pr.indexWrites);
          // bld.append(" <b>Index writes bytes:</b> "+pr.indexWriteBytes);
          // bld.append("<br/>");
          // }
          // }
          // else if (info instanceof GetRequestInfo){
          // GetRequestInfo r=(GetRequestInfo) info;
          // bld.append("<br/>");
          // bld.append("<b>Entity count:</b> "+r.entityCount);
          // bld.append("<br/><b>Result bytes:</b> "+r.resultBytes);
          // bld.append("<br/>");
          // }
          // bld.append("</p>");
          bld.append("</p></form>");
          createFormText.setText(bld.toString(), true, true);
          // createFormText.getParent().getParent().layout(true);
        }
      }
    });
    tableViewer.setLabelProvider(new LabelProvider() {
View Full Code Here

    layout2.marginHeight = 0;
    createComposite.setLayout(layout2);
    Section desc = formToolkit.createSection(createComposite,
        Section.TITLE_BAR);
    desc.setText("Details");
    final FormText createFormText = formToolkit.createFormText(desc, false);
    createFormText
        .setText(
            "<form><p>Please select query\n\n\n<br/><br/> <br/></p></form>",
            true, false);
    desc.setClient(createFormText);
    desc.setLayoutData(GridDataFactory.fillDefaults().grab(true, false)
        .hint(-1, 200).create());
    Section stack = formToolkit.createSection(createComposite,
        Section.TITLE_BAR);
    stack.setText("Stack");
    stack.setLayoutData(GridDataFactory.fillDefaults().grab(true, true)
        .create());
    final TableViewer tableViewer = new TableViewer(stack);
    tableViewer.getTable().setLinesVisible(true);
    tableViewer.setContentProvider(new ArrayContentProvider());
    tv.addSelectionChangedListener(new ISelectionChangedListener() {

      public void selectionChanged(SelectionChangedEvent event) {
        IStructuredSelection sel = (IStructuredSelection) event
            .getSelection();
        if (sel.isEmpty()) {
          tableViewer.setInput(null);
        } else {
          RequestInfo info = (RequestInfo) sel.getFirstElement();
          tableViewer.setInput(info.getStackTrace());
          StringBuilder bld = new StringBuilder();
          bld.append("<form>");
          bld.append("<p>");
          bld.append("<b>Query:</b> " + info.getMessage());
          bld.append("<br/>");
          bld.append("<b>Count:</b> " + info.getCount());
          bld.append("<br/>");
          bld.append("<b>Api time(ms):</b> " + info.getCost());

          if (info instanceof PutRequestInfo) {
            PutRequestInfo pr = (PutRequestInfo) info;
            if (pr.entityWritesBytes != 0) {
              bld.append("<br/>");
              bld.append("<b>Entity writes:</b> "
                  + pr.entityWrites);
              bld.append(" <b>Entity writes bytes:</b> "
                  + pr.entityWritesBytes);
              bld.append("<br/>");
              bld
                  .append("<b>Index writes:</b> "
                      + pr.indexWrites);
              bld.append(" <b>Index writes bytes:</b> "
                  + pr.indexWriteBytes);
              bld.append("<br/>");
            }
          } else if (info instanceof GetRequestInfo) {
            GetRequestInfo r = (GetRequestInfo) info;
            bld.append("<br/>");
            bld.append("<b>Entity count:</b> " + r.entityCount);
            bld
                .append("<br/><b>Result bytes:</b> "
                    + r.resultBytes);
            bld.append("<br/>");
          }
          bld.append("</p>");
          bld.append("</form>");
          createFormText.setText(bld.toString(), true, true);
          // createFormText.getParent().getParent().layout(true);
        }
      }
    });
    tableViewer.setLabelProvider(new LabelProvider() {
View Full Code Here

TOP

Related Classes of org.eclipse.ui.forms.widgets.FormText

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.