mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
Bug 570775: Add pop-up action to invert terminal colors on the fly
New action to temporarily invert the terminal colors, the preference setting is not altered by this action. Only the active terminal is affected. Change-Id: Idc01163838539c2ba5699556951c1742bbf07ad6 Signed-off-by: Fabrizio Iannetti <fabrizio.iannetti@gmail.com>
This commit is contained in:
parent
50f2172fba
commit
3b680c8d8e
13 changed files with 104 additions and 9 deletions
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
|||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %pluginName
|
||||
Bundle-SymbolicName: org.eclipse.tm.terminal.control; singleton:=true
|
||||
Bundle-Version: 5.0.100.qualifier
|
||||
Bundle-Version: 5.1.0.qualifier
|
||||
Bundle-Activator: org.eclipse.tm.internal.terminal.control.impl.TerminalPlugin
|
||||
Bundle-Vendor: %providerName
|
||||
Bundle-Localization: plugin
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2018 Wind River Systems, Inc. and others.
|
||||
* Copyright (c) 2006, 2021 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 2.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -70,6 +70,11 @@ public interface ITerminalViewControl {
|
|||
|
||||
void setInvertedColors(boolean invert);
|
||||
|
||||
/**
|
||||
* @since 5.1
|
||||
*/
|
||||
boolean isInvertedColors();
|
||||
|
||||
Font getFont();
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2003, 2018 Wind River Systems, Inc. and others.
|
||||
* Copyright (c) 2003, 2021 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 2.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -1365,6 +1365,11 @@ public class VT100TerminalControl implements ITerminalControlForText, ITerminalC
|
|||
fCtlText.setInvertedColors(invert);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInvertedColors() {
|
||||
return fCtlText.isInvertedColors();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setConnectOnEnterIfClosed(boolean on) {
|
||||
connectOnEnterIfClosed = on;
|
||||
|
|
|
@ -50,6 +50,8 @@ public interface ILinelRenderer {
|
|||
|
||||
void setInvertedColors(boolean invert);
|
||||
|
||||
boolean isInvertedColors();
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #getDefaultBackgroundColor(Device)}
|
||||
*/
|
||||
|
|
|
@ -136,6 +136,10 @@ public class StyleMap {
|
|||
fInvertColors = invert;
|
||||
}
|
||||
|
||||
public boolean isInvertedColors() {
|
||||
return fInvertColors;
|
||||
}
|
||||
|
||||
public Font getFont(TerminalStyle style) {
|
||||
style = defaultIfNull(style);
|
||||
if (style.isBold()) {
|
||||
|
|
|
@ -510,6 +510,10 @@ public class TextCanvas extends GridCanvas {
|
|||
redraw();
|
||||
}
|
||||
|
||||
public boolean isInvertedColors() {
|
||||
return fCellRenderer.isInvertedColors();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if the cursor is enabled (blinking). By default the cursor is not enabled.
|
||||
*/
|
||||
|
|
|
@ -208,4 +208,9 @@ public class TextLineRenderer implements ILinelRenderer {
|
|||
fStyleMap.setInvertedColors(invert);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInvertedColors() {
|
||||
return fStyleMap.isInvertedColors();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
|||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %pluginName
|
||||
Bundle-SymbolicName: org.eclipse.tm.terminal.view.ui;singleton:=true
|
||||
Bundle-Version: 4.7.100.qualifier
|
||||
Bundle-Version: 4.8.0.qualifier
|
||||
Bundle-Activator: org.eclipse.tm.terminal.view.ui.activator.UIPlugin
|
||||
Bundle-Vendor: %providerName
|
||||
Require-Bundle: org.eclipse.core.expressions;bundle-version="3.4.400",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
###############################################################################
|
||||
# Copyright (c) 2018, 2020 Contributors to the Eclipse Foundation
|
||||
# Copyright (c) 2018, 2021 Contributors to the Eclipse Foundation
|
||||
#
|
||||
# See the NOTICE file(s) distributed with this work for additional
|
||||
# information regarding copyright ownership.
|
||||
|
@ -24,7 +24,7 @@ blurb=Terminal (Console) View\n\
|
|||
Version: {featureVersion}\n\
|
||||
Build id: {0}\n\
|
||||
\n\
|
||||
Copyright (c) 2018, 2020 Contributors to the Eclipse Foundation
|
||||
Copyright (c) 2018, 2021 Contributors to the Eclipse Foundation
|
||||
\n\
|
||||
See the NOTICE file(s) distributed with this work for additional\n\
|
||||
information regarding copyright ownership.\n\
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2021 Fabrizio Iannetti.
|
||||
*
|
||||
* 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
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.tm.terminal.view.ui.actions;
|
||||
|
||||
import org.eclipse.core.runtime.Assert;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
|
||||
import org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction;
|
||||
import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
|
||||
import org.eclipse.tm.terminal.view.ui.nls.Messages;
|
||||
import org.eclipse.tm.terminal.view.ui.tabs.TabFolderManager;
|
||||
|
||||
/**
|
||||
* @since 4.8
|
||||
*/
|
||||
public class InvertColorsAction extends AbstractTerminalAction {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param tabFolderManager The parent tab folder manager. Must not be <code>null</code>.
|
||||
*/
|
||||
public InvertColorsAction(TabFolderManager tabFolderManager) {
|
||||
super(null, SelectEncodingAction.class.getName(), IAction.AS_CHECK_BOX);
|
||||
|
||||
Assert.isNotNull(tabFolderManager);
|
||||
setupAction(Messages.InvertColorsAction_menu, Messages.InvertColorsAction_tooltip, (ImageDescriptor) null,
|
||||
(ImageDescriptor) null, (ImageDescriptor) null, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
ITerminalViewControl target = getTarget();
|
||||
if (target == null)
|
||||
return;
|
||||
target.setInvertedColors(!target.isInvertedColors());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAction(boolean aboutToShow) {
|
||||
setEnabled(aboutToShow && getTarget() != null && getTarget().getState() == TerminalState.CONNECTED);
|
||||
setChecked(aboutToShow && getTarget() != null && getTarget().isInvertedColors());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2011, 2018 Wind River Systems, Inc. and others. All rights reserved.
|
||||
* Copyright (c) 2011, 2021 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 2.0 which accompanies this distribution, and is
|
||||
* available at https://www.eclipse.org/legal/epl-2.0/
|
||||
|
@ -83,6 +83,9 @@ public class Messages extends NLS {
|
|||
public static String SelectEncodingAction_menu;
|
||||
public static String SelectEncodingAction_tooltip;
|
||||
|
||||
public static String InvertColorsAction_menu;
|
||||
public static String InvertColorsAction_tooltip;
|
||||
|
||||
public static String ProcessSettingsPage_dialogTitle;
|
||||
public static String ProcessSettingsPage_processImagePathSelectorControl_label;
|
||||
public static String ProcessSettingsPage_processImagePathSelectorControl_button;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
###############################################################################
|
||||
# Copyright (c) 2012, 2018 Wind River Systems, Inc. and others. All rights reserved.
|
||||
# Copyright (c) 2012, 2021 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 2.0 which accompanies this distribution, and is
|
||||
# available at https://www.eclipse.org/legal/epl-2.0/
|
||||
|
@ -39,6 +39,9 @@ ToggleCommandFieldAction_toolTip=Toggle Command Input Field
|
|||
SelectEncodingAction_menu=Switch Encoding...
|
||||
SelectEncodingAction_tooltip=Switch the Encoding of the active Terminal
|
||||
|
||||
InvertColorsAction_menu=Inverted colors
|
||||
InvertColorsAction_tooltip=Invert the colors of the active Terminal
|
||||
|
||||
ProcessSettingsPage_dialogTitle=Select Process Image
|
||||
ProcessSettingsPage_processImagePathSelectorControl_label=Image Path:
|
||||
ProcessSettingsPage_processImagePathSelectorControl_button=Browse
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2011, 2018 Wind River Systems, Inc. and others. All rights reserved.
|
||||
* Copyright (c) 2011, 2021 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 2.0 which accompanies this distribution, and is
|
||||
* available at https://www.eclipse.org/legal/epl-2.0/
|
||||
|
@ -36,6 +36,7 @@ import org.eclipse.tm.internal.terminal.control.actions.TerminalActionPaste;
|
|||
import org.eclipse.tm.internal.terminal.control.actions.TerminalActionSelectAll;
|
||||
import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
|
||||
import org.eclipse.tm.terminal.view.core.interfaces.constants.ITerminalsConnectorConstants;
|
||||
import org.eclipse.tm.terminal.view.ui.actions.InvertColorsAction;
|
||||
import org.eclipse.tm.terminal.view.ui.actions.SelectEncodingAction;
|
||||
import org.eclipse.tm.terminal.view.ui.interfaces.ITerminalsView;
|
||||
import org.eclipse.ui.IWorkbenchActionConstants;
|
||||
|
@ -294,6 +295,14 @@ public class TabFolderMenuHandler extends PlatformObject {
|
|||
return getActiveTerminalViewControl();
|
||||
}
|
||||
});
|
||||
|
||||
// Create and add the invert colors action
|
||||
add(new InvertColorsAction(getParentView().getAdapter(TabFolderManager.class)) {
|
||||
@Override
|
||||
protected ITerminalViewControl getTarget() {
|
||||
return getActiveTerminalViewControl();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue