mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
fixed clearing console
This commit is contained in:
parent
abc8c1ae28
commit
f4ed4e4745
1 changed files with 25 additions and 20 deletions
|
@ -110,6 +110,7 @@ public class BuildConsoleView extends ViewPart implements ISelectionListener, IB
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
fTextViewer.setEditable(false);
|
fTextViewer.setEditable(false);
|
||||||
|
origTitle = getTitle();
|
||||||
initializeWidgetFont(fTextViewer.getTextWidget());
|
initializeWidgetFont(fTextViewer.getTextWidget());
|
||||||
|
|
||||||
initializeActions();
|
initializeActions();
|
||||||
|
@ -118,14 +119,14 @@ public class BuildConsoleView extends ViewPart implements ISelectionListener, IB
|
||||||
|
|
||||||
WorkbenchHelp.setHelp(fTextViewer.getControl(), ICHelpContextIds.CLEAR_CONSOLE_VIEW);
|
WorkbenchHelp.setHelp(fTextViewer.getControl(), ICHelpContextIds.CLEAR_CONSOLE_VIEW);
|
||||||
|
|
||||||
fTextViewer.setDocument(getDocument(getSite().getPage().getSelection()));
|
setProject(getSite().getPage().getSelection());
|
||||||
origTitle = getTitle();
|
setDocument();
|
||||||
setTitle(getSite().getPage().getSelection());
|
setTitle();
|
||||||
getSite().getPage().addSelectionListener(this);
|
getSite().getPage().addSelectionListener(this);
|
||||||
fConsoleManager.addConsoleListener(this);
|
fConsoleManager.addConsoleListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IProject getProject(ISelection selection) {
|
protected IProject setProject(ISelection selection) {
|
||||||
if ( selection == null ) {
|
if ( selection == null ) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -141,26 +142,32 @@ public class BuildConsoleView extends ViewPart implements ISelectionListener, IB
|
||||||
resource = (IResource) input.getAdapter(IResource.class);
|
resource = (IResource) input.getAdapter(IResource.class);
|
||||||
}
|
}
|
||||||
if (resource != null) {
|
if (resource != null) {
|
||||||
return resource.getProject();
|
selProject = resource.getProject();
|
||||||
|
return selProject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (ClassCastException e) {
|
catch (ClassCastException e) {
|
||||||
}
|
}
|
||||||
return null;
|
selProject = null;
|
||||||
|
return selProject;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IDocument getDocument(ISelection selection) {
|
protected IProject getProject() {
|
||||||
IProject project = getProject(selection);
|
return selProject;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected IDocument setDocument() {
|
||||||
|
IProject project = getProject();
|
||||||
if (project != null ) {
|
if (project != null ) {
|
||||||
return fConsoleManager.getConsoleDocument(project);
|
fTextViewer.setDocument(fConsoleManager.getConsoleDocument(project));
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setTitle(ISelection selection) {
|
protected void setTitle() {
|
||||||
String title = origTitle;
|
String title = origTitle;
|
||||||
IProject project = getProject(selection);
|
IProject project = getProject();
|
||||||
if (project != null ) {
|
if (project != null ) {
|
||||||
title += " [" + project.getName() + "]";
|
title += " [" + project.getName() + "]";
|
||||||
}
|
}
|
||||||
|
@ -275,21 +282,19 @@ public class BuildConsoleView extends ViewPart implements ISelectionListener, IB
|
||||||
}
|
}
|
||||||
|
|
||||||
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
|
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
|
||||||
fTextViewer.setDocument(getDocument(selection));
|
setProject(selection);
|
||||||
setTitle(selection);
|
setDocument();
|
||||||
|
setTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void consoleChange(IBuildConsoleEvent event) {
|
public void consoleChange(IBuildConsoleEvent event) {
|
||||||
if ( event.getType() == IBuildConsoleEvent.CONSOLE_START ) {
|
if ( event.getType() == IBuildConsoleEvent.CONSOLE_START ) {
|
||||||
Display display = fTextViewer.getControl().getDisplay();
|
Display display = fTextViewer.getControl().getDisplay();
|
||||||
final IProject project = event.getProject();
|
selProject = event.getProject();
|
||||||
display.asyncExec(new Runnable() {
|
display.asyncExec(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
String title = origTitle;
|
setDocument();
|
||||||
if (project != null ) {
|
setTitle();
|
||||||
title += " [" + project.getName() + "]";
|
|
||||||
}
|
|
||||||
setTitle(title);
|
|
||||||
fTextViewer.setDocument(fConsoleManager.getConsoleDocument(project));
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue