[Patchanim-commit] SF.net SVN: patchanim: [187] trunk/patchanim
Brought to you by:
dbrosius
From: <dbr...@us...> - 2008-02-14 07:42:39
|
Revision: 187 http://patchanim.svn.sourceforge.net/patchanim/?rev=187&view=rev Author: dbrosius Date: 2008-02-13 23:42:44 -0800 (Wed, 13 Feb 2008) Log Message: ----------- add rename patch to context menu, and update doc Modified Paths: -------------- trunk/patchanim/htdocs/nameediting.jpg trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchListPanel.java trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties Modified: trunk/patchanim/htdocs/nameediting.jpg =================================================================== (Binary files differ) Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchListPanel.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchListPanel.java 2008-02-14 07:34:15 UTC (rev 186) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchListPanel.java 2008-02-14 07:42:44 UTC (rev 187) @@ -205,16 +205,7 @@ if (me.getClickCount() == 2) { CombinedPatch patch = (CombinedPatch)patchList.getSelectedValue(); if (patch != null) { - ResourceBundle rb = PatchAnimBundle.getBundle(); - String newName = JOptionPane.showInputDialog(JPatchListPanel.this, rb.getString(PatchAnimBundle.ENTERNEWPATCHNAME), patch.getName()); - if (newName != null) { - patch.setName(newName); - PatchPanelMediator mediator = PatchPanelMediator.getMediator(); - mediator.getDocument().setDirty(true); - patchList.invalidate(); - patchList.revalidate(); - patchList.repaint(); - } + renamePatch(patch); } } } @@ -235,9 +226,34 @@ }); } + private void renamePatch(CombinedPatch patch) { + if (patch != null) { + ResourceBundle rb = PatchAnimBundle.getBundle(); + String newName = JOptionPane.showInputDialog(JPatchListPanel.this, rb.getString(PatchAnimBundle.ENTERNEWPATCHNAME), patch.getName()); + if (newName != null) { + patch.setName(newName); + PatchPanelMediator mediator = PatchPanelMediator.getMediator(); + mediator.getDocument().setDirty(true); + patchList.invalidate(); + patchList.revalidate(); + patchList.repaint(); + } + } + } + private void showPatchListMenu(MouseEvent me) { ResourceBundle rb = PatchAnimBundle.getBundle(); JPopupMenu patchMenu = new JPopupMenu(); + JMenuItem renameItem = new JMenuItem(rb.getString(PatchAnimBundle.RENAME)); + renameItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent ae) { + CombinedPatch patch = (CombinedPatch)patchList.getSelectedValue(); + if (patch != null) { + renamePatch(patch); + } + } + }); + patchMenu.add(renameItem); JMenuItem cloneItem = new JMenuItem(rb.getString(PatchAnimBundle.CLONE)); cloneItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java 2008-02-14 07:34:15 UTC (rev 186) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java 2008-02-14 07:42:44 UTC (rev 187) @@ -69,6 +69,7 @@ public static final String ENTERNEWPATCHNAME = "patchanim.enternewpatchname"; public static final String ADD = "patchanim.add"; public static final String REMOVE = "patchanim.remove"; + public static final String RENAME = "patchanim.rename"; public static final String CLONE = "patchanim.clone"; public static final String COLOR = "patchanim.color"; public static final String SETALLPOINTS = "patchanim.setallpoints"; Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties 2008-02-14 07:34:15 UTC (rev 186) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties 2008-02-14 07:42:44 UTC (rev 187) @@ -62,6 +62,7 @@ patchanim.enternewpatchname = Rename Patch to patchanim.add = Add patchanim.remove = Remove +patchanim.rename = Rename patchanim.clone = Clone patchanim.color = Color patchanim.setallpoints = Set all control points to... This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |