KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > shark > swingclient > workflowadmin > repository > actions > DeletePackage


1 package org.enhydra.shark.swingclient.workflowadmin.repository.actions;
2
3 import java.awt.event.*;
4
5 import javax.swing.*;
6
7
8
9 import org.enhydra.shark.api.client.wfservice.*;
10 import org.enhydra.shark.swingclient.*;
11 import org.enhydra.shark.swingclient.workflowadmin.*;
12 import org.enhydra.shark.swingclient.workflowadmin.repository.*;
13
14 /**
15  * Deletes package from the engine's repository.
16  *
17  * @author Sasa Bojanic
18  * @version 1.0
19  */

20 public class DeletePackage extends ActionBase {
21
22    public DeletePackage(RepositoryManagement rpm) {
23       super(rpm);
24    }
25
26    public void actionPerformed(ActionEvent e) {
27       int r=JOptionPane.showConfirmDialog(actionPanel.getWindow(),
28             ResourceManager.
29                getLanguageDependentString("QuestionDoYouReallyWantToDeleteThePackageFileFromTheRepository"),
30             SharkClient.getAppTitle(),JOptionPane.YES_NO_OPTION);
31       if (r==JOptionPane.NO_OPTION) {
32          return;
33       }
34
35       RepositoryManagement rpm=(RepositoryManagement)actionPanel;
36       SharkAdmin workflowAdmin=rpm.getWorkflowAdmin();
37       try {
38          String JavaDoc path=rpm.getSelectedPackagePath();
39
40          SharkClient.getRepositoryManager().deletePackage(path);
41          rpm.refresh(true);
42       } catch (RepositoryInvalid ri){
43          JOptionPane.showMessageDialog(workflowAdmin.getFrame(),
44             ResourceManager.getLanguageDependentString("ErrorNotConnectedToTheServer"),
45             workflowAdmin.getAppTitle(),JOptionPane.ERROR_MESSAGE);
46          workflowAdmin.showXPDLErrorsReport(ri.getXPDLValidationErrors());
47       } catch (Exception JavaDoc be){
48          JOptionPane.showMessageDialog(workflowAdmin.getFrame(),
49             ResourceManager.getLanguageDependentString("ErrorTheSelectedPackageCannotBeDeletedAtTheMoment"),
50             workflowAdmin.getAppTitle(),JOptionPane.ERROR_MESSAGE);
51        }
52    }
53 }
54
55
Popular Tags