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 173457 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/team/examples/filesystem/ui/SynchronizeAction.java (+7 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.team.examples.filesystem.ui;
11
package org.eclipse.team.examples.filesystem.ui;
12
12
13
import org.eclipse.core.commands.ExecutionEvent;
14
import org.eclipse.core.commands.ExecutionException;
13
import org.eclipse.core.resources.mapping.ResourceMapping;
15
import org.eclipse.core.resources.mapping.ResourceMapping;
14
import org.eclipse.jface.action.IAction;
16
import org.eclipse.jface.action.IAction;
15
import org.eclipse.team.core.subscribers.SubscriberScopeManager;
17
import org.eclipse.team.core.subscribers.SubscriberScopeManager;
Lines 38-41 Link Here
38
		participant.run(getTargetPart());
40
		participant.run(getTargetPart());
39
	}
41
	}
40
42
43
	public Object execute(ExecutionEvent event) throws ExecutionException {
44
		// TODO Auto-generated method stub
45
		return null;
46
	}
47
41
}
48
}
(-)src/org/eclipse/team/examples/filesystem/ui/PutAction.java (+7 lines)
Lines 12-17 Link Here
12
12
13
import java.lang.reflect.InvocationTargetException;
13
import java.lang.reflect.InvocationTargetException;
14
14
15
import org.eclipse.core.commands.ExecutionEvent;
16
import org.eclipse.core.commands.ExecutionException;
15
import org.eclipse.jface.action.IAction;
17
import org.eclipse.jface.action.IAction;
16
import org.eclipse.team.examples.filesystem.Policy;
18
import org.eclipse.team.examples.filesystem.Policy;
17
19
Lines 43-46 Link Here
43
	protected boolean isOverrideIncoming() {
45
	protected boolean isOverrideIncoming() {
44
		return false;
46
		return false;
45
	}
47
	}
48
49
	public Object execute(ExecutionEvent event) throws ExecutionException {
50
		// TODO Auto-generated method stub
51
		return null;
52
	}
46
}
53
}
(-)src/org/eclipse/team/examples/filesystem/ui/FileSystemAction.java (-1 / +1 lines)
Lines 27-33 Link Here
27
	/**
27
	/**
28
	 * @see org.eclipse.team.internal.ui.actions.TeamAction#isEnabled()
28
	 * @see org.eclipse.team.internal.ui.actions.TeamAction#isEnabled()
29
	 */
29
	 */
30
	protected boolean isEnabled() {
30
	public boolean isEnabled() {
31
		return getSelectedMappings().length > 0;
31
		return getSelectedMappings().length > 0;
32
	}
32
	}
33
33
(-)src/org/eclipse/team/examples/filesystem/ui/DisconnectAction.java (-6 / +7 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.team.examples.filesystem.ui;
11
package org.eclipse.team.examples.filesystem.ui;
12
12
13
import org.eclipse.core.commands.ExecutionEvent;
14
import org.eclipse.core.commands.ExecutionException;
13
import org.eclipse.core.resources.IProject;
15
import org.eclipse.core.resources.IProject;
14
import org.eclipse.jface.action.IAction;
16
import org.eclipse.jface.action.IAction;
15
import org.eclipse.jface.dialogs.ErrorDialog;
17
import org.eclipse.jface.dialogs.ErrorDialog;
Lines 36-46 Link Here
36
			ErrorDialog.openError(getShell(), Policy.bind("DisconnectAction.errorTitle"), null, e.getStatus()); //$NON-NLS-1$
38
			ErrorDialog.openError(getShell(), Policy.bind("DisconnectAction.errorTitle"), null, e.getStatus()); //$NON-NLS-1$
37
		} 
39
		} 
38
	}
40
	}
39
	
41
40
	/**
42
	public Object execute(ExecutionEvent event) throws ExecutionException {
41
	 * @see TeamAction#isEnabled()
43
		// TODO Auto-generated method stub
42
	 */
44
		return null;
43
	protected boolean isEnabled() {
44
		return true;
45
	}
45
	}
46
	
46
}
47
}
(-)src/org/eclipse/team/examples/filesystem/ui/MergeAction.java (+9 lines)
Lines 12-17 Link Here
12
12
13
import java.lang.reflect.InvocationTargetException;
13
import java.lang.reflect.InvocationTargetException;
14
14
15
import org.eclipse.core.commands.ExecutionEvent;
16
import org.eclipse.core.commands.ExecutionException;
15
import org.eclipse.jface.action.IAction;
17
import org.eclipse.jface.action.IAction;
16
import org.eclipse.team.ui.synchronize.ModelMergeOperation;
18
import org.eclipse.team.ui.synchronize.ModelMergeOperation;
17
19
Lines 25-30 Link Here
25
public class MergeAction extends FileSystemAction {
27
public class MergeAction extends FileSystemAction {
26
28
27
	public void run(IAction action) {
29
	public void run(IAction action) {
30
		System.out.println("MergeAction:run");
28
		try {
31
		try {
29
			ModelMergeOperation operation;
32
			ModelMergeOperation operation;
30
			if (isUseSyncFramework()) {
33
			if (isUseSyncFramework()) {
Lines 45-48 Link Here
45
	private boolean isUseSyncFramework() {
48
	private boolean isUseSyncFramework() {
46
		return true;
49
		return true;
47
	}
50
	}
51
52
	public Object execute(ExecutionEvent event) throws ExecutionException {
53
		System.out.println("MergeAction:run");
54
		// TODO Auto-generated method stub
55
		return null;
56
	}
48
}
57
}
(-)src/org/eclipse/team/examples/filesystem/ui/GetAction.java (+7 lines)
Lines 12-17 Link Here
12
12
13
import java.lang.reflect.InvocationTargetException;
13
import java.lang.reflect.InvocationTargetException;
14
14
15
import org.eclipse.core.commands.ExecutionEvent;
16
import org.eclipse.core.commands.ExecutionException;
15
import org.eclipse.jface.action.IAction;
17
import org.eclipse.jface.action.IAction;
16
import org.eclipse.team.examples.filesystem.Policy;
18
import org.eclipse.team.examples.filesystem.Policy;
17
19
Lines 41-44 Link Here
41
	protected boolean isOverwriteOutgoing() {
43
	protected boolean isOverwriteOutgoing() {
42
		return false;
44
		return false;
43
	}
45
	}
46
47
	public Object execute(ExecutionEvent event) throws ExecutionException {
48
		// TODO Auto-generated method stub
49
		return null;
50
	}
44
}
51
}
(-)src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java (-1 / +1 lines)
Lines 50-56 Link Here
50
 * facilities for enablement handling, standard error handling, selection
50
 * facilities for enablement handling, standard error handling, selection
51
 * retrieval and prompting.
51
 * retrieval and prompting.
52
 */
52
 */
53
abstract public class CVSAction extends TeamAction implements IEditorActionDelegate, IHandler {
53
abstract public class CVSAction extends TeamAction implements IEditorActionDelegate {
54
	
54
	
55
	private List accumulatedStatus = new ArrayList();
55
	private List accumulatedStatus = new ArrayList();
56
	private RetargetAction retargetAction;
56
	private RetargetAction retargetAction;
(-)plugin.properties (-7 / +24 lines)
Lines 23-39 Link Here
23
TextPreferencePage.name=File Content
23
TextPreferencePage.name=File Content
24
IgnorePreferencePage.name=Ignored Resources
24
IgnorePreferencePage.name=Ignored Resources
25
25
26
ConfigureProject.label=&Share Project...
26
ConfigureProject.label=Share Project...
27
ConfigureProject.tooltip=Share the project with others using a version and configuration management system.
27
ConfigureProject.tooltip=Share the project with others using a version and configuration management system.
28
ConfigureProject.mnemonic=S
28
29
29
ApplyPatch.label=Appl&y Patch...
30
ApplyPatch.label=Apply Patch...
30
ApplyPatch.tooltip=Apply a patch to one or more workspace projects.
31
ApplyPatch.tooltip=Apply a patch to one or more workspace projects.
32
ApplyPatch.mnemonic=y
31
Command.applyPatch.name=Apply Patch...
33
Command.applyPatch.name=Apply Patch...
32
Command.applyPatch.description=Apply a patch to one or more workspace projects.
34
Command.applyPatch.description=Apply a patch to one or more workspace projects.
33
35
34
ImportProjectSet.label=Import Project &Set...
36
ImportProjectSet.label=Import Project &Set...
35
37
36
TeamGroupMenu.label=T&eam
38
TeamGroupMenu.label=Team
39
TeamGroupMenu.mnemonic=e
37
Team.viewCategory=Team
40
Team.viewCategory=Team
38
41
39
Synchronizing.perspective=Team Synchronizing
42
Synchronizing.perspective=Team Synchronizing
Lines 60-65 Link Here
60
Command.syncLast.name=Repeat last synchronization
63
Command.syncLast.name=Repeat last synchronization
61
Command.syncLast.description=Repeat the last synchronization
64
Command.syncLast.description=Repeat the last synchronization
62
65
66
Command.importProjectSet.name=Import Project Set...
67
Command.importProjectSet.description=Import Project Set into the workspace
68
69
Command.showLocalHistory.name=Show Local History
70
Command.showLocalHistory.description=Show Local History
71
72
Command.compareLocalHistory.name=Local History...
73
Command.compareLocalHistory.description=Compare the Selected Resource with Local History
74
75
Command.configureProject.name=Share Project...
76
63
CompressFolderView.name=Compress Folders
77
CompressFolderView.name=Compress Folders
64
CompressFolderView.description=Compress in-sync folders paths
78
CompressFolderView.description=Compress in-sync folders paths
65
79
Lines 74-81 Link Here
74
EnabledModels = Models
88
EnabledModels = Models
75
Workspace=Workspace
89
Workspace=Workspace
76
90
77
ShowLocalHistory.label=Show Local &History
91
ShowLocalHistory.label=Show Local History
78
CompareLocalHistory.label= &Local History...
92
ShowLocalHistory.mnemonic=H
79
CompareLocalHistory.tooltip= Compare the Selected Resource with Local History
93
CompareLocalHistory.label=Local History...
80
ReplaceLocalHistory.label= &Local History...
94
CompareLocalHistory.tooltip=Compare the Selected Resource with Local History
95
CompareLocalHistory.mnemonic=L
96
ReplaceLocalHistory.label= Local History...
81
ReplaceLocalHistory.tooltip= Replace the Selected Resource with Local History
97
ReplaceLocalHistory.tooltip= Replace the Selected Resource with Local History
98
ReplaceLocalHistory.mnemonic=L
(-)plugin.xml (-24 / +238 lines)
Lines 49-55 Link Here
49
<!-- ****************** POPUP ACTIONS *************** -->
49
<!-- ****************** POPUP ACTIONS *************** -->
50
   <extension
50
   <extension
51
         point="org.eclipse.ui.popupMenus">
51
         point="org.eclipse.ui.popupMenus">
52
      <objectContribution
52
      <!--objectContribution
53
            objectClass="org.eclipse.core.resources.mapping.ResourceMapping"
53
            objectClass="org.eclipse.core.resources.mapping.ResourceMapping"
54
            adaptable="true"
54
            adaptable="true"
55
            id="org.eclipse.team.ui.ResourceContributions">
55
            id="org.eclipse.team.ui.ResourceContributions">
Lines 94-101 Link Here
94
                  name="projectGroup">
94
                  name="projectGroup">
95
            </separator>
95
            </separator>
96
         </menu>
96
         </menu>
97
      </objectContribution>
97
      </objectContribution-->
98
      <objectContribution
98
      <!--objectContribution
99
            objectClass="org.eclipse.core.resources.mapping.ResourceMapping"
99
            objectClass="org.eclipse.core.resources.mapping.ResourceMapping"
100
            adaptable="true"
100
            adaptable="true"
101
            id="org.eclipse.team.ui.ProjectContributions">
101
            id="org.eclipse.team.ui.ProjectContributions">
Lines 114-121 Link Here
114
           </adapt>
114
           </adapt>
115
           </not>
115
           </not>
116
         </enablement>
116
         </enablement>
117
      </objectContribution>        
117
      </objectContribution-->
118
      <objectContribution
118
      <!--objectContribution
119
            objectClass="org.eclipse.core.resources.IFile"
119
            objectClass="org.eclipse.core.resources.IFile"
120
            nameFilter="*.psf"
120
            nameFilter="*.psf"
121
            id="org.eclipse.team.ui.ProjectSetFileContributions">
121
            id="org.eclipse.team.ui.ProjectSetFileContributions">
Lines 126-151 Link Here
126
               enablesFor="*"
126
               enablesFor="*"
127
               id="nonbound.org.eclipse.team.ui.ImportProjectSetAction">
127
               id="nonbound.org.eclipse.team.ui.ImportProjectSetAction">
128
         </action>
128
         </action>
129
      </objectContribution>
129
      </objectContribution-->
130
      <objectContribution
130
      <objectContribution
131
            adaptable="true"
131
            adaptable="true"
132
            id="org.eclipse.team.ui.UnmanagedFileContributions"
132
            id="org.eclipse.team.ui.UnmanagedFileContributions"
133
            objectClass="org.eclipse.core.resources.IFile">
133
            objectClass="org.eclipse.core.resources.IFile">
134
         <action
134
         <!--action
135
               class="org.eclipse.team.internal.ui.history.ShowLocalHistory"
135
               class="org.eclipse.team.internal.ui.history.ShowLocalHistory"
136
               id="org.eclipse.team.ui.showLocalHistory"
136
               id="org.eclipse.team.ui.showLocalHistory"
137
               label="%ShowLocalHistory.label"
137
               label="%ShowLocalHistory.label"
138
               menubarPath="team.main/group4"
138
               menubarPath="team.main/group4"
139
               enablesFor="1"
139
               enablesFor="1"
140
               tooltip="%ShowLocalHistory.label"/>
140
               tooltip="%ShowLocalHistory.label"/-->
141
         <action
141
         <!--action
142
               class="org.eclipse.team.internal.ui.history.CompareLocalHistory"
142
               class="org.eclipse.team.internal.ui.history.CompareLocalHistory"
143
               id="org.eclipse.team.ui.compareLocalHistory"
143
               id="org.eclipse.team.ui.compareLocalHistory"
144
               label="%CompareLocalHistory.label"
144
               label="%CompareLocalHistory.label"
145
               menubarPath="compareWithMenu/compareWithGroup"
145
               menubarPath="compareWithMenu/compareWithGroup"
146
               enablesFor="1"
146
               enablesFor="1"
147
               overrideActionId="compareWithHistory"
147
               overrideActionId="compareWithHistory"
148
               tooltip="%CompareLocalHistory.tooltip"/>
148
               tooltip="%CompareLocalHistory.tooltip"/-->
149
         <action
149
         <action
150
               class="org.eclipse.team.internal.ui.history.ReplaceLocalHistory"
150
               class="org.eclipse.team.internal.ui.history.ReplaceLocalHistory"
151
               id="org.eclipse.team.ui.replaceLocalHistory"
151
               id="org.eclipse.team.ui.replaceLocalHistory"
Lines 285-308 Link Here
285
            id="org.eclipse.team.ui.category.team">
285
            id="org.eclipse.team.ui.category.team">
286
      </category>
286
      </category>
287
      <command
287
      <command
288
            name="%Command.syncAll.name"
289
            categoryId="org.eclipse.team.ui.category.team"
290
            description="%Command.syncAll.description"
291
            id="org.eclipse.team.ui.synchronizeAll">
292
      </command>
293
      <command
294
            name="%Command.syncLast.name"
288
            name="%Command.syncLast.name"
295
            categoryId="org.eclipse.team.ui.category.team"
289
            categoryId="org.eclipse.team.ui.category.team"
296
            description="%Command.syncLast.description"
290
            description="%Command.syncLast.description"
297
            id="org.eclipse.team.ui.synchronizeLast">
291
            id="org.eclipse.team.ui.synchronizeLast">
298
      </command>
292
      </command>
299
      <command
293
      <command
300
            name="%Command.applyPatch.name"
301
            categoryId="org.eclipse.team.ui.category.team"
302
            description="%Command.applyPatch.description"
303
            id="org.eclipse.team.ui.applyPatch">
304
      </command>
305
      <command
306
       		name="%Synchronizing.perspective"
294
       		name="%Synchronizing.perspective"
307
        	description="%Synchronizing.openPerspectiveDescription"
295
        	description="%Synchronizing.openPerspectiveDescription"
308
        	categoryId="org.eclipse.ui.category.perspectives"
296
        	categoryId="org.eclipse.ui.category.perspectives"
Lines 317-322 Link Here
317
            description="%ViewCommand.historyView.description"
305
            description="%ViewCommand.historyView.description"
318
            categoryId="org.eclipse.ui.category.views"
306
            categoryId="org.eclipse.ui.category.views"
319
            id="org.eclipse.team.ui.GenericHistoryView"/>
307
            id="org.eclipse.team.ui.GenericHistoryView"/>
308
      <!-- TZarna: added commands -->
309
      <command
310
            categoryId="org.eclipse.team.ui.category.team"
311
            defaultHandler="org.eclipse.team.internal.ui.actions.ApplyPatchAction"
312
            description="%Command.applyPatch.description"
313
            id="org.eclipse.team.ui.applyPatch"
314
            name="%Command.applyPatch.name">
315
      </command>
316
      <command
317
            categoryId="org.eclipse.team.ui.category.team"
318
            defaultHandler="org.eclipse.team.internal.ui.actions.ConfigureProjectAction"
319
            id="org.eclipse.team.ui.configureProject"
320
            name="%Command.configureProject.name">
321
      </command>
322
      <command
323
            categoryId="org.eclipse.team.ui.category.team"
324
            defaultHandler="org.eclipse.team.internal.ui.synchronize.actions.GlobalRefreshHandler"
325
            description="%Command.syncAll.description"
326
            id="org.eclipse.team.ui.synchronizeAll"
327
            name="%Command.syncAll.name">
328
      </command>
329
      <command
330
            categoryId="org.eclipse.team.ui.category.team"
331
            defaultHandler="org.eclipse.team.internal.ui.actions.ImportProjectSetAction"
332
            description="%Command.importProjectSet.description"
333
            id="org.eclipse.team.ui.importProjectSet"
334
            name="%Command.importProjectSet.name">
335
      </command>
336
      <command
337
            categoryId="org.eclipse.team.ui.category.team"
338
            defaultHandler="org.eclipse.team.internal.ui.history.ShowLocalHistory"
339
            description="%Command.showLocalHistory.description"
340
            id="org.eclipse.team.ui.showLocalHistory"
341
            name="%Command.showLocalHistory.name">
342
      </command>
343
      <command
344
            categoryId="org.eclipse.team.ui.category.team"
345
            defaultHandler="org.eclipse.team.internal.ui.history.CompareLocalHistory"
346
            description="%Command.compareLocalHistory.description"
347
            id="org.eclipse.team.ui.compareLocalHistory"
348
            name="%Command.compareLocalHistory.name">
349
      </command>
320
   </extension>
350
   </extension>
321
   
351
   
322
   <extension
352
   <extension
Lines 333-339 Link Here
333
            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/>
363
            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/>
334
   </extension>
364
   </extension>
335
<!-- action sets -->
365
<!-- action sets -->
336
   <extension
366
   <!--extension
337
         point="org.eclipse.ui.actionSets">
367
         point="org.eclipse.ui.actionSets">
338
      <actionSet
368
      <actionSet
339
            label="%Command.category.name"
369
            label="%Command.category.name"
Lines 366-372 Link Here
366
               menubarPath="project/additions"
396
               menubarPath="project/additions"
367
               tooltip="%ApplyPatch.tooltip"/>
397
               tooltip="%ApplyPatch.tooltip"/>
368
      </actionSet>
398
      </actionSet>
369
   </extension>
399
   </extension-->
370
   
400
   
371
 <!-- file modification validator -->
401
 <!-- file modification validator -->
372
   
402
   
Lines 494-497 Link Here
494
      </triggerPoint>
524
      </triggerPoint>
495
    </extension>
525
    </extension>
496
    
526
    
527
    <!-- *************** Menus **************** -->
528
    <extension
529
          point="org.eclipse.ui.menus">
530
       <menuContribution
531
             locationURI="menu:project?after=additions">
532
             <!-- always enabled -->
533
             <command
534
                   commandId="org.eclipse.team.ui.applyPatch"
535
                   label="%ApplyPatch.label"
536
                   mnemonic="%ApplyPatch.mnemonic"
537
                   style="push"
538
                   tooltip="%ApplyPatch.tooltip">
539
                <visibleWhen
540
                      checkEnabled="false">
541
                </visibleWhen>
542
             </command>
543
       </menuContribution>
544
       <menuContribution
545
             locationURI="menu:project?after=open.ext">
546
             <!-- enablement? -->
547
             <command
548
                   commandId="org.eclipse.team.ui.configureProject"
549
                   id="org.eclipse.team.ui.ConfigureProject"
550
                   label="%ConfigureProject.label"
551
                   mnemonic="%ConfigureProject.mnemonic"
552
                   style="push"
553
                   tooltip="%ConfigureProject.tooltip">
554
             </command>
555
       </menuContribution>
556
       <menuContribution
557
             locationURI="toolbar:org.eclipse.ui.main.toolbar">
558
          <toolbar
559
                id="whatever">
560
             <command
561
                   commandId="org.eclipse.team.ui.synchronizeAll"
562
                   icon="$nl$/icons/full/elcl16/synch_participants.gif"
563
                   label="%Command.syncAll.name"
564
                   style="pulldown">
565
             </command>
566
             </toolbar>
567
          <!--toolbar
568
                id="toolbar:org.eclipse.ui.main.toolbar?after=search">
569
                         <command
570
                   commandId="org.eclipse.team.ui.synchronizeAll2"
571
                   icon="$nl$/icons/full/elcl16/synch_participants.gif"
572
                   label="%Command.syncAll.name"
573
                   style="pulldown">
574
             </command>
575
          </toolbar-->
576
       </menuContribution>
577
       <menuContribution
578
             locationURI="popup:org.eclipse.ui.popup.any?after=team.main">
579
          <!-- should be enabled only for IFiles with *.psf extension, multiselection is allowed -->
580
          <command
581
                commandId="org.eclipse.team.ui.importProjectSet"
582
                label="%Command.importProjectSet.name"
583
                style="push">
584
          </command>
585
       </menuContribution>
586
       <menuContribution
587
             locationURI="popup:team.main?after=projectGroup">
588
          <command
589
                commandId="org.eclipse.team.ui.configureProject"
590
                id="nonbound.org.eclipse.team.ui.ConfigureProject"
591
                label="%ConfigureProject.label"
592
                mnemonic="%ConfigureProject.mnemonic"
593
                style="push"
594
                tooltip="%ConfigureProject.tooltip">
595
          </command>
596
       </menuContribution>
597
       <menuContribution
598
             locationURI="popup:org.eclipse.ui.popup.any">
599
             <menu
600
                   id="team.main"
601
                   label="%TeamGroupMenu.label"
602
                   mnemonic="%TeamGroupMenu.mnemonic">
603
                  <separator
604
                        name="group1"
605
                        visible="true">
606
            </separator>
607
            <separator
608
                  name="group2"
609
                  visible="true">
610
            </separator>
611
            <separator
612
                  name="group3"
613
                  visible="true">
614
            </separator>
615
            <separator
616
                  name="group4"
617
                  visible="true">
618
            </separator>
619
            <separator
620
                  name="group5"
621
                  visible="true">
622
            </separator>
623
            <separator
624
                  name="group6"
625
                  visible="true">
626
            </separator>
627
            <separator
628
                  name="group7"
629
                  visible="true">
630
            </separator>
631
            <separator
632
                  name="group8"
633
                  visible="true">
634
            </separator>
635
            <separator
636
                  name="group9"
637
                  visible="true">
638
            </separator>
639
            <separator
640
                  name="group10"
641
                  visible="true">
642
            </separator>
643
            <separator
644
                  name="targetGroup"
645
                  visible="true">
646
                  </separator>
647
    <separator
648
                  name="projectGroup"
649
                  visible="true">
650
            </separator>
651
            </menu>
652
       </menuContribution>
653
       <menuContribution
654
             locationURI="popup:compareWithMenu?after=compareWithGroup">
655
          <command
656
                commandId="org.eclipse.team.ui.compareLocalHistory"
657
                label="%CompareLocalHistory.label"
658
                style="push"
659
                tooltip="%CompareLocalHistory.tooltip">
660
          </command>
661
       </menuContribution>
662
       <menuContribution
663
             locationURI="popup:team.main?after=group4">
664
          <command
665
                commandId="org.eclipse.team.ui.showLocalHistory"
666
                label="%ShowLocalHistory.label"
667
                mnemonic="%ShowLocalHistory.mnemonic"
668
                style="push"
669
                >
670
          </command>
671
       </menuContribution>
672
       <menuContribution
673
             locationURI="popup:compareWithMenu?after=compareWithGroup">
674
          <command
675
                commandId="org.eclipse.team.ui.compareLocalHistory"
676
                label="%CompareLocalHistory.label"
677
                mnemonic="%CompareLocalHistory.mnemonic"
678
                style="push"
679
                tooltip="%CompareLocalHistory.tooltip">
680
          </command>
681
       </menuContribution>
682
    </extension>
683
    <extension
684
          point="org.eclipse.ui.handlers">
685
       <handler
686
             class="org.eclipse.team.internal.ui.actions.ApplyPatchAction"
687
             commandId="org.eclipse.team.ui.handler1">
688
       </handler>
689
       <handler
690
             class="org.eclipse.team.internal.ui.actions.ConfigureProjectAction"
691
             commandId="org.eclipse.team.ui.handler3">
692
       </handler>
693
       <handler
694
             class="org.eclipse.team.internal.ui.actions.ImportProjectSetAction"
695
             commandId="org.eclipse.team.ui.handler7">
696
       </handler>
697
       <handler
698
             class="org.eclipse.team.internal.ui.history.ShowLocalHistory"
699
             commandId="org.eclipse.team.ui.handler9">
700
       </handler>
701
       <handler
702
             class="org.eclipse.team.internal.ui.history.CompareLocalHistory"
703
             commandId="org.eclipse.team.ui.handler11">
704
       </handler>
705
       <handler
706
             class="org.eclipse.team.internal.ui.synchronize.actions.GlobalRefreshHandler"
707
             commandId="org.eclipse.team.ui.handler2">
708
       </handler>
709
    </extension>
710
    
497
</plugin>
711
</plugin>
(-)src/org/eclipse/team/internal/ui/actions/ImportProjectSetAction.java (-4 / +40 lines)
Lines 13-18 Link Here
13
import java.lang.reflect.InvocationTargetException;
13
import java.lang.reflect.InvocationTargetException;
14
import java.util.Iterator;
14
import java.util.Iterator;
15
15
16
import org.eclipse.core.commands.*;
16
import org.eclipse.core.resources.IFile;
17
import org.eclipse.core.resources.IFile;
17
import org.eclipse.core.runtime.IProgressMonitor;
18
import org.eclipse.core.runtime.IProgressMonitor;
18
import org.eclipse.core.runtime.IStatus;
19
import org.eclipse.core.runtime.IStatus;
Lines 21-40 Link Here
21
import org.eclipse.jface.dialogs.ErrorDialog;
22
import org.eclipse.jface.dialogs.ErrorDialog;
22
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
23
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
23
import org.eclipse.jface.operation.IRunnableWithProgress;
24
import org.eclipse.jface.operation.IRunnableWithProgress;
24
import org.eclipse.jface.viewers.ISelection;
25
import org.eclipse.jface.viewers.*;
25
import org.eclipse.jface.viewers.IStructuredSelection;
26
import org.eclipse.swt.widgets.Display;
26
import org.eclipse.swt.widgets.Display;
27
import org.eclipse.swt.widgets.Shell;
27
import org.eclipse.swt.widgets.Shell;
28
import org.eclipse.team.internal.ui.*;
28
import org.eclipse.team.internal.ui.*;
29
import org.eclipse.ui.IObjectActionDelegate;
29
import org.eclipse.ui.IObjectActionDelegate;
30
import org.eclipse.ui.IWorkbenchPart;
30
import org.eclipse.ui.IWorkbenchPart;
31
import org.eclipse.ui.actions.ActionDelegate;
31
import org.eclipse.ui.handlers.HandlerUtil;
32
32
33
public class ImportProjectSetAction extends ActionDelegate implements IObjectActionDelegate {
33
// XXX: do we need to extend TeamAction here? I think not, there's no
34
// functionality from TeamAction needed here
35
public class ImportProjectSetAction extends AbstractHandler implements IObjectActionDelegate {
34
	
36
	
35
	private IStructuredSelection fSelection;
37
	private IStructuredSelection fSelection;
36
	
38
	
37
	public void run(IAction action) {
39
	public void run(IAction action) {
40
		System.out.println("ImportProjectSetAction:run");
38
		final Shell shell= Display.getDefault().getActiveShell();
41
		final Shell shell= Display.getDefault().getActiveShell();
39
		try {
42
		try {
40
			new ProgressMonitorDialog(shell).run(true, true, new IRunnableWithProgress() {
43
			new ProgressMonitorDialog(shell).run(true, true, new IRunnableWithProgress() {
Lines 61-64 Link Here
61
	public void setActivePart(IAction action, IWorkbenchPart targetPart) {
64
	public void setActivePart(IAction action, IWorkbenchPart targetPart) {
62
	}
65
	}
63
66
67
	public Object execute(ExecutionEvent event) throws ExecutionException {
68
		System.out.println("ImportProjectSetAction:execute");
69
		
70
		final ITreeSelection treeSelection = ((ITreeSelection) HandlerUtil
71
				.getCurrentSelection(event));
72
73
		final Shell shell = Display.getDefault().getActiveShell();
74
		try {
75
			new ProgressMonitorDialog(shell).run(true, true,
76
					new IRunnableWithProgress() {
77
						public void run(IProgressMonitor monitor)
78
								throws InvocationTargetException,
79
								InterruptedException {
80
							Iterator iterator = treeSelection.iterator();
81
							while (iterator.hasNext()) {
82
								IFile file = (IFile) iterator.next();
83
								ProjectSetImporter.importProjectSet(file
84
										.getLocation().toString(), shell,
85
										monitor);
86
							}
87
						}
88
					});
89
		} catch (InvocationTargetException exception) {
90
			ErrorDialog.openError(shell, null, null, new Status(IStatus.ERROR,
91
					TeamUIPlugin.PLUGIN_ID, IStatus.ERROR,
92
					TeamUIMessages.ImportProjectSetAction_0, exception
93
							.getTargetException()));
94
		} catch (InterruptedException exception) {
95
		}
96
97
		return null;
98
	}
99
64
}
100
}
(-)src/org/eclipse/team/internal/ui/actions/ApplyPatchAction.java (-5 / +19 lines)
Lines 11-29 Link Here
11
package org.eclipse.team.internal.ui.actions;
11
package org.eclipse.team.internal.ui.actions;
12
12
13
import org.eclipse.compare.patch.ApplyPatchOperation;
13
import org.eclipse.compare.patch.ApplyPatchOperation;
14
import org.eclipse.core.commands.ExecutionEvent;
15
import org.eclipse.core.commands.ExecutionException;
14
import org.eclipse.core.resources.IResource;
16
import org.eclipse.core.resources.IResource;
15
import org.eclipse.jface.action.IAction;
17
import org.eclipse.jface.action.IAction;
16
import org.eclipse.swt.custom.BusyIndicator;
18
import org.eclipse.swt.custom.BusyIndicator;
17
import org.eclipse.swt.widgets.Display;
19
import org.eclipse.swt.widgets.Display;
18
import org.eclipse.team.core.TeamException;
19
20
20
public class ApplyPatchAction extends TeamAction {
21
public class ApplyPatchAction extends TeamAction {
21
22
22
	protected boolean isEnabled() throws TeamException {
23
		return true;
24
	}
25
	
26
	public void run(IAction action) {
23
	public void run(IAction action) {
24
		System.out.println("applyPatchAction:run");
27
		IResource[] resources = getSelectedResources();
25
		IResource[] resources = getSelectedResources();
28
		IResource resource = null;
26
		IResource resource = null;
29
		if (resources.length > 0) {
27
		if (resources.length > 0) {
Lines 33-36 Link Here
33
		BusyIndicator.showWhile(Display.getDefault(), op); 
31
		BusyIndicator.showWhile(Display.getDefault(), op); 
34
	}
32
	}
35
33
34
	public Object execute(ExecutionEvent event) throws ExecutionException {
35
		System.out.println("applyPatchAction:execute");
36
		
37
		IResource[] resources = getSelectedResources(event);
38
39
		IResource resource = null;
40
		if (resources.length > 0) {
41
			resource = resources[0];
42
		}
43
		ApplyPatchOperation op = new ApplyPatchOperation(getTargetPart(event),
44
				resource);
45
		BusyIndicator.showWhile(Display.getDefault(), op);
46
47
		return null;
48
	}
49
36
}
50
}
(-)src/org/eclipse/team/internal/ui/actions/TeamAction.java (-14 / +133 lines)
Lines 17-22 Link Here
17
import java.util.Iterator;
17
import java.util.Iterator;
18
import java.util.List;
18
import java.util.List;
19
19
20
import org.eclipse.core.commands.AbstractHandler;
21
import org.eclipse.core.commands.ExecutionEvent;
20
import org.eclipse.core.resources.*;
22
import org.eclipse.core.resources.*;
21
import org.eclipse.core.resources.mapping.ResourceMapping;
23
import org.eclipse.core.resources.mapping.ResourceMapping;
22
import org.eclipse.core.runtime.IAdaptable;
24
import org.eclipse.core.runtime.IAdaptable;
Lines 26-40 Link Here
26
import org.eclipse.jface.operation.IRunnableWithProgress;
28
import org.eclipse.jface.operation.IRunnableWithProgress;
27
import org.eclipse.jface.viewers.*;
29
import org.eclipse.jface.viewers.*;
28
import org.eclipse.swt.custom.BusyIndicator;
30
import org.eclipse.swt.custom.BusyIndicator;
29
import org.eclipse.swt.widgets.Display;
31
import org.eclipse.swt.widgets.*;
30
import org.eclipse.swt.widgets.Shell;
31
import org.eclipse.team.core.RepositoryProvider;
32
import org.eclipse.team.core.RepositoryProvider;
32
import org.eclipse.team.core.TeamException;
33
import org.eclipse.team.core.TeamException;
33
import org.eclipse.team.internal.core.TeamPlugin;
34
import org.eclipse.team.internal.core.TeamPlugin;
34
import org.eclipse.team.internal.ui.TeamUIPlugin;
35
import org.eclipse.team.internal.ui.TeamUIPlugin;
35
import org.eclipse.team.internal.ui.Utils;
36
import org.eclipse.team.internal.ui.Utils;
36
import org.eclipse.ui.*;
37
import org.eclipse.ui.*;
37
import org.eclipse.ui.actions.ActionDelegate;
38
import org.eclipse.ui.handlers.HandlerUtil;
38
import org.eclipse.ui.internal.LegacyResourceSupport;
39
import org.eclipse.ui.internal.LegacyResourceSupport;
39
40
40
/**
41
/**
Lines 46-52 Link Here
46
 * Team providers may also instantiate or subclass any of the  
47
 * Team providers may also instantiate or subclass any of the  
47
 * subclasses of TeamAction provided in this package.
48
 * subclasses of TeamAction provided in this package.
48
 */
49
 */
49
public abstract class TeamAction extends ActionDelegate implements IObjectActionDelegate, IViewActionDelegate, IWorkbenchWindowActionDelegate  {
50
public abstract class TeamAction extends AbstractHandler implements IObjectActionDelegate, IViewActionDelegate, IWorkbenchWindowActionDelegate, IActionDelegate2  {
50
	// The current selection
51
	// The current selection
51
	private IStructuredSelection selection;
52
	private IStructuredSelection selection;
52
	
53
	
Lines 135-140 Link Here
135
		return (IProject[]) projects.toArray(new IProject[projects.size()]);
136
		return (IProject[]) projects.toArray(new IProject[projects.size()]);
136
	}
137
	}
137
	
138
	
139
	protected IProject[] getSelectedProjects(ExecutionEvent event) {
140
		IResource[] selectedResources = getSelectedResources(event);
141
		if (selectedResources.length == 0)
142
			return new IProject[0];
143
		ArrayList projects = new ArrayList();
144
		for (int i = 0; i < selectedResources.length; i++) {
145
			IResource resource = selectedResources[i];
146
			if (resource.getType() == IResource.PROJECT) {
147
				projects.add(resource);
148
			}
149
		}
150
		return (IProject[]) projects.toArray(new IProject[projects.size()]);
151
	}
152
	
138
	/**
153
	/**
139
	 * Returns an array of the given class type c that contains all
154
	 * Returns an array of the given class type c that contains all
140
	 * instances of c that are either contained in the selection or
155
	 * instances of c that are either contained in the selection or
Lines 156-161 Link Here
156
		return Utils.getContributedResources(getSelection().toArray());
171
		return Utils.getContributedResources(getSelection().toArray());
157
	}
172
	}
158
	
173
	
174
	protected IResource[] getSelectedResources(ExecutionEvent event) {
175
		ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
176
		if (currentSelection == null
177
				|| !(currentSelection instanceof IStructuredSelection))
178
			currentSelection = StructuredSelection.EMPTY;
179
180
		return Utils
181
				.getContributedResources(((IStructuredSelection) currentSelection)
182
						.toArray());
183
	}
184
	
159
	protected IStructuredSelection getSelection() {
185
	protected IStructuredSelection getSelection() {
160
		if (selection == null)
186
		if (selection == null)
161
			selection = StructuredSelection.EMPTY;
187
			selection = StructuredSelection.EMPTY;
Lines 222-227 Link Here
222
			return window.getShell();
248
			return window.getShell();
223
		}
249
		}
224
	}
250
	}
251
	
252
	protected Shell getShell(ExecutionEvent event) {
253
		Shell shell = HandlerUtil.getActiveShell(event);
254
		if (shell != null) {
255
			return shell;
256
		} else if (HandlerUtil.getActivePart(event) != null) {
257
			return HandlerUtil.getActivePart(event).getSite().getShell();
258
		} else if (HandlerUtil.getActiveWorkbenchWindow(event) != null) {
259
			return HandlerUtil.getActiveWorkbenchWindow(event).getShell();
260
		} else {
261
			IWorkbench workbench = TeamUIPlugin.getPlugin().getWorkbench();
262
			if (workbench == null)
263
				return null;
264
			IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
265
			if (window == null)
266
				return null;
267
			return window.getShell();
268
		}
269
	}
270
	
225
	/**
271
	/**
226
	 * Convenience method for running an operation with progress and
272
	 * Convenience method for running an operation with progress and
227
	 * error feedback.
273
	 * error feedback.
Lines 262-267 Link Here
262
		}
308
		}
263
	}
309
	}
264
	
310
	
311
	/**
312
	 * Convenience method for running an operation with progress and error
313
	 * feedback.
314
	 * 
315
	 * @param runnable
316
	 *            the runnable which executes the operation
317
	 * @param problemMessage
318
	 *            the message to display in the case of errors
319
	 * @param progressKind
320
	 *            one of PROGRESS_BUSYCURSOR or PROGRESS_DIALOG
321
	 */
322
	final protected void run(final IRunnableWithProgress runnable,
323
			final String problemMessage, int progressKind, ExecutionEvent event) {
324
		final Exception[] exceptions = new Exception[] { null };
325
		switch (progressKind) {
326
		case PROGRESS_BUSYCURSOR:
327
			BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
328
				public void run() {
329
					try {
330
						runnable.run(new NullProgressMonitor());
331
					} catch (InvocationTargetException e) {
332
						exceptions[0] = e;
333
					} catch (InterruptedException e) {
334
						exceptions[0] = null;
335
					}
336
				}
337
			});
338
			break;
339
		default:
340
		case PROGRESS_DIALOG:
341
			try {
342
				new ProgressMonitorDialog(HandlerUtil.getActiveShell(event))
343
						.run(true, true, runnable);
344
			} catch (InvocationTargetException e) {
345
				exceptions[0] = e;
346
			} catch (InterruptedException e) {
347
				exceptions[0] = null;
348
			}
349
			break;
350
		}
351
		if (exceptions[0] != null) {
352
			handle(exceptions[0], null, problemMessage, event);
353
		}
354
	}
355
	
265
	/*
356
	/*
266
	 * Method declared on IActionDelegate.
357
	 * Method declared on IActionDelegate.
267
	 */
358
	 */
Lines 284-294 Link Here
284
	 * This method can be overridden by subclasses but should not be invoked by them.
375
	 * This method can be overridden by subclasses but should not be invoked by them.
285
	 */
376
	 */
286
	protected void setActionEnablement(IAction action) {
377
	protected void setActionEnablement(IAction action) {
287
		try {
378
//		try {
288
			action.setEnabled(isEnabled());
379
			action.setEnabled(isEnabled());
289
		} catch (TeamException e) {
380
//		} catch (TeamException e) {
290
			action.setEnabled(isEnabledForException(e));
381
//			action.setEnabled(isEnabledForException(e));
291
		}
382
//		}
292
	}
383
	}
293
	
384
	
294
	/**
385
	/**
Lines 328-340 Link Here
328
	}
419
	}
329
	
420
	
330
	/**
421
	/**
331
	 * Concrete action enablement code.
422
	 * Shows the given errors to the user.
332
	 * Subclasses must implement.
333
	 * 
423
	 * 
334
	 * @return whether the action is enabled
424
	 * @param exception
335
	 * @throws TeamException if an error occurs during enablement detection
425
	 *            the status containing the error
336
	 */
426
	 * @param title
337
	abstract protected boolean isEnabled() throws TeamException;
427
	 *            the title of the error dialog
428
	 * @param message
429
	 *            the message for the error dialog
430
	 */
431
	protected void handle(Exception exception, String title, String message,
432
			ExecutionEvent event) {
433
		Utils.handleError(HandlerUtil.getActiveShell(event), exception, title,
434
				message);
435
	}
338
	
436
	
339
	/**
437
	/**
340
	 * Convenience method that maps the given resources to their providers.
438
	 * Convenience method that maps the given resources to their providers.
Lines 370-375 Link Here
370
        return targetPart;
468
        return targetPart;
371
469
372
	}
470
	}
471
	
472
	protected IWorkbenchPart getTargetPart(ExecutionEvent event) {
473
		return HandlerUtil.getActivePart(event);
474
	}
373
475
374
	/**
476
	/**
375
	 * Return the path that was active when the menu item was selected.
477
	 * Return the path that was active when the menu item was selected.
Lines 422-425 Link Here
422
		}
524
		}
423
        selection = null;
525
        selection = null;
424
	}
526
	}
527
	
528
    /**
529
     * The <code>TeamAction</code> implementation of this
530
     * <code>IActionDelegate2</code> method does nothing. Subclasses may
531
     * reimplement.
532
     */
533
    public void init(IAction action) {
534
    }
535
    
536
    /**
537
     * The <code>TeamAction</code> implementation of this
538
     * <code>IActionDelegate2</code> method redirects to the <code>run</code>
539
     * method. Subclasses may reimplement.
540
     */
541
    public void runWithEvent(IAction action, Event event) {
542
        run(action);
543
    }
425
}
544
}
(-)src/org/eclipse/team/internal/ui/actions/ConfigureProjectAction.java (-8 / +30 lines)
Lines 13-18 Link Here
13
 
13
 
14
import java.lang.reflect.InvocationTargetException;
14
import java.lang.reflect.InvocationTargetException;
15
15
16
import org.eclipse.core.commands.ExecutionEvent;
17
import org.eclipse.core.commands.ExecutionException;
16
import org.eclipse.core.resources.IProject;
18
import org.eclipse.core.resources.IProject;
17
import org.eclipse.core.runtime.IProgressMonitor;
19
import org.eclipse.core.runtime.IProgressMonitor;
18
import org.eclipse.jface.action.IAction;
20
import org.eclipse.jface.action.IAction;
Lines 21-27 Link Here
21
import org.eclipse.jface.wizard.WizardDialog;
23
import org.eclipse.jface.wizard.WizardDialog;
22
import org.eclipse.swt.SWT;
24
import org.eclipse.swt.SWT;
23
import org.eclipse.swt.widgets.Shell;
25
import org.eclipse.swt.widgets.Shell;
24
import org.eclipse.team.core.RepositoryProvider;
25
import org.eclipse.team.internal.ui.TeamUIMessages;
26
import org.eclipse.team.internal.ui.TeamUIMessages;
26
import org.eclipse.team.internal.ui.wizards.ConfigureProjectWizard;
27
import org.eclipse.team.internal.ui.wizards.ConfigureProjectWizard;
27
import org.eclipse.ui.IWorkbenchWindow;
28
import org.eclipse.ui.IWorkbenchWindow;
Lines 44-49 Link Here
44
	 * Method declared on IActionDelegate.
45
	 * Method declared on IActionDelegate.
45
	 */
46
	 */
46
	public void run(IAction action) {
47
	public void run(IAction action) {
48
		System.out.println("ConfigureProjectAction:run");
47
		run(new IRunnableWithProgress() {
49
		run(new IRunnableWithProgress() {
48
			public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
50
			public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
49
				try {
51
				try {
Lines 62-78 Link Here
62
	/**
64
	/**
63
	 * @see TeamAction#isEnabled()
65
	 * @see TeamAction#isEnabled()
64
	 */
66
	 */
65
	protected boolean isEnabled() {
67
//	public boolean isEnabled() {
66
		IProject[] selectedProjects = getSelectedProjects();
68
//		IProject[] selectedProjects = getSelectedProjects();
67
		if (selectedProjects.length != 1) return false;
69
//		if (selectedProjects.length != 1) return false;
68
		if (!selectedProjects[0].isAccessible()) return false;
70
//		if (!selectedProjects[0].isAccessible()) return false;
69
		if (!RepositoryProvider.isShared(selectedProjects[0])) return true;
71
//		if (!RepositoryProvider.isShared(selectedProjects[0])) return true;
70
		return false;
72
//		return false;
71
	}
73
//	}
72
	
74
	
73
	/* (non-Javadoc)
75
	/* (non-Javadoc)
74
	 * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
76
	 * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
75
	 */
77
	 */
76
	public void init(IWorkbenchWindow window) {
78
	public void init(IWorkbenchWindow window) {
77
	}
79
	}
80
	
81
	public Object execute(final ExecutionEvent event) throws ExecutionException {
82
		System.out.println("ConfigureProjectAction:execute");
83
		run(new IRunnableWithProgress() {
84
			public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
85
				try {
86
					IProject project = getSelectedProjects(event)[0];
87
					ConfigureProjectWizard wizard = new ConfigureProjectWizard();
88
					wizard.init(null, project);
89
					WizardDialog dialog = new ResizeWizardDialog(getShell(event), wizard);
90
					//dialog.
91
					dialog.open();
92
				} catch (Exception e) {
93
					throw new InvocationTargetException(e);
94
				}
95
			}
96
		}, TeamUIMessages.ConfigureProjectAction_configureProject, TeamAction.PROGRESS_BUSYCURSOR,event); 
97
98
		return null;
99
	}
78
}
100
}
(-)src/org/eclipse/team/internal/ui/history/ShowLocalHistory.java (-4 / +62 lines)
Lines 12-40 Link Here
12
12
13
import java.lang.reflect.InvocationTargetException;
13
import java.lang.reflect.InvocationTargetException;
14
14
15
import org.eclipse.core.commands.*;
15
import org.eclipse.core.resources.*;
16
import org.eclipse.core.resources.*;
16
import org.eclipse.core.runtime.*;
17
import org.eclipse.core.runtime.*;
17
import org.eclipse.jface.action.IAction;
18
import org.eclipse.jface.action.IAction;
18
import org.eclipse.jface.dialogs.ErrorDialog;
19
import org.eclipse.jface.dialogs.ErrorDialog;
19
import org.eclipse.jface.dialogs.MessageDialog;
20
import org.eclipse.jface.dialogs.MessageDialog;
20
import org.eclipse.jface.operation.IRunnableWithProgress;
21
import org.eclipse.jface.operation.IRunnableWithProgress;
21
import org.eclipse.jface.viewers.ISelection;
22
import org.eclipse.jface.viewers.*;
22
import org.eclipse.jface.viewers.IStructuredSelection;
23
import org.eclipse.swt.widgets.Shell;
23
import org.eclipse.swt.widgets.Shell;
24
import org.eclipse.team.internal.ui.TeamUIMessages;
24
import org.eclipse.team.internal.ui.TeamUIMessages;
25
import org.eclipse.team.internal.ui.TeamUIPlugin;
25
import org.eclipse.team.internal.ui.TeamUIPlugin;
26
import org.eclipse.team.internal.ui.actions.TeamAction;
26
import org.eclipse.team.ui.TeamUI;
27
import org.eclipse.team.ui.TeamUI;
27
import org.eclipse.team.ui.history.IHistoryPage;
28
import org.eclipse.team.ui.history.IHistoryPage;
28
import org.eclipse.team.ui.history.IHistoryView;
29
import org.eclipse.team.ui.history.IHistoryView;
29
import org.eclipse.ui.*;
30
import org.eclipse.ui.*;
30
import org.eclipse.ui.actions.ActionDelegate;
31
import org.eclipse.ui.handlers.HandlerUtil;
31
32
32
public class ShowLocalHistory extends ActionDelegate implements IObjectActionDelegate {
33
public class ShowLocalHistory extends TeamAction implements IObjectActionDelegate {
33
34
34
	private IStructuredSelection fSelection;
35
	private IStructuredSelection fSelection;
35
	private IWorkbenchPart targetPart;
36
	private IWorkbenchPart targetPart;
36
	
37
	
37
	public void run(IAction action) {
38
	public void run(IAction action) {
39
		System.out.println("ShowLocalHistoryHandler:run");
38
		IFileState states[]= getLocalHistory();
40
		IFileState states[]= getLocalHistory();
39
		if (states == null || states.length == 0)
41
		if (states == null || states.length == 0)
40
			return;
42
			return;
Lines 84-89 Link Here
84
		return fSelection;
86
		return fSelection;
85
	}
87
	}
86
	
88
	
89
	public IStructuredSelection getSelection(ExecutionEvent event) {
90
//		return fSelection;
91
		ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
92
		if (currentSelection == null
93
				|| !(currentSelection instanceof IStructuredSelection))
94
			currentSelection = StructuredSelection.EMPTY;
95
		
96
		return (IStructuredSelection) currentSelection;
97
	}
98
	
87
	protected IFileState[] getLocalHistory() {
99
	protected IFileState[] getLocalHistory() {
88
		final IFile file = (IFile) getSelection().getFirstElement();
100
		final IFile file = (IFile) getSelection().getFirstElement();
89
		IFileState states[];
101
		IFileState states[];
Lines 100-108 Link Here
100
		}
112
		}
101
		return states;
113
		return states;
102
	}
114
	}
115
	
116
	protected IFileState[] getLocalHistory(ExecutionEvent event) {
117
		final IFile file = (IFile) getSelection(event).getFirstElement();
118
		IFileState states[];
119
		try {
120
			states= file.getHistory(null);
121
		} catch (CoreException ex) {		
122
			MessageDialog.openError(getShell(event), getPromptTitle(), ex.getMessage());
123
			return null;
124
		}
125
		
126
		if (states == null || states.length <= 0) {
127
			MessageDialog.openInformation(getShell(event), getPromptTitle(), TeamUIMessages.ShowLocalHistory_0);
128
			return states;
129
		}
130
		return states;
131
	}
103
132
104
	protected String getPromptTitle() {
133
	protected String getPromptTitle() {
105
		return TeamUIMessages.ShowLocalHistory_2;
134
		return TeamUIMessages.ShowLocalHistory_2;
106
	}
135
	}
107
136
137
	public Object execute(final ExecutionEvent event) throws ExecutionException {
138
		System.out.println("ShowLocalHistoryHandler:execute");
139
		IFileState states[]= getLocalHistory(event);
140
		if (states == null || states.length == 0)
141
			return null;
142
		try {
143
			PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
144
				public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
145
					final IResource resource = (IResource) getSelection(event).getFirstElement();
146
					Runnable r = new Runnable() {
147
						public void run() {
148
							IHistoryView view = TeamUI.showHistoryFor(TeamUIPlugin.getActivePage(), resource,  LocalHistoryPageSource.getInstance());
149
							IHistoryPage page = view.getHistoryPage();
150
							if (page instanceof LocalHistoryPage){
151
								LocalHistoryPage historyPage = (LocalHistoryPage) page;
152
								historyPage.setClickAction(isCompare());
153
							}
154
						}
155
					};
156
					TeamUIPlugin.getStandardDisplay().asyncExec(r);				
157
				}
158
			});
159
		} catch (InvocationTargetException exception) {
160
			ErrorDialog.openError(getShell(event), null, null, new Status(IStatus.ERROR, TeamUIPlugin.PLUGIN_ID, IStatus.ERROR, TeamUIMessages.ShowLocalHistory_1, exception.getTargetException()));
161
		} catch (InterruptedException exception) {
162
		}
163
		return null;
164
	}
165
108
}
166
}
(-)src/org/eclipse/team/internal/ui/synchronize/actions/GlobalRefreshHandler.java (+24 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 * IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.team.internal.ui.synchronize.actions;
12
13
import org.eclipse.core.commands.*;
14
15
public class GlobalRefreshHandler extends AbstractHandler {
16
17
	public Object execute(ExecutionEvent event) throws ExecutionException {
18
		System.out.println("GlobalRefreshHandler:execute");
19
		
20
		// TODO Auto-generated method stub
21
		return null;
22
	}
23
24
}
(-)src/org/eclipse/team/ui/CompoundContributionItem2.java (+45 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 * IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.team.ui;
12
13
import java.util.ArrayList;
14
15
import org.eclipse.jface.action.*;
16
import org.eclipse.ui.actions.CompoundContributionItem;
17
import org.eclipse.ui.internal.WorkbenchMessages;
18
19
public class CompoundContributionItem2 extends CompoundContributionItem {
20
21
	public CompoundContributionItem2() {
22
		super();
23
	}
24
25
	public CompoundContributionItem2(String id) {
26
		super(id);
27
		// TODO Auto-generated constructor stub
28
	}
29
30
	protected IContributionItem[] getContributionItems() {
31
		ArrayList list = new ArrayList();
32
		
33
		String text = WorkbenchMessages.Workbench_noApplicableItems;
34
        Action dummyAction = new Action(text) {
35
            // dummy inner class; no methods
36
        };
37
        dummyAction.setEnabled(false);
38
        list.add(new ActionContributionItem(dummyAction));
39
        
40
        return (IContributionItem[]) list.toArray(new IContributionItem[list.size()]);
41
        
42
//        return null;
43
	}
44
45
}

Return to bug 173457