Package de.innovationgate.eclipse.wgadesigner.team

Source Code of de.innovationgate.eclipse.wgadesigner.team.WGAFSDesignResourceSyncInfoDecorator

/*******************************************************************************
* Copyright (c) 2009, 2010 Innovation Gate GmbH.
* 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:
*     Innovation Gate GmbH - initial API and implementation
******************************************************************************/
package de.innovationgate.eclipse.wgadesigner.team;

import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.viewers.ILabelDecorator;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;
import org.eclipse.team.core.synchronize.SyncInfo;
import org.eclipse.team.ui.synchronize.ISynchronizeModelElement;

import de.innovationgate.eclipse.wgadesigner.decorators.DesignFolderDecorator;
import de.innovationgate.eclipse.wgadesigner.decorators.NatureDecorator;

public class WGAFSDesignResourceSyncInfoDecorator extends LabelProvider implements ILabelDecorator {

  private DesignFolderDecorator _designFolderDecorator = new DesignFolderDecorator();
  private NatureDecorator _natureDecorator = new NatureDecorator();
 
  public Image decorateImage(Image image, Object element) {
    if(element instanceof ISynchronizeModelElement) {
        ISynchronizeModelElement node = (ISynchronizeModelElement)element;
        if(node instanceof IAdaptable) {
          SyncInfo info = (SyncInfo)((IAdaptable)node).getAdapter(SyncInfo.class);
          if (info != null) {
            Image result = null;
            IResource resource = info.getLocal();
            result = _designFolderDecorator.decorateImage(image, element);           
            if (result != null) {
              result = _natureDecorator.decorateImage(result, element);
            }
          }
        }
      }
      return image;
  }

  public String decorateText(String text, Object element) {
    return text;
  }
}
TOP

Related Classes of de.innovationgate.eclipse.wgadesigner.team.WGAFSDesignResourceSyncInfoDecorator

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.