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

Collapse All | Expand All

(-)plugin.xml (+2 lines)
Lines 1321-1331 Link Here
1321
            description="%ShowAnnotationAction.tooltip"
1321
            description="%ShowAnnotationAction.tooltip"
1322
            categoryId="org.eclipse.team.cvs.ui.actionSet"
1322
            categoryId="org.eclipse.team.cvs.ui.actionSet"
1323
            name="%ShowAnnotationAction.name"
1323
            name="%ShowAnnotationAction.name"
1324
            defaultHandler="org.eclipse.team.internal.ccvs.ui.actions.ShowAnnotationAction"
1324
            id="org.eclipse.team.cvs.ui.showAnnotation"/>
1325
            id="org.eclipse.team.cvs.ui.showAnnotation"/>
1325
      <command
1326
      <command
1326
            description="%ShowHistoryAction.tooltip"
1327
            description="%ShowHistoryAction.tooltip"
1327
            categoryId="org.eclipse.team.cvs.ui.actionSet"
1328
            categoryId="org.eclipse.team.cvs.ui.actionSet"
1328
            name="%ShowHistoryAction.name"
1329
            name="%ShowHistoryAction.name"
1330
            defaultHandler="org.eclipse.team.internal.ccvs.ui.actions.ShowHistoryAction"
1329
            id="org.eclipse.team.cvs.ui.showHistory"/>
1331
            id="org.eclipse.team.cvs.ui.showHistory"/>
1330
      <command
1332
      <command
1331
            description="%AddAction.tooltip"
1333
            description="%AddAction.tooltip"
(-)src/org/eclipse/team/internal/ui/actions/TeamAction.java (-8 / +38 lines)
Lines 480-501 Link Here
480
		}
480
		}
481
		return null;
481
		return null;
482
	}
482
	}
483
483
	
484
	private void execute(IWorkbenchWindow activeWorkbenchWindow,
484
	public void setEnabled(Object evaluationContext) {
485
			IWorkbenchPart part, ISelection selection)
485
		IWorkbenchWindow activeWorkbenchWindow = (IWorkbenchWindow) HandlerUtil
486
			throws InvocationTargetException, InterruptedException {
486
				.getVariable(evaluationContext,
487
						ISources.ACTIVE_WORKBENCH_WINDOW_NAME);
488
		if (activeWorkbenchWindow != null) {
489
			ISelection selection = (ISelection) HandlerUtil.getVariable(
490
					evaluationContext, ISources.ACTIVE_CURRENT_SELECTION_NAME);
491
			if (selection == null) {
492
				selection = StructuredSelection.EMPTY;
493
			}
494
			IWorkbenchPart part = (IWorkbenchPart) HandlerUtil.getVariable(
495
					evaluationContext, ISources.ACTIVE_PART_NAME);
496
			updateSelection(activeWorkbenchWindow, part, selection);
497
		}
498
	}
499
	
500
	/**
501
	 * Allows subclasses to check for ResourceMappings or CVS related inputs.
502
	 * 
503
	 * @param input the editor input to consider for selection.
504
	 */
505
	protected void updateInput(IEditorInput input) {
506
		IFile file = ResourceUtil.getFile(input);
507
		if (file != null) {
508
			selectionChanged((IAction) null, new StructuredSelection(file));
509
		}
510
	}
511
	
512
	private void updateSelection(IWorkbenchWindow activeWorkbenchWindow,
513
			IWorkbenchPart part, ISelection selection) {
487
		// If the action is run from within an editor, try and find the
514
		// If the action is run from within an editor, try and find the
488
		// file for the given editor.
515
		// file for the given editor.
489
		if (part != null && part instanceof IEditorPart) {
516
		if (part != null && part instanceof IEditorPart) {
490
			IEditorInput input = ((IEditorPart) part).getEditorInput();
517
			IEditorInput input = ((IEditorPart) part).getEditorInput();
491
			IFile file = ResourceUtil.getFile(input);
518
			updateInput(input);
492
			if (file != null) {
493
				selectionChanged((IAction) null, new StructuredSelection(file));
494
			}
495
		} else {
519
		} else {
496
			// Fallback is to prime the action with the selection
520
			// Fallback is to prime the action with the selection
497
			selectionChanged((IAction) null, selection);
521
			selectionChanged((IAction) null, selection);
498
		}
522
		}
523
	}
524
525
	private void execute(IWorkbenchWindow activeWorkbenchWindow,
526
			IWorkbenchPart part, ISelection selection)
527
			throws InvocationTargetException, InterruptedException {
528
		updateSelection(activeWorkbenchWindow, part, selection);
499
		// Safe guard to ensure that the action is only run when enabled.
529
		// Safe guard to ensure that the action is only run when enabled.
500
		if (isEnabled()) {
530
		if (isEnabled()) {
501
			execute((IAction) null);
531
			execute((IAction) null);

Return to bug 303784