|
Lines 24-38
Link Here
|
| 24 |
import org.eclipse.swt.SWT; |
24 |
import org.eclipse.swt.SWT; |
| 25 |
import org.eclipse.swt.widgets.Shell; |
25 |
import org.eclipse.swt.widgets.Shell; |
| 26 |
import org.eclipse.ui.*; |
26 |
import org.eclipse.ui.*; |
| 27 |
import org.eclipse.ui.actions.ActionFactory; |
27 |
import org.eclipse.ui.actions.*; |
| 28 |
import org.eclipse.ui.actions.ContributionItemFactory; |
|
|
| 29 |
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; |
28 |
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; |
| 30 |
import org.eclipse.ui.application.ActionBarAdvisor; |
29 |
import org.eclipse.ui.application.ActionBarAdvisor; |
| 31 |
import org.eclipse.ui.application.IActionBarConfigurer; |
30 |
import org.eclipse.ui.application.IActionBarConfigurer; |
| 32 |
import org.eclipse.ui.browser.IWebBrowser; |
31 |
import org.eclipse.ui.browser.IWebBrowser; |
| 33 |
import org.eclipse.ui.browser.IWorkbenchBrowserSupport; |
32 |
import org.eclipse.ui.browser.IWorkbenchBrowserSupport; |
| 34 |
import org.eclipse.ui.plugin.AbstractUIPlugin; |
33 |
import org.eclipse.ui.plugin.AbstractUIPlugin; |
| 35 |
import org.osgi.framework.*; |
34 |
import org.osgi.framework.Bundle; |
|
|
35 |
import org.osgi.framework.Constants; |
| 36 |
|
36 |
|
| 37 |
public class DemoActionBarAdvisor extends ActionBarAdvisor { |
37 |
public class DemoActionBarAdvisor extends ActionBarAdvisor { |
| 38 |
|
38 |
|
|
Lines 55-60
Link Here
|
| 55 |
super( configurer ); |
55 |
super( configurer ); |
| 56 |
} |
56 |
} |
| 57 |
|
57 |
|
|
|
58 |
@Override |
| 58 |
protected void makeActions( final IWorkbenchWindow window ) { |
59 |
protected void makeActions( final IWorkbenchWindow window ) { |
| 59 |
ImageDescriptor quitActionImage = AbstractUIPlugin.imageDescriptorFromPlugin( "org.eclipse.rap.demo", |
60 |
ImageDescriptor quitActionImage = AbstractUIPlugin.imageDescriptorFromPlugin( "org.eclipse.rap.demo", |
| 60 |
"icons/ttt.gif" ); |
61 |
"icons/ttt.gif" ); |
|
Lines 69-92
Link Here
|
| 69 |
exitAction = ActionFactory.QUIT.create( window ); |
70 |
exitAction = ActionFactory.QUIT.create( window ); |
| 70 |
exitAction.setImageDescriptor( quitActionImage ); |
71 |
exitAction.setImageDescriptor( quitActionImage ); |
| 71 |
register( exitAction ); |
72 |
register( exitAction ); |
| 72 |
|
73 |
|
| 73 |
importAction = ActionFactory.IMPORT.create( window ); |
74 |
importAction = ActionFactory.IMPORT.create( window ); |
| 74 |
register( importAction ); |
75 |
register( importAction ); |
| 75 |
|
76 |
|
| 76 |
exportAction = ActionFactory.EXPORT.create( window ); |
77 |
exportAction = ActionFactory.EXPORT.create( window ); |
| 77 |
register( exportAction ); |
78 |
register( exportAction ); |
| 78 |
|
79 |
|
| 79 |
saveAction = ActionFactory.SAVE.create( window ); |
80 |
saveAction = ActionFactory.SAVE.create( window ); |
| 80 |
register( saveAction ); |
81 |
register( saveAction ); |
| 81 |
|
82 |
|
| 82 |
saveAllAction = ActionFactory.SAVE_ALL.create( window ); |
83 |
saveAllAction = ActionFactory.SAVE_ALL.create( window ); |
| 83 |
register( saveAllAction ); |
84 |
register( saveAllAction ); |
| 84 |
|
85 |
|
| 85 |
preferencesAction = ActionFactory.PREFERENCES.create( window ); |
86 |
preferencesAction = ActionFactory.PREFERENCES.create( window ); |
| 86 |
register( preferencesAction ); |
87 |
register( preferencesAction ); |
| 87 |
|
88 |
|
| 88 |
newEditorAction = new Action() { |
89 |
newEditorAction = new Action() { |
| 89 |
|
90 |
|
|
|
91 |
@Override |
| 90 |
public void run() { |
92 |
public void run() { |
| 91 |
try { |
93 |
try { |
| 92 |
window.getActivePage().openEditor( new FooEditorInput(DemoActionBarAdvisor.this), |
94 |
window.getActivePage().openEditor( new FooEditorInput(DemoActionBarAdvisor.this), |
|
Lines 103-110
Link Here
|
| 103 |
.getSharedImages() |
105 |
.getSharedImages() |
| 104 |
.getImageDescriptor( ISharedImages.IMG_TOOL_NEW_WIZARD ) ); |
106 |
.getImageDescriptor( ISharedImages.IMG_TOOL_NEW_WIZARD ) ); |
| 105 |
register( newEditorAction ); |
107 |
register( newEditorAction ); |
| 106 |
|
108 |
|
| 107 |
aboutAction = new Action() { |
109 |
aboutAction = new Action() { |
|
|
110 |
@Override |
| 108 |
public void run() { |
111 |
public void run() { |
| 109 |
Shell shell = window.getShell(); |
112 |
Shell shell = window.getShell(); |
| 110 |
Bundle bundle = Platform.getBundle( PlatformUI.PLUGIN_ID ); |
113 |
Bundle bundle = Platform.getBundle( PlatformUI.PLUGIN_ID ); |
|
Lines 120-125
Link Here
|
| 120 |
aboutAction.setImageDescriptor( helpActionImage ); |
123 |
aboutAction.setImageDescriptor( helpActionImage ); |
| 121 |
register( aboutAction ); |
124 |
register( aboutAction ); |
| 122 |
rapWebSiteAction = new Action() { |
125 |
rapWebSiteAction = new Action() { |
|
|
126 |
@Override |
| 123 |
public void run() { |
127 |
public void run() { |
| 124 |
IWorkbenchBrowserSupport browserSupport; |
128 |
IWorkbenchBrowserSupport browserSupport; |
| 125 |
browserSupport = PlatformUI.getWorkbench().getBrowserSupport(); |
129 |
browserSupport = PlatformUI.getWorkbench().getBrowserSupport(); |
|
Lines 143-148
Link Here
|
| 143 |
IContributionItem showViewMenu = ContributionItemFactory.VIEWS_SHORTLIST.create( window ); |
147 |
IContributionItem showViewMenu = ContributionItemFactory.VIEWS_SHORTLIST.create( window ); |
| 144 |
showViewMenuMgr.add( showViewMenu ); |
148 |
showViewMenuMgr.add( showViewMenu ); |
| 145 |
wizardAction = new Action() { |
149 |
wizardAction = new Action() { |
|
|
150 |
@Override |
| 146 |
public void run() { |
151 |
public void run() { |
| 147 |
SurveyWizard wizard = new SurveyWizard(); |
152 |
SurveyWizard wizard = new SurveyWizard(); |
| 148 |
WizardDialog dlg = new WizardDialog( window.getShell(), wizard ); |
153 |
WizardDialog dlg = new WizardDialog( window.getShell(), wizard ); |
|
Lines 154-159
Link Here
|
| 154 |
wizardAction.setImageDescriptor( wizardActionImage ); |
159 |
wizardAction.setImageDescriptor( wizardActionImage ); |
| 155 |
register( wizardAction ); |
160 |
register( wizardAction ); |
| 156 |
browserAction = new Action() { |
161 |
browserAction = new Action() { |
|
|
162 |
@Override |
| 157 |
public void run() { |
163 |
public void run() { |
| 158 |
browserIndex++; |
164 |
browserIndex++; |
| 159 |
try { |
165 |
try { |
|
Lines 172-183
Link Here
|
| 172 |
register( browserAction ); |
178 |
register( browserAction ); |
| 173 |
} |
179 |
} |
| 174 |
|
180 |
|
|
|
181 |
@Override |
| 175 |
protected void fillMenuBar( final IMenuManager menuBar ) { |
182 |
protected void fillMenuBar( final IMenuManager menuBar ) { |
| 176 |
MenuManager fileMenu = new MenuManager( "File", |
183 |
MenuManager fileMenu = new MenuManager( "&File", |
| 177 |
IWorkbenchActionConstants.M_FILE ); |
184 |
IWorkbenchActionConstants.M_FILE ); |
| 178 |
MenuManager windowMenu = new MenuManager( "Window", |
185 |
MenuManager windowMenu = new MenuManager( "&Window", |
| 179 |
IWorkbenchActionConstants.M_WINDOW ); |
186 |
IWorkbenchActionConstants.M_WINDOW ); |
| 180 |
MenuManager helpMenu = new MenuManager( "Help", |
187 |
MenuManager helpMenu = new MenuManager( "&Help", |
| 181 |
IWorkbenchActionConstants.M_HELP ); |
188 |
IWorkbenchActionConstants.M_HELP ); |
| 182 |
menuBar.add( fileMenu ); |
189 |
menuBar.add( fileMenu ); |
| 183 |
fileMenu.add( importAction ); |
190 |
fileMenu.add( importAction ); |
|
Lines 192-197
Link Here
|
| 192 |
helpMenu.add( aboutAction ); |
199 |
helpMenu.add( aboutAction ); |
| 193 |
} |
200 |
} |
| 194 |
|
201 |
|
|
|
202 |
@Override |
| 195 |
protected void fillCoolBar( final ICoolBarManager coolBar ) { |
203 |
protected void fillCoolBar( final ICoolBarManager coolBar ) { |
| 196 |
createToolBar( coolBar, "main" ); |
204 |
createToolBar( coolBar, "main" ); |
| 197 |
createToolBar( coolBar, "editor" ); |
205 |
createToolBar( coolBar, "editor" ); |
|
Lines 213-218
Link Here
|
| 213 |
} |
221 |
} |
| 214 |
} |
222 |
} |
| 215 |
|
223 |
|
|
|
224 |
@Override |
| 216 |
protected void fillStatusLine( final IStatusLineManager statusLine ) { |
225 |
protected void fillStatusLine( final IStatusLineManager statusLine ) { |
| 217 |
statusLine.add( aboutAction ); |
226 |
statusLine.add( aboutAction ); |
| 218 |
} |
227 |
} |