Java Code Examples for org.eclipse.jface.action.IAction#setText()

The following examples show how to use org.eclipse.jface.action.IAction#setText() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DeploymentActionBarContributor.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * This extracts those actions in the <code>submenuActions</code> collection whose text is qualified and returns
 * a map of these actions, keyed by submenu text.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected Map<String, Collection<IAction>> extractSubmenuActions ( Collection<IAction> createActions )
{
    Map<String, Collection<IAction>> createSubmenuActions = new LinkedHashMap<String, Collection<IAction>> ();
    if ( createActions != null )
    {
        for ( Iterator<IAction> actions = createActions.iterator (); actions.hasNext (); )
        {
            IAction action = actions.next ();
            StringTokenizer st = new StringTokenizer ( action.getText (), "|" ); //$NON-NLS-1$
            if ( st.countTokens () == 2 )
            {
                String text = st.nextToken ().trim ();
                Collection<IAction> submenuActions = createSubmenuActions.get ( text );
                if ( submenuActions == null )
                {
                    createSubmenuActions.put ( text, submenuActions = new ArrayList<IAction> () );
                }
                action.setText ( st.nextToken ().trim () );
                submenuActions.add ( action );
                actions.remove ();
            }
        }
    }
    return createSubmenuActions;
}
 
Example 2
Source File: SyncDependenciesAction.java    From developer-studio with Apache License 2.0 6 votes vote down vote up
public void selectionChanged(IAction arg0, ISelection arg1) {
	if (arg1 instanceof TreeSelection) {
		TreeSelection treeSelection = (TreeSelection) arg1;
		if (treeSelection.getFirstElement() instanceof IProject) {
			IProject project = (IProject) treeSelection.getFirstElement();
			arg0.setEnabled(project.isOpen());
			this.project = project;
			mavenProjectFile = project.getFile("pom.xml");
			if (mavenProjectFile.exists()) {
				arg0.setText("Sync Project Dependencies with pom.xml");
			}
		} else {
			arg0.setEnabled(false);
		}
	}
}
 
Example 3
Source File: UpgradePluginVersionsAction.java    From developer-studio with Apache License 2.0 6 votes vote down vote up
@Override
public void selectionChanged(IAction action, ISelection selection) {
	if (selection instanceof TreeSelection) {
		TreeSelection treeSelection = (TreeSelection) selection;
		if (treeSelection.getFirstElement() instanceof IProject) {
			IProject project = (IProject) treeSelection.getFirstElement();
			action.setEnabled(project.isOpen());
			this.project = project;
			mavenProjectFile = project.getFile("pom.xml");
			if (mavenProjectFile.exists()) {
				action.setText("Upgrade Plugin Versions in pom.xml");
			}
		} else {
			action.setEnabled(false);
		}
	}

}
 
Example 4
Source File: MenuProvider.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
/** Undo, Redo, and Delete */
private void addEditActions(final IMenuManager menu) {
	GEFActionConstants.addStandardActionGroups(menu);
	IAction undoAction = registry.getAction(ActionFactory.UNDO.getId());
	undoAction.setImageDescriptor(Icon.UNDO.descriptor());
	undoAction.setDisabledImageDescriptor(Icon.UNDO_DISABLED.descriptor());
	IAction redoAction = registry.getAction(ActionFactory.REDO.getId());
	redoAction.setImageDescriptor(Icon.REDO.descriptor());
	redoAction.setDisabledImageDescriptor(Icon.REDO_DISABLED.descriptor());
	menu.appendToGroup(GEFActionConstants.GROUP_UNDO, undoAction);
	menu.appendToGroup(GEFActionConstants.GROUP_UNDO, redoAction);
	IAction deleteAction = registry.getAction(ActionFactory.DELETE.getId());
	deleteAction.setText(M.Delete);
	deleteAction.setImageDescriptor(Icon.DELETE.descriptor());
	deleteAction.setDisabledImageDescriptor(Icon.DELETE_DISABLED.descriptor());
	menu.appendToGroup(GEFActionConstants.GROUP_EDIT, deleteAction);
}
 
Example 5
Source File: CriticalPathView.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
@Override
protected void fillLocalToolBar(@Nullable IToolBarManager manager) {
    super.fillLocalToolBar(manager);
    if (manager == null) {
        return;
    }
    IAction followArrowBwdAction = getTimeGraphViewer().getFollowArrowBwdAction();
    followArrowBwdAction.setText(Messages.CriticalPathView_followArrowBwdText);
    followArrowBwdAction.setToolTipText(Messages.CriticalPathView_followArrowBwdText);
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, followArrowBwdAction);

    IAction followArrowFwdAction = getTimeGraphViewer().getFollowArrowFwdAction();
    followArrowFwdAction.setText(Messages.CriticalPathView_followArrowFwdText);
    followArrowFwdAction.setToolTipText(Messages.CriticalPathView_followArrowFwdText);
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, followArrowFwdAction);
}
 
Example 6
Source File: LamiReportView.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
private void populateMenu(IMenuManager menuMgr) {
    menuMgr.add(fNewChartAction);
    menuMgr.add(SEPARATOR);
    menuMgr.add(fClearCustomViewsAction);
    menuMgr.add(SEPARATOR);
    if(fExportTsvAction.isEnabled()) {
        menuMgr.add(fExportTsvAction);
    }
    List<Supplier<@Nullable IImageSave>> suppliers = getSuppliers();
    boolean isSingleton = suppliers.size()==1;
    LamiReportViewTabPage currentSelectedPage = getCurrentSelectedPage();
    if (currentSelectedPage != null) {
        for (int index = 0; index < suppliers.size(); index++) {
            String fileName = isSingleton ? currentSelectedPage.getName() : String.format("%s%02d", currentSelectedPage.getName(), index + 1); //$NON-NLS-1$
            IAction action = SaveImageUtil.createSaveAction(fileName, suppliers.get(index));
            String suffix = isSingleton ? "" : (" " + (index + 1)); //$NON-NLS-1$ //$NON-NLS-2$
            action.setText(Messages.LamiReportView_ActivateTableAction_ExportChart + suffix + '…');
            menuMgr.add(action);
        }
    }
}
 
Example 7
Source File: ItemActionBarContributor.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * This extracts those actions in the <code>submenuActions</code> collection whose text is qualified and returns
 * a map of these actions, keyed by submenu text.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected Map<String, Collection<IAction>> extractSubmenuActions ( Collection<IAction> createActions )
{
    Map<String, Collection<IAction>> createSubmenuActions = new LinkedHashMap<String, Collection<IAction>> ();
    if ( createActions != null )
    {
        for ( Iterator<IAction> actions = createActions.iterator (); actions.hasNext (); )
        {
            IAction action = actions.next ();
            StringTokenizer st = new StringTokenizer ( action.getText (), "|" ); //$NON-NLS-1$
            if ( st.countTokens () == 2 )
            {
                String text = st.nextToken ().trim ();
                Collection<IAction> submenuActions = createSubmenuActions.get ( text );
                if ( submenuActions == null )
                {
                    createSubmenuActions.put ( text, submenuActions = new ArrayList<IAction> () );
                }
                action.setText ( st.nextToken ().trim () );
                submenuActions.add ( action );
                actions.remove ();
            }
        }
    }
    return createSubmenuActions;
}
 
Example 8
Source File: ComponentActionBarContributor.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * This extracts those actions in the <code>submenuActions</code> collection whose text is qualified and returns
 * a map of these actions, keyed by submenu text.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected Map<String, Collection<IAction>> extractSubmenuActions ( Collection<IAction> createActions )
{
    Map<String, Collection<IAction>> createSubmenuActions = new LinkedHashMap<String, Collection<IAction>> ();
    if ( createActions != null )
    {
        for ( Iterator<IAction> actions = createActions.iterator (); actions.hasNext (); )
        {
            IAction action = actions.next ();
            StringTokenizer st = new StringTokenizer ( action.getText (), "|" ); //$NON-NLS-1$
            if ( st.countTokens () == 2 )
            {
                String text = st.nextToken ().trim ();
                Collection<IAction> submenuActions = createSubmenuActions.get ( text );
                if ( submenuActions == null )
                {
                    createSubmenuActions.put ( text, submenuActions = new ArrayList<IAction> () );
                }
                action.setText ( st.nextToken ().trim () );
                submenuActions.add ( action );
                actions.remove ();
            }
        }
    }
    return createSubmenuActions;
}
 
Example 9
Source File: GlobalizeActionBarContributor.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * This extracts those actions in the <code>submenuActions</code> collection whose text is qualified and returns
 * a map of these actions, keyed by submenu text.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected Map<String, Collection<IAction>> extractSubmenuActions ( Collection<IAction> createActions )
{
    Map<String, Collection<IAction>> createSubmenuActions = new LinkedHashMap<String, Collection<IAction>> ();
    if ( createActions != null )
    {
        for ( Iterator<IAction> actions = createActions.iterator (); actions.hasNext (); )
        {
            IAction action = actions.next ();
            StringTokenizer st = new StringTokenizer ( action.getText (), "|" ); //$NON-NLS-1$
            if ( st.countTokens () == 2 )
            {
                String text = st.nextToken ().trim ();
                Collection<IAction> submenuActions = createSubmenuActions.get ( text );
                if ( submenuActions == null )
                {
                    createSubmenuActions.put ( text, submenuActions = new ArrayList<IAction> () );
                }
                action.setText ( st.nextToken ().trim () );
                submenuActions.add ( action );
                actions.remove ();
            }
        }
    }
    return createSubmenuActions;
}
 
Example 10
Source File: InfrastructureActionBarContributor.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * This extracts those actions in the <code>submenuActions</code> collection whose text is qualified and returns
 * a map of these actions, keyed by submenu text.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected Map<String, Collection<IAction>> extractSubmenuActions ( Collection<IAction> createActions )
{
    Map<String, Collection<IAction>> createSubmenuActions = new LinkedHashMap<String, Collection<IAction>> ();
    if ( createActions != null )
    {
        for ( Iterator<IAction> actions = createActions.iterator (); actions.hasNext (); )
        {
            IAction action = actions.next ();
            StringTokenizer st = new StringTokenizer ( action.getText (), "|" ); //$NON-NLS-1$
            if ( st.countTokens () == 2 )
            {
                String text = st.nextToken ().trim ();
                Collection<IAction> submenuActions = createSubmenuActions.get ( text );
                if ( submenuActions == null )
                {
                    createSubmenuActions.put ( text, submenuActions = new ArrayList<IAction> () );
                }
                action.setText ( st.nextToken ().trim () );
                submenuActions.add ( action );
                actions.remove ();
            }
        }
    }
    return createSubmenuActions;
}
 
Example 11
Source File: RecipeActionBarContributor.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * This extracts those actions in the <code>submenuActions</code> collection whose text is qualified and returns
 * a map of these actions, keyed by submenu text.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected Map<String, Collection<IAction>> extractSubmenuActions ( Collection<IAction> createActions )
{
    Map<String, Collection<IAction>> createSubmenuActions = new LinkedHashMap<String, Collection<IAction>> ();
    if ( createActions != null )
    {
        for ( Iterator<IAction> actions = createActions.iterator (); actions.hasNext (); )
        {
            IAction action = actions.next ();
            StringTokenizer st = new StringTokenizer ( action.getText (), "|" ); //$NON-NLS-1$
            if ( st.countTokens () == 2 )
            {
                String text = st.nextToken ().trim ();
                Collection<IAction> submenuActions = createSubmenuActions.get ( text );
                if ( submenuActions == null )
                {
                    createSubmenuActions.put ( text, submenuActions = new ArrayList<IAction> () );
                }
                action.setText ( st.nextToken ().trim () );
                submenuActions.add ( action );
                actions.remove ();
            }
        }
    }
    return createSubmenuActions;
}
 
Example 12
Source File: MemoryActionBarContributor.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * This extracts those actions in the <code>submenuActions</code> collection whose text is qualified and returns
 * a map of these actions, keyed by submenu text.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected Map<String, Collection<IAction>> extractSubmenuActions ( Collection<IAction> createActions )
{
    Map<String, Collection<IAction>> createSubmenuActions = new LinkedHashMap<String, Collection<IAction>> ();
    if ( createActions != null )
    {
        for ( Iterator<IAction> actions = createActions.iterator (); actions.hasNext (); )
        {
            IAction action = actions.next ();
            StringTokenizer st = new StringTokenizer ( action.getText (), "|" );
            if ( st.countTokens () == 2 )
            {
                String text = st.nextToken ().trim ();
                Collection<IAction> submenuActions = createSubmenuActions.get ( text );
                if ( submenuActions == null )
                {
                    createSubmenuActions.put ( text, submenuActions = new ArrayList<IAction> () );
                }
                action.setText ( st.nextToken ().trim () );
                submenuActions.add ( action );
                actions.remove ();
            }
        }
    }
    return createSubmenuActions;
}
 
Example 13
Source File: WorldActionBarContributor.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * This extracts those actions in the <code>submenuActions</code> collection whose text is qualified and returns
 * a map of these actions, keyed by submenu text.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected Map<String, Collection<IAction>> extractSubmenuActions ( Collection<IAction> createActions )
{
    Map<String, Collection<IAction>> createSubmenuActions = new LinkedHashMap<String, Collection<IAction>> ();
    if ( createActions != null )
    {
        for ( Iterator<IAction> actions = createActions.iterator (); actions.hasNext (); )
        {
            IAction action = actions.next ();
            StringTokenizer st = new StringTokenizer ( action.getText (), "|" ); //$NON-NLS-1$
            if ( st.countTokens () == 2 )
            {
                String text = st.nextToken ().trim ();
                Collection<IAction> submenuActions = createSubmenuActions.get ( text );
                if ( submenuActions == null )
                {
                    createSubmenuActions.put ( text, submenuActions = new ArrayList<IAction> () );
                }
                action.setText ( st.nextToken ().trim () );
                submenuActions.add ( action );
                actions.remove ();
            }
        }
    }
    return createSubmenuActions;
}
 
Example 14
Source File: OsgiActionBarContributor.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * This extracts those actions in the <code>submenuActions</code> collection whose text is qualified and returns
 * a map of these actions, keyed by submenu text.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected Map<String, Collection<IAction>> extractSubmenuActions ( Collection<IAction> createActions )
{
    Map<String, Collection<IAction>> createSubmenuActions = new LinkedHashMap<String, Collection<IAction>> ();
    if ( createActions != null )
    {
        for ( Iterator<IAction> actions = createActions.iterator (); actions.hasNext (); )
        {
            IAction action = actions.next ();
            StringTokenizer st = new StringTokenizer ( action.getText (), "|" ); //$NON-NLS-1$
            if ( st.countTokens () == 2 )
            {
                String text = st.nextToken ().trim ();
                Collection<IAction> submenuActions = createSubmenuActions.get ( text );
                if ( submenuActions == null )
                {
                    createSubmenuActions.put ( text, submenuActions = new ArrayList<IAction> () );
                }
                action.setText ( st.nextToken ().trim () );
                submenuActions.add ( action );
                actions.remove ();
            }
        }
    }
    return createSubmenuActions;
}
 
Example 15
Source File: ProfileActionBarContributor.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * This extracts those actions in the <code>submenuActions</code> collection whose text is qualified and returns
 * a map of these actions, keyed by submenu text.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected Map<String, Collection<IAction>> extractSubmenuActions ( Collection<IAction> createActions )
{
    Map<String, Collection<IAction>> createSubmenuActions = new LinkedHashMap<String, Collection<IAction>> ();
    if ( createActions != null )
    {
        for ( Iterator<IAction> actions = createActions.iterator (); actions.hasNext (); )
        {
            IAction action = actions.next ();
            StringTokenizer st = new StringTokenizer ( action.getText (), "|" ); //$NON-NLS-1$
            if ( st.countTokens () == 2 )
            {
                String text = st.nextToken ().trim ();
                Collection<IAction> submenuActions = createSubmenuActions.get ( text );
                if ( submenuActions == null )
                {
                    createSubmenuActions.put ( text, submenuActions = new ArrayList<IAction> () );
                }
                action.setText ( st.nextToken ().trim () );
                submenuActions.add ( action );
                actions.remove ();
            }
        }
    }
    return createSubmenuActions;
}
 
Example 16
Source File: SetupActionBarContributor.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * This extracts those actions in the <code>submenuActions</code> collection whose text is qualified and returns
 * a map of these actions, keyed by submenu text.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected Map<String, Collection<IAction>> extractSubmenuActions ( Collection<IAction> createActions )
{
    Map<String, Collection<IAction>> createSubmenuActions = new LinkedHashMap<String, Collection<IAction>> ();
    if ( createActions != null )
    {
        for ( Iterator<IAction> actions = createActions.iterator (); actions.hasNext (); )
        {
            IAction action = actions.next ();
            StringTokenizer st = new StringTokenizer ( action.getText (), "|" ); //$NON-NLS-1$
            if ( st.countTokens () == 2 )
            {
                String text = st.nextToken ().trim ();
                Collection<IAction> submenuActions = createSubmenuActions.get ( text );
                if ( submenuActions == null )
                {
                    createSubmenuActions.put ( text, submenuActions = new ArrayList<IAction> () );
                }
                action.setText ( st.nextToken ().trim () );
                submenuActions.add ( action );
                actions.remove ();
            }
        }
    }
    return createSubmenuActions;
}
 
Example 17
Source File: DetailViewActionBarContributor.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * This extracts those actions in the <code>submenuActions</code> collection whose text is qualified and returns
 * a map of these actions, keyed by submenu text.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected Map<String, Collection<IAction>> extractSubmenuActions ( Collection<IAction> createActions )
{
    Map<String, Collection<IAction>> createSubmenuActions = new LinkedHashMap<String, Collection<IAction>> ();
    if ( createActions != null )
    {
        for ( Iterator<IAction> actions = createActions.iterator (); actions.hasNext (); )
        {
            IAction action = actions.next ();
            StringTokenizer st = new StringTokenizer ( action.getText (), "|" ); //$NON-NLS-1$
            if ( st.countTokens () == 2 )
            {
                String text = st.nextToken ().trim ();
                Collection<IAction> submenuActions = createSubmenuActions.get ( text );
                if ( submenuActions == null )
                {
                    createSubmenuActions.put ( text, submenuActions = new ArrayList<IAction> () );
                }
                action.setText ( st.nextToken ().trim () );
                submenuActions.add ( action );
                actions.remove ();
            }
        }
    }
    return createSubmenuActions;
}
 
Example 18
Source File: JSIndexViewActionProvider.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * @param view
 * @param typeNames
 * @return
 */
protected IAction createAction(final IndexView view, final List<String> typeNames)
{
	IAction action = new Action()
	{
		@Override
		public void run()
		{
			TreeViewer treeViewer = view.getTreeViewer();

			if (treeViewer != null)
			{
				Object input = treeViewer.getInput();

				if (input instanceof IProject)
				{
					IProject project = (IProject) input;

					JSIndexQueryHelper queryHelper = new JSIndexQueryHelper(project);
					Collection<TypeElement> types = queryHelper.getTypes(typeNames.get(0), true);
					List<ClassElement> classes = JSTypeUtil.typesToClasses(types);

					if (!CollectionsUtil.isEmpty(classes))
					{
						ClassElement c = classes.get(0);

						treeViewer.setSelection(new StructuredSelection(c), true);
					}
				}
			}
		}
	};

	action.setText(Messages.JSIndexViewActionProvider_JumpToType);

	return action;
}
 
Example 19
Source File: ControlFlowView.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
@Override
protected void fillLocalToolBar(IToolBarManager manager) {
    // add "Optimization" Button to local tool bar of Controlflow
    IAction optimizationAction = getOptimizationAction();
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, optimizationAction);

    // add a separator to local tool bar
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, new Separator());

    super.fillLocalToolBar(manager);
    IDialogSettings settings = Activator.getDefault().getDialogSettings();
    IDialogSettings section = settings.getSection(getClass().getName());
    if (section == null) {
        section = settings.addNewSection(getClass().getName());
    }

    IAction hideArrowsAction = getTimeGraphViewer().getHideArrowsAction(section);
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, hideArrowsAction);

    IAction followArrowBwdAction = getTimeGraphViewer().getFollowArrowBwdAction();
    followArrowBwdAction.setText(Messages.ControlFlowView_followCPUBwdText);
    followArrowBwdAction.setToolTipText(Messages.ControlFlowView_followCPUBwdText);
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, followArrowBwdAction);

    IAction followArrowFwdAction = getTimeGraphViewer().getFollowArrowFwdAction();
    followArrowFwdAction.setText(Messages.ControlFlowView_followCPUFwdText);
    followArrowFwdAction.setToolTipText(Messages.ControlFlowView_followCPUFwdText);
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, followArrowFwdAction);

    IAction previousEventAction = new SearchEventAction(false, PackageMessages.ControlFlowView_PreviousEventJobName);
    previousEventAction.setText(PackageMessages.ControlFlowView_PreviousEventActionName);
    previousEventAction.setToolTipText(PackageMessages.ControlFlowView_PreviousEventActionTooltip);
    previousEventAction.setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(PREV_EVENT_ICON_PATH));
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, previousEventAction);

    IAction nextEventAction = new SearchEventAction(true, PackageMessages.ControlFlowView_NextEventJobName);
    nextEventAction.setText(PackageMessages.ControlFlowView_NextEventActionName);
    nextEventAction.setToolTipText(PackageMessages.ControlFlowView_NextEventActionTooltip);
    nextEventAction.setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(NEXT_EVENT_ICON_PATH));
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, nextEventAction);
}
 
Example 20
Source File: LaborView.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void createPartControl(final Composite parent){
	setTitleImage(Images.IMG_VIEW_LABORATORY.getImage());
	
	tabFolder = new CTabFolder(parent, SWT.TOP);
	tabFolder.setLayout(new FillLayout());
	
	final CTabItem resultsTabItem = new CTabItem(tabFolder, SWT.NULL);
	resultsTabItem.setText("Resultate");
	resultsComposite = new LaborResultsComposite(tabFolder, SWT.NONE);
	resultsTabItem.setControl(resultsComposite);
	
	final CTabItem ordersTabItem = new CTabItem(tabFolder, SWT.NULL);
	ordersTabItem.setText("Verordnungen");
	ordersComposite = new LaborOrdersComposite(tabFolder, SWT.NONE);
	ordersTabItem.setControl(ordersComposite);
	
	tabFolder.setSelection(0);
	tabFolder.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e){
			resultsComposite.reload();
			ordersComposite.reload();
		}
	});
	makeActions();
	menu = new ViewMenus(getViewSite());
	menu.createMenu(newAction, backAction, fwdAction, printAction, importAction, xmlAction);
	// Orders
	final LaborOrderPulldownMenuCreator menuCreator =
		new LaborOrderPulldownMenuCreator(parent.getShell());
	if (menuCreator.getSelected() != null) {
		IAction dropDownAction = menuCreator.getAction();
		
		IActionBars actionBars = getViewSite().getActionBars();
		IToolBarManager toolbar = actionBars.getToolBarManager();
		
		toolbar.add(dropDownAction);
		
		// Set data
		dropDownAction.setText(menuCreator.getSelected().getText());
		dropDownAction.setToolTipText(menuCreator.getSelected().getToolTipText());
		dropDownAction.setImageDescriptor(menuCreator.getSelected().getImageDescriptor());
	}
	// Importers
	IToolBarManager tm = getViewSite().getActionBars().getToolBarManager();
	List<IAction> importers =
		Extensions.getClasses(
			Extensions.getExtensions(ExtensionPointConstantsUi.LABORDATENIMPORT),
			"ToolbarAction", //$NON-NLS-1$ //$NON-NLS-2$
			false);
	for (IAction ac : importers) {
		tm.add(ac);
	}
	if (importers.size() > 0) {
		tm.add(new Separator());
	}
	tm.add(refreshAction);
	tm.add(newColumnAction);
	tm.add(newAction);
	tm.add(backAction);
	tm.add(fwdAction);
	tm.add(expandAllAction);
	tm.add(collapseAllAction);
	tm.add(printAction);
	
	// register event listeners
	ElexisEventDispatcher.getInstance().addListeners(eeli_labitem, eeli_laborder,
		eeli_labresult, eeli_pat);
	Patient act = (Patient) ElexisEventDispatcher.getSelected(Patient.class);
	if ((act != null && act != resultsComposite.getPatient())) {
		resultsComposite.selectPatient(act);
	}
	getSite().getPage().addPartListener(udpateOnVisible);
}