tmf: Update copyright headers in tmf.ui
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / views / uml2sd / SDView.java
CommitLineData
73005152 1/**********************************************************************
c8422608 2 * Copyright (c) 2005, 2012 IBM Corporation, Ericsson
73005152
BH
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
a55887ca
AM
7 *
8 * Contributors:
c8422608
AM
9 * IBM - Initial API and implementation
10 * Bernd Hufmann - Updated for TMF
73005152 11 **********************************************************************/
c8422608 12
73005152
BH
13package org.eclipse.linuxtools.tmf.ui.views.uml2sd;
14
15import java.util.Iterator;
16
17import org.eclipse.jface.action.Action;
18import org.eclipse.jface.action.ActionContributionItem;
19import org.eclipse.jface.action.IAction;
20import org.eclipse.jface.action.IContributionItem;
21import org.eclipse.jface.action.IMenuListener;
22import org.eclipse.jface.action.IMenuManager;
23import org.eclipse.jface.action.IToolBarManager;
24import org.eclipse.jface.action.MenuManager;
25import org.eclipse.jface.action.Separator;
26import org.eclipse.jface.viewers.ISelection;
27import org.eclipse.jface.viewers.ISelectionProvider;
28import org.eclipse.jface.viewers.StructuredSelection;
8fd82db5 29import org.eclipse.linuxtools.internal.tmf.ui.Activator;
a55887ca 30import org.eclipse.linuxtools.internal.tmf.ui.ITmfImageConstants;
73005152
BH
31import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.BaseMessage;
32import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.Frame;
33import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.GraphNode;
34import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.SyncMessage;
35import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.SyncMessageReturn;
36import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.ConfigureMinMax;
37import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.FirstPage;
38import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.KeyBindingsManager;
39import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.LastPage;
40import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.MoveToMessage;
41import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.NextPage;
42import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.OpenSDFiltersDialog;
43import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.OpenSDFindDialog;
44import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.OpenSDPagesDialog;
45import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.PrevPage;
46import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.Print;
47import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.ShowNodeEnd;
48import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.ShowNodeStart;
49import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.Zoom;
50import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.Zoom.ZoomType;
51import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.provider.IExtendedFilterProvider;
52import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.provider.IExtendedFindProvider;
73005152
BH
53import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.provider.ISDAdvancedPagingProvider;
54import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.provider.ISDCollapseProvider;
55import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.provider.ISDExtendedActionBarProvider;
56import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.provider.ISDFilterProvider;
57import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.provider.ISDFindProvider;
8a95ce5a 58import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.provider.ISDGraphNodeSupporter;
73005152
BH
59import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.provider.ISDPagingProvider;
60import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.provider.ISDPropertiesProvider;
61import org.eclipse.linuxtools.tmf.ui.views.uml2sd.load.IUml2SDLoader;
62import org.eclipse.linuxtools.tmf.ui.views.uml2sd.load.LoadersManager;
63import org.eclipse.linuxtools.tmf.ui.views.uml2sd.util.SDMessages;
64import org.eclipse.swt.SWT;
65import org.eclipse.swt.graphics.Cursor;
66import org.eclipse.swt.layout.GridData;
67import org.eclipse.swt.layout.GridLayout;
68import org.eclipse.swt.widgets.Composite;
69import org.eclipse.swt.widgets.Menu;
70import org.eclipse.ui.IActionBars;
71import org.eclipse.ui.IViewReference;
72import org.eclipse.ui.IWorkbenchPage;
73import org.eclipse.ui.PlatformUI;
74import org.eclipse.ui.actions.ActionFactory;
75import org.eclipse.ui.part.ViewPart;
ebf38fcc 76import org.eclipse.ui.views.properties.IPropertySheetPage;
73005152
BH
77
78/**
df0b8ff4
BH
79 * <p>
80 * This class is a generic sequence diagram view implementation.
81 * </p>
82
a55887ca 83 * @version 1.0
73005152 84 * @author sveyrier
73005152
BH
85 */
86public class SDView extends ViewPart {
87
df0b8ff4
BH
88 // ------------------------------------------------------------------------
89 // Attributes
90 // ------------------------------------------------------------------------
91 /**
92 * The sequence diagram widget.
93 */
eb63f5ff 94 protected SDWidget fSdWidget = null;
df0b8ff4
BH
95 /**
96 * The time compression bar.
97 */
eb63f5ff 98 protected TimeCompressionBar fTimeCompressionBar = null;
df0b8ff4
BH
99 /**
100 * The sequence diagram find provider implementation.
101 */
eb63f5ff 102 protected ISDFindProvider fSdFindProvider = null;
df0b8ff4
BH
103 /**
104 * The sequence diagram paging provider implementation.
105 */
eb63f5ff 106 protected ISDPagingProvider fSdPagingProvider = null;
df0b8ff4
BH
107 /**
108 * The sequence diagram filter provider implementation.
109 */
eb63f5ff 110 protected ISDFilterProvider fSdFilterProvider = null;
df0b8ff4
BH
111 /**
112 * The extended sequence diagram filter provider implementation.
113 */
eb63f5ff 114 protected IExtendedFilterProvider fSdExFilterProvider = null;
df0b8ff4
BH
115 /**
116 * The extended sequence diagram find provider implementation.
117 */
eb63f5ff 118 protected IExtendedFindProvider fSdExFindProvider = null;
df0b8ff4
BH
119 /**
120 * The extended sequence diagram action bar provider implementation.
121 */
eb63f5ff 122 protected ISDExtendedActionBarProvider fSdExtendedActionBarProvider = null;
df0b8ff4
BH
123 /**
124 * The sequence diagram property provider implementation.
125 */
eb63f5ff 126 protected ISDPropertiesProvider fSdPropertiesProvider = null;
df0b8ff4 127 /**
a55887ca 128 * Button for executing the next page action.
df0b8ff4 129 */
eb63f5ff 130 protected NextPage fNextPageButton = null;
df0b8ff4 131 /**
a55887ca 132 * Button for executing the previous page action.
df0b8ff4 133 */
eb63f5ff 134 protected PrevPage fPrevPageButton = null;
df0b8ff4 135 /**
a55887ca 136 * Button for executing the first page page action.
df0b8ff4 137 */
eb63f5ff 138 protected FirstPage fFirstPageButton = null;
df0b8ff4 139 /**
a55887ca 140 * Button for executing the last page action.
df0b8ff4 141 */
eb63f5ff 142 protected LastPage fLastPageButton = null;
df0b8ff4
BH
143 /**
144 * The menu manager reference.
145 */
eb63f5ff 146 protected MenuManager fMenuMgr = null;
df0b8ff4 147 /**
a55887ca 148 * Flag to indicate whether view needs initialization or not.
df0b8ff4 149 */
eb63f5ff 150 protected boolean fNeedInit = true;
df0b8ff4
BH
151 /**
152 * WaitCursor is the cursor to be displayed when long tasks are running
153 */
eb63f5ff 154 protected Cursor fWaitCursor;
df0b8ff4
BH
155
156 // ------------------------------------------------------------------------
157 // Methods
158 // ------------------------------------------------------------------------
73005152
BH
159
160 /*
161 * (non-Javadoc)
162 * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
163 */
164 @Override
165 public void createPartControl(Composite c) {
166 Composite parent = new Composite(c, SWT.NONE);
167 GridLayout parentLayout = new GridLayout();
168 parentLayout.numColumns = 2;
169 parentLayout.marginWidth = 0;
170 parentLayout.marginHeight = 0;
171 parent.setLayout(parentLayout);
172
173 GridData timeLayoutdata = new GridData(GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_FILL);
174 timeLayoutdata.widthHint = 10;
175 GridData seqDiagLayoutData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_FILL);
eb63f5ff
BH
176 fTimeCompressionBar = new TimeCompressionBar(parent, SWT.NONE);
177 fTimeCompressionBar.setLayoutData(timeLayoutdata);
178 fSdWidget = new SDWidget(parent, SWT.NONE);// SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
179 fSdWidget.setLayoutData(seqDiagLayoutData);
180 fSdWidget.setSite(this);
181 fSdWidget.setTimeBar(fTimeCompressionBar);
73005152
BH
182
183 // Add this view to the key bindings manager
184 KeyBindingsManager.getInstance().add(this.getSite().getId());
a55887ca 185
73005152
BH
186 createCoolbarContent();
187
188 hookContextMenu();
189
eb63f5ff 190 fTimeCompressionBar.setVisible(false);
73005152
BH
191 parent.layout(true);
192
193 Print print = new Print(this);
194 getViewSite().getActionBars().setGlobalActionHandler(ActionFactory.PRINT.getId(), print);
195
eb63f5ff 196 fNeedInit = restoreLoader();
73005152
BH
197 }
198
199 /**
df0b8ff4 200 * Load a blank page that is supposed to explain that a kind of interaction must be chosen.
73005152
BH
201 */
202 protected void loadBlank() {
a55887ca 203 IUml2SDLoader loader = new BlankUml2SdLoader();
df0b8ff4
BH
204 loader.setViewer(this);
205 setContentDescription(loader.getTitleString());
73005152
BH
206 }
207
208 /*
209 * (non-Javadoc)
210 * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
211 */
212 @Override
213 public void setFocus() {
eb63f5ff 214 if (fSdWidget != null) {
73005152
BH
215 // update actions for key bindings
216 KeyBindingsManager.getInstance().setSdView(this);
eb63f5ff 217 fSdWidget.setFocus();
73005152 218 }
eb63f5ff
BH
219 if (isViewReady() && fNeedInit) {
220 fNeedInit = restoreLoader();
73005152
BH
221 }
222 }
223
224 /*
225 * (non-Javadoc)
226 * @see org.eclipse.ui.part.WorkbenchPart#dispose()
227 */
228 @Override
229 public void dispose() {
230 KeyBindingsManager.getInstance().remove(this.getSite().getId());
231 super.dispose();
232 }
233
234 /**
df0b8ff4 235 * Returns the SD widget.
a55887ca 236 *
73005152
BH
237 * @return The SD widget.
238 */
239 public SDWidget getSDWidget() {
eb63f5ff 240 return fSdWidget;
73005152 241 }
df0b8ff4 242
73005152
BH
243 /**
244 * Set the find provider for the opened sequence diagram viewer<br>
245 * If the provider is not set, the find menu item will not be available in the viewer<br>
246 * A find provider is called back when the user perform a find action<br>
a55887ca 247 * The find provider is responsible to move the sequence diagram to the GraphNode which match the
73005152 248 * find criteria as well as to highlight the GraphNode
a55887ca 249 *
73005152
BH
250 * @param provider the search provider
251 */
252 public void setSDFindProvider(ISDFindProvider provider) {
eb63f5ff
BH
253 fSdFindProvider = provider;
254 fSdExFindProvider = null;
73005152
BH
255 createCoolbarContent();
256 if (provider != null) {
257 KeyBindingsManager.getInstance().setFindEnabled(true);
258 }
259 else {
260 KeyBindingsManager.getInstance().setFindEnabled(false);
261 }
262 }
a55887ca 263
73005152
BH
264 /**
265 * Set the find provider for the opened sequence diagram viewer<br>
a55887ca
AM
266 * If the provider is not set, the find menu item will not be available in
267 * the viewer<br>
73005152 268 * A find provider is called back when the user perform a find action<br>
a55887ca
AM
269 * If the extended find provider is set, it replaces the regular find
270 * provider (sdFindProvider).<br>
271 *
73005152 272 * @param provider
a55887ca 273 * The provider to set
73005152
BH
274 */
275 public void setExtendedFindProvider(IExtendedFindProvider provider) {
eb63f5ff
BH
276 fSdExFindProvider = provider;
277 fSdFindProvider = null;
73005152
BH
278 createCoolbarContent();
279 if (provider != null) {
280 KeyBindingsManager.getInstance().setFindEnabled(true);
281 }
282 else {
283 KeyBindingsManager.getInstance().setFindEnabled(false);
284 }
285 }
286
287 /**
288 * Returns the extended find provider
a55887ca 289 *
73005152
BH
290 * @return extended find provider.
291 */
292 public IExtendedFindProvider getExtendedFindProvider() {
eb63f5ff 293 return fSdExFindProvider;
73005152
BH
294 }
295
296 /**
297 * Resets all providers.
298 */
299 public void resetProviders() {
300 KeyBindingsManager.getInstance().setFindEnabled(false);
eb63f5ff
BH
301 fSdFindProvider = null;
302 fSdExFindProvider = null;
303 fSdFilterProvider = null;
304 fSdExFilterProvider = null;
305 fSdPagingProvider = null;
306 fSdExtendedActionBarProvider = null;
307 fSdPropertiesProvider = null;
308 if ((fSdWidget != null) && (!fSdWidget.isDisposed())) {
309 fSdWidget.setCollapseProvider(null);
73005152
BH
310 }
311 }
312
313 /**
314 * Set the filter provider for the opened sequence diagram viewer<br>
315 * If the provider is not set, the filter menu item will not be available in the viewer<br>
316 * A filter provider is called back when the user perform a filter action<br>
a55887ca 317 *
73005152
BH
318 * @param provider the filter provider
319 */
320 public void setSDFilterProvider(ISDFilterProvider provider) {
eb63f5ff 321 fSdFilterProvider = provider;
73005152
BH
322 // Both systems can be used now, commenting out next statement
323 // sdExFilterProvider = null;
324 createCoolbarContent();
325 }
a55887ca 326
73005152 327 /**
a55887ca
AM
328 * Sets the extended filter provider for the opened sequence diagram viewer.
329 *
73005152 330 * @param provider
a55887ca 331 * The provider to set
73005152
BH
332 */
333 public void setExtendedFilterProvider(IExtendedFilterProvider provider) {
eb63f5ff 334 fSdExFilterProvider = provider;
73005152
BH
335 // Both systems can be used now, commenting out next statement
336 // sdFilterProvider = null;
337 createCoolbarContent();
338 }
339
340 /**
341 * Returns the extended find provider.
a55887ca 342 *
73005152
BH
343 * @return The extended find provider.
344 */
345 public IExtendedFilterProvider getExtendedFilterProvider() {
eb63f5ff 346 return fSdExFilterProvider;
73005152
BH
347 }
348
349 /**
a55887ca 350 * Register the given provider to support Drag and Drop collapsing. This provider is
73005152 351 * responsible of updating the Frame.
a55887ca 352 *
73005152
BH
353 * @param provider - the provider to register
354 */
355 public void setCollapsingProvider(ISDCollapseProvider provider) {
eb63f5ff
BH
356 if ((fSdWidget != null) && (!fSdWidget.isDisposed())) {
357 fSdWidget.setCollapseProvider(provider);
73005152
BH
358 }
359 }
360
361 /**
362 * Set the page provider for the opened sequence diagram viewer<br>
363 * If the sequence diagram provided (see setFrame) need to be split in many parts, a paging provider must be
364 * provided in order to handle page change requested by the user<br>
365 * Set a page provider will create the next and previous page buttons in the viewer coolBar
a55887ca 366 *
73005152
BH
367 * @param provider the paging provider
368 */
369 public void setSDPagingProvider(ISDPagingProvider provider) {
eb63f5ff 370 fSdPagingProvider = provider;
73005152
BH
371 createCoolbarContent();
372 }
373
374 /**
375 * Returns the current page provider for the view
a55887ca 376 *
73005152
BH
377 * @return the paging provider
378 */
379 public ISDPagingProvider getSDPagingProvider() {
eb63f5ff 380 return fSdPagingProvider;
73005152
BH
381 }
382
383 /**
384 * Returns the current find provider for the view
a55887ca 385 *
73005152
BH
386 * @return the find provider
387 */
388 public ISDFindProvider getSDFindProvider() {
eb63f5ff 389 return fSdFindProvider;
73005152
BH
390 }
391
392 /**
393 * Returns the current filter provider for the view
a55887ca 394 *
73005152
BH
395 * @return the filter provider
396 */
397 public ISDFilterProvider getSDFilterProvider() {
eb63f5ff 398 return fSdFilterProvider;
73005152
BH
399 }
400
401 /**
402 * Set the extended action bar provider for the opened sequence diagram viewer<br>
403 * This allow to add programmatically actions in the coolbar and/or in the drop-down menu
a55887ca 404 *
73005152
BH
405 * @param provider the search provider
406 */
407 public void setSDExtendedActionBarProvider(ISDExtendedActionBarProvider provider) {
eb63f5ff 408 fSdExtendedActionBarProvider = provider;
73005152
BH
409 createCoolbarContent();
410 }
411
412 /**
413 * Returns the current extended action bar provider for the view
a55887ca 414 *
73005152
BH
415 * @return the extended action bar provider
416 */
417 public ISDExtendedActionBarProvider getSDExtendedActionBarProvider() {
eb63f5ff 418 return fSdExtendedActionBarProvider;
73005152
BH
419 }
420
421 /**
df0b8ff4 422 * Set the properties view provider for the opened sequence diagram viewer
a55887ca 423 *
73005152
BH
424 * @param provider the properties provider
425 */
426 public void setSDPropertiesProvider(ISDPropertiesProvider provider) {
eb63f5ff 427 fSdPropertiesProvider = provider;
73005152
BH
428 }
429
430 /**
df0b8ff4 431 * Returns the current extended action bar provider for the view.
a55887ca 432 *
73005152
BH
433 * @return the extended action bar provider
434 */
435 public ISDPropertiesProvider getSDPropertiesProvider() {
eb63f5ff 436 return fSdPropertiesProvider;
73005152
BH
437 }
438
439 /**
440 * Creates the basic sequence diagram menu
441 */
442 protected void hookContextMenu() {
eb63f5ff
BH
443 fMenuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
444 fMenuMgr.setRemoveAllWhenShown(true);
445 fMenuMgr.addMenuListener(new IMenuListener() {
73005152
BH
446 @Override
447 public void menuAboutToShow(IMenuManager manager) {
448 fillContextMenu(manager);
449 }
450 });
eb63f5ff
BH
451 Menu menu = fMenuMgr.createContextMenu(fSdWidget.getViewControl());
452 fSdWidget.getViewControl().setMenu(menu);
453 getSite().registerContextMenu(fMenuMgr, fSdWidget.getSelectionProvider());
73005152
BH
454 }
455
456 /**
457 * Returns the context menu manager
a55887ca 458 *
73005152
BH
459 * @return the menu manager
460 */
461 public MenuManager getMenuManager() {
eb63f5ff 462 return fMenuMgr;
73005152
BH
463 }
464
465 /**
466 * Fills the basic sequence diagram menu and define the dynamic menu item insertion point
a55887ca 467 *
73005152
BH
468 * @param manager the menu manager
469 */
470 protected void fillContextMenu(IMenuManager manager) {
471 manager.add(new Separator("Additions")); //$NON-NLS-1$
eb63f5ff
BH
472 if (getSDWidget() != null && getSDWidget().fCurrentGraphNode != null) {
473 ISelectionProvider selProvider = fSdWidget.getSelectionProvider();
73005152
BH
474 ISelection sel = selProvider.getSelection();
475 int nbMessage = 0;
476 Iterator<?> it = ((StructuredSelection) sel).iterator();
477 while (it.hasNext()) {
478 Object node = it.next();
479 if (node instanceof BaseMessage) {
480 nbMessage++;
481 }
482 }
483 if (nbMessage != 1) {
484 return;
485 }
eb63f5ff
BH
486 GraphNode node = getSDWidget().fCurrentGraphNode;
487 if ((node instanceof SyncMessageReturn) && (((SyncMessageReturn) node).getMessage() != null)) {
488 Action goToMessage = new MoveToMessage(this);
489 goToMessage.setText(SDMessages._39);
490 manager.add(goToMessage);
73005152 491 }
eb63f5ff
BH
492 if ((node instanceof SyncMessage) && (((SyncMessage) node).getMessageReturn() != null)) {
493 Action goToMessage = new MoveToMessage(this);
494 goToMessage.setText(SDMessages._40);
495 manager.add(goToMessage);
73005152
BH
496 }
497 }
498 manager.add(new Separator("MultiSelectAdditions")); //$NON-NLS-1$
499 }
500
501 /**
502 * Enables/Disables an action with given name.
a55887ca 503 *
73005152
BH
504 * @param actionName The action name
505 * @param state true or false
506 */
507 public void setEnableAction(String actionName, boolean state) {
508 IActionBars bar = getViewSite().getActionBars();
509 if (bar != null) {
510 IContributionItem item = bar.getMenuManager().find(actionName);
511 if ((item != null) && (item instanceof ActionContributionItem)) {
512 IAction action = ((ActionContributionItem) item).getAction();
513 if (action != null) {
514 action.setEnabled(state);
515 }
516 item.setVisible(state);
517 bar.updateActionBars();
518 }
519 }
520 }
521
522 /**
523 * Creates the coolBar icon depending on the actions supported by the Sequence Diagram provider<br>
524 * - Navigation buttons are displayed if ISDPovider.HasPaging return true<br>
525 * - Navigation buttons are enabled depending on the value return by ISDPovider.HasNext and HasPrev<br>
a55887ca 526 *
73005152
BH
527 * @see ISDGraphNodeSupporter Action support definition
528 * @see SDView#setSDFilterProvider(ISDFilterProvider)
529 * @see SDView#setSDFindProvider(ISDFindProvider)
530 * @see SDView#setSDPagingProvider(ISDPagingProvider)
531 */
532 protected void createCoolbarContent() {
533 IActionBars bar = getViewSite().getActionBars();
534
535 bar.getMenuManager().removeAll();
536 bar.getToolBarManager().removeAll();
537
538 createMenuGroup();
539
540 Zoom resetZoom = new Zoom(this, ZoomType.ZOOM_RESET);
541 bar.getMenuManager().appendToGroup("UML2SD_OTHER_COMMANDS", resetZoom);//$NON-NLS-1$
542 bar.getToolBarManager().appendToGroup("UML2SD_OTHER_COMMANDS", resetZoom); //$NON-NLS-1$
543
544 Zoom noZoom = new Zoom(this, ZoomType.ZOOM_NONE);
545 noZoom.setChecked(true);
546 bar.getMenuManager().appendToGroup("UML2SD_OTHER_COMMANDS", noZoom);//$NON-NLS-1$
547 bar.getToolBarManager().appendToGroup("UML2SD_OTHER_COMMANDS", noZoom); //$NON-NLS-1$
548
549 Zoom zoomIn = new Zoom(this, ZoomType.ZOOM_IN);
550 bar.getMenuManager().appendToGroup("UML2SD_OTHER_COMMANDS", zoomIn);//$NON-NLS-1$
551 bar.getToolBarManager().appendToGroup("UML2SD_OTHER_COMMANDS", zoomIn); //$NON-NLS-1$
552
553 Zoom zoomOut = new Zoom(this, ZoomType.ZOOM_OUT);
554 bar.getMenuManager().appendToGroup("UML2SD_OTHER_COMMANDS", zoomOut);//$NON-NLS-1$
555 bar.getToolBarManager().appendToGroup("UML2SD_OTHER_COMMANDS", zoomOut); //$NON-NLS-1$
556
557 MenuManager navigation = new MenuManager(SDMessages._77);
558
559 ShowNodeStart showNodeStart = new ShowNodeStart(this);
560 showNodeStart.setText(SDMessages.uml_25);
561
562 showNodeStart.setId("org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.ShowNodeStart");//$NON-NLS-1$
563 showNodeStart.setActionDefinitionId("org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.ShowNodeStart");//$NON-NLS-1$
564 navigation.add(showNodeStart);
565
566 ShowNodeEnd showNodeEnd = new ShowNodeEnd(this);
567 showNodeEnd.setText(SDMessages.uml_23);
568
569 showNodeEnd.setId("org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.ShowNodeEnd");//$NON-NLS-1$
570 showNodeEnd.setActionDefinitionId("org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.ShowNodeEnd");//$NON-NLS-1$
571 navigation.add(showNodeEnd);
572
573 bar.getMenuManager().appendToGroup("UML2SD_OTHER_COMMANDS", navigation); //$NON-NLS-1$
574
575 ConfigureMinMax minMax = new ConfigureMinMax(this);
576 minMax.setText(SDMessages.uml_45);
577 minMax.setId("org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.ConfigureMinMax");//$NON-NLS-1$
578 bar.getMenuManager().appendToGroup("UML2SD_OTHER_COMMANDS", minMax); //$NON-NLS-1$
579
eb63f5ff 580 if ((fSdWidget.getFrame() != null) && (fSdWidget.getFrame().hasTimeInfo())) {
73005152 581 minMax.setEnabled(true);
df0b8ff4 582 } else {
73005152 583 minMax.setEnabled(false);
df0b8ff4 584 }
73005152
BH
585
586 // Do we need to display a paging item
eb63f5ff
BH
587 if (fSdPagingProvider != null) {
588 fNextPageButton = new NextPage(this);
589 bar.getToolBarManager().appendToGroup("UML2SD_OTHER_COMMANDS", fNextPageButton); //$NON-NLS-1$
590 fNextPageButton.setEnabled(fSdPagingProvider.hasNextPage());
591 bar.getMenuManager().appendToGroup("UML2SD_OTHER_COMMANDS", fNextPageButton); //$NON-NLS-1$
592
593 fPrevPageButton = new PrevPage(this);
594 bar.getToolBarManager().appendToGroup("UML2SD_OTHER_COMMANDS", fPrevPageButton); //$NON-NLS-1$
595 fPrevPageButton.setEnabled(fSdPagingProvider.hasPrevPage());
596 bar.getMenuManager().appendToGroup("UML2SD_OTHER_COMMANDS", fPrevPageButton); //$NON-NLS-1$
a55887ca 597
eb63f5ff
BH
598 fFirstPageButton = new FirstPage(this);
599 bar.getToolBarManager().appendToGroup("UML2SD_OTHER_COMMANDS", fFirstPageButton); //$NON-NLS-1$
600 fFirstPageButton.setEnabled(fSdPagingProvider.hasPrevPage());
601 bar.getMenuManager().appendToGroup("UML2SD_OTHER_COMMANDS", fFirstPageButton); //$NON-NLS-1$
602
603 fLastPageButton = new LastPage(this);
604 bar.getToolBarManager().appendToGroup("UML2SD_OTHER_COMMANDS", fLastPageButton); //$NON-NLS-1$
605 fLastPageButton.setEnabled(fSdPagingProvider.hasNextPage());
606 bar.getMenuManager().appendToGroup("UML2SD_OTHER_COMMANDS", fLastPageButton); //$NON-NLS-1$
73005152
BH
607 }
608
eb63f5ff
BH
609 if (fSdExFilterProvider != null) {
610 Action action = fSdExFilterProvider.getFilterAction();
73005152
BH
611 if (action != null) {
612 if (action.getId() == null)
a55887ca 613 {
73005152 614 action.setId("org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.extendedFilter"); //$NON-NLS-1$
a55887ca
AM
615 }
616 if (action.getImageDescriptor() == null) {
8fd82db5 617 action.setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_FILTERS));
a55887ca
AM
618 }
619 if (action.getText() == null || action.getText().length() == 0) {
73005152 620 action.setText(SDMessages._42);
a55887ca 621 }
73005152
BH
622 bar.getMenuManager().prependToGroup("UML2SD_FILTERING", action); //$NON-NLS-1$
623 bar.getToolBarManager().prependToGroup("UML2SD_FILTERING", action); //$NON-NLS-1$
624 }
625 }
626 // Both systems can be used now: commenting out else keyword
eb63f5ff 627 /* else */if (fSdFilterProvider != null) {
a55887ca 628 bar.getMenuManager().appendToGroup("UML2SD_FILTERING", new OpenSDFiltersDialog(this, fSdFilterProvider)); //$NON-NLS-1$
73005152 629 // No longer in the coolbar: commenting out next statement
a55887ca 630 //bar.getToolBarManager().appendToGroup("UML2SD_FILTERING",new OpenSDFiltersDialog(this, sdFilterProvider)); //$NON-NLS-1$
73005152 631 }
eb63f5ff 632 if (fSdPagingProvider instanceof ISDAdvancedPagingProvider) {
73005152
BH
633 IContributionItem sdPaging = bar.getMenuManager().find(OpenSDPagesDialog.ID);
634 if (sdPaging != null) {
635 bar.getMenuManager().remove(sdPaging);
636 sdPaging = null;
637 }
eb63f5ff 638 bar.getMenuManager().appendToGroup("UML2SD_OTHER_COMMANDS", new OpenSDPagesDialog(this, (ISDAdvancedPagingProvider) fSdPagingProvider)); //$NON-NLS-1$
73005152
BH
639 updatePagesMenuItem(bar);
640 }
641
eb63f5ff
BH
642 if (fSdExFindProvider != null) {
643 Action action = fSdExFindProvider.getFindAction();
73005152 644 if (action != null) {
df0b8ff4 645 if (action.getId() == null) {
73005152 646 action.setId("org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.extendedFind"); //$NON-NLS-1$
df0b8ff4
BH
647 }
648 if (action.getImageDescriptor() == null) {
8fd82db5 649 action.setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_SEARCH_SEQ));
df0b8ff4
BH
650 }
651 if (action.getText() == null) {
73005152 652 action.setText(SDMessages._41);
df0b8ff4 653 }
73005152
BH
654 bar.getMenuManager().appendToGroup("UML2SD_OTHER_COMMANDS", action); //$NON-NLS-1$
655 bar.getToolBarManager().appendToGroup("UML2SD_OTHER_COMMANDS", action); //$NON-NLS-1$
656 }
eb63f5ff 657 } else if (fSdFindProvider != null) {
73005152
BH
658 bar.getMenuManager().appendToGroup("UML2SD_OTHER_COMMANDS", new OpenSDFindDialog(this)); //$NON-NLS-1$
659 bar.getToolBarManager().appendToGroup("UML2SD_OTHER_COMMANDS", new OpenSDFindDialog(this)); //$NON-NLS-1$
660 }
661
eb63f5ff
BH
662 if (fSdExtendedActionBarProvider != null) {
663 fSdExtendedActionBarProvider.supplementCoolbarContent(bar);
73005152
BH
664 }
665
666 bar.updateActionBars();
667 }
668
669 /**
670 * Updates the view coolbar buttons state according to the value return by: -
671 * ISDExtendedActionBarProvider.hasNextPage()<br>
672 * - ISDExtendedActionBarProvider.hasPrevPage()<br>
a55887ca 673 *
73005152
BH
674 */
675 public void updateCoolBar() {
eb63f5ff 676 if (fSdPagingProvider != null) {
73005152 677 IActionBars bar = getViewSite().getActionBars();
df0b8ff4 678 if (bar == null) {
73005152 679 return;
df0b8ff4 680 }
73005152 681 IToolBarManager barManager = bar.getToolBarManager();
df0b8ff4 682 if (barManager == null) {
73005152 683 return;
df0b8ff4 684 }
73005152 685 IContributionItem nextPage = barManager.find(NextPage.ID);
eb63f5ff 686 if (nextPage instanceof ActionContributionItem) {
73005152 687 IAction nextPageAction = ((ActionContributionItem) nextPage).getAction();
eb63f5ff
BH
688 if (nextPageAction instanceof NextPage) {
689 ((NextPage) nextPageAction).setEnabled(fSdPagingProvider.hasNextPage());
73005152
BH
690 }
691 }
692
693 IContributionItem prevPage = barManager.find(PrevPage.ID);
eb63f5ff 694 if (prevPage instanceof ActionContributionItem) {
73005152 695 IAction prevPageAction = ((ActionContributionItem) prevPage).getAction();
eb63f5ff
BH
696 if (prevPageAction instanceof PrevPage) {
697 ((PrevPage) prevPageAction).setEnabled(fSdPagingProvider.hasPrevPage());
73005152
BH
698 }
699 }
700
701 IContributionItem firstPage = barManager.find(FirstPage.ID);
eb63f5ff 702 if (firstPage instanceof ActionContributionItem) {
73005152 703 IAction firstPageAction = ((ActionContributionItem) firstPage).getAction();
eb63f5ff
BH
704 if (firstPageAction instanceof FirstPage) {
705 ((FirstPage) firstPageAction).setEnabled(fSdPagingProvider.hasPrevPage());
73005152
BH
706 }
707 }
708
709 IContributionItem lastPage = barManager.find(LastPage.ID);
eb63f5ff 710 if (lastPage instanceof ActionContributionItem) {
73005152 711 IAction lastPageAction = ((ActionContributionItem) lastPage).getAction();
eb63f5ff
BH
712 if (lastPageAction instanceof LastPage) {
713 ((LastPage) lastPageAction).setEnabled(fSdPagingProvider.hasNextPage());
73005152
BH
714 }
715 }
a55887ca 716
73005152
BH
717 updatePagesMenuItem(bar);
718 }
719 }
720
721 /**
722 * Enables or disables the Pages... menu item, depending on the number of pages
a55887ca 723 *
73005152
BH
724 * @param bar the bar containing the action
725 */
726 protected void updatePagesMenuItem(IActionBars bar) {
eb63f5ff 727 if (fSdPagingProvider instanceof ISDAdvancedPagingProvider) {
73005152
BH
728 IMenuManager menuManager = bar.getMenuManager();
729 ActionContributionItem contributionItem = (ActionContributionItem) menuManager.find(OpenSDPagesDialog.ID);
730 IAction openSDPagesDialog = null;
731 if (contributionItem != null) {
732 openSDPagesDialog = contributionItem.getAction();
733 }
734
eb63f5ff
BH
735 if (openSDPagesDialog instanceof OpenSDPagesDialog) {
736 openSDPagesDialog.setEnabled(((ISDAdvancedPagingProvider) fSdPagingProvider).pagesCount() > 1);
73005152
BH
737 }
738 }
739 }
740
741 /**
742 * The frame to render (the sequence diagram)
a55887ca 743 *
73005152
BH
744 * @param frame the frame to display
745 */
746 public void setFrame(Frame frame) {
747 setFrame(frame, true);
748 }
749
750 /**
751 * The frame to render (the sequence diagram)
a55887ca 752 *
73005152 753 * @param frame the frame to display
df0b8ff4 754 * @param resetPosition boolean Flag whether to reset the position or not.
73005152
BH
755 */
756 protected void setFrame(Frame frame, boolean resetPosition) {
8a95ce5a 757 if (getSDWidget() == null) {
73005152 758 return;
a55887ca 759 }
73005152
BH
760
761 if (frame == null) {
762 loadBlank();
763 return;
764 }
765
df0b8ff4 766 IUml2SDLoader loader = LoadersManager.getInstance().getCurrentLoader(getViewSite().getId(), this);
4b4a1525
BH
767 if (loader == null) {
768 return;
769 }
73005152 770
4b4a1525 771 if (loader.getTitleString() != null) {
df0b8ff4 772 setContentDescription(loader.getTitleString());
73005152
BH
773 }
774
8a95ce5a 775 getSDWidget().setFrame(frame, resetPosition);
73005152 776
eb63f5ff
BH
777 if (fTimeCompressionBar != null) {
778 fTimeCompressionBar.setFrame(frame);
df0b8ff4 779 }
73005152 780 updateCoolBar();
8a95ce5a
BH
781 if (fTimeCompressionBar != null) {
782 if (!frame.hasTimeInfo()) {
783 Composite parent = fTimeCompressionBar.getParent();
784 fTimeCompressionBar.setVisible(false);
785 parent.layout(true);
786 } else {
787 Composite parent = fTimeCompressionBar.getParent();
788 fTimeCompressionBar.setVisible(true);
789 parent.layout(true);
790 }
73005152
BH
791 }
792 IContributionItem shortKeysMenu = getViewSite().getActionBars().getMenuManager().find("org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers");//$NON-NLS-1$
793 MenuManager shortKeys = (MenuManager) shortKeysMenu;
794 if (shortKeys != null) {
795 IContributionItem[] items = shortKeys.getItems();
796 for (int i = 0; i < items.length; i++) {
797 if (items[i] instanceof ActionContributionItem) {
798 IAction action = ((ActionContributionItem) items[i]).getAction();
df0b8ff4 799 if (action != null) {
73005152 800 action.setEnabled(true);
df0b8ff4 801 }
73005152
BH
802 }
803 }
804 }
805 createCoolbarContent();
806 }
807
808 /**
809 * Activate or deactivate the short key command given in parameter (see plugin.xml)
a55887ca 810 *
73005152
BH
811 * @param id the command id defined in the plugin.xml
812 * @param value the state value
813 */
814 public void setEnableCommand(String id, boolean value) {
815 IContributionItem shortKeysMenu = getViewSite().getActionBars().getMenuManager().find("org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers");//$NON-NLS-1$
816 MenuManager shortKeys = (MenuManager) shortKeysMenu;
df0b8ff4 817 if (shortKeys == null) {
73005152 818 return;
df0b8ff4 819 }
73005152
BH
820 IContributionItem item = shortKeys.find(id);
821 if ((item != null) && (item instanceof ActionContributionItem)) {
822 IAction action = ((ActionContributionItem) item).getAction();
df0b8ff4 823 if (action != null) {
73005152 824 action.setEnabled(value);
df0b8ff4 825 }
73005152
BH
826 }
827 }
828
829 /**
830 * Set the frame from an other thread than the one executing the main loop
a55887ca 831 *
df0b8ff4 832 * @param frame The frame to set (and display)
73005152
BH
833 */
834 public void setFrameSync(final Frame frame) {
835 if (getSDWidget() == null || getSDWidget().isDisposed()) {
836 return;
837 }
838 getSDWidget().getDisplay().syncExec(new Runnable() {
839 @Override
840 public void run() {
8a95ce5a
BH
841 if (getSDWidget() == null || getSDWidget().isDisposed() ||
842 ((fTimeCompressionBar != null) && fTimeCompressionBar.isDisposed())) {
73005152
BH
843 return;
844 }
845 setFrame(frame);
846 }
847 });
848
849 }
850
851 /**
852 * Ensure an object is visible from an other thread than the one executing the main loop
a55887ca 853 *
df0b8ff4 854 * @param sm The node to make visible in view
73005152
BH
855 */
856 public void ensureVisibleSync(final GraphNode sm) {
857 getSDWidget().getDisplay().syncExec(new Runnable() {
858 @Override
859 public void run() {
860 if (getSDWidget() == null || getSDWidget().isDisposed()) {
861 return;
862 }
863 getSDWidget().ensureVisible(sm);
864 }
865 });
866 }
867
868 /**
869 * Set the frame and ensure an object is visible from an other thread than the one executing the main loop
a55887ca 870 *
df0b8ff4
BH
871 * @param sm The node to make visible in view
872 * @param frame Frame The frame to set
73005152
BH
873 */
874 public void setFrameAndEnsureVisibleSync(final Frame frame, final GraphNode sm) {
875 if (getSDWidget() == null || getSDWidget().isDisposed()) {
876 return;
877 }
878 getSDWidget().getDisplay().syncExec(new Runnable() {
879 @Override
880 public void run() {
881 if (getSDWidget() == null || getSDWidget().isDisposed()) {
882 return;
883 }
884 setFrameAndEnsureVisible(frame, sm);
885 }
886 });
887 }
888
889 /**
890 * Set the frame and ensure an object is visible
a55887ca 891 *
df0b8ff4
BH
892 * @param sm The node to make visible in view
893 * @param frame Frame The frame to set
73005152
BH
894 */
895 public void setFrameAndEnsureVisible(Frame frame, GraphNode sm) {
896 getSDWidget().clearSelection();
897 setFrame(frame, false);
898 getSDWidget().ensureVisible(sm);
899 }
900
901 /**
902 * Set the frame and ensure an object is visible from an other thread than the one executing the main loop
a55887ca 903 *
df0b8ff4
BH
904 * @param frame The frame to set.
905 * @param x The x coordinate to make visible.
906 * @param y The y coordinate to make visible.
73005152
BH
907 */
908 public void setFrameAndEnsureVisibleSync(final Frame frame, final int x, final int y) {
909 if (getSDWidget() == null || getSDWidget().isDisposed()) {
910 return;
911 }
a55887ca 912
73005152
BH
913 getSDWidget().getDisplay().syncExec(new Runnable() {
914 @Override
915 public void run() {
916 setFrameAndEnsureVisible(frame, x, y);
917 }
918 });
919 }
920
921 /**
922 * Set the frame and ensure an object is visible
a55887ca 923 *
df0b8ff4
BH
924 * @param frame The frame to set.
925 * @param x The x coordinate to make visible.
926 * @param y The y coordinate to make visible.
73005152
BH
927 */
928 public void setFrameAndEnsureVisible(Frame frame, int x, int y) {
929 getSDWidget().clearSelection();
930 setFrame(frame, false);
931 getSDWidget().ensureVisible(x, y);
932 getSDWidget().redraw();
933 }
934
73005152
BH
935 /**
936 * Toggle between default and wait cursors from an other thread than the one executing the main loop
a55887ca
AM
937 *
938 * @param wait <code>true</code> for wait cursor else <code>false</code> for default cursor.
73005152 939 */
eb63f5ff 940 public void toggleWaitCursorAsync(final boolean wait) {
73005152
BH
941 if (getSDWidget() == null || getSDWidget().isDisposed()) {
942 return;
943 }
944
945 getSDWidget().getDisplay().asyncExec(new Runnable() {
946 @Override
947 public void run() {
948 if (getSDWidget() == null || getSDWidget().isDisposed()) {
949 return;
950 }
eb63f5ff
BH
951 if (wait) {
952 if (fWaitCursor != null && !fWaitCursor.isDisposed()) {
953 fWaitCursor.dispose();
73005152 954 }
eb63f5ff
BH
955 fWaitCursor = new Cursor(getSDWidget().getDisplay(), SWT.CURSOR_WAIT);
956 getSDWidget().setCursor(fWaitCursor);
73005152
BH
957 getSDWidget().getDisplay().update();
958 } else {
eb63f5ff
BH
959 if (fWaitCursor != null && !fWaitCursor.isDisposed()) {
960 fWaitCursor.dispose();
73005152 961 }
eb63f5ff 962 fWaitCursor = null;
73005152
BH
963 getSDWidget().setCursor(null);
964 getSDWidget().getDisplay().update();
965 }
966 }
967 });
968 }
969
970 /**
971 * Return the time compression bar widget
a55887ca
AM
972 *
973 * @return the time compression bar
73005152
BH
974 */
975 public TimeCompressionBar getTimeCompressionBar() {
eb63f5ff 976 return fTimeCompressionBar;
73005152
BH
977 }
978
979 /**
980 * Returns the current Frame (the sequence diagram container)
a55887ca
AM
981 *
982 * @return the current frame
73005152
BH
983 */
984 public Frame getFrame() {
985 if (getSDWidget() != null) {
986 return getSDWidget().getFrame();
987 }
abbdd66a 988 return null;
73005152
BH
989 }
990
df0b8ff4
BH
991 /**
992 * Restores the loader for the view based on the view ID.
a55887ca 993 *
df0b8ff4
BH
994 * @return boolean <code>true</code> if initialization is needed else <code>false</code>.
995 */
73005152
BH
996 protected boolean restoreLoader() {
997 String id = getViewSite().getId();
998 // System.err.println("restoreLoader() id="+id);
999 if (id == null) {
1000 return true;
1001 }
df0b8ff4 1002 IUml2SDLoader loader = LoadersManager.getInstance().getCurrentLoader(id, this);
73005152 1003 // System.err.println("restoreLoader() l="+l);
df0b8ff4
BH
1004 if ((loader != null)) {// &&( LoadersManager.getLoadersManager().getViewer(l)==this)){
1005 loader.setViewer(this);
73005152 1006 return false;
73005152 1007 }
abbdd66a
AM
1008 loadBlank();
1009 return true;
73005152
BH
1010 }
1011
df0b8ff4
BH
1012 /**
1013 * Checks if current view is ready to be used.
a55887ca 1014 *
df0b8ff4
BH
1015 * @return boolean <code>true</code> if view is ready else <code>false</code>.
1016 */
73005152 1017 protected boolean isViewReady() {
df0b8ff4
BH
1018 IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
1019 if (page == null) {
73005152 1020 return false;
df0b8ff4 1021 }
73005152 1022
df0b8ff4 1023 IViewReference[] ref = page.getViewReferences();
73005152
BH
1024 for (int i = 0; i < ref.length; i++) {
1025 if (ref[i].getView(false) == this) {
1026 return true;
1027 }
1028 }
1029 return false;
1030 }
1031
df0b8ff4
BH
1032 /**
1033 * Creates the menu group.
1034 */
73005152
BH
1035 protected void createMenuGroup() {
1036 IActionBars bar = getViewSite().getActionBars();
1037 if (bar == null) {
1038 return;
1039 }
1040 bar.getToolBarManager().add(new Separator("UML2SD_VIEW_MODES")); //$NON-NLS-1$
1041 bar.getToolBarManager().add(new Separator("UML2SD_WORKING_SET")); //$NON-NLS-1$
1042 bar.getToolBarManager().add(new Separator("UML2SD_SORTING")); //$NON-NLS-1$
1043 bar.getToolBarManager().add(new Separator("UML2SD_FILTERING")); //$NON-NLS-1$
1044 bar.getToolBarManager().add(new Separator("UML2SD_VIEW_LAYOUT")); //$NON-NLS-1$
1045 bar.getToolBarManager().add(new Separator("UML2SD_LINK_EDITOR")); //$NON-NLS-1$
1046 bar.getToolBarManager().add(new Separator("UML2SD_OTHER_COMMANDS")); //$NON-NLS-1$
1047 bar.getToolBarManager().add(new Separator("UML2SD_OTHER_PLUGINS_COMMANDS")); //$NON-NLS-1$
1048 bar.getMenuManager().add(new Separator("UML2SD_VIEW_MODES")); //$NON-NLS-1$
1049 bar.getMenuManager().add(new Separator("UML2SD_WORKING_SET")); //$NON-NLS-1$
1050 bar.getMenuManager().add(new Separator("UML2SD_SORTING")); //$NON-NLS-1$
1051 bar.getMenuManager().add(new Separator("UML2SD_FILTERING")); //$NON-NLS-1$
1052 bar.getMenuManager().add(new Separator("UML2SD_VIEW_LAYOUT")); //$NON-NLS-1$
1053 bar.getMenuManager().add(new Separator("UML2SD_LINK_EDITOR")); //$NON-NLS-1$
1054 bar.getMenuManager().add(new Separator("UML2SD_OTHER_COMMANDS")); //$NON-NLS-1$
1055 bar.getMenuManager().add(new Separator("UML2SD_OTHER_PLUGINS_COMMANDS")); //$NON-NLS-1$
1056 }
1057
df0b8ff4
BH
1058 /*
1059 * Gets adapter for this view for properties.
1060 * (non-Javadoc)
1061 * @see org.eclipse.ui.part.WorkbenchPart#getAdapter(java.lang.Class)
1062 */
73005152 1063 @Override
eb63f5ff
BH
1064 public Object getAdapter(Class adapter) {
1065 Object obj = super.getAdapter(adapter);
1066 if (fSdPropertiesProvider != null && adapter.equals(IPropertySheetPage.class)) {
1067 return fSdPropertiesProvider.getPropertySheetEntry();
73005152
BH
1068 }
1069
1070 return obj;
1071 }
a55887ca 1072
3145ec83 1073 /**
3145ec83 1074 * Loader for a blank sequence diagram.
a55887ca 1075 *
dbd4432d 1076 * @version 1.0
3145ec83
BH
1077 */
1078 public static class BlankUml2SdLoader implements IUml2SDLoader {
1079 /*
1080 * (non-Javadoc)
1081 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.load.IUml2SDLoader#setViewer(org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDView)
1082 */
1083 @Override
1084 public void setViewer(SDView viewer) {
1085 // Nothing to do
1086 Frame f = new Frame();
1087 f.setName(""); //$NON-NLS-1$
1088 viewer.setFrame(f);
1089 }
1090
1091 /*
1092 * (non-Javadoc)
1093 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.load.IUml2SDLoader#getTitleString()
1094 */
1095 @Override
1096 public String getTitleString() {
1097 return ""; //$NON-NLS-1$
1098 }
1099
1100 /*
1101 * (non-Javadoc)
1102 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.load.IUml2SDLoader#dispose()
1103 */
1104 @Override
1105 public void dispose() {
1106 }
a55887ca 1107 }
73005152 1108}
This page took 0.085395 seconds and 5 git commands to generate.