@Override public AbstractFile getParent() { return file.getParent(); }
protected List<AbstractFile> populateParentFolders(AbstractFile folder) { List<AbstractFile> parents = new LinkedList<AbstractFile>(); while ((folder = folder.getParent()) != null) parents.add(folder); return parents; } }
@Override protected boolean hasFolderChanged(AbstractFile folder) { // This job modifies the folder where the archive is return folder.equalsCanonical(destFile.getParent()); // Note: parent may be null }
@Override public AbstractFile getParent() { if(!getParentSet) { getParent = file.getParent(); // Create a CachedFile instance around the file if recursion is enabled if(recurseInstances && getParent!=null) getParent = new CachedFile(getParent, true); getParentSet = true; } return getParent; }
/** * Creates a new <code>TempOpenWithJob</code> that operates on a single file. * * @param progressDialog the ProgressDialog that monitors this job * @param mainFrame the MainFrame this job is attached to * @param fileToOpen the file to copy to a temporary location and execute * @param command the command used to execute the temporary file */ public TempOpenWithJob(ProgressDialog progressDialog, MainFrame mainFrame, AbstractFile fileToOpen, Command command) { this(progressDialog, mainFrame, new FileSet(fileToOpen.getParent(), fileToOpen), command); }
/** * Creates a new <code>TempExecJob</code> that operates on a single file. * * @param progressDialog the ProgressDialog that monitors this job * @param mainFrame the MainFrame this job is attached to * @param fileToExecute the file to copy to a temporary location and execute */ public TempExecJob(ProgressDialog progressDialog, MainFrame mainFrame, AbstractFile fileToExecute) { this(progressDialog, mainFrame, new FileSet(fileToExecute.getParent(), fileToExecute)); }
@Override protected boolean hasFolderChanged(AbstractFile folder) { // This job modifies the folder where the checksum file is return folder.equalsCanonical(checksumFile.getParent()); // Note: parent may be null }
/** * Checks if CRC file exists. * @param file firts part */ private void findCRCFile(AbstractFile file) { AbstractFile f = file.getParent(); if (f != null) { try { crcFile = f.getDirectChild(file.getNameWithoutExtension() + ".sfv"); } catch (IOException e) { LOGGER.debug("Caught exception", e); } } }
@Override public String apply(AbstractFile file) { AbstractFile parent = file.getParent(); if (parent != null) return extractNamePart(parent.getName()); return ""; }
/** * Updates <code>panel</code>'s location to its parent. * * @param panel in which to change the location. * @return <code>true</code> if <code>panel</code> has a parent, <code>false</code> otherwise. */ protected boolean goToParent(FolderPanel panel) { AbstractFile parent; if((parent = panel.getCurrentFolder().getParent()) != null) { panel.tryChangeCurrentFolder(parent, null, true); return true; } return false; }
public SelfUpdateJob(ProgressDialog progressDialog, MainFrame mainFrame, AbstractFile remoteJarFile) { this(progressDialog, mainFrame, new FileSet(remoteJarFile.getParent(), remoteJarFile), getDestJarFile()); }
/** * Creates a new <code>TempExecJob</code> that operates on a single file. * * @param progressDialog the ProgressDialog that monitors this job * @param mainFrame the MainFrame this job is attached to * @param fileToCopy the file to copy to a temporary location */ public TempCopyJob(ProgressDialog progressDialog, MainFrame mainFrame, AbstractFile fileToCopy) { super(progressDialog, mainFrame, new FileSet(fileToCopy.getParent(), fileToCopy), FileFactory.getTemporaryFolder(), getTemporaryFileName(fileToCopy), TransferMode.COPY, FileCollisionDialog.OVERWRITE_ACTION); }
/** * Returns the specified file's parent, or an empty string if it doesn't have one. * @param file file whose parent should be returned. * @return the specified file's parent, or an empty string if it doesn't have one. */ private String getParent(AbstractFile file) { AbstractFile parent; if((parent = file.getParent()) == null) return ""; return parent.getAbsolutePath(); }
private SelfUpdateJob(ProgressDialog progressDialog, MainFrame mainFrame, FileSet files, AbstractFile destJar, AbstractFile tempDestJar) { super(progressDialog, mainFrame, files, tempDestJar.getParent(), tempDestJar.getName(), TransferMode.DOWNLOAD, FileCollisionDialog.OVERWRITE_ACTION); this.destJar = destJar; this.tempDestJar = tempDestJar; this.classLoader = getClass().getClassLoader(); directoryOrClassFileFilter = new OrFileFilter( new AttributeFileFilter(FileAttribute.DIRECTORY), new ExtensionFilenameFilter(".class") ); }
private void addFileDetails(XAlignedComponentPanel panel, AbstractFile file, String nameLabel) { addFileDetailsRow(panel, nameLabel+":", new FileLabel(file, false), 0); AbstractFile parent = file.getParent(); addFileDetailsRow(panel, Translator.get("location")+":", new FileLabel((parent==null?file:parent), true), 0); addFileDetailsRow(panel, Translator.get("size")+":", new JLabel(SizeFormat.format(file.getSize(), SizeFormat.DIGITS_FULL| SizeFormat.UNIT_LONG| SizeFormat.INCLUDE_SPACE)), 0); addFileDetailsRow(panel, Translator.get("date")+":", new JLabel(CustomDateFormat.format(new Date(file.getDate()))), 0); addFileDetailsRow(panel, Translator.get("permissions")+":", new JLabel(file.getPermissionsString()), 10); }
/** * Enables or disables this action based on the currently active folder's * has a parent and current tab is not locked, this action will be enabled, * if not it will be disabled. */ @Override protected void toggleEnabledState() { setEnabled(!mainFrame.getActivePanel().getTabs().getCurrentTab().isLocked() && mainFrame.getActivePanel().getCurrentFolder().getParent()!=null); }
/** * Enables or disables this action based on the currently active folder's * has a parent and current tab is not locked, this action will be enabled, * if not it will be disabled. */ @Override protected void toggleEnabledState() { setEnabled(!mainFrame.getActivePanel().getTabs().getCurrentTab().isLocked() && mainFrame.getActivePanel().getCurrentFolder().getParent()!=null); }
/** * Enables or disables this action based on the currently active folder's * has a parent and selected tab in the other panel is not locked, * this action will be enabled, if not it will be disabled. */ @Override protected void toggleEnabledState() { setEnabled(!mainFrame.getInactivePanel().getTabs().getCurrentTab().isLocked() && mainFrame.getActivePanel().getCurrentFolder().getParent()!=null); }
public void handleOpenFile(ApplicationEvent event) { // Wait until the application has been launched. This step is required to properly handle the case where the // application is launched with a file to open, for instance when drag-n-dropping a file to the Dock icon // when muCommander is not started yet. In this case, this method is called while Launcher is still busy // launching the application (no mainframe exists yet). muCommander.waitUntilLaunched(); AbstractFile file = FileFactory.getFile(event.getFilename()); FolderPanel activePanel = WindowManager.getCurrentMainFrame().getActivePanel(); if(file.isBrowsable()) activePanel.tryChangeCurrentFolder(file); else activePanel.tryChangeCurrentFolder(file.getParent(), file, false); }
/** * Enables or disables this action based on the currently active folder's * has a parent and both tabs in the two panel are not locked, * this action will be enabled, if not it will be disabled. */ @Override protected void toggleEnabledState() { setEnabled(!mainFrame.getActivePanel().getTabs().getCurrentTab().isLocked() && !mainFrame.getInactivePanel().getTabs().getCurrentTab().isLocked() && mainFrame.getActivePanel().getCurrentFolder().getParent()!=null); }