/*******************************************************************************
 * Copyright (c) 2011 Oak Ridge National Laboratory.
 * 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
 ******************************************************************************/
package org.csstudio.diag.epics.pvtree;

import org.csstudio.csdata.ProcessVariable;
import org.eclipse.core.runtime.IAdapterFactory;

/** Adapter from PV Tree model to {@link ProcessVariable}
 *  @author Kay Kasemir
 */
public class PVTreeItemAdapter implements IAdapterFactory
{
    final private Class<?>[] targets = new  Class<?>[]
    {
        String.class,
        ProcessVariable.class
    };

    @Override
    public Class<?>[] getAdapterList()
    {
        return targets;
    }

    @SuppressWarnings("rawtypes")
    @Override
    public Object getAdapter(final Object adaptableObject, final Class adapterType)
    {
        final String pv_name = ((PVTreeItem)adaptableObject).getPVName();

        if (adapterType == String.class)
            return pv_name;
        else if (adapterType == ProcessVariable.class)
            return new ProcessVariable(pv_name);
        else
            return null;
    }
}

@@ -950,42 +950,8 @@
  %7D%0A%0A
-    @SuppressWarnings(%22rawtypes%22)%0A
     
@@ -971,22 +971,21 @@
  public 
-Object
+%3CT%3E T
  getAdap
@@ -1029,16 +1029,19 @@
 al Class
+%3CT%3E
  adapter
@@ -1126,17 +1126,16 @@
 Name();%0A
-%0A
         
@@ -1186,23 +1186,41 @@
  return 
+adapterType.cast(
 pv_name
+)
 ;%0A      
@@ -1287,16 +1287,33 @@
  return 
+adapterType.cast(
 new Proc
@@ -1324,32 +1324,33 @@
 ariable(pv_name)
+)
 ;%0A        else%0A 

Fix cast warning