diff options
author | Uwe Stieber | 2012-07-09 13:34:29 +0000 |
---|---|---|
committer | Uwe Stieber | 2012-07-09 13:34:29 +0000 |
commit | b597943e493c505151baec6c896d9e41c2ee6bc0 (patch) | |
tree | a74670c8fcfc76d298a53eb630fa8bb80c017b43 | |
parent | 26bf458355aadaed7019466a5a1fe96158829f5c (diff) | |
download | org.eclipse.tcf-b597943e493c505151baec6c896d9e41c2ee6bc0.tar.gz org.eclipse.tcf-b597943e493c505151baec6c896d9e41c2ee6bc0.tar.xz org.eclipse.tcf-b597943e493c505151baec6c896d9e41c2ee6bc0.zip |
Target Explorer: Editor input objects can be adapted to peer model objects for expression evaluation
2 files changed, 74 insertions, 61 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.xml index 86ffbff65..082417f85 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.xml +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.xml @@ -11,6 +11,12 @@ <adapter type="org.eclipse.ui.IPersistableElement"/> <adapter type="org.eclipse.tcf.te.ui.views.interfaces.categories.ICategorizable"/> </factory> + + <factory + adaptableType="org.eclipse.ui.IEditorInput" + class="org.eclipse.tcf.te.tcf.ui.internal.adapters.AdapterFactory"> + <adapter type="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"/> + </factory> </extension> <!-- Element factory contributions --> diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/adapters/AdapterFactory.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/adapters/AdapterFactory.java index 4675e422e..3d8e2e0c1 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/adapters/AdapterFactory.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/adapters/AdapterFactory.java @@ -1,61 +1,68 @@ -/*******************************************************************************
- * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others. 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:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tcf.te.tcf.ui.internal.adapters;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
-import org.eclipse.tcf.te.tcf.ui.navigator.LabelProviderDelegate;
-import org.eclipse.tcf.te.ui.views.interfaces.categories.ICategorizable;
-import org.eclipse.ui.IPersistableElement;
-
-/**
- * Adapter factory implementation.
- */
-public class AdapterFactory implements IAdapterFactory {
- // The adapter for ILabelProvider.class
- private final LabelProviderDelegate labelProvider = new LabelProviderDelegate();
-
- // The adapter class.
- private Class<?>[] adapters = {
- ILabelProvider.class,
- IPersistableElement.class,
- ICategorizable.class
- };
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
- */
- @Override
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if (adaptableObject instanceof IPeerModel) {
- if (ILabelProvider.class.equals(adapterType)) {
- return labelProvider;
- }
- if (IPersistableElement.class.equals(adapterType)) {
- return new PersistablePeerModel((IPeerModel)adaptableObject);
- }
- if (ICategorizable.class.equals(adapterType)) {
- return new CategorizableAdapter(adaptableObject);
- }
-
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
- */
- @Override
- public Class[] getAdapterList() {
- return adapters;
- }
-
-}
+/******************************************************************************* + * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others. 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: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.tcf.ui.internal.adapters; + +import org.eclipse.core.runtime.IAdapterFactory; +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel; +import org.eclipse.tcf.te.tcf.ui.navigator.LabelProviderDelegate; +import org.eclipse.tcf.te.ui.views.interfaces.categories.ICategorizable; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IPersistableElement; + +/** + * Adapter factory implementation. + */ +public class AdapterFactory implements IAdapterFactory { + // The adapter for ILabelProvider.class + private final LabelProviderDelegate labelProvider = new LabelProviderDelegate(); + + // The adapter class. + private Class<?>[] adapters = { + ILabelProvider.class, + IPersistableElement.class, + ICategorizable.class, + IPeerModel.class + }; + + /* (non-Javadoc) + * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class) + */ + @Override + public Object getAdapter(Object adaptableObject, Class adapterType) { + if (adaptableObject instanceof IPeerModel) { + if (ILabelProvider.class.equals(adapterType)) { + return labelProvider; + } + if (IPersistableElement.class.equals(adapterType)) { + return new PersistablePeerModel((IPeerModel)adaptableObject); + } + if (ICategorizable.class.equals(adapterType)) { + return new CategorizableAdapter(adaptableObject); + } + + } + + if (adaptableObject instanceof IEditorInput) { + return ((IEditorInput)adaptableObject).getAdapter(adapterType); + } + + return null; + } + + /* (non-Javadoc) + * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList() + */ + @Override + public Class[] getAdapterList() { + return adapters; + } + +} |