mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-30 04:15:35 +02:00
fixed NPE in build console when console manager was not finsihed being initialized and the console was being written to.
This commit is contained in:
parent
01619cd230
commit
92b484a970
3 changed files with 39 additions and 45 deletions
|
@ -163,6 +163,9 @@ public class BuildConsoleManager implements IBuildConsoleManager, IResourceChang
|
|||
public void startup() {
|
||||
fConsole = new BuildConsole(this);
|
||||
ConsolePlugin.getDefault().getConsoleManager().addConsoles(new org.eclipse.ui.console.IConsole[]{fConsole});
|
||||
infoStream = new BuildConsoleStream(fConsole);
|
||||
outputStream = new BuildConsoleStream(fConsole);
|
||||
errorStream = new BuildConsoleStream(fConsole);
|
||||
|
||||
runUI(new Runnable() {
|
||||
|
||||
|
@ -174,13 +177,10 @@ public class BuildConsoleManager implements IBuildConsoleManager, IResourceChang
|
|||
public void run() {
|
||||
// install colors
|
||||
infoColor = createColor(CUIPlugin.getStandardDisplay(), BuildConsolePreferencePage.PREF_BUILDCONSOLE_INFO_COLOR);
|
||||
infoStream = new BuildConsoleStream(fConsole);
|
||||
infoStream.setColor(infoColor);
|
||||
outputColor = createColor(CUIPlugin.getStandardDisplay(), BuildConsolePreferencePage.PREF_BUILDCONSOLE_OUTPUT_COLOR);
|
||||
outputStream = new BuildConsoleStream(fConsole);
|
||||
outputStream.setColor(outputColor);
|
||||
errorColor = createColor(CUIPlugin.getStandardDisplay(), BuildConsolePreferencePage.PREF_BUILDCONSOLE_ERROR_COLOR);
|
||||
errorStream = new BuildConsoleStream(fConsole);
|
||||
errorStream.setColor(errorColor);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -234,7 +234,7 @@ public class BuildConsolePage extends Page implements ISelectionListener, IPrope
|
|||
action.setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(
|
||||
ISharedImages.IMG_TOOL_COPY_DISABLED));
|
||||
action.setHoverImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(
|
||||
ISharedImages.IMG_TOOL_COPY_HOVER));
|
||||
ISharedImages.IMG_TOOL_COPY));
|
||||
setGlobalAction(actionBars, ActionFactory.COPY.getId(), action);
|
||||
action = new TextViewerAction(getViewer(), ITextOperationTarget.SELECT_ALL);
|
||||
action.configureAction(ConsoleMessages.getString("BuildConsolePage.Select_&All@Ctrl+A_12"), //$NON-NLS-1$
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2002,2003,2004 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2002,2003,2004 QNX Software Systems and others. All rights
|
||||
* reserved. This program and the accompanying materials are made available
|
||||
* under the terms of the Common Public License v1.0 which accompanies this
|
||||
* distribution, and is available at http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
***********************************************************************/
|
||||
* Contributors: QNX Software Systems - Initial API and implementation
|
||||
******************************************************************************/
|
||||
package org.eclipse.cdt.internal.ui.buildconsole;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -146,7 +144,7 @@ public class BuildConsolePartitioner
|
|||
public ITypedRegion[] computePartitioning(int offset, int length) {
|
||||
if (offset == 0 && length == fDocument.getLength()) {
|
||||
return (ITypedRegion[])fPartitions.toArray(new ITypedRegion[fPartitions.size()]);
|
||||
} else {
|
||||
}
|
||||
int end = offset + length;
|
||||
List list = new ArrayList();
|
||||
for (int i = 0; i < fPartitions.size(); i++) {
|
||||
|
@ -159,7 +157,6 @@ public class BuildConsolePartitioner
|
|||
}
|
||||
return (ITypedRegion[])list.toArray(new ITypedRegion[list.size()]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jface.text.IDocumentPartitioner#getPartition(int)
|
||||
|
@ -234,7 +231,8 @@ public class BuildConsolePartitioner
|
|||
}
|
||||
} else {
|
||||
// modify parition offset
|
||||
newPartition = messageConsolePartition.createNewPartition(messageConsolePartition.getOffset()-overflow, messageConsolePartition.getLength());
|
||||
newPartition = messageConsolePartition.createNewPartition(messageConsolePartition.getOffset()
|
||||
- overflow, messageConsolePartition.getLength());
|
||||
}
|
||||
if (newPartition != null) {
|
||||
newParitions.add(newPartition);
|
||||
|
@ -243,7 +241,6 @@ public class BuildConsolePartitioner
|
|||
}
|
||||
fPartitions = newParitions;
|
||||
|
||||
//called from GUI Thread (see startUpdaterThread()), no asyncExec needed.
|
||||
try {
|
||||
fDocument.replace(0, overflow, ""); //$NON-NLS-1$
|
||||
} catch (BadLocationException e) {
|
||||
|
@ -252,11 +249,9 @@ public class BuildConsolePartitioner
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Adds a new colored input partition, combining with the previous
|
||||
* partition if possible.
|
||||
* Adds a new colored input partition, combining with the previous partition
|
||||
* if possible.
|
||||
*/
|
||||
private BuildConsolePartition addPartition(BuildConsolePartition partition) {
|
||||
if (fPartitions.isEmpty()) {
|
||||
|
@ -310,7 +305,6 @@ public class BuildConsolePartitioner
|
|||
flush();
|
||||
}
|
||||
|
||||
|
||||
public synchronized void write(byte[] b, int off, int len) throws IOException {
|
||||
super.write(b, off, len);
|
||||
flush();
|
||||
|
|
Loading…
Add table
Reference in a new issue