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.ShowResourceInHistoryAction"
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 / +41 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
	/* (non-Javadoc)
485
			IWorkbenchPart part, ISelection selection)
485
	 * @see org.eclipse.core.commands.AbstractHandler#setEnabled(java.lang.Object)
486
			throws InvocationTargetException, InterruptedException {
486
	 */
487
	public void setEnabled(Object evaluationContext) {
488
		IWorkbenchWindow activeWorkbenchWindow = (IWorkbenchWindow) HandlerUtil
489
				.getVariable(evaluationContext,
490
						ISources.ACTIVE_WORKBENCH_WINDOW_NAME);
491
		if (activeWorkbenchWindow != null) {
492
			ISelection selection = (ISelection) HandlerUtil.getVariable(
493
					evaluationContext, ISources.ACTIVE_CURRENT_SELECTION_NAME);
494
			if (selection == null) {
495
				selection = StructuredSelection.EMPTY;
496
			}
497
			IWorkbenchPart part = (IWorkbenchPart) HandlerUtil.getVariable(
498
					evaluationContext, ISources.ACTIVE_PART_NAME);
499
			updateSelection(activeWorkbenchWindow, part, selection);
500
		}
501
	}
502
	
503
	/**
504
	 * Allows subclasses to check for ResourceMappings or CVS related inputs.
505
	 * 
506
	 * @param input the editor input to consider for selection.
507
	 */
508
	protected void updateInput(IEditorInput input) {
509
		IFile file = ResourceUtil.getFile(input);
510
		if (file != null) {
511
			selectionChanged((IAction) null, new StructuredSelection(file));
512
		}
513
	}
514
	
515
	private void updateSelection(IWorkbenchWindow activeWorkbenchWindow,
516
			IWorkbenchPart part, ISelection selection) {
487
		// If the action is run from within an editor, try and find the
517
		// If the action is run from within an editor, try and find the
488
		// file for the given editor.
518
		// file for the given editor.
489
		if (part != null && part instanceof IEditorPart) {
519
		if (part != null && part instanceof IEditorPart) {
490
			IEditorInput input = ((IEditorPart) part).getEditorInput();
520
			IEditorInput input = ((IEditorPart) part).getEditorInput();
491
			IFile file = ResourceUtil.getFile(input);
521
			updateInput(input);
492
			if (file != null) {
493
				selectionChanged((IAction) null, new StructuredSelection(file));
494
			}
495
		} else {
522
		} else {
496
			// Fallback is to prime the action with the selection
523
			// Fallback is to prime the action with the selection
497
			selectionChanged((IAction) null, selection);
524
			selectionChanged((IAction) null, selection);
498
		}
525
		}
526
	}
527
528
	private void execute(IWorkbenchWindow activeWorkbenchWindow,
529
			IWorkbenchPart part, ISelection selection)
530
			throws InvocationTargetException, InterruptedException {
531
		updateSelection(activeWorkbenchWindow, part, selection);
499
		// Safe guard to ensure that the action is only run when enabled.
532
		// Safe guard to ensure that the action is only run when enabled.
500
		if (isEnabled()) {
533
		if (isEnabled()) {
501
			execute((IAction) null);
534
			execute((IAction) null);

Return to bug 303784