Skip to main content
summaryrefslogtreecommitdiffstats
blob: 876001028f65400c057593e4fd8cff7c987741bf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/***********************************************************************
 * Copyright (c) 2008 by SAP AG, Walldorf. 
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     SAP AG - initial API and implementation
 ***********************************************************************/
package org.eclipse.jst.jee.ui.internal.navigator.ear;

import org.eclipse.core.resources.IProject;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.preference.PreferenceDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.dialogs.PropertyDialog;

public class ShowDepPropPageAction implements IObjectActionDelegate
{

	private ISelection sel;	
	
    public void selectionChanged(IAction action, ISelection selection) {
        sel = selection;
    }

    public void setActivePart(IAction action, IWorkbenchPart targetPart) {
    }
	  
	public void run(IAction action) {
		if (sel == null){
			return;
		}
		Object selectedObject = ((IStructuredSelection) sel).getFirstElement();
		if (selectedObject instanceof ModulesNode) {
			IProject earProject = ((ModulesNode)selectedObject).getEarProject();
			PreferenceDialog dialog = PropertyDialog.createDialogOn(PlatformUI.getWorkbench().getActiveWorkbenchWindow().
                    getShell(), "org.eclipse.wst.common.componentcore.ui.DeploymentAssemblyPage", earProject); //$NON-NLS-1$
			if (dialog != null) {
				dialog.open();
			}
		}
	}
	
}

Back to the top