mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-01 06:05:24 +02:00
bug 199605: have line wrap option on the build console
This commit is contained in:
parent
e6ae67c516
commit
90ec4a7886
9 changed files with 83 additions and 7 deletions
BIN
core/org.eclipse.cdt.ui/icons/elcl16/wrap_lines.png
Normal file
BIN
core/org.eclipse.cdt.ui/icons/elcl16/wrap_lines.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 876 B |
|
@ -20,6 +20,7 @@ CView.make_edit_action =Project properties
|
|||
ConsolePreferencePage.clearConsole.label=Always clear console before building
|
||||
ConsolePreferencePage.autoOpenConsole.label=Open console when building
|
||||
ConsolePreferencePage.consoleOnTop.label=Bring console to top when building (if present)
|
||||
ConsolePreferencePage.consoleWrapLines.label=Wrap lines on the console
|
||||
ConsolePreferencePage.consoleLines.label=Limit console output (number of lines):
|
||||
ConsolePreferencePage.consoleLines.errorMessage=Value must be an integer between 10 and 2147483647
|
||||
ConsolePreferencePage.tabWidth.label=Display tab width:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2002, 2011 QNX Software Systems and others.
|
||||
* Copyright (c) 2002, 2013 QNX Software Systems 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
|
||||
|
@ -133,6 +133,7 @@ public class BuildConsolePage extends Page
|
|||
private NextErrorAction fNextErrorAction;
|
||||
private PreviousErrorAction fPreviousErrorAction;
|
||||
private ShowErrorAction fShowErrorAction;
|
||||
private WrapLinesAction fWrapAction;
|
||||
|
||||
/**
|
||||
* @param view
|
||||
|
@ -296,6 +297,8 @@ public class BuildConsolePage extends Page
|
|||
setTabs(CUIPlugin.getDefault().getPreferenceStore().getInt(BuildConsolePreferencePage.PREF_BUILDCONSOLE_TAB_WIDTH));
|
||||
} else if (IConsoleConstants.P_BACKGROUND_COLOR.equals(property)) {
|
||||
fViewer.getTextWidget().setBackground(fConsole.getBackground());
|
||||
} else if (property.equals(BuildConsolePreferencePage.PREF_BUILDCONSOLE_WRAP_LINES)) {
|
||||
fWrapAction.setChecked(BuildConsolePreferencePage.isConsoleWrapLines());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -303,6 +306,7 @@ public class BuildConsolePage extends Page
|
|||
fClearOutputAction = new ClearOutputAction(getViewer());
|
||||
fScrollLockAction = new ScrollLockAction(getViewer());
|
||||
fScrollLockAction.setChecked(fIsLocked);
|
||||
fWrapAction = new WrapLinesAction(getViewer());
|
||||
fNextErrorAction = new NextErrorAction(this);
|
||||
fPreviousErrorAction = new PreviousErrorAction(this);
|
||||
fShowErrorAction = new ShowErrorAction(this);
|
||||
|
@ -363,6 +367,7 @@ public class BuildConsolePage extends Page
|
|||
mgr.appendToGroup(BuildConsole.ERROR_GROUP, fShowErrorAction);
|
||||
mgr.appendToGroup(IConsoleConstants.OUTPUT_GROUP, fSaveLogAction);
|
||||
mgr.appendToGroup(IConsoleConstants.OUTPUT_GROUP, fScrollLockAction);
|
||||
mgr.appendToGroup(IConsoleConstants.OUTPUT_GROUP, fWrapAction);
|
||||
mgr.appendToGroup(IConsoleConstants.OUTPUT_GROUP, fClearOutputAction);
|
||||
}
|
||||
|
||||
|
|
|
@ -92,7 +92,6 @@ public class BuildConsoleViewer extends TextViewer
|
|||
styledText.setFont(parent.getFont());
|
||||
styledText.setDoubleClickEnabled(true);
|
||||
styledText.setEditable(false);
|
||||
styledText.setWordWrap(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ public final class ConsoleMessages extends NLS {
|
|||
public static String CopyLog_LogFileIsNotAvailable;
|
||||
public static String CopyLog_UnableToAccess;
|
||||
public static String CopyLog_UnavailableLog;
|
||||
public static String WrapLinesAction_WrapLines;
|
||||
|
||||
static {
|
||||
NLS.initializeMessages(BUNDLE_NAME, ConsoleMessages.class);
|
||||
|
|
|
@ -38,3 +38,4 @@ ScrollLockAction_Scroll_Lock_1=Scroll Lock
|
|||
NextErrorAction_Tooltip=Next Error
|
||||
PreviousErrorAction_Tooltip=Previous Error
|
||||
ShowErrorAction_Tooltip=Show Error In Editor
|
||||
WrapLinesAction_WrapLines=Wrap Lines
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2013, 2013 Andrew Gvozdev 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:
|
||||
* Andrew Gvozdev - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.ui.buildconsole;
|
||||
|
||||
import org.eclipse.jface.action.Action;
|
||||
import org.eclipse.swt.custom.StyledText;
|
||||
|
||||
import org.eclipse.cdt.ui.CDTSharedImages;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.preferences.BuildConsolePreferencePage;
|
||||
|
||||
/**
|
||||
* Toggles word wrapping of the console
|
||||
*/
|
||||
public class WrapLinesAction extends Action {
|
||||
private BuildConsoleViewer fConsoleViewer;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param viewer - console viewer.
|
||||
*/
|
||||
public WrapLinesAction(BuildConsoleViewer viewer) {
|
||||
super(ConsoleMessages.WrapLinesAction_WrapLines);
|
||||
fConsoleViewer = viewer;
|
||||
setChecked(BuildConsolePreferencePage.isConsoleWrapLines());
|
||||
|
||||
setToolTipText(ConsoleMessages.WrapLinesAction_WrapLines);
|
||||
setImageDescriptor(CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_OBJS_WRAP_LINE));
|
||||
}
|
||||
|
||||
private void setWordWrap(boolean wrap) {
|
||||
StyledText styledText = fConsoleViewer.getTextWidget();
|
||||
if (styledText != null) {
|
||||
styledText.setWordWrap(wrap);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
setWordWrap(isChecked());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setChecked(boolean checked) {
|
||||
super.setChecked(checked);
|
||||
setWordWrap(checked);
|
||||
}
|
||||
}
|
|
@ -11,10 +11,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.ui.preferences;
|
||||
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.ICHelpContextIds;
|
||||
|
||||
import org.eclipse.jface.preference.BooleanFieldEditor;
|
||||
import org.eclipse.jface.preference.ColorFieldEditor;
|
||||
import org.eclipse.jface.preference.FieldEditorPreferencePage;
|
||||
|
@ -30,11 +26,16 @@ import org.eclipse.ui.IWorkbench;
|
|||
import org.eclipse.ui.IWorkbenchPreferencePage;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.ICHelpContextIds;
|
||||
|
||||
public class BuildConsolePreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
|
||||
|
||||
private static final String PREF_CLEAR_CONSOLE = "clearConsole"; //$NON-NLS-1$
|
||||
private static final String PREF_CONSOLE_ON_TOP = "consoleOnTop"; //$NON-NLS-1$
|
||||
private static final String PREF_AUTO_OPEN_CONSOLE = "autoOpenConsole"; //$NON-NLS-1$
|
||||
public static final String PREF_BUILDCONSOLE_WRAP_LINES = "buildConsoleWrapLines"; //$NON-NLS-1$
|
||||
|
||||
// In font registry
|
||||
public static final String PREF_BUILDCONSOLE_FONT = "org.eclipse.cdt.ui.buildconsole.ConsoleFont"; //$NON-NLS-1$
|
||||
|
@ -74,6 +75,9 @@ public class BuildConsolePreferencePage extends FieldEditorPreferencePage implem
|
|||
BooleanFieldEditor consoleOnTop = new BooleanFieldEditor(PREF_CONSOLE_ON_TOP,
|
||||
CUIPlugin.getResourceString("ConsolePreferencePage.consoleOnTop.label"), parent); //$NON-NLS-1$
|
||||
addField(consoleOnTop);
|
||||
BooleanFieldEditor consoleWrapLines = new BooleanFieldEditor(PREF_BUILDCONSOLE_WRAP_LINES,
|
||||
CUIPlugin.getResourceString("ConsolePreferencePage.consoleWrapLines.label"), parent); //$NON-NLS-1$
|
||||
addField(consoleWrapLines);
|
||||
|
||||
IntegerFieldEditor buildCount = new IntegerFieldEditor(PREF_BUILDCONSOLE_LINES,
|
||||
CUIPlugin.getResourceString("ConsolePreferencePage.consoleLines.label"), parent); //$NON-NLS-1$
|
||||
|
@ -133,6 +137,7 @@ public class BuildConsolePreferencePage extends FieldEditorPreferencePage implem
|
|||
public static boolean isClearBuildConsole() {
|
||||
return CUIPlugin.getDefault().getPreferenceStore().getBoolean(PREF_CLEAR_CONSOLE);
|
||||
}
|
||||
|
||||
public static boolean isAutoOpenConsole() {
|
||||
return CUIPlugin.getDefault().getPreferenceStore().getBoolean(PREF_AUTO_OPEN_CONSOLE);
|
||||
}
|
||||
|
@ -141,6 +146,10 @@ public class BuildConsolePreferencePage extends FieldEditorPreferencePage implem
|
|||
return CUIPlugin.getDefault().getPreferenceStore().getBoolean(PREF_CONSOLE_ON_TOP);
|
||||
}
|
||||
|
||||
public static boolean isConsoleWrapLines() {
|
||||
return CUIPlugin.getDefault().getPreferenceStore().getBoolean(PREF_BUILDCONSOLE_WRAP_LINES);
|
||||
}
|
||||
|
||||
public static int buildConsoleLines() {
|
||||
return CUIPlugin.getDefault().getPreferenceStore().getInt(PREF_BUILDCONSOLE_LINES);
|
||||
}
|
||||
|
@ -153,6 +162,7 @@ public class BuildConsolePreferencePage extends FieldEditorPreferencePage implem
|
|||
prefs.setDefault(PREF_CLEAR_CONSOLE, true);
|
||||
prefs.setDefault(PREF_AUTO_OPEN_CONSOLE, true);
|
||||
prefs.setDefault(PREF_CONSOLE_ON_TOP, false);
|
||||
prefs.setDefault(PREF_BUILDCONSOLE_WRAP_LINES, true);
|
||||
prefs.setDefault(PREF_BUILDCONSOLE_LINES, 500);
|
||||
prefs.setDefault(PREF_BUILDCONSOLE_TAB_WIDTH, 4);
|
||||
PreferenceConverter.setDefault(prefs, PREF_BUILDCONSOLE_OUTPUT_COLOR, new RGB(0, 0, 0));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2010 Andrew Gvozdev and others.
|
||||
* Copyright (c) 2010, 2013 Andrew Gvozdev 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
|
||||
|
@ -128,6 +128,8 @@ public class CDTSharedImages {
|
|||
public static final String IMG_OBJS_INCCONT = "icons/obj16/incc_obj.gif"; //$NON-NLS-1$
|
||||
public static final String IMG_OBJS_EXTENSION = "icons/obj16/extension_obj.gif"; //$NON-NLS-1$
|
||||
public static final String IMG_OBJS_USER = "icons/obj16/person-me.gif"; //$NON-NLS-1$
|
||||
/** @since 5.6 */
|
||||
public static final String IMG_OBJS_WRAP_LINE = "icons/elcl16/wrap_lines.png"; //$NON-NLS-1$
|
||||
public static final String IMG_OBJS_CDT_TESTING = "icons/obj16/flask.png"; //$NON-NLS-1$
|
||||
|
||||
public static final String IMG_OBJS_NLS_NEVER_TRANSLATE = "icons/obj16/never_translate.gif"; //$NON-NLS-1$
|
||||
|
|
Loading…
Add table
Reference in a new issue