/**********************************************************************
- * Copyright (c) 2005, 2008 IBM Corporation and others.
- * Copyright (c) 2011, 2012 Ericsson.
- *
+ * Copyright (c) 2005, 2014 IBM Corporation, Ericsson
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- * Bernd Hufmann - Updated for TMF
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ * Bernd Hufmann - Updated for TMF
**********************************************************************/
+
package org.eclipse.linuxtools.tmf.ui.views.uml2sd;
import java.util.Iterator;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.linuxtools.internal.tmf.ui.Activator;
import org.eclipse.linuxtools.internal.tmf.ui.ITmfImageConstants;
-import org.eclipse.linuxtools.internal.tmf.ui.TmfUiPlugin;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.BaseMessage;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.Frame;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.GraphNode;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.provider.ISDExtendedActionBarProvider;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.provider.ISDFilterProvider;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.provider.ISDFindProvider;
+import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.provider.ISDGraphNodeSupporter;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.provider.ISDPagingProvider;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.provider.ISDPropertiesProvider;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.load.IUml2SDLoader;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.load.LoadersManager;
-import org.eclipse.linuxtools.tmf.ui.views.uml2sd.util.SDMessages;
+import org.eclipse.linuxtools.tmf.ui.views.uml2sd.util.Messages;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.layout.GridData;
* This class is a generic sequence diagram view implementation.
* </p>
- * @version 1.0
+ * @version 1.0
* @author sveyrier
*/
public class SDView extends ViewPart {
+ // ------------------------------------------------------------------------
+ // Constants
+ // ------------------------------------------------------------------------
+ /**
+ * Name of menu separator for view modes
+ * @since 2.0
+ */
+ public static final String UML2SD_VIEW_MODES_SEPARATOR = "UML2SD_VIEW_MODES"; //$NON-NLS-1$
+ /**
+ * Name of menu separator for working set
+ * @since 2.0
+ */
+ public static final String UML2SD_WORKING_SET_SEPARATOR = "UML2SD_WORKING_SET"; //$NON-NLS-1$
+ /**
+ * Name of menu separator for sorting
+ * @since 2.0
+ */
+ public static final String UML2SD_SORTING_SEPARATOR = "UML2SD_SORTING"; //$NON-NLS-1$
+ /**
+ * Name of menu separator for filtering
+ * @since 2.0
+ */
+ public static final String UML2SD_FILTERING_SEPARATOR = "UML2SD_FILTERING"; //$NON-NLS-1$
+ /**
+ * Name of menu separator for view layout
+ * @since 2.0
+ */
+ public static final String UML2SD_VIEW_LAYOUT_SEPARATOR = "UML2SD_VIEW_LAYOUT"; //$NON-NLS-1$
+ /**
+ * Name of menu separator for link editor
+ * @since 2.0
+ */
+ public static final String UML2SD_LINK_EDITOR_SEPARATOR = "UML2SD_LINK_EDITOR"; //$NON-NLS-1$
+ /**
+ * Name of menu separator for other commands
+ * @since 2.0
+ */
+ public static final String UML2SD_OTHER_COMMANDS_SEPARATOR = "UML2SD_OTHER_COMMANDS"; //$NON-NLS-1$
+ /**
+ * Name of menu separator for other plug-in commands
+ * @since 2.0
+ */
+ public static final String UML2SD_OTHER_PLUGINS_COMMANDS_SEPARATOR = "UML2SD_OTHER_PLUGINS_COMMANDS"; //$NON-NLS-1$
+
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
/**
* The sequence diagram widget.
*/
- protected SDWidget fSdWidget = null;
+ private SDWidget fSdWidget = null;
/**
* The time compression bar.
*/
- protected TimeCompressionBar fTimeCompressionBar = null;
+ private TimeCompressionBar fTimeCompressionBar = null;
/**
* The sequence diagram find provider implementation.
*/
- protected ISDFindProvider fSdFindProvider = null;
+ private ISDFindProvider fSdFindProvider = null;
/**
* The sequence diagram paging provider implementation.
*/
- protected ISDPagingProvider fSdPagingProvider = null;
+ private ISDPagingProvider fSdPagingProvider = null;
/**
* The sequence diagram filter provider implementation.
*/
- protected ISDFilterProvider fSdFilterProvider = null;
+ private ISDFilterProvider fSdFilterProvider = null;
/**
* The extended sequence diagram filter provider implementation.
*/
- protected IExtendedFilterProvider fSdExFilterProvider = null;
+ private IExtendedFilterProvider fSdExFilterProvider = null;
/**
* The extended sequence diagram find provider implementation.
*/
- protected IExtendedFindProvider fSdExFindProvider = null;
+ private IExtendedFindProvider fSdExFindProvider = null;
/**
* The extended sequence diagram action bar provider implementation.
*/
- protected ISDExtendedActionBarProvider fSdExtendedActionBarProvider = null;
+ private ISDExtendedActionBarProvider fSdExtendedActionBarProvider = null;
/**
* The sequence diagram property provider implementation.
*/
- protected ISDPropertiesProvider fSdPropertiesProvider = null;
+ private ISDPropertiesProvider fSdPropertiesProvider = null;
/**
- * Button for executing the next page action.
+ * Button for executing the next page action.
*/
- protected NextPage fNextPageButton = null;
+ private NextPage fNextPageButton = null;
/**
- * Button for executing the previous page action.
+ * Button for executing the previous page action.
*/
- protected PrevPage fPrevPageButton = null;
+ private PrevPage fPrevPageButton = null;
/**
- * Button for executing the first page page action.
+ * Button for executing the first page page action.
*/
- protected FirstPage fFirstPageButton = null;
+ private FirstPage fFirstPageButton = null;
/**
- * Button for executing the last page action.
+ * Button for executing the last page action.
*/
- protected LastPage fLastPageButton = null;
+ private LastPage fLastPageButton = null;
/**
* The menu manager reference.
*/
- protected MenuManager fMenuMgr = null;
+ private MenuManager fMenuMgr = null;
/**
- * Flag to indicate whether view needs initialization or not.
+ * Flag to indicate whether view needs initialization or not.
*/
- protected boolean fNeedInit = true;
+ private boolean fNeedInit = true;
/**
* WaitCursor is the cursor to be displayed when long tasks are running
*/
- protected Cursor fWaitCursor;
+ private Cursor fWaitCursor;
+
+ private Zoom fResetZoomAction;
+ private Zoom fNoZoomAction;
+ private Zoom fZoomInAction;
+ private Zoom fZoomOutAction;
// ------------------------------------------------------------------------
// Methods
// ------------------------------------------------------------------------
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
- */
@Override
public void createPartControl(Composite c) {
Composite parent = new Composite(c, SWT.NONE);
GridData seqDiagLayoutData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_FILL);
fTimeCompressionBar = new TimeCompressionBar(parent, SWT.NONE);
fTimeCompressionBar.setLayoutData(timeLayoutdata);
- fSdWidget = new SDWidget(parent, SWT.NONE);// SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
+ fSdWidget = new SDWidget(parent, SWT.NONE);
fSdWidget.setLayoutData(seqDiagLayoutData);
fSdWidget.setSite(this);
fSdWidget.setTimeBar(fTimeCompressionBar);
// Add this view to the key bindings manager
KeyBindingsManager.getInstance().add(this.getSite().getId());
-
+
createCoolbarContent();
hookContextMenu();
* Load a blank page that is supposed to explain that a kind of interaction must be chosen.
*/
protected void loadBlank() {
- IUml2SDLoader loader = new BlankUml2SdLoader();
+ IUml2SDLoader loader = new BlankUml2SdLoader();
loader.setViewer(this);
setContentDescription(loader.getTitleString());
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
- */
@Override
public void setFocus() {
if (fSdWidget != null) {
}
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.part.WorkbenchPart#dispose()
- */
@Override
public void dispose() {
KeyBindingsManager.getInstance().remove(this.getSite().getId());
+ disposeZoomActions();
super.dispose();
}
+ private void disposeZoomActions() {
+ if (fResetZoomAction != null) {
+ fResetZoomAction.dispose();
+ }
+ if (fNoZoomAction != null) {
+ fNoZoomAction.dispose();
+ }
+ if (fZoomInAction != null) {
+ fZoomInAction.dispose();
+ }
+ if (fZoomOutAction != null) {
+ fZoomOutAction.dispose();
+ }
+ }
+
/**
* Returns the SD widget.
- *
+ *
* @return The SD widget.
*/
public SDWidget getSDWidget() {
* Set the find provider for the opened sequence diagram viewer<br>
* If the provider is not set, the find menu item will not be available in the viewer<br>
* A find provider is called back when the user perform a find action<br>
- * The find provider is responsible to move the sequence diagram to the GraphNode which match the
+ * The find provider is responsible to move the sequence diagram to the GraphNode which match the
* find criteria as well as to highlight the GraphNode
- *
+ *
* @param provider the search provider
*/
public void setSDFindProvider(ISDFindProvider provider) {
KeyBindingsManager.getInstance().setFindEnabled(false);
}
}
-
+
/**
* Set the find provider for the opened sequence diagram viewer<br>
- * If the provider is not set, the find menu item will not be available in the viewer<br>
+ * If the provider is not set, the find menu item will not be available in
+ * the viewer<br>
* A find provider is called back when the user perform a find action<br>
- * If the extended find provider is set, it replaces the regular find provider (sdFindProvider).<br>
+ * If the extended find provider is set, it replaces the regular find
+ * provider (sdFindProvider).<br>
+ *
* @param provider
+ * The provider to set
*/
public void setExtendedFindProvider(IExtendedFindProvider provider) {
fSdExFindProvider = provider;
/**
* Returns the extended find provider
- *
+ *
* @return extended find provider.
*/
public IExtendedFindProvider getExtendedFindProvider() {
* Set the filter provider for the opened sequence diagram viewer<br>
* If the provider is not set, the filter menu item will not be available in the viewer<br>
* A filter provider is called back when the user perform a filter action<br>
- *
+ *
* @param provider the filter provider
*/
public void setSDFilterProvider(ISDFilterProvider provider) {
fSdFilterProvider = provider;
// Both systems can be used now, commenting out next statement
- // sdExFilterProvider = null;
createCoolbarContent();
}
-
+
/**
- * Sets the extended filter provider for the opend sequence diagram viewer.
+ * Sets the extended filter provider for the opened sequence diagram viewer.
+ *
* @param provider
+ * The provider to set
*/
public void setExtendedFilterProvider(IExtendedFilterProvider provider) {
fSdExFilterProvider = provider;
// Both systems can be used now, commenting out next statement
- // sdFilterProvider = null;
createCoolbarContent();
}
/**
* Returns the extended find provider.
- *
+ *
* @return The extended find provider.
*/
public IExtendedFilterProvider getExtendedFilterProvider() {
}
/**
- * Register the given provider to support Drag and Drop collapsing. This provider is
+ * Register the given provider to support Drag and Drop collapsing. This provider is
* responsible of updating the Frame.
- *
+ *
* @param provider - the provider to register
*/
public void setCollapsingProvider(ISDCollapseProvider provider) {
* If the sequence diagram provided (see setFrame) need to be split in many parts, a paging provider must be
* provided in order to handle page change requested by the user<br>
* Set a page provider will create the next and previous page buttons in the viewer coolBar
- *
+ *
* @param provider the paging provider
*/
public void setSDPagingProvider(ISDPagingProvider provider) {
/**
* Returns the current page provider for the view
- *
+ *
* @return the paging provider
*/
public ISDPagingProvider getSDPagingProvider() {
/**
* Returns the current find provider for the view
- *
+ *
* @return the find provider
*/
public ISDFindProvider getSDFindProvider() {
/**
* Returns the current filter provider for the view
- *
+ *
* @return the filter provider
*/
public ISDFilterProvider getSDFilterProvider() {
/**
* Set the extended action bar provider for the opened sequence diagram viewer<br>
* This allow to add programmatically actions in the coolbar and/or in the drop-down menu
- *
+ *
* @param provider the search provider
*/
public void setSDExtendedActionBarProvider(ISDExtendedActionBarProvider provider) {
/**
* Returns the current extended action bar provider for the view
- *
+ *
* @return the extended action bar provider
*/
public ISDExtendedActionBarProvider getSDExtendedActionBarProvider() {
/**
* Set the properties view provider for the opened sequence diagram viewer
- *
+ *
* @param provider the properties provider
*/
public void setSDPropertiesProvider(ISDPropertiesProvider provider) {
/**
* Returns the current extended action bar provider for the view.
- *
+ *
* @return the extended action bar provider
*/
public ISDPropertiesProvider getSDPropertiesProvider() {
return fSdPropertiesProvider;
}
+ /**
+ * Sets the sdWidget.
+ *
+ * @param sdWidget
+ * A sdWidget to set
+ * @since 2.0
+ */
+ protected void setSDWidget(SDWidget sdWidget) {
+ fSdWidget = sdWidget;
+ }
+
+ /**
+ * Sets the time compression bar.
+ *
+ * @param timeCompressionbar
+ * A sdWidget to set
+ * @since 2.0
+ */
+ protected void setTimeBar(TimeCompressionBar timeCompressionbar) {
+ fTimeCompressionBar = timeCompressionbar;
+ }
+
+ /**
+ * Sets the initialization flag.
+ *
+ * @param needInit
+ * flag value to set
+ * @since 2.0
+ */
+ protected void setNeedInit(boolean needInit) {
+ fNeedInit = needInit;
+ }
+
/**
* Creates the basic sequence diagram menu
*/
/**
* Returns the context menu manager
- *
+ *
* @return the menu manager
*/
public MenuManager getMenuManager() {
/**
* Fills the basic sequence diagram menu and define the dynamic menu item insertion point
- *
+ *
* @param manager the menu manager
*/
protected void fillContextMenu(IMenuManager manager) {
manager.add(new Separator("Additions")); //$NON-NLS-1$
- if (getSDWidget() != null && getSDWidget().fCurrentGraphNode != null) {
+ if (getSDWidget() != null && getSDWidget().getCurrentGraphNode() != null) {
ISelectionProvider selProvider = fSdWidget.getSelectionProvider();
ISelection sel = selProvider.getSelection();
int nbMessage = 0;
if (nbMessage != 1) {
return;
}
- GraphNode node = getSDWidget().fCurrentGraphNode;
+ GraphNode node = getSDWidget().getCurrentGraphNode();
if ((node instanceof SyncMessageReturn) && (((SyncMessageReturn) node).getMessage() != null)) {
Action goToMessage = new MoveToMessage(this);
- goToMessage.setText(SDMessages._39);
+ goToMessage.setText(Messages.SequenceDiagram_GoToMessage);
manager.add(goToMessage);
}
if ((node instanceof SyncMessage) && (((SyncMessage) node).getMessageReturn() != null)) {
Action goToMessage = new MoveToMessage(this);
- goToMessage.setText(SDMessages._40);
+ goToMessage.setText(Messages.SequenceDiagram_GoToMessageReturn);
manager.add(goToMessage);
}
}
/**
* Enables/Disables an action with given name.
- *
+ *
* @param actionName The action name
* @param state true or false
*/
* Creates the coolBar icon depending on the actions supported by the Sequence Diagram provider<br>
* - Navigation buttons are displayed if ISDPovider.HasPaging return true<br>
* - Navigation buttons are enabled depending on the value return by ISDPovider.HasNext and HasPrev<br>
- *
+ *
* @see ISDGraphNodeSupporter Action support definition
* @see SDView#setSDFilterProvider(ISDFilterProvider)
* @see SDView#setSDFindProvider(ISDFindProvider)
bar.getMenuManager().removeAll();
bar.getToolBarManager().removeAll();
+ disposeZoomActions();
createMenuGroup();
- Zoom resetZoom = new Zoom(this, ZoomType.ZOOM_RESET);
- bar.getMenuManager().appendToGroup("UML2SD_OTHER_COMMANDS", resetZoom);//$NON-NLS-1$
- bar.getToolBarManager().appendToGroup("UML2SD_OTHER_COMMANDS", resetZoom); //$NON-NLS-1$
+ fResetZoomAction = new Zoom(this, ZoomType.ZOOM_RESET);
+ bar.getMenuManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, fResetZoomAction);
+ bar.getToolBarManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, fResetZoomAction);
- Zoom noZoom = new Zoom(this, ZoomType.ZOOM_NONE);
- noZoom.setChecked(true);
- bar.getMenuManager().appendToGroup("UML2SD_OTHER_COMMANDS", noZoom);//$NON-NLS-1$
- bar.getToolBarManager().appendToGroup("UML2SD_OTHER_COMMANDS", noZoom); //$NON-NLS-1$
+ fNoZoomAction = new Zoom(this, ZoomType.ZOOM_NONE);
+ fNoZoomAction.setChecked(true);
+ bar.getMenuManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, fNoZoomAction);
+ bar.getToolBarManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, fNoZoomAction);
- Zoom zoomIn = new Zoom(this, ZoomType.ZOOM_IN);
- bar.getMenuManager().appendToGroup("UML2SD_OTHER_COMMANDS", zoomIn);//$NON-NLS-1$
- bar.getToolBarManager().appendToGroup("UML2SD_OTHER_COMMANDS", zoomIn); //$NON-NLS-1$
+ fZoomInAction = new Zoom(this, ZoomType.ZOOM_IN);
+ bar.getMenuManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, fZoomInAction);
+ bar.getToolBarManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, fZoomInAction);
- Zoom zoomOut = new Zoom(this, ZoomType.ZOOM_OUT);
- bar.getMenuManager().appendToGroup("UML2SD_OTHER_COMMANDS", zoomOut);//$NON-NLS-1$
- bar.getToolBarManager().appendToGroup("UML2SD_OTHER_COMMANDS", zoomOut); //$NON-NLS-1$
+ fZoomOutAction = new Zoom(this, ZoomType.ZOOM_OUT);
+ bar.getMenuManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, fZoomOutAction);
+ bar.getToolBarManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, fZoomOutAction);
- MenuManager navigation = new MenuManager(SDMessages._77);
+ MenuManager navigation = new MenuManager(Messages.SequenceDiagram_Navigation);
ShowNodeStart showNodeStart = new ShowNodeStart(this);
- showNodeStart.setText(SDMessages.uml_25);
+ showNodeStart.setText(Messages.SequenceDiagram_ShowNodeStart);
showNodeStart.setId("org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.ShowNodeStart");//$NON-NLS-1$
showNodeStart.setActionDefinitionId("org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.ShowNodeStart");//$NON-NLS-1$
navigation.add(showNodeStart);
ShowNodeEnd showNodeEnd = new ShowNodeEnd(this);
- showNodeEnd.setText(SDMessages.uml_23);
+ showNodeEnd.setText(Messages.SequenceDiagram_ShowNodeEnd);
showNodeEnd.setId("org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.ShowNodeEnd");//$NON-NLS-1$
showNodeEnd.setActionDefinitionId("org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.ShowNodeEnd");//$NON-NLS-1$
navigation.add(showNodeEnd);
- bar.getMenuManager().appendToGroup("UML2SD_OTHER_COMMANDS", navigation); //$NON-NLS-1$
+ bar.getMenuManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, navigation);
ConfigureMinMax minMax = new ConfigureMinMax(this);
- minMax.setText(SDMessages.uml_45);
+ minMax.setText(Messages.SequenceDiagram_ConfigureMinMax);
minMax.setId("org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.ConfigureMinMax");//$NON-NLS-1$
- bar.getMenuManager().appendToGroup("UML2SD_OTHER_COMMANDS", minMax); //$NON-NLS-1$
+ bar.getMenuManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, minMax);
if ((fSdWidget.getFrame() != null) && (fSdWidget.getFrame().hasTimeInfo())) {
minMax.setEnabled(true);
// Do we need to display a paging item
if (fSdPagingProvider != null) {
fNextPageButton = new NextPage(this);
- bar.getToolBarManager().appendToGroup("UML2SD_OTHER_COMMANDS", fNextPageButton); //$NON-NLS-1$
+ bar.getToolBarManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, fNextPageButton);
fNextPageButton.setEnabled(fSdPagingProvider.hasNextPage());
- bar.getMenuManager().appendToGroup("UML2SD_OTHER_COMMANDS", fNextPageButton); //$NON-NLS-1$
+ bar.getMenuManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, fNextPageButton);
fPrevPageButton = new PrevPage(this);
- bar.getToolBarManager().appendToGroup("UML2SD_OTHER_COMMANDS", fPrevPageButton); //$NON-NLS-1$
+ bar.getToolBarManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, fPrevPageButton);
fPrevPageButton.setEnabled(fSdPagingProvider.hasPrevPage());
- bar.getMenuManager().appendToGroup("UML2SD_OTHER_COMMANDS", fPrevPageButton); //$NON-NLS-1$
-
+ bar.getMenuManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, fPrevPageButton);
+
fFirstPageButton = new FirstPage(this);
- bar.getToolBarManager().appendToGroup("UML2SD_OTHER_COMMANDS", fFirstPageButton); //$NON-NLS-1$
+ bar.getToolBarManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, fFirstPageButton);
fFirstPageButton.setEnabled(fSdPagingProvider.hasPrevPage());
- bar.getMenuManager().appendToGroup("UML2SD_OTHER_COMMANDS", fFirstPageButton); //$NON-NLS-1$
+ bar.getMenuManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, fFirstPageButton);
fLastPageButton = new LastPage(this);
- bar.getToolBarManager().appendToGroup("UML2SD_OTHER_COMMANDS", fLastPageButton); //$NON-NLS-1$
+ bar.getToolBarManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, fLastPageButton);
fLastPageButton.setEnabled(fSdPagingProvider.hasNextPage());
- bar.getMenuManager().appendToGroup("UML2SD_OTHER_COMMANDS", fLastPageButton); //$NON-NLS-1$
+ bar.getMenuManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, fLastPageButton);
}
if (fSdExFilterProvider != null) {
Action action = fSdExFilterProvider.getFilterAction();
if (action != null) {
if (action.getId() == null)
+ {
action.setId("org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.extendedFilter"); //$NON-NLS-1$
- if (action.getImageDescriptor() == null)
- action.setImageDescriptor(TmfUiPlugin.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_FILTERS));
- if (action.getText() == null || action.getText().length() == 0)
- action.setText(SDMessages._42);
- bar.getMenuManager().prependToGroup("UML2SD_FILTERING", action); //$NON-NLS-1$
- bar.getToolBarManager().prependToGroup("UML2SD_FILTERING", action); //$NON-NLS-1$
+ }
+ if (action.getImageDescriptor() == null) {
+ action.setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_FILTERS));
+ }
+ if (action.getText() == null || action.getText().length() == 0) {
+ action.setText(Messages.SequenceDiagram_EditFilters);
+ }
+ bar.getMenuManager().prependToGroup(UML2SD_FILTERING_SEPARATOR, action);
+ bar.getToolBarManager().prependToGroup(UML2SD_FILTERING_SEPARATOR, action);
}
}
// Both systems can be used now: commenting out else keyword
- /* else */if (fSdFilterProvider != null) {
- bar.getMenuManager().appendToGroup("UML2SD_FILTERING", new OpenSDFiltersDialog(this, fSdFilterProvider)); //$NON-NLS-1$
- // No longer in the coolbar: commenting out next statement
- //bar.getToolBarManager().appendToGroup("UML2SD_FILTERING",new OpenSDFiltersDialog(this, sdFilterProvider)); //$NON-NLS-1$
+ if (fSdFilterProvider != null) {
+ bar.getMenuManager().appendToGroup(UML2SD_FILTERING_SEPARATOR, new OpenSDFiltersDialog(this, fSdFilterProvider));
}
if (fSdPagingProvider instanceof ISDAdvancedPagingProvider) {
IContributionItem sdPaging = bar.getMenuManager().find(OpenSDPagesDialog.ID);
bar.getMenuManager().remove(sdPaging);
sdPaging = null;
}
- bar.getMenuManager().appendToGroup("UML2SD_OTHER_COMMANDS", new OpenSDPagesDialog(this, (ISDAdvancedPagingProvider) fSdPagingProvider)); //$NON-NLS-1$
+ bar.getMenuManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, new OpenSDPagesDialog(this, (ISDAdvancedPagingProvider) fSdPagingProvider));
updatePagesMenuItem(bar);
}
action.setId("org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.extendedFind"); //$NON-NLS-1$
}
if (action.getImageDescriptor() == null) {
- action.setImageDescriptor(TmfUiPlugin.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_SEARCH_SEQ));
+ action.setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_SEARCH_SEQ));
}
if (action.getText() == null) {
- action.setText(SDMessages._41);
+ action.setText(Messages.SequenceDiagram_Find + "..."); //$NON-NLS-1$
}
- bar.getMenuManager().appendToGroup("UML2SD_OTHER_COMMANDS", action); //$NON-NLS-1$
- bar.getToolBarManager().appendToGroup("UML2SD_OTHER_COMMANDS", action); //$NON-NLS-1$
+ bar.getMenuManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, action);
+ bar.getToolBarManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, action);
}
} else if (fSdFindProvider != null) {
- bar.getMenuManager().appendToGroup("UML2SD_OTHER_COMMANDS", new OpenSDFindDialog(this)); //$NON-NLS-1$
- bar.getToolBarManager().appendToGroup("UML2SD_OTHER_COMMANDS", new OpenSDFindDialog(this)); //$NON-NLS-1$
+ bar.getMenuManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, new OpenSDFindDialog(this));
+ bar.getToolBarManager().appendToGroup(UML2SD_OTHER_COMMANDS_SEPARATOR, new OpenSDFindDialog(this));
}
if (fSdExtendedActionBarProvider != null) {
* Updates the view coolbar buttons state according to the value return by: -
* ISDExtendedActionBarProvider.hasNextPage()<br>
* - ISDExtendedActionBarProvider.hasPrevPage()<br>
- *
+ *
*/
public void updateCoolBar() {
if (fSdPagingProvider != null) {
((LastPage) lastPageAction).setEnabled(fSdPagingProvider.hasNextPage());
}
}
-
+
updatePagesMenuItem(bar);
}
}
/**
* Enables or disables the Pages... menu item, depending on the number of pages
- *
+ *
* @param bar the bar containing the action
*/
protected void updatePagesMenuItem(IActionBars bar) {
/**
* The frame to render (the sequence diagram)
- *
+ *
* @param frame the frame to display
*/
public void setFrame(Frame frame) {
/**
* The frame to render (the sequence diagram)
- *
+ *
* @param frame the frame to display
* @param resetPosition boolean Flag whether to reset the position or not.
*/
protected void setFrame(Frame frame, boolean resetPosition) {
- if (fSdWidget == null)
+ if (getSDWidget() == null) {
return;
+ }
if (frame == null) {
loadBlank();
}
IUml2SDLoader loader = LoadersManager.getInstance().getCurrentLoader(getViewSite().getId(), this);
+ if (loader == null) {
+ return;
+ }
- if ((loader != null) && (loader.getTitleString() != null)) {
+ if (loader.getTitleString() != null) {
setContentDescription(loader.getTitleString());
}
- if (getSDWidget() != null) {
- getSDWidget().setFrame(frame, resetPosition);
- }
+ getSDWidget().setFrame(frame, resetPosition);
if (fTimeCompressionBar != null) {
fTimeCompressionBar.setFrame(frame);
}
updateCoolBar();
- if (!frame.hasTimeInfo()) {
- Composite parent = fTimeCompressionBar.getParent();
- fTimeCompressionBar.setVisible(false);
- parent.layout(true);
- } else {
- Composite parent = fTimeCompressionBar.getParent();
- fTimeCompressionBar.setVisible(true);
- parent.layout(true);
+ if (fTimeCompressionBar != null) {
+ if (!frame.hasTimeInfo()) {
+ Composite parent = fTimeCompressionBar.getParent();
+ fTimeCompressionBar.setVisible(false);
+ parent.layout(true);
+ } else {
+ Composite parent = fTimeCompressionBar.getParent();
+ fTimeCompressionBar.setVisible(true);
+ parent.layout(true);
+ }
}
IContributionItem shortKeysMenu = getViewSite().getActionBars().getMenuManager().find("org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers");//$NON-NLS-1$
MenuManager shortKeys = (MenuManager) shortKeysMenu;
/**
* Activate or deactivate the short key command given in parameter (see plugin.xml)
- *
+ *
* @param id the command id defined in the plugin.xml
* @param value the state value
*/
/**
* Set the frame from an other thread than the one executing the main loop
- *
+ *
* @param frame The frame to set (and display)
*/
public void setFrameSync(final Frame frame) {
getSDWidget().getDisplay().syncExec(new Runnable() {
@Override
public void run() {
- if (getSDWidget() == null || getSDWidget().isDisposed()) {
+ if (getSDWidget() == null || getSDWidget().isDisposed() ||
+ ((fTimeCompressionBar != null) && fTimeCompressionBar.isDisposed())) {
return;
}
setFrame(frame);
/**
* Ensure an object is visible from an other thread than the one executing the main loop
- *
+ *
* @param sm The node to make visible in view
*/
public void ensureVisibleSync(final GraphNode sm) {
/**
* Set the frame and ensure an object is visible from an other thread than the one executing the main loop
- *
+ *
* @param sm The node to make visible in view
* @param frame Frame The frame to set
*/
/**
* Set the frame and ensure an object is visible
- *
+ *
* @param sm The node to make visible in view
* @param frame Frame The frame to set
*/
/**
* Set the frame and ensure an object is visible from an other thread than the one executing the main loop
- *
+ *
* @param frame The frame to set.
* @param x The x coordinate to make visible.
* @param y The y coordinate to make visible.
if (getSDWidget() == null || getSDWidget().isDisposed()) {
return;
}
-
+
getSDWidget().getDisplay().syncExec(new Runnable() {
@Override
public void run() {
/**
* Set the frame and ensure an object is visible
- *
+ *
* @param frame The frame to set.
* @param x The x coordinate to make visible.
* @param y The y coordinate to make visible.
/**
* Toggle between default and wait cursors from an other thread than the one executing the main loop
- *
- * @param wait <code>true</code> for wait cursor else <code>false</code> for default cursor.
+ *
+ * @param wait <code>true</code> for wait cursor else <code>false</code> for default cursor.
*/
public void toggleWaitCursorAsync(final boolean wait) {
if (getSDWidget() == null || getSDWidget().isDisposed()) {
/**
* Return the time compression bar widget
- *
- * @return the time compression bar
+ *
+ * @return the time compression bar
*/
public TimeCompressionBar getTimeCompressionBar() {
return fTimeCompressionBar;
/**
* Returns the current Frame (the sequence diagram container)
- *
- * @return the current frame
+ *
+ * @return the current frame
*/
public Frame getFrame() {
if (getSDWidget() != null) {
return getSDWidget().getFrame();
}
- else {
- return null;
- }
+ return null;
+ }
+
+ /**
+ * Gets the initialization flag.
+ * @return the value of the initialization flag.
+ * @since 2.0
+ */
+ protected boolean isNeedInit() {
+ return fNeedInit;
}
/**
* Restores the loader for the view based on the view ID.
- *
+ *
* @return boolean <code>true</code> if initialization is needed else <code>false</code>.
*/
protected boolean restoreLoader() {
String id = getViewSite().getId();
- // System.err.println("restoreLoader() id="+id);
if (id == null) {
return true;
}
IUml2SDLoader loader = LoadersManager.getInstance().getCurrentLoader(id, this);
- // System.err.println("restoreLoader() l="+l);
- if ((loader != null)) {// &&( LoadersManager.getLoadersManager().getViewer(l)==this)){
+ if ((loader != null)) {
loader.setViewer(this);
return false;
- } else {
- loadBlank();
- return true;
}
+ loadBlank();
+ return true;
}
/**
* Checks if current view is ready to be used.
- *
+ *
* @return boolean <code>true</code> if view is ready else <code>false</code>.
*/
protected boolean isViewReady() {
if (bar == null) {
return;
}
- bar.getToolBarManager().add(new Separator("UML2SD_VIEW_MODES")); //$NON-NLS-1$
- bar.getToolBarManager().add(new Separator("UML2SD_WORKING_SET")); //$NON-NLS-1$
- bar.getToolBarManager().add(new Separator("UML2SD_SORTING")); //$NON-NLS-1$
- bar.getToolBarManager().add(new Separator("UML2SD_FILTERING")); //$NON-NLS-1$
- bar.getToolBarManager().add(new Separator("UML2SD_VIEW_LAYOUT")); //$NON-NLS-1$
- bar.getToolBarManager().add(new Separator("UML2SD_LINK_EDITOR")); //$NON-NLS-1$
- bar.getToolBarManager().add(new Separator("UML2SD_OTHER_COMMANDS")); //$NON-NLS-1$
- bar.getToolBarManager().add(new Separator("UML2SD_OTHER_PLUGINS_COMMANDS")); //$NON-NLS-1$
- bar.getMenuManager().add(new Separator("UML2SD_VIEW_MODES")); //$NON-NLS-1$
- bar.getMenuManager().add(new Separator("UML2SD_WORKING_SET")); //$NON-NLS-1$
- bar.getMenuManager().add(new Separator("UML2SD_SORTING")); //$NON-NLS-1$
- bar.getMenuManager().add(new Separator("UML2SD_FILTERING")); //$NON-NLS-1$
- bar.getMenuManager().add(new Separator("UML2SD_VIEW_LAYOUT")); //$NON-NLS-1$
- bar.getMenuManager().add(new Separator("UML2SD_LINK_EDITOR")); //$NON-NLS-1$
- bar.getMenuManager().add(new Separator("UML2SD_OTHER_COMMANDS")); //$NON-NLS-1$
- bar.getMenuManager().add(new Separator("UML2SD_OTHER_PLUGINS_COMMANDS")); //$NON-NLS-1$
+ bar.getToolBarManager().add(new Separator(UML2SD_VIEW_MODES_SEPARATOR));
+ bar.getToolBarManager().add(new Separator(UML2SD_WORKING_SET_SEPARATOR));
+ bar.getToolBarManager().add(new Separator(UML2SD_SORTING_SEPARATOR));
+ bar.getToolBarManager().add(new Separator(UML2SD_FILTERING_SEPARATOR));
+ bar.getToolBarManager().add(new Separator(UML2SD_VIEW_LAYOUT_SEPARATOR));
+ bar.getToolBarManager().add(new Separator(UML2SD_LINK_EDITOR_SEPARATOR));
+ bar.getToolBarManager().add(new Separator(UML2SD_OTHER_COMMANDS_SEPARATOR));
+ bar.getToolBarManager().add(new Separator(UML2SD_OTHER_PLUGINS_COMMANDS_SEPARATOR));
+ bar.getMenuManager().add(new Separator(UML2SD_VIEW_MODES_SEPARATOR));
+ bar.getMenuManager().add(new Separator(UML2SD_WORKING_SET_SEPARATOR));
+ bar.getMenuManager().add(new Separator(UML2SD_SORTING_SEPARATOR));
+ bar.getMenuManager().add(new Separator(UML2SD_FILTERING_SEPARATOR));
+ bar.getMenuManager().add(new Separator(UML2SD_VIEW_LAYOUT_SEPARATOR));
+ bar.getMenuManager().add(new Separator(UML2SD_LINK_EDITOR_SEPARATOR));
+ bar.getMenuManager().add(new Separator(UML2SD_OTHER_COMMANDS_SEPARATOR));
+ bar.getMenuManager().add(new Separator(UML2SD_OTHER_PLUGINS_COMMANDS_SEPARATOR));
}
- /*
- * Gets adapter for this view for properties.
- * (non-Javadoc)
- * @see org.eclipse.ui.part.WorkbenchPart#getAdapter(java.lang.Class)
- */
- @SuppressWarnings("rawtypes")
@Override
public Object getAdapter(Class adapter) {
Object obj = super.getAdapter(adapter);
return obj;
}
-
+
/**
- * @version 1.0
- *
* Loader for a blank sequence diagram.
- *
+ *
+ * @version 1.0
*/
public static class BlankUml2SdLoader implements IUml2SDLoader {
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.load.IUml2SDLoader#setViewer(org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDView)
- */
@Override
public void setViewer(SDView viewer) {
// Nothing to do
viewer.setFrame(f);
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.load.IUml2SDLoader#getTitleString()
- */
@Override
public String getTitleString() {
return ""; //$NON-NLS-1$
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.load.IUml2SDLoader#dispose()
- */
@Override
public void dispose() {
}
- }
+ }
}