/plugins/ProjectViewer/tags/pv_2_1_3_3/projectviewer/action/ReimportAction.java

# · Java · 63 lines · 20 code · 10 blank · 33 comment · 3 complexity · 7f82c09183ebdf7b2977d9a5663a9da3 MD5 · raw file

  1. /*
  2. * :tabSize=4:indentSize=4:noTabs=false:
  3. * :folding=explicit:collapseFolds=1:
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License
  7. * as published by the Free Software Foundation; either version 2
  8. * of the License, or any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18. */
  19. package projectviewer.action;
  20. //{{{ Imports
  21. import java.awt.event.ActionEvent;
  22. import org.gjt.sp.jedit.jEdit;
  23. import projectviewer.vpt.VPTNode;
  24. import projectviewer.importer.ReImporter;
  25. //}}}
  26. /**
  27. * Removes all the files below the root from a project, and then calls the
  28. * initial project importer.
  29. *
  30. * @author Marcelo Vanzin
  31. * @version $Id: ReimportAction.java 6333 2005-02-10 06:31:59Z vanza $
  32. */
  33. public class ReimportAction extends Action {
  34. public ReimportAction() {
  35. super("projectviewer_wrapper_reimport");
  36. }
  37. //{{{ getText() method
  38. /** Returns the text to be shown on the button and/or menu item. */
  39. public String getText() {
  40. return jEdit.getProperty("projectviewer.action.reimport");
  41. } //}}}
  42. //{{{ actionPerformed(ActionEvent) method
  43. /** Reimports files below the project root. */
  44. public void actionPerformed(ActionEvent ae) {
  45. VPTNode n = viewer.getSelectedNode();
  46. new ReImporter(n, viewer).doImport();
  47. } //}}}
  48. //{{{ prepareForNode(VPTNode) method
  49. /** Enable action only for the root node. */
  50. public void prepareForNode(VPTNode node) {
  51. cmItem.setVisible(node != null && (node.isProject() || node.isDirectory()));
  52. } //}}}
  53. }