forked from eclipse-platform/eclipse.platform.ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Undo Redo Buttons do not react on E4 handlers
fixes eclipse-platform#977 Undo Redo can now be enabled by E4 Handlers. How To Test: Open the E4UndoRedoTestPart using the Quick Access Check that undo redo is enabled in the menu and tool bar Check that a pop up appears when undo or redo is pressed Switch to a text editor, do the same checks but the behavior should match what you expect from the text editor
- Loading branch information
Showing
4 changed files
with
87 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/e4/E4UndoRedoTestPart.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
|
||
package org.eclipse.ui.tests.e4; | ||
|
||
|
||
import javax.annotation.PostConstruct; | ||
import javax.inject.Inject; | ||
|
||
import org.eclipse.e4.core.commands.EHandlerService; | ||
import org.eclipse.e4.core.di.annotations.Execute; | ||
import org.eclipse.swt.SWT; | ||
import org.eclipse.swt.widgets.Composite; | ||
import org.eclipse.swt.widgets.Label; | ||
import org.eclipse.swt.widgets.MessageBox; | ||
import org.eclipse.swt.widgets.Shell; | ||
import org.eclipse.ui.actions.ActionFactory; | ||
|
||
public class E4UndoRedoTestPart { | ||
|
||
@Inject | ||
private EHandlerService handlerService; | ||
|
||
@PostConstruct | ||
public void postConstruct(Composite parent) { | ||
|
||
new Label(parent, SWT.NONE).setText("Press Undo or Redo"); | ||
|
||
handlerService.activateHandler(ActionFactory.UNDO.getCommandId(), new Handler("Undo")); | ||
handlerService.activateHandler(ActionFactory.REDO.getCommandId(), new Handler("Redo")); | ||
} | ||
|
||
private class Handler { | ||
|
||
private String type; | ||
|
||
public Handler(String type) { | ||
this.type = type; | ||
} | ||
|
||
@Execute | ||
public void execute(Shell shell) { | ||
|
||
MessageBox messageBox = new MessageBox(shell, SWT.NONE); | ||
messageBox.setMessage(type); | ||
messageBox.setText("E4 Undo Redo Test"); | ||
messageBox.open(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters