Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 112025
Collapse All | Expand All

(-)src/org/eclipse/team/internal/ui/synchronize/actions/ShowSynchronizeParticipantAction.java (-3 / +57 lines)
Lines 11-25 Link Here
11
package org.eclipse.team.internal.ui.synchronize.actions;
11
package org.eclipse.team.internal.ui.synchronize.actions;
12
12
13
import org.eclipse.jface.action.Action;
13
import org.eclipse.jface.action.Action;
14
import org.eclipse.jface.action.IAction;
15
import org.eclipse.jface.resource.CompositeImageDescriptor;
16
import org.eclipse.jface.util.IPropertyChangeListener;
17
import org.eclipse.jface.util.PropertyChangeEvent;
18
import org.eclipse.swt.graphics.ImageData;
19
import org.eclipse.swt.graphics.Point;
14
import org.eclipse.team.core.TeamException;
20
import org.eclipse.team.core.TeamException;
21
import org.eclipse.team.internal.ui.TeamUIPlugin;
15
import org.eclipse.team.internal.ui.Utils;
22
import org.eclipse.team.internal.ui.Utils;
16
import org.eclipse.team.internal.ui.synchronize.SynchronizeView;
23
import org.eclipse.team.internal.ui.synchronize.SynchronizeView;
24
import org.eclipse.team.ui.synchronize.AbstractSynchronizeParticipant;
25
import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
17
import org.eclipse.team.ui.synchronize.ISynchronizeParticipantReference;
26
import org.eclipse.team.ui.synchronize.ISynchronizeParticipantReference;
18
import org.eclipse.team.ui.synchronize.ISynchronizeView;
27
import org.eclipse.team.ui.synchronize.ISynchronizeView;
19
28
20
public class ShowSynchronizeParticipantAction extends Action {
29
public class ShowSynchronizeParticipantAction extends Action implements IPropertyChangeListener {
21
	
30
	
22
	private ISynchronizeParticipantReference fPage;
31
    private ISynchronizeParticipantReference fPage;
23
	private ISynchronizeView fView;
32
	private ISynchronizeView fView;
24
	
33
	
25
	public void run() {
34
	public void run() {
Lines 43-48 Link Here
43
		super(Utils.shortenText(SynchronizeView.MAX_NAME_LENGTH, ref.getDisplayName()), Action.AS_RADIO_BUTTON);
52
		super(Utils.shortenText(SynchronizeView.MAX_NAME_LENGTH, ref.getDisplayName()), Action.AS_RADIO_BUTTON);
44
		fPage = ref;
53
		fPage = ref;
45
		fView = view;
54
		fView = view;
46
		setImageDescriptor(ref.getDescriptor().getImageDescriptor());
55
        setImageDescriptor( new ParticipantOverlay( ref));
56
        
57
        try {
58
          fPage.getParticipant().addPropertyChangeListener( this);
59
        } catch( TeamException e) {
60
          Utils.handle(e);
61
        }
62
	}
63
    
64
	public void propertyChange( PropertyChangeEvent event) {
65
      if( AbstractSynchronizeParticipant.P_PINNED.equals( event.getProperty())) {
66
        setImageDescriptor(new ParticipantOverlay( fPage));
67
      }
68
	}
69
70
    
71
	private static final class ParticipantOverlay extends CompositeImageDescriptor {
72
	  private ISynchronizeParticipantReference ref;
73
74
      private ImageData overlayData = TeamUIPlugin.getImageDescriptor( "elcl16/pinned_ovr.gif").getImageData();
75
      private ImageData imageData;
76
77
      private ISynchronizeParticipant participant;
78
	  
79
	  private ParticipantOverlay( ISynchronizeParticipantReference ref) {
80
	    this.ref = ref;
81
        try {
82
          this.participant = ref.getParticipant();
83
          this.imageData = ref.getDescriptor().getImageDescriptor().getImageData();
84
        } catch( TeamException ex) {
85
          TeamUIPlugin.log(ex);
86
        }
87
	  }
88
	  
89
	  protected void drawCompositeImage( int width, int height) {
90
	    drawImage(this.imageData, 0, 0);
91
        if(this.participant.isPinned()) {
92
          drawImage(overlayData, this.imageData.width - overlayData.width, 0);
93
        }
94
	  }
95
	  
96
	  protected Point getSize() {
97
	    return new Point( this.imageData.width, this.imageData.height);
98
	  }
99
47
	}
100
	}
48
}
101
}
102
(-)icons/full/elcl16/pinned_ovr.gif (+2 lines)
Added Link Here
1
GIF89a³2]r6a.R'•>5›Xr¶I}µQ£Ê?Ÿ§nÿÿÿÿÿÿ!ù,"pÉE
2
šKsn&ÆVdA’¡F(™1œ²½J?E;

Return to bug 112025