Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 6e6eddd63b32235c61b62bf7ecebd90a95dcade1 (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
/*******************************************************************************
 * Copyright (c) 2014 vogella GmbH
 * 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:
 *     Gaetano Santoro - initial implementation
 *     Matthias Mailänder - rebase onto Mars
 *     Lars Vogel <Lars.Vogel@gmail.com> - Bug 287303
 *******************************************************************************/

package org.eclipse.ui.internal.console;

import org.eclipse.jface.action.Action;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.console.IConsoleView;

/**
 * Activates line breaks in the Console view so that the full log statement is
 * always visible
 */
public class WordWrapAction extends Action {

	private IConsoleView fConsoleView = null;

	public WordWrapAction(IConsoleView consoleView) {
		super(ConsoleMessages.WordWrapAction_0);
		fConsoleView = consoleView;

		setToolTipText(ConsoleMessages.WordWrapAction_1);
		setHoverImageDescriptor(ConsolePluginImages.getImageDescriptor(IInternalConsoleConstants.IMG_LCL_WRAP));
		setDisabledImageDescriptor(ConsolePluginImages.getImageDescriptor(IInternalConsoleConstants.IMG_DLCL_WRAP));
		setImageDescriptor(ConsolePluginImages.getImageDescriptor(IInternalConsoleConstants.IMG_ELCL_WRAP));
		PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IConsoleHelpContextIds.CONSOLE_WORD_WRAP_ACTION);

		boolean checked = fConsoleView.getWordWrap();
		setChecked(checked);
	}

	@Override
	public void run() {
		fConsoleView.setWordWrap(isChecked());
	}

	public void dispose() {
		fConsoleView = null;
	}
}

Back to the top