[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jboss-cvs-commits
Subject:    [jboss-cvs] contrib/jbosside/org.jboss.ide.eclipse.deployer.ui/src/org/jboss/ide/eclipse/deployer/ui
From:       Laurent Etiemble <letiemble () users ! sourceforge ! net>
Date:       2003-07-31 21:47:46
[Download RAW message or body]

  User: letiemble
  Date: 03/07/31 14:47:46

  Added:       jbosside/org.jboss.ide.eclipse.deployer.ui/src/org/jboss/ide/eclipse/deployer/ui/decorators
  DeployedDecorator.java
  Log:
  First iteration for the Deployer Plugin
  I18N to be done
  Javadoc to be completed
  Need for more tests
  
  Revision  Changes    Path
  1.1                  \
contrib/jbosside/org.jboss.ide.eclipse.deployer.ui/src/org/jboss/ide/eclipse/deployer/ui/decorators/DeployedDecorator.java
  
  Index: DeployedDecorator.java
  ===================================================================
  /*
   * Created on 31 juil. 03
   *
   * To change the template for this generated file go to
   * Window>Preferences>Java>Code Generation>Code and Comments
   */
  package org.jboss.ide.eclipse.deployer.ui.decorators;
  
  import java.util.Collection;
  import java.util.Iterator;
  import java.util.Vector;
  
  import org.eclipse.core.resources.IResource;
  import org.eclipse.core.runtime.CoreException;
  import org.eclipse.core.runtime.IAdaptable;
  import org.eclipse.jface.viewers.IDecoration;
  import org.eclipse.jface.viewers.ILabelProviderListener;
  import org.eclipse.jface.viewers.ILightweightLabelDecorator;
  import org.eclipse.jface.viewers.LabelProviderChangedEvent;
  import org.eclipse.ui.IDecoratorManager;
  import org.jboss.ide.eclipse.deployer.ui.DeployerUIImages;
  import org.jboss.ide.eclipse.deployer.ui.DeployerUIPlugin;
  import org.jboss.ide.eclipse.deployer.ui.IDeployerUIConstants;
  
  /**
   * @author    Laurent Etiemble
   * @created   31 juillet 2003
   * @version   $Revision: 1.1 $
   */
  public class DeployedDecorator implements ILightweightLabelDecorator
  {
     private Collection listeners = new Vector();
     /** Plugin Id of the decorator */
     public final static String DECORATOR_ID = \
"org.jboss.ide.eclipse.deployer.ui.decorators.DeployedDecorator";  
  
     /**Constructor for the DeployedDecorator object */
     public DeployedDecorator()
     {
        super();
     }
  
  
     /**
      * Adds a feature to the Listener attribute of the DeployedDecorator object
      *
      * @param listener  The feature to be added to the Listener attribute
      */
     public void addListener(ILabelProviderListener listener)
     {
        this.listeners.add(listener);
     }
  
  
     /**
      * Description of the Method
      *
      * @param element     Description of the Parameter
      * @param decoration  Description of the Parameter
      */
     public void decorate(Object element, IDecoration decoration)
     {
        IResource objectResource = getResource(element);
  
        if (objectResource == null)
        {
           return;
        }
  
        try
        {
           if (objectResource.getSessionProperty(IDeployerUIConstants.QNAME_TARGET) \
!= null)  {
              // decoration.addPrefix("<D> ");
              decoration.addOverlay(DeployerUIImages.getImageDescriptor(IDeployerUIConstants.IMG_OVR_DEPLOYED));
  }
        }
        catch (CoreException ce)
        {
        }
     }
  
  
     /** Description of the Method */
     public void dispose()
     {
     }
  
  
     /**
      * Gets the labelProperty attribute of the DeployedDecorator object
      *
      * @param element   Description of the Parameter
      * @param property  Description of the Parameter
      * @return          The labelProperty value
      */
     public boolean isLabelProperty(Object element, String property)
     {
        return false;
     }
  
  
     /**
      * Description of the Method
      *
      * @param resource  Description of the Parameter
      */
     public void refresh(IResource resource)
     {
        for (Iterator iterator = this.listeners.iterator(); iterator.hasNext(); )
        {
           ILabelProviderListener listener = (ILabelProviderListener) \
                iterator.next();
           listener.labelProviderChanged(new LabelProviderChangedEvent(this, \
resource));  }
     }
  
  
     /**
      * Description of the Method
      *
      * @param listener  Description of the Parameter
      */
     public void removeListener(ILabelProviderListener listener)
     {
        this.listeners.remove(listener);
     }
  
  
     /**
      * Returns the resource for the given input object, or
      * null if there is no resource associated with it.
      *
      * @param object  the object to find the resource for
      * @return        the resource for the given object, or null
      */
     private IResource getResource(Object object)
     {
        if (object instanceof IResource)
        {
           return (IResource) object;
        }
        if (object instanceof IAdaptable)
        {
           return (IResource) ((IAdaptable) object).getAdapter(IResource.class);
        }
        return null;
     }
  
  
     /**
      * Gets the demoDecorator attribute of the DeployedDecorator class
      *
      * @return   The demoDecorator value
      */
     public static DeployedDecorator getDemoDecorator()
     {
        IDecoratorManager decoratorManager = \
DeployerUIPlugin.getDefault().getWorkbench().getDecoratorManager();  
        if (decoratorManager.getEnabled(DECORATOR_ID))
        {
           return (DeployedDecorator) \
decoratorManager.getBaseLabelProvider(DECORATOR_ID);  }
        return null;
     }
  }
  
  
  


-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
jboss-cvs-commits mailing list
jboss-cvs-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-cvs-commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic