Search in sources :

Example 1 with FileSystemItem

use of org.rstudio.core.client.files.FileSystemItem in project rstudio by rstudio.

the class ChooseFolderDialog method onSelection.

@Override
public void onSelection(SelectionEvent<FileSystemItem> event) {
    super.onSelection(event);
    FileSystemItem item = event.getSelectedItem();
    if (item != null && item.isDirectory())
        browser_.setFilename(item.getName());
}
Also used : FileSystemItem(org.rstudio.core.client.files.FileSystemItem)

Example 2 with FileSystemItem

use of org.rstudio.core.client.files.FileSystemItem in project rstudio by rstudio.

the class ChooseFolderDialog2 method ls.

@Override
public FileSystemItem[] ls() {
    FileSystemItem[] items = super.ls();
    ArrayList<FileSystemItem> dirs = new ArrayList<FileSystemItem>();
    for (FileSystemItem item : items) if (item.isDirectory())
        dirs.add(item);
    return dirs.toArray(new FileSystemItem[0]);
}
Also used : FileSystemItem(org.rstudio.core.client.files.FileSystemItem) ArrayList(java.util.ArrayList)

Example 3 with FileSystemItem

use of org.rstudio.core.client.files.FileSystemItem in project rstudio by rstudio.

the class ChooseFolderDialog2 method onSelection.

@Override
public void onSelection(SelectionEvent<FileSystemItem> event) {
    super.onSelection(event);
    FileSystemItem item = event.getSelectedItem();
    if (item != null)
        browser_.setFilename(item.getPath());
    else
        browser_.setFilename("");
}
Also used : FileSystemItem(org.rstudio.core.client.files.FileSystemItem)

Example 4 with FileSystemItem

use of org.rstudio.core.client.files.FileSystemItem 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);
}
Also used : FileSystemItem(org.rstudio.core.client.files.FileSystemItem) ImageResource2x(org.rstudio.core.client.resources.ImageResource2x)

Example 5 with FileSystemItem

use of org.rstudio.core.client.files.FileSystemItem in project rstudio by rstudio.

the class DirectoryContentsWidget method selectBufferMatchImpl.

private boolean selectBufferMatchImpl(String buffer, StringTransformer transformer) {
    String string = transformer.transform(buffer);
    int i = 0;
    for (Map.Entry<String, FileSystemItem> entry : items_.entrySet()) {
        String fileName = transformer.transform(entry.getKey());
        if (fileName.startsWith(string)) {
            setSelectedRow(i);
            return true;
        }
        i++;
    }
    return false;
}
Also used : FileSystemItem(org.rstudio.core.client.files.FileSystemItem) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) Point(org.rstudio.core.client.Point)

Aggregations

FileSystemItem (org.rstudio.core.client.files.FileSystemItem)89 ServerError (org.rstudio.studio.client.server.ServerError)18 ProgressIndicator (org.rstudio.core.client.widget.ProgressIndicator)16 JsArrayString (com.google.gwt.core.client.JsArrayString)14 ScheduledCommand (com.google.gwt.core.client.Scheduler.ScheduledCommand)10 Handler (org.rstudio.core.client.command.Handler)10 Command (com.google.gwt.user.client.Command)9 ArrayList (java.util.ArrayList)7 AppCommand (org.rstudio.core.client.command.AppCommand)7 VoidServerRequestCallback (org.rstudio.studio.client.server.VoidServerRequestCallback)6 TextFileType (org.rstudio.studio.client.common.filetypes.TextFileType)5 JsArray (com.google.gwt.core.client.JsArray)4 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)4 JSONString (com.google.gwt.json.client.JSONString)4 FilePosition (org.rstudio.core.client.FilePosition)4 ServerRequestCallback (org.rstudio.studio.client.server.ServerRequestCallback)4 EditingTarget (org.rstudio.studio.client.workbench.views.source.editors.EditingTarget)4 CodeBrowserEditingTarget (org.rstudio.studio.client.workbench.views.source.editors.codebrowser.CodeBrowserEditingTarget)4 DataEditingTarget (org.rstudio.studio.client.workbench.views.source.editors.data.DataEditingTarget)4 TextEditingTarget (org.rstudio.studio.client.workbench.views.source.editors.text.TextEditingTarget)4