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

Collapse All | Expand All

(-)Eclipse UI/org/eclipse/ui/internal/Workbench.java (+13 lines)
Lines 166-171 Link Here
166
import org.eclipse.ui.internal.themes.FontDefinition;
166
import org.eclipse.ui.internal.themes.FontDefinition;
167
import org.eclipse.ui.internal.themes.ThemeElementHelper;
167
import org.eclipse.ui.internal.themes.ThemeElementHelper;
168
import org.eclipse.ui.internal.themes.WorkbenchThemeManager;
168
import org.eclipse.ui.internal.themes.WorkbenchThemeManager;
169
import org.eclipse.ui.internal.tweaklets.GrabFocus;
170
import org.eclipse.ui.internal.tweaklets.Tweaklets;
169
import org.eclipse.ui.internal.util.PrefUtil;
171
import org.eclipse.ui.internal.util.PrefUtil;
170
import org.eclipse.ui.internal.util.Util;
172
import org.eclipse.ui.internal.util.Util;
171
import org.eclipse.ui.intro.IIntroManager;
173
import org.eclipse.ui.intro.IIntroManager;
Lines 1304-1309 Link Here
1304
1306
1305
		// initialize workbench single-click vs double-click behavior
1307
		// initialize workbench single-click vs double-click behavior
1306
		initializeSingleClickOption();
1308
		initializeSingleClickOption();
1309
		
1310
		StartupThreading.runWithoutExceptions(new StartupRunnable() {
1311
1312
			public void runWithException() {
1313
				((GrabFocus) Tweaklets.get(GrabFocus.class))
1314
						.init(getDisplay());
1315
			}
1316
		});
1317
		
1307
1318
1308
		// attempt to restore a previous workbench state
1319
		// attempt to restore a previous workbench state
1309
		try {
1320
		try {
Lines 2662-2667 Link Here
2662
		Platform.getExtensionRegistry().removeRegistryChangeListener(
2673
		Platform.getExtensionRegistry().removeRegistryChangeListener(
2663
				startupRegistryListener);
2674
				startupRegistryListener);
2664
2675
2676
		((GrabFocus) Tweaklets.get(GrabFocus.class)).dispose();
2677
		
2665
		// Bring down all of the services.
2678
		// Bring down all of the services.
2666
		serviceLocator.dispose();
2679
		serviceLocator.dispose();
2667
2680
(-)Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java (+13 lines)
Lines 100-105 Link Here
100
import org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants;
100
import org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants;
101
import org.eclipse.ui.internal.registry.PerspectiveDescriptor;
101
import org.eclipse.ui.internal.registry.PerspectiveDescriptor;
102
import org.eclipse.ui.internal.registry.UIExtensionTracker;
102
import org.eclipse.ui.internal.registry.UIExtensionTracker;
103
import org.eclipse.ui.internal.tweaklets.GrabFocus;
103
import org.eclipse.ui.internal.tweaklets.TabBehaviour;
104
import org.eclipse.ui.internal.tweaklets.TabBehaviour;
104
import org.eclipse.ui.internal.tweaklets.Tweaklets;
105
import org.eclipse.ui.internal.tweaklets.Tweaklets;
105
import org.eclipse.ui.internal.util.PrefUtil;
106
import org.eclipse.ui.internal.util.PrefUtil;
Lines 571-576 Link Here
571
			return;
572
			return;
572
		}
573
		}
573
574
575
        if (composite!=null && composite.isVisible()
576
        		&& !((GrabFocus)Tweaklets.get(GrabFocus.class)).grabFocusAllowed(part)) {
577
        	return;
578
        }
579
        
574
        // If zoomed, unzoom.
580
        // If zoomed, unzoom.
575
        zoomOutIfNecessary(part);
581
        zoomOutIfNecessary(part);
576
582
Lines 789-794 Link Here
789
        if (persp == null || !certifyPart(part)) {
795
        if (persp == null || !certifyPart(part)) {
790
			return;
796
			return;
791
		}
797
		}
798
        
799
        if (!((GrabFocus)Tweaklets.get(GrabFocus.class)).grabFocusAllowed(part)) {
800
        	return;
801
        }
792
802
793
        String label = null; // debugging only
803
        String label = null; // debugging only
794
        if (UIStats.isDebugging(UIStats.BRING_PART_TO_TOP)) {
804
        if (UIStats.isDebugging(UIStats.BRING_PART_TO_TOP)) {
Lines 1013-1018 Link Here
1013
     * Performs showing of the view in the given mode.
1023
     * Performs showing of the view in the given mode.
1014
     */
1024
     */
1015
    private void busyShowView(IViewPart part, int mode) {
1025
    private void busyShowView(IViewPart part, int mode) {
1026
        if (!((GrabFocus)Tweaklets.get(GrabFocus.class)).grabFocusAllowed(part)) {
1027
        	return;
1028
        }
1016
        if (mode == VIEW_ACTIVATE) {
1029
        if (mode == VIEW_ACTIVATE) {
1017
			activate(part);
1030
			activate(part);
1018
		} else if (mode == VIEW_VISIBLE) {
1031
		} else if (mode == VIEW_VISIBLE) {
(-)Eclipse (+32 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
12
package org.eclipse.ui.internal.tweaklets;
13
14
import org.eclipse.swt.widgets.Display;
15
import org.eclipse.ui.IWorkbenchPart;
16
17
/**
18
 * The tweaklet provider can prevent the workbench page from grabbing focus.
19
 * 
20
 * @since 3.3
21
 */
22
public abstract class GrabFocus {
23
	static {
24
		Tweaklets.setDefault(GrabFocus.class, new AllowGrabFocus());
25
	}
26
27
	public abstract boolean grabFocusAllowed(IWorkbenchPart part);
28
29
	public abstract void init(Display display);
30
31
	public abstract void dispose();
32
}
(-)Eclipse (+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
12
package org.eclipse.ui.internal.tweaklets;
13
14
import org.eclipse.swt.widgets.Display;
15
import org.eclipse.ui.IWorkbenchPart;
16
17
/**
18
 * @since 3.3
19
 * 
20
 */
21
public class AllowGrabFocus extends GrabFocus {
22
23
	/*
24
	 * (non-Javadoc)
25
	 * 
26
	 * @see org.eclipse.ui.internal.tweaklets.GrabFocusManager#allowGrabFocus(org.eclipse.ui.IWorkbenchPart)
27
	 */
28
	public boolean grabFocusAllowed(IWorkbenchPart part) {
29
		return true;
30
	}
31
32
	/*
33
	 * (non-Javadoc)
34
	 * 
35
	 * @see org.eclipse.ui.internal.tweaklets.GrabFocusManager#init(Display)
36
	 */
37
	public void init(Display display) {
38
	}
39
40
	/* (non-Javadoc)
41
	 * @see org.eclipse.ui.internal.tweaklets.GrabFocusManager#dispose()
42
	 */
43
	public void dispose() {
44
	}
45
}

Return to bug 85608