01: /*******************************************************************************
02: * Copyright (c) 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.pde.internal.ui.editor.target;
11:
12: import org.eclipse.jface.action.Action;
13: import org.eclipse.jface.dialogs.MessageDialog;
14: import org.eclipse.jface.window.ApplicationWindow;
15: import org.eclipse.pde.internal.core.itarget.ITargetModel;
16: import org.eclipse.pde.internal.ui.PDEUIMessages;
17: import org.eclipse.swt.widgets.Shell;
18:
19: public class OpenTargetProfileAction extends Action {
20:
21: private ITargetModel fTargetModel;
22: private Shell fShell;
23: private String fTargetName;
24:
25: public OpenTargetProfileAction(Shell shell, ITargetModel model,
26: String targetName) {
27: fShell = shell;
28: fTargetModel = model;
29: fTargetName = targetName;
30: }
31:
32: public void run() {
33: if (fTargetModel == null) {
34: MessageDialog
35: .openError(
36: fShell,
37: PDEUIMessages.OpenTargetProfileAction_title,
38: PDEUIMessages.OpenTargetProfileAction_missingProfile);
39: return;
40: }
41:
42: if (!fTargetModel.isLoaded()) {
43: MessageDialog
44: .openError(
45: fShell,
46: PDEUIMessages.OpenTargetProfileAction_title,
47: PDEUIMessages.OpenTargetProfileAction_invalidProfile);
48: return;
49: }
50:
51: ApplicationWindow appWindow = new TargetProfileWindow(fShell,
52: fTargetModel, fTargetName);
53: appWindow.create();
54: appWindow.open();
55: }
56:
57: }
|