Search in sources :

Example 1 with RefreshMSCViewAction

use of org.eclipse.titan.log.viewer.views.msc.ui.actions.RefreshMSCViewAction in project titan.EclipsePlug-ins by eclipse.

the class MSCView method createCoolbarContent.

/**
 * Creates the coolBar icon depending on the actions supported by the
 * Message Sequence Chart 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>
 */
protected void createCoolbarContent() {
    IActionBars bar = getViewSite().getActionBars();
    bar.getToolBarManager().removeAll();
    createMenuGroups();
    this.openValueView = new OpenValueViewAction(this, true);
    this.openValueView.setImageDescriptor(Activator.getDefault().getCachedImageDescriptor(Constants.ICONS_DETAILS_VIEW));
    this.silentOpenValueView = new OpenValueViewAction(this, false);
    this.silentOpenValueView.setImageDescriptor(Activator.getDefault().getCachedImageDescriptor(Constants.ICONS_DETAILS_VIEW));
    this.openTextTable = new OpenTextTableAction(this);
    this.openTextTable.setImageDescriptor(Activator.getDefault().getCachedImageDescriptor(Constants.ICONS_TEXT_TABLE_VIEW));
    this.openSource = new OpenSourceAction(this, false, true);
    this.openSource.setImageDescriptor(Activator.getDefault().getCachedImageDescriptor(Constants.ICONS_TEXT_TABLE_VIEW));
    this.silentOpenSource = new OpenSourceAction(this, true, false);
    this.silentOpenSource.setImageDescriptor(Activator.getDefault().getCachedImageDescriptor(Constants.ICONS_TEXT_TABLE_VIEW));
    IAction switchToTextTable = new Action() {

        @Override
        public void run() {
            if (logFileMetaData == null) {
                return;
            }
            TextTableViewHelper.open(logFileMetaData.getProjectName(), logFileMetaData.getProjectRelativePath(), getSelectedRecordNumber());
        }
    };
    switchToTextTable.setImageDescriptor(Activator.getDefault().getCachedImageDescriptor(Constants.ICONS_TEXT_TABLE_VIEW));
    switchToTextTable.setText("Switch to Table view");
    switchToTextTable.setToolTipText(switchToTextTable.getText());
    bar.getToolBarManager().appendToGroup(Constants.ID_SWITCH_VIEW_GROUP, switchToTextTable);
    this.jumpToPreviousSetverdict = new JumpToPreviousSetverdictAction(this);
    // $NON-NLS-1$
    this.jumpToPreviousSetverdict.setId("jumpToNextSetVerdict");
    // $NON-NLS-1$
    this.jumpToPreviousSetverdict.setText(Messages.getString("MSCView.11"));
    // $NON-NLS-1$
    this.jumpToPreviousSetverdict.setToolTipText(Messages.getString("MSCView.12"));
    this.jumpToPreviousSetverdict.setImageDescriptor(ImageDescriptor.createFromImage(Activator.getDefault().getIcon(Constants.ICONS_MSC_JUMP_TO_PREVIOUS)));
    this.jumpToPreviousSetverdict.setEnabled(false);
    bar.getToolBarManager().appendToGroup(MSCConstants.ID_ZOOM_GROUP, this.jumpToPreviousSetverdict);
    this.jumpToNextSetverdict = new JumpToNextSetverdictAction(this);
    // $NON-NLS-1$
    this.jumpToNextSetverdict.setId("jumpToNextSetVerdict");
    // $NON-NLS-1$
    this.jumpToNextSetverdict.setText(Messages.getString("MSCView.13"));
    // $NON-NLS-1$
    this.jumpToNextSetverdict.setToolTipText(Messages.getString("MSCView.14"));
    this.jumpToNextSetverdict.setImageDescriptor(ImageDescriptor.createFromImage(Activator.getDefault().getIcon(Constants.ICONS_MSC_JUMP_TO_NEXT)));
    this.jumpToNextSetverdict.setEnabled(false);
    bar.getToolBarManager().appendToGroup(MSCConstants.ID_ZOOM_GROUP, this.jumpToNextSetverdict);
    this.refresh = new RefreshMSCViewAction(this);
    // $NON-NLS-1$
    this.refresh.setId("refreshMSCView");
    // $NON-NLS-1$
    this.refresh.setToolTipText(Messages.getString("MSCView.1"));
    this.refresh.setImageDescriptor(ImageDescriptor.createFromImage(Activator.getDefault().getIcon(Constants.ICONS_REFRESH)));
    IActionBars actionBar = getViewSite().getActionBars();
    actionBar.setGlobalActionHandler(ActionFactory.REFRESH.getId(), this.refresh);
    bar.getToolBarManager().appendToGroup(MSCConstants.ID_ZOOM_GROUP, this.refresh);
    IAction closeAllAction = new Action() {

        @Override
        public void run() {
            IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
            IViewReference[] viewReferences = activePage.getViewReferences();
            for (IViewReference reference : viewReferences) {
                IViewPart view = reference.getView(false);
                // memento restored views that never have had focus are null!!!
                if (view == null) {
                    activePage.hideView(reference);
                } else if (view instanceof MSCView) {
                    activePage.hideView(reference);
                }
            }
            // Clear Details view if needed
            DetailsView detailsView = (DetailsView) activePage.findView(Constants.DETAILS_VIEW_ID);
            if (detailsView != null) {
                detailsView.setData(null, false);
            }
        }
    };
    closeAllAction.setImageDescriptor(ImageDescriptor.createFromImage(Activator.getDefault().getIcon(Constants.ICONS_MSC_DELETE)));
    // $NON-NLS-1$
    closeAllAction.setId("closeMSC");
    // $NON-NLS-1$
    closeAllAction.setToolTipText(Messages.getString("MSCView.2"));
    closeAllAction.setEnabled(true);
    bar.getToolBarManager().appendToGroup(MSCConstants.ID_ZOOM_GROUP, closeAllAction);
    ZoomAction resetZoom = new ZoomAction(this);
    resetZoom.setId(MSCConstants.ID_RESET_ZOOM);
    // $NON-NLS-1$
    resetZoom.setText(Messages.getString("MSCView.3"));
    // $NON-NLS-1$
    resetZoom.setToolTipText(Messages.getString("MSCView.4"));
    resetZoom.setImageDescriptor(Activator.getDefault().getCachedImageDescriptor(MSCConstants.ICON_RESET_ZOOM));
    bar.getToolBarManager().appendToGroup(MSCConstants.ID_ZOOM_GROUP, resetZoom);
    ZoomAction noZoom = new ZoomAction(this);
    noZoom.setChecked(true);
    noZoom.setId(MSCConstants.ID_NO_ZOOM);
    // $NON-NLS-1$
    noZoom.setText(Messages.getString("MSCView.5"));
    // $NON-NLS-1$
    noZoom.setToolTipText(Messages.getString("MSCView.6"));
    noZoom.setImageDescriptor(Activator.getDefault().getCachedImageDescriptor(MSCConstants.ICON_MOVE));
    bar.getToolBarManager().appendToGroup(MSCConstants.ID_ZOOM_GROUP, noZoom);
    ZoomAction zoomIn = new ZoomAction(this);
    zoomIn.setId(MSCConstants.ID_ZOOM_IN);
    // $NON-NLS-1$
    zoomIn.setText(Messages.getString("MSCView.7"));
    // $NON-NLS-1$
    zoomIn.setToolTipText(Messages.getString("MSCView.8"));
    zoomIn.setImageDescriptor(Activator.getDefault().getCachedImageDescriptor(MSCConstants.ICON_ZOOM_IN));
    bar.getToolBarManager().appendToGroup(MSCConstants.ID_ZOOM_GROUP, zoomIn);
    ZoomAction zoomOut = new ZoomAction(this);
    zoomOut.setId(MSCConstants.ID_ZOOM_OUT);
    // $NON-NLS-1$
    zoomOut.setText(Messages.getString("MSCView.9"));
    // $NON-NLS-1$
    zoomOut.setToolTipText(Messages.getString("MSCView.10"));
    zoomOut.setImageDescriptor(Activator.getDefault().getCachedImageDescriptor(MSCConstants.ICON_ZOOM_OUT));
    bar.getToolBarManager().appendToGroup(MSCConstants.ID_ZOOM_GROUP, zoomOut);
    bar.getToolBarManager().appendToGroup(MSCConstants.ID_ZOOM_GROUP, filterAction);
    Action decipheringAction = new Action() {

        @Override
        public void run() {
            final List<String> rulesets = DecipheringPreferenceHandler.getAvailableRuleSets();
            ElementListSelectionDialog dialog = new ElementListSelectionDialog(MSCView.this.getSite().getShell(), new LabelProvider());
            dialog.setTitle("Message name deciphering");
            dialog.setMessage("Select a deciphering ruleset");
            dialog.setHelpAvailable(false);
            dialog.setElements(rulesets.toArray());
            if (dialog.open() == Window.CANCEL || dialog.getFirstResult() == null) {
                return;
            }
            MSCView.this.model.setDecipheringRuleset((String) dialog.getFirstResult());
            mscWidget.redraw();
        }
    };
    decipheringAction.setImageDescriptor(Activator.getImageDescriptor(Constants.ICONS_MSC_DECIPHERING));
    decipheringAction.setToolTipText("Select a message name deciphering ruleset");
    bar.getToolBarManager().appendToGroup(MSCConstants.ID_ZOOM_GROUP, decipheringAction);
    bar.updateActionBars();
}
Also used : OpenSourceAction(org.eclipse.titan.log.viewer.views.msc.ui.actions.OpenSourceAction) RefreshMSCViewAction(org.eclipse.titan.log.viewer.views.msc.ui.actions.RefreshMSCViewAction) IAction(org.eclipse.jface.action.IAction) OpenValueViewAction(org.eclipse.titan.log.viewer.views.msc.ui.actions.OpenValueViewAction) OpenTextTableAction(org.eclipse.titan.log.viewer.views.msc.ui.actions.OpenTextTableAction) JumpToPreviousSetverdictAction(org.eclipse.titan.log.viewer.views.msc.ui.actions.JumpToPreviousSetverdictAction) ZoomAction(org.eclipse.titan.log.viewer.views.msc.ui.actions.ZoomAction) JumpToNextSetverdictAction(org.eclipse.titan.log.viewer.views.msc.ui.actions.JumpToNextSetverdictAction) OpenSourceAction(org.eclipse.titan.log.viewer.views.msc.ui.actions.OpenSourceAction) Action(org.eclipse.jface.action.Action) IViewPart(org.eclipse.ui.IViewPart) IAction(org.eclipse.jface.action.IAction) RefreshMSCViewAction(org.eclipse.titan.log.viewer.views.msc.ui.actions.RefreshMSCViewAction) JumpToNextSetverdictAction(org.eclipse.titan.log.viewer.views.msc.ui.actions.JumpToNextSetverdictAction) JumpToPreviousSetverdictAction(org.eclipse.titan.log.viewer.views.msc.ui.actions.JumpToPreviousSetverdictAction) OpenTextTableAction(org.eclipse.titan.log.viewer.views.msc.ui.actions.OpenTextTableAction) ZoomAction(org.eclipse.titan.log.viewer.views.msc.ui.actions.ZoomAction) ElementListSelectionDialog(org.eclipse.ui.dialogs.ElementListSelectionDialog) IViewReference(org.eclipse.ui.IViewReference) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) OpenValueViewAction(org.eclipse.titan.log.viewer.views.msc.ui.actions.OpenValueViewAction) LabelProvider(org.eclipse.jface.viewers.LabelProvider) IActionBars(org.eclipse.ui.IActionBars)

Aggregations

Action (org.eclipse.jface.action.Action)1 IAction (org.eclipse.jface.action.IAction)1 LabelProvider (org.eclipse.jface.viewers.LabelProvider)1 JumpToNextSetverdictAction (org.eclipse.titan.log.viewer.views.msc.ui.actions.JumpToNextSetverdictAction)1 JumpToPreviousSetverdictAction (org.eclipse.titan.log.viewer.views.msc.ui.actions.JumpToPreviousSetverdictAction)1 OpenSourceAction (org.eclipse.titan.log.viewer.views.msc.ui.actions.OpenSourceAction)1 OpenTextTableAction (org.eclipse.titan.log.viewer.views.msc.ui.actions.OpenTextTableAction)1 OpenValueViewAction (org.eclipse.titan.log.viewer.views.msc.ui.actions.OpenValueViewAction)1 RefreshMSCViewAction (org.eclipse.titan.log.viewer.views.msc.ui.actions.RefreshMSCViewAction)1 ZoomAction (org.eclipse.titan.log.viewer.views.msc.ui.actions.ZoomAction)1 IActionBars (org.eclipse.ui.IActionBars)1 IViewPart (org.eclipse.ui.IViewPart)1 IViewReference (org.eclipse.ui.IViewReference)1 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)1 ElementListSelectionDialog (org.eclipse.ui.dialogs.ElementListSelectionDialog)1