KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > debug > ui > actions > AddAdvancedAction


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 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.jdt.internal.debug.ui.actions;
12
13
14 import org.eclipse.jdt.internal.debug.ui.launcher.IClasspathViewer;
15 import org.eclipse.jdt.internal.debug.ui.launcher.RuntimeClasspathAdvancedDialog;
16 import org.eclipse.jface.action.IAction;
17 import org.eclipse.jface.dialogs.Dialog;
18
19 /**
20  * Opens a dialog to allow the user to choose among advanced actions.
21  */

22 public class AddAdvancedAction extends RuntimeClasspathAction {
23     
24     private IAction[] fActions;
25
26     public AddAdvancedAction(IClasspathViewer viewer, IAction[] actions) {
27         super(ActionMessages.AddAdvancedAction_Ad_vanced____1, viewer);
28         fActions = actions;
29         setViewer(viewer);
30     }
31
32     /**
33      * Prompts for a project to add.
34      *
35      * @see IAction#run()
36      */

37     public void run() {
38         Dialog dialog = new RuntimeClasspathAdvancedDialog(getShell(), fActions, getViewer());
39         dialog.open();
40     }
41         
42     /**
43      * @see RuntimeClasspathAction#setViewer(RuntimeClasspathViewer)
44      */

45     public void setViewer(IClasspathViewer viewer) {
46         super.setViewer(viewer);
47         if (fActions != null) {
48             for (int i = 0; i < fActions.length; i++) {
49                 if (fActions[i] instanceof RuntimeClasspathAction) {
50                     ((RuntimeClasspathAction)fActions[i]).setViewer(viewer);
51                 }
52             }
53         }
54     }
55     
56     protected int getActionType() {
57         return ADD;
58     }
59 }
60
Popular Tags