[Buix-commits] r415 - in trunk/lutinvcs: lutinvcs-api/src/main/resources/i18n lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui lutinvcs-ui-pre-jaxx lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler
Author: tchemit Date: 2008-04-06 17:39:09 +0000 (Sun, 06 Apr 2008) New Revision: 415 Added: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/ConfirmUIHandler.java trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/DiffUIHandler.java trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/SynchUIHandler.java Removed: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/ConfirmUIHandler.java trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/DiffUIHandler.java trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/SynchUIHandler.java trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/AbstractConfirmUIHandler.java trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/AbstractDiffUIHandler.java trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/AbstractSynchUIHandler.java Modified: trunk/lutinvcs/lutinvcs-api/src/main/resources/i18n/lutinvcs-api-fr_FR.properties trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JConfirmUI.jaxx trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JDiffUI.jaxx trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JSynchUI.jaxx trunk/lutinvcs/lutinvcs-ui-pre-jaxx/pom.xml trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/AbstractConfirmUI.java trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/AbstractDiffUI.java trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/AbstractSynchUI.java Log: clean code and remove AbstractHandler unused Modified: trunk/lutinvcs/lutinvcs-api/src/main/resources/i18n/lutinvcs-api-fr_FR.properties =================================================================== --- trunk/lutinvcs/lutinvcs-api/src/main/resources/i18n/lutinvcs-api-fr_FR.properties 2008-04-06 17:24:11 UTC (rev 414) +++ trunk/lutinvcs/lutinvcs-api/src/main/resources/i18n/lutinvcs-api-fr_FR.properties 2008-04-06 17:39:09 UTC (rev 415) @@ -6,8 +6,8 @@ lutinvcs.action.diff=voir les diff\u00E9rences lutinvcs.action.overwriteAndUpdate=Update lutinvcs.action.refresh=Rafra\u00EEchir -lutinvcs.action.revert=Rollback -lutinvcs.action.update=Update +lutinvcs.action.revert=Annuler les modifications +lutinvcs.action.update=Mettre \u00E0 jour lutinvcs.error.checkout.dir=Ne peut pas uploader le fichier ''{0}'' lutinvcs.error.connexion.noinit=La connexion {0} n''a pas \u00E9t\u00E9 initialis\u00E9e lutinvcs.error.connexion.noopen=La connexion {0} n''a pas \u00E9t\u00E9 ouverte Modified: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JConfirmUI.jaxx =================================================================== --- trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JConfirmUI.jaxx 2008-04-06 17:24:11 UTC (rev 414) +++ trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JConfirmUI.jaxx 2008-04-06 17:39:09 UTC (rev 415) @@ -1,11 +1,6 @@ <AbstractConfirmUI title='lutinvcs.confirm.title' defaultCloseOperation='DISPOSE_ON_CLOSE' modal='true' resizable='false' height='300' width='400'> <style source="common.css"/> - <!--script> - public JConfirmUI(org.codelutin.vcs.ui.handler.AbstractConfirmUIHandler handler) { - super(handler); - } - </script--> <Table> <row fill='both'> <cell fill='both'> Modified: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JDiffUI.jaxx =================================================================== --- trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JDiffUI.jaxx 2008-04-06 17:24:11 UTC (rev 414) +++ trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JDiffUI.jaxx 2008-04-06 17:39:09 UTC (rev 415) @@ -1,13 +1,5 @@ <AbstractDiffUI title='lutinvcs.diff.title' id='diffui' defaultCloseOperation='DISPOSE_ON_CLOSE'> <style source="common.css"/> - <!--script> - import org.codelutin.vcs.type.VCSAction; - import org.codelutin.vcs.type.VCSEntryLocation; - - /*public JDiffUI(org.codelutin.vcs.ui.handler.AbstractDiffUIHandler handler) { - super(handler); - }*/ - </script--> <java.awt.CardLayout id='cardLayout'/> <Table> Modified: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JSynchUI.jaxx =================================================================== --- trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JSynchUI.jaxx 2008-04-06 17:24:11 UTC (rev 414) +++ trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JSynchUI.jaxx 2008-04-06 17:39:09 UTC (rev 415) @@ -1,13 +1,6 @@ <AbstractSynchUI title='lutinvcs.synch.title' modal="true" defaultCloseOperation='DISPOSE_ON_CLOSE'> <style source="common.css"/> - <!--script> - import org.codelutin.vcs.type.VCSAction; - import org.codelutin.vcs.type.VCSEntryLocation; - /*public JSynchUI(org.codelutin.vcs.ui.handler.AbstractSynchUIHandler handler) { - super(handler); - }*/ - </script--> <java.awt.CardLayout id='cardLayout'/> <JVCSPopup id="allPopup"/> Modified: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/pom.xml =================================================================== --- trunk/lutinvcs/lutinvcs-ui-pre-jaxx/pom.xml 2008-04-06 17:24:11 UTC (rev 414) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/pom.xml 2008-04-06 17:39:09 UTC (rev 415) @@ -43,6 +43,11 @@ <scope>compile</scope> </dependency> <dependency> + <groupId>lutinlib.vcs</groupId> + <artifactId>lutinvcs-provider-mock</artifactId> + <scope>compile</scope> + </dependency> + <dependency> <groupId>lutinlib</groupId> <artifactId>jaxx</artifactId> <scope>compile</scope> Modified: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/AbstractConfirmUI.java =================================================================== --- trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/AbstractConfirmUI.java 2008-04-06 17:24:11 UTC (rev 414) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/AbstractConfirmUI.java 2008-04-06 17:39:09 UTC (rev 415) @@ -15,9 +15,9 @@ package org.codelutin.vcs.ui; import jaxx.runtime.swing.Table; -import org.codelutin.vcs.ui.handler.AbstractConfirmUIHandler; +import org.codelutin.vcs.ui.model.AbstractUIModel; import org.codelutin.vcs.ui.model.ConfirmUIModel; -import org.codelutin.vcs.ui.model.AbstractUIModel; +import org.codelutin.vcs.ui.handler.ConfirmUIHandler; import javax.swing.JButton; import javax.swing.JLabel; @@ -51,8 +51,8 @@ @Override - protected AbstractConfirmUIHandler getHandler() { - return (AbstractConfirmUIHandler) super.getHandler(); + protected ConfirmUIHandler getHandler() { + return (ConfirmUIHandler) super.getHandler(); } @Override Modified: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/AbstractDiffUI.java =================================================================== --- trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/AbstractDiffUI.java 2008-04-06 17:24:11 UTC (rev 414) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/AbstractDiffUI.java 2008-04-06 17:39:09 UTC (rev 415) @@ -15,9 +15,8 @@ package org.codelutin.vcs.ui; import org.codelutin.vcs.type.VCSAction; -import org.codelutin.vcs.ui.handler.AbstractDiffUIHandler; -import org.codelutin.vcs.ui.handler.AbstractTabUIHandler; import org.codelutin.vcs.ui.model.DiffUIModel; +import org.codelutin.vcs.ui.handler.DiffUIHandler; import javax.swing.JButton; @@ -34,8 +33,8 @@ } @Override - protected AbstractDiffUIHandler getHandler() { - return (AbstractDiffUIHandler) handler; + protected DiffUIHandler getHandler() { + return (DiffUIHandler) handler; } protected void selectFile() { Modified: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/AbstractSynchUI.java =================================================================== --- trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/AbstractSynchUI.java 2008-04-06 17:24:11 UTC (rev 414) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/AbstractSynchUI.java 2008-04-06 17:39:09 UTC (rev 415) @@ -16,8 +16,8 @@ import org.codelutin.vcs.type.VCSAction; import org.codelutin.vcs.type.VCSEntryLocation; -import org.codelutin.vcs.ui.handler.AbstractSynchUIHandler; import org.codelutin.vcs.ui.model.SynchUIModel; +import org.codelutin.vcs.ui.handler.SynchUIHandler; import javax.swing.JButton; @@ -49,8 +49,8 @@ } @Override - protected AbstractSynchUIHandler getHandler() { - return (AbstractSynchUIHandler) handler; + protected SynchUIHandler getHandler() { + return (SynchUIHandler) handler; } public AbstractVCSPopup getPopup(VCSEntryLocation modelName) { Deleted: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/ConfirmUIHandler.java =================================================================== --- trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/ConfirmUIHandler.java 2008-04-06 17:24:11 UTC (rev 414) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/ConfirmUIHandler.java 2008-04-06 17:39:09 UTC (rev 415) @@ -1,112 +0,0 @@ -/** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit - * This program is free software; you - * can redistribute it and/or modify it under the terms of the GNU General - * Public License as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. This program is - * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU General Public License for more details. You - * should have received a copy of the GNU General Public License along with this - * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - * - Suite 330, Boston, MA 02111-1307, USA. - * # #% - */ -package org.codelutin.vcs.ui; - -import org.codelutin.vcs.VCSEntry; -import org.codelutin.vcs.type.VCSAction; -import org.codelutin.vcs.ui.model.AbstractVCSEntriesTableModel; -import org.codelutin.vcs.ui.model.ConfirmUIModel; - -import javax.swing.ListSelectionModel; -import java.beans.PropertyChangeEvent; -import java.util.List; - -/** @author chemit */ -public class ConfirmUIHandler extends org.codelutin.vcs.ui.handler.AbstractUIHandler<ConfirmUIModel, AbstractConfirmUI> { - - - public ConfirmUIHandler() { - super(); - //this.ui = new JConfirmUI(this); - } - - /*public void setUi(AbstractConfirmUI ui) { - this.ui = ui; - }*/ - - /*public ConfirmUIModel getModel() { - return getUi().getModel(); - }*/ - - - public Class<AbstractConfirmUI> getUiClass() { - return AbstractConfirmUI.class; - } - - public Class<? super ConfirmUIModel> getModelClass() { - return ConfirmUIModel.class; - } - - public ListSelectionModel getSelectionModel() { - return getUi().getContentTable().getSelectionModel(); - } - - public void propertyChange(PropertyChangeEvent evt) { - if (log.isDebugEnabled()) { - log.debug(evt.getPropertyName() + " old:" + evt.getOldValue() + ", new:" + evt.getNewValue()); - } - String action = evt.getPropertyName(); - - if (ConfirmUIModel.ACCEPT_PROPERTY_CHANGED.equals(action)) { - updateUI(); - return; - } - - if (ConfirmUIModel.MESSAGE_HISTORY_PROPERTY_CHANGED.equals(action)) { - updateMessageUI(); - return; - } - - throw new IllegalStateException("unimplemented property changed : " + evt); - } - - protected void updateUI() { - VCSAction action = getModel().getAction(); - getUi().getAccept().setText(action.getLibelle()); - getUi().getToolbar().setVisible(action.isCommit()); - getUi().getHandler().getSelectionModel().setSelectionInterval(0, getModel().getEntriesModel().getRowCount() - 1); - } - - protected void updateMessageUI() { - // update message history combo box ? - getUi().getLastMessages().setEnabled(!getModel().getCommitMessages().isEmpty()); - } - - public void doAction(String commitMessage, AbstractVCSEntriesTableModel model) { - - VCSAction action = getModel().getAction(); - - List<VCSEntry> entries = model.filter(action, model.getDisplayedEntries(getSelectionModel())); - - if (action.isCommit()) { - getModel().addCommitMessage(commitMessage); - - } else { - commitMessage = null; - } - - if (log.isDebugEnabled()) { - log.debug("action:" + action + ", message:" + commitMessage + ", nb files:" + entries.size()); - } - - getActionManager().add(action, entries.toArray(new VCSEntry[entries.size()]), commitMessage); - - // dispose ui - getUi().dispose(); - - } - - -} Deleted: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/DiffUIHandler.java =================================================================== --- trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/DiffUIHandler.java 2008-04-06 17:24:11 UTC (rev 414) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/DiffUIHandler.java 2008-04-06 17:39:09 UTC (rev 415) @@ -1,92 +0,0 @@ -/** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit - * This program is free software; you - * can redistribute it and/or modify it under the terms of the GNU General - * Public License as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. This program is - * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU General Public License for more details. You - * should have received a copy of the GNU General Public License along with this - * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - * - Suite 330, Boston, MA 02111-1307, USA. - * # #% - */ -package org.codelutin.vcs.ui; - -import org.codelutin.vcs.VCSEntry; -import org.codelutin.vcs.type.VCSAction; -import org.codelutin.vcs.type.VCSEntryLocation; -import org.codelutin.vcs.ui.model.DiffUIModel; - -import java.beans.PropertyChangeEvent; - -/** @author chemit */ -public class DiffUIHandler extends org.codelutin.vcs.ui.handler.AbstractTabUIHandler<DiffUIModel, AbstractDiffUI> { - - //protected AbstractDiffUI ui; - - public DiffUIHandler() { - //this.ui = new JDiffUI(this); - } - - /*public AbstractDiffUI getUi() { - return ui; - }*/ - - /*public void setUi(AbstractDiffUI ui) { - this.ui = ui; - } - - public DiffUIModel getModel() { - return ui.getModel(); - }*/ - - public Class<AbstractDiffUI> getUiClass() { - return AbstractDiffUI.class; - } - - public Class<? super DiffUIModel> getModelClass() { - return DiffUIModel.class; - } - - @Override - public void propertyChange(PropertyChangeEvent evt) { - //if (log.isDebugEnabled()) { - log.info(evt.getPropertyName() + " old:" + evt.getOldValue() + ", new:" + evt.getNewValue()); - //} - - String action = evt.getPropertyName(); - if (DiffUIModel.FILE_PROPERTY_CHANGED.equals(action)) { - doSelectFile((VCSEntry) evt.getNewValue()); - } else { - super.propertyChange(evt); - } - } - - @Override - public void doSelectLocation(VCSEntryLocation location) { - super.doSelectLocation(location); - - } - - protected void initTab(VCSEntryLocation location) { - //TODO - } - - public void doSelectFile(VCSEntry model) { - //TODO - } - - public void doAction(VCSAction action, VCSEntry model) { - //TODO - } - - public void gotoNextDiff() { - //TODO - } - - public void gotoPreviousDiff() { - //TODO - } -} Deleted: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/SynchUIHandler.java =================================================================== --- trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/SynchUIHandler.java 2008-04-06 17:24:11 UTC (rev 414) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/SynchUIHandler.java 2008-04-06 17:39:09 UTC (rev 415) @@ -1,177 +0,0 @@ -package org.codelutin.vcs.ui; - -import org.codelutin.vcs.VCSEntry; -import org.codelutin.vcs.type.VCSAction; -import org.codelutin.vcs.type.VCSEntryLocation; -import org.codelutin.vcs.ui.handler.VCSAbsractAction; -import org.codelutin.vcs.ui.model.AbstractVCSEntriesTableModel; -import org.codelutin.vcs.ui.model.SynchUIModel; - -import javax.swing.JTable; -import javax.swing.ListSelectionModel; -import java.awt.event.ActionEvent; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.util.ArrayList; -import java.util.List; - -/** @author chemit */ -public class SynchUIHandler extends org.codelutin.vcs.ui.handler.AbstractTabUIHandler<SynchUIModel, AbstractSynchUI> { - - //protected AbstractSynchUI ui; - - public SynchUIHandler() { - //this.ui = new JSynchUI(this); - } - - public Class<AbstractSynchUI> getUiClass() { - return AbstractSynchUI.class; - } - - public Class<? super SynchUIModel> getModelClass() { - return SynchUIModel.class; - } - - /*public void setUi(AbstractSynchUI ui) { - this.ui = ui; - } - - public AbstractSynchUI getUi() { - return ui; - }*/ - - /*public SynchUIModel getModel() { - return ui.getModel(); - }*/ - - /*public void doAllAction(VCSAction action) { - doAction(action, false); - } - - public void doSelectAction(VCSAction action) { - doAction(action, true); - }*/ - - @Override - public void doSelectLocation(VCSEntryLocation location) { - - super.doSelectLocation(location); - - VCSAction[] actions = getModel().getEntriesModel().getActions((ListSelectionModel) null); - List<String> acts = new ArrayList<String>(); - for (VCSAction action : actions) { - acts.add(action.name().toLowerCase()); - } - boolean hasActions = actions.length > 0; - getUi().getDiffAll().setEnabled(hasActions && acts.contains("diff")); - getUi().getUpdateAll().setEnabled(hasActions && acts.contains("update")); - getUi().getCommitAll().setEnabled(hasActions && acts.contains("commit")); - getUi().getRevertAll().setEnabled(hasActions && acts.contains("revert")); - getUi().getDeleteAll().setEnabled(hasActions && acts.contains("delete")); - getUi().getRefreshAll().setEnabled(hasActions); - } - - public void doAction(VCSAction action, boolean useSelection) { - AbstractVCSEntriesTableModel model = getModel().getEntriesModel(); - log.info(action + " : " + model); - ListSelectionModel selectionModel = getSelectionModel(); - if (action == VCSAction.REFRESH) { - selectionModel.clearSelection(); - // do refresh of all states - log.info("refresh :" + model.getRowCount()); - model.refresh(model.getEntries(), System.nanoTime()); - } else { - List<VCSEntry> entries = model.filter(action, model.getDisplayedEntries(useSelection ? selectionModel : null)); - if (entries.isEmpty()) { - // nothing to do - return; - } - if (action == VCSAction.DIFF) { - // show diff ui - return; - } - log.info("files to treate :" + entries.size()); - - AbstractConfirmUI confirmUI = VCSUIFactory.newConfirmUI(); - - confirmUI.getModel().init(action, model.getLocation(), entries.toArray(new VCSEntry[entries.size()])); - - confirmUI.setVisible(true); - //TODO SynchModel should listener for modification on ActionManagerQueue thread - log.info("TODO refresh states for files..."); - } - } - - protected void initTab(VCSEntryLocation location) { - JTable table = getUi().getTable(location); - AbstractVCSEntriesTableModel fileStatesModel = getModel().getEntriesModel(); - table.setModel(fileStatesModel); - table.addMouseListener(new ListMouseListener(getUi(), fileStatesModel, location)); - AbstractVCSPopup popup = getUi().getPopup(location); - - popup.setDispatchAction(new VCSAbsractAction() { - private static final long serialVersionUID = 8622118724992019898L; - - public void actionPerformed(ActionEvent e) { - doAction(action, false); - } - }); - } - - protected static class ListMouseListener extends MouseAdapter { - - private final AbstractVCSEntriesTableModel model; - - private final ListSelectionModel selectionModel; - - private final JTable jTable; - private final AbstractVCSPopup jPopupMenu; - - public ListMouseListener(AbstractSynchUI ui, AbstractVCSEntriesTableModel model, VCSEntryLocation modelName) { - this.model = model; - jPopupMenu = ui.getPopup(modelName); - jTable = ui.getTable(modelName); - selectionModel = jTable.getSelectionModel(); - } - - @Override - public void mousePressed(MouseEvent e) { - super.mousePressed(e); - if (e.isPopupTrigger()) { - initPopup(e.getX(), e.getY()); - } - } - - @Override - public void mouseReleased(MouseEvent e) { - super.mouseReleased(e); - if (e.isPopupTrigger()) { - initPopup(e.getX(), e.getY()); - } - } - - @Override - public void mouseClicked(MouseEvent e) { - // nothing to do - } - - protected void initPopup(int x, int y) { - if (!selectionModel.isSelectionEmpty()) { - List<String> acts = new ArrayList<String>(); - for (VCSAction action : model.getActions(selectionModel)) { - acts.add(action.name().toLowerCase()); - } - boolean hasActions = !acts.isEmpty(); - jPopupMenu.getDiff().setEnabled(hasActions && acts.contains("diff")); - jPopupMenu.getUpdate().setEnabled(hasActions && acts.contains("update")); - jPopupMenu.getCommit().setEnabled(hasActions && acts.contains("commit")); - jPopupMenu.getRevert().setEnabled(hasActions && acts.contains("revert")); - jPopupMenu.getDelete().setEnabled(hasActions && acts.contains("delete")); - jPopupMenu.getRefresh().setEnabled(hasActions); - jPopupMenu.pack(); - // display popup - jPopupMenu.show(jTable, x, y); - } - } - } -} Deleted: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/AbstractConfirmUIHandler.java =================================================================== --- trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/AbstractConfirmUIHandler.java 2008-04-06 17:24:11 UTC (rev 414) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/AbstractConfirmUIHandler.java 2008-04-06 17:39:09 UTC (rev 415) @@ -1,81 +0,0 @@ -/** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit - * This program is free software; you - * can redistribute it and/or modify it under the terms of the GNU General - * Public License as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. This program is - * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU General Public License for more details. You - * should have received a copy of the GNU General Public License along with this - * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - * - Suite 330, Boston, MA 02111-1307, USA. - * # #% - */ -package org.codelutin.vcs.ui.handler; - -import org.codelutin.vcs.VCSEntry; -import org.codelutin.vcs.type.VCSAction; -import org.codelutin.vcs.ui.AbstractConfirmUI; -import org.codelutin.vcs.ui.model.AbstractVCSEntriesTableModel; -import org.codelutin.vcs.ui.model.ConfirmUIModel; - -import java.beans.PropertyChangeEvent; -import java.util.List; - -/** - * Abstract ConfirmUI handler - * - * @author chemit - */ -public abstract class AbstractConfirmUIHandler extends AbstractUIHandler<ConfirmUIModel, AbstractConfirmUI> { - - protected abstract void updateUI(); - - protected abstract void updateMessageUI(); - - public void propertyChange(PropertyChangeEvent evt) { - if (log.isDebugEnabled()) { - log.debug(evt.getPropertyName() + " old:" + evt.getOldValue() + ", new:" + evt.getNewValue()); - } - String action = evt.getPropertyName(); - - if (ConfirmUIModel.ACCEPT_PROPERTY_CHANGED.equals(action)) { - updateUI(); - return; - } - - if (ConfirmUIModel.MESSAGE_HISTORY_PROPERTY_CHANGED.equals(action)) { - updateMessageUI(); - return; - } - - throw new IllegalStateException("unimplemented property changed : " + evt); - } - - public void doAction(String commitMessage, AbstractVCSEntriesTableModel model) { - - VCSAction action = getModel().getAction(); - - List<VCSEntry> entries = model.filter(action, model.getDisplayedEntries(getSelectionModel())); - - if (action.isCommit()) { - getModel().addCommitMessage(commitMessage); - - } else { - commitMessage = null; - } - - if (log.isDebugEnabled()) { - log.debug("action:" + action + ", message:" + commitMessage + ", nb files:" + entries.size()); - } - - getActionManager().add(action, entries.toArray(new VCSEntry[entries.size()]), commitMessage); - - // dispose ui - getUi().dispose(); - - } - - -} \ No newline at end of file Deleted: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/AbstractDiffUIHandler.java =================================================================== --- trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/AbstractDiffUIHandler.java 2008-04-06 17:24:11 UTC (rev 414) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/AbstractDiffUIHandler.java 2008-04-06 17:39:09 UTC (rev 415) @@ -1,66 +0,0 @@ -/** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit - * This program is free software; you - * can redistribute it and/or modify it under the terms of the GNU General - * Public License as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. This program is - * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU General Public License for more details. You - * should have received a copy of the GNU General Public License along with this - * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - * - Suite 330, Boston, MA 02111-1307, USA. - * # #% - */ -package org.codelutin.vcs.ui.handler; - -import org.codelutin.vcs.VCSEntry; -import org.codelutin.vcs.type.VCSAction; -import org.codelutin.vcs.type.VCSEntryLocation; -import org.codelutin.vcs.ui.AbstractDiffUI; -import org.codelutin.vcs.ui.model.DiffUIModel; - -import java.beans.PropertyChangeEvent; - -/** @author chemit */ -public abstract class AbstractDiffUIHandler<U extends AbstractDiffUI> extends AbstractTabUIHandler<DiffUIModel, U> { - - public void propertyChange(PropertyChangeEvent evt) { - //if (log.isDebugEnabled()) { - log.info(evt.getPropertyName() + " old:" + evt.getOldValue() + ", new:" + evt.getNewValue()); - //} - - String action = evt.getPropertyName(); - if (DiffUIModel.FILE_PROPERTY_CHANGED.equals(action)) { - doSelectFile((VCSEntry) evt.getNewValue()); - } else { - super.propertyChange(evt); - } - } - - public abstract void doSelectFile(VCSEntry model); - - public abstract void doAction(VCSAction action, VCSEntry model); - - public abstract void gotoNextDiff(); - - public abstract void gotoPreviousDiff(); - - public void doSelectLocation(VCSEntryLocation location) { - log.info(location); - - getUi().getCardLayout().show(getUi().getPreview(), location.name().toLowerCase() + "Content"); - //VCSAction[] actions = getModel().getModel().getActions((ListSelectionModel) null); - /*List<String> acts = new ArrayList<String>(); - for (VCSAction action : actions) { - acts.add(action.name().toLowerCase()); - } */ - /*boolean hasActions = actions.length > 0; - getUi().getDiffAll().setEnabled(hasActions && acts.contains("diff")); - getUi().getUpdateAll().setEnabled(hasActions && acts.contains("update")); - getUi().getCommitAll().setEnabled(hasActions && acts.contains("commit")); - getUi().getRevertAll().setEnabled(hasActions && acts.contains("revert")); - getUi().getDeleteAll().setEnabled(hasActions && acts.contains("delete")); - getUi().getRefreshAll().setEnabled(hasActions);*/ - } -} \ No newline at end of file Deleted: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/AbstractSynchUIHandler.java =================================================================== --- trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/AbstractSynchUIHandler.java 2008-04-06 17:24:11 UTC (rev 414) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/AbstractSynchUIHandler.java 2008-04-06 17:39:09 UTC (rev 415) @@ -1,49 +0,0 @@ -/** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit - * This program is free software; you - * can redistribute it and/or modify it under the terms of the GNU General - * Public License as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. This program is - * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU General Public License for more details. You - * should have received a copy of the GNU General Public License along with this - * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - * - Suite 330, Boston, MA 02111-1307, USA. - * # #% - */ -package org.codelutin.vcs.ui.handler; - -import org.codelutin.vcs.type.VCSAction; -import org.codelutin.vcs.type.VCSEntryLocation; -import org.codelutin.vcs.ui.AbstractSynchUI; -import org.codelutin.vcs.ui.model.SynchUIModel; - -import javax.swing.ListSelectionModel; -import java.util.ArrayList; -import java.util.List; - -/** @author chemit */ -public abstract class AbstractSynchUIHandler<U extends AbstractSynchUI> extends AbstractTabUIHandler<SynchUIModel, U> { - - public abstract void doAction(VCSAction action, boolean useSelect); - - public void doSelectLocation(VCSEntryLocation location) { - - super.doSelectLocation(location); - - VCSAction[] actions = getModel().getEntriesModel().getActions((ListSelectionModel) null); - List<String> acts = new ArrayList<String>(); - for (VCSAction action : actions) { - acts.add(action.name().toLowerCase()); - } - boolean hasActions = actions.length > 0; - getUi().getDiffAll().setEnabled(hasActions && acts.contains("diff")); - getUi().getUpdateAll().setEnabled(hasActions && acts.contains("update")); - getUi().getCommitAll().setEnabled(hasActions && acts.contains("commit")); - getUi().getRevertAll().setEnabled(hasActions && acts.contains("revert")); - getUi().getDeleteAll().setEnabled(hasActions && acts.contains("delete")); - getUi().getRefreshAll().setEnabled(hasActions); - } - -} Copied: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/ConfirmUIHandler.java (from rev 413, trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/ConfirmUIHandler.java) =================================================================== --- trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/ConfirmUIHandler.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/ConfirmUIHandler.java 2008-04-06 17:39:09 UTC (rev 415) @@ -0,0 +1,113 @@ +/** + * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * # #% + */ +package org.codelutin.vcs.ui.handler; + +import org.codelutin.vcs.VCSEntry; +import org.codelutin.vcs.type.VCSAction; +import org.codelutin.vcs.ui.model.AbstractVCSEntriesTableModel; +import org.codelutin.vcs.ui.model.ConfirmUIModel; +import org.codelutin.vcs.ui.AbstractConfirmUI; + +import javax.swing.ListSelectionModel; +import java.beans.PropertyChangeEvent; +import java.util.List; + +/** @author chemit */ +public class ConfirmUIHandler extends org.codelutin.vcs.ui.handler.AbstractUIHandler<ConfirmUIModel, AbstractConfirmUI> { + + + public ConfirmUIHandler() { + super(); + //this.ui = new JConfirmUI(this); + } + + /*public void setUi(AbstractConfirmUI ui) { + this.ui = ui; + }*/ + + /*public ConfirmUIModel getModel() { + return getUi().getModel(); + }*/ + + + public Class<AbstractConfirmUI> getUiClass() { + return AbstractConfirmUI.class; + } + + public Class<? super ConfirmUIModel> getModelClass() { + return ConfirmUIModel.class; + } + + public ListSelectionModel getSelectionModel() { + return getUi().getContentTable().getSelectionModel(); + } + + public void propertyChange(PropertyChangeEvent evt) { + if (log.isDebugEnabled()) { + log.debug(evt.getPropertyName() + " old:" + evt.getOldValue() + ", new:" + evt.getNewValue()); + } + String action = evt.getPropertyName(); + + if (ConfirmUIModel.ACCEPT_PROPERTY_CHANGED.equals(action)) { + updateUI(); + return; + } + + if (ConfirmUIModel.MESSAGE_HISTORY_PROPERTY_CHANGED.equals(action)) { + updateMessageUI(); + return; + } + + throw new IllegalStateException("unimplemented property changed : " + evt); + } + + protected void updateUI() { + VCSAction action = getModel().getAction(); + getUi().getAccept().setText(action.getLibelle()); + getUi().getToolbar().setVisible(action.isCommit()); + getUi().getHandler().getSelectionModel().setSelectionInterval(0, getModel().getEntriesModel().getRowCount() - 1); + } + + protected void updateMessageUI() { + // update message history combo box ? + getUi().getLastMessages().setEnabled(!getModel().getCommitMessages().isEmpty()); + } + + public void doAction(String commitMessage, AbstractVCSEntriesTableModel model) { + + VCSAction action = getModel().getAction(); + + List<VCSEntry> entries = model.filter(action, model.getDisplayedEntries(getSelectionModel())); + + if (action.isCommit()) { + getModel().addCommitMessage(commitMessage); + + } else { + commitMessage = null; + } + + if (log.isDebugEnabled()) { + log.debug("action:" + action + ", message:" + commitMessage + ", nb files:" + entries.size()); + } + + getActionManager().add(action, entries.toArray(new VCSEntry[entries.size()]), commitMessage); + + // dispose ui + getUi().dispose(); + + } + + +} Copied: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/DiffUIHandler.java (from rev 413, trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/DiffUIHandler.java) =================================================================== --- trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/DiffUIHandler.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/DiffUIHandler.java 2008-04-06 17:39:09 UTC (rev 415) @@ -0,0 +1,93 @@ +/** + * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * # #% + */ +package org.codelutin.vcs.ui.handler; + +import org.codelutin.vcs.VCSEntry; +import org.codelutin.vcs.type.VCSAction; +import org.codelutin.vcs.type.VCSEntryLocation; +import org.codelutin.vcs.ui.model.DiffUIModel; +import org.codelutin.vcs.ui.AbstractDiffUI; + +import java.beans.PropertyChangeEvent; + +/** @author chemit */ +public class DiffUIHandler extends org.codelutin.vcs.ui.handler.AbstractTabUIHandler<DiffUIModel, AbstractDiffUI> { + + //protected AbstractDiffUI ui; + + public DiffUIHandler() { + //this.ui = new JDiffUI(this); + } + + /*public AbstractDiffUI getUi() { + return ui; + }*/ + + /*public void setUi(AbstractDiffUI ui) { + this.ui = ui; + } + + public DiffUIModel getModel() { + return ui.getModel(); + }*/ + + public Class<AbstractDiffUI> getUiClass() { + return AbstractDiffUI.class; + } + + public Class<? super DiffUIModel> getModelClass() { + return DiffUIModel.class; + } + + @Override + public void propertyChange(PropertyChangeEvent evt) { + //if (log.isDebugEnabled()) { + log.info(evt.getPropertyName() + " old:" + evt.getOldValue() + ", new:" + evt.getNewValue()); + //} + + String action = evt.getPropertyName(); + if (DiffUIModel.FILE_PROPERTY_CHANGED.equals(action)) { + doSelectFile((VCSEntry) evt.getNewValue()); + } else { + super.propertyChange(evt); + } + } + + @Override + public void doSelectLocation(VCSEntryLocation location) { + super.doSelectLocation(location); + + } + + protected void initTab(VCSEntryLocation location) { + //TODO + } + + public void doSelectFile(VCSEntry model) { + //TODO + } + + public void doAction(VCSAction action, VCSEntry model) { + //TODO + } + + public void gotoNextDiff() { + //TODO + } + + public void gotoPreviousDiff() { + //TODO + } +} Copied: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/SynchUIHandler.java (from rev 413, trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/SynchUIHandler.java) =================================================================== --- trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/SynchUIHandler.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/SynchUIHandler.java 2008-04-06 17:39:09 UTC (rev 415) @@ -0,0 +1,181 @@ +package org.codelutin.vcs.ui.handler; + +import org.codelutin.vcs.VCSEntry; +import org.codelutin.vcs.type.VCSAction; +import org.codelutin.vcs.type.VCSEntryLocation; +import org.codelutin.vcs.ui.handler.VCSAbsractAction; +import org.codelutin.vcs.ui.model.AbstractVCSEntriesTableModel; +import org.codelutin.vcs.ui.model.SynchUIModel; +import org.codelutin.vcs.ui.AbstractSynchUI; +import org.codelutin.vcs.ui.AbstractConfirmUI; +import org.codelutin.vcs.ui.VCSUIFactory; +import org.codelutin.vcs.ui.AbstractVCSPopup; + +import javax.swing.JTable; +import javax.swing.ListSelectionModel; +import java.awt.event.ActionEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.util.ArrayList; +import java.util.List; + +/** @author chemit */ +public class SynchUIHandler extends org.codelutin.vcs.ui.handler.AbstractTabUIHandler<SynchUIModel, AbstractSynchUI> { + + //protected AbstractSynchUI ui; + + public SynchUIHandler() { + //this.ui = new JSynchUI(this); + } + + public Class<AbstractSynchUI> getUiClass() { + return AbstractSynchUI.class; + } + + public Class<? super SynchUIModel> getModelClass() { + return SynchUIModel.class; + } + + /*public void setUi(AbstractSynchUI ui) { + this.ui = ui; + } + + public AbstractSynchUI getUi() { + return ui; + }*/ + + /*public SynchUIModel getModel() { + return ui.getModel(); + }*/ + + /*public void doAllAction(VCSAction action) { + doAction(action, false); + } + + public void doSelectAction(VCSAction action) { + doAction(action, true); + }*/ + + @Override + public void doSelectLocation(VCSEntryLocation location) { + + super.doSelectLocation(location); + + VCSAction[] actions = getModel().getEntriesModel().getActions((ListSelectionModel) null); + List<String> acts = new ArrayList<String>(); + for (VCSAction action : actions) { + acts.add(action.name().toLowerCase()); + } + boolean hasActions = actions.length > 0; + getUi().getDiffAll().setEnabled(hasActions && acts.contains("diff")); + getUi().getUpdateAll().setEnabled(hasActions && acts.contains("update")); + getUi().getCommitAll().setEnabled(hasActions && acts.contains("commit")); + getUi().getRevertAll().setEnabled(hasActions && acts.contains("revert")); + getUi().getDeleteAll().setEnabled(hasActions && acts.contains("delete")); + getUi().getRefreshAll().setEnabled(hasActions); + } + + public void doAction(VCSAction action, boolean useSelection) { + AbstractVCSEntriesTableModel model = getModel().getEntriesModel(); + log.info(action + " : " + model); + ListSelectionModel selectionModel = getSelectionModel(); + if (action == VCSAction.REFRESH) { + selectionModel.clearSelection(); + // do refresh of all states + log.info("refresh :" + model.getRowCount()); + model.refresh(model.getEntries(), System.nanoTime()); + } else { + List<VCSEntry> entries = model.filter(action, model.getDisplayedEntries(useSelection ? selectionModel : null)); + if (entries.isEmpty()) { + // nothing to do + return; + } + if (action == VCSAction.DIFF) { + // show diff ui + return; + } + log.info("files to treate :" + entries.size()); + + AbstractConfirmUI confirmUI = VCSUIFactory.newConfirmUI(); + + confirmUI.getModel().init(action, model.getLocation(), entries.toArray(new VCSEntry[entries.size()])); + + confirmUI.setVisible(true); + //TODO SynchModel should listener for modification on ActionManagerQueue thread + log.info("TODO refresh states for files..."); + } + } + + protected void initTab(VCSEntryLocation location) { + JTable table = getUi().getTable(location); + AbstractVCSEntriesTableModel fileStatesModel = getModel().getEntriesModel(); + table.setModel(fileStatesModel); + table.addMouseListener(new ListMouseListener(getUi(), fileStatesModel, location)); + AbstractVCSPopup popup = getUi().getPopup(location); + + popup.setDispatchAction(new VCSAbsractAction() { + private static final long serialVersionUID = 8622118724992019898L; + + public void actionPerformed(ActionEvent e) { + doAction(action, false); + } + }); + } + + protected static class ListMouseListener extends MouseAdapter { + + private final AbstractVCSEntriesTableModel model; + + private final ListSelectionModel selectionModel; + + private final JTable jTable; + private final AbstractVCSPopup jPopupMenu; + + public ListMouseListener(AbstractSynchUI ui, AbstractVCSEntriesTableModel model, VCSEntryLocation modelName) { + this.model = model; + jPopupMenu = ui.getPopup(modelName); + jTable = ui.getTable(modelName); + selectionModel = jTable.getSelectionModel(); + } + + @Override + public void mousePressed(MouseEvent e) { + super.mousePressed(e); + if (e.isPopupTrigger()) { + initPopup(e.getX(), e.getY()); + } + } + + @Override + public void mouseReleased(MouseEvent e) { + super.mouseReleased(e); + if (e.isPopupTrigger()) { + initPopup(e.getX(), e.getY()); + } + } + + @Override + public void mouseClicked(MouseEvent e) { + // nothing to do + } + + protected void initPopup(int x, int y) { + if (!selectionModel.isSelectionEmpty()) { + List<String> acts = new ArrayList<String>(); + for (VCSAction action : model.getActions(selectionModel)) { + acts.add(action.name().toLowerCase()); + } + boolean hasActions = !acts.isEmpty(); + jPopupMenu.getDiff().setEnabled(hasActions && acts.contains("diff")); + jPopupMenu.getUpdate().setEnabled(hasActions && acts.contains("update")); + jPopupMenu.getCommit().setEnabled(hasActions && acts.contains("commit")); + jPopupMenu.getRevert().setEnabled(hasActions && acts.contains("revert")); + jPopupMenu.getDelete().setEnabled(hasActions && acts.contains("delete")); + jPopupMenu.getRefresh().setEnabled(hasActions); + jPopupMenu.pack(); + // display popup + jPopupMenu.show(jTable, x, y); + } + } + } +}
participants (1)
-
tchemit@users.labs.libre-entreprise.org