Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 8f5e232f115422b4a7b24da28eefc0548ad6155b (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
package org.eclipse.debug.internal.ui;

/**********************************************************************
Copyright (c) 2000, 2002 IBM Corp.  All rights reserved.
This file is 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
**********************************************************************/
 
import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.debug.internal.ui.launchConfigurations.PersistableLaunchConfigurationFactory;
import org.eclipse.debug.internal.ui.launchConfigurations.PersistableLaunchConfigurationTypeFactory;
import org.eclipse.ui.IPersistableElement;

public class DebugUIAdapterFactory implements IAdapterFactory {

	/**
	 * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(Object, Class)
	 */
	public Object getAdapter(Object obj, Class adapterType) {
		if (adapterType.isInstance(obj)) {
			return obj;
		}
		
		if (adapterType == IPersistableElement.class) {
			if (obj instanceof ILaunchConfiguration) {
				return new PersistableLaunchConfigurationFactory((ILaunchConfiguration)obj);
			} else if (obj instanceof ILaunchConfigurationType) {
				return new PersistableLaunchConfigurationTypeFactory((ILaunchConfigurationType)obj);
			}
		}
		
		return null;
	}

	/**
	 * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
	 */
	public Class[] getAdapterList() {
		return new Class[] {IPersistableElement.class};
	}

}

Back to the top