Example usage for com.google.gwt.safehtml.shared SafeHtmlBuilder toSafeHtml

List of usage examples for com.google.gwt.safehtml.shared SafeHtmlBuilder toSafeHtml

Introduction

In this page you can find the example usage for com.google.gwt.safehtml.shared SafeHtmlBuilder toSafeHtml.

Prototype

public SafeHtml toSafeHtml() 

Source Link

Document

Returns the safe HTML accumulated in the builder as a SafeHtml .

Usage

From source file:org.eclipse.che.ide.ext.debugger.client.debug.DebuggerViewImpl.java

License:Open Source License

@Inject
protected DebuggerViewImpl(PartStackUIResources partStackUIResources, DebuggerResources resources,
        DebuggerLocalizationConstant locale, Resources coreRes,
        VariableTreeNodeRenderer.Resources rendererResources, DtoFactory dtoFactory,
        DebuggerViewImplUiBinder uiBinder) {
    super(partStackUIResources);

    this.locale = locale;
    this.res = resources;
    this.coreRes = coreRes;
    this.dtoFactory = dtoFactory;

    setContentWidget(uiBinder.createAndBindUi(this));

    TableElement breakPointsElement = Elements.createTableElement();
    breakPointsElement.setAttribute("style", "width: 100%");
    SimpleList.ListEventDelegate<Breakpoint> breakpointListEventDelegate = new SimpleList.ListEventDelegate<Breakpoint>() {
        public void onListItemClicked(Element itemElement, Breakpoint itemData) {
            breakpoints.getSelectionModel().setSelectedItem(itemData);
        }//from   www.j  a  v a 2 s . co m

        public void onListItemDoubleClicked(Element listItemBase, Breakpoint itemData) {
            // TODO: implement 'go to breakpoint source' feature
        }
    };

    SimpleList.ListItemRenderer<Breakpoint> breakpointListItemRenderer = new SimpleList.ListItemRenderer<Breakpoint>() {
        @Override
        public void render(Element itemElement, Breakpoint itemData) {
            TableCellElement label = Elements.createTDElement();

            SafeHtmlBuilder sb = new SafeHtmlBuilder();
            // Add icon
            sb.appendHtmlConstant("<table><tr><td>");
            SVGResource icon = res.breakpoint();
            if (icon != null) {
                sb.appendHtmlConstant("<img src=\"" + icon.getSafeUri().asString() + "\">");
            }
            sb.appendHtmlConstant("</td>");

            // Add title
            sb.appendHtmlConstant("<td>");

            String path = itemData.getPath();
            sb.appendEscaped(path.substring(path.lastIndexOf("/") + 1) + " - [line: "
                    + String.valueOf(itemData.getLineNumber() + 1) + "]");
            sb.appendHtmlConstant("</td></tr></table>");

            label.setInnerHTML(sb.toSafeHtml().asString());

            itemElement.appendChild(label);
        }

        @Override
        public Element createElement() {
            return Elements.createTRElement();
        }
    };

    breakpoints = SimpleList.create((SimpleList.View) breakPointsElement, coreRes.defaultSimpleListCss(),
            breakpointListItemRenderer, breakpointListEventDelegate);
    this.breakpointsPanel.add(breakpoints);
    this.variables = Tree.create(rendererResources, new VariableNodeDataAdapter(),
            new VariableTreeNodeRenderer(rendererResources));
    this.variables.setTreeEventHandler(new Tree.Listener<DebuggerVariable>() {
        @Override
        public void onNodeAction(@NotNull TreeNodeElement<DebuggerVariable> node) {
        }

        @Override
        public void onNodeClosed(@NotNull TreeNodeElement<DebuggerVariable> node) {
            selectedVariable = null;
        }

        @Override
        public void onNodeContextMenu(int mouseX, int mouseY, @NotNull TreeNodeElement<DebuggerVariable> node) {
        }

        @Override
        public void onNodeDragStart(@NotNull TreeNodeElement<DebuggerVariable> node,
                @NotNull MouseEvent event) {
        }

        @Override
        public void onNodeDragDrop(@NotNull TreeNodeElement<DebuggerVariable> node, @NotNull MouseEvent event) {
        }

        @Override
        public void onNodeExpanded(@NotNull final TreeNodeElement<DebuggerVariable> node) {
            selectedVariable = node;
            delegate.onSelectedVariableElement(selectedVariable.getData());
            delegate.onExpandVariablesTree();
        }

        @Override
        public void onNodeSelected(@NotNull TreeNodeElement<DebuggerVariable> node,
                @NotNull SignalEvent event) {
            selectedVariable = node;
            delegate.onSelectedVariableElement(selectedVariable.getData());
        }

        @Override
        public void onRootContextMenu(int mouseX, int mouseY) {
        }

        @Override
        public void onRootDragDrop(@NotNull MouseEvent event) {
        }

        @Override
        public void onKeyboard(@NotNull KeyboardEvent event) {
        }
    });

    this.variablesPanel.add(variables);
    minimizeButton.ensureDebugId("debugger-minimizeBut");
}

From source file:org.eclipse.che.ide.ext.git.client.branch.BranchViewImpl.java

License:Open Source License

/** Create presenter. */
@Inject/*  w w  w.  j a  v  a 2s  .  co m*/
protected BranchViewImpl(GitResources resources, GitLocalizationConstant locale,
        org.eclipse.che.ide.Resources coreRes, DialogFactory dialogFactory) {
    this.res = resources;
    this.locale = locale;
    this.dialogFactory = dialogFactory;
    this.ensureDebugId("git-branches-window");

    Widget widget = ourUiBinder.createAndBindUi(this);

    this.setTitle(locale.branchTitle());
    this.setWidget(widget);

    TableElement breakPointsElement = Elements.createTableElement();
    breakPointsElement.setAttribute("style", "width: 100%");
    SimpleList.ListEventDelegate<Branch> listBranchesDelegate = new SimpleList.ListEventDelegate<Branch>() {
        public void onListItemClicked(Element itemElement, Branch itemData) {
            branches.getSelectionModel().setSelectedItem(itemData);
            delegate.onBranchSelected(itemData);
        }

        public void onListItemDoubleClicked(Element listItemBase, Branch itemData) {
        }
    };
    SimpleList.ListItemRenderer<Branch> listBranchesRenderer = new SimpleList.ListItemRenderer<Branch>() {
        @Override
        public void render(Element itemElement, Branch itemData) {
            TableCellElement label = Elements.createTDElement();

            SafeHtmlBuilder sb = new SafeHtmlBuilder();

            sb.appendHtmlConstant("<table><tr><td>");
            sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "git-branches-"
                    + itemData.getDisplayName() + "\">");
            sb.appendEscaped(itemData.getDisplayName());
            sb.appendHtmlConstant("</td>");

            if (itemData.isActive()) {
                SVGResource icon = res.currentBranch();
                sb.appendHtmlConstant("<td><img src=\"" + icon.getSafeUri().asString() + "\"></td>");
            }

            sb.appendHtmlConstant("</tr></table>");

            label.setInnerHTML(sb.toSafeHtml().asString());

            itemElement.appendChild(label);
        }

        @Override
        public Element createElement() {
            return Elements.createTRElement();
        }
    };
    branches = SimpleList.create((SimpleList.View) breakPointsElement, coreRes.defaultSimpleListCss(),
            listBranchesRenderer, listBranchesDelegate);
    this.branchesPanel.add(branches);

    createButtons();
}

From source file:org.eclipse.che.ide.ext.git.client.compare.branchList.BranchListViewImpl.java

License:Open Source License

@Inject
protected BranchListViewImpl(GitResources resources, GitLocalizationConstant locale,
        org.eclipse.che.ide.Resources coreRes) {
    this.res = resources;
    this.locale = locale;
    this.ensureDebugId("git-compare-branch-window");

    Widget widget = uiBinder.createAndBindUi(this);

    this.setTitle(locale.compareWithBranchTitle());
    this.setWidget(widget);

    TableElement tableElement = Elements.createTableElement();
    tableElement.setAttribute("style", "width: 100%");
    SimpleList.ListEventDelegate<Branch> listBranchesDelegate = new SimpleList.ListEventDelegate<Branch>() {
        public void onListItemClicked(Element itemElement, Branch itemData) {
            branches.getSelectionModel().setSelectedItem(itemData);
            delegate.onBranchSelected(itemData);
        }/*  ww w  .  j  av a 2 s . c o  m*/

        public void onListItemDoubleClicked(Element listItemBase, Branch itemData) {
            delegate.onCompareClicked();
        }
    };
    SimpleList.ListItemRenderer<Branch> listBranchesRenderer = new SimpleList.ListItemRenderer<Branch>() {
        @Override
        public void render(Element itemElement, Branch itemData) {
            TableCellElement label = Elements.createTDElement();

            SafeHtmlBuilder sb = new SafeHtmlBuilder();

            sb.appendHtmlConstant("<table><tr><td>");
            sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "git-compare-branch-"
                    + itemData.getDisplayName() + "\">");
            sb.appendEscaped(itemData.getDisplayName());
            sb.appendHtmlConstant("</td>");

            if (itemData.isActive()) {
                SVGResource icon = res.currentBranch();
                sb.appendHtmlConstant("<td><img src=\"" + icon.getSafeUri().asString() + "\"></td>");
            }

            sb.appendHtmlConstant("</tr></table>");

            label.setInnerHTML(sb.toSafeHtml().asString());

            itemElement.appendChild(label);
        }

        @Override
        public Element createElement() {
            return Elements.createTRElement();
        }
    };
    branches = SimpleList.create((SimpleList.View) tableElement, coreRes.defaultSimpleListCss(),
            listBranchesRenderer, listBranchesDelegate);
    this.branchesPanel.add(branches);

    createButtons();
}

From source file:org.eclipse.che.ide.ext.git.client.compare.changedList.ChangedListViewImpl.java

License:Open Source License

@Inject
protected ChangedListViewImpl(GitResources resources, GitLocalizationConstant locale,
        NodesResources nodesResources) {
    this.res = resources;
    this.locale = locale;
    this.nodesResources = nodesResources;

    DockLayoutPanel widget = uiBinder.createAndBindUi(this);

    this.setTitle(locale.changeListTitle());
    this.setWidget(widget);

    NodeStorage nodeStorage = new NodeStorage(new NodeUniqueKeyProvider() {
        @NotNull/* w  w  w .  java  2  s .  c o  m*/
        @Override
        public String getKey(@NotNull Node item) {
            if (item instanceof HasStorablePath) {
                return ((HasStorablePath) item).getStorablePath();
            } else {
                return String.valueOf(item.hashCode());
            }
        }
    });
    NodeLoader nodeLoader = new NodeLoader(Collections.<NodeInterceptor>emptySet());
    tree = new Tree(nodeStorage, nodeLoader);
    tree.getSelectionModel().setSelectionMode(SelectionModel.Mode.SINGLE);
    tree.getSelectionModel().addSelectionChangedHandler(new SelectionChangedEvent.SelectionChangedHandler() {
        @Override
        public void onSelectionChanged(SelectionChangedEvent event) {
            List<Node> selection = event.getSelection();
            if (!selection.isEmpty()) {
                delegate.onNodeSelected(event.getSelection().get(0));
            } else {
                delegate.onNodeNotSelected();
            }
        }
    });
    changedFilesPanel.add(tree);

    createButtons();

    SafeHtmlBuilder shb = new SafeHtmlBuilder();

    shb.appendHtmlConstant("<table height =\"20\">");
    shb.appendHtmlConstant("<tr height =\"3\"></tr><tr>");
    shb.appendHtmlConstant("<td width =\"20\" bgcolor =\"dodgerBlue\"></td>");
    shb.appendHtmlConstant("<td>modified</td>");
    shb.appendHtmlConstant("<td width =\"20\" bgcolor =\"red\"></td>");
    shb.appendHtmlConstant("<td>deleted</td>");
    shb.appendHtmlConstant("<td width =\"20\" bgcolor =\"green\"></td>");
    shb.appendHtmlConstant("<td>added</td>");
    shb.appendHtmlConstant("<td width =\"20\" bgcolor =\"purple\"></td>");
    shb.appendHtmlConstant("<td>copied</td>");
    shb.appendHtmlConstant("</tr></table>");

    getFooter().add(new HTML(shb.toSafeHtml()));
}

From source file:org.eclipse.che.ide.ext.git.client.compare.changeslist.ChangesListViewImpl.java

License:Open Source License

@Inject
protected ChangesListViewImpl(GitLocalizationConstant locale) {
    this.locale = locale;
    this.setTitle(locale.changeListTitle());

    createButtons();//from  www .j  a v a  2s  .com

    SafeHtmlBuilder shb = new SafeHtmlBuilder();

    shb.appendHtmlConstant("<table height =\"20\">");
    shb.appendHtmlConstant("<tr height =\"3\"></tr><tr>");
    shb.appendHtmlConstant("<td width =\"20\" bgcolor =\"dodgerBlue\"></td>");
    shb.appendHtmlConstant("<td>modified</td>");
    shb.appendHtmlConstant("<td width =\"20\" bgcolor =\"red\"></td>");
    shb.appendHtmlConstant("<td>deleted</td>");
    shb.appendHtmlConstant("<td width =\"20\" bgcolor =\"green\"></td>");
    shb.appendHtmlConstant("<td>added</td>");
    shb.appendHtmlConstant("<td width =\"20\" bgcolor =\"purple\"></td>");
    shb.appendHtmlConstant("<td>copied</td>");
    shb.appendHtmlConstant("</tr></table>");

    getFooter().add(new HTML(shb.toSafeHtml()));
}

From source file:org.eclipse.che.ide.ext.java.jdi.client.debug.DebuggerViewImpl.java

License:Open Source License

@Inject
protected DebuggerViewImpl(PartStackUIResources partStackUIResources, JavaRuntimeResources resources,
        JavaRuntimeLocalizationConstant locale, Resources coreRes,
        VariableTreeNodeRenderer.Resources rendererResources, DtoFactory dtoFactory,
        DebuggerViewImplUiBinder uiBinder) {
    super(partStackUIResources);

    this.locale = locale;
    this.res = resources;
    this.coreRes = coreRes;
    this.dtoFactory = dtoFactory;

    setContentWidget(uiBinder.createAndBindUi(this));

    TableElement breakPointsElement = Elements.createTableElement();
    breakPointsElement.setAttribute("style", "width: 100%");
    SimpleList.ListEventDelegate<Breakpoint> breakpointListEventDelegate = new SimpleList.ListEventDelegate<Breakpoint>() {
        public void onListItemClicked(Element itemElement, Breakpoint itemData) {
            breakpoints.getSelectionModel().setSelectedItem(itemData);
        }/*  w ww .  ja v a 2  s  .  c o m*/

        public void onListItemDoubleClicked(Element listItemBase, Breakpoint itemData) {
            // TODO: implement 'go to breakpoint source' feature
        }
    };

    SimpleList.ListItemRenderer<Breakpoint> breakpointListItemRenderer = new SimpleList.ListItemRenderer<Breakpoint>() {
        @Override
        public void render(Element itemElement, Breakpoint itemData) {
            TableCellElement label = Elements.createTDElement();

            SafeHtmlBuilder sb = new SafeHtmlBuilder();
            // Add icon
            sb.appendHtmlConstant("<table><tr><td>");
            SVGResource icon = res.breakpoint();
            if (icon != null) {
                sb.appendHtmlConstant("<img src=\"" + icon.getSafeUri().asString() + "\">");
            }
            sb.appendHtmlConstant("</td>");

            // Add title
            sb.appendHtmlConstant("<td>");
            sb.appendEscaped(
                    itemData.getPath() + " - [line: " + String.valueOf(itemData.getLineNumber() + 1) + "]");
            sb.appendHtmlConstant("</td></tr></table>");

            label.setInnerHTML(sb.toSafeHtml().asString());

            itemElement.appendChild(label);
        }

        @Override
        public Element createElement() {
            return Elements.createTRElement();
        }
    };

    breakpoints = SimpleList.create((SimpleList.View) breakPointsElement, coreRes.defaultSimpleListCss(),
            breakpointListItemRenderer, breakpointListEventDelegate);
    this.breakpointsPanel.add(breakpoints);
    this.variables = Tree.create(rendererResources, new VariableNodeDataAdapter(),
            new VariableTreeNodeRenderer(rendererResources));
    this.variables.setTreeEventHandler(new Tree.Listener<DebuggerVariable>() {
        @Override
        public void onNodeAction(@NotNull TreeNodeElement<DebuggerVariable> node) {
        }

        @Override
        public void onNodeClosed(@NotNull TreeNodeElement<DebuggerVariable> node) {
            selectedVariable = null;
        }

        @Override
        public void onNodeContextMenu(int mouseX, int mouseY, @NotNull TreeNodeElement<DebuggerVariable> node) {
        }

        @Override
        public void onNodeDragStart(@NotNull TreeNodeElement<DebuggerVariable> node,
                @NotNull MouseEvent event) {
        }

        @Override
        public void onNodeDragDrop(@NotNull TreeNodeElement<DebuggerVariable> node, @NotNull MouseEvent event) {
        }

        @Override
        public void onNodeExpanded(@NotNull final TreeNodeElement<DebuggerVariable> node) {
            selectedVariable = node;
            delegate.onSelectedVariableElement(selectedVariable.getData());
            delegate.onExpandVariablesTree();
        }

        @Override
        public void onNodeSelected(@NotNull TreeNodeElement<DebuggerVariable> node,
                @NotNull SignalEvent event) {
            selectedVariable = node;
            delegate.onSelectedVariableElement(selectedVariable.getData());
        }

        @Override
        public void onRootContextMenu(int mouseX, int mouseY) {
        }

        @Override
        public void onRootDragDrop(@NotNull MouseEvent event) {
        }

        @Override
        public void onKeyboard(@NotNull KeyboardEvent event) {
        }
    });

    this.variablesPanel.add(variables);
    minimizeButton.ensureDebugId("debugger-minimizeBut");
}

From source file:org.eclipse.che.ide.processes.runtime.CellTableRuntimeInfoWidgetFactory.java

License:Open Source License

private Widget createCellTable(ListDataProvider<RuntimeInfo> dataProvider) {
    CellTable<RuntimeInfo> table = new CellTable<>(100, resources);
    table.ensureDebugId("runtimeInfoCellTable");

    TextColumn<RuntimeInfo> referenceColumn = new TextColumn<RuntimeInfo>() {
        @Override/*from   w ww .  ja  va 2 s  .co m*/
        public String getValue(RuntimeInfo record) {
            return valueOrDefault(record.getReference());
        }

        @Override
        public void render(Context context, RuntimeInfo object, SafeHtmlBuilder sb) {
            sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "runtime-info-reference-"
                    + context.getIndex() + "\">");
            super.render(context, object, sb);
        }
    };

    TextColumn<RuntimeInfo> portColumn = new TextColumn<RuntimeInfo>() {
        @Override
        public String getValue(RuntimeInfo record) {
            return valueOrDefault(record.getPort());
        }

        @Override
        public void render(Context context, RuntimeInfo object, SafeHtmlBuilder sb) {
            sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "runtime-info-port-"
                    + context.getIndex() + "\">");
            super.render(context, object, sb);
        }
    };

    TextColumn<RuntimeInfo> protocolColumn = new TextColumn<RuntimeInfo>() {
        @Override
        public String getValue(RuntimeInfo record) {
            return valueOrDefault(record.getProtocol());
        }

        @Override
        public void render(Context context, RuntimeInfo object, SafeHtmlBuilder sb) {
            sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "runtime-info-protocol-"
                    + context.getIndex() + "\">");
            super.render(context, object, sb);
        }
    };

    Column<RuntimeInfo, SafeHtml> urlColumn = new Column<RuntimeInfo, SafeHtml>(
            new AbstractCell<SafeHtml>("click", "keydown") {

                @Override
                public void render(Context context, SafeHtml value, SafeHtmlBuilder sb) {
                    sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "runtime-info-url-"
                            + context.getIndex() + "\">");

                    if (value != null) {
                        sb.append(value);
                    }
                }

                @Override
                protected void onEnterKeyDown(Context context, Element parent, SafeHtml value,
                        NativeEvent event, ValueUpdater<SafeHtml> valueUpdater) {
                    if (valueUpdater != null) {
                        valueUpdater.update(value);
                    }
                }

                @Override
                public void onBrowserEvent(Context context, Element parent, SafeHtml value, NativeEvent event,
                        ValueUpdater<SafeHtml> valueUpdater) {
                    super.onBrowserEvent(context, parent, value, event, valueUpdater);
                    if ("click".equals(event.getType())) {
                        onEnterKeyDown(context, parent, value, event, valueUpdater);
                    }
                }
            }) {
        @Override
        public SafeHtml getValue(RuntimeInfo record) {
            String value = valueOrDefault(record.getUrl());

            SafeHtmlBuilder sb = new SafeHtmlBuilder();
            sb.appendHtmlConstant("<a target=\"_blank\" href=\"" + value + "\">");
            sb.appendEscaped(value);
            sb.appendHtmlConstant("</a>");
            return sb.toSafeHtml();
        }
    };

    table.addColumn(referenceColumn, locale.cellTableReferenceColumn());
    table.addColumn(portColumn, locale.cellTablePortColumn());
    table.addColumn(protocolColumn, locale.cellTableProtocolColumn());
    table.addColumn(urlColumn, locale.cellTableUrlColumn());

    table.setColumnWidth(referenceColumn, 15., Unit.PCT);
    table.setColumnWidth(portColumn, 7., Unit.PCT);
    table.setColumnWidth(protocolColumn, 7., Unit.PCT);
    table.setColumnWidth(urlColumn, 71., Unit.PCT);

    dataProvider.addDataDisplay(table);

    return table;
}

From source file:org.eclipse.che.plugin.debugger.ide.debug.BreakpointItemRender.java

License:Open Source License

@Override
public void render(Element itemElement, Breakpoint itemData) {
    TableCellElement label = Elements.createTDElement();

    SafeHtmlBuilder sb = new SafeHtmlBuilder();
    // Add icon/* w w  w .j  a va  2  s  .  com*/
    sb.appendHtmlConstant("<table><tr><td>");
    SVGResource icon = debuggerResources.breakpoint();
    if (icon != null) {
        sb.appendHtmlConstant("<img src=\"" + icon.getSafeUri().asString() + "\">");
    }
    sb.appendHtmlConstant("</td>");

    // Add title
    sb.appendHtmlConstant("<td>");

    String path = itemData.getLocation().getTarget();
    sb.appendEscaped(path.substring(path.lastIndexOf("/") + 1) + ":"
            + String.valueOf(itemData.getLocation().getLineNumber()));
    sb.appendHtmlConstant("</td></tr></table>");

    label.setInnerHTML(sb.toSafeHtml().asString());

    itemElement.appendChild(label);
}

From source file:org.eclipse.che.plugin.debugger.ide.debug.DebuggerViewImpl.java

License:Open Source License

@Inject
protected DebuggerViewImpl(PartStackUIResources partStackUIResources, DebuggerResources resources,
        DebuggerLocalizationConstant locale, Resources coreRes,
        VariableTreeNodeRenderer.Resources rendererResources, DebuggerViewImplUiBinder uiBinder) {
    super(partStackUIResources);

    this.locale = locale;
    this.res = resources;
    this.coreRes = coreRes;

    setContentWidget(uiBinder.createAndBindUi(this));

    TableElement breakPointsElement = Elements.createTableElement();
    breakPointsElement.setAttribute("style", "width: 100%");
    SimpleList.ListEventDelegate<Breakpoint> breakpointListEventDelegate = new SimpleList.ListEventDelegate<Breakpoint>() {
        public void onListItemClicked(Element itemElement, Breakpoint itemData) {
            breakpoints.getSelectionModel().setSelectedItem(itemData);
        }/* w  w  w. ja va  2 s  . com*/

        public void onListItemDoubleClicked(Element listItemBase, Breakpoint itemData) {
            // TODO: implement 'go to breakpoint source' feature
        }
    };

    SimpleList.ListItemRenderer<Breakpoint> breakpointListItemRenderer = new SimpleList.ListItemRenderer<Breakpoint>() {
        @Override
        public void render(Element itemElement, Breakpoint itemData) {
            TableCellElement label = Elements.createTDElement();

            SafeHtmlBuilder sb = new SafeHtmlBuilder();
            // Add icon
            sb.appendHtmlConstant("<table><tr><td>");
            SVGResource icon = res.breakpoint();
            if (icon != null) {
                sb.appendHtmlConstant("<img src=\"" + icon.getSafeUri().asString() + "\">");
            }
            sb.appendHtmlConstant("</td>");

            // Add title
            sb.appendHtmlConstant("<td>");

            String path = itemData.getPath();
            sb.appendEscaped(path.substring(path.lastIndexOf("/") + 1) + " - [line: "
                    + String.valueOf(itemData.getLineNumber() + 1) + "]");
            sb.appendHtmlConstant("</td></tr></table>");

            label.setInnerHTML(sb.toSafeHtml().asString());

            itemElement.appendChild(label);
        }

        @Override
        public Element createElement() {
            return Elements.createTRElement();
        }
    };

    breakpoints = SimpleList.create((SimpleList.View) breakPointsElement, coreRes.defaultSimpleListCss(),
            breakpointListItemRenderer, breakpointListEventDelegate);
    this.breakpointsPanel.add(breakpoints);
    this.variables = Tree.create(rendererResources, new VariableNodeDataAdapter(),
            new VariableTreeNodeRenderer(rendererResources));
    this.variables.setTreeEventHandler(new Tree.Listener<MutableVariable>() {
        @Override
        public void onNodeAction(@NotNull TreeNodeElement<MutableVariable> node) {
        }

        @Override
        public void onNodeClosed(@NotNull TreeNodeElement<MutableVariable> node) {
            selectedVariable = null;
        }

        @Override
        public void onNodeContextMenu(int mouseX, int mouseY, @NotNull TreeNodeElement<MutableVariable> node) {
        }

        @Override
        public void onNodeDragStart(@NotNull TreeNodeElement<MutableVariable> node, @NotNull MouseEvent event) {
        }

        @Override
        public void onNodeDragDrop(@NotNull TreeNodeElement<MutableVariable> node, @NotNull MouseEvent event) {
        }

        @Override
        public void onNodeExpanded(@NotNull final TreeNodeElement<MutableVariable> node) {
            selectedVariable = node;
            delegate.onSelectedVariableElement(selectedVariable.getData());
            delegate.onExpandVariablesTree();
        }

        @Override
        public void onNodeSelected(@NotNull TreeNodeElement<MutableVariable> node, @NotNull SignalEvent event) {
            selectedVariable = node;
            delegate.onSelectedVariableElement(selectedVariable.getData());
        }

        @Override
        public void onRootContextMenu(int mouseX, int mouseY) {
        }

        @Override
        public void onRootDragDrop(@NotNull MouseEvent event) {
        }

        @Override
        public void onKeyboard(@NotNull KeyboardEvent event) {
        }
    });

    this.variablesPanel.add(variables);
    minimizeButton.ensureDebugId("debugger-minimizeBut");
}

From source file:org.eclipse.che.plugin.debugger.ide.debug.FrameItemRender.java

License:Open Source License

@Override
public void render(Element itemElement, StackFrameDump itemData) {
    TableCellElement label = Elements.createTDElement();

    SafeHtmlBuilder sb = new SafeHtmlBuilder();
    sb.appendEscaped(itemData.getLocation().getMethod().getName());
    sb.appendEscaped("(");

    List<? extends Variable> arguments = itemData.getLocation().getMethod().getArguments();
    for (int i = 0; i < arguments.size(); i++) {
        String type = arguments.get(i).getType();
        sb.appendEscaped(type.substring(type.lastIndexOf(".") + 1));

        if (i != arguments.size() - 1) {
            sb.appendEscaped(", ");
        }/* w ww.j  a  v a  2  s .  c om*/
    }

    sb.appendEscaped("):");
    sb.append(itemData.getLocation().getLineNumber());
    sb.appendEscaped(", ");

    Path path = Path.valueOf(itemData.getLocation().getTarget());

    String className;
    if (path.isAbsolute()) {
        className = path.removeFileExtension().lastSegment();
    } else {
        className = path.lastSegment();
    }

    sb.appendEscaped(className);

    label.setInnerHTML(sb.toSafeHtml().asString());
    itemElement.appendChild(label);
}