protected void updateViewer() { if (viewer_ == null) return; Object[] d = dirs_.getSelectedValues(); Object[] f = files_.getSelectedValues(); /* * if((d!=null)&&(d.length>0)&&(d[0] instanceof URLAdapter)) { URLAdapter p=(URLAdapter)d[0]; * FuLog.debug("Name="+p.getName()); FuLog.debug("Path="+p.getPath()); FuLog.debug("Dir.="+p.isDirectory()); } * if((f!=null)&&(f.length>0)&&(f[0] instanceof URLAdapter)) { URLAdapter p=(URLAdapter)f[0]; * FuLog.debug("Name="+p.getName()); FuLog.debug("Path="+p.getPath()); FuLog.debug("Dir.="+p.isDirectory()); } */ /* * DefaultListModel lm=new DefaultListModel(); for(int i=0;i<d.length;i++) lm.addElement(d[i]); for(int i=0;i<f.length;i++) * lm.addElement(f[i]); viewer_.setModel(lm); */ viewer_.updateContent(d, f); }
protected void fireFileAction(String _action) { Object[] selected = files_.getSelectedValues(); if (selected == null) return; for (int i = 0; i < selected.length; i++) if (((VfsFile) selected[i]).canRead()) { String path = ((VfsFile) selected[i]).getAbsolutePath(); ActionEvent evt = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, _action + "(" + path + ")"); for (Enumeration e = listeners_.elements(); e.hasMoreElements();) ((ActionListener) e.nextElement()).actionPerformed(evt); } }
public void keyTyped(KeyEvent _evt) { Object source = _evt.getSource(); char c = Character.toUpperCase(_evt.getKeyChar()); if (c == KeyEvent.VK_ENTER) { if ((source == dirs_) && (dirs_.getSelectedValues().length == 1)) openDirectory(); else if ((source == files_) && (files_.getSelectedValues().length == 1)) openFile(); } else if (Character.isLetterOrDigit(c)) { if ((source == dirs_) || (source == files_)) { try { JList l = (JList) source; ListModel m = l.getModel(); int t = m.getSize(); for (int i = 0; i < t; i++) { VfsFile f = (VfsFile) m.getElementAt(i); String v = f.getViewName(); if ((v.length() > 0) && (Character.toUpperCase(v.charAt(0)) == c)) { l.setSelectedValue(f, true); break; } } } catch (Throwable th) { FuLog.error(th); } } } } }
protected void updateMenuFiles() { int l = files_.getSelectedValues().length; int s = listeners_.size(); BuActionEnabler.setEnabledForAction(pmFiles_, "OUVRIR_FICHIER", (l > 0) && (s > 0)); BuActionEnabler.setEnabledForAction(pmFiles_, "DETRUIRE_FICHIER", l >= 1); BuActionEnabler.setEnabledForAction(pmFiles_, "RENOMMER_FICHIER", l == 1); // VfsFile dir=getCurrentDirectory(); // miCvsAdd_.setEnabled // ((dir!=null)&&dir.createChild("CVS").exists()); pmFiles_.computeMnemonics(); }
public void deleteFiles() { VfsFile[] selected = new DtFilesSelection(files_.getSelectedValues()).getAllFiles(); VfsLib.getOperations().deleteFiles(selected); // refresh(); /* * BuDialogConfirmation d=new BuDialogConfirmation (null,null,"Voulez-vous vraiment dtruire\n"+ "le fichier * "+selected.getName()+" ?"); if(d.activate()==JOptionPane.OK_OPTION) { if(selected.delete()) refresh(); else { new * BuDialogError (null,null, "Le fichier "+selected.getName()+" n'a pas pu\n"+ "tre dtruit.") .activate(); } } */ }
protected void updateMenuDirs() { int l = dirs_.getSelectedValues().length; BuActionEnabler.setEnabledForAction(pmDirs_, "OUVRIR_REPERTOIRE", l == 1); BuActionEnabler.setEnabledForAction(pmDirs_, "DETRUIRE_REPERTOIRE", l == 1); BuActionEnabler.setEnabledForAction(pmDirs_, "RENOMMER_REPERTOIRE", l == 1); pmDirs_.computeMnemonics(); }
private void runFileCmd(String _cmd1) { String cmd = "cd " + getCurrentDirectory().getAbsolutePath() + " ; " + _cmd1; Object[] selected = files_.getSelectedValues(); if (selected == null) return; for (int i = 0; i < selected.length; i++) if (((VfsFile) selected[i]).canRead()) cmd += " " + ((VfsFile) selected[i]).getName(); BuShell.runCommand(app_, cmd); }
if ((source == dirs_) && (dirs_.getSelectedValues().length == 1)) openDirectory(); else if ((source == files_) && (files_.getSelectedValues().length == 1)) openFile(); } else if (BuLib.isRight(_evt)) { if (source == current_) {