[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-patch] CDT UI Build console cap
|
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/ChangeLog,v
retrieving revision 1.36
diff -u -r1.36 ChangeLog
--- ChangeLog 27 Nov 2002 18:57:44 -0000 1.36
+++ ChangeLog 27 Nov 2002 19:52:45 -0000
@@ -1,4 +1,19 @@
2002-11-27 David Inglis
+
+ * plugin.properties:
+ * plugin.xml:
+ * src/.../internal/ui/BuildConsoleManager.java:
+ * src/.../internal/ui/ConsoleEvent.java:
+ * src/.../internal/ui/buildconsole/BuildConsoleView.java:
+ * src/.../internal/ui/cview/CView.java:
+ * src/.../ui/preferences/BuildConsolePreferencePage.java:
+ * src/.../internal/ui/preferences/CPluginPreferencePage.java:
+ * src/.../ui/CUIPlugin.java:
+ * src/.../ui/IBuildConsoleEvent.java:
+ refactored CPluginPreferencePage into a BuildConsolePreferencePage.
+ added a configurable cap on the number of lines to keep in the build console.
+
+2002-11-27 David Inglis
* utils.ui/.../controls/ControlFactory.java:
removed unsed hyperlink stuff since it was leaking Cursors.
Index: plugin.properties
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/plugin.properties,v
retrieving revision 1.15
diff -u -r1.15 plugin.properties
--- plugin.properties 25 Nov 2002 19:32:24 -0000 1.15
+++ plugin.properties 27 Nov 2002 19:52:45 -0000
@@ -46,6 +46,7 @@
CPluginPreferencePage.name=C/C++
CPluginEditorPreferencePage.name=C/C++ Editor
CPluginTemplatePreferencePage.name=Code Templates
+CPluginBuildConsolePreferencePage.name=Build Console
CProjectPropertyPage.name=C/C++ Project
CLaunchingPropertyPage.executionArguments.name=C Execution Arguments
CApplicationLauncher.label=Executable
Index: plugin.xml
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/plugin.xml,v
retrieving revision 1.16
diff -u -r1.16 plugin.xml
--- plugin.xml 21 Nov 2002 18:29:30 -0000 1.16
+++ plugin.xml 27 Nov 2002 19:52:45 -0000
@@ -29,9 +29,9 @@
<extension-point id="CCompletionContributor" name="%completionContributorName"/>
<extension-point id="CElementFilters" name="%elementFiltersName"/>
<!-- =========================================================================== -->
-<!-- Extension Implementation: must implement org.eclipse.jface.text.ITextHover -->
-<!-- Purpose: Provide a perspective specific text hovering for CEditor files -->
<!-- Extension point: org.eclipse.cdt.ui.textHovers -->
+<!-- Purpose: Provide a perspective specific text hovering for CEditor files -->
+<!-- Extension Implementation: must implement org.eclipse.jface.text.ITextHover -->
<!-- =========================================================================== -->
<extension-point id="textHovers" name="%textHoversName"/>
@@ -139,8 +139,8 @@
id="org.eclipse.cdt.ui.MakeView">
</view>
</extension>
-<!-- The wizards -->
<!-- For C Wizards -->
+<!-- The wizards -->
<extension
point="org.eclipse.ui.newWizards">
<category
@@ -248,6 +248,12 @@
category="org.eclipse.cdt.ui.preferences.CPluginPreferencePage"
class="org.eclipse.cdt.internal.ui.preferences.TemplatePreferencePage"
id="org.eclipse.cdt.ui.preferences.TemplatePreferencePage">
+ </page>
+ <page
+ name="%CPluginBuildConsolePreferencePage.name"
+ category="org.eclipse.cdt.ui.preferences.CPluginPreferencePage"
+ class="org.eclipse.cdt.internal.ui.preferences.BuildConsolePreferencePage"
+ id="org.eclipse.cdt.ui.preferneces.CBuildConsolePreferernces">
</page>
</extension>
<extension
Index: src/org/eclipse/cdt/internal/ui/BuildConsoleManager.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/BuildConsoleManager.java,v
retrieving revision 1.2
diff -u -r1.2 BuildConsoleManager.java
--- src/org/eclipse/cdt/internal/ui/BuildConsoleManager.java 20 Nov 2002 14:16:00 -0000 1.2
+++ src/org/eclipse/cdt/internal/ui/BuildConsoleManager.java 27 Nov 2002 19:52:46 -0000
@@ -5,12 +5,14 @@
package org.eclipse.cdt.internal.ui;
import java.io.IOException;
+import java.util.Collection;
import java.util.HashMap;
+import java.util.Iterator;
import org.eclipse.cdt.core.ConsoleOutputStream;
import org.eclipse.cdt.core.resources.IConsole;
-import org.eclipse.cdt.internal.ui.preferences.CPluginPreferencePage;
-import org.eclipse.cdt.ui.*;
+import org.eclipse.cdt.internal.ui.preferences.BuildConsolePreferencePage;
+import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.ui.IBuildConsoleListener;
import org.eclipse.cdt.ui.IBuildConsoleManager;
import org.eclipse.core.resources.IProject;
@@ -20,7 +22,9 @@
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.ListenerList;
+import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchPage;
@@ -28,26 +32,67 @@
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
-public class BuildConsoleManager implements IBuildConsoleManager, IResourceChangeListener {
+public class BuildConsoleManager implements IBuildConsoleManager, IResourceChangeListener, IPropertyChangeListener {
private HashMap fConsoleDocumentMap;
ListenerList listeners = new ListenerList(1);
+ private class BuildConsoleDocument extends Document {
+
+ private int fMaxLines;
+
+ public BuildConsoleDocument(int nLines) {
+ super();
+ fMaxLines = nLines;
+ }
+
+ public void setDocumentSize(int nLines) {
+ fMaxLines = nLines;
+ nLines = getNumberOfLines();
+ if (nLines > fMaxLines) {
+ try {
+ int start = getLineOffset(nLines - fMaxLines);
+ String part = get(start, getLength() - start);
+ set(part);
+ } catch (BadLocationException e) {
+ }
+ }
+ }
+
+ public BuildConsoleDocument(String initialContent) {
+ super(initialContent);
+ }
+
+ public void replace(int offset, int length, String text) throws BadLocationException {
+ super.replace(offset, length, text);
+ int nLines = getNumberOfLines();
+ if (nLines > fMaxLines) {
+ int start = getLineOffset(nLines - fMaxLines);
+ String part = get(start, getLength() - start);
+ set(part);
+ }
+ }
+ }
+
private class BuildConsole extends ConsoleOutputStream implements IConsole {
- protected IDocument fDocument;
+ private BuildConsoleDocument fDocument;
public BuildConsole() {
- fDocument = new Document();
+ fDocument = new BuildConsoleDocument(BuildConsolePreferencePage.buildConsoleLines());
+ }
+
+ public void setConsoleSize(int nLines) {
+ fDocument.setDocumentSize(nLines);
}
public void start(IProject project) {
- if (CPluginPreferencePage.isClearBuildConsole() ) {
+ if (BuildConsolePreferencePage.isClearBuildConsole()) {
clear();
}
- Object[] list = listeners.getListeners();
- if ( list .length > 0 ) {
- for ( int i = 0; i < list.length; i++ ) {
- IBuildConsoleListener listener = (IBuildConsoleListener)list[i];
- ConsoleEvent event = new ConsoleEvent(project, ConsoleEvent.CONSOLE_START);
+ Object[] list = listeners.getListeners();
+ if (list.length > 0) {
+ for (int i = 0; i < list.length; i++) {
+ IBuildConsoleListener listener = (IBuildConsoleListener) list[i];
+ ConsoleEvent event = new ConsoleEvent(BuildConsoleManager.this, project, ConsoleEvent.CONSOLE_START);
listener.consoleChange(event);
}
}
@@ -73,18 +118,17 @@
public void flush() throws IOException {
flush(false);
}
-
+
public void flush(boolean force) throws IOException {
- if ( force || fBuffer.length() > 512) {
+ if (force || fBuffer.length() > 512) {
Display.getDefault().syncExec(new Runnable() {
public void run() {
- if (CPluginPreferencePage.isConsoleOnTop())
+ if (BuildConsolePreferencePage.isConsoleOnTop())
bringConsoleOnTop();
try {
int len = fDocument.getLength();
fDocument.replace(len, 0, readBuffer());
- }
- catch (BadLocationException x) {
+ } catch (BadLocationException x) {
}
}
});
@@ -101,18 +145,16 @@
// show the build console
IViewPart cBuild = page.findView(CUIPlugin.CONSOLE_ID);
if (cBuild == null) {
- if (CPluginPreferencePage.isAutoOpenConsole()) {
+ if (BuildConsolePreferencePage.isAutoOpenConsole()) {
IWorkbenchPart activePart = page.getActivePart();
cBuild = page.showView(CUIPlugin.CONSOLE_ID);
//restore focus
page.activate(activePart);
}
- }
- else {
+ } else {
page.bringToTop(cBuild);
}
- }
- catch (PartInitException pie) {
+ } catch (PartInitException pie) {
}
}
}
@@ -122,7 +164,7 @@
}
}
-
+
public BuildConsoleManager() {
fConsoleDocumentMap = new HashMap();
}
@@ -134,23 +176,33 @@
* @see IResourceChangeListener#resourceChanged(IResourceChangeEvent)
*/
public void resourceChanged(IResourceChangeEvent event) {
- if ( fConsoleDocumentMap == null ) {
+ if (fConsoleDocumentMap == null) {
return;
}
IResource resource = event.getResource();
- if ( event.getType() == IResourceChangeEvent.PRE_DELETE ) {
- if(resource.getType() == IResource.PROJECT ) {
+ if (resource.getType() == IResource.PROJECT) {
+ if (event.getType() == IResourceChangeEvent.PRE_DELETE || event.getType() == IResourceChangeEvent.PRE_CLOSE) {
fConsoleDocumentMap.remove(resource);
+ Object[] list = listeners.getListeners();
+ if (list.length > 0) {
+ for (int i = 0; i < list.length; i++) {
+ IBuildConsoleListener listener = (IBuildConsoleListener) list[i];
+ ConsoleEvent consoleEvent = new ConsoleEvent(this, (IProject) resource, ConsoleEvent.CONSOLE_CLOSE);
+ listener.consoleChange(consoleEvent);
+ }
+ }
}
}
}
-
+
public void shutdown() {
CUIPlugin.getWorkspace().removeResourceChangeListener(this);
+ CUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(this);
}
-
+
public void startup() {
CUIPlugin.getWorkspace().addResourceChangeListener(this);
+ CUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(this);
}
private BuildConsole getBuildConsole(IProject project) {
@@ -176,6 +228,17 @@
public void removeConsoleListener(IBuildConsoleListener listener) {
listeners.remove(listener);
+ }
+
+ public void propertyChange(PropertyChangeEvent event) {
+ if (event.getProperty() == BuildConsolePreferencePage.PREF_BUILDCONSOLE_LINES) {
+ Collection consoles = fConsoleDocumentMap.values();
+ Iterator iter = consoles.iterator();
+ while (iter.hasNext()) {
+ BuildConsole console = (BuildConsole) iter.next();
+ console.setConsoleSize(BuildConsolePreferencePage.buildConsoleLines());
+ }
+ }
}
}
Index: src/org/eclipse/cdt/internal/ui/ConsoleEvent.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/ConsoleEvent.java,v
retrieving revision 1.1
diff -u -r1.1 ConsoleEvent.java
--- src/org/eclipse/cdt/internal/ui/ConsoleEvent.java 29 Oct 2002 21:40:58 -0000 1.1
+++ src/org/eclipse/cdt/internal/ui/ConsoleEvent.java 27 Nov 2002 19:52:46 -0000
@@ -3,14 +3,17 @@
* All Rights Reserved.
*/package org.eclipse.cdt.internal.ui;
+import java.util.EventObject;
+
import org.eclipse.cdt.ui.IBuildConsoleEvent;
import org.eclipse.core.resources.IProject;
-public class ConsoleEvent implements IBuildConsoleEvent {
+public class ConsoleEvent extends EventObject implements IBuildConsoleEvent {
private IProject fProject;
private int fType;
- public ConsoleEvent(IProject project, int type) {
+ public ConsoleEvent(Object source, IProject project, int type) {
+ super(source);
fProject = project;
fType = type;
}
Index: src/org/eclipse/cdt/internal/ui/buildconsole/BuildConsoleView.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/buildconsole/BuildConsoleView.java,v
retrieving revision 1.3
diff -u -r1.3 BuildConsoleView.java
--- src/org/eclipse/cdt/internal/ui/buildconsole/BuildConsoleView.java 14 Nov 2002 15:20:07 -0000 1.3
+++ src/org/eclipse/cdt/internal/ui/buildconsole/BuildConsoleView.java 27 Nov 2002 19:52:46 -0000
@@ -8,7 +8,7 @@
import java.util.ResourceBundle;
import org.eclipse.cdt.internal.ui.ICHelpContextIds;
-import org.eclipse.cdt.internal.ui.preferences.CPluginPreferencePage;
+import org.eclipse.cdt.internal.ui.preferences.BuildConsolePreferencePage;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.ui.IBuildConsoleEvent;
import org.eclipse.cdt.ui.IBuildConsoleListener;
@@ -70,7 +70,7 @@
fFont = null;
fPropertyChangeListener = new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
- if (fTextViewer != null && event.getProperty().equals(CPluginPreferencePage.PREF_CONSOLE_FONT)) {
+ if (fTextViewer != null && event.getProperty().equals(BuildConsolePreferencePage.PREF_CONSOLE_FONT)) {
initializeWidgetFont(fTextViewer.getTextWidget());
}
}
@@ -137,10 +137,10 @@
protected IProject getProject() {
return selProject;
}
-
+
protected IDocument setDocument() {
IProject project = getProject();
- if (project != null ) {
+ if (project != null) {
fTextViewer.setDocument(fConsoleManager.getConsoleDocument(project));
}
return null;
@@ -149,20 +149,19 @@
protected void setTitle() {
String title = origTitle;
IProject project = getProject();
- if (project != null ) {
+ if (project != null) {
title += " [" + project.getName() + "]";
}
setTitle(title);
}
-
+
protected void initializeWidgetFont(StyledText styledText) {
IPreferenceStore store = CUIPlugin.getDefault().getPreferenceStore();
- String prefKey = CPluginPreferencePage.PREF_CONSOLE_FONT;
+ String prefKey = BuildConsolePreferencePage.PREF_CONSOLE_FONT;
FontData data = null;
if (store.contains(prefKey) && !store.isDefault(prefKey)) {
data = PreferenceConverter.getFontData(store, prefKey);
- }
- else {
+ } else {
data = PreferenceConverter.getDefaultFontData(store, prefKey);
}
if (data != null) {
@@ -173,8 +172,7 @@
fFont.dispose();
fFont = font;
- }
- else {
+ } else {
// if all the preferences failed
styledText.setFont(JFaceResources.getTextFont());
}
@@ -247,16 +245,15 @@
if (fFont != null) {
fFont.dispose();
fFont = null;
- }
+ }
getSite().getPage().removeSelectionListener(this);
fConsoleManager.removeConsoleListener(this);
}
-
+
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
IProject newProject = convertSelectionToProject(selection);
IProject oldProject = getProject();
- if (oldProject == null ||
- (newProject != null && !newProject.equals(oldProject))) {
+ if (oldProject == null || (newProject != null && !newProject.equals(oldProject))) {
setProject(newProject);
setDocument();
setTitle();
@@ -264,9 +261,12 @@
}
public void consoleChange(IBuildConsoleEvent event) {
- if ( event.getType() == IBuildConsoleEvent.CONSOLE_START ) {
+ if (event.getType() == IBuildConsoleEvent.CONSOLE_START || event.getType() == IBuildConsoleEvent.CONSOLE_CLOSE) {
Display display = fTextViewer.getControl().getDisplay();
selProject = event.getProject();
+ if (event.getType() == IBuildConsoleEvent.CONSOLE_CLOSE && selProject != event.getProject()) {
+ return;
+ }
display.asyncExec(new Runnable() {
public void run() {
setDocument();
@@ -278,7 +278,7 @@
IProject convertSelectionToProject(ISelection selection) {
IProject project = null;
- if ( selection == null ) {
+ if (selection == null) {
return project;
}
try {
Index: src/org/eclipse/cdt/internal/ui/cview/CView.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CView.java,v
retrieving revision 1.10
diff -u -r1.10 CView.java
--- src/org/eclipse/cdt/internal/ui/cview/CView.java 20 Nov 2002 21:16:00 -0000 1.10
+++ src/org/eclipse/cdt/internal/ui/cview/CView.java 27 Nov 2002 19:52:46 -0000
@@ -1012,7 +1012,7 @@
boolean refreshViewer= false;
- if (event.getProperty() == CPluginPreferencePage.SHOW_CU_CHILDREN) {
+ if (event.getProperty() == CPluginPreferencePage.PREF_SHOW_CU_CHILDREN) {
boolean showCUChildren= CPluginPreferencePage.showCompilationUnitChildren();
((CContentProvider)viewer.getContentProvider()).setProvideMembers(showCUChildren);
refreshViewer= true;
Index: src/org/eclipse/cdt/internal/ui/preferences/BuildConsolePreferencePage.java
===================================================================
RCS file: src/org/eclipse/cdt/internal/ui/preferences/BuildConsolePreferencePage.java
diff -N src/org/eclipse/cdt/internal/ui/preferences/BuildConsolePreferencePage.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/cdt/internal/ui/preferences/BuildConsolePreferencePage.java 27 Nov 2002 19:52:47 -0000
@@ -0,0 +1,96 @@
+/*
+ * (c) Copyright QNX Software System Ltd. 2002.
+ * All Rights Reserved.
+ */
+package org.eclipse.cdt.internal.ui.preferences;
+
+import org.eclipse.cdt.ui.CUIPlugin;
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.preference.FontFieldEditor;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.IntegerFieldEditor;
+import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+public class BuildConsolePreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
+
+ public static final String PREF_CONSOLE_FONT = "consoleFont";
+ private static final String PREF_CLEAR_CONSOLE = "clearConsole";
+ private static final String PREF_CONSOLE_ON_TOP = "consoleOnTop";
+ private static final String PREF_AUTO_OPEN_CONSOLE = "autoOpenConsole";
+ public static final String PREF_BUILDCONSOLE_LINES = "buildConsoleLines";
+
+ private static final String CLEAR_CONSOLE_LABEL= "CBasePreferencePage.clearConsole.label";
+ private static final String CONSOLE_ON_TOP_LABEL= "CBasePreferencePage.consoleOnTop.label";
+ private static final String AUTO_OPEN_CONSOLE_LABEL= "CBasePreferencePage.autoOpenConsole.label";
+ private static final String CONSOLE_FONT_LABEL= "CBasePreferencePage.consoleFont.label";
+
+ public BuildConsolePreferencePage() {
+ super(GRID);
+ setPreferenceStore(CUIPlugin.getDefault().getPreferenceStore());
+ }
+
+ protected void createFieldEditors() {
+ Composite parent = getFieldEditorParent();
+ BooleanFieldEditor clearConsole =
+ new BooleanFieldEditor(PREF_CLEAR_CONSOLE, CUIPlugin.getResourceString(CLEAR_CONSOLE_LABEL), parent);
+ addField(clearConsole);
+
+ BooleanFieldEditor autoOpenConsole =
+ new BooleanFieldEditor(PREF_AUTO_OPEN_CONSOLE, CUIPlugin.getResourceString(AUTO_OPEN_CONSOLE_LABEL), parent);
+ addField(autoOpenConsole);
+ BooleanFieldEditor consoleOnTop =
+ new BooleanFieldEditor(PREF_CONSOLE_ON_TOP, CUIPlugin.getResourceString(CONSOLE_ON_TOP_LABEL), parent);
+ addField(consoleOnTop);
+
+ IntegerFieldEditor buildCount = new IntegerFieldEditor( PREF_BUILDCONSOLE_LINES, "&Build console lines: ", parent );
+ buildCount.setValidRange( 10, Integer.MAX_VALUE );
+ addField( buildCount );
+
+ addField(new FontFieldEditor(PREF_CONSOLE_FONT, CUIPlugin.getResourceString(CONSOLE_FONT_LABEL), parent));
+ }
+
+ /**
+ * Returns the current preference setting if the build console should
+ * be cleared before each build.
+ */
+ 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);
+ }
+
+ public static boolean isConsoleOnTop() {
+ return CUIPlugin.getDefault().getPreferenceStore().getBoolean(PREF_CONSOLE_ON_TOP);
+ }
+
+ public static int buildConsoleLines() {
+ return CUIPlugin.getDefault().getPreferenceStore().getInt(PREF_BUILDCONSOLE_LINES);
+ }
+
+ public void init(IWorkbench workbench) {
+ }
+
+ public static void initDefaults(IPreferenceStore prefs) {
+ prefs.setDefault(PREF_CLEAR_CONSOLE, true);
+ prefs.setDefault(PREF_AUTO_OPEN_CONSOLE, false);
+ prefs.setDefault(PREF_CONSOLE_ON_TOP, true);
+ prefs.setDefault(PREF_BUILDCONSOLE_LINES, 100);
+ Font font = JFaceResources.getTextFont();
+ if (font != null) {
+ FontData[] data = font.getFontData();
+ if (data != null && data.length > 0) {
+ PreferenceConverter.setDefault(prefs, PREF_CONSOLE_FONT, data[0]);
+ }
+ }
+
+ }
+
+}
Index: src/org/eclipse/cdt/internal/ui/preferences/CPluginPreferencePage.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CPluginPreferencePage.java,v
retrieving revision 1.5
diff -u -r1.5 CPluginPreferencePage.java
--- src/org/eclipse/cdt/internal/ui/preferences/CPluginPreferencePage.java 29 Oct 2002 21:40:58 -0000 1.5
+++ src/org/eclipse/cdt/internal/ui/preferences/CPluginPreferencePage.java 27 Nov 2002 19:52:47 -0000
@@ -9,12 +9,7 @@
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
-import org.eclipse.jface.preference.FontFieldEditor;
import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceConverter;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
@@ -25,25 +20,11 @@
*/
public class CPluginPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
- public static final String PREF_CONSOLE_FONT= "consoleFont";
-
-// private static final String PREF_BUILD_LOCATION= "buildLocation";
-// private static final String PREF_STOP_ON_ERROR= "stopOnError";
- private static final String PREF_CLEAR_CONSOLE= "clearConsole";
- private static final String PREF_CONSOLE_ON_TOP= "consoleOnTop";
- private static final String PREF_AUTO_OPEN_CONSOLE = "autoOpenConsole";
private static final String PREF_LINK_TO_EDITOR= "linkToEditor";
- public static final String SHOW_CU_CHILDREN="CUChildren"; //$NON-NLS-1$
-
- private static final String PAGE_DESC= "CBasePreferencePage.description";
-// private static final String BUILD_LOC_LABEL= "CBasePreferencePage.buildLocation.label";
- private static final String CLEAR_CONSOLE_LABEL= "CBasePreferencePage.clearConsole.label";
- private static final String CONSOLE_ON_TOP_LABEL= "CBasePreferencePage.consoleOnTop.label";
- private static final String AUTO_OPEN_CONSOLE_LABEL= "CBasePreferencePage.autoOpenConsole.label";
+ public static final String PREF_SHOW_CU_CHILDREN= "CUChildren"; //$NON-NLS-1$
+
private static final String LINK_TO_EDITOR_LABEL= "CBasePreferencePage.linkToEditor.label";
private static final String SHOW_CU_CHILDREN_LABEL= "CBasePreferencePage.CUChildren.label";
- //private static final String EDITOR_FONT_LABEL= "CBasePreferencePage.editorFont.label";
- private static final String CONSOLE_FONT_LABEL= "CBasePreferencePage.consoleFont.label";
public CPluginPreferencePage() {
super(GRID);
@@ -63,73 +44,25 @@
*/
protected void createFieldEditors() {
Composite parent= getFieldEditorParent();
-/*
- Label buildText= new Label(parent, SWT.NONE);
- GridData gd= new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan= 3;
- buildText.setLayoutData(gd);
- buildText.setText(CUIPlugin.getResourceString(PAGE_DESC));
- FileFieldEditor editor= new FileFieldEditor(PREF_BUILD_LOCATION, CUIPlugin.getResourceString(BUILD_LOC_LABEL), true, parent) {
- protected boolean checkState() {
- return true;
- }
- };
- addField(editor);
-*/
- BooleanFieldEditor clearConsole= new BooleanFieldEditor(PREF_CLEAR_CONSOLE, CUIPlugin.getResourceString(CLEAR_CONSOLE_LABEL), parent);
- addField(clearConsole);
-
- BooleanFieldEditor autoOpenConsole = new BooleanFieldEditor(PREF_AUTO_OPEN_CONSOLE, CUIPlugin.getResourceString(AUTO_OPEN_CONSOLE_LABEL), parent);
- addField(autoOpenConsole);
- BooleanFieldEditor consoleOnTop= new BooleanFieldEditor(PREF_CONSOLE_ON_TOP, CUIPlugin.getResourceString(CONSOLE_ON_TOP_LABEL), parent);
- addField(consoleOnTop);
BooleanFieldEditor linkEditor= new BooleanFieldEditor(PREF_LINK_TO_EDITOR, CUIPlugin.getResourceString(LINK_TO_EDITOR_LABEL), parent);
addField(linkEditor);
- BooleanFieldEditor showCUChildrenEditor= new BooleanFieldEditor(SHOW_CU_CHILDREN, CUIPlugin.getResourceString(SHOW_CU_CHILDREN_LABEL), parent);
+ BooleanFieldEditor showCUChildrenEditor= new BooleanFieldEditor(PREF_SHOW_CU_CHILDREN, CUIPlugin.getResourceString(SHOW_CU_CHILDREN_LABEL), parent);
addField(showCUChildrenEditor);
- addField(new FontFieldEditor(PREF_CONSOLE_FONT, CUIPlugin.getResourceString(CONSOLE_FONT_LABEL), parent));
-
- //addField(new FontFieldEditor(AbstractTextEditor.PREFERENCE_FONT, CUIPlugin.getResourceString(EDITOR_FONT_LABEL), parent));
-
}
- /**
- * Returns the current preference setting if the build console should
- * be cleared before each build.
- */
- 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);
- }
-
- public static boolean isConsoleOnTop() {
- return CUIPlugin.getDefault().getPreferenceStore().getBoolean(PREF_CONSOLE_ON_TOP);
- }
public static boolean isLinkToEditor() {
return CUIPlugin.getDefault().getPreferenceStore().getBoolean(PREF_LINK_TO_EDITOR);
}
public static boolean showCompilationUnitChildren() {
- return CUIPlugin.getDefault().getPreferenceStore().getBoolean(SHOW_CU_CHILDREN);
+ return CUIPlugin.getDefault().getPreferenceStore().getBoolean(PREF_SHOW_CU_CHILDREN);
}
/**
- * Returns the current preference setting of the build command location.
- */
-// public static String getBuildLocation() {
-// return CUIPlugin.getDefault().getPreferenceStore().getString(PREF_BUILD_LOCATION);
-// }
-
-// public static boolean isStopOnError() {
-// return CUIPlugin.getDefault().getPreferenceStore().getBoolean(PREF_STOP_ON_ERROR);
-// }
- /**
* @see IWorkbenchPreferencePage#init
*/
public void init(IWorkbench workbench) {
@@ -139,21 +72,8 @@
* Initializes the default values of this page in the preference bundle.
*/
public static void initDefaults(IPreferenceStore prefs) {
-// prefs.setDefault(PREF_BUILD_LOCATION, "make");
-// prefs.setDefault(PREF_STOP_ON_ERROR, false);
- prefs.setDefault(PREF_CLEAR_CONSOLE, true);
- prefs.setDefault(PREF_AUTO_OPEN_CONSOLE, false);
- prefs.setDefault(PREF_CONSOLE_ON_TOP, true);
prefs.setDefault(PREF_LINK_TO_EDITOR, true);
- prefs.setDefault(SHOW_CU_CHILDREN, true);
- Font font= JFaceResources.getTextFont();
- if (font != null) {
- FontData[] data= font.getFontData();
- if (data != null && data.length > 0) {
- //PreferenceConverter.setDefault(prefs, AbstractTextEditor.PREFERENCE_FONT, data[0]);
- PreferenceConverter.setDefault(prefs, PREF_CONSOLE_FONT, data[0]);
- }
- }
+ prefs.setDefault(PREF_SHOW_CU_CHILDREN, true);
}
}
Index: src/org/eclipse/cdt/ui/CUIPlugin.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPlugin.java,v
retrieving revision 1.2
diff -u -r1.2 CUIPlugin.java
--- src/org/eclipse/cdt/ui/CUIPlugin.java 6 Nov 2002 19:26:58 -0000 1.2
+++ src/org/eclipse/cdt/ui/CUIPlugin.java 27 Nov 2002 19:52:47 -0000
@@ -18,6 +18,7 @@
import org.eclipse.cdt.internal.ui.cview.CView;
import org.eclipse.cdt.internal.ui.editor.CDocumentProvider;
import org.eclipse.cdt.internal.ui.editor.asm.AsmTextTools;
+import org.eclipse.cdt.internal.ui.preferences.BuildConsolePreferencePage;
import org.eclipse.cdt.internal.ui.preferences.CEditorPreferencePage;
import org.eclipse.cdt.internal.ui.preferences.CPluginPreferencePage;
import org.eclipse.cdt.internal.ui.text.CTextTools;
@@ -228,6 +229,7 @@
CPluginPreferencePage.initDefaults(store);
CEditorPreferencePage.initDefaults(store);
CView.initDefaults(store);
+ BuildConsolePreferencePage.initDefaults(store);
}
});
}
Index: src/org/eclipse/cdt/ui/IBuildConsoleEvent.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/IBuildConsoleEvent.java,v
retrieving revision 1.1
diff -u -r1.1 IBuildConsoleEvent.java
--- src/org/eclipse/cdt/ui/IBuildConsoleEvent.java 29 Oct 2002 21:40:58 -0000 1.1
+++ src/org/eclipse/cdt/ui/IBuildConsoleEvent.java 27 Nov 2002 19:52:47 -0000
@@ -8,6 +8,7 @@
public interface IBuildConsoleEvent {
final static int CONSOLE_START = 1;
+ final static int CONSOLE_CLOSE = 2;
IProject getProject();
int getType();