Setting a wait cursor in the standalone client
Post here questions and problems related to oXygen frameworks/document types.
-
- Posts: 44
- Joined: Wed Aug 08, 2007 5:56 am
Setting a wait cursor in the standalone client
I am working on a WorkspaceAccessPluginExtension. The UI consists of a menu and menu item. How can I set a wait cursor?
What I've tried so far:
What I've tried so far:
Code: Select all
private AtomicReference<JMenuBar> menuRef = new AtomicReference<JMenuBar>(); // Cringe
...
@Override
public void applicationStarted(final StandalonePluginWorkspace ws) {
ws.addMenuBarCustomizer(new MenuBarCustomizer() {
@Override
public void customizeMainMenu(JMenuBar menuBar) {
...
menuRef = new AtomicReference(menuBar);
}
});
}
...
return new AbstractAction("Sync") {
Cursor cursor = menuRef.get().getCursor();
try {
...
menuRef.get().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
...
} finally {
menuRef.get().setCursor(cursor);
}
}
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Setting a wait cursor in the standalone client
Hi,
You should try to set the busy cursor on the entire application main frame, something like:
otherwise you will only set it on the menu bar area which is probably not what you are after.
Regards,
Radu
You should try to set the busy cursor on the entire application main frame, something like:
Code: Select all
javax.swing.JFrame parentFrame = (JFrame) PluginWorkspaceProvider.getPluginWorkspace().getParentFrame();
parentFrame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Setting a wait cursor in the standalone client
Hi,
I tested and this works for me:
Regards,
Radu
I tested and this works for me:
Code: Select all
pluginWorkspaceAccess.addMenuBarCustomizer(new MenuBarCustomizer() {
@Override
public void customizeMainMenu(JMenuBar mainMenu) {
JMenu custom = new JMenu("ABC");
custom.add(new AbstractAction("TEST") {
@Override
public void actionPerformed(ActionEvent e) {
javax.swing.JFrame parentFrame = (JFrame) PluginWorkspaceProvider.getPluginWorkspace().getParentFrame();
parentFrame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
try {
Thread.sleep(10000);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
parentFrame.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
});
mainMenu.add(custom);
}
});
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Return to “SDK-API, Frameworks - Document Types”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service