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

Collapse All | Expand All

(-)Eclipse UI Tests/org/eclipse/ui/tests/dynamicplugins/DynamicPluginsTestSuite.java (+1 lines)
Lines 31-36 Link Here
31
	public DynamicPluginsTestSuite() {
31
	public DynamicPluginsTestSuite() {
32
	    addTest(new TestSuite(ActionSetTests.class));
32
	    addTest(new TestSuite(ActionSetTests.class));
33
		addTest(new TestSuite(ActivitySupportTests.class));
33
		addTest(new TestSuite(ActivitySupportTests.class));
34
		addTest(new TestSuite(BindingsExtensionDynamicTest.class));
34
		addTest(new TestSuite(BrowserTests.class));
35
		addTest(new TestSuite(BrowserTests.class));
35
		addTest(new TestSuite(PreferencePageTests.class));
36
		addTest(new TestSuite(PreferencePageTests.class));
36
		addTest(new TestSuite(KeywordTests.class));
37
		addTest(new TestSuite(KeywordTests.class));
(-)Eclipse UI Tests/org/eclipse/ui/tests/leaks/LeakTests.java (+3 lines)
Lines 61-66 Link Here
61
            }
61
            }
62
        }
62
        }
63
63
64
        if (!flag) {
65
        	System.out.println();
66
        }
64
        assertTrue("Reference not enqueued", flag);
67
        assertTrue("Reference not enqueued", flag);
65
    }
68
    }
66
69
(-)Eclipse (+145 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005 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.ui.tests.dynamicplugins;
12
13
import org.eclipse.core.commands.common.NotDefinedException;
14
import org.eclipse.jface.bindings.Binding;
15
import org.eclipse.jface.bindings.Scheme;
16
import org.eclipse.jface.bindings.TriggerSequence;
17
import org.eclipse.jface.bindings.keys.KeySequence;
18
import org.eclipse.jface.bindings.keys.ParseException;
19
import org.eclipse.jface.contexts.IContextIds;
20
import org.eclipse.ui.internal.IWorkbenchConstants;
21
import org.eclipse.ui.keys.IBindingService;
22
23
public class BindingsExtensionDynamicTest extends DynamicTestCase {
24
25
	public BindingsExtensionDynamicTest(String testName) {
26
		super(testName);
27
	}
28
29
	protected String getExtensionId() {
30
		return "bindingsExtensionDynamicTest.testDynamicBindingAddition";
31
	}
32
33
	protected String getExtensionPoint() {
34
		return IWorkbenchConstants.PL_BINDINGS;
35
	}
36
37
	protected String getInstallLocation() {
38
		return "data/org.eclipse.bindingsExtensionDynamicTest";
39
	}
40
41
	public void testBinding() throws ParseException {
42
		final IBindingService bindingService = (IBindingService) getWorkbench()
43
				.getAdapter(IBindingService.class);
44
		final TriggerSequence triggerSequence = KeySequence.getInstance("M1+W");
45
		Binding[] bindings;
46
		Scheme scheme;
47
		boolean found;
48
49
		found = false;
50
		bindings = bindingService.getBindings();
51
		if (bindings != null) {
52
			for (int i = 0; i < bindings.length; i++) {
53
				final Binding binding = bindings[i];
54
				if ("monkey".equals(binding.getSchemeId())
55
						&& IContextIds.CONTEXT_ID_WINDOW.equals(binding
56
								.getContextId())
57
						&& "org.eclipse.ui.views.showView".equals(binding
58
								.getParameterizedCommand().getId())
59
						&& binding.getParameterizedCommand().getParameterMap()
60
								.containsKey(
61
										"org.eclipse.ui.views.showView.viewId")
62
						&& binding.getPlatform() == null
63
						&& binding.getLocale() == null
64
						&& binding.getType() == Binding.SYSTEM
65
						&& triggerSequence.equals(binding.getTriggerSequence())) {
66
					found = true;
67
68
				}
69
			}
70
		}
71
		assertTrue(!found);
72
		scheme = bindingService.getScheme("monkey");
73
		try {
74
			scheme.getName();
75
			fail();
76
		} catch (final NotDefinedException e) {
77
			assertTrue(true);
78
		}
79
80
		getBundle();
81
82
		found = false;
83
		bindings = bindingService.getBindings();
84
		if (bindings != null) {
85
			for (int i = 0; i < bindings.length; i++) {
86
				final Binding binding = bindings[i];
87
				if ("monkey".equals(binding.getSchemeId())
88
						&& IContextIds.CONTEXT_ID_WINDOW.equals(binding
89
								.getContextId())
90
					&& "org.eclipse.ui.views.showView".equals(binding
91
								.getParameterizedCommand().getId())
92
						&& binding.getParameterizedCommand().getParameterMap()
93
								.containsKey(
94
										"org.eclipse.ui.views.showView.viewId")
95
						&& binding.getPlatform() == null
96
						&& binding.getLocale() == null
97
						&& binding.getType() == Binding.SYSTEM
98
						&& triggerSequence.equals(binding.getTriggerSequence())) {
99
					found = true;
100
101
				}
102
			}
103
		}
104
		assertTrue(found);
105
		scheme = bindingService.getScheme("monkey");
106
		try {
107
			assertTrue("Monkey".equals(scheme.getName()));
108
		} catch (final NotDefinedException e) {
109
			fail();
110
		}
111
112
		removeBundle();
113
114
		found = false;
115
		bindings = bindingService.getBindings();
116
		if (bindings != null) {
117
			for (int i = 0; i < bindings.length; i++) {
118
				final Binding binding = bindings[i];
119
				if ("monkey".equals(binding.getSchemeId())
120
						&& IContextIds.CONTEXT_ID_WINDOW.equals(binding
121
								.getContextId())
122
						&& "org.eclipse.ui.views.showView".equals(binding
123
								.getParameterizedCommand().getId())
124
						&& binding.getParameterizedCommand().getParameterMap()
125
								.containsKey(
126
										"org.eclipse.ui.views.showView.viewId")
127
						&& binding.getPlatform() == null
128
						&& binding.getLocale() == null
129
						&& binding.getType() == Binding.SYSTEM
130
						&& triggerSequence.equals(binding.getTriggerSequence())) {
131
					found = true;
132
133
				}
134
			}
135
		}
136
		assertTrue(!found);
137
		scheme = bindingService.getScheme("monkey");
138
		try {
139
			scheme.getName();
140
			fail();
141
		} catch (final NotDefinedException e) {
142
			assertTrue(true);
143
		}
144
	}
145
}
(-)data/org.eclipse.bindingsExtensionDynamicTest/plugin.xml (+28 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<?eclipse version="3.0"?>
3
<plugin
4
   id="bindingsExtensionDynamicTest"
5
   name="Bindings Extension Dynamic Test Plug-in"
6
   version="1.0.0">
7
   
8
   <requires>
9
      <import plugin="org.eclipse.ui"/>
10
   </requires>
11
12
   <extension
13
         id="testDynamicBindingAddition"
14
         point="org.eclipse.ui.bindings">
15
      <key
16
      		commandId="org.eclipse.ui.views.showView"
17
            sequence="M1+W"
18
            schemeId="monkey">
19
            <parameter
20
            	id="org.eclipse.ui.views.showView.viewId"
21
            	value="monkey" />
22
      </key>
23
      <scheme
24
            id="monkey"
25
            name="Monkey" />
26
   </extension> 
27
28
</plugin>

Return to bug 96600