View | Details | Raw Unified | Return to bug 298530
Collapse All | Expand All

(-)Eclipse (+49 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2009 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.tests;
13
14
import java.util.Arrays;
15
16
import junit.framework.Assert;
17
18
/**
19
 * Test helper methods
20
 */
21
public class TestUtils {
22
23
	/**
24
	 * To be replaced with Assert.assertArrayEquals in JUnit 4
25
	 */
26
	public static void assertArrayEquals(Object[] expecteds, Object[] actuals) {
27
		if (!Arrays.equals(expecteds, actuals)) {
28
			Assert.assertEquals(arrayToString(expecteds), arrayToString(actuals));
29
		}
30
	}
31
32
	/**
33
	 * To be replaced with Arrays.toString in Java 1.5
34
	 */
35
	public static String arrayToString(Object[] array) {
36
		StringBuffer buffer = new StringBuffer();
37
		if (array == null)
38
			buffer.append("null");
39
		else {
40
			buffer.append('[');
41
			for (int i = 0; i < array.length; i++) {
42
				buffer.append(array[i]);
43
				if (i != array.length - 1)
44
					buffer.append(',');
45
			}
46
		}
47
		return buffer.toString();
48
	}
49
}
(-)Eclipse (+28 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2009 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.tests.commands;
13
14
import org.eclipse.core.commands.AbstractHandler;
15
import org.eclipse.core.commands.ExecutionEvent;
16
17
public class CountingHandler extends AbstractHandler {
18
19
	public int executionCount = 0;
20
	public static CountingHandler lastExecutedHandler = null;
21
22
	public Object execute(ExecutionEvent event) {
23
		lastExecutedHandler = this;
24
		executionCount++;
25
		return null;
26
	}
27
28
}
(-)Eclipse UI Tests/org/eclipse/ui/tests/commands/HandlerActivationTest.java (-2 / +8 lines)
Lines 264-270 public class HandlerActivationTest extends UITestCase { Link Here
264
				CMD_ID, currentHandler, expression));
264
				CMD_ID, currentHandler, expression));
265
	}
265
	}
266
	
266
	
267
	
268
	public void testExceptionThrowingHandler(){
267
	public void testExceptionThrowingHandler(){
269
		
268
		
270
		try {
269
		try {
Lines 275-281 public class HandlerActivationTest extends UITestCase { Link Here
275
				fail("Unexpected exception while executing command", e);
274
				fail("Unexpected exception while executing command", e);
276
		}
275
		}
277
	}
276
	}
278
	
277
278
	public void testHandlerForAliasCommand() throws Exception {
279
		handlerService.executeCommand("org.eclipse.ui.tests.newCommand", null);
280
		assertEquals(1, CountingHandler.lastExecutedHandler.executionCount);
281
282
		handlerService.executeCommand("org.eclipse.ui.tests.oldCommand", null);
283
		assertEquals(2, CountingHandler.lastExecutedHandler.executionCount);
284
	}
279
	
285
	
280
	public void testBasicHandler() throws Exception {
286
	public void testBasicHandler() throws Exception {
281
287
(-)Eclipse UI Tests/org/eclipse/ui/tests/menus/MenuBaseTests.java (-27 / +36 lines)
Lines 16-21 import org.eclipse.jface.action.MenuManager; Link Here
16
import org.eclipse.swt.widgets.Decorations;
16
import org.eclipse.swt.widgets.Decorations;
17
import org.eclipse.swt.widgets.MenuItem;
17
import org.eclipse.swt.widgets.MenuItem;
18
import org.eclipse.swt.widgets.Shell;
18
import org.eclipse.swt.widgets.Shell;
19
import org.eclipse.ui.menus.CommandContributionItem;
20
import org.eclipse.ui.tests.TestUtils;
19
import org.eclipse.ui.tests.menus.DeclaredProgrammaticFactory.MyItem;
21
import org.eclipse.ui.tests.menus.DeclaredProgrammaticFactory.MyItem;
20
22
21
/**
23
/**
Lines 40-47 public class MenuBaseTests extends MenuTestCase { Link Here
40
			"MenuTest.Separator",
42
			"MenuTest.Separator",
41
			"MenuTest.AfterSeparator",
43
			"MenuTest.AfterSeparator",
42
			"MenuTest.ParameterItem",
44
			"MenuTest.ParameterItem",
43
			null, // "MenuTest.DynamicItem",
45
			"MenuTest.DynamicItem",
44
			"MenuTest.DynamicMenu",
46
			"MenuTest.DynamicMenu",
47
			"MenuTest.AliasedCmdItem",
45
			"MenuTest.ItemX1",
48
			"MenuTest.ItemX1",
46
			MenuPopulationTest.ID_DEFAULT,
49
			MenuPopulationTest.ID_DEFAULT,
47
			MenuPopulationTest.ID_ALL,
50
			MenuPopulationTest.ID_ALL,
Lines 61-66 public class MenuBaseTests extends MenuTestCase { Link Here
61
			org.eclipse.ui.menus.CommandContributionItem.class,
64
			org.eclipse.ui.menus.CommandContributionItem.class,
62
			org.eclipse.ui.menus.CommandContributionItem.class,
65
			org.eclipse.ui.menus.CommandContributionItem.class,
63
			org.eclipse.ui.menus.CommandContributionItem.class,
66
			org.eclipse.ui.menus.CommandContributionItem.class,
67
			org.eclipse.ui.menus.CommandContributionItem.class,
64
			MyItem.class
68
			MyItem.class
65
		};
69
		};
66
		String[] expectedMenuItemLabels = {
70
		String[] expectedMenuItemLabels = {
Lines 72-113 public class MenuBaseTests extends MenuTestCase { Link Here
72
			"Dynamic Item 1",
76
			"Dynamic Item 1",
73
			"Dynamic Item 2",
77
			"Dynamic Item 2",
74
			"Dynamic Menu",
78
			"Dynamic Menu",
79
			"New Command",
75
			"Icons Default",
80
			"Icons Default",
76
			"Icons All",
81
			"Icons All",
77
			"Icons Toolbar Only",
82
			"Icons Toolbar Only",
78
			"MyItem"
83
			"MyItem"
79
		};
84
		};
85
	
86
	private MenuManager manager;
80
87
81
	/**
82
	 * @param testName
83
	 */
84
	public MenuBaseTests(String testName) {
88
	public MenuBaseTests(String testName) {
85
		super(testName);
89
		super(testName);
86
	}
90
	}
87
	
91
88
	public void testBasicPopulation() throws Exception {
92
	protected void doSetUp() throws Exception {
89
		MenuManager manager = new MenuManager(null, TEST_CONTRIBUTIONS_CACHE_ID);
93
		super.doSetUp();
94
		manager = new MenuManager("Test Menu", TEST_CONTRIBUTIONS_CACHE_ID);
90
		menuService.populateContributionManager(manager, "menu:"
95
		menuService.populateContributionManager(manager, "menu:"
91
				+ TEST_CONTRIBUTIONS_CACHE_ID);
96
				+ TEST_CONTRIBUTIONS_CACHE_ID);
92
		IContributionItem[] items = manager.getItems();
97
	}
93
		
98
	
94
		// Correct number of items?
99
	protected void doTearDown() throws Exception {
95
		assertEquals("Bad count", expectedIds.length, items.length);
96
97
		int diffIndex = checkContribIds(items, expectedIds);
98
		assertTrue("Id mismatch at index " + diffIndex , diffIndex == ALL_OK);
99
100
		diffIndex = checkContribClasses(items, expectedClasses);
101
		assertTrue("Class mismatch at index " + diffIndex , diffIndex == ALL_OK);
102
103
		menuService.releaseContributions(manager);
100
		menuService.releaseContributions(manager);
104
		manager.dispose();
101
		manager.dispose();
102
		super.doTearDown();
103
	}
104
	
105
	public void testContributionItemsCorrect() throws Exception {
106
		IContributionItem[] items = manager.getItems();
107
		TestUtils.assertArrayEquals(expectedIds, getContributionItemIds(items));
108
		assertContributionClassesInstanceOf(expectedClasses, items);
109
	}
110
	
111
	public void testAliasedCommandItem() {
112
		IContributionItem[] items = manager.getItems();
113
		CommandContributionItem aliasedCommandContribution = null;
114
		for (int i = 0; i < items.length; i++) {
115
			if ("MenuTest.AliasedCmdItem".equals(items[i].getId())) {
116
				aliasedCommandContribution = (CommandContributionItem) items[i];
117
			}
118
		}
119
		assertNotNull("aliasedCommandContribution", aliasedCommandContribution);
120
		assertEquals("org.eclipse.ui.tests.newCommand", aliasedCommandContribution.getCommand().getId());
105
	}
121
	}
106
122
107
	public void testBasicMenuPopulation() throws Exception {
123
	public void testMenuItemsCorrect() throws Exception {
108
		MenuManager manager = new MenuManager("Test Menu", TEST_CONTRIBUTIONS_CACHE_ID);
109
		menuService.populateContributionManager(manager, "menu:"
110
				+ TEST_CONTRIBUTIONS_CACHE_ID);
111
		
124
		
112
		Shell shell = window.getShell();
125
		Shell shell = window.getShell();
113
126
Lines 121-131 public class MenuBaseTests extends MenuTestCase { Link Here
121
//		printClasses(items);
134
//		printClasses(items);
122
//		printMenuItemLabels(menuItems);
135
//		printMenuItemLabels(menuItems);
123
		
136
		
124
		// Correct number of items?
137
		TestUtils.assertArrayEquals(expectedMenuItemLabels, getMenuItemsLabels(menuItems));
125
		assertEquals("createMenuBar: Bad count", expectedMenuItemLabels.length, menuItems.length);
126
127
		int diffIndex = checkMenuItemLabels(menuItems, expectedMenuItemLabels);
128
		assertTrue("createMenuBar: Index mismatch at index " + diffIndex , diffIndex == ALL_OK);
129
138
130
		// Test the update mechanism
139
		// Test the update mechanism
131
		
140
		
(-)Eclipse UI Tests/org/eclipse/ui/tests/menus/MenuTestCase.java (-28 / +31 lines)
Lines 18-23 import org.eclipse.ui.IWorkbenchWindow; Link Here
18
import org.eclipse.ui.contexts.IContextActivation;
18
import org.eclipse.ui.contexts.IContextActivation;
19
import org.eclipse.ui.contexts.IContextService;
19
import org.eclipse.ui.contexts.IContextService;
20
import org.eclipse.ui.menus.IMenuService;
20
import org.eclipse.ui.menus.IMenuService;
21
import org.eclipse.ui.tests.TestUtils;
21
import org.eclipse.ui.tests.api.workbenchpart.MenuContributionHarness;
22
import org.eclipse.ui.tests.api.workbenchpart.MenuContributionHarness;
22
import org.eclipse.ui.tests.harness.util.UITestCase;
23
import org.eclipse.ui.tests.harness.util.UITestCase;
23
24
Lines 49-59 public class MenuTestCase extends UITestCase { Link Here
49
	protected IWorkbenchWindow window;
50
	protected IWorkbenchWindow window;
50
	protected IContextActivation activeContext;
51
	protected IContextActivation activeContext;
51
52
52
	/*
53
	 * (non-Javadoc)
54
	 * 
55
	 * @see org.eclipse.ui.tests.harness.util.UITestCase#doSetUp()
56
	 */
57
	protected void doSetUp() throws Exception {
53
	protected void doSetUp() throws Exception {
58
		super.doSetUp();
54
		super.doSetUp();
59
55
Lines 70-80 public class MenuTestCase extends UITestCase { Link Here
70
		menuService = (IMenuService) window.getService(IMenuService.class);
66
		menuService = (IMenuService) window.getService(IMenuService.class);
71
	}
67
	}
72
68
73
	/*
74
	 * (non-Javadoc)
75
	 * 
76
	 * @see org.eclipse.ui.tests.harness.util.UITestCase#doTearDown()
77
	 */
78
	protected void doTearDown() throws Exception {
69
	protected void doTearDown() throws Exception {
79
		if (activeContext != null) {
70
		if (activeContext != null) {
80
			contextService.deactivateContext(activeContext);
71
			contextService.deactivateContext(activeContext);
Lines 106-132 public class MenuTestCase extends UITestCase { Link Here
106
		return ALL_OK;
97
		return ALL_OK;
107
	}
98
	}
108
99
109
	protected static int checkContribClasses(IContributionItem[] items, Class[] classes) {
100
	protected static String[] getContributionItemIds(IContributionItem[] items) {
110
		// Test cases should check this independently so they can issue the
101
		String[] ids = new String[items.length];
111
		// correct error (i.e. "Not enough items...wanted 6 got 5") but for
102
		for (int i = 0; i < items.length; i++) {
112
		// safety's sake...
103
			if (items[i] != null) {
113
		if (items.length != classes.length)
104
				ids[i] = items[i].getId();
114
			return 0;
105
			}
115
		
116
		for (int i = 0; i < classes.length; i++) {
117
			// HACK!! cant find anonyous classes
118
			if (classes[i] == null)
119
				continue;
120
			
121
			// minor upgrade ... if the item is an instanceof the class we're good
122
			// this handles the case where the item is a subclass of
123
			// CompoundContributionItem
124
			if (!classes[i].isInstance(items[i]))
125
				return i;
126
		}
106
		}
127
		return ALL_OK;
107
		return ids;
128
	}
108
	}
129
109
110
	protected static String[] getMenuItemsLabels(MenuItem[] items) {
111
		String[] ids = new String[items.length];
112
		for (int i = 0; i < items.length; i++) {
113
			if (items[i] != null) {
114
				ids[i] = items[i].getText();
115
			}
116
		}
117
		return ids;
118
	}
119
120
	protected static void assertContributionClassesInstanceOf(Class[] expectedClasses,
121
			IContributionItem[] items) {
122
		assertEquals("contributed item count, actual items = "
123
				+ TestUtils.arrayToString(getContributionItemIds(items)), expectedClasses.length,
124
				items.length);
125
		for (int i = 0; i < expectedClasses.length; i++) {
126
			if (expectedClasses[i] == null) {
127
				assertNull("index " + i, items[i]);
128
			} else {
129
				assertTrue("index " + i, expectedClasses[i].isInstance(items[i]));
130
			}
131
		}
132
	}
130
	protected static int checkMenuItemLabels(MenuItem[] menuItems,
133
	protected static int checkMenuItemLabels(MenuItem[] menuItems,
131
			String[] expectedLabels) {
134
			String[] expectedLabels) {
132
		// Test cases should check this independently so they can issue the
135
		// Test cases should check this independently so they can issue the
(-)Eclipse UI Tests/org/eclipse/ui/tests/themes/JFaceThemeTest.java (-1 / +2 lines)
Lines 19-24 import org.eclipse.jface.resource.JFaceResources; Link Here
19
import org.eclipse.jface.util.IPropertyChangeListener;
19
import org.eclipse.jface.util.IPropertyChangeListener;
20
import org.eclipse.swt.graphics.Color;
20
import org.eclipse.swt.graphics.Color;
21
import org.eclipse.swt.graphics.RGB;
21
import org.eclipse.swt.graphics.RGB;
22
import org.eclipse.ui.tests.TestUtils;
22
import org.eclipse.ui.themes.ITheme;
23
import org.eclipse.ui.themes.ITheme;
23
import org.eclipse.ui.themes.IThemeManager;
24
import org.eclipse.ui.themes.IThemeManager;
24
25
Lines 48-54 public class JFaceThemeTest extends ThemeTest { Link Here
48
                    themeFonts.getKeySet()));
49
                    themeFonts.getKeySet()));
49
            for (Iterator i = themeFonts.getKeySet().iterator(); i.hasNext();) {
50
            for (Iterator i = themeFonts.getKeySet().iterator(); i.hasNext();) {
50
                String key = (String) i.next();
51
                String key = (String) i.next();
51
                assertArrayEquals(themeFonts.getFontData(key), jfaceFonts
52
				TestUtils.assertArrayEquals(themeFonts.getFontData(key), jfaceFonts
52
                        .getFontData(key));
53
                        .getFontData(key));
53
            }
54
            }
54
        }
55
        }
(-)Eclipse UI Tests/org/eclipse/ui/tests/themes/ThemeAPITest.java (-105 / +19 lines)
Lines 26-31 import org.eclipse.swt.graphics.RGB; Link Here
26
import org.eclipse.swt.widgets.Display;
26
import org.eclipse.swt.widgets.Display;
27
import org.eclipse.ui.internal.themes.ThemeElementHelper;
27
import org.eclipse.ui.internal.themes.ThemeElementHelper;
28
import org.eclipse.ui.internal.util.PrefUtil;
28
import org.eclipse.ui.internal.util.PrefUtil;
29
import org.eclipse.ui.tests.TestUtils;
29
import org.eclipse.ui.themes.ITheme;
30
import org.eclipse.ui.themes.ITheme;
30
import org.eclipse.ui.themes.IThemeManager;
31
import org.eclipse.ui.themes.IThemeManager;
31
32
Lines 36-157 import org.eclipse.ui.themes.IThemeManager; Link Here
36
 */
37
 */
37
public class ThemeAPITest extends ThemeTest {
38
public class ThemeAPITest extends ThemeTest {
38
39
39
    /**
40
	 * 
41
	 */
42
	private static final String EXTENDED_THEME3 = "extendedTheme3";
40
	private static final String EXTENDED_THEME3 = "extendedTheme3";
43
	/**
44
	 * 
45
	 */
46
	private static final String EXTENDED_THEME2 = "extendedTheme2";
41
	private static final String EXTENDED_THEME2 = "extendedTheme2";
47
	/**
48
	 * 
49
	 */
50
	private static final String EXTENDED_THEME1 = "extendedTheme1";
42
	private static final String EXTENDED_THEME1 = "extendedTheme1";
51
	/**
52
	 * 
53
	 */
54
	private static final String PLATFORMFONT = "platformfont";
43
	private static final String PLATFORMFONT = "platformfont";
55
	/**
56
	 * 
57
	 */
58
	private static final String PLATFORMCOLOR = "platformcolor";
44
	private static final String PLATFORMCOLOR = "platformcolor";
59
	/**
60
	 * 
61
	 */
62
	private static final String NOOVERRIDEFONT = "nooverridefont";
45
	private static final String NOOVERRIDEFONT = "nooverridefont";
63
	/**
64
	 * 
65
	 */
66
	private static final String NOVALFONT = "novalfont";
46
	private static final String NOVALFONT = "novalfont";
67
	/**
68
	 * 
69
	 */
70
	private static final String DEFAULTEDFONT3 = "defaultedfont3";
47
	private static final String DEFAULTEDFONT3 = "defaultedfont3";
71
	/**
72
	 * 
73
	 */
74
	private static final String DEFAULTEDFONT2 = "defaultedfont2";
48
	private static final String DEFAULTEDFONT2 = "defaultedfont2";
75
	/**
76
	 * 
77
	 */
78
	private static final String DEFAULTEDFONT = "defaultedfont";
49
	private static final String DEFAULTEDFONT = "defaultedfont";
79
	/**
80
	 * 
81
	 */
82
	private static final String VALFONT = "valfont";
50
	private static final String VALFONT = "valfont";
83
	/**
84
	 * 
85
	 */
86
	private static final String DEFAULTEDCOLOR3 = "defaultedcolor3";
51
	private static final String DEFAULTEDCOLOR3 = "defaultedcolor3";
87
	/**
88
	 * 
89
	 */
90
	private static final String DEFAULTEDCOLOR2 = "adefaultedcolor2";
52
	private static final String DEFAULTEDCOLOR2 = "adefaultedcolor2";
91
	/**
92
	 * 
93
	 */
94
	private static final String VALUE2 = "value2";
53
	private static final String VALUE2 = "value2";
95
	/**
96
	 * 
97
	 */
98
	private static final String OVERRIDE1 = "override1";
54
	private static final String OVERRIDE1 = "override1";
99
	/**
100
	 * 
101
	 */
102
	private static final String NOOVERRIDECOLOR = "nooverridecolor";
55
	private static final String NOOVERRIDECOLOR = "nooverridecolor";
103
	/**
104
	 * 
105
	 */
106
	private static final String DEFAULTEDCOLOR = "defaultedcolor";
56
	private static final String DEFAULTEDCOLOR = "defaultedcolor";
107
	/**
108
	 * 
109
	 */
110
	private static final String SWTCOLOR = "swtcolor";
57
	private static final String SWTCOLOR = "swtcolor";
111
	/**
112
	 * 
113
	 */
114
	private static final String FACTORYCOLOR = "factorycolor";
58
	private static final String FACTORYCOLOR = "factorycolor";
115
	/**
116
	 * 
117
	 */
118
	private static final String RGBCOLOR = "rgbcolor";
59
	private static final String RGBCOLOR = "rgbcolor";
119
	/**
120
	 * 
121
	 */
122
	private static final String BOOL1 = "bool1";
60
	private static final String BOOL1 = "bool1";
123
	/**
124
	 * 
125
	 */
126
	private static final String BOGUSKEY = "BOGUSKEY";
61
	private static final String BOGUSKEY = "BOGUSKEY";
127
	/**
128
	 * 
129
	 */
130
	private static final String INT1 = "int1";
62
	private static final String INT1 = "int1";
131
	/**
132
	 * 
133
	 */
134
	private static final String DATA2 = "data2";
63
	private static final String DATA2 = "data2";
135
	/**
136
	 * 
137
	 */
138
	private static final String DATA1 = "data1";	
64
	private static final String DATA1 = "data1";	
139
	/**
140
	 * 
141
	 */
142
	private static final String BAD_COLOR1 = "badColor1";
65
	private static final String BAD_COLOR1 = "badColor1";
143
	/**
144
	 * 
145
	 */
146
	private static final String BAD_COLOR2 = "badColor2";
66
	private static final String BAD_COLOR2 = "badColor2";
147
	/**
148
	 * 
149
	 */
150
	private static final String BAD_COLOR3 = "badColor3";
67
	private static final String BAD_COLOR3 = "badColor3";
151
68
152
	/**
153
     * @param testName
154
     */
155
    public ThemeAPITest(String testName) {
69
    public ThemeAPITest(String testName) {
156
        super(testName);
70
        super(testName);
157
    }
71
    }
Lines 165-173 public class ThemeAPITest extends ThemeTest { Link Here
165
79
166
        assertEquals(source, event.getSource());
80
        assertEquals(source, event.getSource());
167
        if (array) {
81
        if (array) {
168
            assertArrayEquals((Object[]) oldObject, (Object[]) event
82
			TestUtils.assertArrayEquals((Object[]) oldObject, (Object[]) event
169
                    .getOldValue());
83
                    .getOldValue());
170
            assertArrayEquals((Object[]) newObject, (Object[]) event
84
			TestUtils.assertArrayEquals((Object[]) newObject, (Object[]) event
171
                    .getNewValue());
85
                    .getNewValue());
172
        } else {
86
        } else {
173
            assertEquals(oldObject, event.getOldValue());
87
            assertEquals(oldObject, event.getOldValue());
Lines 177-185 public class ThemeAPITest extends ThemeTest { Link Here
177
        event = (PropertyChangeEvent) events.get(1);
91
        event = (PropertyChangeEvent) events.get(1);
178
        assertEquals(source, event.getSource());
92
        assertEquals(source, event.getSource());
179
        if (array) {
93
        if (array) {
180
            assertArrayEquals((Object[]) oldObject, (Object[]) event
94
			TestUtils.assertArrayEquals((Object[]) oldObject, (Object[]) event
181
                    .getNewValue());
95
                    .getNewValue());
182
            assertArrayEquals((Object[]) newObject, (Object[]) event
96
			TestUtils.assertArrayEquals((Object[]) newObject, (Object[]) event
183
                    .getOldValue());
97
                    .getOldValue());
184
        } else {
98
        } else {
185
            assertEquals(oldObject, event.getNewValue());
99
            assertEquals(oldObject, event.getNewValue());
Lines 348-382 public class ThemeAPITest extends ThemeTest { Link Here
348
262
349
    public void testDefaultedFont_valfont() {
263
    public void testDefaultedFont_valfont() {
350
        ITheme defaultTheme = getDefaultTheme();
264
        ITheme defaultTheme = getDefaultTheme();
351
        assertArrayEquals(
265
		TestUtils.assertArrayEquals(
352
                defaultTheme.getFontRegistry().getFontData(VALFONT),
266
                defaultTheme.getFontRegistry().getFontData(VALFONT),
353
                defaultTheme.getFontRegistry().getFontData(DEFAULTEDFONT));
267
                defaultTheme.getFontRegistry().getFontData(DEFAULTEDFONT));
354
    }
268
    }
355
269
356
    public void testDefaultedFont_defaultedfont() {
270
    public void testDefaultedFont_defaultedfont() {
357
        ITheme defaultTheme = getDefaultTheme();
271
        ITheme defaultTheme = getDefaultTheme();
358
        assertArrayEquals(defaultTheme.getFontRegistry().getFontData(
272
		TestUtils.assertArrayEquals(defaultTheme.getFontRegistry().getFontData(
359
                DEFAULTEDFONT), defaultTheme.getFontRegistry().getFontData(
273
                DEFAULTEDFONT), defaultTheme.getFontRegistry().getFontData(
360
                DEFAULTEDFONT2));
274
                DEFAULTEDFONT2));
361
    }
275
    }
362
276
363
    public void testDefaultedFont_defaultedfont2() {
277
    public void testDefaultedFont_defaultedfont2() {
364
        ITheme defaultTheme = getDefaultTheme();
278
        ITheme defaultTheme = getDefaultTheme();
365
        assertArrayEquals(defaultTheme.getFontRegistry().getFontData(
279
		TestUtils.assertArrayEquals(defaultTheme.getFontRegistry().getFontData(
366
                DEFAULTEDFONT2), defaultTheme.getFontRegistry().getFontData(
280
                DEFAULTEDFONT2), defaultTheme.getFontRegistry().getFontData(
367
                DEFAULTEDFONT3));
281
                DEFAULTEDFONT3));
368
    }
282
    }
369
283
370
    public void testDefaultedFontOverride_valfont() {
284
    public void testDefaultedFontOverride_valfont() {
371
        ITheme theme1 = getTheme1();
285
        ITheme theme1 = getTheme1();
372
        assertArrayEquals(theme1.getFontRegistry().getFontData(VALFONT),
286
		TestUtils.assertArrayEquals(theme1.getFontRegistry().getFontData(VALFONT),
373
                theme1.getFontRegistry().getFontData(DEFAULTEDFONT));
287
                theme1.getFontRegistry().getFontData(DEFAULTEDFONT));
374
    }
288
    }
375
289
376
    public void testDefaultedFontOverride_defaultedfont2() {
290
    public void testDefaultedFontOverride_defaultedfont2() {
377
        ITheme theme1 = getTheme1();
291
        ITheme theme1 = getTheme1();
378
292
379
        assertArrayEquals(new FontData[] { new FontData("Courier", 16,
293
		TestUtils.assertArrayEquals(new FontData[] { new FontData("Courier", 16,
380
                SWT.NORMAL) }, theme1.getFontRegistry().getFontData(
294
                SWT.NORMAL) }, theme1.getFontRegistry().getFontData(
381
                DEFAULTEDFONT2));
295
                DEFAULTEDFONT2));
382
    }
296
    }
Lines 384-390 public class ThemeAPITest extends ThemeTest { Link Here
384
    public void testDefaultedFontOverride_defaultedfont3() {
298
    public void testDefaultedFontOverride_defaultedfont3() {
385
        ITheme theme1 = getTheme1();
299
        ITheme theme1 = getTheme1();
386
300
387
        assertArrayEquals(theme1.getFontRegistry()
301
		TestUtils.assertArrayEquals(theme1.getFontRegistry()
388
                .getFontData(DEFAULTEDFONT2), theme1.getFontRegistry()
302
                .getFontData(DEFAULTEDFONT2), theme1.getFontRegistry()
389
                .getFontData(DEFAULTEDFONT3));
303
                .getFontData(DEFAULTEDFONT3));
390
    }
304
    }
Lines 502-515 public class ThemeAPITest extends ThemeTest { Link Here
502
416
503
    public void testNoValFont() {
417
    public void testNoValFont() {
504
        ITheme defaultTheme = getDefaultTheme();
418
        ITheme defaultTheme = getDefaultTheme();
505
        assertArrayEquals(defaultTheme.getFontRegistry().defaultFont()
419
		TestUtils.assertArrayEquals(defaultTheme.getFontRegistry().defaultFont()
506
                .getFontData(), defaultTheme.getFontRegistry().getFontData(
420
                .getFontData(), defaultTheme.getFontRegistry().getFontData(
507
                NOVALFONT));
421
                NOVALFONT));
508
    }
422
    }
509
423
510
    public void testNoValFontOverride() {
424
    public void testNoValFontOverride() {
511
        ITheme theme1 = getTheme1();
425
        ITheme theme1 = getTheme1();
512
        assertArrayEquals(new FontData[] { new FontData("Courier", 10,
426
		TestUtils.assertArrayEquals(new FontData[] { new FontData("Courier", 10,
513
                SWT.ITALIC) }, theme1.getFontRegistry()
427
                SWT.ITALIC) }, theme1.getFontRegistry()
514
                .getFontData(NOVALFONT));
428
                .getFontData(NOVALFONT));
515
429
Lines 536-544 public class ThemeAPITest extends ThemeTest { Link Here
536
                SWT.ITALIC) };
450
                SWT.ITALIC) };
537
        store.setValue(ThemeElementHelper.createPreferenceKey(theme, font),
451
        store.setValue(ThemeElementHelper.createPreferenceKey(theme, font),
538
                PreferenceConverter.getStoredRepresentation(newFont));
452
                PreferenceConverter.getStoredRepresentation(newFont));
539
        assertArrayEquals(newFont, theme.getFontRegistry().getFontData(font));
453
		TestUtils.assertArrayEquals(newFont, theme.getFontRegistry().getFontData(font));
540
        store.setToDefault(ThemeElementHelper.createPreferenceKey(theme, font));
454
        store.setToDefault(ThemeElementHelper.createPreferenceKey(theme, font));
541
        assertArrayEquals(oldFont, theme.getFontRegistry().getFontData(font));
455
		TestUtils.assertArrayEquals(oldFont, theme.getFontRegistry().getFontData(font));
542
    }
456
    }
543
457
544
    public void testPlatformColor() {
458
    public void testPlatformColor() {
Lines 569-575 public class ThemeAPITest extends ThemeTest { Link Here
569
        else
483
        else
570
            data = new FontData[] { new FontData("Sans", 15, SWT.BOLD) };
484
            data = new FontData[] { new FontData("Sans", 15, SWT.BOLD) };
571
485
572
        assertArrayEquals(data, defaultTheme.getFontRegistry().getFontData(
486
		TestUtils.assertArrayEquals(data, defaultTheme.getFontRegistry().getFontData(
573
                PLATFORMFONT));
487
                PLATFORMFONT));
574
    }
488
    }
575
489
Lines 641-647 public class ThemeAPITest extends ThemeTest { Link Here
641
555
642
    public void testValFont() {
556
    public void testValFont() {
643
        ITheme defaultTheme = getDefaultTheme();
557
        ITheme defaultTheme = getDefaultTheme();
644
        assertArrayEquals(
558
		TestUtils.assertArrayEquals(
645
                new FontData[] { new FontData("Tahoma", 20, SWT.BOLD) },
559
                new FontData[] { new FontData("Tahoma", 20, SWT.BOLD) },
646
                defaultTheme.getFontRegistry().getFontData(VALFONT));
560
                defaultTheme.getFontRegistry().getFontData(VALFONT));
647
    }
561
    }
Lines 684-693 public class ThemeAPITest extends ThemeTest { Link Here
684
        FontData[] fd = new FontData[] { new FontData("Sans", 10,
598
        FontData[] fd = new FontData[] { new FontData("Sans", 10,
685
                SWT.NORMAL) };
599
                SWT.NORMAL) };
686
        
600
        
687
        assertArrayEquals(fd, ext1.getFontRegistry()
601
		TestUtils.assertArrayEquals(fd, ext1.getFontRegistry()
688
                .getFontData(VALFONT));
602
                .getFontData(VALFONT));
689
603
690
        assertArrayEquals(fd, ext1.getFontRegistry()
604
		TestUtils.assertArrayEquals(fd, ext1.getFontRegistry()
691
                .getFontData(NOVALFONT));
605
                .getFontData(NOVALFONT));
692
    }
606
    }
693
    
607
    
(-)Eclipse UI Tests/org/eclipse/ui/tests/themes/ThemeTest.java (-40 lines)
Lines 10-17 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.ui.tests.themes;
11
package org.eclipse.ui.tests.themes;
12
12
13
import java.util.Arrays;
14
15
import org.eclipse.ui.tests.harness.util.UITestCase;
13
import org.eclipse.ui.tests.harness.util.UITestCase;
16
import org.eclipse.ui.themes.ITheme;
14
import org.eclipse.ui.themes.ITheme;
17
import org.eclipse.ui.themes.IThemeManager;
15
import org.eclipse.ui.themes.IThemeManager;
Lines 25-86 public abstract class ThemeTest extends UITestCase { Link Here
25
23
26
    protected static final String THEME1 = "theme1";
24
    protected static final String THEME1 = "theme1";
27
25
28
    public static void assertArrayEquals(Object[] datas, Object[] datas2) {
29
        if (!Arrays.equals(datas, datas2)) {
30
            String expected = formatArray(datas);
31
            String actual = formatArray(datas2);
32
            fail("expected:<" + expected + "> but was:<" + actual + ">");
33
        }
34
    }
35
36
    protected static String formatArray(Object[] datas) {
37
        StringBuffer buffer = new StringBuffer();
38
        if (datas == null)
39
            buffer.append("null");
40
        else {
41
            buffer.append('[');
42
            for (int i = 0; i < datas.length; i++) {
43
                buffer.append(datas[i]);
44
                if (i != datas.length - 1)
45
                    buffer.append(',');
46
            }
47
        }
48
        return buffer.toString();
49
    }
50
51
    protected IThemeManager fManager;
26
    protected IThemeManager fManager;
52
27
53
    /**
54
     * @param testName
55
     */
56
    public ThemeTest(String testName) {
28
    public ThemeTest(String testName) {
57
        super(testName);
29
        super(testName);
58
        // TODO Auto-generated constructor stub
59
    }
30
    }
60
31
61
    /*
62
     * (non-Javadoc)
63
     * 
64
     * @see org.eclipse.ui.tests.util.UITestCase#doSetUp()
65
     */
66
    protected void doSetUp() throws Exception {
32
    protected void doSetUp() throws Exception {
67
        super.doSetUp();
33
        super.doSetUp();
68
        fManager = fWorkbench.getThemeManager();
34
        fManager = fWorkbench.getThemeManager();
69
        fManager.setCurrentTheme(IThemeManager.DEFAULT_THEME);
35
        fManager.setCurrentTheme(IThemeManager.DEFAULT_THEME);
70
    }
36
    }
71
37
72
    /**
73
     * @return
74
     */
75
    protected ITheme getDefaultTheme() {
38
    protected ITheme getDefaultTheme() {
76
        ITheme defaultTheme = fManager.getTheme(IThemeManager.DEFAULT_THEME);
39
        ITheme defaultTheme = fManager.getTheme(IThemeManager.DEFAULT_THEME);
77
        assertNotNull(defaultTheme);
40
        assertNotNull(defaultTheme);
78
        return defaultTheme;
41
        return defaultTheme;
79
    }
42
    }
80
43
81
    /**
82
     * @return
83
     */
84
    protected ITheme getTheme1() {
44
    protected ITheme getTheme1() {
85
        ITheme theme1 = fManager.getTheme(THEME1);
45
        ITheme theme1 = fManager.getTheme(THEME1);
86
        assertNotNull(theme1);
46
        assertNotNull(theme1);
(-)plugin.xml (+24 lines)
Lines 909-914 Link Here
909
            id="org.eclipse.ui.tests.keyModel.emacs1"
909
            id="org.eclipse.ui.tests.keyModel.emacs1"
910
            name="emacsCommand1">
910
            name="emacsCommand1">
911
      </command>
911
      </command>
912
      <command
913
            id="org.eclipse.ui.tests.oldCommand"
914
            name="Old Command">
915
         <aliasFor
916
               commandId="org.eclipse.ui.tests.newCommand">
917
         </aliasFor>
918
      </command>
919
      <command
920
            id="org.eclipse.ui.tests.newCommand"
921
            name="New Command">
922
      </command>
912
   </extension>
923
   </extension>
913
   <extension
924
   <extension
914
         point="org.eclipse.ui.bindings">
925
         point="org.eclipse.ui.bindings">
Lines 3195-3200 Link Here
3195
            markerType="org.eclipse.ui.tests.categoryTestMarker"/>
3206
            markerType="org.eclipse.ui.tests.categoryTestMarker"/>
3196
   </extension>
3207
   </extension>
3197
3208
3209
   <extension
3210
         point="org.eclipse.ui.handlers">
3211
      <handler
3212
            commandId="org.eclipse.ui.tests.oldCommand"
3213
            class="org.eclipse.ui.tests.commands.CountingHandler" />
3214
   </extension>
3215
3198
   <!-- Tests for the new help context identifier work. -->
3216
   <!-- Tests for the new help context identifier work. -->
3199
   <extension
3217
   <extension
3200
         point="org.eclipse.ui.commands">
3218
         point="org.eclipse.ui.commands">
Lines 3820-3825 Link Here
3820
               id="MenuTest.DynamicSubItem">
3838
               id="MenuTest.DynamicSubItem">
3821
            </dynamic>
3839
            </dynamic>
3822
         </menu>
3840
         </menu>
3841
         <command
3842
               commandId="org.eclipse.ui.tests.oldCommand"
3843
               icon="icons/anything.gif"
3844
               id="MenuTest.AliasedCmdItem"
3845
               mnemonic="B">
3846
         </command>
3823
      </menuContribution>
3847
      </menuContribution>
3824
      <menuContribution
3848
      <menuContribution
3825
            locationURI="menu:org.eclipse.ui.tests.IfYouChangeMe.FixTheTests">
3849
            locationURI="menu:org.eclipse.ui.tests.IfYouChangeMe.FixTheTests">
(-)Eclipse UI/org/eclipse/ui/internal/commands/CommandPersistence.java (-39 / +33 lines)
Lines 13-32 package org.eclipse.ui.internal.commands; Link Here
13
13
14
import java.util.ArrayList;
14
import java.util.ArrayList;
15
import java.util.List;
15
import java.util.List;
16
17
import org.eclipse.core.commands.AbstractParameterValueConverter;
16
import org.eclipse.core.commands.AbstractParameterValueConverter;
18
import org.eclipse.core.commands.Category;
17
import org.eclipse.core.commands.Category;
19
import org.eclipse.core.commands.Command;
18
import org.eclipse.core.commands.Command;
20
import org.eclipse.core.commands.ParameterType;
19
import org.eclipse.core.commands.ParameterType;
21
import org.eclipse.core.commands.State;
20
import org.eclipse.core.commands.State;
22
import org.eclipse.core.commands.common.HandleObject;
21
import org.eclipse.core.commands.common.HandleObject;
22
import org.eclipse.core.runtime.Assert;
23
import org.eclipse.core.runtime.IConfigurationElement;
23
import org.eclipse.core.runtime.IConfigurationElement;
24
import org.eclipse.core.runtime.IExtensionDelta;
24
import org.eclipse.core.runtime.IExtensionDelta;
25
import org.eclipse.core.runtime.IExtensionRegistry;
25
import org.eclipse.core.runtime.IExtensionRegistry;
26
import org.eclipse.core.runtime.IRegistryChangeEvent;
26
import org.eclipse.core.runtime.IRegistryChangeEvent;
27
import org.eclipse.core.runtime.Platform;
27
import org.eclipse.core.runtime.Platform;
28
import org.eclipse.ui.PlatformUI;
28
import org.eclipse.ui.PlatformUI;
29
import org.eclipse.ui.commands.ICommandService;
30
import org.eclipse.ui.internal.WorkbenchMessages;
29
import org.eclipse.ui.internal.WorkbenchMessages;
31
import org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants;
30
import org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants;
32
import org.eclipse.ui.internal.services.RegistryPersistence;
31
import org.eclipse.ui.internal.services.RegistryPersistence;
Lines 34-40 import org.eclipse.ui.internal.util.PrefUtil; Link Here
34
33
35
/**
34
/**
36
 * <p>
35
 * <p>
37
 * A static class for accessing the registry and the preference store.
36
 * CommandPersistence is responsible to read commands, categories, parameters,
37
 * states and aliases from the extension registry and to register them with the
38
 * {@link CommandService}.
38
 * </p>
39
 * </p>
39
 * 
40
 * 
40
 * @since 3.1
41
 * @since 3.1
Lines 72-85 public final class CommandPersistence extends RegistryPersistence { Link Here
72
	 * @param configurationElementCount
73
	 * @param configurationElementCount
73
	 *            The number of configuration elements that are really in the
74
	 *            The number of configuration elements that are really in the
74
	 *            array.
75
	 *            array.
75
	 * @param commandService
76
	 *            The command service to which the categories should be added;
77
	 *            must not be <code>null</code>.
78
	 */
76
	 */
79
	private static final void readCategoriesFromRegistry(
77
	private final void readCategoriesFromRegistry(
80
			final IConfigurationElement[] configurationElements,
78
			final IConfigurationElement[] configurationElements,
81
			final int configurationElementCount,
79
			final int configurationElementCount) {
82
			final ICommandService commandService) {
83
		// Undefine all the previous handle objects.
80
		// Undefine all the previous handle objects.
84
		final HandleObject[] handleObjects = commandService
81
		final HandleObject[] handleObjects = commandService
85
				.getDefinedCategories();
82
				.getDefinedCategories();
Lines 138-151 public final class CommandPersistence extends RegistryPersistence { Link Here
138
	 * @param configurationElementCount
135
	 * @param configurationElementCount
139
	 *            The number of configuration elements that are really in the
136
	 *            The number of configuration elements that are really in the
140
	 *            array.
137
	 *            array.
141
	 * @param commandService
142
	 *            The command service to which the commands should be added;
143
	 *            must not be <code>null</code>.
144
	 */
138
	 */
145
	private static final void readCommandsFromRegistry(
139
	private final void readCommandsFromRegistry(
146
			final IConfigurationElement[] configurationElements,
140
			final IConfigurationElement[] configurationElements,
147
			final int configurationElementCount,
141
			final int configurationElementCount) {
148
			final ICommandService commandService) {
149
		// Undefine all the previous handle objects.
142
		// Undefine all the previous handle objects.
150
		final HandleObject[] handleObjects = commandService
143
		final HandleObject[] handleObjects = commandService
151
				.getDefinedCommands();
144
				.getDefinedCommands();
Lines 167-172 public final class CommandPersistence extends RegistryPersistence { Link Here
167
				continue;
160
				continue;
168
			}
161
			}
169
162
163
			IConfigurationElement[] aliases = configurationElement
164
					.getChildren(TAG_COMMAND_ALIAS_FOR);
165
			if (aliases.length > 0) {
166
				if (aliases.length > 1) {
167
					logWarnings(warningsToLog, "There should only be only one aliasFor element"); //$NON-NLS-1$
168
				}
169
				String targetCommandId = readRequired(aliases[0], ATT_COMMAND_ID, warningsToLog,
170
						"aliasFor needs a commandId"); //$NON-NLS-1$
171
				commandService.defineAlias(commandId, targetCommandId);
172
				// Other attributes are ignored for alias commands
173
				// as documented in extension point description
174
				continue;
175
			}
176
170
			// Read out the name.
177
			// Read out the name.
171
			final String name = readRequired(configurationElement, ATT_NAME,
178
			final String name = readRequired(configurationElement, ATT_NAME,
172
					warningsToLog, "Commands need a name"); //$NON-NLS-1$
179
					warningsToLog, "Commands need a name"); //$NON-NLS-1$
Lines 190-196 public final class CommandPersistence extends RegistryPersistence { Link Here
190
197
191
			// Read out the parameters.
198
			// Read out the parameters.
192
			final Parameter[] parameters = readParameters(configurationElement,
199
			final Parameter[] parameters = readParameters(configurationElement,
193
					warningsToLog, commandService);
200
					warningsToLog);
194
201
195
			// Read out the returnTypeId.
202
			// Read out the returnTypeId.
196
			final String returnTypeId = readOptional(configurationElement,
203
			final String returnTypeId = readOptional(configurationElement,
Lines 241-255 public final class CommandPersistence extends RegistryPersistence { Link Here
241
	 *            The list of warnings found during parsing. Warnings found
248
	 *            The list of warnings found during parsing. Warnings found
242
	 *            while parsing the parameters will be appended to this list.
249
	 *            while parsing the parameters will be appended to this list.
243
	 *            This value must not be <code>null</code>.
250
	 *            This value must not be <code>null</code>.
244
	 * @param commandService
245
	 *            The command service from which the parameter can get parameter
246
	 *            types; must not be <code>null</code>.
247
	 * @return The array of parameters found for this configuration element;
251
	 * @return The array of parameters found for this configuration element;
248
	 *         <code>null</code> if none can be found.
252
	 *         <code>null</code> if none can be found.
249
	 */
253
	 */
250
	private static final Parameter[] readParameters(
254
	private final Parameter[] readParameters(
251
			final IConfigurationElement configurationElement,
255
			final IConfigurationElement configurationElement,
252
			final List warningsToLog, final ICommandService commandService) {
256
			final List warningsToLog) {
253
		final IConfigurationElement[] parameterElements = configurationElement
257
		final IConfigurationElement[] parameterElements = configurationElement
254
				.getChildren(TAG_COMMAND_PARAMETER);
258
				.getChildren(TAG_COMMAND_PARAMETER);
255
		if ((parameterElements == null) || (parameterElements.length == 0)) {
259
		if ((parameterElements == null) || (parameterElements.length == 0)) {
Lines 318-332 public final class CommandPersistence extends RegistryPersistence { Link Here
318
	 * @param configurationElementCount
322
	 * @param configurationElementCount
319
	 *            The number of configuration elements that are really in the
323
	 *            The number of configuration elements that are really in the
320
	 *            array.
324
	 *            array.
321
	 * @param commandService
322
	 *            The command service to which the commands should be added;
323
	 *            must not be <code>null</code>.
324
	 * @since 3.2
325
	 * @since 3.2
325
	 */
326
	 */
326
	private static final void readParameterTypesFromRegistry(
327
	private final void readParameterTypesFromRegistry(
327
			final IConfigurationElement[] configurationElements,
328
			final IConfigurationElement[] configurationElements,
328
			final int configurationElementCount,
329
			final int configurationElementCount) {
329
			final ICommandService commandService) {
330
330
331
		// Undefine all the previous handle objects.
331
		// Undefine all the previous handle objects.
332
		final HandleObject[] handleObjects = commandService
332
		final HandleObject[] handleObjects = commandService
Lines 425-431 public final class CommandPersistence extends RegistryPersistence { Link Here
425
	 * The command service with which this persistence class is associated;
425
	 * The command service with which this persistence class is associated;
426
	 * never <code>null</code>.
426
	 * never <code>null</code>.
427
	 */
427
	 */
428
	private final ICommandService commandService;
428
	private final CommandService commandService;
429
429
430
	/**
430
	/**
431
	 * Constructs a new instance of <code>CommandPersistence</code>.
431
	 * Constructs a new instance of <code>CommandPersistence</code>.
Lines 434-443 public final class CommandPersistence extends RegistryPersistence { Link Here
434
	 *            The command service which should be populated with the values
434
	 *            The command service which should be populated with the values
435
	 *            from the registry; must not be <code>null</code>.
435
	 *            from the registry; must not be <code>null</code>.
436
	 */
436
	 */
437
	CommandPersistence(final ICommandService commandService) {
437
	CommandPersistence(final CommandService commandService) {
438
		if (commandService == null) {
438
		Assert.isNotNull(commandService, "commandService"); //$NON-NLS-1$
439
			throw new NullPointerException("The command service cannot be null"); //$NON-NLS-1$
440
		}
441
		this.commandService = commandService;
439
		this.commandService = commandService;
442
	}
440
	}
443
441
Lines 462-471 public final class CommandPersistence extends RegistryPersistence { Link Here
462
	
460
	
463
	/**
461
	/**
464
	 * Reads all of the commands and categories from the registry,
462
	 * Reads all of the commands and categories from the registry,
465
	 * 
466
	 * @param commandService
467
	 *            The command service which should be populated with the values
468
	 *            from the registry; must not be <code>null</code>.
469
	 */
463
	 */
470
	protected final void read() {
464
	protected final void read() {
471
		super.read();
465
		super.read();
Lines 519-530 public final class CommandPersistence extends RegistryPersistence { Link Here
519
513
520
		readCategoriesFromRegistry(
514
		readCategoriesFromRegistry(
521
				indexedConfigurationElements[INDEX_CATEGORY_DEFINITIONS],
515
				indexedConfigurationElements[INDEX_CATEGORY_DEFINITIONS],
522
				categoryDefinitionCount, commandService);
516
				categoryDefinitionCount);
523
		readCommandsFromRegistry(
517
		readCommandsFromRegistry(
524
				indexedConfigurationElements[INDEX_COMMAND_DEFINITIONS],
518
				indexedConfigurationElements[INDEX_COMMAND_DEFINITIONS],
525
				commandDefinitionCount, commandService);
519
				commandDefinitionCount);
526
		readParameterTypesFromRegistry(
520
		readParameterTypesFromRegistry(
527
				indexedConfigurationElements[INDEX_PARAMETER_TYPE_DEFINITIONS],
521
				indexedConfigurationElements[INDEX_PARAMETER_TYPE_DEFINITIONS],
528
				parameterTypeDefinitionCount, commandService);
522
				parameterTypeDefinitionCount);
529
	}
523
	}
530
}
524
}
(-)Eclipse UI/org/eclipse/ui/internal/commands/CommandService.java (-2 / +14 lines)
Lines 17-23 import java.util.HashMap; Link Here
17
import java.util.Iterator;
17
import java.util.Iterator;
18
import java.util.List;
18
import java.util.List;
19
import java.util.Map;
19
import java.util.Map;
20
21
import org.eclipse.core.commands.Category;
20
import org.eclipse.core.commands.Category;
22
import org.eclipse.core.commands.Command;
21
import org.eclipse.core.commands.Command;
23
import org.eclipse.core.commands.CommandManager;
22
import org.eclipse.core.commands.CommandManager;
Lines 31-39 import org.eclipse.core.commands.common.NotDefinedException; Link Here
31
import org.eclipse.core.runtime.ISafeRunnable;
30
import org.eclipse.core.runtime.ISafeRunnable;
32
import org.eclipse.core.runtime.SafeRunner;
31
import org.eclipse.core.runtime.SafeRunner;
33
import org.eclipse.jface.commands.PersistentState;
32
import org.eclipse.jface.commands.PersistentState;
33
import org.eclipse.ui.commands.ICommandService;
34
import org.eclipse.ui.commands.IElementReference;
34
import org.eclipse.ui.commands.IElementReference;
35
import org.eclipse.ui.commands.IElementUpdater;
35
import org.eclipse.ui.commands.IElementUpdater;
36
import org.eclipse.ui.commands.ICommandService;
37
import org.eclipse.ui.internal.WorkbenchPlugin;
36
import org.eclipse.ui.internal.WorkbenchPlugin;
38
import org.eclipse.ui.internal.util.PrefUtil;
37
import org.eclipse.ui.internal.util.PrefUtil;
39
import org.eclipse.ui.menus.UIElement;
38
import org.eclipse.ui.menus.UIElement;
Lines 335-338 public final class CommandService implements ICommandService { Link Here
335
	public CommandPersistence getCommandPersistence() {
334
	public CommandPersistence getCommandPersistence() {
336
		return commandPersistence;
335
		return commandPersistence;
337
	}
336
	}
337
338
	/**
339
	 * Defines an alias in the underlying CommandManager.
340
	 * 
341
	 * @see CommandManager#defineAlias(String, String)
342
	 * @param sourceCommandId
343
	 *            alias command id
344
	 * @param targetCommandId
345
	 *            alias target command id
346
	 */
347
	protected void defineAlias(String sourceCommandId, String targetCommandId) {
348
		commandManager.defineAlias(sourceCommandId, targetCommandId);
349
	}
338
}
350
}
(-)Eclipse UI/org/eclipse/ui/internal/registry/IWorkbenchRegistryConstants.java (+5 lines)
Lines 945-950 public interface IWorkbenchRegistryConstants { Link Here
945
	public static String TAG_COMMAND = "command"; //$NON-NLS-1$
945
	public static String TAG_COMMAND = "command"; //$NON-NLS-1$
946
946
947
	/**
947
	/**
948
	 * The name of the element storing an alias.
949
	 */
950
	public static String TAG_COMMAND_ALIAS_FOR = "aliasFor"; //$NON-NLS-1$
951
952
	/**
948
	 * The name of the element storing a parameter.
953
	 * The name of the element storing a parameter.
949
	 */
954
	 */
950
	public static String TAG_COMMAND_PARAMETER = "commandParameter"; //$NON-NLS-1$
955
	public static String TAG_COMMAND_PARAMETER = "commandParameter"; //$NON-NLS-1$
(-)src/org/eclipse/core/commands/CommandManager.java (-1 / +35 lines)
Lines 285-290 public final class CommandManager extends HandleObjectManager implements Link Here
285
	 */
285
	 */
286
	private final Map parameterTypesById = new HashMap();
286
	private final Map parameterTypesById = new HashMap();
287
287
288
289
	/**
290
	 * Map<String, String> holding command aliases mapping from sourceCommandId
291
	 * to targetCommandId.
292
	 */
293
	private Map commandIdAliases = new HashMap();
294
288
	/**
295
	/**
289
	 * Adds a listener to this command manager. The listener will be notified
296
	 * Adds a listener to this command manager. The listener will be notified
290
	 * when the set of defined commands changes. This can be used to track the
297
	 * when the set of defined commands changes. This can be used to track the
Lines 543-549 public final class CommandManager extends HandleObjectManager implements Link Here
543
	public final Command getCommand(final String commandId) {
550
	public final Command getCommand(final String commandId) {
544
		checkId(commandId);
551
		checkId(commandId);
545
552
546
		Command command = (Command) handleObjectsById.get(commandId);
553
		Command command = (Command) handleObjectsById.get(resolveAlias(commandId));
547
		if (command == null) {
554
		if (command == null) {
548
			command = new Command(commandId);
555
			command = new Command(commandId);
549
			handleObjectsById.put(commandId, command);
556
			handleObjectsById.put(commandId, command);
Lines 1048-1051 public final class CommandManager extends HandleObjectManager implements Link Here
1048
			executionListener.postExecuteFailure(commandId, exception);
1055
			executionListener.postExecuteFailure(commandId, exception);
1049
		}
1056
		}
1050
	}
1057
	}
1058
1059
	/**
1060
	 * Defines an alias from sourceCommandId to targetCommandId. This makes
1061
	 * getCommand(sourceCommandId) equivalent to getCommand(targetCommandId).
1062
	 *
1063
	 * @param sourceCommandId
1064
	 *            command id of alias command
1065
	 * @param targetCommandId
1066
	 *            command id of alias target
1067
	 */
1068
	public void defineAlias(String sourceCommandId, String targetCommandId) {
1069
		commandIdAliases.put(sourceCommandId, targetCommandId);
1070
	}
1071
1072
	/**
1073
	 * Returns the alias target command id if an alias for the given commandId was
1074
	 * defined. If no alias is defined, the given commandId is returned unchanged.
1075
	 *
1076
	 * @param commandId
1077
	 *            command id to resolve
1078
	 * @return alias target command id or given command id if no alias was
1079
	 *         defined.
1080
	 */ 
1081
	private String resolveAlias(String commandId) {
1082
		String targetCommandId = (String) commandIdAliases.get(commandId);
1083
		return targetCommandId != null ? targetCommandId : commandId;
1084
	}
1051
}
1085
}
(-)schema/commands.exsd (-122 / +147 lines)
Lines 2-10 Link Here
2
<!-- Schema file written by PDE -->
2
<!-- Schema file written by PDE -->
3
<schema targetNamespace="org.eclipse.ui" xmlns="http://www.w3.org/2001/XMLSchema">
3
<schema targetNamespace="org.eclipse.ui" xmlns="http://www.w3.org/2001/XMLSchema">
4
<annotation>
4
<annotation>
5
      <appinfo>
5
      <appInfo>
6
         <meta.schema plugin="org.eclipse.ui" id="commands" name="Commands"/>
6
         <meta.schema plugin="org.eclipse.ui" id="commands" name="Commands"/>
7
      </appinfo>
7
      </appInfo>
8
      <documentation>
8
      <documentation>
9
         &lt;p&gt;
9
         &lt;p&gt;
10
The &lt;code&gt;org.eclipse.ui.commands&lt;/code&gt; extension point is used to declare commands and command categories, using the &lt;code&gt;command&lt;/code&gt; and &lt;code&gt;category&lt;/code&gt; elements. A command is an abstract representation of some semantic behaviour, but not it&apos;s actual implementation.  This allows different developers to contribute specific behaviour for their individual parts.  For example, there might be a &quot;paste&quot; command with one implementation in an editor and a different implementation in an explorer widget.  These implementations are called handlers.  Commands can also be viewed as declarative function pointers, or signal handlers.
10
The &lt;code&gt;org.eclipse.ui.commands&lt;/code&gt; extension point is used to declare commands and command categories, using the &lt;code&gt;command&lt;/code&gt; and &lt;code&gt;category&lt;/code&gt; elements. A command is an abstract representation of some semantic behaviour, but not it&apos;s actual implementation.  This allows different developers to contribute specific behaviour for their individual parts.  For example, there might be a &quot;paste&quot; command with one implementation in an editor and a different implementation in an explorer widget.  These implementations are called handlers.  Commands can also be viewed as declarative function pointers, or signal handlers.
Lines 13-18 The &lt;code&gt;org.eclipse.ui.commands&lt;/code&gt; extension point is used to Link Here
13
   </annotation>
13
   </annotation>
14
14
15
   <element name="extension">
15
   <element name="extension">
16
      <annotation>
17
         <appInfo>
18
            <meta.element />
19
         </appInfo>
20
      </annotation>
16
      <complexType>
21
      <complexType>
17
         <sequence>
22
         <sequence>
18
            <element ref="category" minOccurs="0" maxOccurs="unbounded"/>
23
            <element ref="category" minOccurs="0" maxOccurs="unbounded"/>
Lines 36-44 The &lt;code&gt;org.eclipse.ui.commands&lt;/code&gt; extension point is used to Link Here
36
               <documentation>
41
               <documentation>
37
                  An optional name of the extension instance.
42
                  An optional name of the extension instance.
38
               </documentation>
43
               </documentation>
39
               <appinfo>
44
               <appInfo>
40
                  <meta.attribute translatable="true"/>
45
                  <meta.attribute translatable="true"/>
41
               </appinfo>
46
               </appInfo>
42
            </annotation>
47
            </annotation>
43
         </attribute>
48
         </attribute>
44
         <attribute name="point" type="string" use="required">
49
         <attribute name="point" type="string" use="required">
Lines 64-78 This element is used to define commands. A command represents an request from th Link Here
64
            <element ref="defaultHandler" minOccurs="0" maxOccurs="1"/>
69
            <element ref="defaultHandler" minOccurs="0" maxOccurs="1"/>
65
            <element ref="state" minOccurs="0" maxOccurs="unbounded"/>
70
            <element ref="state" minOccurs="0" maxOccurs="unbounded"/>
66
            <element ref="commandParameter" minOccurs="0" maxOccurs="unbounded"/>
71
            <element ref="commandParameter" minOccurs="0" maxOccurs="unbounded"/>
72
            <element ref="aliasFor" minOccurs="0" maxOccurs="1"/>
67
         </sequence>
73
         </sequence>
68
         <attribute name="category" type="string">
74
         <attribute name="category" type="string">
69
            <annotation>
75
            <annotation>
70
               <documentation>
76
               <documentation>
71
                  Please use &lt;code&gt;categoryId&lt;/code&gt; instead.
77
                  Please use &lt;code&gt;categoryId&lt;/code&gt; instead.
72
               </documentation>
78
               </documentation>
73
               <appinfo>
79
               <appInfo>
74
                  <meta.attribute deprecated="true"/>
80
                  <meta.attribute deprecated="true"/>
75
               </appinfo>
81
               </appInfo>
76
            </annotation>
82
            </annotation>
77
         </attribute>
83
         </attribute>
78
         <attribute name="description" type="string">
84
         <attribute name="description" type="string">
Lines 80-88 This element is used to define commands. A command represents an request from th Link Here
80
               <documentation>
86
               <documentation>
81
                  A translatable short description of this command for display in the UI.
87
                  A translatable short description of this command for display in the UI.
82
               </documentation>
88
               </documentation>
83
               <appinfo>
89
               <appInfo>
84
                  <meta.attribute translatable="true"/>
90
                  <meta.attribute translatable="true"/>
85
               </appinfo>
91
               </appInfo>
86
            </annotation>
92
            </annotation>
87
         </attribute>
93
         </attribute>
88
         <attribute name="id" type="string" use="required">
94
         <attribute name="id" type="string" use="required">
Lines 97-105 This element is used to define commands. A command represents an request from th Link Here
97
               <documentation>
103
               <documentation>
98
                  The translatable name of this command for display in the UI. Commands are typically named in the form of an imperative verb.
104
                  The translatable name of this command for display in the UI. Commands are typically named in the form of an imperative verb.
99
               </documentation>
105
               </documentation>
100
               <appinfo>
106
               <appInfo>
101
                  <meta.attribute translatable="true"/>
107
                  <meta.attribute translatable="true"/>
102
               </appinfo>
108
               </appInfo>
103
            </annotation>
109
            </annotation>
104
         </attribute>
110
         </attribute>
105
         <attribute name="categoryId" type="string">
111
         <attribute name="categoryId" type="string">
Lines 110-118 The unique id of the category for this command. If this command does not specify Link Here
110
&lt;/p&gt;
116
&lt;/p&gt;
111
&lt;p&gt;&lt;em&gt;Since: 3.0&lt;/em&gt;&lt;/p&gt;
117
&lt;p&gt;&lt;em&gt;Since: 3.0&lt;/em&gt;&lt;/p&gt;
112
               </documentation>
118
               </documentation>
113
               <appinfo>
119
               <appInfo>
114
                  <meta.attribute kind="identifier" basedOn="org.eclipse.ui.commands/category/@id"/>
120
                  <meta.attribute kind="identifier" basedOn="org.eclipse.ui.commands/category/@id"/>
115
               </appinfo>
121
               </appInfo>
116
            </annotation>
122
            </annotation>
117
         </attribute>
123
         </attribute>
118
         <attribute name="defaultHandler" type="string">
124
         <attribute name="defaultHandler" type="string">
Lines 123-131 The default handler for this command (see the &lt;a href=&quot;org_eclipse_ui_ha Link Here
123
&lt;/p&gt;
129
&lt;/p&gt;
124
&lt;p&gt;&lt;em&gt;Since: 3.1&lt;/em&gt;&lt;/p&gt;
130
&lt;p&gt;&lt;em&gt;Since: 3.1&lt;/em&gt;&lt;/p&gt;
125
               </documentation>
131
               </documentation>
126
               <appinfo>
132
               <appInfo>
127
                  <meta.attribute kind="java" basedOn="org.eclipse.core.commands.IHandler"/>
133
                  <meta.attribute kind="java" basedOn="org.eclipse.core.commands.IHandler"/>
128
               </appinfo>
134
               </appInfo>
129
            </annotation>
135
            </annotation>
130
         </attribute>
136
         </attribute>
131
         <attribute name="returnTypeId" type="string">
137
         <attribute name="returnTypeId" type="string">
Lines 136-144 The id of a &lt;code&gt;commandParameterType&lt;/code&gt; indicating the type of Link Here
136
&lt;/p&gt;
142
&lt;/p&gt;
137
&lt;p&gt;&lt;em&gt;Since: 3.2&lt;/em&gt;&lt;/p&gt;
143
&lt;p&gt;&lt;em&gt;Since: 3.2&lt;/em&gt;&lt;/p&gt;
138
               </documentation>
144
               </documentation>
139
               <appinfo>
145
               <appInfo>
140
                  <meta.attribute kind="identifier" basedOn="org.eclipse.ui.commands/commandParameterType/@id"/>
146
                  <meta.attribute kind="identifier" basedOn="org.eclipse.ui.commands/commandParameterType/@id"/>
141
               </appinfo>
147
               </appInfo>
142
            </annotation>
148
            </annotation>
143
         </attribute>
149
         </attribute>
144
         <attribute name="helpContextId" type="string">
150
         <attribute name="helpContextId" type="string">
Lines 168-176 In the UI, commands are often organized by category to make them more manageable Link Here
168
               <documentation>
174
               <documentation>
169
                  A translatable short description of this category for display in the UI.
175
                  A translatable short description of this category for display in the UI.
170
               </documentation>
176
               </documentation>
171
               <appinfo>
177
               <appInfo>
172
                  <meta.attribute translatable="true"/>
178
                  <meta.attribute translatable="true"/>
173
               </appinfo>
179
               </appInfo>
174
            </annotation>
180
            </annotation>
175
         </attribute>
181
         </attribute>
176
         <attribute name="id" type="string" use="required">
182
         <attribute name="id" type="string" use="required">
Lines 185-193 In the UI, commands are often organized by category to make them more manageable Link Here
185
               <documentation>
191
               <documentation>
186
                  The translatable name of this category for display in the UI.
192
                  The translatable name of this category for display in the UI.
187
               </documentation>
193
               </documentation>
188
               <appinfo>
194
               <appInfo>
189
                  <meta.attribute translatable="true"/>
195
                  <meta.attribute translatable="true"/>
190
               </appinfo>
196
               </appInfo>
191
            </annotation>
197
            </annotation>
192
         </attribute>
198
         </attribute>
193
      </complexType>
199
      </complexType>
Lines 195-203 In the UI, commands are often organized by category to make them more manageable Link Here
195
201
196
   <element name="commandParameter">
202
   <element name="commandParameter">
197
      <annotation>
203
      <annotation>
198
         <appinfo>
204
         <appInfo>
199
            <meta.element labelAttribute="id"/>
205
            <meta.element labelAttribute="id"/>
200
         </appinfo>
206
         </appInfo>
201
         <documentation>
207
         <documentation>
202
            &lt;p&gt;
208
            &lt;p&gt;
203
Defines a parameter that a command should understand.  A parameter is a way to provide more information to a handler at execution time.  For example, a &quot;show view&quot; command might take a view as a parameter.  Handlers should be able to understand these parameters, so they should be treated like API.
209
Defines a parameter that a command should understand.  A parameter is a way to provide more information to a handler at execution time.  For example, a &quot;show view&quot; command might take a view as a parameter.  Handlers should be able to understand these parameters, so they should be treated like API.
Lines 221-229 Defines a parameter that a command should understand. A parameter is a way to p Link Here
221
               <documentation>
227
               <documentation>
222
                  The name for the parameter.  This is the name as it will be displayed to an end-user.  As such, it should be translatable.  The name should be short -- preferrably one word.
228
                  The name for the parameter.  This is the name as it will be displayed to an end-user.  As such, it should be translatable.  The name should be short -- preferrably one word.
223
               </documentation>
229
               </documentation>
224
               <appinfo>
230
               <appInfo>
225
                  <meta.attribute translatable="true"/>
231
                  <meta.attribute translatable="true"/>
226
               </appinfo>
232
               </appInfo>
227
            </annotation>
233
            </annotation>
228
         </attribute>
234
         </attribute>
229
         <attribute name="values" type="string">
235
         <attribute name="values" type="string">
Lines 231-239 Defines a parameter that a command should understand. A parameter is a way to p Link Here
231
               <documentation>
237
               <documentation>
232
                  The class providing a list of parameter values for the user to select.  This class should implement &lt;code&gt;org.eclipse.core.commands.IParameterValues&lt;/code&gt;.  If this class is not specified, you must specify the more verbose &lt;code&gt;values&lt;/code&gt; element.  Please see &lt;code&gt;org.eclipse.core.runtime.IExecutableExtension&lt;/code&gt;.
238
                  The class providing a list of parameter values for the user to select.  This class should implement &lt;code&gt;org.eclipse.core.commands.IParameterValues&lt;/code&gt;.  If this class is not specified, you must specify the more verbose &lt;code&gt;values&lt;/code&gt; element.  Please see &lt;code&gt;org.eclipse.core.runtime.IExecutableExtension&lt;/code&gt;.
233
               </documentation>
239
               </documentation>
234
               <appinfo>
240
               <appInfo>
235
                  <meta.attribute kind="java" basedOn="org.eclipse.core.commands.IParameterValues"/>
241
                  <meta.attribute kind="java" basedOn="org.eclipse.core.commands.IParameterValues"/>
236
               </appinfo>
242
               </appInfo>
237
            </annotation>
243
            </annotation>
238
         </attribute>
244
         </attribute>
239
         <attribute name="typeId" type="string">
245
         <attribute name="typeId" type="string">
Lines 241-249 Defines a parameter that a command should understand. A parameter is a way to p Link Here
241
               <documentation>
247
               <documentation>
242
                  The id of a commandParameterType for this commandParameter.  Specifying a typeId allows handlers of a command to convert string parameter values to objects in a consistent way and it allows potential callers of a command to look for commands that take objects of various types for their parameters.
248
                  The id of a commandParameterType for this commandParameter.  Specifying a typeId allows handlers of a command to convert string parameter values to objects in a consistent way and it allows potential callers of a command to look for commands that take objects of various types for their parameters.
243
               </documentation>
249
               </documentation>
244
               <appinfo>
250
               <appInfo>
245
                  <meta.attribute kind="identifier" basedOn="org.eclipse.ui.commands/commandParameterType/@id"/>
251
                  <meta.attribute kind="identifier" basedOn="org.eclipse.ui.commands/commandParameterType/@id"/>
246
               </appinfo>
252
               </appInfo>
247
            </annotation>
253
            </annotation>
248
         </attribute>
254
         </attribute>
249
         <attribute name="optional" type="boolean" use="default" value="true">
255
         <attribute name="optional" type="boolean" use="default" value="true">
Lines 278-286 Defines the object type of a commandParameter and may specify an &lt;code&gt;org Link Here
278
               <documentation>
284
               <documentation>
279
                  The fully qualified name of a Java class or interface to use as the type of this command parameter.  This attribute is optional, however if omitted, &lt;code&gt;java.lang.Object&lt;/code&gt; will be used as the parameter type.
285
                  The fully qualified name of a Java class or interface to use as the type of this command parameter.  This attribute is optional, however if omitted, &lt;code&gt;java.lang.Object&lt;/code&gt; will be used as the parameter type.
280
               </documentation>
286
               </documentation>
281
               <appinfo>
287
               <appInfo>
282
                  <meta.attribute kind="java"/>
288
                  <meta.attribute kind="java"/>
283
               </appinfo>
289
               </appInfo>
284
            </annotation>
290
            </annotation>
285
         </attribute>
291
         </attribute>
286
         <attribute name="converter" type="string">
292
         <attribute name="converter" type="string">
Lines 288-296 Defines the object type of a commandParameter and may specify an &lt;code&gt;org Link Here
288
               <documentation>
294
               <documentation>
289
                  The class for converting between objects and string representations of objects for command parameter values.  This class should extend &lt;code&gt;org.eclipse.core.commands.AbstractParameterValueConverter&lt;/code&gt;. The converter should produce and consume objects of the type indicated in the &lt;code&gt;type&lt;/code&gt; attribute. If this class is not specified, this facility to convert between string and object values for this parameter type will not be available (the &lt;code&gt;getValueConverter()&lt;/code&gt; on class &lt;code&gt;ParameterType&lt;/code&gt; will return &lt;code&gt;null&lt;/code&gt;).
295
                  The class for converting between objects and string representations of objects for command parameter values.  This class should extend &lt;code&gt;org.eclipse.core.commands.AbstractParameterValueConverter&lt;/code&gt;. The converter should produce and consume objects of the type indicated in the &lt;code&gt;type&lt;/code&gt; attribute. If this class is not specified, this facility to convert between string and object values for this parameter type will not be available (the &lt;code&gt;getValueConverter()&lt;/code&gt; on class &lt;code&gt;ParameterType&lt;/code&gt; will return &lt;code&gt;null&lt;/code&gt;).
290
               </documentation>
296
               </documentation>
291
               <appinfo>
297
               <appInfo>
292
                  <meta.attribute kind="java" basedOn="org.eclipse.core.commands.AbstractParameterValueConverter"/>
298
                  <meta.attribute kind="java" basedOn="org.eclipse.core.commands.AbstractParameterValueConverter"/>
293
               </appinfo>
299
               </appInfo>
294
            </annotation>
300
            </annotation>
295
         </attribute>
301
         </attribute>
296
      </complexType>
302
      </complexType>
Lines 298-306 Defines the object type of a commandParameter and may specify an &lt;code&gt;org Link Here
298
304
299
   <element name="values">
305
   <element name="values">
300
      <annotation>
306
      <annotation>
301
         <appinfo>
307
         <appInfo>
302
            <meta.element labelAttribute="class"/>
308
            <meta.element labelAttribute="class"/>
303
         </appinfo>
309
         </appInfo>
304
         <documentation>
310
         <documentation>
305
            &lt;p&gt;
311
            &lt;p&gt;
306
The more verbose version of the &lt;code&gt;values&lt;/code&gt; attribute on the &lt;code&gt;commandParameter&lt;/code&gt;.
312
The more verbose version of the &lt;code&gt;values&lt;/code&gt; attribute on the &lt;code&gt;commandParameter&lt;/code&gt;.
Lines 317-325 The more verbose version of the &lt;code&gt;values&lt;/code&gt; attribute on the Link Here
317
               <documentation>
323
               <documentation>
318
                  The class providing a list of parameter values for the user to select.  This class should implement &lt;code&gt;org.eclipse.core.commands.IParameterValues&lt;/code&gt;.  If this class is not specified, you must specify the more verbose &lt;code&gt;values&lt;/code&gt; element.  Please see &lt;code&gt;org.eclipse.core.runtime.IExecutableExtension&lt;/code&gt;.
324
                  The class providing a list of parameter values for the user to select.  This class should implement &lt;code&gt;org.eclipse.core.commands.IParameterValues&lt;/code&gt;.  If this class is not specified, you must specify the more verbose &lt;code&gt;values&lt;/code&gt; element.  Please see &lt;code&gt;org.eclipse.core.runtime.IExecutableExtension&lt;/code&gt;.
319
               </documentation>
325
               </documentation>
320
               <appinfo>
326
               <appInfo>
321
                  <meta.attribute kind="java" basedOn="org.eclipse.core.commands.IParameterValues"/>
327
                  <meta.attribute kind="java" basedOn="org.eclipse.core.commands.IParameterValues"/>
322
               </appinfo>
328
               </appInfo>
323
            </annotation>
329
            </annotation>
324
         </attribute>
330
         </attribute>
325
      </complexType>
331
      </complexType>
Lines 327-335 The more verbose version of the &lt;code&gt;values&lt;/code&gt; attribute on the Link Here
327
333
328
   <element name="parameter">
334
   <element name="parameter">
329
      <annotation>
335
      <annotation>
330
         <appinfo>
336
         <appInfo>
331
            <meta.element labelAttribute="name"/>
337
            <meta.element labelAttribute="name"/>
332
         </appinfo>
338
         </appInfo>
333
         <documentation>
339
         <documentation>
334
            &lt;p&gt;
340
            &lt;p&gt;
335
A possible value for a parameter.
341
A possible value for a parameter.
Lines 357-365 A possible value for a parameter. Link Here
357
363
358
   <element name="defaultHandler">
364
   <element name="defaultHandler">
359
      <annotation>
365
      <annotation>
360
         <appinfo>
366
         <appInfo>
361
            <meta.element labelAttribute="class"/>
367
            <meta.element labelAttribute="class"/>
362
         </appinfo>
368
         </appInfo>
363
         <documentation>
369
         <documentation>
364
            &lt;p&gt;
370
            &lt;p&gt;
365
The default handler for this command.  If no other handler is active, this handler will be active.  This handler will conflict with other handler definitions that specify no &lt;code&gt;activeWhen&lt;/code&gt; conditions.  If you are not creating an &lt;code&gt;IExecutableExtension&lt;/code&gt;, you can use the &lt;code&gt;defaultHandler&lt;/code&gt; attribute instead.
371
The default handler for this command.  If no other handler is active, this handler will be active.  This handler will conflict with other handler definitions that specify no &lt;code&gt;activeWhen&lt;/code&gt; conditions.  If you are not creating an &lt;code&gt;IExecutableExtension&lt;/code&gt;, you can use the &lt;code&gt;defaultHandler&lt;/code&gt; attribute instead.
Lines 376-384 The default handler for this command. If no other handler is active, this handl Link Here
376
               <documentation>
382
               <documentation>
377
                  The class which implements &lt;code&gt;org.eclipse.core.commands.IHandler&lt;/code&gt;.
383
                  The class which implements &lt;code&gt;org.eclipse.core.commands.IHandler&lt;/code&gt;.
378
               </documentation>
384
               </documentation>
379
               <appinfo>
385
               <appInfo>
380
                  <meta.attribute kind="java" basedOn="org.eclipse.core.commands.IHandler"/>
386
                  <meta.attribute kind="java" basedOn="org.eclipse.core.commands.IHandler"/>
381
               </appinfo>
387
               </appInfo>
382
            </annotation>
388
            </annotation>
383
         </attribute>
389
         </attribute>
384
      </complexType>
390
      </complexType>
Lines 386-394 The default handler for this command. If no other handler is active, this handl Link Here
386
392
387
   <element name="state">
393
   <element name="state">
388
      <annotation>
394
      <annotation>
389
         <appinfo>
395
         <appInfo>
390
            <meta.element labelAttribute="class"/>
396
            <meta.element labelAttribute="class"/>
391
         </appinfo>
397
         </appInfo>
392
         <documentation>
398
         <documentation>
393
            &lt;p&gt;
399
            &lt;p&gt;
394
State information shared between all handlers, and potentially persisted between sessions.The state is simply a class that is loaded to look after the state.  See the API Information for more details.  This is not used for UI attributes like a menu contribution check box state or label.
400
State information shared between all handlers, and potentially persisted between sessions.The state is simply a class that is loaded to look after the state.  See the API Information for more details.  This is not used for UI attributes like a menu contribution check box state or label.
Lines 405-413 State information shared between all handlers, and potentially persisted between Link Here
405
               <documentation>
411
               <documentation>
406
                  The class that can be loaded to store the state of this command.  State is shared amongst handlers, and can be persisted between sessions.  This class must subclass &lt;code&gt;org.eclipse.core.commands.State&lt;/code&gt;.  Please see API Information.
412
                  The class that can be loaded to store the state of this command.  State is shared amongst handlers, and can be persisted between sessions.  This class must subclass &lt;code&gt;org.eclipse.core.commands.State&lt;/code&gt;.  Please see API Information.
407
               </documentation>
413
               </documentation>
408
               <appinfo>
414
               <appInfo>
409
                  <meta.attribute kind="java" basedOn="org.eclipse.core.commands.State"/>
415
                  <meta.attribute kind="java" basedOn="org.eclipse.core.commands.State"/>
410
               </appinfo>
416
               </appInfo>
411
            </annotation>
417
            </annotation>
412
         </attribute>
418
         </attribute>
413
         <attribute name="id" type="string" use="required">
419
         <attribute name="id" type="string" use="required">
Lines 424-432 A unique identifier for this state. This is used for persisting the state betwe Link Here
424
430
425
   <element name="class">
431
   <element name="class">
426
      <annotation>
432
      <annotation>
427
         <appinfo>
433
         <appInfo>
428
            <meta.element labelAttribute="class"/>
434
            <meta.element labelAttribute="class"/>
429
         </appinfo>
435
         </appInfo>
430
         <documentation>
436
         <documentation>
431
            &lt;p&gt;
437
            &lt;p&gt;
432
The class that can be loaded to store the state of this command.  This element is used if you wish to pass multiple parameters to an &lt;code&gt;org.eclipse.core.runtime.IExecutableExtension&lt;/code&gt;.
438
The class that can be loaded to store the state of this command.  This element is used if you wish to pass multiple parameters to an &lt;code&gt;org.eclipse.core.runtime.IExecutableExtension&lt;/code&gt;.
Lines 443-451 The class that can be loaded to store the state of this command. This element i Link Here
443
               <documentation>
449
               <documentation>
444
                  The class that can be loaded to store the state of this command.  State is shared amongst handlers, and can be persisted between sessions.  This class must implement &lt;code&gt;org.eclipse.core.commands.State&lt;/code&gt;.  Please see API Information.
450
                  The class that can be loaded to store the state of this command.  State is shared amongst handlers, and can be persisted between sessions.  This class must implement &lt;code&gt;org.eclipse.core.commands.State&lt;/code&gt;.  Please see API Information.
445
               </documentation>
451
               </documentation>
446
               <appinfo>
452
               <appInfo>
447
                  <meta.attribute kind="java"/>
453
                  <meta.attribute kind="java"/>
448
               </appinfo>
454
               </appInfo>
449
            </annotation>
455
            </annotation>
450
         </attribute>
456
         </attribute>
451
      </complexType>
457
      </complexType>
Lines 453-461 The class that can be loaded to store the state of this command. This element i Link Here
453
459
454
   <element name="keyConfiguration">
460
   <element name="keyConfiguration">
455
      <annotation>
461
      <annotation>
456
         <appinfo>
462
         <appInfo>
457
            <meta.element deprecated="true"/>
463
            <meta.element deprecated="true"/>
458
         </appinfo>
464
         </appInfo>
459
         <documentation>
465
         <documentation>
460
            This element is used to define key configurations. If more than one of these elements exist with the same &lt;code&gt;id&lt;/code&gt; attribute, only the last declared element (in order of reading the plugin registry) is considered valid.  Please use the &quot;org.eclipse.ui.bindings&quot; extension point instead.
466
            This element is used to define key configurations. If more than one of these elements exist with the same &lt;code&gt;id&lt;/code&gt; attribute, only the last declared element (in order of reading the plugin registry) is considered valid.  Please use the &quot;org.eclipse.ui.bindings&quot; extension point instead.
461
         </documentation>
467
         </documentation>
Lines 466-474 The class that can be loaded to store the state of this command. This element i Link Here
466
               <documentation>
472
               <documentation>
467
                  A translatable short description of this key configuration for display in the UI.
473
                  A translatable short description of this key configuration for display in the UI.
468
               </documentation>
474
               </documentation>
469
               <appinfo>
475
               <appInfo>
470
                  <meta.attribute translatable="true" deprecated="true"/>
476
                  <meta.attribute translatable="true" deprecated="true"/>
471
               </appinfo>
477
               </appInfo>
472
            </annotation>
478
            </annotation>
473
         </attribute>
479
         </attribute>
474
         <attribute name="id" type="string" use="required">
480
         <attribute name="id" type="string" use="required">
Lines 476-484 The class that can be loaded to store the state of this command. This element i Link Here
476
               <documentation>
482
               <documentation>
477
                  The unique identifier of this key configuration.
483
                  The unique identifier of this key configuration.
478
               </documentation>
484
               </documentation>
479
               <appinfo>
485
               <appInfo>
480
                  <meta.attribute deprecated="true"/>
486
                  <meta.attribute deprecated="true"/>
481
               </appinfo>
487
               </appInfo>
482
            </annotation>
488
            </annotation>
483
         </attribute>
489
         </attribute>
484
         <attribute name="name" type="string" use="required">
490
         <attribute name="name" type="string" use="required">
Lines 486-494 The class that can be loaded to store the state of this command. This element i Link Here
486
               <documentation>
492
               <documentation>
487
                  The translatable name of this key configuration for display in the UI. If this key configuration has a parent, it is not necessary to add &quot;(extends ...)&quot; to the name. This will be automatically added by the UI where necessary.
493
                  The translatable name of this key configuration for display in the UI. If this key configuration has a parent, it is not necessary to add &quot;(extends ...)&quot; to the name. This will be automatically added by the UI where necessary.
488
               </documentation>
494
               </documentation>
489
               <appinfo>
495
               <appInfo>
490
                  <meta.attribute translatable="true" deprecated="true"/>
496
                  <meta.attribute translatable="true" deprecated="true"/>
491
               </appinfo>
497
               </appInfo>
492
            </annotation>
498
            </annotation>
493
         </attribute>
499
         </attribute>
494
         <attribute name="parent" type="string">
500
         <attribute name="parent" type="string">
Lines 497-505 The class that can be loaded to store the state of this command. This element i Link Here
497
                  The unique id of the parent key configuration. If this key configuration has a parent, it will borrow all key bindings from its parent, in addition to the key bindings defined in its own key configuration.
503
                  The unique id of the parent key configuration. If this key configuration has a parent, it will borrow all key bindings from its parent, in addition to the key bindings defined in its own key configuration.
498
@deprecated Please use parentId instead.
504
@deprecated Please use parentId instead.
499
               </documentation>
505
               </documentation>
500
               <appinfo>
506
               <appInfo>
501
                  <meta.attribute deprecated="true"/>
507
                  <meta.attribute deprecated="true"/>
502
               </appinfo>
508
               </appInfo>
503
            </annotation>
509
            </annotation>
504
         </attribute>
510
         </attribute>
505
         <attribute name="parentId" type="string">
511
         <attribute name="parentId" type="string">
Lines 507-515 The class that can be loaded to store the state of this command. This element i Link Here
507
               <documentation>
513
               <documentation>
508
                  The unique id of the parent key configuration. If this key configuration has a parent, it will borrow all key bindings from its parent, in addition to the key bindings defined in its own key configuration.
514
                  The unique id of the parent key configuration. If this key configuration has a parent, it will borrow all key bindings from its parent, in addition to the key bindings defined in its own key configuration.
509
               </documentation>
515
               </documentation>
510
               <appinfo>
516
               <appInfo>
511
                  <meta.attribute deprecated="true"/>
517
                  <meta.attribute deprecated="true"/>
512
               </appinfo>
518
               </appInfo>
513
            </annotation>
519
            </annotation>
514
         </attribute>
520
         </attribute>
515
      </complexType>
521
      </complexType>
Lines 517-525 The class that can be loaded to store the state of this command. This element i Link Here
517
523
518
   <element name="context">
524
   <element name="context">
519
      <annotation>
525
      <annotation>
520
         <appinfo>
526
         <appInfo>
521
            <meta.element deprecated="true"/>
527
            <meta.element deprecated="true"/>
522
         </appinfo>
528
         </appInfo>
523
         <documentation>
529
         <documentation>
524
            This element is used to define contexts. If more than one of these elements exist with the same &lt;code&gt;id&lt;/code&gt; attribute, only the last declared element (in order of reading the plugin registry) is considered valid.  Please use the &lt;a href=&quot;org_eclipse_ui_contexts.html&quot;&gt;org.eclipse.ui.contexts&lt;/a&gt; extension point instead.
530
            This element is used to define contexts. If more than one of these elements exist with the same &lt;code&gt;id&lt;/code&gt; attribute, only the last declared element (in order of reading the plugin registry) is considered valid.  Please use the &lt;a href=&quot;org_eclipse_ui_contexts.html&quot;&gt;org.eclipse.ui.contexts&lt;/a&gt; extension point instead.
525
         </documentation>
531
         </documentation>
Lines 530-538 The class that can be loaded to store the state of this command. This element i Link Here
530
               <documentation>
536
               <documentation>
531
                  A translatable short description of this context for display in the UI.
537
                  A translatable short description of this context for display in the UI.
532
               </documentation>
538
               </documentation>
533
               <appinfo>
539
               <appInfo>
534
                  <meta.attribute translatable="true" deprecated="true"/>
540
                  <meta.attribute translatable="true" deprecated="true"/>
535
               </appinfo>
541
               </appInfo>
536
            </annotation>
542
            </annotation>
537
         </attribute>
543
         </attribute>
538
         <attribute name="id" type="string" use="required">
544
         <attribute name="id" type="string" use="required">
Lines 540-548 The class that can be loaded to store the state of this command. This element i Link Here
540
               <documentation>
546
               <documentation>
541
                  The unique identifier of this context.
547
                  The unique identifier of this context.
542
               </documentation>
548
               </documentation>
543
               <appinfo>
549
               <appInfo>
544
                  <meta.attribute deprecated="true"/>
550
                  <meta.attribute deprecated="true"/>
545
               </appinfo>
551
               </appInfo>
546
            </annotation>
552
            </annotation>
547
         </attribute>
553
         </attribute>
548
         <attribute name="name" type="string" use="required">
554
         <attribute name="name" type="string" use="required">
Lines 550-558 The class that can be loaded to store the state of this command. This element i Link Here
550
               <documentation>
556
               <documentation>
551
                  The translatable name of this context for display in the UI. If this context has a parent, it is not necessary to add &quot;(extends parent)&quot; to the name. This will be automatically added by the UI where necessary.
557
                  The translatable name of this context for display in the UI. If this context has a parent, it is not necessary to add &quot;(extends parent)&quot; to the name. This will be automatically added by the UI where necessary.
552
               </documentation>
558
               </documentation>
553
               <appinfo>
559
               <appInfo>
554
                  <meta.attribute translatable="true" deprecated="true"/>
560
                  <meta.attribute translatable="true" deprecated="true"/>
555
               </appinfo>
561
               </appInfo>
556
            </annotation>
562
            </annotation>
557
         </attribute>
563
         </attribute>
558
         <attribute name="parent" type="string">
564
         <attribute name="parent" type="string">
Lines 561-569 The class that can be loaded to store the state of this command. This element i Link Here
561
                  The unique id of the parent context. If this context has a parent, it will borrow all key bindings from its parent, in addition to the key bindings defined in its own context.
567
                  The unique id of the parent context. If this context has a parent, it will borrow all key bindings from its parent, in addition to the key bindings defined in its own context.
562
@deprecated Please use &quot;parentId&quot; instead.
568
@deprecated Please use &quot;parentId&quot; instead.
563
               </documentation>
569
               </documentation>
564
               <appinfo>
570
               <appInfo>
565
                  <meta.attribute deprecated="true"/>
571
                  <meta.attribute deprecated="true"/>
566
               </appinfo>
572
               </appInfo>
567
            </annotation>
573
            </annotation>
568
         </attribute>
574
         </attribute>
569
         <attribute name="parentId" type="string">
575
         <attribute name="parentId" type="string">
Lines 571-579 The class that can be loaded to store the state of this command. This element i Link Here
571
               <documentation>
577
               <documentation>
572
                  The unique id of the parent context. If this context has a parent, it will borrow all key bindings from its parent, in addition to the key bindings defined in its own context.
578
                  The unique id of the parent context. If this context has a parent, it will borrow all key bindings from its parent, in addition to the key bindings defined in its own context.
573
               </documentation>
579
               </documentation>
574
               <appinfo>
580
               <appInfo>
575
                  <meta.attribute deprecated="true"/>
581
                  <meta.attribute deprecated="true"/>
576
               </appinfo>
582
               </appInfo>
577
            </annotation>
583
            </annotation>
578
         </attribute>
584
         </attribute>
579
      </complexType>
585
      </complexType>
Lines 581-589 The class that can be loaded to store the state of this command. This element i Link Here
581
587
582
   <element name="scope">
588
   <element name="scope">
583
      <annotation>
589
      <annotation>
584
         <appinfo>
590
         <appInfo>
585
            <meta.element labelAttribute="id" deprecated="true"/>
591
            <meta.element labelAttribute="id" deprecated="true"/>
586
         </appinfo>
592
         </appInfo>
587
         <documentation>
593
         <documentation>
588
            This element is used to define scopes. If more than one of these elements exist with the same &lt;code&gt;id&lt;/code&gt; attribute, only the last declared element (in order of reading the plugin registry) is considered valid.
594
            This element is used to define scopes. If more than one of these elements exist with the same &lt;code&gt;id&lt;/code&gt; attribute, only the last declared element (in order of reading the plugin registry) is considered valid.
589
@deprecated Please use the &quot;org.eclipse.ui.contexts&quot; extension point instead.
595
@deprecated Please use the &quot;org.eclipse.ui.contexts&quot; extension point instead.
Lines 597-605 The class that can be loaded to store the state of this command. This element i Link Here
597
603
598
@deprecated Please use the &quot;org.eclipse.ui.contexts&quot; extension point instead.
604
@deprecated Please use the &quot;org.eclipse.ui.contexts&quot; extension point instead.
599
               </documentation>
605
               </documentation>
600
               <appinfo>
606
               <appInfo>
601
                  <meta.attribute translatable="true" deprecated="true"/>
607
                  <meta.attribute translatable="true" deprecated="true"/>
602
               </appinfo>
608
               </appInfo>
603
            </annotation>
609
            </annotation>
604
         </attribute>
610
         </attribute>
605
         <attribute name="id" type="string" use="required">
611
         <attribute name="id" type="string" use="required">
Lines 609-617 The class that can be loaded to store the state of this command. This element i Link Here
609
615
610
@deprecated Please use the &quot;org.eclipse.ui.contexts&quot; extension point instead.
616
@deprecated Please use the &quot;org.eclipse.ui.contexts&quot; extension point instead.
611
               </documentation>
617
               </documentation>
612
               <appinfo>
618
               <appInfo>
613
                  <meta.attribute deprecated="true"/>
619
                  <meta.attribute deprecated="true"/>
614
               </appinfo>
620
               </appInfo>
615
            </annotation>
621
            </annotation>
616
         </attribute>
622
         </attribute>
617
         <attribute name="name" type="string" use="required">
623
         <attribute name="name" type="string" use="required">
Lines 621-629 The class that can be loaded to store the state of this command. This element i Link Here
621
627
622
@deprecated Please use the &quot;org.eclipse.ui.contexts&quot; extension point instead.
628
@deprecated Please use the &quot;org.eclipse.ui.contexts&quot; extension point instead.
623
               </documentation>
629
               </documentation>
624
               <appinfo>
630
               <appInfo>
625
                  <meta.attribute translatable="true" deprecated="true"/>
631
                  <meta.attribute translatable="true" deprecated="true"/>
626
               </appinfo>
632
               </appInfo>
627
            </annotation>
633
            </annotation>
628
         </attribute>
634
         </attribute>
629
         <attribute name="parent" type="string">
635
         <attribute name="parent" type="string">
Lines 633-641 The class that can be loaded to store the state of this command. This element i Link Here
633
639
634
@deprecated Please use the &quot;org.eclipse.ui.contexts&quot; extension point instead.
640
@deprecated Please use the &quot;org.eclipse.ui.contexts&quot; extension point instead.
635
               </documentation>
641
               </documentation>
636
               <appinfo>
642
               <appInfo>
637
                  <meta.attribute deprecated="true"/>
643
                  <meta.attribute deprecated="true"/>
638
               </appinfo>
644
               </appInfo>
639
            </annotation>
645
            </annotation>
640
         </attribute>
646
         </attribute>
641
      </complexType>
647
      </complexType>
Lines 643-651 The class that can be loaded to store the state of this command. This element i Link Here
643
649
644
   <element name="activeKeyConfiguration">
650
   <element name="activeKeyConfiguration">
645
      <annotation>
651
      <annotation>
646
         <appinfo>
652
         <appInfo>
647
            <meta.element deprecated="true"/>
653
            <meta.element deprecated="true"/>
648
         </appinfo>
654
         </appInfo>
649
         <documentation>
655
         <documentation>
650
            &lt;p&gt;
656
            &lt;p&gt;
651
This element is used to define the initial active key configuration for Eclipse. If more than one of these elements exist, only the last declared element (in order of reading the plugin registry) is considered valid.
657
This element is used to define the initial active key configuration for Eclipse. If more than one of these elements exist, only the last declared element (in order of reading the plugin registry) is considered valid.
Lines 661-669 This element has been replaced with a preference. If your application needs to Link Here
661
               <documentation>
667
               <documentation>
662
                  The unique id (&lt;code&gt;id&lt;/code&gt; attribute) of the keyConfiguration element one wishes to be initially active.
668
                  The unique id (&lt;code&gt;id&lt;/code&gt; attribute) of the keyConfiguration element one wishes to be initially active.
663
               </documentation>
669
               </documentation>
664
               <appinfo>
670
               <appInfo>
665
                  <meta.attribute deprecated="true"/>
671
                  <meta.attribute deprecated="true"/>
666
               </appinfo>
672
               </appInfo>
667
            </annotation>
673
            </annotation>
668
         </attribute>
674
         </attribute>
669
         <attribute name="keyConfigurationId" type="string">
675
         <attribute name="keyConfigurationId" type="string">
Lines 671-679 This element has been replaced with a preference. If your application needs to Link Here
671
               <documentation>
677
               <documentation>
672
                  The unique id (&lt;code&gt;id&lt;/code&gt; attribute) of the keyConfiguration element one wishes to be initially active.
678
                  The unique id (&lt;code&gt;id&lt;/code&gt; attribute) of the keyConfiguration element one wishes to be initially active.
673
               </documentation>
679
               </documentation>
674
               <appinfo>
680
               <appInfo>
675
                  <meta.attribute deprecated="true"/>
681
                  <meta.attribute deprecated="true"/>
676
               </appinfo>
682
               </appInfo>
677
            </annotation>
683
            </annotation>
678
         </attribute>
684
         </attribute>
679
      </complexType>
685
      </complexType>
Lines 681-689 This element has been replaced with a preference. If your application needs to Link Here
681
687
682
   <element name="keyBinding">
688
   <element name="keyBinding">
683
      <annotation>
689
      <annotation>
684
         <appinfo>
690
         <appInfo>
685
            <meta.element deprecated="true"/>
691
            <meta.element deprecated="true"/>
686
         </appinfo>
692
         </appInfo>
687
         <documentation>
693
         <documentation>
688
            This element allows one to assign key sequences to commands.  Please use the &lt;code&gt;key&lt;/code&gt; element in the &quot;org.eclipse.ui.bindings&quot; extension point instead.
694
            This element allows one to assign key sequences to commands.  Please use the &lt;code&gt;key&lt;/code&gt; element in the &quot;org.eclipse.ui.bindings&quot; extension point instead.
689
         </documentation>
695
         </documentation>
Lines 695-703 This element has been replaced with a preference. If your application needs to Link Here
695
                  The unique id of the key configuration of this key binding.
701
                  The unique id of the key configuration of this key binding.
696
@deprecated Please use keyConfigurationId instead.
702
@deprecated Please use keyConfigurationId instead.
697
               </documentation>
703
               </documentation>
698
               <appinfo>
704
               <appInfo>
699
                  <meta.attribute deprecated="true"/>
705
                  <meta.attribute deprecated="true"/>
700
               </appinfo>
706
               </appInfo>
701
            </annotation>
707
            </annotation>
702
         </attribute>
708
         </attribute>
703
         <attribute name="command" type="string">
709
         <attribute name="command" type="string">
Lines 706-714 This element has been replaced with a preference. If your application needs to Link Here
706
                  The unique identifier of the command to which the key sequence specified by this key binding is assigned. If the value of this attribute is an empty string, the key sequence is assigned to an internal &apos;no operation&apos; command. This is useful for &apos;undefining&apos; key bindings in specific key configurations and contexts which may have been borrowed from their parents.
712
                  The unique identifier of the command to which the key sequence specified by this key binding is assigned. If the value of this attribute is an empty string, the key sequence is assigned to an internal &apos;no operation&apos; command. This is useful for &apos;undefining&apos; key bindings in specific key configurations and contexts which may have been borrowed from their parents.
707
@deprecated Please use &quot;commandId&quot; instead.
713
@deprecated Please use &quot;commandId&quot; instead.
708
               </documentation>
714
               </documentation>
709
               <appinfo>
715
               <appInfo>
710
                  <meta.attribute deprecated="true"/>
716
                  <meta.attribute deprecated="true"/>
711
               </appinfo>
717
               </appInfo>
712
            </annotation>
718
            </annotation>
713
         </attribute>
719
         </attribute>
714
         <attribute name="locale" type="string">
720
         <attribute name="locale" type="string">
Lines 716-724 This element has been replaced with a preference. If your application needs to Link Here
716
               <documentation>
722
               <documentation>
717
                  An optional attribute indicating that this key binding is only defined for the specified locale. Locales are specified according to the format declared in &lt;code&gt;java.util.Locale&lt;/code&gt;.
723
                  An optional attribute indicating that this key binding is only defined for the specified locale. Locales are specified according to the format declared in &lt;code&gt;java.util.Locale&lt;/code&gt;.
718
               </documentation>
724
               </documentation>
719
               <appinfo>
725
               <appInfo>
720
                  <meta.attribute deprecated="true"/>
726
                  <meta.attribute deprecated="true"/>
721
               </appinfo>
727
               </appInfo>
722
            </annotation>
728
            </annotation>
723
         </attribute>
729
         </attribute>
724
         <attribute name="platform" type="string">
730
         <attribute name="platform" type="string">
Lines 726-734 This element has been replaced with a preference. If your application needs to Link Here
726
               <documentation>
732
               <documentation>
727
                  An optional attribute indicating that this key binding is only defined for the specified platform. The possible values of the &lt;code&gt;platform&lt;/code&gt; attribute are the set of the possible values returned by &lt;code&gt;org.eclipse.swt.SWT.getPlatform()&lt;/code&gt;.
733
                  An optional attribute indicating that this key binding is only defined for the specified platform. The possible values of the &lt;code&gt;platform&lt;/code&gt; attribute are the set of the possible values returned by &lt;code&gt;org.eclipse.swt.SWT.getPlatform()&lt;/code&gt;.
728
               </documentation>
734
               </documentation>
729
               <appinfo>
735
               <appInfo>
730
                  <meta.attribute deprecated="true"/>
736
                  <meta.attribute deprecated="true"/>
731
               </appinfo>
737
               </appInfo>
732
            </annotation>
738
            </annotation>
733
         </attribute>
739
         </attribute>
734
         <attribute name="contextId" type="string">
740
         <attribute name="contextId" type="string">
Lines 736-744 This element has been replaced with a preference. If your application needs to Link Here
736
               <documentation>
742
               <documentation>
737
                  The unique id of the context of this key binding.
743
                  The unique id of the context of this key binding.
738
               </documentation>
744
               </documentation>
739
               <appinfo>
745
               <appInfo>
740
                  <meta.attribute deprecated="true"/>
746
                  <meta.attribute deprecated="true"/>
741
               </appinfo>
747
               </appInfo>
742
            </annotation>
748
            </annotation>
743
         </attribute>
749
         </attribute>
744
         <attribute name="string" type="string">
750
         <attribute name="string" type="string">
Lines 747-755 This element has been replaced with a preference. If your application needs to Link Here
747
                  The key sequence to assign to the command. Key sequences consist of one or more key strokes, where a key stroke consists of a key on the keyboard, optionally pressed in combination with one or more of the following modifiers: Ctrl, Alt, Shift, and Command. Key strokes are separated by spaces, and modifiers are separated by &apos;+&apos; characters.
753
                  The key sequence to assign to the command. Key sequences consist of one or more key strokes, where a key stroke consists of a key on the keyboard, optionally pressed in combination with one or more of the following modifiers: Ctrl, Alt, Shift, and Command. Key strokes are separated by spaces, and modifiers are separated by &apos;+&apos; characters.
748
@deprecated Please use &quot;keySequence&quot; instead.
754
@deprecated Please use &quot;keySequence&quot; instead.
749
               </documentation>
755
               </documentation>
750
               <appinfo>
756
               <appInfo>
751
                  <meta.attribute deprecated="true"/>
757
                  <meta.attribute deprecated="true"/>
752
               </appinfo>
758
               </appInfo>
753
            </annotation>
759
            </annotation>
754
         </attribute>
760
         </attribute>
755
         <attribute name="scope" type="string">
761
         <attribute name="scope" type="string">
Lines 758-766 This element has been replaced with a preference. If your application needs to Link Here
758
                  The unique id of the context of this key binding.
764
                  The unique id of the context of this key binding.
759
@deprecated Please use &quot;contextId&quot; instead.  The old default scope, &quot;org.eclipse.ui.globalScope&quot;, has been changed to &quot;org.eclipse.ui.contexts.window&quot;.  The old name is still supported, but it is deprecated.
765
@deprecated Please use &quot;contextId&quot; instead.  The old default scope, &quot;org.eclipse.ui.globalScope&quot;, has been changed to &quot;org.eclipse.ui.contexts.window&quot;.  The old name is still supported, but it is deprecated.
760
               </documentation>
766
               </documentation>
761
               <appinfo>
767
               <appInfo>
762
                  <meta.attribute deprecated="true"/>
768
                  <meta.attribute deprecated="true"/>
763
               </appinfo>
769
               </appInfo>
764
            </annotation>
770
            </annotation>
765
         </attribute>
771
         </attribute>
766
         <attribute name="keyConfigurationId" type="string">
772
         <attribute name="keyConfigurationId" type="string">
Lines 769-777 This element has been replaced with a preference. If your application needs to Link Here
769
                  The unique id of the key configuration of this key binding.
775
                  The unique id of the key configuration of this key binding.
770
@deprecated Please use the &lt;code&gt;schemeId&lt;/code&gt; attribute on the &lt;code&gt;key&lt;/code&gt; element in the new &quot;org.eclipse.ui.bindings&quot; extension point.
776
@deprecated Please use the &lt;code&gt;schemeId&lt;/code&gt; attribute on the &lt;code&gt;key&lt;/code&gt; element in the new &quot;org.eclipse.ui.bindings&quot; extension point.
771
               </documentation>
777
               </documentation>
772
               <appinfo>
778
               <appInfo>
773
                  <meta.attribute deprecated="true"/>
779
                  <meta.attribute deprecated="true"/>
774
               </appinfo>
780
               </appInfo>
775
            </annotation>
781
            </annotation>
776
         </attribute>
782
         </attribute>
777
         <attribute name="commandId" type="string">
783
         <attribute name="commandId" type="string">
Lines 779-787 This element has been replaced with a preference. If your application needs to Link Here
779
               <documentation>
785
               <documentation>
780
                  The unique identifier of the command to which the key sequence specified by this key binding is assigned. If the value of this attribute is an empty string, the key sequence is assigned to an internal &apos;no operation&apos; command. This is useful for &apos;undefining&apos; key bindings in specific key configurations and contexts which may have been borrowed from their parents.
786
                  The unique identifier of the command to which the key sequence specified by this key binding is assigned. If the value of this attribute is an empty string, the key sequence is assigned to an internal &apos;no operation&apos; command. This is useful for &apos;undefining&apos; key bindings in specific key configurations and contexts which may have been borrowed from their parents.
781
               </documentation>
787
               </documentation>
782
               <appinfo>
788
               <appInfo>
783
                  <meta.attribute deprecated="true"/>
789
                  <meta.attribute deprecated="true"/>
784
               </appinfo>
790
               </appInfo>
785
            </annotation>
791
            </annotation>
786
         </attribute>
792
         </attribute>
787
         <attribute name="keySequence" type="string">
793
         <attribute name="keySequence" type="string">
Lines 791-817 This element has been replaced with a preference. If your application needs to Link Here
791
&lt;p&gt;The modifier keys can also be expressed in a platform-independent way.  On MacOS X, for example, &quot;Command&quot; is almost always used in place of &quot;Ctrl&quot;.  So, we provide &quot;M1&quot; which will map to either &quot;Ctrl&quot; or &quot;Command&quot;, as appropriate.  Similarly, &quot;M2&quot; is &quot;Shift&quot;; &quot;M3&quot; is &quot;Alt&quot;; and &quot;M4&quot; is &quot;Ctrl&quot; (MacOS X).  If more platforms are added, then you can count on these aliases being mapped to good platform defaults.&lt;/p&gt;
797
&lt;p&gt;The modifier keys can also be expressed in a platform-independent way.  On MacOS X, for example, &quot;Command&quot; is almost always used in place of &quot;Ctrl&quot;.  So, we provide &quot;M1&quot; which will map to either &quot;Ctrl&quot; or &quot;Command&quot;, as appropriate.  Similarly, &quot;M2&quot; is &quot;Shift&quot;; &quot;M3&quot; is &quot;Alt&quot;; and &quot;M4&quot; is &quot;Ctrl&quot; (MacOS X).  If more platforms are added, then you can count on these aliases being mapped to good platform defaults.&lt;/p&gt;
792
&lt;p&gt;The syntax for this string is defined in &lt;code&gt;org.eclipse.ui.internal.keys&lt;/code&gt;.  Briefly, the string is case insensitive -- though all capitals is preferred stylistically.  If the key is a letter, then simply append the letter.  If the key is a special key (i.e., non-ASCII), then use one of the following: ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT, ARROW_UP, BREAK, CAPS_LOCK, END, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, HOME, INSERT, NUM_LOCK, NUMPAD_0, NUMPAD_1, NUMPAD_2, NUMPAD_3, NUMPAD_4, NUMPAD_5, NUMPAD_6, NUMPAD_7, NUMPAD_8, NUMPAD_9, NUMPAD_ADD, NUMPAD_DECIMAL, NUMPAD_DIVIDE, NUMPAD_ENTER, NUMPAD_EQUAL, NUMPAD_MULTIPLY, NUMPAD_SUBTRACT, PAGE_UP, PAGE_DOWN, PAUSE, PRINT_SCREEN, or SCROLL_LOCK.  If the key is a non-printable ASCII key, then use one of the following: BS, CR, DEL, ESC, FF, LF, NUL, SPACE, TAB, or VT.  Note that the main keyboard enter/return key is CR.&lt;/p&gt;
798
&lt;p&gt;The syntax for this string is defined in &lt;code&gt;org.eclipse.ui.internal.keys&lt;/code&gt;.  Briefly, the string is case insensitive -- though all capitals is preferred stylistically.  If the key is a letter, then simply append the letter.  If the key is a special key (i.e., non-ASCII), then use one of the following: ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT, ARROW_UP, BREAK, CAPS_LOCK, END, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, HOME, INSERT, NUM_LOCK, NUMPAD_0, NUMPAD_1, NUMPAD_2, NUMPAD_3, NUMPAD_4, NUMPAD_5, NUMPAD_6, NUMPAD_7, NUMPAD_8, NUMPAD_9, NUMPAD_ADD, NUMPAD_DECIMAL, NUMPAD_DIVIDE, NUMPAD_ENTER, NUMPAD_EQUAL, NUMPAD_MULTIPLY, NUMPAD_SUBTRACT, PAGE_UP, PAGE_DOWN, PAUSE, PRINT_SCREEN, or SCROLL_LOCK.  If the key is a non-printable ASCII key, then use one of the following: BS, CR, DEL, ESC, FF, LF, NUL, SPACE, TAB, or VT.  Note that the main keyboard enter/return key is CR.&lt;/p&gt;
793
               </documentation>
799
               </documentation>
794
               <appinfo>
800
               <appInfo>
795
                  <meta.attribute deprecated="true"/>
801
                  <meta.attribute deprecated="true"/>
796
               </appinfo>
802
               </appInfo>
803
            </annotation>
804
         </attribute>
805
      </complexType>
806
   </element>
807
808
   <element name="aliasFor">
809
      <annotation>
810
         <documentation>
811
            Adding an &quot;aliasFor&quot; element to a command makes the command an alias for another command specified by the &quot;commandId&quot; attribute of the &quot;aliasFor&quot; element. This allows to refactor commands and change their ids in a backward-compatible fashion by defining a new command and making the old one an alias for the new one. All attributes of the alias command except the id will be ignored. The command itself will not be defined, wherever the command id is used, the alias command is used instead.
812
         </documentation>
813
      </annotation>
814
      <complexType>
815
         <attribute name="commandId" type="string" use="required">
816
            <annotation>
817
               <documentation>
818
                  This is the id of the Command that this command is an alias for.
819
               </documentation>
820
               <appInfo>
821
                  <meta.attribute kind="identifier" basedOn="org.eclipse.ui.commands/command/@id"/>
822
               </appInfo>
797
            </annotation>
823
            </annotation>
798
         </attribute>
824
         </attribute>
799
      </complexType>
825
      </complexType>
800
   </element>
826
   </element>
801
827
802
   <annotation>
828
   <annotation>
803
      <appinfo>
829
      <appInfo>
804
         <meta.section type="since"/>
830
         <meta.section type="since"/>
805
      </appinfo>
831
      </appInfo>
806
      <documentation>
832
      <documentation>
807
2.1
833
         2.1
808
      </documentation>
834
      </documentation>
809
   </annotation>
835
   </annotation>
810
836
811
   <annotation>
837
   <annotation>
812
      <appinfo>
838
      <appInfo>
813
         <meta.section type="examples"/>
839
         <meta.section type="examples"/>
814
      </appinfo>
840
      </appInfo>
815
      <documentation>
841
      <documentation>
816
         &lt;p&gt;
842
         &lt;p&gt;
817
The &lt;code&gt;plugin.xml&lt;/code&gt; file in the &lt;code&gt;org.eclipse.ui&lt;/code&gt; plugin makes extensive use of the &lt;code&gt;org.eclipse.ui.commands&lt;/code&gt; extension point.
843
The &lt;code&gt;plugin.xml&lt;/code&gt; file in the &lt;code&gt;org.eclipse.ui&lt;/code&gt; plugin makes extensive use of the &lt;code&gt;org.eclipse.ui.commands&lt;/code&gt; extension point.
Lines 820-828 The &lt;code&gt;plugin.xml&lt;/code&gt; file in the &lt;code&gt;org.eclipse.ui&l Link Here
820
   </annotation>
846
   </annotation>
821
847
822
   <annotation>
848
   <annotation>
823
      <appinfo>
849
      <appInfo>
824
         <meta.section type="apiInfo"/>
850
         <meta.section type="apiInfo"/>
825
      </appinfo>
851
      </appInfo>
826
      <documentation>
852
      <documentation>
827
         &lt;p&gt;
853
         &lt;p&gt;
828
Handlers can be registered with commands using the &lt;code&gt;org.eclipse.ui.handlers.IHandlerService&lt;/code&gt;.  This can be retrieved from various workbench components (e.g., workbench, workbench window, part site, etc.) by calling &lt;code&gt;getService(IHandlerService.class)&lt;/code&gt;.
854
Handlers can be registered with commands using the &lt;code&gt;org.eclipse.ui.handlers.IHandlerService&lt;/code&gt;.  This can be retrieved from various workbench components (e.g., workbench, workbench window, part site, etc.) by calling &lt;code&gt;getService(IHandlerService.class)&lt;/code&gt;.
Lines 845-855 There are a few default implementations of handler states that may be useful to Link Here
845
   </annotation>
871
   </annotation>
846
872
847
873
848
849
   <annotation>
874
   <annotation>
850
      <appinfo>
875
      <appInfo>
851
         <meta.section type="copyright"/>
876
         <meta.section type="copyright"/>
852
      </appinfo>
877
      </appInfo>
853
      <documentation>
878
      <documentation>
854
         Copyright (c) 2000, 2007 IBM Corporation and others.&lt;br&gt;
879
         Copyright (c) 2000, 2007 IBM Corporation and others.&lt;br&gt;
855
All rights reserved. This program and the accompanying materials are made
880
All rights reserved. This program and the accompanying materials are made

Return to bug 298530