Search in sources :

Example 21 with ImageResource2x

use of org.rstudio.core.client.resources.ImageResource2x in project rstudio by rstudio.

the class BuildCommands method setBuildCommandState.

public static void setBuildCommandState(Commands commands, SessionInfo sessionInfo) {
    // remove devtools commands if it isn't installed
    if (!sessionInfo.isDevtoolsInstalled()) {
        commands.devtoolsLoadAll().remove();
    }
    // adapt or remove package commands if this isn't a package
    String type = sessionInfo.getBuildToolsType();
    if (!type.equals(SessionInfo.BUILD_TOOLS_PACKAGE)) {
        commands.devtoolsLoadAll().remove();
        commands.buildSourcePackage().remove();
        commands.buildBinaryPackage().remove();
        commands.roxygenizePackage().remove();
        commands.checkPackage().remove();
        commands.testPackage().remove();
        commands.buildAll().setImageResource(new ImageResource2x(BuildPaneResources.INSTANCE.iconBuild2x()));
        commands.buildAll().setMenuLabel("_Build All");
        commands.buildAll().setButtonLabel("Build All");
        commands.buildAll().setDesc("Build all");
    }
    // remove makefile commands if this isn't a makefile
    if (type.equals(SessionInfo.BUILD_TOOLS_CUSTOM) || type.equals(SessionInfo.BUILD_TOOLS_WEBSITE)) {
        commands.rebuildAll().remove();
    }
    if (type.equals(SessionInfo.BUILD_TOOLS_CUSTOM) || type.equals(SessionInfo.BUILD_TOOLS_PACKAGE)) {
        commands.cleanAll().remove();
    }
    // remove all other commands if there are no build tools
    if (type.equals(SessionInfo.BUILD_TOOLS_NONE)) {
        commands.buildAll().remove();
        commands.rebuildAll().remove();
        commands.cleanAll().remove();
        commands.stopBuild().remove();
        commands.activateBuild().remove();
        commands.layoutZoomBuild().remove();
    }
}
Also used : ImageResource2x(org.rstudio.core.client.resources.ImageResource2x)

Example 22 with ImageResource2x

use of org.rstudio.core.client.resources.ImageResource2x in project rstudio by rstudio.

the class BuildPane method createMainToolbar.

@Override
protected Toolbar createMainToolbar() {
    Toolbar toolbar = new Toolbar();
    SessionInfo sessionInfo = session_.getSessionInfo();
    String type = sessionInfo.getBuildToolsType();
    boolean pkg = type.equals(SessionInfo.BUILD_TOOLS_PACKAGE);
    boolean makefile = type.equals(SessionInfo.BUILD_TOOLS_MAKEFILE);
    boolean website = type.equals(SessionInfo.BUILD_TOOLS_WEBSITE);
    // always include build all
    ToolbarButton buildAllButton = commands_.buildAll().createToolbarButton();
    if (website) {
        if (sessionInfo.getBuildToolsBookdownWebsite()) {
            buildAllButton.setText("Build Book");
        } else {
            buildAllButton.setText("Build Website");
        }
    }
    toolbar.addLeftWidget(buildAllButton);
    // book build menu
    if (sessionInfo.getBuildToolsBookdownWebsite()) {
        BookdownBuildPopupMenu buildPopupMenu = new BookdownBuildPopupMenu();
        ToolbarButton buildMenuButton = new ToolbarButton(buildPopupMenu, true);
        toolbar.addLeftWidget(buildMenuButton);
    }
    toolbar.addLeftSeparator();
    // packages get check package
    if (pkg) {
        toolbar.addLeftWidget(commands_.checkPackage().createToolbarButton());
        toolbar.addLeftSeparator();
    }
    // create more menu
    if (makefile || website || pkg) {
        ToolbarPopupMenu moreMenu = new ToolbarPopupMenu();
        if (makefile || website) {
            if (makefile)
                moreMenu.addItem(commands_.rebuildAll().createMenuItem(false));
            moreMenu.addItem(commands_.cleanAll().createMenuItem(false));
            moreMenu.addSeparator();
        } else // packages get additional commands 
        if (pkg) {
            moreMenu.addItem(commands_.devtoolsLoadAll().createMenuItem(false));
            moreMenu.addItem(commands_.rebuildAll().createMenuItem(false));
            moreMenu.addSeparator();
            moreMenu.addItem(commands_.testPackage().createMenuItem(false));
            moreMenu.addSeparator();
            moreMenu.addItem(commands_.checkPackage().createMenuItem(false));
            moreMenu.addSeparator();
            moreMenu.addItem(commands_.buildSourcePackage().createMenuItem(false));
            moreMenu.addItem(commands_.buildBinaryPackage().createMenuItem(false));
            moreMenu.addSeparator();
            moreMenu.addItem(commands_.roxygenizePackage().createMenuItem(false));
            moreMenu.addSeparator();
        }
        moreMenu.addItem(commands_.buildToolsProjectSetup().createMenuItem(false));
        // add more menu
        ToolbarButton moreButton = new ToolbarButton("More", new ImageResource2x(StandardIcons.INSTANCE.more_actions2x()), moreMenu);
        toolbar.addLeftWidget(moreButton);
    }
    // connect compile panel
    compilePanel_.connectToolbar(toolbar);
    return toolbar;
}
Also used : ToolbarButton(org.rstudio.core.client.widget.ToolbarButton) ToolbarPopupMenu(org.rstudio.core.client.widget.ToolbarPopupMenu) SessionInfo(org.rstudio.studio.client.workbench.model.SessionInfo) ImageResource2x(org.rstudio.core.client.resources.ImageResource2x) JsArrayString(com.google.gwt.core.client.JsArrayString) Toolbar(org.rstudio.core.client.widget.Toolbar)

Example 23 with ImageResource2x

use of org.rstudio.core.client.resources.ImageResource2x in project rstudio by rstudio.

the class ClearAllDialog method createMainWidget.

@Override
protected Widget createMainWidget() {
    progress_ = addProgressIndicator();
    VerticalPanel panel = new VerticalPanel();
    HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
    // add image
    MessageDialogImages images = MessageDialogImages.INSTANCE;
    Image image = new Image(new ImageResource2x(images.dialog_warning2x()));
    horizontalPanel.add(image);
    // add message widget
    String objects;
    if (numObjects_ == 0)
        objects = "all objects";
    else if (numObjects_ == 1)
        objects = "1 object";
    else
        objects = numObjects_ + " objects";
    Label label = new MultiLineLabel("Are you sure you want to remove " + objects + " from the " + "environment? This operation cannot be undone.");
    label.setStylePrimaryName(ThemeResources.INSTANCE.themeStyles().dialogMessage());
    horizontalPanel.add(label);
    panel.add(horizontalPanel);
    // add include hidden option
    HorizontalPanel optionPanel = new HorizontalPanel();
    Style optionStyle = optionPanel.getElement().getStyle();
    optionStyle.setMarginLeft(image.getWidth(), Unit.PX);
    optionStyle.setMarginBottom(10, Unit.PX);
    chkIncludeHidden_ = new CheckBox("Include hidden objects");
    chkIncludeHidden_.setValue(prefs_.clearHidden().getValue());
    if (numObjects_ == 0) {
        chkIncludeHidden_.addValueChangeHandler(new ValueChangeHandler<Boolean>() {

            @Override
            public void onValueChange(ValueChangeEvent<Boolean> event) {
                prefs_.clearHidden().setGlobalValue(event.getValue());
                prefs_.writeUIPrefs();
            }
        });
        optionPanel.add(chkIncludeHidden_);
    }
    panel.add(optionPanel);
    return panel;
}
Also used : MessageDialogImages(org.rstudio.core.client.widget.images.MessageDialogImages) MultiLineLabel(org.rstudio.core.client.widget.MultiLineLabel) ImageResource2x(org.rstudio.core.client.resources.ImageResource2x) Style(com.google.gwt.dom.client.Style) MultiLineLabel(org.rstudio.core.client.widget.MultiLineLabel)

Example 24 with ImageResource2x

use of org.rstudio.core.client.resources.ImageResource2x in project rstudio by rstudio.

the class EnvironmentPane method createImportMenu.

private Widget createImportMenu() {
    ToolbarPopupMenu menu = new ToolbarPopupMenu();
    menu.setAutoOpen(true);
    menu.addItem(commands_.importDatasetFromFile().createMenuItem(false));
    menu.addItem(commands_.importDatasetFromURL().createMenuItem(false));
    menu.addItem(commands_.importDatasetFromCsvUsingBase().createMenuItem(false));
    menu.addItem(commands_.importDatasetFromCsvUsingReadr().createMenuItem(false));
    menu.addSeparator();
    menu.addItem(commands_.importDatasetFromXLS().createMenuItem(false));
    menu.addSeparator();
    menu.addItem(commands_.importDatasetFromSAV().createMenuItem(false));
    menu.addItem(commands_.importDatasetFromSAS().createMenuItem(false));
    menu.addItem(commands_.importDatasetFromStata().createMenuItem(false));
    menu.addSeparator();
    menu.addItem(commands_.importDatasetFromXML().createMenuItem(false));
    menu.addItem(commands_.importDatasetFromJSON().createMenuItem(false));
    menu.addSeparator();
    menu.addItem(commands_.importDatasetFromJDBC().createMenuItem(false));
    menu.addItem(commands_.importDatasetFromODBC().createMenuItem(false));
    menu.addSeparator();
    menu.addItem(commands_.importDatasetFromMongo().createMenuItem(false));
    dataImportButton_ = new ToolbarButton("Import Dataset", new ImageResource2x(StandardIcons.INSTANCE.import_dataset2x()), menu);
    return dataImportButton_;
}
Also used : ToolbarButton(org.rstudio.core.client.widget.ToolbarButton) ToolbarPopupMenu(org.rstudio.core.client.widget.ToolbarPopupMenu) ImageResource2x(org.rstudio.core.client.resources.ImageResource2x)

Example 25 with ImageResource2x

use of org.rstudio.core.client.resources.ImageResource2x in project rstudio by rstudio.

the class FileSystemItem method getIcon.

// RStudio-specific code should use FileTypeRegistry.getIconForFile() instead
public final ImageResource getIcon() {
    if (isDirectory()) {
        if (isPublicFolder())
            return new ImageResource2x(RES.iconPublicFolder2x());
        else
            return new ImageResource2x(RES.iconFolder2x());
    }
    Match m = EXT_PATTERN.match(getName(), 0);
    if (m == null)
        return new ImageResource2x(RES.iconText2x());
    String lowerExt = m.getValue().toLowerCase();
    if (lowerExt.equals(".csv")) {
        return new ImageResource2x(RES.iconCsv2x());
    } else if (lowerExt.equals(".pdf")) {
        return new ImageResource2x(RES.iconPdf2x());
    } else if (lowerExt.equals(".jpg") || lowerExt.equals(".jpeg") || lowerExt.equals(".gif") || lowerExt.equals(".bmp") || lowerExt.equals(".tiff") || lowerExt.equals(".tif") || lowerExt.equals(".png")) {
        return new ImageResource2x(RES.iconPng2x());
    } else {
        return new ImageResource2x(RES.iconText2x());
    }
}
Also used : ImageResource2x(org.rstudio.core.client.resources.ImageResource2x) Match(org.rstudio.core.client.regex.Match)

Aggregations

ImageResource2x (org.rstudio.core.client.resources.ImageResource2x)48 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)13 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)13 ToolbarButton (org.rstudio.core.client.widget.ToolbarButton)11 ToolbarPopupMenu (org.rstudio.core.client.widget.ToolbarPopupMenu)10 ImageResource (com.google.gwt.resources.client.ImageResource)9 Image (com.google.gwt.user.client.ui.Image)7 Toolbar (org.rstudio.core.client.widget.Toolbar)6 Style (com.google.gwt.dom.client.Style)4 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)4 JsArrayString (com.google.gwt.core.client.JsArrayString)3 Element (com.google.gwt.dom.client.Element)3 SafeHtmlBuilder (com.google.gwt.safehtml.shared.SafeHtmlBuilder)3 TextColumn (com.google.gwt.user.cellview.client.TextColumn)3 Event (com.google.gwt.user.client.Event)3 HTML (com.google.gwt.user.client.ui.HTML)3 Label (com.google.gwt.user.client.ui.Label)3 MessageDialogImages (org.rstudio.core.client.widget.images.MessageDialogImages)3 TableRowElement (com.google.gwt.dom.client.TableRowElement)2 Column (com.google.gwt.user.cellview.client.Column)2