1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

bug 304033: Synch with editor action should trigger right away

Patch from Dmitry Kozlov
This commit is contained in:
Andrew Gvozdev 2010-03-02 15:32:04 +00:00
parent 0660433a64
commit cd9a705e11
2 changed files with 27 additions and 2 deletions

View file

@ -290,7 +290,7 @@ public class BuildConsolePage extends Page
fScrollLockAction = new ScrollLockAction(getViewer()); fScrollLockAction = new ScrollLockAction(getViewer());
fNextErrorAction = new NextErrorAction(this); fNextErrorAction = new NextErrorAction(this);
fPreviousErrorAction = new PreviousErrorAction(this); fPreviousErrorAction = new PreviousErrorAction(this);
fShowErrorAction = new ShowErrorAction(); fShowErrorAction = new ShowErrorAction(this);
fScrollLockAction.setChecked(fIsLocked); fScrollLockAction.setChecked(fIsLocked);
getViewer().setAutoScroll(!fIsLocked); getViewer().setAutoScroll(!fIsLocked);

View file

@ -11,17 +11,25 @@
package org.eclipse.cdt.internal.ui.buildconsole; package org.eclipse.cdt.internal.ui.buildconsole;
import org.eclipse.core.resources.IProject;
import org.eclipse.jface.action.Action; import org.eclipse.jface.action.Action;
import org.eclipse.ui.ISharedImages; import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI; import org.eclipse.ui.PlatformUI;
import org.eclipse.cdt.core.resources.IConsole;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.ui.IBuildConsoleManager;
/** /**
* Set whether to show error in editor when moving to next/prev error in Build Console * Set whether to show error in editor when moving to next/prev error in Build Console
*/ */
public class ShowErrorAction extends Action { public class ShowErrorAction extends Action {
public ShowErrorAction() { private BuildConsolePage fConsolePage;
public ShowErrorAction(BuildConsolePage page) {
super(ConsoleMessages.ShowErrorAction_Tooltip); super(ConsoleMessages.ShowErrorAction_Tooltip);
fConsolePage = page;
setChecked(true); setChecked(true);
setToolTipText(ConsoleMessages.ShowErrorAction_Tooltip); setToolTipText(ConsoleMessages.ShowErrorAction_Tooltip);
ISharedImages images = PlatformUI.getWorkbench().getSharedImages(); ISharedImages images = PlatformUI.getWorkbench().getSharedImages();
@ -29,4 +37,21 @@ public class ShowErrorAction extends Action {
setDisabledImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_ELCL_SYNCED_DISABLED)); setDisabledImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_ELCL_SYNCED_DISABLED));
} }
/**
* @see org.eclipse.jface.action.IAction#run()
*/
@Override
public void run() {
super.run();
if ( isChecked() ) {
IProject project = fConsolePage.getProject();
IBuildConsoleManager consoleManager = CUIPlugin.getDefault().getConsoleManager();
IConsole console = consoleManager.getConsole(project);
if ( console instanceof BuildConsolePartitioner) {
BuildConsolePartitioner par = (BuildConsolePartitioner)console;
fConsolePage.showError(par, true );
}
}
}
} }