KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > ui > editor > target > OpenTargetProfileAction


1 /*******************************************************************************
2  * Copyright (c) 2006 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.pde.internal.ui.editor.target;
12
13 import org.eclipse.jface.action.Action;
14 import org.eclipse.jface.dialogs.MessageDialog;
15 import org.eclipse.jface.window.ApplicationWindow;
16 import org.eclipse.pde.internal.core.itarget.ITargetModel;
17 import org.eclipse.pde.internal.ui.PDEUIMessages;
18 import org.eclipse.swt.widgets.Shell;
19
20 public class OpenTargetProfileAction extends Action {
21
22     private ITargetModel fTargetModel;
23     private Shell fShell;
24     private String JavaDoc fTargetName;
25
26     public OpenTargetProfileAction(Shell shell, ITargetModel model, String JavaDoc targetName) {
27         fShell = shell;
28         fTargetModel = model;
29         fTargetName = targetName;
30     }
31     
32     public void run() {
33         if (fTargetModel == null) {
34             MessageDialog.openError(fShell, PDEUIMessages.OpenTargetProfileAction_title, PDEUIMessages.OpenTargetProfileAction_missingProfile);
35             return;
36         }
37         
38         if (!fTargetModel.isLoaded()) {
39             MessageDialog.openError(fShell, PDEUIMessages.OpenTargetProfileAction_title, PDEUIMessages.OpenTargetProfileAction_invalidProfile);
40             return;
41         }
42         
43         ApplicationWindow appWindow = new TargetProfileWindow(fShell, fTargetModel, fTargetName);
44         appWindow.create();
45         appWindow.open();
46     }
47
48 }
49
Popular Tags