Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 128074 Details for
Bug 267409
[Contributions] Tests for toggle state and radio state
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Test v01
ToggleStateTest v01.txt (text/plain), 3.96 KB, created by
Prakash Rangaraj
on 2009-03-09 14:07:34 EDT
(
hide
)
Description:
Test v01
Filename:
MIME Type:
Creator:
Prakash Rangaraj
Created:
2009-03-09 14:07:34 EDT
Size:
3.96 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.workbench >Index: Eclipse UI/org/eclipse/ui/internal/handlers/HandlerProxy.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/HandlerProxy.java,v >retrieving revision 1.29 >diff -u -r1.29 HandlerProxy.java >--- Eclipse UI/org/eclipse/ui/internal/handlers/HandlerProxy.java 6 Mar 2009 17:38:24 -0000 1.29 >+++ Eclipse UI/org/eclipse/ui/internal/handlers/HandlerProxy.java 9 Mar 2009 18:06:07 -0000 >@@ -466,6 +466,7 @@ > public void handleStateChange(State state, Object oldValue) { > if (state.getId().equals(RegistryToggleState.STATE_ID)) { > checkedState = state; >+ refreshElements(); > } else if (state.getId().equals(RadioState.STATE_ID)) { > radioState = state; > refreshElements(); >#P org.eclipse.ui.tests >Index: Eclipse UI Tests/org/eclipse/ui/tests/commands/ToggleStateTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/ToggleStateTest.java,v >retrieving revision 1.2 >diff -u -r1.2 ToggleStateTest.java >--- Eclipse UI Tests/org/eclipse/ui/tests/commands/ToggleStateTest.java 6 Mar 2009 17:38:23 -0000 1.2 >+++ Eclipse UI Tests/org/eclipse/ui/tests/commands/ToggleStateTest.java 9 Mar 2009 18:06:15 -0000 >@@ -13,10 +13,16 @@ > > import org.eclipse.core.commands.Command; > import org.eclipse.core.commands.ExecutionException; >+import org.eclipse.core.commands.Parameterization; >+import org.eclipse.core.commands.ParameterizedCommand; > import org.eclipse.core.commands.State; >+import org.eclipse.jface.resource.ImageDescriptor; > import org.eclipse.ui.commands.ICommandService; >+import org.eclipse.ui.commands.IElementReference; > import org.eclipse.ui.handlers.IHandlerService; > import org.eclipse.ui.handlers.RegistryToggleState; >+import org.eclipse.ui.menus.UIElement; >+import org.eclipse.ui.services.IServiceLocator; > import org.eclipse.ui.tests.harness.util.UITestCase; > > /** >@@ -71,6 +77,57 @@ > } > } > >+ static class MyUIElement extends UIElement{ >+ >+ private boolean checked; >+ protected MyUIElement(IServiceLocator serviceLocator){ >+ super(serviceLocator); >+ } >+ >+ public void setDisabledIcon(ImageDescriptor desc) {} >+ public void setHoverIcon(ImageDescriptor desc) {} >+ public void setIcon(ImageDescriptor desc) {} >+ public void setText(String text) {} >+ public void setTooltip(String text) {} >+ >+ public void setChecked(boolean checked) { >+ this.checked = checked; >+ } >+ >+ public boolean isChecked() { >+ return checked; >+ } >+ >+ } >+ >+ public void testMultipleContributions() throws Exception{ >+ >+ Command command1 = commandService.getCommand("org.eclipse.ui.tests.toggleStateCommand1"); >+ ParameterizedCommand parameterizedCommand = new ParameterizedCommand(command1, new Parameterization[0]); >+ >+ MyUIElement element1 = new MyUIElement(fWorkbench); >+ MyUIElement element2 = new MyUIElement(fWorkbench); >+ >+ IElementReference reference1 = commandService.registerElementForCommand(parameterizedCommand, element1); >+ IElementReference reference2 = commandService.registerElementForCommand(parameterizedCommand, element2); >+ >+ try{ >+ >+ commandService.refreshElements(command1.getId(), null); >+ assertEquals(element1.isChecked(), element2.isChecked()); >+ >+ Boolean oldValue = (Boolean) handlerService.executeCommand(command1.getId(), null); >+ //value should have changed >+ assertEquals(!oldValue.booleanValue(), element1.isChecked()); >+ //and changed in both places >+ assertEquals(element1.isChecked(), element2.isChecked()); >+ >+ }finally { >+ commandService.unregisterElement(reference1); >+ commandService.unregisterElement(reference2); >+ } >+ >+ } > > private void assertState(Command command1, boolean expectedValue) { > State state = command1.getState(RegistryToggleState.STATE_ID);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 267409
: 128074 |
129936