Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 986bef24fe5186a0289fe6364f62139b8061c723 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*******************************************************************************
 * Copyright (c) 2011 Wind River Systems, Inc. and others. 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:
 * Wind River Systems - initial API and implementation
 *******************************************************************************/
package org.eclipse.tcf.te.tcf.ui.console;

import org.eclipse.core.runtime.PlatformObject;
import org.eclipse.tcf.te.tcf.ui.console.nls.Messages;
import org.eclipse.ui.console.IConsole;
import org.eclipse.ui.console.IConsoleConstants;
import org.eclipse.ui.console.IConsolePageParticipant;
import org.eclipse.ui.menus.CommandContributionItem;
import org.eclipse.ui.menus.CommandContributionItemParameter;
import org.eclipse.ui.part.IPageBookViewPage;

/**
 * Console page participant implementation.
 */
public class PageParticipant extends PlatformObject implements IConsolePageParticipant {

	/* (non-Javadoc)
	 * @see org.eclipse.ui.console.IConsolePageParticipant#activated()
	 */
	@Override
    public void activated() {
	}

	/* (non-Javadoc)
	 * @see org.eclipse.ui.console.IConsolePageParticipant#deactivated()
	 */
	@Override
    public void deactivated() {
	}

	/* (non-Javadoc)
	 * @see org.eclipse.ui.console.IConsolePageParticipant#dispose()
	 */
	@Override
    public void dispose() {
	}

	/* (non-Javadoc)
	 * @see org.eclipse.ui.console.IConsolePageParticipant#init(org.eclipse.ui.part.IPageBookViewPage, org.eclipse.ui.console.IConsole)
	 */
	@Override
    public void init(IPageBookViewPage page, IConsole console) {
		if (page == null || page.getSite() == null || page.getSite().getActionBars() == null || page.getSite().getActionBars().getToolBarManager() == null) return;

		// Create the command contribution item parameters
		CommandContributionItemParameter parameters;
		parameters = new CommandContributionItemParameter(page.getSite(),
		                                                  "org.eclipse.tcf.te.tcf.ui.console.commands.remove", //$NON-NLS-1$
		                                                  "org.eclipse.tcf.te.tcf.ui.console.command.remove", //$NON-NLS-1$
														  CommandContributionItem.STYLE_PUSH);
		parameters.label = Messages.PageParticipant_command_remove_label;
		parameters.tooltip = Messages.PageParticipant_command_remove_label;

		// Create the contribution item and append to the LAUNCH_GROUP
		page.getSite().getActionBars().getToolBarManager().appendToGroup(IConsoleConstants.LAUNCH_GROUP, new CommandContributionItem(parameters));
	}
}

Back to the top