public boolean openFile(FileSystemItem file, boolean canUseDefault) { FileType fileType = getTypeForFile(file, canUseDefault); if (fileType != null) { fileType.openFile(file, eventBus_); return true; } else { return false; } }
public void editFile(FileSystemItem file, FilePosition position) { if (satellite_.isCurrentWindowSatellite()) { satellite_.focusMainWindow(); callSatelliteEditFile(file.cast(), position.cast()); } else { FileType fileType = getTypeForFile(file); if (!(fileType instanceof TextFileType)) fileType = TEXT; if (fileType != null) fileType.openFile(file, position, eventBus_); } }
public void editFile(FileSystemItem file, FilePosition position, boolean highlightLine) { // edit the file in the main window unless this is a source satellite // (in which case we want to edit it locally) if (satellite_.isCurrentWindowSatellite() && !satellite_.getSatelliteName().startsWith(SourceSatellite.NAME_PREFIX)) { satellite_.focusMainWindow(); callSatelliteEditFile(file.cast(), position.cast(), highlightLine); } else { FileType fileType = getTypeForFile(file); if (fileType != null && !(fileType instanceof TextFileType)) fileType = TEXT; if (fileType != null) fileType.openFile( file, position, highlightLine ? NavigationMethods.HIGHLIGHT_LINE : NavigationMethods.DEFAULT, eventBus_); } }
public void openFile(final FileSystemItem file, final boolean canUseBrowser) { FileType fileType = getTypeForFile(file); if (fileType != null) { fileType.openFile(file, eventBus_); } else { // build default command to use if we have an error or the // file is not a text file final Command defaultCommand = new Command() { @Override public void execute() { if (canUseBrowser) { if (session_.getSessionInfo().getAllowFileDownloads()) { BROWSER.openFile(file, eventBus_); } else { globalDisplay_.showErrorMessage( "File Download Error", "Unable to show file because file downloads are " + "restricted on this server.\n"); } } } }; // check with the server to see if this is likely to be a text file server_.isTextFile( file.getPath(), new ServerRequestCallback<Boolean>() { @Override public void onResponseReceived(Boolean isText) { if (isText) TEXT.openFile(file, eventBus_); else defaultCommand.execute(); } @Override public void onError(ServerError error) { defaultCommand.execute(); } }); } }