use of org.rstudio.core.client.resources.ImageResource2x in project rstudio by rstudio.
the class DirectoryContentsWidget method setContents.
public void setContents(FileSystemItem[] contents, FileSystemItem parentDirectory) {
clearContents();
if (parentDirectory != null)
addItem(parentDirectory, "..", new ImageResource2x(FileIconResources.INSTANCE.iconUpFolder2x()));
for (FileSystemItem fsi : contents) addItem(fsi, null, null);
showProgress(false);
}
use of org.rstudio.core.client.resources.ImageResource2x in project rstudio by rstudio.
the class PathBreadcrumbWidget method maybeAddProjectIcon.
private void maybeAddProjectIcon() {
if (projectIconsAdded_)
return;
if (pSession_ == null || pSession_.get() == null)
return;
final FileSystemItem projDir = pSession_.get().getSessionInfo().getActiveProjectDir();
if (projDir != null) {
Image projIcon = new Image(new ImageResource2x(RES.projectImage2x()));
projIcon.addStyleName(ThemeResources.INSTANCE.themeStyles().handCursor());
projIcon.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
SelectionCommitEvent.fire(PathBreadcrumbWidget.this, projDir);
}
});
projIcon.addStyleName(RES.styles().project());
projIcon.setTitle("Go to project directory");
eastFrame_.insert(projIcon, 0);
// TODO: infer from contents
double width = 42;
frame_.setWidgetSize(eastFrame_, width);
projectIconsAdded_ = true;
}
}
use of org.rstudio.core.client.resources.ImageResource2x in project rstudio by rstudio.
the class ShinyGadgetDialog method addCaptionWithCloseButton.
private void addCaptionWithCloseButton(String caption) {
final Image closeIcon = new Image(new ImageResource2x(ThemeResources.INSTANCE.closeDialog2x()));
Style closeIconStyle = closeIcon.getElement().getStyle();
closeIconStyle.setCursor(Style.Cursor.POINTER);
closeIconStyle.setMarginTop(2, Unit.PX);
FlexTable captionLayoutTable = new FlexTable();
captionLayoutTable.setWidth("100%");
captionLayoutTable.setText(0, 0, caption);
captionLayoutTable.setWidget(0, 1, closeIcon);
captionLayoutTable.getCellFormatter().setHorizontalAlignment(0, 1, HasHorizontalAlignment.HorizontalAlignmentConstant.endOf(Direction.LTR));
HTML captionWidget = (HTML) getCaption();
captionWidget.getElement().appendChild(captionLayoutTable.getElement());
captionWidget.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
EventTarget target = event.getNativeEvent().getEventTarget();
Element targetElement = (Element) target.cast();
if (targetElement == closeIcon.getElement()) {
closeIcon.fireEvent(event);
}
}
});
closeIcon.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
performClose();
}
});
}
use of org.rstudio.core.client.resources.ImageResource2x in project rstudio by rstudio.
the class TextEditingTargetWidget method setIsShinyFormat.
@Override
public void setIsShinyFormat(boolean showOutputOptions, boolean isPresentation, boolean isShinyPrerendered) {
setRmdFormatButtonVisible(false);
showRmdViewerMenuItems(!isPresentation, showOutputOptions, true, RmdOutput.TYPE_SHINY);
String docType = isPresentation ? "Presentation" : "Document";
knitCommandText_ = "Run " + docType;
knitDocumentButton_.setTitle("View the current " + docType.toLowerCase() + " with Shiny (" + DomUtils.htmlToText(commands_.knitDocument().getShortcutPrettyHtml()) + ")");
knitDocumentButton_.setText(knitCommandText_);
knitDocumentButton_.setLeftImage(new ImageResource2x(StandardIcons.INSTANCE.run2x()));
runDocumentMenuButton_.setVisible(isShinyPrerendered);
setKnitDocumentMenuVisible(isShinyPrerendered);
isShiny_ = true;
if (publishButton_ != null)
publishButton_.setIsStatic(false);
}
use of org.rstudio.core.client.resources.ImageResource2x in project rstudio by rstudio.
the class TextEditingTargetWidget method createCodeTransformMenuButton.
private Widget createCodeTransformMenuButton() {
if (codeTransform_ == null) {
ImageResource icon = new ImageResource2x(ThemeResources.INSTANCE.codeTransform2x());
ToolbarPopupMenu menu = new ToolbarPopupMenu();
menu.addItem(commands_.codeCompletion().createMenuItem(false));
menu.addSeparator();
menu.addItem(commands_.goToHelp().createMenuItem(false));
menu.addItem(commands_.goToFunctionDefinition().createMenuItem(false));
menu.addItem(commands_.findUsages().createMenuItem(false));
menu.addSeparator();
menu.addItem(commands_.extractFunction().createMenuItem(false));
menu.addItem(commands_.extractLocalVariable().createMenuItem(false));
menu.addItem(commands_.renameInScope().createMenuItem(false));
menu.addSeparator();
menu.addItem(commands_.reflowComment().createMenuItem(false));
menu.addItem(commands_.commentUncomment().createMenuItem(false));
menu.addItem(commands_.insertRoxygenSkeleton().createMenuItem(false));
menu.addSeparator();
menu.addItem(commands_.reindent().createMenuItem(false));
menu.addItem(commands_.reformatCode().createMenuItem(false));
menu.addSeparator();
menu.addItem(commands_.showDiagnosticsActiveDocument().createMenuItem(false));
menu.addItem(commands_.showDiagnosticsProject().createMenuItem(false));
menu.addSeparator();
menu.addItem(commands_.profileCode().createMenuItem(false));
codeTransform_ = new ToolbarButton("", icon, menu);
codeTransform_.setTitle("Code Tools");
}
return codeTransform_;
}
Aggregations