Skip to main content
summaryrefslogtreecommitdiffstats
blob: 9216d190aece7e323a1d0862093c8ada282195f0 (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
/*******************************************************************************
 * Copyright (c) 2000, 2003 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials 
 * are made available under the terms of the Common Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/cpl-v10.html
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.team.examples.filesystem.deployment;

import org.eclipse.core.resources.IResource;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.team.core.IDeploymentProviderManager;
import org.eclipse.team.core.Team;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ui.actions.TeamAction;
import org.eclipse.ui.IActionDelegate;

public class NullAction extends TeamAction implements IActionDelegate {

	public void run(IAction action) {
		MessageDialog.openQuestion(getShell(), "Action Run", "Action Run");
	}
	
	/* (non-Javadoc)
	 * @see org.eclipse.team.internal.ui.actions.TeamAction#isEnabled()
	 */
	protected boolean isEnabled() throws TeamException {
		IResource[] resources = getSelectedResources();
		if(resources.length == 1) {
			IResource resource = resources[0];
			IDeploymentProviderManager manager = Team.getDeploymentManager();
			if(! manager.getMappedTo(resource, FileSystemDeploymentProvider.ID)) {
				return false;
			}
		}
		return true;
	}
}

Back to the top