Search in sources :

Example 1 with FindResult

use of org.rstudio.studio.client.workbench.views.output.find.model.FindResult in project rstudio by rstudio.

the class FindOutputPane method createMainWidget.

@Override
protected Widget createMainWidget() {
    context_ = new FindResultContext();
    FindOutputResources resources = GWT.create(FindOutputResources.class);
    resources.styles().ensureInjected();
    table_ = new FastSelectTable<FindResult, CodeNavigationTarget, Object>(new FindOutputCodec(resources), resources.styles().selectedRow(), true, false);
    FontSizer.applyNormalFontSize(table_);
    table_.addStyleName(resources.styles().findOutput());
    table_.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            if (event.getNativeButton() != NativeEvent.BUTTON_LEFT)
                return;
            if (dblClick_.checkForDoubleClick(event.getNativeEvent()))
                fireSelectionCommitted();
        }

        private final DoubleClickState dblClick_ = new DoubleClickState();
    });
    table_.addKeyDownHandler(new KeyDownHandler() {

        @Override
        public void onKeyDown(KeyDownEvent event) {
            if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER)
                fireSelectionCommitted();
            event.stopPropagation();
            event.preventDefault();
        }
    });
    container_ = new SimplePanel();
    container_.setSize("100%", "100%");
    statusPanel_ = new StatusPanel();
    statusPanel_.setSize("100%", "100%");
    scrollPanel_ = new ScrollPanel(table_);
    scrollPanel_.setSize("100%", "100%");
    container_.setWidget(scrollPanel_);
    return container_;
}
Also used : CodeNavigationTarget(org.rstudio.core.client.CodeNavigationTarget) SimplePanel(com.google.gwt.user.client.ui.SimplePanel) ScrollPanel(com.google.gwt.user.client.ui.ScrollPanel) FindResult(org.rstudio.studio.client.workbench.views.output.find.model.FindResult)

Example 2 with FindResult

use of org.rstudio.studio.client.workbench.views.output.find.model.FindResult in project rstudio by rstudio.

the class FindResultContext method addMatches.

public void addMatches(Iterable<FindResult> findResults) {
    int origMaxLineWidth = maxLineWidth_;
    for (FindResult fr : findResults) {
        File file = getFile(fr.getFile());
        file.addMatch(fr.getLine(), 0, fr.getLineValue());
        int index = data_.getList().indexOf(file);
        if (// not that we are expecting otherwise...
        index >= 0)
            data_.getList().set(index, file);
    }
    if (maxLineWidth_ != origMaxLineWidth) {
        for (File aFile : data_.getList()) aFile.refresh();
    }
}
Also used : FindResult(org.rstudio.studio.client.workbench.views.output.find.model.FindResult)

Aggregations

FindResult (org.rstudio.studio.client.workbench.views.output.find.model.FindResult)2 ScrollPanel (com.google.gwt.user.client.ui.ScrollPanel)1 SimplePanel (com.google.gwt.user.client.ui.SimplePanel)1 CodeNavigationTarget (org.rstudio.core.client.CodeNavigationTarget)1