KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > internal > ui > commands > actions > ExecuteActionRequest


1 /*******************************************************************************
2  * Copyright (c) 2006, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.debug.internal.ui.commands.actions;
12
13 import org.eclipse.core.runtime.IStatus;
14 import org.eclipse.debug.internal.core.commands.DebugCommandRequest;
15 import org.eclipse.debug.internal.ui.DebugUIMessages;
16 import org.eclipse.debug.internal.ui.DebugUIPlugin;
17 import org.eclipse.jface.dialogs.MessageDialog;
18
19 /**
20  * Plain status collector for actions. Has no result.
21  *
22  * @since 3.3
23  *
24  */

25 public class ExecuteActionRequest extends DebugCommandRequest {
26     
27     private ICommandParticipant fParticipant = null;
28     
29     public ExecuteActionRequest(Object JavaDoc[] elements) {
30         super(elements);
31     }
32
33     public void done() {
34         if (fParticipant != null) {
35             fParticipant.requestDone(this);
36             fParticipant = null;
37         }
38         final IStatus status = getStatus();
39         if (status != null) {
40             switch (status.getSeverity()) {
41             case IStatus.ERROR:
42                 DebugUIPlugin.getStandardDisplay().asyncExec(new Runnable JavaDoc() {
43                     public void run() {
44                         MessageDialog.openError(DebugUIPlugin.getShell(), DebugUIMessages.DebugUITools_Error_1, status.getMessage());
45                     }
46                 });
47                 break;
48             case IStatus.WARNING:
49                 DebugUIPlugin.getStandardDisplay().asyncExec(new Runnable JavaDoc() {
50                     public void run() {
51                         MessageDialog.openWarning(DebugUIPlugin.getShell(), DebugUIMessages.DebugUITools_Error_1, status.getMessage());
52                     }
53                 });
54                 break;
55             case IStatus.INFO:
56                 DebugUIPlugin.getStandardDisplay().asyncExec(new Runnable JavaDoc() {
57                     public void run() {
58                         MessageDialog.openInformation(DebugUIPlugin.getShell(), DebugUIMessages.DebugUITools_Error_1, status.getMessage());
59                     }
60                 });
61                 break;
62             }
63         }
64     }
65     
66     public void setCommandParticipant(ICommandParticipant participant) {
67         fParticipant = participant;
68     }
69
70 }
71
Popular Tags