KickJava   Java API By Example, From Geeks To Geeks.

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


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

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