1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 568926 - Build Console has no action to disable activation on output

This change adds an action to the CDT build console, to disable
activation on build output. The action uses the existing preference
"build console on top when building" from C/C++ -> Build -> Console.

The action icon is copied from platform debug UI, see:

org.eclipse.debug.internal.ui.IInternalDebugUIConstants.IMG_ELCL_STANDARD_OUT
org.eclipse.debug.ui/icons/full/elcl16/writeout_co.png (and @2x)

The change also ensures the existing preference works, as it currently
has no effect on not showing the build console on CDT build.

Change-Id: I0d94583b85e1a13f18d43de8c10355ccdab7f259
Signed-off-by: Simeon Andreev <simeon.danailov.andreev@gmail.com>
This commit is contained in:
Simeon Andreev 2020-11-19 12:56:37 +01:00 committed by Jonah Graham
parent 7881736c68
commit a655f7b4a5
10 changed files with 62 additions and 4 deletions

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.ui; singleton:=true
Bundle-Version: 7.0.100.qualifier
Bundle-Version: 7.1.0.qualifier
Bundle-Activator: org.eclipse.cdt.ui.CUIPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin

Binary file not shown.

After

Width:  |  Height:  |  Size: 347 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 735 B

View file

@ -0,0 +1,48 @@
/*******************************************************************************
* Copyright (c) 2020, Simeon Andreev and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Simeon Andreev - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.ui.buildconsole;
import org.eclipse.cdt.internal.ui.preferences.BuildConsolePreferencePage;
import org.eclipse.cdt.ui.CDTSharedImages;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.preference.IPreferenceStore;
/**
* Set whether to show the build console on activity.
*/
public class BringToTopOnBuild extends Action {
public BringToTopOnBuild() {
super(ConsoleMessages.BringToTopOnBuild);
propertyChange();
setToolTipText(ConsoleMessages.BringToTopOnBuild);
setImageDescriptor(CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_OBJS_BRING_CONSOLE_TO_TOP_ON_BUILD));
}
@Override
public void run() {
super.run();
boolean isSet = isChecked();
IPreferenceStore store = CUIPlugin.getDefault().getPreferenceStore();
store.setValue(BuildConsolePreferencePage.PREF_CONSOLE_ON_TOP, isSet);
}
public void propertyChange() {
boolean isChecked = BuildConsolePreferencePage.isConsoleOnTop();
setChecked(isChecked);
}
}

View file

@ -158,13 +158,14 @@ public class BuildConsoleManager implements IBuildConsoleManager, IResourceChang
// console
page.activate(activePart);
}
if (bringToTop && shouldBringToTop(consoleView)) {
boolean shouldBringToTop = shouldBringToTop(consoleView);
if (bringToTop && shouldBringToTop) {
page.bringToTop(consoleView);
}
if (consoleView instanceof IConsoleView) {
if (BuildConsole.getCurrentPage() == null)
((IConsoleView) consoleView).display(fConsole);
else
else if (shouldBringToTop)
((IConsoleView) consoleView).display(BuildConsole.getCurrentPage().getConsole());
}
}

View file

@ -123,6 +123,7 @@ public class BuildConsolePage extends Page
private PreviousErrorAction fPreviousErrorAction;
private ShowErrorAction fShowErrorAction;
private WrapLinesAction fWrapAction;
private BringToTopOnBuild fBringToTopOnBuild;
/**
* @param view
@ -261,6 +262,8 @@ public class BuildConsolePage extends Page
|| property.equals(BuildConsolePreferencePage.PREF_BUILDCONSOLE_LINES)
|| property.equals(BuildConsolePreferencePage.PREF_BUILDCONSOLE_WRAP_LINES_MAX)) {
fWrapAction.propertyChange();
} else if (property.equals(BuildConsolePreferencePage.PREF_CONSOLE_ON_TOP)) {
fBringToTopOnBuild.propertyChange();
}
}
@ -272,6 +275,7 @@ public class BuildConsolePage extends Page
fNextErrorAction = new NextErrorAction(this);
fPreviousErrorAction = new PreviousErrorAction(this);
fShowErrorAction = new ShowErrorAction(this);
fBringToTopOnBuild = new BringToTopOnBuild();
fSaveLogAction = new CopyBuildLogAction(this);
getViewer().setAutoScroll(!fIsLocked);
@ -332,6 +336,7 @@ public class BuildConsolePage extends Page
mgr.appendToGroup(IConsoleConstants.OUTPUT_GROUP, fScrollLockAction);
mgr.appendToGroup(IConsoleConstants.OUTPUT_GROUP, fWrapAction);
mgr.appendToGroup(IConsoleConstants.OUTPUT_GROUP, fClearOutputAction);
mgr.appendToGroup(IConsoleConstants.OUTPUT_GROUP, fBringToTopOnBuild);
}
protected BuildConsoleViewer getViewer() {

View file

@ -49,6 +49,7 @@ public final class ConsoleMessages extends NLS {
public static String CopyLog_UnableToAccess;
public static String CopyLog_UnavailableLog;
public static String WrapLinesAction_WrapLines;
public static String BringToTopOnBuild;
static {
NLS.initializeMessages(BUNDLE_NAME, ConsoleMessages.class);

View file

@ -42,3 +42,4 @@ NextErrorAction_Tooltip=Next Error
PreviousErrorAction_Tooltip=Previous Error\u0020
ShowErrorAction_Tooltip=Show Error In Editor
WrapLinesAction_WrapLines=Wrap Lines
BringToTopOnBuild=Bring console to top when building

View file

@ -35,7 +35,7 @@ import org.eclipse.ui.PlatformUI;
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$
public 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$
/**

View file

@ -120,6 +120,8 @@ public class CDTSharedImages {
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$
/** @since 7.1 */
public static final String IMG_OBJS_BRING_CONSOLE_TO_TOP_ON_BUILD = "icons/elcl16/bring_console_to_top_on_build.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$