From: Frederic D. <de...@us...> - 2004-06-01 11:28:22
|
Update of /cvsroot/fudaa/fudaa_devel/fudaa/src/org/fudaa/fudaa/commun/exec In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23809/src/org/fudaa/fudaa/commun/exec Modified Files: FudaaGlobalExecManager.java FudaaExecManagerPanel.java FudaaEditorExterne.java FudaaExecPanel.java FudaaExec.java FudaaAppliManagerImpl.java Log Message: Index: FudaaEditorExterne.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/fudaa/src/org/fudaa/fudaa/commun/exec/FudaaEditorExterne.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** FudaaEditorExterne.java 5 May 2004 12:42:34 -0000 1.6 --- FudaaEditorExterne.java 1 Jun 2004 11:27:42 -0000 1.7 *************** *** 21,25 **** public synchronized void edit(File _f) { if (_f != null) { ! execOnFile(_f); } } --- 21,25 ---- public synchronized void edit(File _f) { if (_f != null) { ! execOnFile(_f,null); } } Index: FudaaGlobalExecManager.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/fudaa/src/org/fudaa/fudaa/commun/exec/FudaaGlobalExecManager.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** FudaaGlobalExecManager.java 5 May 2004 12:42:34 -0000 1.3 --- FudaaGlobalExecManager.java 1 Jun 2004 11:27:42 -0000 1.4 *************** *** 24,33 **** protected ArrayList execs_; - public static final FudaaGlobalExecManager INSTANCE = new FudaaGlobalExecManager(); /** * */ ! private FudaaGlobalExecManager() { loadList(); } --- 24,32 ---- protected ArrayList execs_; /** * */ ! public FudaaGlobalExecManager() { loadList(); } Index: FudaaExec.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/fudaa/src/org/fudaa/fudaa/commun/exec/FudaaExec.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** FudaaExec.java 12 Mar 2004 10:17:01 -0000 1.8 --- FudaaExec.java 1 Jun 2004 11:27:42 -0000 1.9 *************** *** 20,23 **** --- 20,31 ---- import javax.swing.Icon; + import org.fudaa.ctulu.CtuluLib; + import org.fudaa.dodico.commun.DodicoLib; + import org.fudaa.dodico.commun.DodicoPreferences; + import org.fudaa.dodico.objet.CExec; + import org.fudaa.fudaa.commun.FudaaPreferences; + import org.fudaa.fudaa.commun.FudaaUI; + import org.fudaa.fudaa.ressource.FudaaResource; + import com.memoire.bu.BuEmptyIcon; import com.memoire.bu.BuIcon; *************** *** 26,35 **** import com.memoire.bu.BuResource; import com.memoire.fu.FuLib; - - import org.fudaa.ctulu.CtuluLib; - import org.fudaa.dodico.commun.DodicoLib; - import org.fudaa.dodico.commun.DodicoPreferences; - import org.fudaa.dodico.objet.CExec; - import org.fudaa.fudaa.ressource.FudaaResource; /** * @author deniger --- 34,37 ---- *************** *** 56,60 **** */ public final void actionPerformed(ActionEvent _e) { ! execInDir(new File(FuLib.getUserHome())); } } --- 58,62 ---- */ public final void actionPerformed(ActionEvent _e) { ! execInDir(new File(FuLib.getUserHome()),null); } } *************** *** 66,70 **** public final static String KEY_PREFIXE = "ext.executable"; public final static String NAME = "name"; ! public final static BuPreferences PREF = BuPreferences.BU; public static boolean containsIdName(List _ex, String _idToCheck) { --- 68,72 ---- public final static String KEY_PREFIXE = "ext.executable"; public final static String NAME = "name"; ! public final static BuPreferences PREF = FudaaPreferences.FUDAA; public static boolean containsIdName(List _ex, String _idToCheck) { *************** *** 78,82 **** } ! public static BuIcon getIcon(String _p) { if (_p.startsWith(INTERN_PREFIX)) { return FudaaResource.FUDAA.getToolIcon( --- 80,85 ---- } ! public static Icon getIcon(String _p) { ! if(_p==null) return EMPTY_TOOL_ICON; if (_p.startsWith(INTERN_PREFIX)) { return FudaaResource.FUDAA.getToolIcon( *************** *** 102,106 **** int n = _ex.length - 1; for (int i = n; i >= 0; i--) { ! if (_ex[i].getIDName().equals(_idName)) return i; } --- 105,109 ---- int n = _ex.length - 1; for (int i = n; i >= 0; i--) { ! if ((_ex[i]!=null) && (_ex[i].getIDName().equals(_idName))) return i; } *************** *** 168,173 **** if (execCommand_ == null) execCommand_ = idName_; ! setIconURL(_iconUrl); ! setShownName(_idName); } --- 171,177 ---- if (execCommand_ == null) execCommand_ = idName_; ! iconURL_=_iconUrl; ! icon_ = getIcon(iconURL_); ! shownName_=_idName; } *************** *** 175,178 **** --- 179,188 ---- if (action_ != null) action_.updateExec(); } + + protected void execNotFound(){ + FudaaExecPanel pn = new FudaaExecPanel(this); + pn.setErrorText(FudaaResource.getS("Exécutable non trouvé")); + pn.afficheModale(BuLib.HELPER, BuResource.BU.getString("Erreur")); + } protected final void exec(CExec _exec) { *************** *** 180,186 **** _exec.exec(); } catch (RuntimeException _io) { ! FudaaExecPanel pn = new FudaaExecPanel(this); ! pn.setErrorText(FudaaResource.getS("Exécutable non trouvé")); ! pn.afficheModale(BuLib.HELPER, BuResource.BU.getString("Erreur")); } } --- 190,195 ---- _exec.exec(); } catch (RuntimeException _io) { ! execNotFound(); ! } } *************** *** 229,233 **** } ArrayList a = new ArrayList(3 + n); ! StringTokenizer st = new StringTokenizer(execCommand_, CtuluLib.ESPACE); while (st.hasMoreTokens()) { a.add(st.nextToken()); --- 238,243 ---- } ArrayList a = new ArrayList(3 + n); ! StringTokenizer st = new StringTokenizer(getExecCommand(), CtuluLib.ESPACE); ! if(CtuluLib.DEBUG) CtuluLib.debug("exec command "+getExecCommand()); while (st.hasMoreTokens()) { a.add(st.nextToken()); *************** *** 236,239 **** --- 246,250 ---- a.add(_args[i]); } + CExec ex = new CExec(DodicoLib.enTableau(a)); ex.setCatchExceptions(false); *************** *** 267,271 **** * @param _dir le repertoire dans lequel l'exe doit se lancer */ ! public void execInDir(File _dir) { if ((_dir != null) && (_dir.exists()) && (_dir.isDirectory())) { if (CtuluLib.DEBUG) --- 278,282 ---- * @param _dir le repertoire dans lequel l'exe doit se lancer */ ! public void execInDir(File _dir,FudaaUI _parent) { if ((_dir != null) && (_dir.exists()) && (_dir.isDirectory())) { if (CtuluLib.DEBUG) *************** *** 275,279 **** } ! public void execOnFile(File _target) { exec(createExecutant(getParamForFile(_target), _target.getParentFile())); } --- 286,290 ---- } ! public void execOnFile(File _target,FudaaUI _parent) { exec(createExecutant(getParamForFile(_target), _target.getParentFile())); } *************** *** 381,385 **** } ! public final void setIconURL(String _iconURL) { if ((_iconURL == null) || (_iconURL.length() == 0)) { iconURL_ = CtuluLib.EMPTY_STRING; --- 392,396 ---- } ! public void setIconURL(String _iconURL) { if ((_iconURL == null) || (_iconURL.length() == 0)) { iconURL_ = CtuluLib.EMPTY_STRING; Index: FudaaExecManagerPanel.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/fudaa/src/org/fudaa/fudaa/commun/exec/FudaaExecManagerPanel.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** FudaaExecManagerPanel.java 5 May 2004 12:42:34 -0000 1.8 --- FudaaExecManagerPanel.java 1 Jun 2004 11:27:42 -0000 1.9 *************** *** 55,59 **** public FudaaExecManagerPanel(FudaaAppliManagerImpl _mng) { mng_ = _mng; ! List bibliotheque = FudaaGlobalExecManager.INSTANCE.getAllExe(); List myAppli = new ArrayList(_mng.getFudaaExecList()); for (int i = myAppli.size() - 1; i >= 0; i--) { --- 55,59 ---- public FudaaExecManagerPanel(FudaaAppliManagerImpl _mng) { mng_ = _mng; ! List bibliotheque = _mng.getExecMng().getAllExe(); List myAppli = new ArrayList(_mng.getFudaaExecList()); for (int i = myAppli.size() - 1; i >= 0; i--) { *************** *** 181,185 **** m.fillList(l); mApp.fillList(l); ! FudaaGlobalExecManager.INSTANCE.setNewValues(l); mng_.setNewValues(ex); } --- 181,185 ---- m.fillList(l); mApp.fillList(l); ! mng_.getExecMng().setNewValues(l); mng_.setNewValues(ex); } *************** *** 253,257 **** */ public void cancel() { ! FudaaGlobalExecManager.INSTANCE.reloadFromPref(); } } --- 253,257 ---- */ public void cancel() { ! mng_.getExecMng().reloadFromPref(); } } Index: FudaaAppliManagerImpl.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/fudaa/src/org/fudaa/fudaa/commun/exec/FudaaAppliManagerImpl.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** FudaaAppliManagerImpl.java 5 May 2004 12:42:34 -0000 1.3 --- FudaaAppliManagerImpl.java 1 Jun 2004 11:27:42 -0000 1.4 *************** *** 1,3 **** ! /* * @file FudaaAppliExecManager.java * @creation 2 juin 2003 --- 1,3 ---- ! /** * @file FudaaAppliExecManager.java * @creation 2 juin 2003 *************** *** 9,28 **** package org.fudaa.fudaa.commun.exec; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; - import com.memoire.bu.BuCommonImplementation; - import com.memoire.bu.BuMenu; - import com.memoire.bu.BuMenuItem; - import com.memoire.bu.BuPreferences; - import com.memoire.bu.BuResource; - import org.fudaa.ctulu.CtuluLib; import org.fudaa.ebli.dialog.EbliSimpleDialogPanel; import org.fudaa.fudaa.commun.FudaaPreferences; import org.fudaa.fudaa.ressource.FudaaResource; /** * Classe permettant de gerer les executables exterieures pour une application précise.Les --- 9,29 ---- package org.fudaa.fudaa.commun.exec; + import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.List; + import java.util.Observable; import java.util.StringTokenizer; import org.fudaa.ctulu.CtuluLib; import org.fudaa.ebli.dialog.EbliSimpleDialogPanel; import org.fudaa.fudaa.commun.FudaaPreferences; import org.fudaa.fudaa.ressource.FudaaResource; + + import com.memoire.bu.BuMenu; + import com.memoire.bu.BuMenuItem; + import com.memoire.bu.BuPreferences; + import com.memoire.bu.BuResource; /** * Classe permettant de gerer les executables exterieures pour une application précise.Les *************** *** 33,68 **** * @version $Id$ */ ! public class FudaaAppliManagerImpl implements ActionListener { ! protected BuCommonImplementation impl_; ! BuPreferences prefAppli_; ! List actions_; /** * La cle preference pour la liste des executables */ ! private final static String LIST_EXE_PREF = "executable.list"; ! private String prefForList_; /** * @param _prefAppli les preferences contenant la liste ! * @param _impl l'implementation */ ! public FudaaAppliManagerImpl( ! BuPreferences _prefAppli, ! BuCommonImplementation _impl) { ! this(_prefAppli, _impl, null); } /** * @param _prefAppli les preferences stockant les exe ! * @param _impl l'impl parente * @param _prefForList */ ! public FudaaAppliManagerImpl( ! BuPreferences _prefAppli, ! BuCommonImplementation _impl, String _prefForList) { prefAppli_ = _prefAppli; - impl_ = _impl; prefForList_ = _prefForList; if (prefForList_ == null) prefForList_ = CtuluLib.EMPTY_STRING; --- 34,64 ---- * @version $Id$ */ ! public class FudaaAppliManagerImpl extends Observable { ! BuPreferences prefAppli_; ! List actions_; /** * La cle preference pour la liste des executables */ ! private final static String LIST_EXE_PREF = "executable.list"; ! private String prefForList_; ! private FudaaGlobalExecManager execMng_; /** * @param _prefAppli les preferences contenant la liste ! * @param _f la frame parente */ ! public FudaaAppliManagerImpl(BuPreferences _prefAppli) { ! this(_prefAppli, null); } /** * @param _prefAppli les preferences stockant les exe ! * @param _parent l'impl parente * @param _prefForList */ ! public FudaaAppliManagerImpl(BuPreferences _prefAppli, String _prefForList) { prefAppli_ = _prefAppli; prefForList_ = _prefForList; if (prefForList_ == null) prefForList_ = CtuluLib.EMPTY_STRING; *************** *** 71,75 **** private String getKeyForList() { ! return prefForList_ == CtuluLib.EMPTY_STRING? LIST_EXE_PREF : prefForList_ + "." + LIST_EXE_PREF; } --- 67,72 ---- private String getKeyForList() { ! return prefForList_ == CtuluLib.EMPTY_STRING ? LIST_EXE_PREF : prefForList_ + "." ! + LIST_EXE_PREF; } *************** *** 92,97 **** int n = tk.countTokens(); actions_ = new ArrayList(n); for (int i = 0; i < n; i++) { ! actions_.add(FudaaGlobalExecManager.INSTANCE.getFudaaExec(tk.nextToken())); } } --- 89,95 ---- int n = tk.countTokens(); actions_ = new ArrayList(n); + if (execMng_ == null) execMng_ = new FudaaGlobalExecManager(); for (int i = 0; i < n; i++) { ! actions_.add(execMng_.getFudaaExec(tk.nextToken())); } } *************** *** 100,108 **** /** - * Methode appelee lorsque les preferences ont ete modifiees - */ - public void prefChanged() {} - - /** * @param _i l'indice de l'exe * @return L'exe demandé --- 98,101 ---- *************** *** 119,125 **** } - /** ! * @param _e l'exe * @return l'item permettant de lancer l'exe _e. */ --- 112,117 ---- } /** ! * @param _e l'exe * @return l'item permettant de lancer l'exe _e. */ *************** *** 133,137 **** } - /** * Ajoute au menu _m toutes les actions concernant les applications --- 125,128 ---- *************** *** 139,158 **** * @param _m le menu qui recoit les actions */ ! public void createMenuItems(BuMenu _m) { int n = getActionsNb(); BuMenuItem it; for (int i = 0; i < n; i++) { it = new BuMenuItem(); ! it.setAction(FudaaAppliManagerImpl.this.getExec(i).getAction()); _m.add(it); } - if (n > 0) - _m.addSeparator(); - BuMenuItem menuMod = - new BuMenuItem( - FudaaResource.getS("Modifier les applications externes")); - menuMod.setActionCommand("MANAGER"); - menuMod.addActionListener(FudaaAppliManagerImpl.this); - _m.add(menuMod); } --- 130,143 ---- * @param _m le menu qui recoit les actions */ ! public void createMenuItems(BuMenu _m, Component _parent) { int n = getActionsNb(); BuMenuItem it; for (int i = 0; i < n; i++) { it = new BuMenuItem(); ! FudaaExec e=FudaaAppliManagerImpl.this.getExec(i); ! if(e!=null) ! it.setAction(e.getAction()); _m.add(it); } } *************** *** 164,187 **** } - - /** - * Gere la modification des actions - * @param e l'action - */ - public void actionPerformed(ActionEvent e) { - if ("MANAGER".equals(e.getActionCommand())) { - createPanel().afficheModale( - impl_.getFrame(), - FudaaResource.getS("Modifier")); - } else if ("MANAGER_EDITEUR".equals(e.getActionCommand())) { - FudaaEditorPanel pn = new FudaaEditorPanel(); - int i = - pn.afficheModale(impl_.getFrame(), BuResource.BU.getString("Editeur")); - if (EbliSimpleDialogPanel.isOkResponse(i)) { - FudaaPreferences.FUDAA.writeIniFile(); - } - } - } - /** * @param _news --- 149,152 ---- *************** *** 198,212 **** } } ! if(b.length()==0) prefAppli_.removeProperty(getKeyForList()); ! else ! prefAppli_.putStringProperty(getKeyForList(), b.toString()); reload(); ! prefChanged(); } ! else{ prefAppli_.removeProperty(getKeyForList()); ! actions_=null; ! prefChanged(); } } ! } --- 163,185 ---- } } ! if (b.length() == 0) prefAppli_.removeProperty(getKeyForList()); ! else prefAppli_.putStringProperty(getKeyForList(), b.toString()); reload(); ! setChanged(); } ! else { prefAppli_.removeProperty(getKeyForList()); ! actions_ = null; ! setChanged(); } + notifyObservers(); } ! ! /** ! * @return Returns the execMng. ! */ ! public FudaaGlobalExecManager getExecMng() { ! if (execMng_ == null) execMng_ = new FudaaGlobalExecManager(); ! return execMng_; ! } ! } \ No newline at end of file Index: FudaaExecPanel.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/fudaa/src/org/fudaa/fudaa/commun/exec/FudaaExecPanel.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** FudaaExecPanel.java 14 May 2004 10:27:30 -0000 1.11 --- FudaaExecPanel.java 1 Jun 2004 11:27:42 -0000 1.12 *************** *** 97,101 **** void setIconUrl(String iconURL) { iconURL_= iconURL; ! BuIcon ic= FudaaExec.getIcon(iconURL_); if (ic != null) { iconButton_.setToolTipText(iconURL_); --- 97,101 ---- void setIconUrl(String iconURL) { iconURL_= iconURL; ! Icon ic= FudaaExec.getIcon(iconURL_); if (ic != null) { iconButton_.setToolTipText(iconURL_); |