mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
fixed bug #217189.
This commit is contained in:
parent
72580d7559
commit
ce88bbac4a
5 changed files with 38 additions and 1 deletions
|
@ -28,6 +28,7 @@ ConsolePreferencePage.colorSettings.label=Console text color settings
|
||||||
ConsolePreferencePage.outputColor.label=Output text color
|
ConsolePreferencePage.outputColor.label=Output text color
|
||||||
ConsolePreferencePage.infoColor.label=Information message text color
|
ConsolePreferencePage.infoColor.label=Information message text color
|
||||||
ConsolePreferencePage.errorColor.label=Error message text color
|
ConsolePreferencePage.errorColor.label=Error message text color
|
||||||
|
ConsolePreferencePage.backgroundColor.label=Background color
|
||||||
|
|
||||||
# ------- Project/Prefernces/Wizards COnfiguration blocks -------
|
# ------- Project/Prefernces/Wizards COnfiguration blocks -------
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,9 @@ import org.eclipse.cdt.internal.ui.CPluginImages;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
import org.eclipse.cdt.ui.IBuildConsoleManager;
|
import org.eclipse.cdt.ui.IBuildConsoleManager;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.swt.graphics.Color;
|
||||||
import org.eclipse.ui.console.AbstractConsole;
|
import org.eclipse.ui.console.AbstractConsole;
|
||||||
|
import org.eclipse.ui.console.IConsoleConstants;
|
||||||
import org.eclipse.ui.console.IConsoleView;
|
import org.eclipse.ui.console.IConsoleView;
|
||||||
import org.eclipse.ui.part.IPageBookViewPage;
|
import org.eclipse.ui.part.IPageBookViewPage;
|
||||||
|
|
||||||
|
@ -29,6 +31,7 @@ public class BuildConsole extends AbstractConsole {
|
||||||
private IBuildConsoleManager fConsoleManager;
|
private IBuildConsoleManager fConsoleManager;
|
||||||
private String fConsoleName;
|
private String fConsoleName;
|
||||||
private String fConsoleId;
|
private String fConsoleId;
|
||||||
|
private Color fBackground;
|
||||||
|
|
||||||
public BuildConsole(IBuildConsoleManager manager, String name, String id) {
|
public BuildConsole(IBuildConsoleManager manager, String name, String id) {
|
||||||
super(name, CPluginImages.DESC_BUILD_CONSOLE);
|
super(name, CPluginImages.DESC_BUILD_CONSOLE);
|
||||||
|
@ -52,4 +55,21 @@ public class BuildConsole extends AbstractConsole {
|
||||||
public IBuildConsoleManager getConsoleManager() {
|
public IBuildConsoleManager getConsoleManager() {
|
||||||
return fConsoleManager;
|
return fConsoleManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setBackground(Color background) {
|
||||||
|
if (fBackground == null) {
|
||||||
|
if (background == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else if (fBackground.equals(background)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Color old = fBackground;
|
||||||
|
fBackground = background;
|
||||||
|
firePropertyChange(this, IConsoleConstants.P_BACKGROUND_COLOR, old, fBackground);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Color getBackground() {
|
||||||
|
return fBackground;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class BuildConsoleManager implements IBuildConsoleManager, IResourceChang
|
||||||
ListenerList listeners = new ListenerList();
|
ListenerList listeners = new ListenerList();
|
||||||
BuildConsole fConsole;
|
BuildConsole fConsole;
|
||||||
private Map<IProject, BuildConsolePartitioner> fConsoleMap = new HashMap<IProject, BuildConsolePartitioner>();
|
private Map<IProject, BuildConsolePartitioner> fConsoleMap = new HashMap<IProject, BuildConsolePartitioner>();
|
||||||
Color infoColor, outputColor, errorColor;
|
Color infoColor, outputColor, errorColor, backgroundColor;
|
||||||
BuildConsoleStream infoStream, outputStream, errorStream;
|
BuildConsoleStream infoStream, outputStream, errorStream;
|
||||||
String fName, fContextMenuId;
|
String fName, fContextMenuId;
|
||||||
|
|
||||||
|
@ -158,6 +158,7 @@ public class BuildConsoleManager implements IBuildConsoleManager, IResourceChang
|
||||||
infoColor.dispose();
|
infoColor.dispose();
|
||||||
outputColor.dispose();
|
outputColor.dispose();
|
||||||
errorColor.dispose();
|
errorColor.dispose();
|
||||||
|
backgroundColor.dispose();
|
||||||
}
|
}
|
||||||
ConsolePlugin.getDefault().getConsoleManager().removeConsoles(new org.eclipse.ui.console.IConsole[]{fConsole});
|
ConsolePlugin.getDefault().getConsoleManager().removeConsoles(new org.eclipse.ui.console.IConsole[]{fConsole});
|
||||||
CUIPlugin.getWorkspace().removeResourceChangeListener(this);
|
CUIPlugin.getWorkspace().removeResourceChangeListener(this);
|
||||||
|
@ -202,6 +203,8 @@ public class BuildConsoleManager implements IBuildConsoleManager, IResourceChang
|
||||||
errorStream.setConsole(fConsole);
|
errorStream.setConsole(fConsole);
|
||||||
errorColor = createColor(CUIPlugin.getStandardDisplay(), BuildConsolePreferencePage.PREF_BUILDCONSOLE_ERROR_COLOR);
|
errorColor = createColor(CUIPlugin.getStandardDisplay(), BuildConsolePreferencePage.PREF_BUILDCONSOLE_ERROR_COLOR);
|
||||||
errorStream.setColor(errorColor);
|
errorStream.setColor(errorColor);
|
||||||
|
backgroundColor = createColor(CUIPlugin.getStandardDisplay(), BuildConsolePreferencePage.PREF_BUILDCONSOLE_BACKGROUND_COLOR);
|
||||||
|
fConsole.setBackground(backgroundColor);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
CUIPlugin.getWorkspace().addResourceChangeListener(this);
|
CUIPlugin.getWorkspace().addResourceChangeListener(this);
|
||||||
|
@ -231,6 +234,11 @@ public class BuildConsoleManager implements IBuildConsoleManager, IResourceChang
|
||||||
errorStream.setColor(newColor);
|
errorStream.setColor(newColor);
|
||||||
errorColor.dispose();
|
errorColor.dispose();
|
||||||
errorColor = newColor;
|
errorColor = newColor;
|
||||||
|
} else if (property.equals(BuildConsolePreferencePage.PREF_BUILDCONSOLE_BACKGROUND_COLOR)) {
|
||||||
|
Color newColor = createColor(CUIPlugin.getStandardDisplay(), BuildConsolePreferencePage.PREF_BUILDCONSOLE_BACKGROUND_COLOR);
|
||||||
|
fConsole.setBackground(newColor);
|
||||||
|
backgroundColor.dispose();
|
||||||
|
backgroundColor = newColor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -208,6 +208,8 @@ public class BuildConsolePage extends Page
|
||||||
getConsole().addPropertyChangeListener(this);
|
getConsole().addPropertyChangeListener(this);
|
||||||
|
|
||||||
fViewer.addTextListener(this);
|
fViewer.addTextListener(this);
|
||||||
|
fViewer.getTextWidget().setBackground(getConsole().getBackground());
|
||||||
|
|
||||||
setInitialSelection();
|
setInitialSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,6 +253,8 @@ public class BuildConsolePage extends Page
|
||||||
setFont(JFaceResources.getFont(BuildConsolePreferencePage.PREF_BUILDCONSOLE_FONT));
|
setFont(JFaceResources.getFont(BuildConsolePreferencePage.PREF_BUILDCONSOLE_FONT));
|
||||||
} else if (property.equals(BuildConsolePreferencePage.PREF_BUILDCONSOLE_TAB_WIDTH)) {
|
} else if (property.equals(BuildConsolePreferencePage.PREF_BUILDCONSOLE_TAB_WIDTH)) {
|
||||||
setTabs(CUIPlugin.getDefault().getPluginPreferences().getInt(BuildConsolePreferencePage.PREF_BUILDCONSOLE_TAB_WIDTH));
|
setTabs(CUIPlugin.getDefault().getPluginPreferences().getInt(BuildConsolePreferencePage.PREF_BUILDCONSOLE_TAB_WIDTH));
|
||||||
|
} else if (IConsoleConstants.P_BACKGROUND_COLOR.equals(property)) {
|
||||||
|
fViewer.getTextWidget().setBackground(fConsole.getBackground());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@ public class BuildConsolePreferencePage extends FieldEditorPreferencePage implem
|
||||||
public static final String PREF_BUILDCONSOLE_INFO_COLOR = "buildConsoleInfoStreamColor"; //$NON-NLS-1$
|
public static final String PREF_BUILDCONSOLE_INFO_COLOR = "buildConsoleInfoStreamColor"; //$NON-NLS-1$
|
||||||
public static final String PREF_BUILDCONSOLE_OUTPUT_COLOR = "buildConsoleOutputStreamColor"; //$NON-NLS-1$
|
public static final String PREF_BUILDCONSOLE_OUTPUT_COLOR = "buildConsoleOutputStreamColor"; //$NON-NLS-1$
|
||||||
public static final String PREF_BUILDCONSOLE_ERROR_COLOR = "buildConsoleErrorStreamColor"; //$NON-NLS-1$
|
public static final String PREF_BUILDCONSOLE_ERROR_COLOR = "buildConsoleErrorStreamColor"; //$NON-NLS-1$
|
||||||
|
public static final String PREF_BUILDCONSOLE_BACKGROUND_COLOR = "buildConsoleBackgroundColor"; //$NON-NLS-1$
|
||||||
|
|
||||||
public BuildConsolePreferencePage() {
|
public BuildConsolePreferencePage() {
|
||||||
super(GRID);
|
super(GRID);
|
||||||
|
@ -79,6 +80,8 @@ public class BuildConsolePreferencePage extends FieldEditorPreferencePage implem
|
||||||
CUIPlugin.getResourceString("ConsolePreferencePage.infoColor.label"), parent)); //$NON-NLS-1$
|
CUIPlugin.getResourceString("ConsolePreferencePage.infoColor.label"), parent)); //$NON-NLS-1$
|
||||||
addField(createColorFieldEditor(PREF_BUILDCONSOLE_ERROR_COLOR,
|
addField(createColorFieldEditor(PREF_BUILDCONSOLE_ERROR_COLOR,
|
||||||
CUIPlugin.getResourceString("ConsolePreferencePage.errorColor.label"), parent)); //$NON-NLS-1$
|
CUIPlugin.getResourceString("ConsolePreferencePage.errorColor.label"), parent)); //$NON-NLS-1$
|
||||||
|
addField(createColorFieldEditor(PREF_BUILDCONSOLE_BACKGROUND_COLOR,
|
||||||
|
CUIPlugin.getResourceString("ConsolePreferencePage.backgroundColor.label"), parent)); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
private Label createLabel(Composite parent, String text) {
|
private Label createLabel(Composite parent, String text) {
|
||||||
|
@ -131,6 +134,7 @@ public class BuildConsolePreferencePage extends FieldEditorPreferencePage implem
|
||||||
PreferenceConverter.setDefault(prefs, PREF_BUILDCONSOLE_OUTPUT_COLOR, new RGB(0, 0, 0));
|
PreferenceConverter.setDefault(prefs, PREF_BUILDCONSOLE_OUTPUT_COLOR, new RGB(0, 0, 0));
|
||||||
PreferenceConverter.setDefault(prefs, PREF_BUILDCONSOLE_INFO_COLOR, new RGB(0, 0, 255));
|
PreferenceConverter.setDefault(prefs, PREF_BUILDCONSOLE_INFO_COLOR, new RGB(0, 0, 255));
|
||||||
PreferenceConverter.setDefault(prefs, PREF_BUILDCONSOLE_ERROR_COLOR, new RGB(255, 0, 0));
|
PreferenceConverter.setDefault(prefs, PREF_BUILDCONSOLE_ERROR_COLOR, new RGB(255, 0, 0));
|
||||||
|
PreferenceConverter.setDefault(prefs, PREF_BUILDCONSOLE_BACKGROUND_COLOR, new RGB(255, 255, 255));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue