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();
}
}
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;
}
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;
}
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_;
}
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());
}
}
Aggregations