]>
git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdateAction.java
2 Java class UpdateAction is GUI for update spd file.
4 Copyright (c) 2006, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 package org
.tianocore
.packaging
;
15 import java
.awt
.BorderLayout
;
16 import java
.awt
.Dimension
;
17 import java
.awt
.Toolkit
;
19 import javax
.swing
.JFileChooser
;
20 import javax
.swing
.JOptionPane
;
21 import javax
.swing
.JPanel
;
22 import javax
.swing
.JFrame
;
23 import java
.awt
.GridLayout
;
26 import javax
.swing
.JButton
;
29 GUI for update spd file
31 @since PackageEditor 1.0
33 public class UpdateAction
extends JFrame
{
37 private JPanel jContentPane
= null;
39 private JButton jButton
= null;
41 private JButton jButton1
= null;
43 private JButton jButton2
= null;
45 private JButton jButton3
= null;
47 private JButton jButton4
= null;
49 private JButton jButton5
= null;
51 private JButton jButton6
= null;
53 private JButton jButton7
= null;
55 private SpdFileContents sfc
= null;
57 private JFrame pThis
= null; // @jve:decl-index=0:visual-constraint="322,10"
59 private JButton jButton8
= null;
61 private JButton jButton9
= null;
64 This is the default constructor
66 public UpdateAction(SpdFileContents sfc
) {
73 This method initializes this
77 private void initialize() {
78 this.setSize(300, 333);
79 this.setDefaultCloseOperation(javax
.swing
.WindowConstants
.DISPOSE_ON_CLOSE
);
80 this.setContentPane(getJContentPane());
81 this.setTitle("Please Choose an Action");
84 pThis
.setSize(new java
.awt
.Dimension(316,399));
88 Start the window at the center of screen
91 protected void centerWindow(int intWidth
, int intHeight
) {
92 Dimension d
= Toolkit
.getDefaultToolkit().getScreenSize();
93 this.setLocation((d
.width
- intWidth
) / 2, (d
.height
- intHeight
) / 2);
97 Start the window at the center of screen
100 protected void centerWindow() {
101 centerWindow(this.getSize().width
, this.getSize().height
);
105 This method initializes jContentPane
107 @return javax.swing.JPanel
109 private JPanel
getJContentPane() {
110 if (jContentPane
== null) {
111 GridLayout gridLayout
= new GridLayout();
112 gridLayout
.setRows(10);
113 gridLayout
.setColumns(1);
114 jContentPane
= new JPanel();
115 jContentPane
.setLayout(gridLayout
);
116 jContentPane
.add(getJButton8(), null);
117 jContentPane
.add(getJButton7(), null);
118 jContentPane
.add(getJButton6(), null);
119 jContentPane
.add(getJButton5(), null);
120 jContentPane
.add(getJButton4(), null);
121 jContentPane
.add(getJButton3(), null);
122 jContentPane
.add(getJButton2(), null);
123 jContentPane
.add(getJButton1(), null);
124 jContentPane
.add(getJButton(), null);
125 jContentPane
.add(getJButton9(), null);
131 This method initializes jButton
133 @return javax.swing.JButton
135 private JButton
getJButton() {
136 if (jButton
== null) {
137 jButton
= new JButton();
138 jButton
.setText("Save");
139 jButton
.addMouseListener(new java
.awt
.event
.MouseAdapter() {
140 public void mouseClicked(java
.awt
.event
.MouseEvent e
) {
141 JFileChooser chooser
= new JFileChooser(sfc
.getFile());
142 chooser
.setMultiSelectionEnabled(false);
144 int retval
= chooser
.showSaveDialog(frame
);
145 if (retval
== JFileChooser
.APPROVE_OPTION
) {
147 File theFile
= chooser
.getSelectedFile();
148 if (theFile
.exists()) {
149 int retVal
= JOptionPane
.showConfirmDialog(frame
, "Are you sure to replace the exising one?", "File Exists",
150 JOptionPane
.YES_NO_OPTION
);
151 if (retVal
== JOptionPane
.NO_OPTION
) {
157 } catch (Exception ee
) {
158 System
.out
.println(ee
.toString());
170 This method initializes jButton1
172 @return javax.swing.JButton
174 private JButton
getJButton1() {
175 if (jButton1
== null) {
176 jButton1
= new JButton();
177 jButton1
.setText("Update PCD Information");
178 jButton1
.addMouseListener(new java
.awt
.event
.MouseAdapter() {
179 public void mouseClicked(java
.awt
.event
.MouseEvent e
) {
180 ModalFrameUtil
.showAsModal(new UpdatePCD(sfc
), pThis
);
188 This method initializes jButton2
190 @return javax.swing.JButton
192 private JButton
getJButton2() {
193 if (jButton2
== null) {
194 jButton2
= new JButton();
195 jButton2
.setText("Update PPI Declarations");
196 jButton2
.addMouseListener(new java
.awt
.event
.MouseAdapter() {
197 public void mouseClicked(java
.awt
.event
.MouseEvent e
) {
198 ModalFrameUtil
.showAsModal(new UpdatePpi(sfc
), pThis
);
206 This method initializes jButton3
208 @return javax.swing.JButton
210 private JButton
getJButton3() {
211 if (jButton3
== null) {
212 jButton3
= new JButton();
213 jButton3
.setText("Update Protocol Declarations");
214 jButton3
.addMouseListener(new java
.awt
.event
.MouseAdapter() {
215 public void mouseClicked(java
.awt
.event
.MouseEvent e
) {
216 ModalFrameUtil
.showAsModal(new UpdateProtocols(sfc
), pThis
);
224 This method initializes jButton4
226 @return javax.swing.JButton
228 private JButton
getJButton4() {
229 if (jButton4
== null) {
230 jButton4
= new JButton();
231 jButton4
.setText("Update GUID Declarations");
232 jButton4
.addMouseListener(new java
.awt
.event
.MouseAdapter() {
233 public void mouseClicked(java
.awt
.event
.MouseEvent e
) {
234 ModalFrameUtil
.showAsModal(new UpdateGuids(sfc
), pThis
);
242 This method initializes jButton5
244 @return javax.swing.JButton
246 private JButton
getJButton5() {
247 if (jButton5
== null) {
248 jButton5
= new JButton();
249 jButton5
.setText("Update Package Headers");
250 jButton5
.addMouseListener(new java
.awt
.event
.MouseAdapter() {
251 public void mouseClicked(java
.awt
.event
.MouseEvent e
) {
252 ModalFrameUtil
.showAsModal(new UpdatePkgHeader(sfc
), pThis
);
260 This method initializes jButton6
262 @return javax.swing.JButton
264 private JButton
getJButton6() {
265 if (jButton6
== null) {
266 jButton6
= new JButton();
267 jButton6
.setText("Update MSA Files");
268 jButton6
.addMouseListener(new java
.awt
.event
.MouseAdapter() {
269 public void mouseClicked(java
.awt
.event
.MouseEvent e
) {
270 ModalFrameUtil
.showAsModal(new UpdateMsaFile(sfc
), pThis
);
278 This method initializes jButton7
280 @return javax.swing.JButton
282 private JButton
getJButton7() {
283 if (jButton7
== null) {
284 jButton7
= new JButton();
285 jButton7
.setText("Update Library Classes");
286 jButton7
.addMouseListener(new java
.awt
.event
.MouseAdapter() {
287 public void mouseClicked(java
.awt
.event
.MouseEvent e
) {
288 ModalFrameUtil
.showAsModal(new UpdateLibraryClass(sfc
), pThis
);
296 This method initializes jButton8
298 @return javax.swing.JButton
300 private JButton
getJButton8() {
301 if (jButton8
== null) {
302 jButton8
= new JButton();
303 jButton8
.setText("Update SPD Header");
304 jButton8
.addMouseListener(new java
.awt
.event
.MouseAdapter() {
305 public void mouseClicked(java
.awt
.event
.MouseEvent e
) {
306 ModalFrameUtil
.showAsModal(new UpdateNew(sfc
), pThis
);
313 private JButton
getJButton9() {
314 if (jButton9
== null) {
315 jButton9
= new JButton();
316 jButton9
.setText("Done");
317 jButton9
.addMouseListener(new java
.awt
.event
.MouseAdapter() {
318 public void mouseClicked(java
.awt
.event
.MouseEvent e
) {
328 } // @jve:decl-index=0:visual-constraint="104,41"